From: Jarkko Hietaniemi Date: Sun, 3 Jun 2001 23:37:17 +0000 (+0000) Subject: Various "cast to pointer from integer of different size" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=425d70b4c4324ccafae8099527a1f9ab13640b5c;p=p5sagit%2Fp5-mst-13.2.git Various "cast to pointer from integer of different size" picked up by gcc -Wall (in Tru64 where pointers are 64 bits wide but I32 (int) only 32 bits wide). WARNING: the classnum and tagnum changes in Storable.xs may not be wise, they may be breaking binary compatibility (in 64-bit platforms), asked Raphael Manfredi about the changes. p4raw-id: //depot/perl@10417 --- diff --git a/embed.pl b/embed.pl index c8ea257..a2e833b 100755 --- a/embed.pl +++ b/embed.pl @@ -1750,7 +1750,7 @@ Apd |int |mg_get |SV* sv Apd |U32 |mg_length |SV* sv Apd |void |mg_magical |SV* sv Apd |int |mg_set |SV* sv -Ap |I32 |mg_size |SV* sv +Ap |IV |mg_size |SV* sv Ap |void |mini_mktime |struct tm *pm p |OP* |mod |OP* o|I32 type p |int |mode_from_discipline|SV* discp @@ -2284,7 +2284,7 @@ s |void |hv_magic_check |HV *hv|bool *needs_copy|bool *needs_store #endif #if defined(PERL_IN_MG_C) || defined(PERL_DECL_PROT) -s |void |save_magic |I32 mgs_ix|SV *sv +s |void |save_magic |IV mgs_ix|SV *sv s |int |magic_methpack |SV *sv|MAGIC *mg|char *meth s |int |magic_methcall |SV *sv|MAGIC *mg|char *meth|I32 f \ |int n|SV *val diff --git a/ext/Devel/DProf/DProf.xs b/ext/Devel/DProf/DProf.xs index 0cd7daa..0cee6c2 100644 --- a/ext/Devel/DProf/DProf.xs +++ b/ext/Devel/DProf/DProf.xs @@ -87,7 +87,7 @@ typedef struct { U32 total; U32 lastid; U32 default_perldb; - U32 depth; + UV depth; #ifdef OS2 ULONG frequ; long long start_cnt; @@ -497,7 +497,7 @@ check_depth(pTHX_ void *foo) warn("garbled call depth when profiling"); } else { - I32 marks = g_depth - need_depth; + IV marks = g_depth - need_depth; /* warn("Check_depth: got %d, expected %d\n", g_depth, need_depth); */ while (marks--) { diff --git a/ext/Storable/Storable.xs b/ext/Storable/Storable.xs index 542c2a5..4e2db19 100644 --- a/ext/Storable/Storable.xs +++ b/ext/Storable/Storable.xs @@ -278,8 +278,8 @@ typedef struct stcxt { HV *hclass; /* which classnames have been seen, store time */ AV *aclass; /* which classnames have been seen, retrieve time */ HV *hook; /* cache for hook methods per class name */ - I32 tagnum; /* incremented at store time for each seen object */ - I32 classnum; /* incremented at store time for each seen classname */ + IV tagnum; /* incremented at store time for each seen object */ + IV classnum; /* incremented at store time for each seen classname */ int netorder; /* true if network order used */ int s_tainted; /* true if input source is tainted, at retrieve time */ int forgive_me; /* whether to be forgiving... */ diff --git a/mg.c b/mg.c index b9a027e..b743879 100644 --- a/mg.c +++ b/mg.c @@ -40,7 +40,7 @@ struct magic_state { /* MGS is typedef'ed to struct magic_state in perl.h */ STATIC void -S_save_magic(pTHX_ I32 mgs_ix, SV *sv) +S_save_magic(pTHX_ IV mgs_ix, SV *sv) { MGS* mgs; assert(SvMAGICAL(sv)); @@ -93,7 +93,7 @@ Do magic after a value is retrieved from the SV. See C. int Perl_mg_get(pTHX_ SV *sv) { - I32 mgs_ix; + IV mgs_ix; MAGIC* mg; MAGIC** mgp; int mgp_valid = 0; @@ -135,7 +135,7 @@ Do magic after a value is assigned to the SV. See C. int Perl_mg_set(pTHX_ SV *sv) { - I32 mgs_ix; + IV mgs_ix; MAGIC* mg; MAGIC* nextmg; @@ -175,7 +175,7 @@ Perl_mg_length(pTHX_ SV *sv) for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { MGVTBL* vtbl = mg->mg_virtual; if (vtbl && vtbl->svt_len) { - I32 mgs_ix; + IV mgs_ix; mgs_ix = SSNEW(sizeof(MGS)); save_magic(mgs_ix, sv); @@ -190,7 +190,7 @@ Perl_mg_length(pTHX_ SV *sv) return len; } -I32 +IV Perl_mg_size(pTHX_ SV *sv) { MAGIC* mg; @@ -199,7 +199,7 @@ Perl_mg_size(pTHX_ SV *sv) for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { MGVTBL* vtbl = mg->mg_virtual; if (vtbl && vtbl->svt_len) { - I32 mgs_ix; + IV mgs_ix; mgs_ix = SSNEW(sizeof(MGS)); save_magic(mgs_ix, sv); @@ -234,7 +234,7 @@ Clear something magical that the SV represents. See C. int Perl_mg_clear(pTHX_ SV *sv) { - I32 mgs_ix; + IV mgs_ix; MAGIC* mg; mgs_ix = SSNEW(sizeof(MGS));