-
Couldn't load subscription status.
- Fork 93
Reduced compiler warnings #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -459,8 +459,10 @@ bool CommandLine::ReadArgs(int argc, const char * const *argv) | |
| { | ||
| case 'g': | ||
| redundancysize = redundancysize * 1024; | ||
| break; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This must deliberatly fallthrough so the reduncancysize is multiplied more with the given modifier |
||
| case 'm': | ||
| redundancysize = redundancysize * 1024; | ||
| break; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This must deliberatly fallthrough so the reduncancysize is multiplied more with the given modifier (same as above ) |
||
| case 'k': | ||
| redundancysize = redundancysize * 1024; | ||
| break; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,8 @@ u32 gcd(u32 a, u32 b) | |
|
|
||
| template <> bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present, std::ostream &sout, std::ostream &serr) | ||
| { | ||
| (void) sout; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you elaborate why this is added and potentially separate these changes in a separate commit? |
||
| (void) serr; | ||
| inputcount = (u32)present.size(); | ||
|
|
||
| datapresentindex = new u32[inputcount]; | ||
|
|
@@ -83,6 +85,8 @@ template <> bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present, std | |
|
|
||
| template <> bool ReedSolomon<Galois8>::SetInput(u32 count, std::ostream &sout, std::ostream &serr) | ||
| { | ||
| (void) sout; | ||
| (void) serr; | ||
| inputcount = count; | ||
|
|
||
| datapresentindex = new u32[inputcount]; | ||
|
|
@@ -185,6 +189,8 @@ template <> bool ReedSolomon<Galois8>::InternalProcess(const Galois8 &factor, si | |
| // and compute the base values to use for the vandermonde matrix. | ||
| template <> bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present, std::ostream &sout, std::ostream &serr) | ||
| { | ||
| (void) sout; | ||
| (void) serr; | ||
| inputcount = (u32)present.size(); | ||
|
|
||
| datapresentindex = new u32[inputcount]; | ||
|
|
@@ -229,6 +235,8 @@ template <> bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present, st | |
| // and compute the base values to use for the vandermonde matrix. | ||
| template <> bool ReedSolomon<Galois16>::SetInput(u32 count, std::ostream &sout, std::ostream &serr) | ||
| { | ||
| (void) sout; | ||
| (void) serr; | ||
| inputcount = count; | ||
|
|
||
| datapresentindex = new u32[inputcount]; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you elaborate here why this change is needed and potentially separate it in a commit with the explanation? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,21 +247,25 @@ inline bool ReedSolomon<g>::Compute(NoiseLevel noiselevel, std::ostream &sout, s | |
| |(dpi[col]) | | |(dmi[col]) | | | ||
| \ | / \ | / | ||
| */ | ||
|
|
||
| // Allocate the left hand matrix | ||
|
|
||
| leftmatrix = new G[outcount * incount]; | ||
| memset(leftmatrix, 0, outcount * incount * sizeof(G)); | ||
|
|
||
| // Allocate the right hand matrix only if we are recovering | ||
| // Use value initialization to initialize each element in the matrix to zero (or its default state) | ||
| for (size_t i = 0; i < outcount * incount; ++i) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can just remove the memset in this case and there is no need to pre-allocate anything since the next part will fill the matrix anyway, same for the rightmatrix |
||
| leftmatrix[i] = G(); // Default-construct each element (initialize to zero if G's constructor does that) | ||
| } | ||
|
|
||
| G *rightmatrix = 0; | ||
| // Allocate the right hand matrix only if we are recovering | ||
| G *rightmatrix = nullptr; | ||
| if (datamissing > 0) | ||
| { | ||
| rightmatrix = new G[outcount * outcount]; | ||
| memset(rightmatrix, 0, outcount *outcount * sizeof(G)); | ||
| rightmatrix = new G[outcount * outcount]; | ||
|
|
||
| // Similarly, initialize the rightmatrix elements | ||
| for (size_t i = 0; i < outcount * outcount; ++i) { | ||
| rightmatrix[i] = G(); // Default-construct each element | ||
| } | ||
| } | ||
|
|
||
| // Fill in the two matrices: | ||
|
|
||
| vector<RSOutputRow>::const_iterator outputrow = outputrows.begin(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -508,7 +508,7 @@ int test4(int NUM_IN, int *expected_bases) { | |
| for (int i = 0; i < NUM_IN; i++) { | ||
| // read little-endian value | ||
| utype v = 0; | ||
| for (int byte_index = 0; byte_index < sizeof(utype); byte_index++) { | ||
| for (long unsigned int byte_index = 0; byte_index < sizeof(utype); byte_index++) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No it was not, this change was made to reduce compiler warnings as the name of the PR suggests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check the C++ standard (any version). There are no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right Rhialto, it should be size_t. |
||
| u8 byte = data[NUM_IN+0][sizeof(utype)*i + byte_index]; | ||
| v |= (((utype)byte) << (byte_index*8)); | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removal of blocksize (unused I guess) should also be a separate commit with some explanation also referring to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should have been a separate commit since this update is generated