Skip to content

Conversation

@practicalswift
Copy link
Contributor

@practicalswift practicalswift commented Oct 29, 2018

  • Use ToLower(...) instead of std::tolower. std::tolower is locale dependent.
  • Use IsDigit(...) instead of std::isdigit. Some implementations (e.g. Microsoft in 1252 codepage) may classify single-byte characters other than [0-9] as digits.
  • Update KNOWN_VIOLATIONS: Remove fixed violations.
  • Replace use of locale dependent Boost trim (boost::trim) with locale independent TrimString.
  • Use IsSpace(...) instead of boost::is_space

@ken2812221
Copy link
Contributor

ken2812221 commented Oct 29, 2018

utACK 25fc82ccf0d48b5c4d35d47b657c4ba5945c8d3c require #include <utilstrencoding.h> in wallet disabled configure.

I wonder that if this linter has a Good job! ... locale dependency removed error.

@practicalswift practicalswift force-pushed the no-more-locale branch 2 times, most recently from 389d144 to 336d6af Compare October 29, 2018 09:56
@practicalswift
Copy link
Contributor Author

practicalswift commented Oct 29, 2018

@ken2812221 Thanks for the quick review! Please re-review :-)

The locale linter doesn't have the positive "Good job!" message (in the case a dependency in KNOWN_VIOLATIONS is removed). That would have been nice though :-)

@practicalswift practicalswift force-pushed the no-more-locale branch 3 times, most recently from ee2433b to c49621b Compare October 30, 2018 15:59
@practicalswift practicalswift changed the title Use functions guaranteed to be locale independent (IsDigit, ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Use functions guaranteed to be locale independent (IsDigit, ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Remove the use of locale dependent boost::trim(...). Oct 30, 2018
@practicalswift
Copy link
Contributor Author

Added commit:

  • Replace use of locale dependent Boost trim (boost::trim) with locale independent TrimString.

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 30, 2018

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #13751 (Utils and libraries: Drops the boost/algorithm/string/split.hpp dependency by 251Labs)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@laanwj
Copy link
Member

laanwj commented Nov 1, 2018

utACK apart from the rtrim to trim change

@practicalswift
Copy link
Contributor Author

Rebased!

@practicalswift practicalswift force-pushed the no-more-locale branch 2 times, most recently from 02727e0 to 2f3ae54 Compare November 5, 2018 22:03
@practicalswift
Copy link
Contributor Author

practicalswift commented Nov 5, 2018

Added another commit: 2f3ae54ac6dd2fe36c2f469d3b96b2a7bfb5ce90 ("Use IsSpace(...) instead of boost::is_space")

Please review :-)

@practicalswift practicalswift changed the title Use functions guaranteed to be locale independent (IsDigit, ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Remove the use of locale dependent boost::trim(...). Use functions guaranteed to be locale independent (IsDigit, ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Remove the use of locale dependent boost::trim(...) and boost::is_space(...) Nov 5, 2018
@practicalswift
Copy link
Contributor Author

@MarcoFalke @laanwj I've now excluded the trim change to make reviewing easier. Please re-review :-)

@practicalswift practicalswift changed the title Use functions guaranteed to be locale independent (IsDigit, ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Remove the use of locale dependent boost::trim(...) and boost::is_space(...) Use functions guaranteed to be locale independent (IsDigit, ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Remove the use of locale dependent boost::is_space(...) Nov 6, 2018
@maflcko
Copy link
Member

maflcko commented Nov 8, 2018

utACK 7c9f790

@hebasto
Copy link
Member

hebasto commented Dec 6, 2018

utACK 8931a95

@maflcko
Copy link
Member

maflcko commented Dec 6, 2018

re-utACK 8931a95

@maflcko maflcko added this to the 0.18.0 milestone Dec 6, 2018
@practicalswift
Copy link
Contributor Author

@laanwj @ken2812221 Would you mind re-reviewing? :-)


// skip 0x
if (psz[0] == '0' && tolower(psz[1]) == 'x')
if (psz[0] == '0' && ToLower((unsigned char)psz[1]) == 'x')
Copy link
Member

Choose a reason for hiding this comment

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

It's kind of strange for a ToLower function to take an unsigned char (because std::strings index as char), but that's not introduced in this PR.

@laanwj
Copy link
Member

laanwj commented Jan 9, 2019

re-utACK 8931a95

@laanwj laanwj merged commit 8931a95 into bitcoin:master Jan 9, 2019
laanwj added a commit that referenced this pull request Jan 9, 2019
…git, ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Remove the use of locale dependent boost::is_space(...)

8931a95 Include util/strencodings.h which is required for IsSpace(...) (practicalswift)
7c9f790 Update KNOWN_VIOLATIONS: Remove fixed violations (practicalswift)
587924f Use IsSpace(...) instead of boost::is_space (practicalswift)
c5fd143 Use ToLower(...) instead of std::tolower (practicalswift)
e70cc89 Use IsDigit(...) instead of std::isdigit (practicalswift)

Pull request description:

  * Use `ToLower(...)` instead of `std::tolower`. `std::tolower` is locale dependent.
  * Use `IsDigit(...)` instead of `std::isdigit`. Some implementations (e.g. Microsoft in 1252 codepage) may classify single-byte characters other than `[0-9]` as digits.
  * Update `KNOWN_VIOLATIONS`: Remove fixed violations.
  * ~~Replace use of locale dependent Boost trim (`boost::trim`) with locale independent `TrimString`.~~
  * Use` IsSpace(...)` instead of `boost::is_space`

Tree-SHA512: defed016136b530b723fa185afdbd00410925a748856ba3afa4cee60f61a67617e30f304f2b9991a67b5fe075d9624f051e14342aee176f45fbc024d59e1aa82
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jun 2, 2020
Summary:
Use IsDigit(...) instead of std::isdigit
Use ToLower(...) instead of std::tolower
Use IsSpace(...) instead of boost::is_space
Update KNOWN_VIOLATIONS: Remove fixed violations

---

Backport of Core [[bitcoin/bitcoin#14599 | PR14599]]

Test Plan:
  ninja check

Reviewers: #bitcoin_abc, jasonbcox, deadalnix

Reviewed By: #bitcoin_abc, jasonbcox, deadalnix

Subscribers: deadalnix, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D6294
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Aug 17, 2020
Summary:
Use IsDigit(...) instead of std::isdigit
Use ToLower(...) instead of std::tolower
Use IsSpace(...) instead of boost::is_space
Update KNOWN_VIOLATIONS: Remove fixed violations

---

Backport of Core [[bitcoin/bitcoin#14599 | PR14599]]

Test Plan:
  ninja check

Reviewers: #bitcoin_abc, jasonbcox, deadalnix

Reviewed By: #bitcoin_abc, jasonbcox, deadalnix

Subscribers: deadalnix, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D6294
@practicalswift practicalswift deleted the no-more-locale branch April 10, 2021 19:36
dzutto pushed a commit to dzutto/dash that referenced this pull request Sep 9, 2021
…t (IsDigit, ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Remove the use of locale dependent boost::is_space(...)

8931a95 Include util/strencodings.h which is required for IsSpace(...) (practicalswift)
7c9f790 Update KNOWN_VIOLATIONS: Remove fixed violations (practicalswift)
587924f Use IsSpace(...) instead of boost::is_space (practicalswift)
c5fd143 Use ToLower(...) instead of std::tolower (practicalswift)
e70cc89 Use IsDigit(...) instead of std::isdigit (practicalswift)

Pull request description:

  * Use `ToLower(...)` instead of `std::tolower`. `std::tolower` is locale dependent.
  * Use `IsDigit(...)` instead of `std::isdigit`. Some implementations (e.g. Microsoft in 1252 codepage) may classify single-byte characters other than `[0-9]` as digits.
  * Update `KNOWN_VIOLATIONS`: Remove fixed violations.
  * ~~Replace use of locale dependent Boost trim (`boost::trim`) with locale independent `TrimString`.~~
  * Use` IsSpace(...)` instead of `boost::is_space`

Tree-SHA512: defed016136b530b723fa185afdbd00410925a748856ba3afa4cee60f61a67617e30f304f2b9991a67b5fe075d9624f051e14342aee176f45fbc024d59e1aa82
UdjinM6 added a commit to dashpay/dash that referenced this pull request Sep 9, 2021
Merge bitcoin bitcoin#14585, bitcoin#14599: Use functions guaranteed to be locale independent
malbit added a commit to malbit/raptoreum that referenced this pull request Apr 10, 2022
more info: https://wiki.qt.io/New_Signal_Slot_Syntax + https://stackoverflow.com/a/16795664

+ Fix broken notificator on GNOME
+ Do not use systray on systems which do not support systray
+ Global specified name for CoinJoin to be constant through the build + Qt
+ SmartnodeTab at GUI should work with no wallet loaded
+ TxFee setting is non-static now [refs](bitcoin/bitcoin#12909)
+ Filter out macOS process serial number. [refs](bitcoin/bitcoin#17184)
+ Conversion to Windows args to be utf-8 string before parsing them to the Core/Wallet. [refs](bitcoin/bitcoin#13883)
+ Statically specified functions which are used widely along codebase to be Guaranteed Locale Independent. [refs](bitcoin/bitcoin#14599)
+ macOS bug-fixes [refs](bitcoin/bitcoin#17887) , [refs](bitcoin/bitcoin#15040)
+ refactored Timefunctions to be Thread-Safe
+ added support to multiwallet
+ refactored locks with fixes to deadlocks
+ boost::program_options and boost::chrono are NOT IN USE anymore and are deleted from the codebase
+ ArgsManager slightly refactored
+ Hidden Command-Line Arguments added
+ IsServiceEnabled (e.g. zmq, wallet) command_line arguments visibility activation (if certain service is not enabled, all cli commands related to that service will not be shown)
+ Other fixes and tweaks
gades pushed a commit to cosanta/cosanta-core that referenced this pull request May 9, 2022
…t (IsDigit, ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Remove the use of locale dependent boost::is_space(...)

8931a95 Include util/strencodings.h which is required for IsSpace(...) (practicalswift)
7c9f790 Update KNOWN_VIOLATIONS: Remove fixed violations (practicalswift)
587924f Use IsSpace(...) instead of boost::is_space (practicalswift)
c5fd143 Use ToLower(...) instead of std::tolower (practicalswift)
e70cc89 Use IsDigit(...) instead of std::isdigit (practicalswift)

Pull request description:

  * Use `ToLower(...)` instead of `std::tolower`. `std::tolower` is locale dependent.
  * Use `IsDigit(...)` instead of `std::isdigit`. Some implementations (e.g. Microsoft in 1252 codepage) may classify single-byte characters other than `[0-9]` as digits.
  * Update `KNOWN_VIOLATIONS`: Remove fixed violations.
  * ~~Replace use of locale dependent Boost trim (`boost::trim`) with locale independent `TrimString`.~~
  * Use` IsSpace(...)` instead of `boost::is_space`

Tree-SHA512: defed016136b530b723fa185afdbd00410925a748856ba3afa4cee60f61a67617e30f304f2b9991a67b5fe075d9624f051e14342aee176f45fbc024d59e1aa82
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants