Avoid mixing code and declarations in C expat code

Some compilers, notably MSVC, don't support C99 and C89 doesn't allow this.

Fixes MSVS compilation after 7e22fb4f64.
This commit is contained in:
Vadim Zeitlin 2016-03-14 00:12:07 +01:00
parent 7e22fb4f64
commit c7a3785a5c

View File

@ -1703,13 +1703,16 @@ XML_GetBuffer(XML_Parser parser, int len)
} }
if (len > bufferLim - bufferEnd) { if (len > bufferLim - bufferEnd) {
#ifdef XML_CONTEXT_BYTES
int keep;
#endif
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); keep = (int)(bufferPtr - buffer);
if (keep > XML_CONTEXT_BYTES) if (keep > XML_CONTEXT_BYTES)
keep = XML_CONTEXT_BYTES; keep = XML_CONTEXT_BYTES;