aboutsummaryrefslogtreecommitdiff
path: root/src/utilstrencodings.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-07-24 14:49:54 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-07-24 14:50:05 -0400
commit1211b15bf6c0b2904d90b96a9b3834c5cb9e7b4e (patch)
treef759e03bdb78463726b80e83c1ce189773bb50de /src/utilstrencodings.cpp
parent7a9bca61fa5598455d854662a68b560725341f20 (diff)
parente3245f2e7b6f98cda38a3806da854f7d513fec2f (diff)
downloadbitcoin-1211b15bf6c0b2904d90b96a9b3834c5cb9e7b4e.tar.xz
Merge #13656: Remove the boost/algorithm/string/predicate.hpp dependency
e3245f2e7b Removes Boost predicate.hpp dependency (251) Pull request description: This pull request removes the `boost/algorithm/string/predicate.hpp` dependency from the project. To replace the the `predicate.hpp` dependency from the project the function calls to `boost::algorithm::starts_with` and `boost::algorithm::ends_with` have been replaced with respectively C++11's `std::basic_string::front` and `std::basic_string::back` function calls. Refactors that were not required, but have been done anyways: - The Boost function `all` was implicitly made available via the `predicate.hpp` header. Instead of including the appropriate header, function calls to `all` have been replaced with function calls to `std::all_of`. - The `boost::algorithm::is_digit` predicate has been replaced with a custom `IsDigit` function that is locale independent and ASCII deterministic. Tree-SHA512: 22dda6adfb4d7ac0cabac8cc33e8fb8330c899805acc1ae4ede402c4b11ea75a399414b389dfaa3650d23b47f41351b4650077af9005d598fbe48d5277bdc320
Diffstat (limited to 'src/utilstrencodings.cpp')
-rw-r--r--src/utilstrencodings.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/utilstrencodings.cpp b/src/utilstrencodings.cpp
index d1025fc7bf..c6927021cb 100644
--- a/src/utilstrencodings.cpp
+++ b/src/utilstrencodings.cpp
@@ -473,7 +473,7 @@ bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
/* pass single 0 */
++ptr;
} else if (val[ptr] >= '1' && val[ptr] <= '9') {
- while (ptr < end && val[ptr] >= '0' && val[ptr] <= '9') {
+ while (ptr < end && IsDigit(val[ptr])) {
if (!ProcessMantissaDigit(val[ptr], mantissa, mantissa_tzeros))
return false; /* overflow */
++ptr;
@@ -483,9 +483,9 @@ bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
if (ptr < end && val[ptr] == '.')
{
++ptr;
- if (ptr < end && val[ptr] >= '0' && val[ptr] <= '9')
+ if (ptr < end && IsDigit(val[ptr]))
{
- while (ptr < end && val[ptr] >= '0' && val[ptr] <= '9') {
+ while (ptr < end && IsDigit(val[ptr])) {
if (!ProcessMantissaDigit(val[ptr], mantissa, mantissa_tzeros))
return false; /* overflow */
++ptr;
@@ -502,8 +502,8 @@ bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
exponent_sign = true;
++ptr;
}
- if (ptr < end && val[ptr] >= '0' && val[ptr] <= '9') {
- while (ptr < end && val[ptr] >= '0' && val[ptr] <= '9') {
+ if (ptr < end && IsDigit(val[ptr])) {
+ while (ptr < end && IsDigit(val[ptr])) {
if (exponent > (UPPER_BOUND / 10LL))
return false; /* overflow */
exponent = exponent * 10 + val[ptr] - '0';