Skip to content

Fix sign comparison warnings#437

Open
MitchellCash wants to merge 6 commits intoPaycoinFoundation:masterfrom
MitchellCash:sign-compare
Open

Fix sign comparison warnings#437
MitchellCash wants to merge 6 commits intoPaycoinFoundation:masterfrom
MitchellCash:sign-compare

Conversation

@MitchellCash
Copy link
Contributor

This does take some thunder from #366 but I think the commit messages are more detailed and it also includes some extra changes/improvements that #366 does not.

@IngCr3at1on
Copy link
Contributor

@MitchellCash so does this more or less replace #366?

Jeff Garzik and others added 3 commits February 19, 2016 12:18
to eliminate signed/unsigned comparison warnings
nFile's null value is -1.  Cast that to unsigned int, to avoid warning.

Additionally, avoid nFile==0 because the first valid value is 1.
@MitchellCash
Copy link
Contributor Author

@IngCr3at1on now it does ;)

if (nRndPos1 == nRndPos2)
return;

assert(nRndPos1 >= 0 && nRndPos2 >= 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So essentially this is meant to ensure that the RndPos# variables are positive...

I'm wondering if there is any chance that they could ever be negative (if they were and this was left in place it would actually crash the application; I'm not sure what the behavior would be with this check missing); just because it was removed in Bitcoin doesn't necessarily mean it's safe or a good idea for us to remove it though...

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants