bugfix: had stale fieldAddress under some circumstances

This commit is contained in:
zimoch
2011-07-28 12:08:39 +00:00
parent 1428b85a34
commit 050a165a82

View File

@ -650,9 +650,12 @@ formatOutput()
unsigned short addrlen = extract<unsigned short>(commandIndex); unsigned short addrlen = extract<unsigned short>(commandIndex);
fieldAddress.set(commandIndex, addrlen); fieldAddress.set(commandIndex, addrlen);
commandIndex += addrlen; commandIndex += addrlen;
goto normal_format;
} }
case StreamProtocolParser::format: case StreamProtocolParser::format:
{ {
fieldAddress.clear();
normal_format:
// code layout: // code layout:
// formatstring <eos> StreamFormat [info] // formatstring <eos> StreamFormat [info]
formatstring = commandIndex; formatstring = commandIndex;
@ -696,7 +699,6 @@ formatOutput()
name(), formatstr.expand()()); name(), formatstr.expand()());
return false; return false;
} }
fieldAddress.clear();
continue; continue;
} }
case StreamProtocolParser::whitespace: case StreamProtocolParser::whitespace:
@ -1169,9 +1171,12 @@ matchInput()
unsigned short addrlen = extract<unsigned short>(commandIndex); unsigned short addrlen = extract<unsigned short>(commandIndex);
fieldAddress.set(commandIndex, addrlen); fieldAddress.set(commandIndex, addrlen);
commandIndex += addrlen; commandIndex += addrlen;
goto normal_format;
} }
case StreamProtocolParser::format: case StreamProtocolParser::format:
{ {
fieldAddress.clear();
normal_format:
int consumed; int consumed;
// code layout: // code layout:
// formatstring <eos> StreamFormat [info] // formatstring <eos> StreamFormat [info]
@ -1310,7 +1315,6 @@ matchInput()
return false; return false;
} }
// matchValue() has already removed consumed bytes from inputBuffer // matchValue() has already removed consumed bytes from inputBuffer
fieldAddress.clear();
break; break;
} }
case StreamProtocolParser::skip: case StreamProtocolParser::skip:
@ -1332,12 +1336,12 @@ matchInput()
while (commandIndex[i] >= ' ') i++; while (commandIndex[i] >= ' ') i++;
if (!(flags & AsyncMode) && onMismatch[0] != in_cmd) if (!(flags & AsyncMode) && onMismatch[0] != in_cmd)
{ {
error("%s: Input \"%s%s\" too short.", error("%s: Input \"%s%s\" too short.\n",
name(), name(),
inputLine.length() > 20 ? "..." : "", inputLine.length() > 20 ? "..." : "",
inputLine.expand(-20)()); inputLine.expand(-20)());
#ifndef NO_TEMPORARY #ifndef NO_TEMPORARY
error(" No match for \"%s\"\n", error("No match for \"%s\"\n",
StreamBuffer(commandIndex-1,i+1).expand()()); StreamBuffer(commandIndex-1,i+1).expand()());
#endif #endif
} }