summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-05-03 12:27:22 (GMT)
committerGuido van Rossum <guido@python.org>2000-05-03 12:27:22 (GMT)
commit4e751c3d12aa93abb0b96603b99b332dfec135b2 (patch)
treeea13b592621cde898a4330d35f15ea3c184c1112 /Objects/unicodeobject.c
parenta6edfd9737043420cfbf248ccae39ed344bc06a1 (diff)
downloadcpython-4e751c3d12aa93abb0b96603b99b332dfec135b2.zip
cpython-4e751c3d12aa93abb0b96603b99b332dfec135b2.tar.gz
cpython-4e751c3d12aa93abb0b96603b99b332dfec135b2.tar.bz2
Mark Hammond withdraws his fix -- the size includes the trailing 0 so
a size of 0 *is* illegal.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index e843d1a..7a68dd4 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1555,7 +1555,7 @@ PyObject *PyUnicode_DecodeMBCS(const char *s,
/* First get the size of the result */
DWORD usize = MultiByteToWideChar(CP_ACP, 0, s, size, NULL, 0);
- if (size > 0 && usize==0)
+ if (usize==0)
return PyErr_SetFromWindowsErrWithFilename(0, NULL);
v = _PyUnicode_New(usize);
@@ -1578,14 +1578,9 @@ PyObject *PyUnicode_EncodeMBCS(const Py_UNICODE *p,
{
PyObject *repr;
char *s;
- DWORD mbcssize;
-
- /* If there are no characters, bail now! */
- if (size==0)
- return PyString_FromString("");
/* First get the size of the result */
- mbcssize = WideCharToMultiByte(CP_ACP, 0, p, size, NULL, 0, NULL, NULL);
+ DWORD mbcssize = WideCharToMultiByte(CP_ACP, 0, p, size, NULL, 0, NULL, NULL);
if (mbcssize==0)
return PyErr_SetFromWindowsErrWithFilename(0, NULL);