@@ -250,7 +250,7 @@ bool match(char c, const std::string& text, size_t& pos, size_t end) {
250250 return true ;
251251}
252252
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) {
254254 size_t length = strlen (prefix);
255255 if (length + pos > end)
256256 return false ;
@@ -264,16 +264,13 @@ bool match_prefix(const char* prefix, const std::string& text, size_t& pos, size
264264}
265265
266266void skip_whitespace (const std::string& text, size_t & pos, size_t end){
267- while ((pos < end) && (text[pos] == ' ' )) {
267+ while ((pos < end) && (text[pos] == ' ' )) {
268268 pos++;
269269 }
270270}
271271
272272Color parseHexRGB (const std::string& css_str, size_t pos, size_t end, bool & valid) {
273-
274273 int read = 0 ;
275-
276- // const char* str = css_str.c_str() + pos;
277274 int64_t iv = parse_int (css_str, pos, read, 16 );
278275 if (iv < 0 ) {
279276 // Invalid: out of range.
@@ -477,14 +474,14 @@ Color CSSColorParser::parse(const std::string& css_str, bool& valid) {
477474
478475 case ' r' :
479476 case ' R' :
480- if (match_prefix (" rgb" , css_str, pos, end)) {
477+ if (match (" rgb" , css_str, pos, end)) {
481478 return parseRGB (css_str, pos, end, valid);
482479 }
483480 break ;
484481
485482 case ' h' :
486483 case ' H' :
487- if (match_prefix (" hsl" , css_str, pos, end)) {
484+ if (match (" hsl" , css_str, pos, end)) {
488485 return parseHSL (css_str, pos, end, valid);
489486 }
490487 break ;
0 commit comments