MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / ReadDataUri

Method ReadDataUri

src/basicio.cpp:894–907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

892}
893
894void XPathIo::ReadDataUri(const std::string& path) {
895 size_t base64Pos = path.find("base64,");
896 if (base64Pos == std::string::npos)
897 throw Error(ErrorCode::kerErrorMessage, "No base64 data");
898
899 std::string data = path.substr(base64Pos + 7);
900 auto decodeData = new char[data.length()];
901 auto size = base64decode(data.c_str(), decodeData, data.length());
902 if (size > 0)
903 write((byte*)decodeData, size);
904 else
905 throw Error(ErrorCode::kerErrorMessage, "Unable to decode base 64.");
906 delete[] decodeData;
907}
908
909#elif defined(EXV_ENABLE_FILESYSTEM)
910XPathIo::XPathIo(const std::string& orgPath) : FileIo(XPathIo::writeDataToFile(orgPath)), tempFilePath_(path()) {

Callers

nothing calls this directly

Calls 4

ErrorFunction · 0.85
base64decodeFunction · 0.85
c_strMethod · 0.80
writeFunction · 0.50

Tested by

no test coverage detected