Make Encoding::fromUtf8() and Encoding::toUtf8() return std::string

This commit is contained in:
kichikuou
2025-01-02 11:57:56 +09:00
parent 6800258113
commit ea77d594bf
8 changed files with 41 additions and 62 deletions
+2 -3
View File
@@ -348,9 +348,8 @@ CliFrontend::CommandResult CliFrontend::cmd_string() {
if (no < 1 || no > MAX_STRVAR) {
printf("Bad string index %s\n", arg);
} else {
char *utf = g_nact->encoding->toUtf8(g_nact->get_string(no - 1));
printf("string[%d] = \"%s\"\n", no, utf); // TODO: escaping
free(utf);
std::string utf = g_nact->encoding->toUtf8(g_nact->get_string(no - 1));
printf("string[%d] = \"%s\"\n", no, utf.c_str()); // TODO: escaping
}
arg = strtok(NULL, whitespaces);
}