Re: Importing CICN resources from file
Re: Importing CICN resources from file
- Subject: Re: Importing CICN resources from file
- From: Uli Kusterer <email@hidden>
- Date: Sat, 18 Nov 2006 21:08:20 +0100
Am 18.11.2006 um 19:14 schrieb malcom:
2006-11-18 19:09:28.658 nemo[4233] there are 191 CICNs in this file.
CoreEndianFlipData: error -4940 returned for rsrc type cicn (id 30285,
length 8538, native = no)
2006-11-18 19:09:28.661 nemo[4233] Get1IndResource error, -4940
CoreEndianFlipData: error -4940 returned for rsrc type cicn (id 30305,
length 23130, native = no)
This is really more suited for the Carbon-Dev list, but I think you
have to register an endian-flipping callback with the Resource
Manager so it can translate the icons' size etc. I guess Apple don't
include a flipper for cicns in OS X.
Anyone know how to solve it?
See above for a real fix. A workaround for now may be to just run
the app in Rosetta. Another fix would be to install a do-nothing
flipper callback and change your code to assume any data it gets is
PowerPC-endian and convert it whenever used in the code that reads it.
This is the class code:
http://www.cocoabuilder.com/archive/message/cocoa/2002/5/20/65965
BTW -- the URL in there is outdated. It downloads a text file
pointing you at a new file:
http://homepage.mac.com/estebanuribe/CIconViewer.tgz
And that file has lots of issues. For one, it calls DetachResource()
instead of ReleaseResource(), and thus leaks resource Handles like
nobody's business. It also stores a P-String as a C-String. Change:
( (cicnName[0]!=0)?[NSString stringWithCString:cicnName length:
(cicnName[0]+1)]: @""), @"name", nil]];
to
( (cicnName[0]!=0)?[NSString stringWithCString:cicnName+1
length:cicnName[0]]: @""), @"name", nil]];
to fix that. Also, the Get1Resource() stuff may not even be
necessary. Have you tried just using the _createNSImageForCICN method
directly? That uses GetCIcon, so doesn't even need the resource data
that the code above it leaks. An alternative may be to call SetResLoad
(false), which should keep Get1Resource() from actually loading any
resource data and might avoid the error message. If you're lucky,
GetCIcon() works on Intel, and that's why GetResource() & co. weren't
given a flipper for cicns.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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