diff --git a/Source/NSPortCoder.m b/Source/NSPortCoder.m
index cdec56a9e..ef7d4ee6c 100644
--- a/Source/NSPortCoder.m
+++ b/Source/NSPortCoder.m
@@ -35,6 +35,7 @@
#include
#include
#include
+#include
#include
#include
@@ -213,6 +214,20 @@ static BOOL debug_connected_coder = NO;
return;
}
+- (void) encodeDataObject: (NSData*)anObject
+{
+ unsigned l = [anObject length];
+
+ [self encodeValueOfObjCType: @encode(unsigned) at: &l];
+ if (l)
+ {
+ const void *b = [anObject bytes];
+
+ [self encodeArrayOfObjCType: @encode(unsigned char)
+ count: l
+ at: b];
+ }
+}
@end
@@ -351,6 +366,33 @@ static BOOL debug_connected_coder = NO;
[self release];
}
+- (NSData*) decodeDataObject
+{
+ unsigned l;
+
+ [self decodeValueOfObjCType: @encode(unsigned) at: &l];
+ if (l)
+ {
+ void *b;
+ NSData *d;
+ NSZone *z;
+
+#if GS_WITH_GC
+ z = GSAtomicMallocZone();
+#else
+ z = NSDefaultMallocZone();
+#endif
+ b = NSZoneMalloc(z, l);
+ [self decodeArrayOfObjCType: @encode(unsigned char)
+ count: l
+ at: b];
+ d = [[NSData alloc] initWithBytesNoCopy: b length: l fromZone: z];
+ IF_NO_GC(AUTORELEASE(d));
+ return d;
+ }
+ return [NSData data];
+}
+
@end