largest gsc string is 65535, but u cant concat gsc strings > 8191 chars, ull get an error

This commit is contained in:
ineed bots 2023-12-02 15:58:56 -06:00
parent 56e8c485af
commit 4963a9180a

View File

@ -10,6 +10,7 @@ namespace fileio
namespace namespace
{ {
static constexpr size_t max_fhs = 10; static constexpr size_t max_fhs = 10;
static constexpr size_t max_gsc_string = 0x10000 - 1;
enum class scr_fh_type_e enum class scr_fh_type_e
{ {
@ -293,10 +294,10 @@ namespace fileio
} }
} }
if (bytes_to_read > 8191) if (bytes_to_read > max_gsc_string)
{ {
found_nl = false; found_nl = false;
bytes_to_read = 8191; bytes_to_read = max_gsc_string;
game::Com_PrintWarning(game::CON_CHANNEL_SCRIPT, "Line was too long in file %s, truncating\n", scr_fhs[fh].base_path.c_str()); game::Com_PrintWarning(game::CON_CHANNEL_SCRIPT, "Line was too long in file %s, truncating\n", scr_fhs[fh].base_path.c_str());
} }
@ -348,9 +349,9 @@ namespace fileio
} }
} }
if (bytes_to_read > 8191) if (bytes_to_read > max_gsc_string)
{ {
bytes_to_read = 8191; bytes_to_read = max_gsc_string;
game::Com_PrintWarning(game::CON_CHANNEL_SCRIPT, "Line was too long in file %s, truncating\n", scr_fhs[fh].base_path.c_str()); game::Com_PrintWarning(game::CON_CHANNEL_SCRIPT, "Line was too long in file %s, truncating\n", scr_fhs[fh].base_path.c_str());
} }