MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / decompressLvlStr

Method decompressLvlStr

Source/GJGameLevel.cpp:114–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114std::string GJGameLevel::decompressLvlStr(std::string compressedLvlStr)
115{
116 if (compressedLvlStr.empty()) return "";
117
118 std::replace(compressedLvlStr.begin(), compressedLvlStr.end(), '_', '/');
119 std::replace(compressedLvlStr.begin(), compressedLvlStr.end(), '-', '+');
120
121 std::string decoded = base64_decode(compressedLvlStr);
122
123 unsigned char* data = (unsigned char*)decoded.data();
124 unsigned char* a = nullptr;
125 ssize_t deflatedLen = ax::ZipUtils::inflateMemory(data, decoded.length(), &a);
126
127 std::string levelString = (char *)a;
128
129 free(a);
130
131 return levelString;
132}
133
134std::string GJGameLevel::compressLvlStr(std::string decompressedLvlStr, int gdLevelID) {
135 // ax::ZipUtils::

Callers

nothing calls this directly

Calls 4

base64_decodeFunction · 0.85
emptyMethod · 0.80
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected