Skip to content

Commit 07b39f7

Browse files
libretroadminLibretroAdmin
authored andcommitted
ui_qt: cast the narrowed setting fields at their C++ consumers
C++ refuses the implicit int-to-enum conversions the narrowed rarch_setting_t storage relies on in C; the Qt driver's four read sites gain explicit casts. Swept every C++ unit for reads of the narrowed fields; these were all of them.
1 parent c2ef02e commit 07b39f7

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

ui/drivers/ui_qt_widgets.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,17 @@ static inline void add_sublabel_and_whats_this(
103103
char tmp[512];
104104
tmp[0] = '\0';
105105

106-
cbs.enum_idx = setting->enum_idx;
106+
cbs.enum_idx = (enum msg_hash_enums)setting->enum_idx;
107107

108-
menu_cbs_init_bind_sublabel(&cbs, NULL, NULL, 0, setting->type, setting->size);
108+
menu_cbs_init_bind_sublabel(&cbs, NULL, NULL, 0,
109+
(unsigned)setting->type, setting->size);
109110

110111
cbs.action_sublabel(0, 0, 0, 0, 0, tmp, sizeof(tmp));
111112

112113
widget->setToolTip(tmp);
113114

114-
msg_hash_get_help_enum(setting->enum_idx, tmp, sizeof(tmp));
115+
msg_hash_get_help_enum((enum msg_hash_enums)setting->enum_idx,
116+
tmp, sizeof(tmp));
115117

116118
if (!string_is_equal(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_INFORMATION_AVAILABLE)))
117119
widget->setWhatsThis(tmp);

ui/drivers/ui_qt_widgets.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class FormLayout : public QFormLayout
119119
if (!setting)
120120
return false;
121121

122-
ui_type = setting->ui_type;
122+
ui_type = (enum ui_setting_type)setting->ui_type;
123123

124124
switch (ui_type)
125125
{
@@ -196,7 +196,7 @@ class SettingsGroup : public QGroupBox
196196
if (!setting)
197197
return false;
198198

199-
ui_type = setting->ui_type;
199+
ui_type = (enum ui_setting_type)setting->ui_type;
200200

201201
switch (ui_type)
202202
{

0 commit comments

Comments
 (0)