summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2018-01-23 10:24:39 (GMT)
committerlarryhastings <larry@hastings.org>2018-01-23 10:24:39 (GMT)
commit57fa0ab8911a70d91e5b60b8dc91f1085442a9e7 (patch)
treec9d6a9612173f96a5ff2f9a7eb410ad507a858d8
parent4a4c2743133e195cc3725b78a895d85d69e50089 (diff)
downloadcpython-57fa0ab8911a70d91e5b60b8dc91f1085442a9e7.zip
cpython-57fa0ab8911a70d91e5b60b8dc91f1085442a9e7.tar.gz
cpython-57fa0ab8911a70d91e5b60b8dc91f1085442a9e7.tar.bz2
[3.5] bpo-32563: Get expat to compile under C89 (#5201)
* [3.5] bpo-32563: Get expat to compile under C89 expat: Add artificial scopes in xmltok.c utf8_toUtf8() to fix c89 compilation. Cherry-picked from libexpat commit e0b290eb3d8f4c4b45137a7d7f4f8db812145bd2 * Backport XML RPC test skip to 3.5 The buildbot service upgrade removed the XML-RPC interface, so this test no longer works (through no fault of the standard library). * Don't configure a nonexistent Python
-rw-r--r--Modules/expat/xmltok.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c
index 007aed0..70663ce 100644
--- a/Modules/expat/xmltok.c
+++ b/Modules/expat/xmltok.c
@@ -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;