NSData Weirdness
NSData Weirdness
- Subject: NSData Weirdness
- From: Isaac Sherman <email@hidden>
- Date: Sat, 10 Aug 2002 22:15:08 -0400
All right, I'm missing something here. I'm using 10.1.5, IB 2.2, PB 1.1.1,
though I don't believe (in fact, I sincerely hope) it is a bug. Here goes:
I create an instance of NSMutableData. So far so good; NSLog reports a
length of 0 bytes. I serialize 3 ints (all BOOLs), at indices 0, 1, and 2.
I then append more data, (also serialized from BOOLs), which were also
serialized at concurrent indices, 0-6. I then serialize a final int at
index 9, using 10 bytes total (or I should have, anyway).
But NSLog reports that there are 15 bytes of data, however. Furthermore, at
the end of the first step, there are 5 bytes total length, after 0, 1, and
2. So, 3=5, and 7=10. Obviously, these are illegal lvalues, and I must be
missing something. Apparently NSMutableData allocs 4 bytes to store the
first serialize... message, but after that, it adds only 1. Any ways around
this?
The relevant NSLog report shows this fairly clearly. Here it is, from the
data I'm trying to append:
Data=<>, length is 0 bytes.//Newly Alloced
Data=<00000000 >, length is 4 bytes.//serializeIntAtIndex:0
Data=<00000000 00>, length is 5 bytes.//etc
Data=<00000000 0000>, length is 6 bytes.
Data=<00000001 000000>, length is 7 bytes.
Data=<00000001 01000000 >, length is 8 bytes.
Data=<00000001 01010000 00>, length is 9 bytes.
Data=<00000001 01010100 0000>, length is 10 bytes.
Any thoughts/explanations? This seems strange to me, since I use data
fairly often, just never in chunks this large.
TIA,
--
Isaac Sherman
MotaSoft Software
http://homepage.mac.com/huperzoevs/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.