From 23ff93766085364178e68b78911eb4e6aaa9ee48 Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Mon, 21 Nov 2011 21:12:40 -0600 Subject: [PATCH 1/2] please -Wformat: sizeof is unsigned long --- ByteLoader/bytecode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ByteLoader/bytecode.h b/ByteLoader/bytecode.h index dde4d9b64..765fa9289 100755 --- a/ByteLoader/bytecode.h +++ b/ByteLoader/bytecode.h @@ -120,7 +120,7 @@ static int bget_swab = 0; #define BGET_OR_CROAK(arg, type) STMT_START { \ if (BGET_FREAD(&arg, sizeof(type), 1) < 1) { \ Perl_croak(aTHX_ \ - "EOF or error while trying to read %d bytes for %s", \ + "EOF or error while trying to read %lu bytes for %s", \ sizeof(type), STRINGIFY(type)); \ } \ } STMT_END From 2b9c363e78131ae2c216c401d16affa8a31dc435 Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Fri, 25 Nov 2011 22:49:13 -0600 Subject: [PATCH 2/2] B.xs is wrong about B__REGEXP Fix the B__REGEXP typedef, and add a better typecheck for RX_EXTFLAGS. This fixes C.c: In function 'XS_B__REGEXP_EXTFLAGS': C.c:300:11: warning: initialization from incompatible pointer type --- C.xs | 6 ++++-- typemap | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/C.xs b/C.xs index e3b16b163..d1268eb88 100644 --- a/C.xs +++ b/C.xs @@ -13,8 +13,10 @@ # define RX_EXTFLAGS(prog) ((prog)->extflags) #endif -typedef struct magic* B__MAGIC; -typedef SV* B__REGEXP; +typedef struct magic *B__MAGIC; +#if PERL_VERSION >= 11 +typedef struct p5rx *B__REGEXP; +#endif static int my_runops(pTHX) diff --git a/typemap b/typemap index 4602865c4..a7c302bc6 100644 --- a/typemap +++ b/typemap @@ -1,9 +1,9 @@ B::MAGIC T_MG_OBJ -B::REGEXP T_RX_OBJ +B::REGEXP T_RX_OBJ INPUT T_RX_OBJ - if (SvROK($arg)) { + if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_REGEXP) { IV tmp = SvIV((SV*)SvRV($arg)); $var = INT2PTR($type,tmp); } @@ -15,4 +15,4 @@ T_MG_OBJ $var = INT2PTR($type,tmp); } else - croak(\"$var is not a reference to PVMG\") + croak(\"$var is not a reference\")