From: Jarkko Hietaniemi Date: Sun, 27 Aug 2000 21:33:58 +0000 (+0000) Subject: Big-endian 64-bit patch from Raphael Manfredi. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cc96465714ccbfb445fc6ef8f31cccf3e846ae9d;p=p5sagit%2Fp5-mst-13.2.git Big-endian 64-bit patch from Raphael Manfredi. p4raw-id: //depot/perl@6852 --- diff --git a/ext/Storable/Storable.xs b/ext/Storable/Storable.xs index 1b580cf..5913b0e 100644 --- a/ext/Storable/Storable.xs +++ b/ext/Storable/Storable.xs @@ -69,15 +69,31 @@ #ifndef HvSHAREKEYS_off #define HvSHAREKEYS_off(hv) /* Ignore */ #endif -#ifndef INT2PTR -#define INT2PTR(t,v) (t)(IV)(v) -#endif #ifndef AvFILLp /* Older perls (<=5.003) lack AvFILLp */ #define AvFILLp AvFILL #endif typedef double NV; /* Older perls lack the NV type */ +#define IVdf "ld" /* Various printf formats for Perl types */ +#define UVuf "lu" +#define UVof "lo" +#define UVxf "lx" +#define INT2PTR(t,v) (t)(IV)(v) +#define PTR2UV(v) (unsigned long)(v) #endif /* PERL_VERSION -- perls < 5.6 */ +#ifndef NVef /* The following were not part of perl 5.6 */ +#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(PERL_PRIfldbl) +#define NVef PERL_PRIeldbl +#define NVff PERL_PRIfldbl +#define NVgf PERL_PRIgldbl +#endif +#ifndef NVef +#define NVef "e" +#define NVff "f" +#define NVgf "g" +#endif +#endif + #ifdef DEBUGME #ifndef DASSERT #define DASSERT @@ -1442,6 +1458,7 @@ static int store_scalar(stcxt_t *cxt, SV *sv) goto string; /* Share code below */ } } else if (flags & SVp_POK) { /* SvPOKp(sv) => string */ + I32 wlen; /* For 64-bit machines */ pv = SvPV(sv, len); /* @@ -1995,7 +2012,7 @@ static int store_hook( pkg_hide(cxt->hook, pkg, "STORABLE_freeze"); ASSERT(!pkg_can(cxt->hook, pkg, "STORABLE_freeze"), ("hook invisible")); - TRACEME(("Ignoring STORABLE_freeze in class \"%s\"", class)); + TRACEME(("ignoring STORABLE_freeze in class \"%s\"", class)); return store_blessed(cxt, sv, type, pkg); } @@ -2136,9 +2153,10 @@ static int store_hook( } /* */ - if (flags & SHF_LARGE_STRLEN) - WLEN(len2); - else { + if (flags & SHF_LARGE_STRLEN) { + I32 wlen2 = len2; /* STRLEN might be 8 bytes */ + WLEN(wlen2); /* Must write an I32 for 64-bit machines */ + } else { unsigned char clen = (unsigned char) len2; PUTMARK(clen); } @@ -2287,7 +2305,7 @@ static int store_blessed( */ static int store_other(stcxt_t *cxt, SV *sv) { - STRLEN len; + I32 len; static char buf[80]; TRACEME(("store_other"));