perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject [PATCH] fix warnings with gcc 4.x
Date Tue, 19 Jul 2005 08:26:31 GMT
The APR base64 encode/decode functions expect unsigned char * arguments 
for the raw binary input/output buffers. gcc 4.x now warns for pointer 
signedness mismatches like this; casting is really the only way.
(alternatively, if you dislike this, the warning can be turned off)

Also the mpxs_APR__Base64_encode_len looks rather wrong; fixed below.

--- xs/APR/Base64/APR__Base64.h.orig	2005-07-19 09:11:17.000000000 +0100
+++ xs/APR/Base64/APR__Base64.h	2005-07-19 09:09:51.000000000 +0100
@@ -15,13 +15,13 @@
 
 /* apr_base64_encode_len and apr_base64_encode_binary give length that
  * includes the terminating '\0' */
-#define mpxs_APR__Base64_encode_len(len) apr_base64_encode_len(len) - 1;
+#define mpxs_APR__Base64_encode_len(len) (apr_base64_encode_len(len) - 1)
     
 static MP_INLINE void mpxs_apr_base64_encode(pTHX_ SV *sv, SV *arg)
 {
     STRLEN len;
     int encoded_len;
-    char *data = SvPV(arg, len);
+    unsigned char *data = (unsigned char *)SvPV(arg, len);
     mpxs_sv_grow(sv, apr_base64_encode_len(len) - 1);
     encoded_len = apr_base64_encode_binary(SvPVX(sv), data, len);
     mpxs_sv_cur_set(sv, encoded_len - 1);
@@ -33,7 +33,7 @@
     int decoded_len;
     char *data = SvPV(arg, len);
     mpxs_sv_grow(sv, apr_base64_decode_len(data));
-    decoded_len = apr_base64_decode_binary(SvPVX(sv), data);
+    decoded_len = apr_base64_decode_binary((unsigned char *)SvPVX(sv), data);
     mpxs_sv_cur_set(sv, decoded_len);
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message