diff --git a/Source/NSGCString.m b/Source/NSGCString.m index 15701c4f7..f67782904 100644 --- a/Source/NSGCString.m +++ b/Source/NSGCString.m @@ -143,34 +143,23 @@ - (void) encodeWithCoder: aCoder { - [aCoder encodeValueOfObjCType:@encode(unsigned) at:&_count - withName:@"Concrete String count"]; + [aCoder encodeValueOfObjCType:@encode(unsigned) at:&_count]; [aCoder encodeArrayOfObjCType:@encode(unsigned char) count:_count - at:_contents_chars - withName:@"Concrete String content_chars"]; + at:_contents_chars]; } - initWithCoder: aCoder { -#if 0 - [aCoder decodeValueOfObjCType:@encode(char*) at:&_contents_chars - withName:NULL]; - _count = strlen(_contents_chars); - _zone = NSZoneFromPointer(_contents_chars); -#else [aCoder decodeValueOfObjCType:@encode(unsigned) - at:&_count - withName:NULL]; + at:&_count]; if (_count > 0) { _zone = fastZone(self); _contents_chars = NSZoneMalloc(_zone, _count); [aCoder decodeArrayOfObjCType:@encode(unsigned char) count:_count - at:_contents_chars - withName:NULL]; + at:_contents_chars]; } -#endif return self; } diff --git a/Source/NSGString.m b/Source/NSGString.m index fa7014f02..771e8fc5f 100644 --- a/Source/NSGString.m +++ b/Source/NSGString.m @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -254,24 +255,20 @@ - (void) encodeWithCoder: aCoder { - [aCoder encodeValueOfObjCType:@encode(int) at:&_count - withName:@"Concrete String count"]; + [aCoder encodeValueOfObjCType:@encode(int) at:&_count]; [aCoder encodeArrayOfObjCType:@encode(unichar) count:_count - at:_contents_chars - withName:@"Concrete String content_chars"]; + at:_contents_chars]; } - initWithCoder: aCoder { - [aCoder decodeValueOfObjCType:@encode(int) at:&_count - withName:NULL]; + [aCoder decodeValueOfObjCType:@encode(int) at:&_count]; _zone = fastZone(self); _contents_chars = NSZoneMalloc(_zone, sizeof(unichar)*_count); [aCoder decodeArrayOfObjCType:@encode(unichar) count:_count - at:_contents_chars - withName:NULL]; + at:_contents_chars]; return self; } @@ -533,28 +530,23 @@ stringDecrementCountAndFillHoleAt(NSGMutableStringStruct *self, - (void) encodeWithCoder: aCoder // *** changed to unichar { - [aCoder encodeValueOfObjCType:@encode(unsigned) at:&_capacity - withName:@"String capacity"]; - [aCoder encodeValueOfObjCType:@encode(int) at:&_count - withName:@"Concrete String count"]; + [aCoder encodeValueOfObjCType:@encode(unsigned) at:&_capacity]; + [aCoder encodeValueOfObjCType:@encode(int) at:&_count]; [aCoder encodeArrayOfObjCType:@encode(unichar) count:_count - at:_contents_chars - withName:@"Concrete String content_chars"]; + at:_contents_chars]; } - initWithCoder: aCoder // *** changed to unichar { unsigned cap; - [aCoder decodeValueOfObjCType:@encode(unsigned) at:&cap withName:NULL]; + [aCoder decodeValueOfObjCType:@encode(unsigned) at:&cap]; [self initWithCapacity:cap]; - [aCoder decodeValueOfObjCType:@encode(int) at:&_count - withName:NULL]; + [aCoder decodeValueOfObjCType:@encode(int) at:&_count]; [aCoder decodeArrayOfObjCType:@encode(unichar) count:_count - at:_contents_chars - withName:NULL]; + at:_contents_chars]; return self; }