Make GingerBill happy #96

Merged
MartinFouilleul merged 3 commits from flip_oc_str8 into main 2023-09-11 12:21:35 +00:00
3 changed files with 12 additions and 12 deletions
Showing only changes of commit 8d346eca90 - Show all commits

View File

@ -636,8 +636,8 @@ oc_str32 oc_font_get_glyph_indices_from_font_data(oc_font_data* fontData, oc_str
u32 oc_font_get_glyph_index_from_font_data(oc_font_data* fontData, oc_utf32 codePoint)
{
u32 glyphIndex = 0;
oc_str32 codePoints = { 1, &codePoint };
oc_str32 backing = { 1, &glyphIndex };
oc_str32 codePoints = { .ptr = &codePoint, .len = 1 };
oc_str32 backing = { .ptr = &glyphIndex, 1 };
oc_font_get_glyph_indices_from_font_data(fontData, codePoints, backing);
return (glyphIndex);
}
@ -655,15 +655,15 @@ oc_str32 oc_font_get_glyph_indices(oc_font font, oc_str32 codePoints, oc_str32 b
oc_str32 oc_font_push_glyph_indices(oc_font font, oc_arena* arena, oc_str32 codePoints)
{
u32* buffer = oc_arena_push_array(arena, u32, codePoints.len);
oc_str32 backing = { codePoints.len, buffer };
oc_str32 backing = { .ptr = buffer, .len = codePoints.len };
return (oc_font_get_glyph_indices(font, codePoints, backing));
}
u32 oc_font_get_glyph_index(oc_font font, oc_utf32 codePoint)
{
u32 glyphIndex = 0;
oc_str32 codePoints = { 1, &codePoint };
oc_str32 backing = { 1, &glyphIndex };
oc_str32 codePoints = { .ptr = &codePoint, .len = 1 };
oc_str32 backing = { .ptr = &glyphIndex, .len = 1 };
oc_font_get_glyph_indices(font, codePoints, backing);
return (glyphIndex);
}
@ -783,7 +783,7 @@ oc_text_metrics oc_font_text_metrics_utf32(oc_font font, f32 fontSize, oc_str32
if(missingGlyphIndex)
{
oc_font_get_glyph_metrics_from_font_data(fontData, (oc_str32){ 1, &missingGlyphIndex }, &missingGlyphMetrics);
oc_font_get_glyph_metrics_from_font_data(fontData, (oc_str32){ .ptr = &missingGlyphIndex, .len = 1 }, &missingGlyphMetrics);
}
else
{
@ -793,7 +793,7 @@ oc_text_metrics oc_font_text_metrics_utf32(oc_font font, f32 fontSize, oc_str32
missingGlyphIndex = oc_font_get_glyph_index_from_font_data(fontData, 'X');
if(missingGlyphIndex)
{
oc_font_get_glyph_metrics_from_font_data(fontData, (oc_str32){ 1, &missingGlyphIndex }, &missingGlyphMetrics);
oc_font_get_glyph_metrics_from_font_data(fontData, (oc_str32){ .ptr = &missingGlyphIndex, .len = 1 }, &missingGlyphMetrics);
}
else
{

View File

@ -72,8 +72,8 @@ void oc_wasm_list_push_back(oc_wasm_list* list, oc_wasm_list_elt* elt);
typedef struct oc_wasm_str8
{
u64 len;
u32 ptr;
u64 len;
} oc_wasm_str8;
typedef struct oc_wasm_str8_elt

View File

@ -34,8 +34,8 @@ extern "C" {
//----------------------------------------------------------------------------------
typedef struct oc_str8
{
u64 len;
char* ptr;
u64 len;
} oc_str8;
#define OC_STR8(s) ((oc_str8){ .len = (s) ? strlen(s) : 0, .ptr = (char*)s })
@ -43,7 +43,7 @@ typedef struct oc_str8
//NOTE: this only works with string literals, but is sometimes necessary to generate compile-time constants
#define OC_STR8_LIT(s) \
{ \
sizeof(s) - 1, s \
s, sizeof(s) - 1 \
}
#define oc_str8_lp(s) ((s).len), ((s).ptr)
@ -92,8 +92,8 @@ ORCA_API oc_str8_list oc_str8_split(oc_arena* arena, oc_str8 str, oc_str8_list s
//----------------------------------------------------------------------------------
typedef struct oc_str16
{
u64 len;
u16* ptr;
u64 len;
} oc_str16;
ORCA_API oc_str16 oc_str16_from_buffer(u64 len, u16* buffer);
@ -125,8 +125,8 @@ ORCA_API oc_str16_list oc_str16_split(oc_arena* arena, oc_str16 str, oc_str16_li
//----------------------------------------------------------------------------------
typedef struct oc_str32
{
u64 len;
u32* ptr;
u64 len;
} oc_str32;
ORCA_API oc_str32 oc_str32_from_buffer(u64 len, u32* buffer);