MCPcopy Create free account
hub / github.com/TASEmulators/fceux / Base64StringToBytesLength

Function Base64StringToBytesLength

src/utils/xstring.cpp:268–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266}
267
268int Base64StringToBytesLength(const std::string& str)
269{
270 if(str.size() < 7 || (str.size()-7) % 4 || str.substr(0,7) != "base64:") return -1;
271
272 size_t c = ((str.size() - 7) / 4) * 3;
273 if(str[str.size()-1] == '=') { --c;
274 if(str[str.size()-2] == '=') --c; }
275 return c;
276}
277
278///parses a string in the same format as BytesToString
279///returns true if success.

Callers 1

installValueMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected