From fe4a51f4ab80fed8a6df3aedaa3242cceba4b24f Mon Sep 17 00:00:00 2001 From: "Alexander S. Aganichev" Date: Fri, 30 Nov 2001 23:08:14 +0000 Subject: [PATCH] Fixed goldkeys.cfg parser --- docs/notework.txt | 3 +++ golded3/gckeys.cpp | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/notework.txt b/docs/notework.txt index 75d6e82..c04088d 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -12,6 +12,9 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ +- Fixed small bug in goldkeys.cfg parser so the last line without + the feed was incorrectly processed. + - Fixed pseudo in Internet areas. - Partially fixed ATTRIBSEMAIL and ATTRIBSNEWS operation. They still diff --git a/golded3/gckeys.cpp b/golded3/gckeys.cpp index d8056ef..f2bf036 100644 --- a/golded3/gckeys.cpp +++ b/golded3/gckeys.cpp @@ -991,6 +991,12 @@ int ReadKeysCfg(int force) { continue; ptr2 = ptr; ptr = strskip_txt(ptr); + if(*ptr == NUL) { + std::cout << "* " << cfgname << ": Incomplete line " << line << "." << std::endl; + SayBibi(); + cfgerrors++; + continue; + } *ptr++ = NUL; keycmd = SwitchKeyDefs(strCrc16(strupr(ptr2)), &keytype); if(keycmd) { @@ -1020,7 +1026,9 @@ int ReadKeysCfg(int force) { ptr = strskip_wht(ptr); ptr2 = ptr; ptr = strskip_txt(ptr); - *ptr++ = 0; + if(*ptr != NUL) { + *ptr++ = NUL; + } keycmd = SwitchKeyDefs(strCrc16(strupr(ptr2)), &keytype); if(keycmd) { if((keycmd >= KK_Macro) and (keycmd <= KK_ReadMacro)) { @@ -1035,12 +1043,16 @@ int ReadKeysCfg(int force) { ch = *ptr++; tmp2.buf[n++] = (gkey)(ch | (scancode(ch) << 8)); } - *ptr++ = NUL; + if(*ptr != NUL) { + *ptr++ = NUL; + } } else { ptr2 = ptr; ptr = strskip_txt(ptr); - *ptr++ = NUL; + if(*ptr != NUL) { + *ptr++ = NUL; + } int tmpkt; keycmd = SwitchKeyDefs(strCrc16(strupr(ptr2)), &tmpkt); if(keycmd) {