From: Michael W. Hudson Date: Mon, 18 Mar 2002 12:43:33 +0000 (+0000) Subject: Fix X-Git-Tag: v2.2.1c1~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=36de099f047a8a4c069bd06b1f5edd38d6e626ad;p=thirdparty%2FPython%2Fcpython.git Fix [ 531306 ] ucs4 build horked. Classic C mistake, I think. Also squashed a couple of warnings in the ucs4 build. --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 576f97be189f..95ba36116876 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1207,6 +1207,7 @@ PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s, if (_PyString_Resize(&v, cbAllocated)) goto onError; p = PyString_AS_STRING(v) + (p - q); + q = PyString_AS_STRING(v); } /* combine the two values */ @@ -1232,6 +1233,7 @@ PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s, if (_PyString_Resize(&v, cbAllocated)) goto onError; p = PyString_AS_STRING(v) + (p - q); + q = PyString_AS_STRING(v); } *p++ = 0xf0 | (ch>>18); @@ -1246,7 +1248,7 @@ PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s, return v; onError: - Py_DECREF(v); + Py_XDECREF(v); return NULL; } @@ -5525,12 +5527,12 @@ PyObject *PyUnicode_Format(PyObject *format, break; default: - PyErr_Format(PyExc_ValueError, - "unsupported format character '%c' (0x%x) " - "at index %i", - (31<=c && c<=126) ? c : '?', - c, fmt -1 - PyUnicode_AS_UNICODE(uformat)); - goto onError; + PyErr_Format(PyExc_ValueError, + "unsupported format character '%c' (0x%x) " + "at index %i", + (31<=c && c<=126) ? (int)c : '?', + (int)c, (fmt -1 - PyUnicode_AS_UNICODE(uformat))); + goto onError; } if (sign) { if (*pbuf == '-' || *pbuf == '+') {