@@ -1842,7 +1842,7 @@ namespace simplecpp {
18421842 return recursiveExpandToken (output, temp, loc, tok2, macros, expandedmacros2, parametertokens);
18431843 }
18441844
1845- else if (tok->str () == DEFINED) {
1845+ if (tok->str () == DEFINED) {
18461846 const Token *tok2 = tok->next ;
18471847 const Token *tok3 = tok2 ? tok2->next : nullptr ;
18481848 const Token *tok4 = tok3 ? tok3->next : nullptr ;
@@ -1989,7 +1989,7 @@ namespace simplecpp {
19891989 } else {
19901990 std::string strAB;
19911991
1992- const bool varargs = variadic && args.size () >= 1U && B->str () == args[args.size ()-1U ];
1992+ const bool varargs = variadic && ! args.empty () && B->str () == args[args.size ()-1U ];
19931993
19941994 if (expandArg (&tokensB, B, parametertokens)) {
19951995 if (tokensB.empty ())
@@ -2008,7 +2008,7 @@ namespace simplecpp {
20082008 if (A->previous && A->previous ->str () == " \\ " ) {
20092009 if (strAB[0 ] == ' u' && strAB.size () == 5 )
20102010 throw invalidHashHash::universalCharacterUB (tok->location , name (), A, strAB);
2011- else if (strAB[0 ] == ' U' && strAB.size () == 9 )
2011+ if (strAB[0 ] == ' U' && strAB.size () == 9 )
20122012 throw invalidHashHash::universalCharacterUB (tok->location , name (), A, strAB);
20132013 }
20142014
@@ -2487,7 +2487,7 @@ long long simplecpp::characterLiteralToLL(const std::string& str)
24872487
24882488 std::size_t pos;
24892489
2490- if (str.size () >= 1 && str[0 ] == ' \' ' ) {
2490+ if (! str.empty () && str[0 ] == ' \' ' ) {
24912491 narrow = true ;
24922492 pos = 1 ;
24932493 } else if (str.size () >= 2 && str[0 ] == ' u' && str[1 ] == ' \' ' ) {
@@ -2611,7 +2611,7 @@ long long simplecpp::characterLiteralToLL(const std::string& str)
26112611 int additional_bytes;
26122612 if (value >= 0xf5 ) // higher values would result in code points above 0x10ffff
26132613 throw std::runtime_error (" assumed UTF-8 encoded source, but sequence is invalid" );
2614- else if (value >= 0xf0 )
2614+ if (value >= 0xf0 )
26152615 additional_bytes = 3 ;
26162616 else if (value >= 0xe0 )
26172617 additional_bytes = 2 ;
@@ -2678,7 +2678,7 @@ static void simplifyNumbers(simplecpp::TokenList &expr)
26782678 continue ;
26792679 if (tok->str ().compare (0 ,2 ," 0x" ) == 0 )
26802680 tok->setstr (toString (stringToULL (tok->str ())));
2681- else if (!tok->number && tok->str ().find (' \' ' ) != tok-> str (). npos )
2681+ else if (!tok->number && tok->str ().find (' \' ' ) != std::string:: npos)
26822682 tok->setstr (toString (simplecpp::characterLiteralToLL (tok->str ())));
26832683 }
26842684}
@@ -2840,7 +2840,7 @@ static bool hasFile(const std::map<std::string, simplecpp::TokenList *> &filedat
28402840 return !getFileName (filedata, sourcefile, header, dui, systemheader).empty ();
28412841}
28422842
2843- std::map<std::string, simplecpp::TokenList*> simplecpp::load (const simplecpp::TokenList &rawtokens, std::vector<std::string> &fileNumbers , const simplecpp::DUI &dui, simplecpp::OutputList *outputList)
2843+ std::map<std::string, simplecpp::TokenList*> simplecpp::load (const simplecpp::TokenList &rawtokens, std::vector<std::string> &filenames , const simplecpp::DUI &dui, simplecpp::OutputList *outputList)
28442844{
28452845 std::map<std::string, simplecpp::TokenList*> ret;
28462846
@@ -2856,16 +2856,16 @@ std::map<std::string, simplecpp::TokenList*> simplecpp::load(const simplecpp::To
28562856 std::ifstream fin (filename.c_str ());
28572857 if (!fin.is_open ()) {
28582858 if (outputList) {
2859- simplecpp::Output err (fileNumbers );
2859+ simplecpp::Output err (filenames );
28602860 err.type = simplecpp::Output::EXPLICIT_INCLUDE_NOT_FOUND;
2861- err.location = Location (fileNumbers );
2861+ err.location = Location (filenames );
28622862 err.msg = " Can not open include file '" + filename + " ' that is explicitly included." ;
28632863 outputList->push_back (err);
28642864 }
28652865 continue ;
28662866 }
28672867
2868- TokenList *tokenlist = new TokenList (fin, fileNumbers , filename, outputList);
2868+ TokenList *tokenlist = new TokenList (fin, filenames , filename, outputList);
28692869 if (!tokenlist->front ()) {
28702870 delete tokenlist;
28712871 continue ;
@@ -2904,7 +2904,7 @@ std::map<std::string, simplecpp::TokenList*> simplecpp::load(const simplecpp::To
29042904 if (!f.is_open ())
29052905 continue ;
29062906
2907- TokenList *tokens = new TokenList (f, fileNumbers , header2, outputList);
2907+ TokenList *tokens = new TokenList (f, filenames , header2, outputList);
29082908 ret[header2] = tokens;
29092909 if (tokens->front ())
29102910 filelist.push_back (tokens->front ());
0 commit comments