9
9
10
10
using namespace std ;
11
11
12
+ static bool json_isdigit (int ch)
13
+ {
14
+ return ((ch >= ' 0' ) && (ch <= ' 9' ));
15
+ }
16
+
12
17
// convert hexadecimal string to unsigned integer
13
18
static const char *hatoui (const char *first, const char *last,
14
19
unsigned int & out)
@@ -17,7 +22,7 @@ static const char *hatoui(const char *first, const char *last,
17
22
for (; first != last; ++first)
18
23
{
19
24
int digit;
20
- if (isdigit (*first))
25
+ if (json_isdigit (*first))
21
26
digit = *first - ' 0' ;
22
27
23
28
else if (*first >= ' a' && *first <= ' f' )
@@ -44,7 +49,7 @@ enum jtokentype getJsonToken(string& tokenVal, unsigned int& consumed,
44
49
45
50
const char *rawStart = raw;
46
51
47
- while ((*raw) && (isspace (*raw))) // skip whitespace
52
+ while ((*raw) && (json_isspace (*raw))) // skip whitespace
48
53
raw++;
49
54
50
55
switch (*raw) {
@@ -113,18 +118,18 @@ enum jtokentype getJsonToken(string& tokenVal, unsigned int& consumed,
113
118
const char *first = raw;
114
119
115
120
const char *firstDigit = first;
116
- if (!isdigit (*firstDigit))
121
+ if (!json_isdigit (*firstDigit))
117
122
firstDigit++;
118
- if ((*firstDigit == ' 0' ) && isdigit (firstDigit[1 ]))
123
+ if ((*firstDigit == ' 0' ) && json_isdigit (firstDigit[1 ]))
119
124
return JTOK_ERR;
120
125
121
126
numStr += *raw; // copy first char
122
127
raw++;
123
128
124
- if ((*first == ' -' ) && (!isdigit (*raw)))
129
+ if ((*first == ' -' ) && (!json_isdigit (*raw)))
125
130
return JTOK_ERR;
126
131
127
- while ((*raw) && isdigit (*raw)) { // copy digits
132
+ while ((*raw) && json_isdigit (*raw)) { // copy digits
128
133
numStr += *raw;
129
134
raw++;
130
135
}
@@ -134,9 +139,9 @@ enum jtokentype getJsonToken(string& tokenVal, unsigned int& consumed,
134
139
numStr += *raw; // copy .
135
140
raw++;
136
141
137
- if (!isdigit (*raw))
142
+ if (!json_isdigit (*raw))
138
143
return JTOK_ERR;
139
- while ((*raw) && isdigit (*raw)) { // copy digits
144
+ while ((*raw) && json_isdigit (*raw)) { // copy digits
140
145
numStr += *raw;
141
146
raw++;
142
147
}
@@ -152,9 +157,9 @@ enum jtokentype getJsonToken(string& tokenVal, unsigned int& consumed,
152
157
raw++;
153
158
}
154
159
155
- if (!isdigit (*raw))
160
+ if (!json_isdigit (*raw))
156
161
return JTOK_ERR;
157
- while ((*raw) && isdigit (*raw)) { // copy digits
162
+ while ((*raw) && json_isdigit (*raw)) { // copy digits
158
163
numStr += *raw;
159
164
raw++;
160
165
}
0 commit comments