From dcb3070d9c719c3f3568cc1d9219c951b21802c8 Mon Sep 17 00:00:00 2001 From: CaS Date: Mon, 18 Jul 2005 10:12:49 +0000 Subject: [PATCH] Attempt to resolve decoding issues on 64bit systems. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21501 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 8 ++++++++ Source/NSPortCoder.m | 26 ++++++++++++++++++++++++++ Source/NSUnarchiver.m | 26 ++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/ChangeLog b/ChangeLog index fd0332c33..d9ccda9a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-07-18 Richard Frith-Macdonald + + * Source/NSUnarchiver.m: + * Source/NSPortCoder.m: Relax checking of decoded types information + to allow int/long/longlong types to be decoded using 'i/l/q' + interchangably and 'I/L'Q' interchangably because the compiler may + use different encodings on different machines. + 2005-07-15 Adam Fedor * ChangeLog, ChangeLog.1, ChangeLog.2, GNUmakefile, Makefile, diff --git a/Source/NSPortCoder.m b/Source/NSPortCoder.m index 3768eb0be..67d15a386 100644 --- a/Source/NSPortCoder.m +++ b/Source/NSPortCoder.m @@ -234,6 +234,32 @@ typeCheck(char t1, char t2) { if (type_map[(t2 & _GSC_MASK)] != t1) { +/* + * HACK ... allow int/long/longlong types to be used interchangably + * as the ObjC compiler currently uses quadword (q/Q) encoding for + * integer types on some 64bit systems, so the i/l/q/I/L/Q encodings + * can vary. + */ + char c = type_map[(t2 & _GSC_MASK)]; + if ((c == _C_INT || c == _C_LNG +#ifdef _C_LNG_LNG + || c == _C_LNG_LNG +#endif + ) && (t1 == _C_INT || t1 == _C_LNG +#ifdef _C_LNG_LNG + || t1 == _C_LNG_LNG +#endif + )) return; + if ((c == _C_UINT || c == _C_ULNG +#ifdef _C_LNG_LNG + || c == _C_ULNG_LNG +#endif + ) && (t1 == _C_UINT || t1 == _C_ULNG +#ifdef _C_LNG_LNG + || t1 == _C_ULNG_LNG +#endif + )) return; + [NSException raise: NSInternalInconsistencyException format: @"expected %s and got %s", typeToName1(t1), typeToName2(t2)]; diff --git a/Source/NSUnarchiver.m b/Source/NSUnarchiver.m index 8de3b3bfd..0e4903ef9 100644 --- a/Source/NSUnarchiver.m +++ b/Source/NSUnarchiver.m @@ -194,6 +194,32 @@ typeCheck(char t1, char t2) { if (type_map[(t2 & _GSC_MASK)] != t1) { +/* + * HACK ... allow int/long/longlong types to be used interchangably + * as the ObjC compiler currently uses quadword (q/Q) encoding for + * integer types on some 64bit systems, so the i/l/q/I/L/Q encodings + * can vary. + */ + char c = type_map[(t2 & _GSC_MASK)]; + if ((c == _C_INT || c == _C_LNG +#ifdef _C_LNG_LNG + || c == _C_LNG_LNG +#endif + ) && (t1 == _C_INT || t1 == _C_LNG +#ifdef _C_LNG_LNG + || t1 == _C_LNG_LNG +#endif + )) return; + if ((c == _C_UINT || c == _C_ULNG +#ifdef _C_LNG_LNG + || c == _C_ULNG_LNG +#endif + ) && (t1 == _C_UINT || t1 == _C_ULNG +#ifdef _C_LNG_LNG + || t1 == _C_ULNG_LNG +#endif + )) return; + [NSException raise: NSInternalInconsistencyException format: @"expected %s and got %s", typeToName1(t1), typeToName2(t2)];