]> granicus.if.org Git - python/commitdiff
CFStringGetUnicode() returned an extra null character at the end of the string.
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 15 Jul 2004 14:11:30 +0000 (14:11 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 15 Jul 2004 14:11:30 +0000 (14:11 +0000)
fixed.

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

index 1f44a8eaef8fa80fb9d0b1a6718728ffaa4b6fbe..85433319fc27ec8a48276c049bae28379e7847b6 100644 (file)
@@ -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;
 
index c244c727dc755fe654c70e660902b60c961c3d19..f236e6d374effa24a6d25594ec52d32ed07eaff9 100644 (file)
@@ -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;
 """