curl-library
[PATCH] Three trivial warning fixes
Date: Mon, 2 Dec 2013 21:16:59 -0800
In case something is unusable from the raw email text, I've also attached these patch files as file attachments.
In the Windows threading code, Visual Studio didn't like the cast from type "long", a 32-bit value even in 64-bit Windows, to type void *, because it thinks we might have truncated a pointer.
diff -ur curl-7.33.0-clean/lib/curl_threads.c curl-7.33.0-modified/lib/curl_threads.c
--- curl-7.33.0-clean/lib/curl_threads.c 2013-09-08 15:11:15.000000000 -0700
+++ curl-7.33.0-modified/lib/curl_threads.c 2013-10-31 21:25:41.003075748 -0700
@@ -104,7 +104,7 @@
#else
curl_thread_t t;
t = (curl_thread_t)_beginthreadex(NULL, 0, func, arg, 0, NULL);
- if((t == 0) || (t == (curl_thread_t)-1L))
+ if((t == 0) || (t == (curl_thread_t)(intptr_t)-1L))
return curl_thread_t_null;
return t;
#endif
Various compilers warned us about a negative signed int, -1, being written to an unsigned int variable, pop3c->preftype in pop3.c line 1784.
diff -ur curl-7.33.0-clean/lib/pop3.h curl-7.33.0-modified/lib/pop3.h
--- curl-7.33.0-clean/lib/pop3.h 2013-10-12 13:24:12.000000000 -0700
+++ curl-7.33.0-modified/lib/pop3.h 2013-11-01 16:26:30.883479981 -0700
@@ -92,7 +92,7 @@
/* Authentication type values */
#define POP3_TYPE_NONE 0
-#define POP3_TYPE_ANY ~0
+#define POP3_TYPE_ANY ~0U
/* This is the 5-bytes End-Of-Body marker for POP3 */
#define POP3_EOB "\x0d\x0a\x2e\x0d\x0a"
In curl_darwinssl.c, CopyIdentityWithLabelOldSchool's #if guards were using the wrong macro; they were using 10.7.0 (Lion) when the comments said that the function was only supposed to be compiled if Snow Leopard support is required. Indeed we did get deprecation warnings once we set the minimum Mac OS X version to 10.7.0, hence the patch.
diff -ur curl-7.33.0-clean/lib/curl_darwinssl.c curl-7.33.0-modified/lib/curl_darwinssl.c
--- curl-7.33.0-clean/lib/curl_darwinssl.c 2013-10-12 13:24:12.000000000 -0700
+++ curl-7.33.0-modified/lib/curl_darwinssl.c 2013-12-02 21:09:17.005909203 -0800
@@ -834,7 +834,7 @@
return server_cert_summary;
}
-#if CURL_SUPPORT_MAC_10_7
+#if CURL_SUPPORT_MAC_10_6
/* The SecKeychainSearch API was deprecated in Lion, and using it will raise
deprecation warnings, so let's not compile this unless it's necessary: */
static OSStatus CopyIdentityWithLabelOldSchool(char *label,
@@ -874,7 +874,7 @@
CFRelease(search);
return status;
}
-#endif /* CURL_SUPPORT_MAC_10_7 */
+#endif /* CURL_SUPPORT_MAC_10_6 */
static OSStatus CopyIdentityWithLabel(char *label,
SecIdentityRef *out_cert_and_key)
@@ -914,12 +914,12 @@
CFRelease(query_dict);
}
else {
-#if CURL_SUPPORT_MAC_10_7
+#if CURL_SUPPORT_MAC_10_6
/* On Leopard and Snow Leopard, fall back to SecKeychainSearch. */
status = CopyIdentityWithLabelOldSchool(label, out_cert_and_key);
#endif /* CURL_SUPPORT_MAC_10_7 */
}
-#elif CURL_SUPPORT_MAC_10_7
+#elif CURL_SUPPORT_MAC_10_6
/* For developers building on older cats, we have no choice but to fall back
to SecKeychainSearch. */
status = CopyIdentityWithLabelOldSchool(label, out_cert_and_key);
By the way, we believe that it would be wise to change the CURL_BUILD_MAC_* and CURL_SUPPORT_MAC_* macros to put parentheses around their respective expressions, but we're not submitting a patch for that.
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
- application/octet-stream attachment: 01-thread-handle-warning.patch
- application/octet-stream attachment: 02-pop3-signedness-warning.patch
- application/octet-stream attachment: 03-keychain-search-version.patch