]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport of 1.26:
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 15 Jul 2004 14:12:20 +0000 (14:12 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 15 Jul 2004 14:12:20 +0000 (14:12 +0000)
CFStringGetUnicode() returned an extra null character at the end of the string.
fixed.

Mac/Modules/cf/_CFmodule.c
Mac/Modules/cf/cfsupport.py

index d6dba45de379c36afbea95f8333499a59c649a39..7bb56e8f2de5dff4cf02323cf8dc6c53bd181f30 100644 (file)
@@ -5,12 +5,7 @@
 
 
 
-#ifdef _WIN32
-#include "pywintoolbox.h"
-#else
-#include "macglue.h"
 #include "pymactoolbox.h"
-#endif
 
 /* Macro to test whether a weak-loaded CFM function exists */
 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL )  {\
@@ -2001,7 +1996,7 @@ static PyObject *CFStringRefObj_CFStringGetUnicode(CFStringRefObject *_self, PyO
        range.length = size;
        if( data == NULL ) return PyErr_NoMemory();
        CFStringGetCharacters(_self->ob_itself, range, data);
-       _res = (PyObject *)PyUnicode_FromUnicode(data, size);
+       _res = (PyObject *)PyUnicode_FromUnicode(data, size-1);
        free(data);
        return _res;
 
index f27c58b1613eb99118dd0c0752e2476177262fa5..9c2880e61f0434b0b9bc5c3fd018fb8a116f86f5 100644 (file)
@@ -558,7 +558,7 @@ range.location = 0;
 range.length = size;
 if( data == NULL ) return PyErr_NoMemory();
 CFStringGetCharacters(_self->ob_itself, range, data);
-_res = (PyObject *)PyUnicode_FromUnicode(data, size);
+_res = (PyObject *)PyUnicode_FromUnicode(data, size-1);
 free(data);
 return _res;
 """