aboutsummaryrefslogtreecommitdiffstats
path: root/testing/perl-www-curl/fix-curl.xs.patch
blob: 1ae3e8b46c9ef89ccb6bc1100ee6809ef5955f98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
From 893518f6ed260b67fc86e344a9c6bb7626617b3a Mon Sep 17 00:00:00 2001
From: Tuukka Pasanen <tuukka.pasanen@ilmi.fi>
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 <tuukka.pasanen@ilmi.fi>
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 <tuukka.pasanen@ilmi.fi>
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)));