#76 unreachable code in JSONValidator::isValidObject

open
nobody
None
5
2013-04-28
2013-04-28
Anonymous
No

There is a problem with the function:
All the paths within the switch return a value ,thus exiting before getting to the while statement.
Also because of it the return false statement also can't be reached.
I marked the places below

bool JSONValidator::isValidObject(const json_char * & ptr DEPTH_PARAM) json_nothrow {
//ptr should currently be pointing past the {, so this must be the start of a name, or the closing }
//ptr will end up past the last }
do{
switch(*ptr){
case JSON_TEXT('\"'):
return isValidNamedObject(ptr DEPTH_ARG(depth_param));
case JSON_TEXT('}'):
++ptr;
return true;
default:
return false;
}
} while (*++ptr); <=========== warning C4702: unreachable code
return false; <=========== warning C4702: unreachable code
}

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks