@@ -21,7 +21,7 @@ CScript ParseScript(std::string s)
21
21
22
22
static map<string, opcodetype> mapOpNames;
23
23
24
- if (mapOpNames.size () == 0 )
24
+ if (mapOpNames.empty () )
25
25
{
26
26
for (int op = 0 ; op <= OP_NOP10; op++)
27
27
{
@@ -43,36 +43,36 @@ CScript ParseScript(std::string s)
43
43
vector<string> words;
44
44
split (words, s, is_any_of (" \t\n " ), token_compress_on);
45
45
46
- BOOST_FOREACH ( string w, words)
46
+ for (std::vector<std:: string>::const_iterator w = words. begin (); w != words. end (); ++w )
47
47
{
48
- if (w. size () == 0 )
48
+ if (w-> empty () )
49
49
{
50
50
// Empty string, ignore. (boost::split given '' will return one word)
51
51
}
52
- else if (all (w, is_digit ()) ||
53
- (starts_with (w, " -" ) && all (string (w. begin ()+1 , w. end ()), is_digit ())))
52
+ else if (all (* w, is_digit ()) ||
53
+ (starts_with (* w, " -" ) && all (string (w-> begin ()+1 , w-> end ()), is_digit ())))
54
54
{
55
55
// Number
56
- int64_t n = atoi64 (w);
56
+ int64_t n = atoi64 (* w);
57
57
result << n;
58
58
}
59
- else if (starts_with (w, " 0x" ) && IsHex (string (w. begin ()+2 , w. end ())))
59
+ else if (starts_with (* w, " 0x" ) && (w-> begin ()+ 2 != w-> end ()) && IsHex (string (w-> begin ()+2 , w-> end ())))
60
60
{
61
61
// Raw hex data, inserted NOT pushed onto stack:
62
- std::vector<unsigned char > raw = ParseHex (string (w. begin ()+2 , w. end ()));
62
+ std::vector<unsigned char > raw = ParseHex (string (w-> begin ()+2 , w-> end ()));
63
63
result.insert (result.end (), raw.begin (), raw.end ());
64
64
}
65
- else if (w. size () >= 2 && starts_with (w, " '" ) && ends_with (w, " '" ))
65
+ else if (w-> size () >= 2 && starts_with (* w, " '" ) && ends_with (* w, " '" ))
66
66
{
67
67
// Single-quoted string, pushed as data. NOTE: this is poor-man's
68
68
// parsing, spaces/tabs/newlines in single-quoted strings won't work.
69
- std::vector<unsigned char > value (w. begin ()+1 , w. end ()-1 );
69
+ std::vector<unsigned char > value (w-> begin ()+1 , w-> end ()-1 );
70
70
result << value;
71
71
}
72
- else if (mapOpNames.count (w))
72
+ else if (mapOpNames.count (* w))
73
73
{
74
74
// opcode, e.g. OP_ADD or ADD:
75
- result << mapOpNames[w];
75
+ result << mapOpNames[* w];
76
76
}
77
77
else
78
78
{
0 commit comments