@@ -24,11 +24,11 @@ #import "OFArray.h" #import "OFArray_subarray.h" #import "OFArray_adjacent.h" #import "OFString.h" #import "OFXMLElement.h" -#import "OFDataArray.h" +#import "OFData.h" #import "OFNull.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" @@ -654,17 +654,17 @@ objc_autoreleasePoolPop(pool); return JSON; } -- (OFDataArray *)messagePackRepresentation +- (OFData *)messagePackRepresentation { - OFDataArray *data; + OFMutableData *data; size_t i, count; void *pool; - data = [OFDataArray dataArray]; + data = [OFMutableData data]; count = [self count]; if (count <= 15) { uint8_t tmp = 0x90 | ((uint8_t)count & 0xF); [data addItem: &tmp]; @@ -688,11 +688,11 @@ pool = objc_autoreleasePoolPush(); i = 0; for (id object in self) { void *pool2 = objc_autoreleasePoolPush(); - OFDataArray *child; + OFData *child; i++; child = [object messagePackRepresentation]; [data addItems: [child items] @@ -700,10 +700,12 @@ objc_autoreleasePoolPop(pool2); } assert(i == count); + + [data makeImmutable]; objc_autoreleasePoolPop(pool); return data; }