Skip to content
Permalink
Browse files

Mess up StdCompilerINIWrite in an attempt to fix #1921

  • Loading branch information...
jcaesar committed Aug 15, 2017
1 parent 56d1c68 commit 08714a67f847829e5f4f8437028c9cc8e6105a34
Showing with 13 additions and 3 deletions.
  1. +12 −3 src/lib/StdCompiler.cpp
  2. +1 −0 src/lib/StdCompiler.h
@@ -306,12 +306,20 @@ void StdCompilerINIWrite::Character(char &rChar)
}

void StdCompilerINIWrite::String(char *szString, size_t iMaxLength, RawCompileType eType)
{
const char *cszString = szString;
String(cszString, iMaxLength, eType);
}

void StdCompilerINIWrite::String(const char *szString, size_t iMaxLength, RawCompileType eType)
{
PrepareForValue();
if (iMaxLength == 0)
iMaxLength = strlen(szString);
switch (eType)
{
case RCT_Escaped:
WriteEscaped(szString, szString + strlen(szString));
WriteEscaped(szString, szString + iMaxLength);
break;
case RCT_All:
case RCT_Idtf:
@@ -323,6 +331,7 @@ void StdCompilerINIWrite::String(char *szString, size_t iMaxLength, RawCompileTy

void StdCompilerINIWrite::String(char **pszString, RawCompileType eType)
{
assert(pszString);
char cNull = '\0';
String(*pszString ? *pszString : &cNull, 0, eType);
}
@@ -344,7 +353,7 @@ void StdCompilerINIWrite::Raw(void *pData, size_t iSize, RawCompileType eType)

void StdCompilerINIWrite::String(std::string &str, RawCompileType type)
{
Raw(&str[0], str.size(), type);
String(&str[0], str.size(), type);
}

void StdCompilerINIWrite::Begin()
@@ -575,7 +584,7 @@ int StdCompilerINIRead::NameCount(const char *szName)
return iCount;
}

const char *StdCompilerINIRead::GetNameByIndex(size_t idx) const
const char *StdCompilerINIRead::GetNameByIndex(size_t idx) const
{
// not in virtual naming
if (iDepth > iRealDepth || !pName) return nullptr;
@@ -581,6 +581,7 @@ class StdCompilerINIWrite : public StdCompiler
void Byte(uint8_t &rByte) override;
void Boolean(bool &rBool) override;
void Character(char &rChar) override;
void String(const char *szString, size_t iMaxLength, RawCompileType eType = RCT_Escaped);
void String(char *szString, size_t iMaxLength, RawCompileType eType = RCT_Escaped) override;
void String(char **pszString, RawCompileType eType = RCT_Escaped) override;
void String(std::string &str, RawCompileType eType = RCT_Escaped) override;

0 comments on commit 08714a6

Please sign in to comment.
You can’t perform that action at this time.