change len of strings to size_t

This commit is contained in:
Martin Fouilleul 2023-09-11 09:05:48 +02:00
parent 8d346eca90
commit dc837a6a6d
3 changed files with 6 additions and 5 deletions

View File

@ -73,7 +73,7 @@ void oc_wasm_list_push_back(oc_wasm_list* list, oc_wasm_list_elt* elt);
typedef struct oc_wasm_str8
{
u32 ptr;
u64 len;
u32 len; //NOTE: size_t is 4 bytes on wasm32
} oc_wasm_str8;
typedef struct oc_wasm_str8_elt

View File

@ -111,6 +111,7 @@ inline T oc_cube(T a)
#define oc_tga_variants(def, ...) \
def(u8, ##__VA_ARGS__) def(i8, ##__VA_ARGS__) def(u16, ##__VA_ARGS__) def(i16, ##__VA_ARGS__) \
def(u32, ##__VA_ARGS__) def(i32, ##__VA_ARGS__) def(u64, ##__VA_ARGS__) def(i64, ##__VA_ARGS__) \
def(size_t, ##__VA_ARGS__) \
def(f32, ##__VA_ARGS__) def(f64, ##__VA_ARGS__)
// This macro generates one _Generic association between a type and its variant

View File

@ -35,7 +35,7 @@ extern "C" {
typedef struct oc_str8
{
char* ptr;
u64 len;
size_t len;
} oc_str8;
#define OC_STR8(s) ((oc_str8){ .len = (s) ? strlen(s) : 0, .ptr = (char*)s })
@ -93,7 +93,7 @@ ORCA_API oc_str8_list oc_str8_split(oc_arena* arena, oc_str8 str, oc_str8_list s
typedef struct oc_str16
{
u16* ptr;
u64 len;
size_t len;
} oc_str16;
ORCA_API oc_str16 oc_str16_from_buffer(u64 len, u16* buffer);
@ -126,7 +126,7 @@ ORCA_API oc_str16_list oc_str16_split(oc_arena* arena, oc_str16 str, oc_str16_li
typedef struct oc_str32
{
u32* ptr;
u64 len;
size_t len;
} oc_str32;
ORCA_API oc_str32 oc_str32_from_buffer(u64 len, u32* buffer);