Bugfix for encoding.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3238 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1998-11-19 12:03:24 +00:00
parent 422963b224
commit 4f352e2786

View file

@ -1468,9 +1468,12 @@ failure:
{ {
[aCoder encodeValueOfObjCType: @encode(unsigned long) [aCoder encodeValueOfObjCType: @encode(unsigned long)
at: &length]; at: &length];
if (length)
{
[aCoder encodeArrayOfObjCType: @encode(unsigned char) [aCoder encodeArrayOfObjCType: @encode(unsigned char)
count: length count: length
at: bytes]; at: bytes];
}
} }
/* Basic methods */ /* Basic methods */
@ -2215,12 +2218,14 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
- (id) initWithCoder: (NSCoder*)aCoder - (id) initWithCoder: (NSCoder*)aCoder
{ {
unsigned l; unsigned l;
void* b; void *b;
[aCoder decodeValueOfObjCType: @encode(unsigned long) at: &l]; [aCoder decodeValueOfObjCType: @encode(unsigned long) at: &l];
if (l) { if (l)
{
[self initWithCapacity: l]; [self initWithCapacity: l];
if (bytes == 0) { if (bytes == 0)
{
NSLog(@"[NSMutableDataMalloc -initWithCoder:] unable to allocate %lu bytes", l); NSLog(@"[NSMutableDataMalloc -initWithCoder:] unable to allocate %lu bytes", l);
[self release]; [self release];
return nil; return nil;