Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Saving CFArray/CFDict/CFData to disk
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving CFArray/CFDict/CFData to disk




On May 24, 2007, at 10:31 AM, Laurence Harris wrote:


On May 24, 2007, at 8:19 AM, Bernie wrote:

Robert P wrote:

Further, you will then find that what is written to the file is not the string "MyData" but an obfuscated representation of a raw CFStringRef value, for example:
<array>
<data>
GCAAAA==
</data>
</array>


This seems, er, an unusual way to manipulate a CFStringRef, which at best can remain valid only during the lifetime of the app.

Ouch!

Looks like I need a rethink on my struct (or the way I read/write to disk). Plus, I may encounter similar problems with iconRef and menuRef:

Indeed. What exactly are you trying to accomplish with this? CFStringRefs, IconRef, and MenuRefs are all pointers to opaque data, as you must surely know, and hence only valid during the life of the process in which they are created. Why would you store them in a file?

Obviously something like a CFStringRef is serializable though. You could output a serialized form of the data.
(Not sure how you could do this with an IconRef or MenuRef though, since non-Core Foundation objects probably don't incorporate the concept of being serialized into a dictionary.)



Larry


//--------------- typedef struct DBData { union { struct { CFStringRef string; IconRef iconRef; RGBColor rgb; } v1; struct { SInt32 val; SInt32 min; SInt32 max; MenuRef menuRef; } v2; struct { CFAbsoluteTime date; } v3;

		struct {
			ThemeButtonValue  btnVal;
		} v4;
	} u;
} DBData;

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


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >re: Saving CFArray/CFDict/CFData to disk (From: George Warner <email@hidden>)
 >Re: Saving CFArray/CFDict/CFData to disk (From: Bernie <email@hidden>)
 >Re: Saving CFArray/CFDict/CFData to disk (From: Frederick Cheung <email@hidden>)
 >Re: Saving CFArray/CFDict/CFData to disk (From: Bernie <email@hidden>)
 >Re: Saving CFArray/CFDict/CFData to disk (From: Laurence Harris <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.