@@ -37,9 +37,9 @@ inline std::string base64_encode(const std::string& input) {
3737 auto  it = input.begin ();
3838
3939 for  (std::size_t  i = 0 ; i < input.size () / 3 ; ++i) {
40-  temp = (*it++) << 16 ;
41-  temp += (*it++) << 8 ;
42-  temp += (*it++);
40+  temp = static_cast <std:: uint8_t > (*it++) << 16 ;
41+  temp += static_cast <std:: uint8_t > (*it++) << 8 ;
42+  temp += static_cast <std:: uint8_t > (*it++);
4343 encoded.append (1 , kEncodeLookup [(temp & 0x00FC0000 ) >> 18 ]);
4444 encoded.append (1 , kEncodeLookup [(temp & 0x0003F000 ) >> 12 ]);
4545 encoded.append (1 , kEncodeLookup [(temp & 0x00000FC0 ) >> 6 ]);
@@ -48,14 +48,14 @@ inline std::string base64_encode(const std::string& input) {
4848
4949 switch  (input.size () % 3 ) {
5050 case  1 :
51-  temp = (*it++) << 16 ;
51+  temp = static_cast <std:: uint8_t > (*it++) << 16 ;
5252 encoded.append (1 , kEncodeLookup [(temp & 0x00FC0000 ) >> 18 ]);
5353 encoded.append (1 , kEncodeLookup [(temp & 0x0003F000 ) >> 12 ]);
5454 encoded.append (2 , kPadCharacter );
5555 break ;
5656 case  2 :
57-  temp = (*it++) << 16 ;
58-  temp += (*it++) << 8 ;
57+  temp = static_cast <std:: uint8_t > (*it++) << 16 ;
58+  temp += static_cast <std:: uint8_t > (*it++) << 8 ;
5959 encoded.append (1 , kEncodeLookup [(temp & 0x00FC0000 ) >> 18 ]);
6060 encoded.append (1 , kEncodeLookup [(temp & 0x0003F000 ) >> 12 ]);
6161 encoded.append (1 , kEncodeLookup [(temp & 0x00000FC0 ) >> 6 ]);
@@ -118,7 +118,7 @@ inline std::string base64_decode(const std::string& input) {
118118
119119 decoded.push_back ((temp >> 16 ) & 0x000000FF );
120120 decoded.push_back ((temp >> 8 ) & 0x000000FF );
121-  decoded.push_back ((temp)& 0x000000FF );
121+  decoded.push_back ((temp) &  0x000000FF );
122122 }
123123
124124 return  decoded;
0 commit comments