From 893518f6ed260b67fc86e344a9c6bb7626617b3a Mon Sep 17 00:00:00 2001 From: Tuukka Pasanen Date: Mon, 16 Dec 2019 10:41:59 +0200 Subject: [PATCH 1/3] For maximum backward compability define __CURL_MULTI_H if it's not defined --- Curl.xs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Curl.xs b/Curl.xs index cfa282d..a98c255 100644 --- a/Curl.xs +++ b/Curl.xs @@ -68,6 +68,12 @@ typedef struct { struct curl_httppost * last; } perl_curl_form; +/* To keep backward compability define __CURL_MULTI_H if it's not defined */ +#ifdef CURLINC_MULTI_H +# ifndef __CURL_MULTI_H +# define __CURL_MULTI_H 1 +# endif +#endif typedef struct { #ifdef __CURL_MULTI_H From 3e94be6ae245ca29ac21745cf273c7bd0ca9b178 Mon Sep 17 00:00:00 2001 From: Tuukka Pasanen Date: Mon, 16 Dec 2019 10:53:25 +0200 Subject: [PATCH 2/3] Remove -Wunused-but-set-variable warnings --- Curl.xs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Curl.xs b/Curl.xs index a98c255..828b4ec 100644 --- a/Curl.xs +++ b/Curl.xs @@ -358,7 +358,6 @@ fwrite_wrapper2 ( if (call_function) { /* We are doing a callback to perl */ int count, status; - SV *sv; ENTER; SAVETMPS; @@ -608,6 +607,8 @@ curl_easy_init(...) char *sclass = "WWW::Curl::Easy"; PPCODE: + /* Prevent ununsed variable warning */ + (void)(ix); if (items>0 && !SvROK(ST(0))) { STRLEN dummy; sclass = SvPV(ST(0),dummy); @@ -951,6 +952,8 @@ int curl_easy_cleanup(self) WWW::Curl::Easy self CODE: + /* Prevent unused variable warning */ + (void)(self); /* does nothing anymore - cleanup is automatic when a curl handle goes out of scope */ RETVAL = 0; OUTPUT: @@ -968,6 +971,8 @@ curl_easy_strerror(self, errornum) int errornum CODE: { + /* Prevent unused variable */ + (void)(self); #if (LIBCURL_VERSION_NUM>=0x070C00) const char * vchar = curl_easy_strerror(errornum); #else @@ -1186,6 +1191,8 @@ curl_multi_strerror(self, errornum) int errornum CODE: { + /* Prevent unused variable warning */ + (void)(self); #if (LIBCURL_VERSION_NUM>=0x070C00) const char * vchar = curl_multi_strerror(errornum); #else @@ -1256,6 +1263,8 @@ curl_share_strerror(self, errornum) int errornum CODE: { + /* Prevent unused variable */ + (void)(self); #if (LIBCURL_VERSION_NUM>=0x070C00) const char * vchar = curl_share_strerror(errornum); #else From 968e410fcd6ddc4a122d787186eac6516bf982aa Mon Sep 17 00:00:00 2001 From: Tuukka Pasanen Date: Mon, 16 Dec 2019 11:00:46 +0200 Subject: [PATCH 3/3] Remove -Wattribute-warning warning messages with typecasting --- Curl.xs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Curl.xs b/Curl.xs index 828b4ec..05eb71a 100644 --- a/Curl.xs +++ b/Curl.xs @@ -667,7 +667,7 @@ curl_easy_duphandle(self) } if (self->callback[callback_index(CURLOPT_DEBUGFUNCTION)] || self->callback_ctx[callback_index(CURLOPT_DEBUGDATA)]) { - curl_easy_setopt(clone->curl, CURLOPT_DEBUGFUNCTION, debug_callback_func); + curl_easy_setopt(clone->curl, CURLOPT_DEBUGFUNCTION, (curl_debug_callback) debug_callback_func); curl_easy_setopt(clone->curl, CURLOPT_DEBUGDATA, clone); } @@ -722,7 +722,7 @@ curl_easy_setopt(self, option, value, push=0) perl_curl_easy_register_callback(aTHX_ self,&(self->callback_ctx[callback_index(option)]), value); break; case CURLOPT_DEBUGDATA: - curl_easy_setopt(self->curl, CURLOPT_DEBUGFUNCTION, SvOK(value) ? debug_callback_func : NULL); + curl_easy_setopt(self->curl, CURLOPT_DEBUGFUNCTION, (curl_debug_callback) (SvOK(value) ? debug_callback_func : NULL)); curl_easy_setopt(self->curl, option, SvOK(value) ? self : NULL); perl_curl_easy_register_callback(aTHX_ self,&(self->callback_ctx[callback_index(option)]), value); break; @@ -743,7 +743,7 @@ curl_easy_setopt(self, option, value, push=0) perl_curl_easy_register_callback(aTHX_ self,&(self->callback[callback_index(option)]), value); break; case CURLOPT_DEBUGFUNCTION: - curl_easy_setopt(self->curl, option, SvOK(value) ? debug_callback_func : NULL); + curl_easy_setopt(self->curl, option, (curl_debug_callback) (SvOK(value) ? debug_callback_func : NULL)); curl_easy_setopt(self->curl, CURLOPT_DEBUGDATA, SvOK(value) ? self : NULL); perl_curl_easy_register_callback(aTHX_ self,&(self->callback[callback_index(option)]), value); break; @@ -796,7 +796,7 @@ curl_easy_setopt(self, option, value, push=0) /* tell curl to redirect STDERR - value should be a glob */ case CURLOPT_STDERR: - RETVAL = curl_easy_setopt(self->curl, option, IoOFP(sv_2io(value)) ); + RETVAL = curl_easy_setopt(self->curl, option, (FILE *) IoOFP(sv_2io(value)) ); break; /* not working yet... */ @@ -817,7 +817,7 @@ curl_easy_setopt(self, option, value, push=0) WWW__Curl__Share wrapper; IV tmp = SvIV((SV*)SvRV(value)); wrapper = INT2PTR(WWW__Curl__Share,tmp); - RETVAL = curl_easy_setopt(self->curl, option, wrapper->curlsh); + RETVAL = curl_easy_setopt(self->curl, option, (CURLSH *) wrapper->curlsh); } else croak("value is not of type WWW::Curl::Share"); break; @@ -1096,7 +1096,7 @@ curl_multi_info_read(self) }; if (easy) { curl_easy_getinfo(easy, CURLINFO_PRIVATE, &stashid); - curl_easy_setopt(easy, CURLINFO_PRIVATE, NULL); + curl_easy_setopt(easy, CURLINFO_PRIVATE, (curl_off_t) NULL); curl_multi_remove_handle(self->curlm, easy); XPUSHs(sv_2mortal(newSVpv(stashid,0))); XPUSHs(sv_2mortal(newSViv(res)));