[collectd] [PATCH] curl's numeric options are always at minimum long, never int

Dan Fandrich dan at coneharvesters.com
Sat Feb 2 01:19:48 CET 2013


This can affect portability to some architectures.
---
 src/apache.c     |   12 ++++++------
 src/ascent.c     |   12 ++++++------
 src/bind.c       |    4 ++--
 src/curl.c       |    8 ++++----
 src/curl_json.c  |    6 +++---
 src/curl_xml.c   |    2 +-
 src/nginx.c      |   12 ++++++------
 src/write_http.c |    6 +++---
 8 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/src/apache.c b/src/apache.c
index c31dd87..202b73c 100644
--- a/src/apache.c
+++ b/src/apache.c
@@ -373,7 +373,7 @@ static int init_host (apache_t *st) /* {{{ */
 		return (-1);
 	}
 
-	curl_easy_setopt (st->curl, CURLOPT_NOSIGNAL, 1);
+	curl_easy_setopt (st->curl, CURLOPT_NOSIGNAL, 1L);
 	curl_easy_setopt (st->curl, CURLOPT_WRITEFUNCTION, apache_curl_callback);
 	curl_easy_setopt (st->curl, CURLOPT_WRITEDATA, st);
 
@@ -425,24 +425,24 @@ static int init_host (apache_t *st) /* {{{ */
 	}
 
 	curl_easy_setopt (st->curl, CURLOPT_URL, st->url);
-	curl_easy_setopt (st->curl, CURLOPT_FOLLOWLOCATION, 1);
+	curl_easy_setopt (st->curl, CURLOPT_FOLLOWLOCATION, 1L);
 
 	if (st->verify_peer != 0)
 	{
-		curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYPEER, 1);
+		curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYPEER, 1L);
 	}
 	else
 	{
-		curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYPEER, 0);
+		curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYPEER, 0L);
 	}
 
 	if (st->verify_host != 0)
 	{
-		curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYHOST, 2);
+		curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYHOST, 2L);
 	}
 	else
 	{
-		curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYHOST, 0);
+		curl_easy_setopt (st->curl, CURLOPT_SSL_VERIFYHOST, 0L);
 	}
 
 	if (st->cacert != NULL)
diff --git a/src/ascent.c b/src/ascent.c
index 993e480..3a7c393 100644
--- a/src/ascent.c
+++ b/src/ascent.c
@@ -539,7 +539,7 @@ static int ascent_init (void) /* {{{ */
     return (-1);
   }
 
-  curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1);
+  curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1L);
   curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, ascent_curl_callback);
   curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION);
   curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, ascent_curl_error);
@@ -561,17 +561,17 @@ static int ascent_init (void) /* {{{ */
   }
 
   curl_easy_setopt (curl, CURLOPT_URL, url);
-  curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1);
+  curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
 
   if ((verify_peer == NULL) || IS_TRUE (verify_peer))
-    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1);
+    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1L);
   else
-    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0);
+    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0L);
 
   if ((verify_host == NULL) || IS_TRUE (verify_host))
-    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 2);
+    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 2L);
   else
-    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0);
+    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0L);
 
   if (cacert != NULL)
     curl_easy_setopt (curl, CURLOPT_CAINFO, cacert);
diff --git a/src/bind.c b/src/bind.c
index 5b7d7a0..288949a 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -1393,12 +1393,12 @@ static int bind_init (void) /* {{{ */
     return (-1);
   }
 
-  curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1);
+  curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1L);
   curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, bind_curl_callback);
   curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION);
   curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, bind_curl_error);
   curl_easy_setopt (curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL);
-  curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1);
+  curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
 
   return (0);
 } /* }}} int bind_init */
diff --git a/src/curl.c b/src/curl.c
index 2160b98..69a5b95 100644
--- a/src/curl.c
+++ b/src/curl.c
@@ -370,14 +370,14 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */
     return (-1);
   }
 
-  curl_easy_setopt (wp->curl, CURLOPT_NOSIGNAL, 1);
+  curl_easy_setopt (wp->curl, CURLOPT_NOSIGNAL, 1L);
   curl_easy_setopt (wp->curl, CURLOPT_WRITEFUNCTION, cc_curl_callback);
   curl_easy_setopt (wp->curl, CURLOPT_WRITEDATA, wp);
   curl_easy_setopt (wp->curl, CURLOPT_USERAGENT,
       PACKAGE_NAME"/"PACKAGE_VERSION);
   curl_easy_setopt (wp->curl, CURLOPT_ERRORBUFFER, wp->curl_errbuf);
   curl_easy_setopt (wp->curl, CURLOPT_URL, wp->url);
-  curl_easy_setopt (wp->curl, CURLOPT_FOLLOWLOCATION, 1);
+  curl_easy_setopt (wp->curl, CURLOPT_FOLLOWLOCATION, 1L);
 
   if (wp->user != NULL)
   {
@@ -399,9 +399,9 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */
     curl_easy_setopt (wp->curl, CURLOPT_USERPWD, wp->credentials);
   }
 
-  curl_easy_setopt (wp->curl, CURLOPT_SSL_VERIFYPEER, wp->verify_peer);
+  curl_easy_setopt (wp->curl, CURLOPT_SSL_VERIFYPEER, (long) wp->verify_peer);
   curl_easy_setopt (wp->curl, CURLOPT_SSL_VERIFYHOST,
-      wp->verify_host ? 2 : 0);
+      wp->verify_host ? 2L : 0L);
   if (wp->cacert != NULL)
     curl_easy_setopt (wp->curl, CURLOPT_CAINFO, wp->cacert);
 
diff --git a/src/curl_json.c b/src/curl_json.c
index cc8b4ad..2ddaff3 100644
--- a/src/curl_json.c
+++ b/src/curl_json.c
@@ -521,7 +521,7 @@ static int cj_init_curl (cj_t *db) /* {{{ */
     return (-1);
   }
 
-  curl_easy_setopt (db->curl, CURLOPT_NOSIGNAL, 1);
+  curl_easy_setopt (db->curl, CURLOPT_NOSIGNAL, 1L);
   curl_easy_setopt (db->curl, CURLOPT_WRITEFUNCTION, cj_curl_callback);
   curl_easy_setopt (db->curl, CURLOPT_WRITEDATA, db);
   curl_easy_setopt (db->curl, CURLOPT_USERAGENT,
@@ -549,9 +549,9 @@ static int cj_init_curl (cj_t *db) /* {{{ */
     curl_easy_setopt (db->curl, CURLOPT_USERPWD, db->credentials);
   }
 
-  curl_easy_setopt (db->curl, CURLOPT_SSL_VERIFYPEER, (int) db->verify_peer);
+  curl_easy_setopt (db->curl, CURLOPT_SSL_VERIFYPEER, (long) db->verify_peer);
   curl_easy_setopt (db->curl, CURLOPT_SSL_VERIFYHOST,
-                    (int) (db->verify_host ? 2 : 0));
+                    db->verify_host ? 2L : 0L);
   if (db->cacert != NULL)
     curl_easy_setopt (db->curl, CURLOPT_CAINFO, db->cacert);
 
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 46e0d49..da90d7c 100644
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
@@ -737,7 +737,7 @@ static int cx_init_curl (cx_t *db) /* {{{ */
     return (-1);
   }
 
-  curl_easy_setopt (db->curl, CURLOPT_NOSIGNAL, 1);
+  curl_easy_setopt (db->curl, CURLOPT_NOSIGNAL, 1L);
   curl_easy_setopt (db->curl, CURLOPT_WRITEFUNCTION, cx_curl_callback);
   curl_easy_setopt (db->curl, CURLOPT_WRITEDATA, db);
   curl_easy_setopt (db->curl, CURLOPT_USERAGENT,
diff --git a/src/nginx.c b/src/nginx.c
index 3e162ba..b76f25b 100644
--- a/src/nginx.c
+++ b/src/nginx.c
@@ -120,7 +120,7 @@ static int init (void)
     return (-1);
   }
 
-  curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1);
+  curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1L);
   curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, nginx_curl_callback);
   curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION);
   curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, nginx_curl_error);
@@ -143,24 +143,24 @@ static int init (void)
     curl_easy_setopt (curl, CURLOPT_URL, url);
   }
 
-  curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1);
+  curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
 
   if ((verify_peer == NULL) || IS_TRUE (verify_peer))
   {
-    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1);
+    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1L);
   }
   else
   {
-    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0);
+    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0L);
   }
 
   if ((verify_host == NULL) || IS_TRUE (verify_host))
   {
-    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 2);
+    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 2L);
   }
   else
   {
-    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0);
+    curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 0L);
   }
 
   if (cacert != NULL)
diff --git a/src/write_http.c b/src/write_http.c
index 3035e43..6b1c64a 100644
--- a/src/write_http.c
+++ b/src/write_http.c
@@ -111,7 +111,7 @@ static int wh_callback_init (wh_callback_t *cb) /* {{{ */
                 return (-1);
         }
 
-        curl_easy_setopt (cb->curl, CURLOPT_NOSIGNAL, 1);
+        curl_easy_setopt (cb->curl, CURLOPT_NOSIGNAL, 1L);
         curl_easy_setopt (cb->curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION);
 
         headers = NULL;
@@ -147,9 +147,9 @@ static int wh_callback_init (wh_callback_t *cb) /* {{{ */
                 curl_easy_setopt (cb->curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
         }
 
-        curl_easy_setopt (cb->curl, CURLOPT_SSL_VERIFYPEER, cb->verify_peer);
+        curl_easy_setopt (cb->curl, CURLOPT_SSL_VERIFYPEER, (long) cb->verify_peer);
         curl_easy_setopt (cb->curl, CURLOPT_SSL_VERIFYHOST,
-                        cb->verify_host ? 2 : 0);
+                        cb->verify_host ? 2L : 0L);
         if (cb->cacert != NULL)
                 curl_easy_setopt (cb->curl, CURLOPT_CAINFO, cb->cacert);
 
-- 
1.7.10




More information about the collectd mailing list