Modified MsdFile::ReadBuf() so that escaped characters are still skipped when bUnescape == false

As of this commit, this won't affect anything except CourseLoaderCRS, because everywhere else is passing `true` for the bUnescape parameter.
This commit is contained in:
Michael Votaw
2024-02-23 19:21:24 -06:00
committed by teejusb
parent 68e0674164
commit 1d332bf960
+18 -2
View File
@@ -127,8 +127,24 @@ void MsdFile::ReadBuf( const char *buf, int len, bool bUnescape )
/* We've gone through all the control characters. All that is left is either an escaped character,
* ie \#, \\, \:, etc., or a regular character. */
if( bUnescape && i < len && buf[i] == '\\' )
++i;
if(buf[i] == '\\' && i < len)
{
// If we're escaping the next character, skip the '\\'
if(bUnescape)
{
++i;
}
// Otherwise, add the '\\' to cProcessed here, so that
// whatever character is coming next stays escaped in
// the resulting value/parameter string
// (and most importantly, it doesn't get parsed as a control character)
// on the next iteration
else
{
cProcessed[iProcessedLen++] = buf[i++];
}
}
if( i < len )
{
cProcessed[iProcessedLen++] = buf[i++];