Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSData dataWithBytes problem on Intel




On Mar 20, 2007, at 6:04 PM, Sam Waters wrote:

I've found that if I do this:

NSData * dTempData = [NSData dataWithBytes:pBytes length:iLen];

and later on do this:

NSData * dTempData2 = [NSData dataWithBytes:pOtherBytes length:iOtherLen];

then everything is fine for both Intel and PPC, but am worried I'm doing
something fundamentally wrong. PLEASE let me know if I'm doing something
terribly wrong here, I'm new at this!

I think the bug is probably outside of the code you're showing us because there's no way for NSData to know which variable you're assigning object pointer to.


Try something like this:

NSData * dTempData = [NSData dataWithBytes:pBytes length:iLen];
pOtherBytes = pBytes;
iOtherLen = iLen;
dTempData = [NSData dataWithBytes:pOtherBytes length:iOtherLen];

If that works, then it's probably a problem with the way either pOtherBytes or iOtherLen is being set up. On the other hand, if it still crashes, then it might have something to do with the way dTempData is being used after the second assignment.

As for why you see problems on Intel and not PowerPC, it's hard to say without knowing seeing the context of the rest of the code.

    - Scott
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSData dataWithBytes problem on Intel (From: Sam Waters <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.