]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/textparser.cpp
Use C++11 features to manipulate containers
[libs/datafile.git] / source / textparser.cpp
index d467de8582ef323367538ec8dbfd8f03a5e54272..b8515a9b487fa2749d78c5c41a734c2f00c1b70f 100644 (file)
@@ -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");