MCPcopy Create free account
hub / github.com/WallBreaker2/op / base64_encode

Function base64_encode

libop/network/HttpClient.cpp:152–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150// --- encoding & HTTP ---
151
152bool base64_encode(const unsigned char *data, int size, std::string &out) {
153 DWORD needed = 0;
154 if (!CryptBinaryToStringA(data, static_cast<DWORD>(size), CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, nullptr,
155 &needed)) {
156 return false;
157 }
158
159 if (needed == 0) {
160 out.clear();
161 return true;
162 }
163
164 out.assign(needed - 1, '\0');
165 return CryptBinaryToStringA(data, static_cast<DWORD>(size), CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, &out[0],
166 &needed) == TRUE;
167}
168
169bool http_post_json(const ParsedUrl &url, const std::string &body, int timeout_ms, std::string &response,
170 DWORD &status_code, const wchar_t *user_agent) {

Callers 2

detectMethod · 0.85
ocrMethod · 0.85

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected