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: Do deprecated APIs provide byte swapping on the Mac Intel platform?



On 10/31/05 1:59 PM, Joseph Maurer didst favor us with:

> On Oct 28, 2005, at 3:49 AM, Laurence Harris wrote:
> 
>> With very, very few exceptions*, byte swapping is only an issue  when reading
>> from or writing to disk, or transmitting data over a network or to  another
>> process. APIs like GetGWorldPixMap only operate on data created at  runtime
>> in your memory space, so there's never any byte-swapping to be  done. Their
>> data is already in native endian.
>> 
>> As a natural consequence of the above, APIs (other than those that do
>> byte-swapping like CFSwapInt32HostToBig and the very few exceptions
>> mentioned above) never swap bytes as far as I know.
>> 
>> *IconFamilyHandle data is always big endian, for example, because  you can
>> create them at runtime, read them from resources, or read them  from .icns
>> files, so to they're always big endian to avoid confusion.
> 
> Another exception: PICT data are kept big endian in memory, too;

That makes sense since you can create PicHandles at runtime or read them
from disk as well. I didn't mean to suggest that IconFamilyHandles where the
only exception, they were just the only one that came to mind at the time.

> so  you need to replace occurrences of
> 
> &(**myPictHandle).picFrame
> 
> by
> 
> Rect myPicFrame;
> QDGetPictureBounds(myPictHandle, &myPicFrame);

So that means you need to swap the picSize value as well if you access it
(which I don't ;-).

Larry

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Do deprecated APIs provide byte swapping on the Mac Intel platform? (From: Joseph Maurer <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.