From 4963a9180ad2c9c381275806a382e6a4622f2db8 Mon Sep 17 00:00:00 2001 From: ineed bots Date: Sat, 2 Dec 2023 15:58:56 -0600 Subject: [PATCH] largest gsc string is 65535, but u cant concat gsc strings > 8191 chars, ull get an error --- src/component/fileio.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/component/fileio.cpp b/src/component/fileio.cpp index 766ee70..b8937d7 100644 --- a/src/component/fileio.cpp +++ b/src/component/fileio.cpp @@ -10,6 +10,7 @@ namespace fileio namespace { static constexpr size_t max_fhs = 10; + static constexpr size_t max_gsc_string = 0x10000 - 1; 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; - 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()); } @@ -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()); }