Skip to content

Commit 981c5cd

Browse files
[wip] fixing msvc being dumb about OC_STR8_LIT
1 parent 89658e3 commit 981c5cd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/ui/ui.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1664,15 +1664,15 @@ oc_ui_box* oc_ui_box_begin_str8(oc_str8 string)
16641664

16651665
if(box->sig.hovering)
16661666
{
1667-
oc_ui_tag_box_str8(box, OC_STR8_LIT("hover"));
1667+
oc_ui_tag_box_str8(box, OC_STR8("hover"));
16681668
}
16691669
if(box->active)
16701670
{
1671-
oc_ui_tag_box_str8(box, OC_STR8_LIT("active"));
1671+
oc_ui_tag_box_str8(box, OC_STR8("active"));
16721672
}
16731673
if(box->dragging)
16741674
{
1675-
oc_ui_tag_box_str8(box, OC_STR8_LIT("dragging"));
1675+
oc_ui_tag_box_str8(box, OC_STR8("dragging"));
16761676
}
16771677

16781678
//NOTE push box

src/ui/widgets.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ void oc_ui_tooltip_str8(oc_str8 key, oc_str8 text)
524524
oc_ui_style_set_var_str8(OC_UI_BG_COLOR, OC_UI_THEME_TOOLTIP);
525525
oc_ui_style_set_var_str8(OC_UI_ROUNDNESS, OC_UI_THEME_ROUNDNESS_REGULAR);
526526

527-
oc_ui_label_str8(OC_STR8_LIT("label"), text);
527+
oc_ui_label_str8(OC_STR8("label"), text);
528528
}
529529
}
530530
}

src/util/strings.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ typedef struct oc_str8
4040
#define OC_STR8(s) ((oc_str8){ .ptr = (char*)s, .len = (s) ? strlen(s) : 0 })
4141

4242
//NOTE: this only works with string literals, but is sometimes necessary to generate compile-time constants
43-
#define OC_STR8_LIT(s) \
44-
((oc_str8){ \
45-
.ptr = (char*)(s), \
46-
.len = sizeof(s) - 1 })
43+
#define OC_STR8_LIT(s) \
44+
{ \
45+
.ptr = (char*)(s), .len = sizeof(s) - 1 \
46+
}
4747

4848
#define oc_str8_lp(s) ((s).len), ((s).ptr)
4949
#define oc_str8_ip(s) (int)oc_str8_lp(s)

0 commit comments

Comments
 (0)