View Full Version : Is data serialized/inflated via NSArchiver/NSUnarchiver safe for ppc/intel crossover?
TomorrowPlusX
2006.04.11, 11:38 AM
I'm using NSArchiver to serialize a fair amount of font-metric information for a new font renderer I'm writing, and I'm using NSUnarchiver to unarchive it. Basically, I'm just writing out a long string of bytes ( an array of structs, where each struct holds glyph info ).
My question is, if I serialize the font info on my PPC laptop, will it inflate correctly on an intel Mac?
Taxxodium
2006.04.11, 12:11 PM
If you use NSUnarchiver, yes! NSUnarchiver works the same on PPC as on Intel
TomorrowPlusX
2006.04.11, 01:10 PM
Excellent... thanks!
If you use NSUnarchiver, yes! NSUnarchiver works the same on PPC as on Intel
This is only true if you use the basic formats, such as int, float, double, etc.
Writing an array of structs by taking the bytes and writing them out one by one is definitely the wrong thing to do. It will definitely have endian issues, and it may even have padding issues on the same platform depending on compiler version etc.
You should archive each field of each structure with the appropriate calls, that is the only guaranteed way it will work.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.