Skip to content

Commit

Permalink
Add artificial scopes in xmltok.c utf8_toUtf8() to fix c89 compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
bnason-nf authored and hartwork committed Aug 23, 2017
1 parent 205be33 commit e0b290e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions expat/lib/xmltok.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,20 @@ utf8_toUtf8(const ENCODING *UNUSED_P(enc),
}

/* Avoid copying partial characters (from incomplete input). */
const char * const fromLimBefore = fromLim;
align_limit_to_full_utf8_characters(*fromP, &fromLim);
if (fromLim < fromLimBefore) {
input_incomplete = true;
{
const char * const fromLimBefore = fromLim;
align_limit_to_full_utf8_characters(*fromP, &fromLim);
if (fromLim < fromLimBefore) {
input_incomplete = true;
}
}

const ptrdiff_t bytesToCopy = fromLim - *fromP;
memcpy(*toP, *fromP, bytesToCopy);
*fromP += bytesToCopy;
*toP += bytesToCopy;
{
const ptrdiff_t bytesToCopy = fromLim - *fromP;
memcpy(*toP, *fromP, bytesToCopy);
*fromP += bytesToCopy;
*toP += bytesToCopy;
}

if (output_exhausted) // needs to go first
return XML_CONVERT_OUTPUT_EXHAUSTED;
Expand Down

0 comments on commit e0b290e

Please sign in to comment.