YasserAsmi / jvar

JS inspired Variants and JSON parsing for C++
MIT License
24 stars 11 forks source link

incorrect parsing of empty string #18

Closed lmcmgig closed 8 years ago

lmcmgig commented 8 years ago

Hi,

The stripQuotes function doesn't handle the empty string case correctly. Just one if to adjust:

void StrBld::stripQuotes(bool allowsingle) { [...] if ((c1 == '"' && c2 == '"') || (allowsingle && c1 == '\'' && c2 == '\'') ) { mLen--;

* if (mLen >= 1) * instead of if (mLen > 1) { memmove(buf, buf + 1, mLen); [...] }

YasserAsmi commented 8 years ago

Fixed Thanks lmcmgig!