MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / dg_b64

Function dg_b64

tests/test_diagrams.c:402–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400 "</root></mxGraphModel>";
401
402static char *dg_b64(const unsigned char *in, size_t dn) {
403 static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
404 char *out = malloc(dn * 4 / 3 + 8);
405 size_t o = 0;
406 for (size_t i = 0; i < dn; i += 3) {
407 uint32_t v = (uint32_t)in[i] << 16;
408 v |= i + 1 < dn ? (uint32_t)in[i + 1] << 8 : 0;
409 v |= i + 2 < dn ? in[i + 2] : 0;
410 out[o++] = b64[(v >> 18) & 63];
411 out[o++] = b64[(v >> 12) & 63];
412 out[o++] = i + 1 < dn ? b64[(v >> 6) & 63] : '=';
413 out[o++] = i + 2 < dn ? b64[v & 63] : '=';
414 }
415 out[o] = '\0';
416 return out;
417}
418
419/* A draw.io page as the app stores it compressed: URI-encoded, raw deflate,
420 * base64. */

Callers 2

dg_drawio_compressFunction · 0.85
dg_excalidraw_svgFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected