@@ -250,7 +250,7 @@ bool match(char c, const std::string& text, size_t& pos, size_t end) {
250
250
return true ;
251
251
}
252
252
253
- bool match_prefix (const char * prefix, const std::string& text, size_t & pos, size_t end) {
253
+ bool match (const char * prefix, const std::string& text, size_t & pos, size_t end) {
254
254
size_t length = strlen (prefix);
255
255
if (length + pos > end)
256
256
return false ;
@@ -264,16 +264,13 @@ bool match_prefix(const char* prefix, const std::string& text, size_t& pos, size
264
264
}
265
265
266
266
void skip_whitespace (const std::string& text, size_t & pos, size_t end){
267
- while ((pos < end) && (text[pos] == ' ' )) {
267
+ while ((pos < end) && (text[pos] == ' ' )) {
268
268
pos++;
269
269
}
270
270
}
271
271
272
272
Color parseHexRGB (const std::string& css_str, size_t pos, size_t end, bool & valid) {
273
-
274
273
int read = 0 ;
275
-
276
- // const char* str = css_str.c_str() + pos;
277
274
int64_t iv = parse_int (css_str, pos, read, 16 );
278
275
if (iv < 0 ) {
279
276
// Invalid: out of range.
@@ -477,14 +474,14 @@ Color CSSColorParser::parse(const std::string& css_str, bool& valid) {
477
474
478
475
case ' r' :
479
476
case ' R' :
480
- if (match_prefix (" rgb" , css_str, pos, end)) {
477
+ if (match (" rgb" , css_str, pos, end)) {
481
478
return parseRGB (css_str, pos, end, valid);
482
479
}
483
480
break ;
484
481
485
482
case ' h' :
486
483
case ' H' :
487
- if (match_prefix (" hsl" , css_str, pos, end)) {
484
+ if (match (" hsl" , css_str, pos, end)) {
488
485
return parseHSL (css_str, pos, end, valid);
489
486
}
490
487
break ;
0 commit comments