summaryrefslogtreecommitdiff
path: root/ext/Storable
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-08-27 21:33:58 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-08-27 21:33:58 +0000
commitcc96465714ccbfb445fc6ef8f31cccf3e846ae9d (patch)
tree33a7734eec74c5c8d0d2a946b6d036c528b65bbe /ext/Storable
parentbd625725cc198cb9c07f4be09021a5d0e9ad8939 (diff)
downloadperl-cc96465714ccbfb445fc6ef8f31cccf3e846ae9d.tar.gz
Big-endian 64-bit patch from Raphael Manfredi.
p4raw-id: //depot/perl@6852
Diffstat (limited to 'ext/Storable')
-rw-r--r--ext/Storable/Storable.xs34
1 files changed, 26 insertions, 8 deletions
diff --git a/ext/Storable/Storable.xs b/ext/Storable/Storable.xs
index 1b580cff31..5913b0ecf9 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(
}
/* <len2> <frozen-str> */
- 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"));