[PyObjC-svn] r2593 - in branches/pyobjc-2.3.x: . pyobjc-core/Modules/objc

[email protected] Wed, 08 Sep 2010 10:49:12 -0500
Newsgroups gmane.comp.python.pyobjc.cvs
Message-ID <[email protected]>
Author: ronaldoussoren
Date: Wed Sep  8 10:49:12 2010
New Revision: 2593

Log:
Merged revisions 2592 via svnmerge from 
https://svn.red-bean.com/pyobjc/trunk/pyobjc

........
  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.
........


Modified:
   branches/pyobjc-2.3.x/   (props changed)
   branches/pyobjc-2.3.x/pyobjc-core/Modules/objc/unicode-object.m

Modified: branches/pyobjc-2.3.x/pyobjc-core/Modules/objc/unicode-object.m
==============================================================================
--- branches/pyobjc-2.3.x/pyobjc-core/Modules/objc/unicode-object.m	(original)
+++ branches/pyobjc-2.3.x/pyobjc-core/Modules/objc/unicode-object.m	Wed Sep  8 10:49:12 2010
@@ -227,7 +227,7 @@
 	 *  		NSArray.alloc().init()
 	 */
 	PyObjCUnicodeObject* result;
-// XXX - I don't know how to get gcc to let me use sizeof(unichar)
+
 #ifdef PyObjC_UNICODE_FAST_PATH
 	Py_ssize_t length = [value length];
 
@@ -237,6 +237,7 @@
 	}
 	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;

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd