MCPcopy Create free account
hub / github.com/ddnet/ddnet / str_utf8_copy_num

Function str_utf8_copy_num

src/base/str.cpp:1235–1251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1233}
1234
1235void str_utf8_copy_num(char *dst, const char *src, int dst_size, int num)
1236{
1237 int new_cursor;
1238 int cursor = 0;
1239
1240 while(src[cursor] && num > 0)
1241 {
1242 new_cursor = str_utf8_forward(src, cursor);
1243 if(new_cursor >= dst_size) // reserve 1 byte for the null termination
1244 break;
1245 else
1246 cursor = new_cursor;
1247 --num;
1248 }
1249
1250 str_copy(dst, src, cursor < dst_size ? cursor + 1 : dst_size);
1251}
1252
1253void str_utf8_stats(const char *str, size_t max_size, size_t max_count, size_t *size, size_t *count)
1254{

Callers 1

Calls 2

str_utf8_forwardFunction · 0.85
str_copyFunction · 0.70

Tested by

no test coverage detected