cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1255 Mac code is using availability macros incorrectly

From: Edward Rudd <urkle_at_users.sf.net>
Date: Thu, 18 Jul 2013 22:07:10 +0000

It's almost there.. your lib/md5.c and src/tool_metalink.c still have checks against the __MAC and __IPHONE macros.. and I'll need to do some more testing on the "CopyIdentityWithLabel" method.. as it doesn't compile on a 10.6 SDK, so I'm going to compile on a 10.7/8 SDK and test that functionality on a 10.6 box to ensure the run-time checks work correctly. (yes SecItemCopyMatching was added in 10.6 BUT kSecClassIdentity was added on 10.7)

---
** [bugs:#1255] Mac code is using availability macros incorrectly**
**Status:** closed-works-for-me
**Created:** Thu Jul 11, 2013 05:23 PM UTC by Edward Rudd
**Last Updated:** Thu Jul 18, 2013 09:46 PM UTC
**Owner:** Daniel Stenberg
Currently the libcurl code checks for __MAC_10_? and __IPHONE_?_? to determine what it is compiling against..  However that is incorrect usage, as those macros document what is installed on the development system, not what SDK is being compiled against. (yeah.. rather silly IMHO).
The cause is that some of the recent changes in darwin_ssl fail to compile when compiling on a 10.6 SDK.  The CopyIdentityWithLabel includes some new code that has this define check
    ::c
    #if defined(__MAC_10_6) || defined(__IPHONE_2_0)
    // check and use SecItemCopyMatching()
    #endif
However, the SecItemCopyMatching code does not in fact compile on 10.6 SDK as an extra header needs to be included explicitly (<Security/SecItem.h>) AND it doesn't define kSecClassIdentity.
Now changing the definition to
    ::c
    #if defined(__MAC_10_7) || defined(__IPHONE_2_0)
however does not work as my /usr/include/Availability.h defines __IPHONE_2_0 (even in an Mac compilation) as I have that SDK installed on my system!.
The proper checks should be 
    ::c
    #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 || __IPHONE_OS_VERSION_MAX_ALLOWED >= 20000
Read more on this usage in the Availability.h header itself..  These defines are automatically set by the compiler according to which SDK is being used to compile with.  (and in the case of OS X compiling the iphone define is undefined and evaluates as 0 in the comparison so it works correctly.
---
Sent from sourceforge.net because curl-tracker@cool.haxx.se is subscribed to https://sourceforge.net/p/curl/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/curl/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
Received on 2013-07-19

These mail archives are generated by hypermail.

donate! Page updated May 06, 2013.
web site info

File upload with ASP.NET