Ronald Oussoren committed a857f46

Merged revisions 2592 via svnmerge from

r2592 | ronaldoussoren | 2010-09-08 17:09:30 +0200 (Wed, 08 Sep 2010) | 3 lines

Ensure that the pyobjc_unicode's internal storage is NUL terminated,
some C extensions expect them to be.

Comments (0)

Files changed (1)


 	 *  		NSArray.alloc().init()
 	PyObjCUnicodeObject* result;
-// XXX - I don't know how to get gcc to let me use sizeof(unichar)
 	Py_ssize_t length = [value length];
 	result = PyObject_New(PyObjCUnicodeObject, &PyObjCUnicode_Type);
 	Py_UNICODE* tptr = PyObject_MALLOC(sizeof(Py_UNICODE) * (length+1));
+	tptr[0] = tptr[length] = 0;
 	result->base.str = tptr;
 	/*PyUnicode_AS_UNICODE(result) = tptr;*/
 	tptr = NULL;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.