diff options
Diffstat (limited to 'lib9p/core_gen')
-rw-r--r-- | lib9p/core_gen/c.py | 2 | ||||
-rw-r--r-- | lib9p/core_gen/c_fmt_print.py | 2 | ||||
-rw-r--r-- | lib9p/core_gen/c_validate.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/lib9p/core_gen/c.py b/lib9p/core_gen/c.py index 60ceb70..5776035 100644 --- a/lib9p/core_gen/c.py +++ b/lib9p/core_gen/c.py @@ -29,11 +29,11 @@ def gen_c(versions: set[str], typs: list[idl.UserType]) -> str: #include <libmisc/assert.h> #include <libmisc/endian.h> +#include <libmisc/utf8.h> #include <lib9p/core.h> #include "core_tables.h" -#include "core_utf8.h" """ # utilities ################################################################ ret += """ diff --git a/lib9p/core_gen/c_fmt_print.py b/lib9p/core_gen/c_fmt_print.py index eaacddb..7a0a9d3 100644 --- a/lib9p/core_gen/c_fmt_print.py +++ b/lib9p/core_gen/c_fmt_print.py @@ -112,7 +112,7 @@ def gen_c_fmt_print(versions: set[str], typs: list[idl.UserType]) -> str: cnt_str = f"self->{member.cnt.membname}" cnt_typ = c9util.typename(member.cnt.typ) if member.typ.static_size == 1: # SPECIAL (data) - ret += f"\tif (is_valid_utf8_without_nul((uint8_t *)self->{member.membname}, (size_t){cnt_str})) {{\n" + ret += f"\tif (utf8_is_valid_without_nul((uint8_t *)self->{member.membname}, (size_t){cnt_str})) {{\n" ret += f'\t\tfmt_print_str(w, " {member.membname}=");\n' ret += f"\t\tfmt_print_qmem(w, self->{member.membname}, {cnt_str} < 50 ? {cnt_str} : 50);\n" ret += f"\t\tif ({cnt_str} > 50)\n" diff --git a/lib9p/core_gen/c_validate.py b/lib9p/core_gen/c_validate.py index 9c55d8d..e7a4017 100644 --- a/lib9p/core_gen/c_validate.py +++ b/lib9p/core_gen/c_validate.py @@ -66,7 +66,7 @@ def gen_c_validate(versions: set[str], typs: list[idl.UserType]) -> str: "\t{\n" "\t\tsize_t len = n;\n" "\t\tVALIDATE_NET_BYTES(len);\n" - "\t\tif (!is_valid_utf8_without_nul(&net_bytes[net_offset-len], len))\n" + "\t\tif (!utf8_is_valid_without_nul(&net_bytes[net_offset-len], len))\n" f'\t\t\treturn lib9p_error(ctx, {c9util.IDENT("ERRNO_L_EBADMSG")}, "message contains invalid UTF-8");\n' "\t}\n" ) |