Use the more readable form ...
&vchRet[vchRet.size() - 4]
... instead of ...
&v.end()[-n]
Has the added benefit of eliminating a spurious static analyzer warning about improper use of negative values.
Use the more readable form ...
&vchRet[vchRet.size() - 4]
... instead of ...
&v.end()[-n]
Has the added benefit of eliminating a spurious static analyzer warning about improper use of negative values.
utACK 6ab2ce8.
This seems to be an over-cosmetic change... not sure if its worth. utACK 6ab2ce83d9268fc81ac3bec41365ce2d2adfd349
135 | @@ -136,7 +136,7 @@ bool DecodeBase58Check(const char* psz, std::vector<unsigned char>& vchRet) 136 | } 137 | // re-calculate the checksum, ensure it matches the included 4-byte checksum 138 | uint256 hash = Hash(vchRet.begin(), vchRet.end() - 4); 139 | - if (memcmp(&hash, &vchRet.end()[-4], 4) != 0) { 140 | + if (memcmp(&hash, vchRet.data() + vchRet.size() - 4, 4) != 0) {
I guess there's some reason vchRet.end() - 4 doesn't work (pointer versus iterator conflict or something like that)?
Yeah vchRet.end()-4 would still be an iterator I believe, so you'd have to do some ugly thing like &*(vchRet.end()-4) to make it into a pointer iirc?
How about &vchRet[vchRet.size() - 4] ?
Believe that would work, and yeah that's a lot clearer imo 👍
@laanwj @MeshCollider @sipa Thanks for reviewing! Changed to &vchRet[vchRet.size() - 4]. Looks good? :-)
Just confirmed this should be identical behavior, ACK https://github.com/bitcoin/bitcoin/pull/10961/commits/c6a995e7e5e6ae37dc1684f6060038e96864e947
Travis have completed without errors, but GitHub still reports "1 pending check".
Seems like Travis CI is stuck. Anyone able to re-start Travis? :-)
utACK c6a995e7e5e6ae37dc1684f6060038e96864e947
utACK c6a995e7e5e6ae37dc1684f6060038e96864e947