summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-08-25 00:08:21 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-25 06:40:34 -0700
commitc70927a6ffc3cac8e5ec375a3f7e13b4f7bd1ee4 (patch)
tree477e6abc58c0898bee5727b3feb27c9af685f49b /dist
parent9a543cee73966ca61d6dc71cc7322f271f5b6b8b (diff)
downloadperl-c70927a6ffc3cac8e5ec375a3f7e13b4f7bd1ee4.tar.gz
Use SSize_t for arrays
Make the array interface 64-bit safe by using SSize_t instead of I32 for array indices. This is based on a patch by Chip Salzenberg. This completes what the previous commit began when it changed av_extend.
Diffstat (limited to 'dist')
-rw-r--r--dist/Data-Dumper/Dumper.xs13
-rw-r--r--dist/ExtUtils-ParseXS/lib/perlxstut.pod4
-rw-r--r--dist/Math-BigInt-FastCalc/FastCalc.xs20
3 files changed, 19 insertions, 18 deletions
diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs
index 3fdc71fcf6..31524289d4 100644
--- a/dist/Data-Dumper/Dumper.xs
+++ b/dist/Data-Dumper/Dumper.xs
@@ -393,7 +393,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
int use_sparse_seen_hash, I32 useqq)
{
char tmpbuf[128];
- U32 i;
+ Size_t i;
char *c, *r, *realpack;
#ifdef DD_USE_OLD_ID_FORMAT
char id[128];
@@ -641,8 +641,8 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
}
else if (realtype == SVt_PVAV) {
SV *totpad;
- I32 ix = 0;
- const I32 ixmax = av_len((AV *)ival);
+ SSize_t ix = 0;
+ const SSize_t ixmax = av_len((AV *)ival);
SV * const ixsv = newSViv(0);
/* allowing for a 24 char wide array index */
@@ -819,7 +819,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
bool do_utf8 = FALSE;
if (sortkeys) {
- if (!(keys && (I32)i <= av_len(keys))) break;
+ if (!(keys && (SSize_t)i <= av_len(keys))) break;
} else {
if (!(entry = hv_iternext((HV *)ival))) break;
}
@@ -1209,7 +1209,8 @@ Data_Dumper_Dumpxs(href, ...)
HV *seenhv = NULL;
AV *postav, *todumpav, *namesav;
I32 level = 0;
- I32 indent, terse, useqq, i, imax, postlen;
+ I32 indent, terse, useqq;
+ SSize_t i, imax, postlen;
SV **svp;
SV *val, *name, *pad, *xpad, *apad, *sep, *pair, *varname;
SV *freezer, *toaster, *bless, *sortkeys;
@@ -1395,7 +1396,7 @@ Data_Dumper_Dumpxs(href, ...)
sv_catsv(retval, valstr);
sv_catsv(retval, sep);
if (postlen >= 0) {
- I32 i;
+ SSize_t i;
sv_catsv(retval, pad);
for (i = 0; i <= postlen; ++i) {
SV *elem;
diff --git a/dist/ExtUtils-ParseXS/lib/perlxstut.pod b/dist/ExtUtils-ParseXS/lib/perlxstut.pod
index 403b8da7a3..829e714b17 100644
--- a/dist/ExtUtils-ParseXS/lib/perlxstut.pod
+++ b/dist/ExtUtils-ParseXS/lib/perlxstut.pod
@@ -1089,8 +1089,8 @@ Mytest.xs:
SV * paths
INIT:
AV * results;
- I32 numpaths = 0;
- int i, n;
+ SSize_t numpaths = 0, n;
+ int i;
struct statfs buf;
SvGETMAGIC(paths);
diff --git a/dist/Math-BigInt-FastCalc/FastCalc.xs b/dist/Math-BigInt-FastCalc/FastCalc.xs
index a8247c9508..a045c7172e 100644
--- a/dist/Math-BigInt-FastCalc/FastCalc.xs
+++ b/dist/Math-BigInt-FastCalc/FastCalc.xs
@@ -108,7 +108,7 @@ _copy(class, x)
INIT:
AV* a;
AV* a2;
- I32 elems;
+ SSize_t elems;
CODE:
a = (AV*)SvRV(x); /* ref to aray, don't check ref */
@@ -144,8 +144,8 @@ __strip_zeros(x)
INIT:
AV* a;
SV* temp;
- I32 elems;
- I32 index;
+ SSize_t elems;
+ SSize_t index;
CODE:
a = (AV*)SvRV(x); /* ref to aray, don't check ref */
@@ -189,8 +189,8 @@ _dec(class,x)
INIT:
AV* a;
SV* temp;
- I32 elems;
- I32 index;
+ SSize_t elems;
+ SSize_t index;
NV MAX;
CODE:
@@ -233,8 +233,8 @@ _inc(class,x)
INIT:
AV* a;
SV* temp;
- I32 elems;
- I32 index;
+ SSize_t elems;
+ SSize_t index;
NV BASE;
CODE:
@@ -347,13 +347,13 @@ _acmp(class, cx, cy);
INIT:
AV* array_x;
AV* array_y;
- I32 elemsx, elemsy, diff;
+ SSize_t elemsx, elemsy, diff;
SV* tempx;
SV* tempy;
STRLEN lenx;
STRLEN leny;
NV diff_nv;
- I32 diff_str;
+ SSize_t diff_str;
CODE:
array_x = (AV*)SvRV(cx); /* ref to aray, don't check ref */
@@ -376,7 +376,7 @@ _acmp(class, cx, cy);
tempy = *av_fetch(array_y, elemsx, 0); /* fetch last element */
SvPV(tempx, lenx); /* convert to string & store length */
SvPV(tempy, leny); /* convert to string & store length */
- diff_str = (I32)lenx - (I32)leny;
+ diff_str = (SSize_t)lenx - (SSize_t)leny;
if (diff_str > 0)
{
RETURN_MORTAL_INT(1); /* same len, but first elems differs in len */