Fix warnings (-Wsign-compare) when building with DEBUG_ADDRMAN #11577

pull practicalswift wants to merge 1 commits into bitcoin:master from practicalswift:DEBUG_ADDRMAN-warnings changing 1 files +4 −4
  1. practicalswift commented at 9:33 AM on October 30, 2017: contributor

    Fix warnings when building with DEBUG_ADDRMAN.

    Warnings prior to this commit:

    addrman.cpp:390:24: warning: comparison of integers of different signs: 'size_type' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (vRandom.size() != nTried + nNew)
            ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~
    addrman.cpp:411:52: warning: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Wsign-compare]
            if (info.nRandomPos < 0 || info.nRandomPos >= vRandom.size() || vRandom[info.nRandomPos] != n)
                                       ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
    addrman.cpp:419:25: warning: comparison of integers of different signs: 'size_type' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (setTried.size() != nTried)
            ~~~~~~~~~~~~~~~ ^  ~~~~~~
    addrman.cpp:421:23: warning: comparison of integers of different signs: 'size_type' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (mapNew.size() != nNew)
            ~~~~~~~~~~~~~ ^  ~~~~
    4 warnings generated.
    
  2. Fix warnings when building with DEBUG_ADDRMAN
    Warnings prior to this commit:
    
    ```
    addrman.cpp:390:24: warning: comparison of integers of different signs: 'size_type' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (vRandom.size() != nTried + nNew)
            ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~
    addrman.cpp:411:52: warning: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Wsign-compare]
            if (info.nRandomPos < 0 || info.nRandomPos >= vRandom.size() || vRandom[info.nRandomPos] != n)
                                       ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
    addrman.cpp:419:25: warning: comparison of integers of different signs: 'size_type' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (setTried.size() != nTried)
            ~~~~~~~~~~~~~~~ ^  ~~~~~~
    addrman.cpp:421:23: warning: comparison of integers of different signs: 'size_type' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (mapNew.size() != nNew)
            ~~~~~~~~~~~~~ ^  ~~~~
    4 warnings generated.
    ```
    6eddd43e6d
  3. fanquake added the label P2P on Oct 30, 2017
  4. fanquake added the label Refactoring on Oct 30, 2017
  5. promag commented at 11:03 AM on November 5, 2017: member

    Other options are to cast (int) mapNew.size() or to change nNew and nTried types.

  6. practicalswift commented at 7:12 PM on November 21, 2017: contributor

    Anyone willing to review? :-)

  7. sipa commented at 2:22 AM on November 22, 2017: member

    Concept ACK

  8. practicalswift commented at 10:49 AM on January 28, 2018: contributor

    Any chance of merge or should I close? :-)

  9. laanwj commented at 1:26 PM on January 29, 2018: member

    utACK 6eddd43e6d2222895a4b8e7fae800b919131db66

  10. laanwj merged this on Jan 29, 2018
  11. laanwj closed this on Jan 29, 2018

  12. laanwj referenced this in commit c0ae864ef5 on Jan 29, 2018
  13. PastaPastaPasta referenced this in commit fccf28b6a0 on Jan 26, 2020
  14. jasonbcox referenced this in commit aae83510c8 on Oct 31, 2020
  15. ckti referenced this in commit ef142b6200 on Mar 28, 2021
  16. practicalswift deleted the branch on Apr 10, 2021
  17. gades referenced this in commit d50f993900 on Jun 24, 2021
  18. gades referenced this in commit ceccdd0147 on Feb 11, 2022
  19. DrahtBot locked this on Aug 16, 2022

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-16 15:15 UTC

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