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

Function runtime_wire_string_decode

src/daemon/runtime.c:323–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323static bool runtime_wire_string_decode(const uint8_t *in, size_t capacity, char *out,
324 bool allow_empty) {
325 if (!in || !out || capacity == 0) {
326 return false;
327 }
328 size_t length = capacity;
329 for (size_t i = 0; i < capacity; i++) {
330 if (in[i] == 0) {
331 length = i;
332 break;
333 }
334 }
335 if (length == capacity || (!allow_empty && length == 0)) {
336 return false;
337 }
338 for (size_t i = length + 1; i < capacity; i++) {
339 if (in[i] != 0) {
340 return false;
341 }
342 }
343 memcpy(out, in, length);
344 out[length] = '\0';
345 return true;
346}
347
348/* Reuse the service layer's canonical printable-version and lowercase-SHA256
349 * validation without importing detailed ABI values into rendezvous. Fixed

Calls

no outgoing calls

Tested by

no test coverage detected