md5 & metalink: use better build macros on Apple operating systems
authorNick Zitzmann <nickzman@gmail.com>
Wed, 31 Jul 2013 02:20:20 +0000 (20:20 -0600)
committerNick Zitzmann <nickzman@gmail.com>
Wed, 31 Jul 2013 02:20:20 +0000 (20:20 -0600)
Previously we used __MAC_10_X and __IPHONE_X to mark digest-generating
code that was specific to OS X and iOS. Now we use
__MAC_OS_X_VERSION_MAX_ALLOWED and __IPHONE_OS_VERSION_MAX_ALLOWED
instead of those macros.

Bug: http://sourceforge.net/p/curl/bugs/1255/
Reported by: Edward Rudd

lib/md5.c
src/tool_metalink.c

index 57efa43..1c201f3 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -90,13 +90,16 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX * ctx)
 #    include <md5.h>
 #  endif
 
-#elif defined(__MAC_10_4) || defined(__IPHONE_5_0)
+#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
+              (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \
+      (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
+              (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
 
 /* For Apple operating systems: CommonCrypto has the functions we need.
    The library's headers are even backward-compatible with OpenSSL's
    headers as long as we define COMMON_DIGEST_FOR_OPENSSL first.
 
-   These functions are available on Tiger and later, as well as iOS 5.0
+   These functions are available on Tiger and later, as well as iOS 2.0
    and later. If you're building for an older cat, well, sorry. */
 #  define COMMON_DIGEST_FOR_OPENSSL
 #  include <CommonCrypto/CommonDigest.h>
index f9e9869..be5fc26 100644 (file)
 #  ifdef HAVE_NSS_INITCONTEXT
      static NSSInitContext *nss_context;
 #  endif
-#elif defined(__MAC_10_4) || defined(__IPHONE_5_0)
+#elif (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && \
+              (__MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)) || \
+      (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && \
+              (__IPHONE_OS_VERSION_MAX_ALLOWED >= 20000))
 /* For Apple operating systems: CommonCrypto has the functions we need.
    The library's headers are even backward-compatible with OpenSSL's
    headers as long as we define COMMON_DIGEST_FOR_OPENSSL first.
 
-   These functions are available on Tiger and later, as well as iOS 5.0
+   These functions are available on Tiger and later, as well as iOS 2.0
    and later. If you're building for an older cat, well, sorry. */
 #  define COMMON_DIGEST_FOR_OPENSSL
 #  include <CommonCrypto/CommonDigest.h>