• 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: After 2.2.1: 'AliasRecord' has no member named 'aliasSize'. UNTRUE!!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: After 2.2.1: 'AliasRecord' has no member named 'aliasSize'. UNTRUE!!


  • Subject: Re: After 2.2.1: 'AliasRecord' has no member named 'aliasSize'. UNTRUE!!
  • From: Eric Albert <email@hidden>
  • Date: Wed, 18 Jan 2006 19:30:54 -0800

On Jan 18, 2006, at 7:20 PM, Jerry Krinock wrote:

I have two projects which A and B which include many of the same files. One
of the common files declares an AliasRecord, from Apple's Alias Manager.
AliasRecord is a struct of two members. As you can see in your
documentation, one member is declared as:


unsigned short aliasSize ;

Well, after updating Xcode to 2.2.1 today, Project B started spewing an
error with the following falsehood:

'AliasRecord' has no member named 'aliasSize'

Xcode is using gcc 4.0, and the error causes compiling to fail, regardless
of whether architecture is "ppc i386" or just "ppc".


Now, I am reading this AliasRecord out of a file, decoding it, and then
casting the resulting NSData to an AliasRecord. Here is the snippet that
triggers the error:


AliasRecord aliasHeader = *(AliasPtr)[decodedData bytes];
nBytesAliasRecord = aliasHeader.aliasSize ;

I shipped both projects with this code several weeks ago, and it still
compiles in Project A.

When in doubt, take a look at the header. In this case, you'll see in Aliases.h that the AliasRecord struct is opaque if MAC_OS_X_MIN_VERSION_REQUIRED >= MAC_OS_X_VERSION_10_4. In other words, if the "Mac OS X Deployment Target" setting for your project is 10.4 or later, the AliasRecord struct is opaque.


That's because AliasRecords, as you've noticed, get written to disk but are also referenced in data, which means that they often have to be big-endian even on little-endian systems. Rather than enumerate the cases in which you'd want big- or little-endian AliasRecords, we made the data type opaque and added new APIs which deal in native-endian data. They're Get/SetAliasUserType and GetAliasSize, and there are also FromPtr versions of each if you have an AliasRecord * instead of an AliasHandle.

Here's how to write your code in a way that'll work no matter what your deployment target:
AliasRecord aliasHeader = *(AliasPtr)[decodedData bytes];
#if MAC_OS_X_MIN_VERSION_REQUIRED >= MAC_OS_X_VERSION_10_4
nBytesAliasRecord = GetAliasSize(&aliasHeader) ;
#else
nBytesAliasRecord = aliasHeader.aliasSize ;
#endif


Alternatively, define a GetAliasSize macro for deployment targets < 10.4 and then use GetAliasSize throughout your code.

Hope this helps,
Eric

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


  • Follow-Ups:
    • Re: After 2.2.1: 'AliasRecord' has no member named 'aliasSize'. UNTRUE!!
      • From: Jerry Krinock <email@hidden>
References: 
 >After 2.2.1: 'AliasRecord' has no member named 'aliasSize'. UNTRUE!! (From: Jerry Krinock <email@hidden>)

  • Prev by Date: After 2.2.1: 'AliasRecord' has no member named 'aliasSize'. UNTRUE!!
  • Next by Date: Re: Zerolink slows gdb to a crawl?
  • Previous by thread: After 2.2.1: 'AliasRecord' has no member named 'aliasSize'. UNTRUE!!
  • Next by thread: Re: After 2.2.1: 'AliasRecord' has no member named 'aliasSize'. UNTRUE!!
  • Index(es):
    • Date
    • Thread