From f9536ec918af4701efbfb5631141f6752833b299 Mon Sep 17 00:00:00 2001 From: Kevin Caccamo Date: Sun, 15 Jun 2025 07:13:01 -0400 Subject: [PATCH] Fix some things I overlooked Remove some useless lines of code which may cause a read error Fix the casing of linepos variable --- src/gamedata/keysections.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/gamedata/keysections.cpp b/src/gamedata/keysections.cpp index 6f3847927..bdb103a74 100644 --- a/src/gamedata/keysections.cpp +++ b/src/gamedata/keysections.cpp @@ -174,20 +174,20 @@ void D_LoadWadSettings () while (conf < eof) { - size_t linepos = 0; + size_t linePos = 0; // Fetch a line to execute command.Clear(); - for (linepos = 0; (conf + linepos) < eof && conf[linepos] != '\n' && conf[linepos] != '\r'; ++linepos) + for (linePos = 0; (conf + linePos) < eof && conf[linePos] != '\n' && conf[linePos] != '\r'; ++linePos) { - command.Push(conf[linepos]); + command.Push(conf[linePos]); } - if (linepos == 0 && conf >= eof) // End of file + if (linePos == 0 && conf >= eof) // End of file { break; } // Increment 'conf' pointer to next line - conf += linepos; + conf += linePos; while (conf < eof && (*conf == '\n' || *conf == '\r')) { conf++; @@ -195,14 +195,10 @@ void D_LoadWadSettings () // Does 'command' have a comment? If so, remove it. // Comments begin with // - char *stop = &command[linepos]; + char *stop = &command[linePos]; char *comment = &command[0]; bool inQuote = false; - if (*stop == '\r' || *stop == '\n') { - *stop-- = 0; - } - while (comment < stop) { // if (*comment != '\\' && *(comment + 1) == '\"') @@ -218,7 +214,7 @@ void D_LoadWadSettings () } // 'comment' will either be the end of the string, or the starting // position of an inline comment. - if ((comment - &command[0]) < linepos) { + if ((comment - &command[0]) < linePos) { *comment = 0; } else { // Just in case 'comment' is at EOF