mirror of
https://github.com/minetest/minetest.git
synced 2025-03-06 20:48:40 +01:00
Avoid VLA usage and prohibit it by compiler flag
This commit is contained in:
parent
721e06451e
commit
38f4d11d53
4 changed files with 6 additions and 7 deletions
|
@ -855,8 +855,7 @@ if(MSVC)
|
|||
endif()
|
||||
else()
|
||||
# GCC or compatible compilers such as Clang
|
||||
set(WARNING_FLAGS "-Wall -Wextra")
|
||||
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-parameter")
|
||||
set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-parameter -Werror=vla")
|
||||
if(WARN_ALL)
|
||||
set(RELEASE_WARNING_FLAGS "${WARNING_FLAGS}")
|
||||
else()
|
||||
|
|
|
@ -291,13 +291,13 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event)
|
|||
|
||||
s32 selected_idx = dropdown->getSelected();
|
||||
s32 option_size = dropdown->getItemCount();
|
||||
std::string list_of_options[option_size];
|
||||
std::vector<std::string> list_of_options;
|
||||
|
||||
for (s32 i = 0; i < option_size; i++) {
|
||||
list_of_options[i] = wide_to_utf8(dropdown->getItem(i));
|
||||
list_of_options.push_back(wide_to_utf8(dropdown->getItem(i)));
|
||||
}
|
||||
|
||||
porting::showComboBoxDialog(list_of_options, option_size, selected_idx);
|
||||
porting::showComboBoxDialog(list_of_options.data(), option_size, selected_idx);
|
||||
return true; // Prevent the Irrlicht dropdown from opening.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ void showTextInputDialog(const std::string &hint, const std::string ¤t, in
|
|||
jhint, jcurrent, jeditType);
|
||||
}
|
||||
|
||||
void showComboBoxDialog(const std::string optionList[], s32 listSize, s32 selectedIdx)
|
||||
void showComboBoxDialog(const std::string *optionList, s32 listSize, s32 selectedIdx)
|
||||
{
|
||||
jmethodID showdialog = jnienv->GetMethodID(activityClass, "showSelectionInputDialog",
|
||||
"([Ljava/lang/String;I)V");
|
||||
|
|
|
@ -27,7 +27,7 @@ void showTextInputDialog(const std::string &hint, const std::string ¤t, in
|
|||
* @param listSize Size of the list
|
||||
* @param selectedIdx Selected index
|
||||
*/
|
||||
void showComboBoxDialog(const std::string optionList[], s32 listSize, s32 selectedIdx);
|
||||
void showComboBoxDialog(const std::string *optionList, s32 listSize, s32 selectedIdx);
|
||||
|
||||
/**
|
||||
* Opens a share intent to the file at path
|
||||
|
|
Loading…
Add table
Reference in a new issue