[Substrate-commits] SF.net SVN: substrate: [303] trunk/Foundation/NSConcreteData.m
Brought to you by:
landonf
|
From: <la...@us...> - 2006-09-02 05:58:52
|
Revision: 303
http://svn.sourceforge.net/substrate/?rev=303&view=rev
Author: landonf
Date: 2006-09-01 22:58:49 -0700 (Fri, 01 Sep 2006)
Log Message:
-----------
Make sure we always initialize memory, newly allocated or not
Modified Paths:
--------------
trunk/Foundation/NSConcreteData.m
Modified: trunk/Foundation/NSConcreteData.m
===================================================================
--- trunk/Foundation/NSConcreteData.m 2006-09-02 05:51:51 UTC (rev 302)
+++ trunk/Foundation/NSConcreteData.m 2006-09-02 05:58:49 UTC (rev 303)
@@ -222,10 +222,14 @@
}
- (void) setLength:(unsigned int)length {
- if (length > _capacity) {
+ /* Grow our capacity */
+ if (length > _capacity)
[self _growCapacity: length];
+
+ /* Initialize our (possibly new) memory */
+ if (length > _length)
memset(_bytes + _length, 0, length - _length);
- }
+
_length = length;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|