MCPcopy Create free account
hub / github.com/OpenBoardView/OpenBoardView / fix_to_utf8

Function fix_to_utf8

src/openboardview/FileFormats/BRDFileBase.cpp:50–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50char *fix_to_utf8(char *s, char **arena, char *arena_end) {
51 if (!utf8valid(s)) {
52 return s;
53 }
54 char *p = *arena;
55 char *begin = p;
56 while (*s) {
57 uint32_t c = (uint8_t)*s;
58 if (c < 0x80) {
59 if (p + 1 >= arena_end) goto done;
60 *p++ = c;
61 } else {
62 if (p + 2 >= arena_end) goto done;
63 *p++ = 0xc0 | (c >> 6);
64 *p++ = 0x80 | (c & 0x3f);
65 }
66 ++s;
67 }
68 if (p + 1 >= arena_end) goto done;
69 *p++ = 0;
70done:
71 *arena = p;
72 return begin;
73}
74
75void BRDFileBase::AddNailsAsPins() {
76 for (auto &nail : nails) {

Callers 1

read_itemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected