Fix many sign-comparison warnings found in bitcoin codebase #1106

pull jgarzik wants to merge 6 commits into bitcoin:master from jgarzik:sign-compare changing 17 files +68 −68
  1. jgarzik commented at 9:01 PM on April 15, 2012: contributor

    Sign comparison warnings are the largest class of warnings remaining. These commits fix many of the warnings -- which were indeed valid.

    The commits were broken up to make reviewing easier.

  2. The string class returns string::npos, when find() fails.
    Noticed when sign-comparison warnings were enabled.
    ab9dc75a18
  3. Fix loop index var types, fixing many minor sign comparison warnings
    foo.size() typically returns an unsigned integral type; make loop variables
    match those types' signedness.
    c376ac359e
  4. Fix sign-compare warnings: netbase's Lookup* max-solutions may be unsigned 3a78f82a78
  5. serialize.h: CAutoFile's read and write may take size_t nSize c3fad8350b
  6. CNode's nHeaderStart may be negative, so change its type 0dd710acb6
  7. Fix misc. minor sign-comparison warnings 9fb89c26f3
  8. laanwj commented at 5:51 AM on April 16, 2012: member

    ACK

    Is this enough to remove -Wno-sign-compare from the build? Or are there still a lot of these warnings left even after this?

  9. jgarzik commented at 6:20 AM on April 16, 2012: contributor

    Still too many left in the headers, to remove -Wno-sign-compare. Several key classes exported directly to the network assign and test 'unsigned int' types against -1. A few other warnings require some thinking as well. My patches get 75% of the warnings maybe.

  10. gavinandresen commented at 11:55 PM on April 16, 2012: contributor

    ACK

  11. gavinandresen referenced this in commit b97d54355e on Apr 17, 2012
  12. gavinandresen merged this on Apr 17, 2012
  13. gavinandresen closed this on Apr 17, 2012

  14. coblee referenced this in commit 6d771dc201 on Jul 17, 2012
  15. suprnurd referenced this in commit ce8e81d752 on Dec 5, 2017
  16. suprnurd referenced this in commit 62bf64261d on Dec 5, 2017
  17. suprnurd referenced this in commit 74772d336d on Dec 5, 2017
  18. suprnurd referenced this in commit 3b83dd4fd6 on Dec 5, 2017
  19. lateminer referenced this in commit e767896a13 on Jan 22, 2019
  20. DrahtBot locked this on Sep 8, 2021
Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-20 00:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me