Expat compilation fix for pre-C99 compilers.

Don't mix statements and declarations, this is not allowed in C89.

Fixes compilation with MSVC <= 10 after 28ba8ed84e

See #17083.
This commit is contained in:
Vadim Zeitlin 2015-07-30 00:55:35 +02:00
parent fc03d2698c
commit 9b029ea88a

View File

@ -1703,14 +1703,15 @@ XML_GetBuffer(XML_Parser parser, int len)
} }
if (len > bufferLim - bufferEnd) { if (len > bufferLim - bufferEnd) {
#ifdef XML_CONTEXT_BYTES
int keep = (int)(bufferPtr - buffer);
#endif /* defined XML_CONTEXT_BYTES */
int neededSize = len + (int)(bufferEnd - bufferPtr); int neededSize = len + (int)(bufferEnd - bufferPtr);
if (neededSize < 0) { if (neededSize < 0) {
errorCode = XML_ERROR_NO_MEMORY; errorCode = XML_ERROR_NO_MEMORY;
return NULL; return NULL;
} }
#ifdef XML_CONTEXT_BYTES #ifdef XML_CONTEXT_BYTES
int keep = (int)(bufferPtr - buffer);
if (keep > XML_CONTEXT_BYTES) if (keep > XML_CONTEXT_BYTES)
keep = XML_CONTEXT_BYTES; keep = XML_CONTEXT_BYTES;
neededSize += keep; neededSize += keep;