final utf8String translation

This commit is contained in:
gilteixeira 2023-03-14 17:53:33 +00:00
parent 4442358063
commit b31988f1b2
1 changed files with 3 additions and 4 deletions

View File

@ -23,10 +23,9 @@
static UTF8String_t *create_utf8_from_string(const char* string, size_t length) {
UTF8String_t *utf8_string = calloc(1, sizeof(UTF8String_t));
utf8_string->buf = calloc(length+1, sizeof(uint8_t));
utf8_string->size = length+1;
memcpy(utf8_string->buf, string, length+1);
utf8_string->buf[length] = '\0';
utf8_string->buf = calloc(length, sizeof(uint8_t));
utf8_string->size = length;
memcpy(utf8_string->buf, string, length);
return utf8_string;
}