From: Jack Jansen Date: Thu, 15 Jul 2004 14:12:20 +0000 (+0000) Subject: Backport of 1.26: X-Git-Tag: v2.3.5c1~170 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e9f35e891886e0a7d62e517c96c1daa8e9877cee;p=thirdparty%2FPython%2Fcpython.git Backport of 1.26: CFStringGetUnicode() returned an extra null character at the end of the string. fixed. --- diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c index d6dba45de379..7bb56e8f2de5 100644 --- a/Mac/Modules/cf/_CFmodule.c +++ b/Mac/Modules/cf/_CFmodule.c @@ -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; diff --git a/Mac/Modules/cf/cfsupport.py b/Mac/Modules/cf/cfsupport.py index f27c58b1613e..9c2880e61f04 100644 --- a/Mac/Modules/cf/cfsupport.py +++ b/Mac/Modules/cf/cfsupport.py @@ -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; """