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

Function read_small_file_utf8

tests/test_artifact.c:340–350  ·  view source on GitHub ↗

Read a small file through the UTF-8 path layer (wide on Windows), so a * non-ASCII path is never misread by the test's own ANSI CRT call. Returns the * byte count, or 0 when the file cannot be opened or is empty. */

Source from the content-addressed store, hash-verified

338 * non-ASCII path is never misread by the test's own ANSI CRT call. Returns the
339 * byte count, or 0 when the file cannot be opened or is empty. */
340static size_t read_small_file_utf8(const char *path, char *buf, size_t cap) {
341 buf[0] = '\0';
342 FILE *fp = cbm_fopen(path, "rb");
343 if (!fp) {
344 return 0;
345 }
346 size_t rd = fread(buf, 1, cap - 1, fp);
347 (void)fclose(fp);
348 buf[rd] = '\0';
349 return rd;
350}
351
352/* #1171: a repository (and a cache directory) under a non-ASCII path must
353 * export, report the artifact present, and import — also onto an existing

Callers 1

test_artifact.cFile · 0.85

Calls 2

cbm_fopenFunction · 0.85
freadFunction · 0.85

Tested by

no test coverage detected