From d9e50f554f4ce51681cc399e7ff55cd716898322 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Thu, 15 Jul 2004 14:11:30 +0000 Subject: [PATCH] CFStringGetUnicode() returned an extra null character at the end of the string. fixed. --- Mac/Modules/cf/_CFmodule.c | 2 +- Mac/Modules/cf/cfsupport.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Mac/Modules/cf/_CFmodule.c b/Mac/Modules/cf/_CFmodule.c index 1f44a8eaef8..85433319fc2 100644 --- a/Mac/Modules/cf/_CFmodule.c +++ b/Mac/Modules/cf/_CFmodule.c @@ -2349,7 +2349,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 c244c727dc7..f236e6d374e 100644 --- a/Mac/Modules/cf/cfsupport.py +++ b/Mac/Modules/cf/cfsupport.py @@ -575,7 +575,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; """