|
16 | 16 | #include <version.h> |
17 | 17 |
|
18 | 18 | #include <boost/algorithm/string/classification.hpp> |
19 | | -#include <boost/algorithm/string/predicate.hpp> |
20 | 19 | #include <boost/algorithm/string/replace.hpp> |
21 | 20 | #include <boost/algorithm/string/split.hpp> |
22 | 21 |
|
| 22 | +#include <algorithm> |
| 23 | + |
23 | 24 | CScript ParseScript(const std::string& s) |
24 | 25 | { |
25 | 26 | CScript result; |
@@ -54,20 +55,20 @@ CScript ParseScript(const std::string& s) |
54 | 55 | { |
55 | 56 | // Empty string, ignore. (boost::split given '' will return one word) |
56 | 57 | } |
57 | | - else if (all(*w, boost::algorithm::is_digit()) || |
58 | | - (boost::algorithm::starts_with(*w, "-") && all(std::string(w->begin()+1, w->end()), boost::algorithm::is_digit()))) |
| 58 | + else if (std::all_of(w->begin(), w->end(), ::IsDigit) || |
| 59 | + (w->front() == '-' && w->size() > 1 && std::all_of(w->begin()+1, w->end(), ::IsDigit))) |
59 | 60 | { |
60 | 61 | // Number |
61 | 62 | int64_t n = atoi64(*w); |
62 | 63 | result << n; |
63 | 64 | } |
64 | | - else if (boost::algorithm::starts_with(*w, "0x") && (w->begin()+2 != w->end()) && IsHex(std::string(w->begin()+2, w->end()))) |
| 65 | + else if (w->substr(0,2) == "0x" && w->size() > 2 && IsHex(std::string(w->begin()+2, w->end()))) |
65 | 66 | { |
66 | 67 | // Raw hex data, inserted NOT pushed onto stack: |
67 | 68 | std::vector<unsigned char> raw = ParseHex(std::string(w->begin()+2, w->end())); |
68 | 69 | result.insert(result.end(), raw.begin(), raw.end()); |
69 | 70 | } |
70 | | - else if (w->size() >= 2 && boost::algorithm::starts_with(*w, "'") && boost::algorithm::ends_with(*w, "'")) |
| 71 | + else if (w->size() >= 2 && w->front() == '\'' && w->back() == '\'') |
71 | 72 | { |
72 | 73 | // Single-quoted string, pushed as data. NOTE: this is poor-man's |
73 | 74 | // parsing, spaces/tabs/newlines in single-quoted strings won't work. |
|
0 commit comments