• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: MFC Porting Issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MFC Porting Issues


  • Subject: Re: MFC Porting Issues
  • From: Ricky Sharp <email@hidden>
  • Date: Sat, 21 Jan 2006 10:39:33 -0600


On Jan 20, 2006, at 3:41 PM, Kevin Wojniak wrote:

I think I realized what the problem is. When I was comparing the values in the debugger to the actual data it's reading from, some of the values appeared to not have been byte swapped, while others were. And this was only on the 2nd time, not the first. But I realized that when I'm swapping the bytes, I'm only working on the pointer, which is still pointer to the original data, so the original data is getting swapped back and forth each time. So I guess I have to change how it stores and reads this structure.

typedef struct
{
        BYTE b1[8];
        DWORD height;
        DWORD width;
        WORD w1;
        WORD bitDepth;
        DWORD d2;
        DWORD blockLen;
} IPOD_PICTURE_HEADER;


BYTE = unsigned char DWORD = unsigned long WORD = unsigned char

Along with ensuring proper alignment and byte-swapping of the fields, I strongly suggest the usage of "sized" types that guarantee size (e.g. UInt16, UInt32, Bool8, etc.) You typically define these types in some include/import file where they'd be mapped to the appropriate type that each platform defines.


This is always necessary for structures that will be populated with data from some persistent store.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: MFC Porting Issues
      • From: John Stiles <email@hidden>
References: 
 >MFC Porting Issues (From: Kevin Wojniak <email@hidden>)
 >Re: MFC Porting Issues (From: Shawn Erickson <email@hidden>)
 >Re: MFC Porting Issues (From: Kevin Wojniak <email@hidden>)
 >Re: MFC Porting Issues (From: Dave Camp <email@hidden>)
 >Re: MFC Porting Issues (From: Kevin Wojniak <email@hidden>)

  • Prev by Date: Re: anotherDockProgram-help
  • Next by Date: Document Packages Examples...
  • Previous by thread: Re: MFC Porting Issues
  • Next by thread: Re: MFC Porting Issues
  • Index(es):
    • Date
    • Thread