Reduce the scope of variables
This commit is contained in:
+5
-6
@@ -921,10 +921,9 @@ namespace Jzon
|
||||
std::string valueBuffer;
|
||||
bool saveBuffer;
|
||||
|
||||
char c = '\0';
|
||||
for (; cursor < jsonSize; ++cursor)
|
||||
{
|
||||
c = json.at(cursor);
|
||||
char c = json.at(cursor);
|
||||
|
||||
if (IsWhitespace(c))
|
||||
continue;
|
||||
@@ -1218,10 +1217,10 @@ namespace Jzon
|
||||
void Parser::jumpToCommentEnd()
|
||||
{
|
||||
++cursor;
|
||||
char c1 = '\0', c2 = '\0';
|
||||
char c1 = '\0';
|
||||
for (; cursor < jsonSize; ++cursor)
|
||||
{
|
||||
c2 = json.at(cursor);
|
||||
char c2 = json.at(cursor);
|
||||
|
||||
if (c1 == '*' && c2 == '/')
|
||||
break;
|
||||
@@ -1239,10 +1238,10 @@ namespace Jzon
|
||||
|
||||
++cursor;
|
||||
|
||||
char c1 = '\0', c2 = '\0';
|
||||
char c1 = '\0';
|
||||
for (; cursor < jsonSize; ++cursor)
|
||||
{
|
||||
c2 = json.at(cursor);
|
||||
char c2 = json.at(cursor);
|
||||
|
||||
if (c1 != '\\' && c2 == '"')
|
||||
{
|
||||
|
||||
+6
-4
@@ -656,12 +656,14 @@ int readFile(const char* path,Options /* options */)
|
||||
FILE* f = fopen(path,"r");
|
||||
int nResult = f ? typeFile : typeUnknown;
|
||||
if ( f ) {
|
||||
const char* docs[] = { ".doc",".txt", NULL };
|
||||
const char* code[] = { ".cpp",".h" ,".pl" ,".py" ,".pyc", NULL };
|
||||
const char* ext = strstr(path,".");
|
||||
if ( ext ) {
|
||||
if ( sina(ext,docs) ) nResult = typeDoc;
|
||||
if ( sina(ext,code) ) nResult = typeCode;
|
||||
const char* docs[] = { ".doc",".txt", NULL };
|
||||
const char* code[] = { ".cpp",".h" ,".pl" ,".py" ,".pyc", NULL };
|
||||
if ( sina(ext,docs) )
|
||||
nResult = typeDoc;
|
||||
if ( sina(ext,code) )
|
||||
nResult = typeCode;
|
||||
}
|
||||
}
|
||||
if ( f ) fclose(f) ;
|
||||
|
||||
Reference in New Issue
Block a user