allow non-fatal compiler errors
fix crash in whitespace trim increase stack size
This commit is contained in:
parent
56b56131d7
commit
2b700f0514
|
|
@ -117,7 +117,7 @@ if (WIN32)
|
|||
|
||||
if (MSVC)
|
||||
# request 8MB stack for all .exe's
|
||||
set(STACKSIZE 8388608)
|
||||
set(STACKSIZE 16388608)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "/STACK:${STACKSIZE}")
|
||||
|
||||
add_definitions("/wd4244") # disable "conversion from .. to .., possible loss of data" warning
|
||||
|
|
|
|||
|
|
@ -825,7 +825,7 @@ int bsputil_main(int _argc, const char **_argv)
|
|||
logging::init(std::nullopt, bsputil_options);
|
||||
|
||||
if (bsputil_options.remainder.size() != 1 || bsputil_options.operations.empty()) {
|
||||
bsputil_options.print_help();
|
||||
bsputil_options.print_help(true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -169,10 +169,10 @@ void entdict_t::parse(parser_base_t &parser)
|
|||
FError("closing brace without data");
|
||||
|
||||
// trim whitespace from start/end
|
||||
while (std::isspace(keystr.front())) {
|
||||
while (!keystr.empty() && std::isspace(keystr.front())) {
|
||||
keystr.erase(keystr.begin());
|
||||
}
|
||||
while (std::isspace(keystr.back())) {
|
||||
while (!keystr.empty() && std::isspace(keystr.back())) {
|
||||
keystr.erase(keystr.cbegin());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -533,7 +533,7 @@ void setting_container::set_settings(const entdict_t &epairs, source source)
|
|||
}
|
||||
}
|
||||
|
||||
void setting_container::print_help()
|
||||
void setting_container::print_help(bool fatal)
|
||||
{
|
||||
fmt::print("{}usage: {} [-help/-h/-?] [-options] {}\n\n", program_description, program_name, remainder_name);
|
||||
|
||||
|
|
@ -543,7 +543,7 @@ void setting_container::print_help()
|
|||
}
|
||||
|
||||
for (auto setting : grouped.second) {
|
||||
size_t numPadding = std::max(static_cast<size_t>(0), 28 - (setting->primary_name().size() + 4));
|
||||
size_t numPadding = std::max(static_cast<size_t>(0), 28 - std::min((size_t) 28, (setting->primary_name().size() + 4)));
|
||||
fmt::print(
|
||||
" -{} {:{}} {}\n", setting->primary_name(), setting->format(), numPadding, setting->description());
|
||||
|
||||
|
|
@ -555,7 +555,10 @@ void setting_container::print_help()
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
throw quit_after_help_exception();
|
||||
if (fatal)
|
||||
{
|
||||
throw quit_after_help_exception();
|
||||
}
|
||||
}
|
||||
|
||||
void setting_container::print_summary()
|
||||
|
|
@ -679,7 +682,7 @@ std::vector<std::string> setting_container::parse(parser_base_t &parser)
|
|||
}
|
||||
|
||||
if (parser.token == "help" || parser.token == "h" || parser.token == "?") {
|
||||
print_help();
|
||||
print_help(true);
|
||||
} else if (parser.token == "rst") {
|
||||
print_rst_documentation();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ public:
|
|||
|
||||
inline auto grouped() const { return _grouped_settings; }
|
||||
|
||||
void print_help();
|
||||
void print_help(bool fatal);
|
||||
void print_summary();
|
||||
void print_rst_documentation();
|
||||
|
||||
|
|
|
|||
|
|
@ -447,13 +447,16 @@ void light_settings::initialize(int argc, const char **argv)
|
|||
common_settings::initialize(argc - 1, argv + 1);
|
||||
|
||||
if (remainder.size() <= 0 || remainder.size() > 1) {
|
||||
print_help();
|
||||
print_help(true);
|
||||
}
|
||||
|
||||
sourceMap = remainder[0];
|
||||
} catch (parse_exception &ex) {
|
||||
print_help(false);
|
||||
logging::print("ERROR OCCURRED WHEN TRYING TO PARSE ARGUMENTS:\n");
|
||||
logging::print(ex.what());
|
||||
print_help();
|
||||
logging::print("\n\n");
|
||||
throw settings::quit_after_help_exception();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -956,7 +956,7 @@ int maputil_main(int argc, const char **argv)
|
|||
logging::init(std::nullopt, maputil_options);
|
||||
|
||||
if (maputil_options.operations.empty()) {
|
||||
maputil_options.print_help();
|
||||
maputil_options.print_help(true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -587,7 +587,7 @@ void qbsp_settings::initialize(int argc, const char **argv)
|
|||
common_settings::initialize(argc - 1, argv + 1);
|
||||
|
||||
if (remainder.size() <= 0 || remainder.size() > 2) {
|
||||
print_help();
|
||||
print_help(true);
|
||||
}
|
||||
|
||||
qbsp_options.map_path = remainder[0];
|
||||
|
|
@ -596,8 +596,11 @@ void qbsp_settings::initialize(int argc, const char **argv)
|
|||
qbsp_options.bsp_path = remainder[1];
|
||||
}
|
||||
} catch (parse_exception &ex) {
|
||||
print_help(false);
|
||||
logging::print("ERROR OCCURRED WHEN TRYING TO PARSE ARGUMENTS:\n");
|
||||
logging::print(ex.what());
|
||||
print_help();
|
||||
logging::print("\n\n");
|
||||
throw settings::quit_after_help_exception();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,13 +46,16 @@ void vis_settings::initialize(int argc, const char **argv)
|
|||
common_settings::initialize(argc - 1, argv + 1);
|
||||
|
||||
if (remainder.size() <= 0 || remainder.size() > 2) {
|
||||
print_help();
|
||||
print_help(true);
|
||||
}
|
||||
|
||||
sourceMap = DefaultExtension(remainder[0], "bsp");
|
||||
} catch (parse_exception &ex) {
|
||||
print_help(false);
|
||||
logging::print("ERROR OCCURRED WHEN TRYING TO PARSE ARGUMENTS:\n");
|
||||
logging::print(ex.what());
|
||||
print_help();
|
||||
logging::print("\n\n");
|
||||
throw settings::quit_after_help_exception();
|
||||
}
|
||||
}
|
||||
} // namespace settings
|
||||
|
|
|
|||
Loading…
Reference in New Issue