Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.5] bpo-32563: Get expat to compile under C89 #5201

Merged
merged 5 commits into from Jan 23, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 12 additions & 8 deletions Modules/expat/xmltok.c
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((void *)*toP, (const void *)*fromP, (size_t)bytesToCopy);
*fromP += bytesToCopy;
*toP += bytesToCopy;
{
const ptrdiff_t bytesToCopy = fromLim - *fromP;
memcpy((void *)*toP, (const void *)*fromP, (size_t)bytesToCopy);
*fromP += bytesToCopy;
*toP += bytesToCopy;
}

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