diff options
| author | gingerBill <bill@gingerbill.org> | 2024-05-16 16:30:45 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-05-16 16:30:45 +0100 |
| commit | 7cf62f00c34b98cc2f8acab75d5259ff4fc2c6f6 (patch) | |
| tree | e0c6fc1a6bb5d8161184fd988d714a12e700c121 /core | |
| parent | c9b1c99a4057b7e3f6caee3fb37cf85ca29a7fc9 (diff) | |
Correct #soa RTTI usage
Diffstat (limited to 'core')
| -rw-r--r-- | core/fmt/fmt.odin | 2 | ||||
| -rw-r--r-- | core/strings/strings.odin | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index 772d3dd9c..5f9485f7f 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -1960,7 +1960,7 @@ fmt_struct :: proc(fi: ^Info, v: any, the_verb: rune, info: runtime.Type_Info_St fmt_arg(fi, any{data, t.id}, verb) } } else { - t := info.types[i].variant.(runtime.Type_Info_Pointer).elem + t := info.types[i].variant.(runtime.Type_Info_Multi_Pointer).elem t_size := uintptr(t.size) if reflect.is_any(t) { io.write_string(fi.writer, "any{}", &fi.n) diff --git a/core/strings/strings.odin b/core/strings/strings.odin index 13c53f48e..101ba72a9 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -91,8 +91,8 @@ Inputs: Returns: - res: A string created from the null-terminated byte pointer and length */ -string_from_null_terminated_ptr :: proc(ptr: ^byte, len: int) -> (res: string) { - s := transmute(string)mem.Raw_String{ptr, len} +string_from_null_terminated_ptr :: proc(ptr: [^]byte, len: int) -> (res: string) { + s := string(ptr[:len]) s = truncate_to_byte(s, 0) return s } |