Reduce the scope of variables

This commit is contained in:
Luis Díaz Más
2018-11-06 18:58:39 +01:00
parent dc7eb5008b
commit 2d1e1fe6ef
4 changed files with 71 additions and 41 deletions
+5 -6
View File
@@ -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
View File
@@ -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) ;