[darwinbuild-changes] [596] trunk/darwinxref/cfutils.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Oct 12 15:40:22 PDT 2009


Revision: 596
          http://trac.macosforge.org/projects/darwinbuild/changeset/596
Author:   wsiegrist at apple.com
Date:     2009-10-12 15:40:21 -0700 (Mon, 12 Oct 2009)
Log Message:
-----------
CFStringGetBytes returns number of characters, so we need to retrive number of bytes as well for determining where to put the null at the end of result buffer.

Modified Paths:
--------------
    trunk/darwinxref/cfutils.c

Modified: trunk/darwinxref/cfutils.c
===================================================================
--- trunk/darwinxref/cfutils.c	2009-10-09 22:52:07 UTC (rev 595)
+++ trunk/darwinxref/cfutils.c	2009-10-12 22:40:21 UTC (rev 596)
@@ -54,8 +54,9 @@
                 CFIndex size = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
                 result = malloc(size+1);
                 if (result != NULL) {
-                        length = CFStringGetBytes(str, CFRangeMake(0, length), kCFStringEncodingUTF8, '?', 0, (UInt8*)result, size, NULL);
-                        result[length] = 0;
+			CFIndex numbytes;
+                        length = CFStringGetBytes(str, CFRangeMake(0, length), kCFStringEncodingUTF8, '?', 0, (UInt8*)result, size, &numbytes);
+                        result[numbytes] = 0;
                 }
         }
         return result;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20091012/a60799af/attachment.html>


More information about the darwinbuild-changes mailing list