Skip to content
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

Fix sign comparison warnings #437

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

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