summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-11-10 19:12:49 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-11-10 19:12:49 (GMT)
commit0e36826a045d4a7c5ea3df5438b522dbfc8afa9b (patch)
treef4cc304bfdfaa3d4a8338120bd6a597b034828c6 /Objects
parent87a7c825f0dee9861d135bd5373c3f0054cb4a2e (diff)
downloadcpython-0e36826a045d4a7c5ea3df5438b522dbfc8afa9b.zip
cpython-0e36826a045d4a7c5ea3df5438b522dbfc8afa9b.tar.gz
cpython-0e36826a045d4a7c5ea3df5438b522dbfc8afa9b.tar.bz2
Fix UTF-7 encoder on Windows
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 70c75c9..6174998 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4061,7 +4061,7 @@ _PyUnicode_EncodeUTF7(PyObject *str,
start = out = PyBytes_AS_STRING(v);
for (i = 0; i < len; ++i) {
- Py_UNICODE ch = PyUnicode_READ(kind, data, i);
+ Py_UCS4 ch = PyUnicode_READ(kind, data, i);
if (inShift) {
if (ENCODE_DIRECT(ch, !base64SetO, !base64WhiteSpace)) {
@@ -4099,7 +4099,6 @@ _PyUnicode_EncodeUTF7(PyObject *str,
}
continue;
encode_char:
-#ifdef Py_UNICODE_WIDE
if (ch >= 0x10000) {
/* code first surrogate */
base64bits += 16;
@@ -4111,7 +4110,6 @@ encode_char:
/* prepare second surrogate */
ch = 0xDC00 | ((ch-0x10000) & 0x3FF);
}
-#endif
base64bits += 16;
base64buffer = (base64buffer << 16) | ch;
while (base64bits >= 6) {
@@ -4138,7 +4136,7 @@ PyUnicode_EncodeUTF7(const Py_UNICODE *s,
PyObject *tmp = PyUnicode_FromUnicode(s, size);
if (tmp == NULL)
return NULL;
- result = _PyUnicode_EncodeUTF7(tmp, base64SetO,
+ result = _PyUnicode_EncodeUTF7(tmp, base64SetO,
base64WhiteSpace, errors);
Py_DECREF(tmp);
return result;
@@ -5462,7 +5460,7 @@ _PyUnicode_EncodeUTF16(PyObject *str,
kind = PyUnicode_KIND(str);
data = PyUnicode_DATA(str);
len = PyUnicode_GET_LENGTH(str);
-
+
pairs = 0;
if (kind == PyUnicode_4BYTE_KIND)
for (i = 0; i < len; i++)
@@ -6157,7 +6155,7 @@ PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode)
case PyUnicode_2BYTE_KIND: expandsize = 6; break;
case PyUnicode_4BYTE_KIND: expandsize = 10; break;
}
-
+
if (len > PY_SSIZE_T_MAX / expandsize)
return PyErr_NoMemory();