Merge pull request #8 from krisztianloki/master

Fix for 'Not interpreted format conversions' accepted.
This commit is contained in:
dirk-zimoch
2018-02-28 12:01:07 +01:00
committed by GitHub
3 changed files with 16 additions and 4 deletions

View File

@ -1364,13 +1364,15 @@ normal_format:
{
int i = 0;
while (commandIndex[i] >= ' ') i++;
error("%s: Input \"%s%s\" mismatch after %ld byte%s\n",
error("%s: Input \"%s%s\" mismatch after %ld byte%s: %c != %c\n",
name(),
consumedInput > 10 ? "..." : "",
inputLine.expand(consumedInput > 10 ?
consumedInput-10 : 0,20)(),
consumedInput,
consumedInput==1 ? "" : "s");
consumedInput==1 ? "" : "s",
command,
inputLine[consumedInput]);
#ifndef NO_TEMPORARY
error("%s: got \"%s\" where \"%s\" was expected\n",

View File

@ -1058,6 +1058,14 @@ compileNumber(unsigned long& number, const char*& source, unsigned long max)
bool StreamProtocolParser::Protocol::
compileString(StreamBuffer& buffer, const char*& source,
FormatType formatType, Client* client, int quoted)
{
return compileStringInternal(buffer, source, formatType, client, quoted, 0);
}
bool StreamProtocolParser::Protocol::
compileStringInternal(StreamBuffer& buffer, const char*& source,
FormatType formatType, Client* client, int quoted, int recursionDepth)
{
bool escaped = false;
int newline = 0;
@ -1085,7 +1093,7 @@ compileString(StreamBuffer& buffer, const char*& source,
// compile all formats in this line
// We do this here after all variables in this line
// have been replaced and after string has been coded.
if (formatType != NoFormat)
if (recursionDepth == 0 && formatType != NoFormat)
{
int nformats=0;
char c;
@ -1250,7 +1258,7 @@ compileString(StreamBuffer& buffer, const char*& source,
source += strlen(source)+1+sizeof(int);
p = value();
int saveline = line;
if (!compileString(buffer, p, formatType, client))
if (!compileStringInternal(buffer, p, formatType, client, false, recursionDepth + 1))
return false;
line = saveline;
continue;

View File

@ -59,6 +59,8 @@ public:
bool compileCommands(StreamBuffer&, const char*& source, Client*);
bool replaceVariable(StreamBuffer&, const char* varname);
const Variable* getVariable(const char* name);
bool compileStringInternal(StreamBuffer& buffer, const char*& source,
FormatType formatType, Client*, int quoted, int recursionDepth);
public: