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

Function utf8_to_wide

src/daemon/ipc.c:3553–3567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3551}
3552
3553static wchar_t *utf8_to_wide(const char *value) {
3554 if (!value) {
3555 return NULL;
3556 }
3557 int needed = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, NULL, 0);
3558 if (needed <= 0) {
3559 return NULL;
3560 }
3561 wchar_t *wide = malloc((size_t)needed * sizeof(*wide));
3562 if (!wide || MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, value, -1, wide, needed) <= 0) {
3563 free(wide);
3564 return NULL;
3565 }
3566 return wide;
3567}
3568
3569static char *wide_to_utf8(const wchar_t *value) {
3570 if (!value) {

Calls

no outgoing calls

Tested by

no test coverage detected