UTF8Parser::input: size_t is unsigned, so it can't be negative

This commit is contained in:
Geoffrey Thomas
2013-08-03 17:08:43 -07:00
committed by John Hood
parent 5721b392ab
commit 9e9919c941
+1 -3
View File
@@ -129,13 +129,11 @@ std::list<Parser::Action *> Parser::UTF8Parser::input( char c )
/* can't parse incomplete multibyte character */ /* can't parse incomplete multibyte character */
total_bytes_parsed += buf_len; total_bytes_parsed += buf_len;
continue; continue;
} else if ( bytes_parsed > 0 ) { } else {
/* parsed into pwc, accept */ /* parsed into pwc, accept */
assert( bytes_parsed <= buf_len ); assert( bytes_parsed <= buf_len );
memmove( buf, buf + bytes_parsed, buf_len - bytes_parsed ); memmove( buf, buf + bytes_parsed, buf_len - bytes_parsed );
buf_len = buf_len - bytes_parsed; buf_len = buf_len - bytes_parsed;
} else {
throw std::string( "Unknown return value from mbrtowc" );
} }
/* Cast to unsigned for checks, because some /* Cast to unsigned for checks, because some