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

Function runtime_wire_string_decode

src/daemon/runtime.c:335–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333}
334
335static bool runtime_wire_string_decode(const uint8_t *in, size_t capacity, char *out,
336 bool allow_empty) {
337 if (!in || !out || capacity == 0) {
338 return false;
339 }
340 size_t length = capacity;
341 for (size_t i = 0; i < capacity; i++) {
342 if (in[i] == 0) {
343 length = i;
344 break;
345 }
346 }
347 if (length == capacity || (!allow_empty && length == 0)) {
348 return false;
349 }
350 for (size_t i = length + 1; i < capacity; i++) {
351 if (in[i] != 0) {
352 return false;
353 }
354 }
355 memcpy(out, in, length);
356 out[length] = '\0';
357 return true;
358}
359
360/* Reuse the service layer's canonical printable-version and lowercase-SHA256
361 * validation without importing detailed ABI values into rendezvous. Fixed

Calls

no outgoing calls

Tested by

no test coverage detected