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
This commit is contained in:
Richard Frith-Macdonald 2005-07-18 10:12:49 +00:00
parent 2b9ed0e196
commit 0fc276367d
3 changed files with 60 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2005-07-18 Richard Frith-Macdonald <rfm@gnu.org>
* 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 <fedor@gnu.org>
* ChangeLog, ChangeLog.1, ChangeLog.2, GNUmakefile, Makefile,

View file

@ -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)];

View file

@ -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)];