X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftextparser.cpp;h=7dc4bde7e46ed659368498798bf0b6b3b62fa246;hb=HEAD;hp=d467de8582ef323367538ec8dbfd8f03a5e54272;hpb=be282e818fc1462ade484c592e9a942926f780d8;p=libs%2Fdatafile.git diff --git a/source/textparser.cpp b/source/textparser.cpp index d467de8..c7b13e9 100644 --- a/source/textparser.cpp +++ b/source/textparser.cpp @@ -16,7 +16,7 @@ TextParser::TextParser(Input &i, const string &s): Statement TextParser::parse() { - return parse_statement(0); + return parse_statement(nullptr); } Statement TextParser::parse_statement(const Token *t) @@ -30,7 +30,7 @@ Statement TextParser::parse_statement(const Token *t) if(t) { token = *t; - t = 0; + t = nullptr; } else token = parse_token(); @@ -317,20 +317,20 @@ string TextParser::base64_decode(const string &data) bin.reserve(data.size()*3/4); unsigned accum = 0; unsigned a_bits = 0; - for(string::const_iterator i=data.begin(); i!=data.end(); ++i) + for(char c: data) { unsigned d; - if(*i>='A' && *i<='Z') - d = *i-'A'; - else if(*i>='a' && *i<='z') - d = 26+(*i-'a'); - else if(*i>='0' && *i<='9') - d = 52+(*i-'0'); - else if(*i=='+') + if(c>='A' && c<='Z') + d = c-'A'; + else if(c>='a' && c<='z') + d = 26+(c-'a'); + else if(c>='0' && c<='9') + d = 52+(c-'0'); + else if(c=='+') d = 62; - else if(*i=='/') + else if(c=='/') d = 63; - else if(*i=='=') + else if(c=='=') continue; else throw invalid_argument("TextParser::base64_decode");