mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 09:41:15 +00:00
fix 64bit unarchiving error
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29886 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
811f447efe
commit
15d72232b5
1 changed files with 58 additions and 25 deletions
|
@ -188,7 +188,8 @@ static char type_map[32] = {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void
|
|
||||||
|
static inline BOOL
|
||||||
typeCheck(char t1, char t2)
|
typeCheck(char t1, char t2)
|
||||||
{
|
{
|
||||||
if (type_map[(t2 & _GSC_MASK)] != t1)
|
if (type_map[(t2 & _GSC_MASK)] != t1)
|
||||||
|
@ -200,6 +201,35 @@ typeCheck(char t1, char t2)
|
||||||
* can vary.
|
* can vary.
|
||||||
*/
|
*/
|
||||||
char c = type_map[(t2 & _GSC_MASK)];
|
char c = type_map[(t2 & _GSC_MASK)];
|
||||||
|
char s1;
|
||||||
|
char s2;
|
||||||
|
|
||||||
|
switch (t1)
|
||||||
|
{
|
||||||
|
case _C_INT: s1 = _GSC_S_INT; break;
|
||||||
|
case _C_UINT: s1 = _GSC_S_INT; break;
|
||||||
|
case _C_LNG: s1 = _GSC_S_LNG; break;
|
||||||
|
case _C_ULNG: s1 = _GSC_S_LNG; break;
|
||||||
|
#ifdef _C_LNG_LNG
|
||||||
|
case _C_LNG_LNG: s1 = _GSC_S_LNG_LNG; break;
|
||||||
|
case _C_ULNG_LNG: s1 = _GSC_S_LNG_LNG; break;
|
||||||
|
#endif
|
||||||
|
default: s1 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (t2)
|
||||||
|
{
|
||||||
|
case _C_INT: s2 = _GSC_S_INT; break;
|
||||||
|
case _C_UINT: s2 = _GSC_S_INT; break;
|
||||||
|
case _C_LNG: s2 = _GSC_S_LNG; break;
|
||||||
|
case _C_ULNG: s2 = _GSC_S_LNG; break;
|
||||||
|
#ifdef _C_LNG_LNG
|
||||||
|
case _C_LNG_LNG: s2 = _GSC_S_LNG_LNG; break;
|
||||||
|
case _C_ULNG_LNG: s2 = _GSC_S_LNG_LNG; break;
|
||||||
|
#endif
|
||||||
|
default: s2 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ((c == _C_INT || c == _C_LNG
|
if ((c == _C_INT || c == _C_LNG
|
||||||
#ifdef _C_LNG_LNG
|
#ifdef _C_LNG_LNG
|
||||||
|| c == _C_LNG_LNG
|
|| c == _C_LNG_LNG
|
||||||
|
@ -208,7 +238,8 @@ typeCheck(char t1, char t2)
|
||||||
#ifdef _C_LNG_LNG
|
#ifdef _C_LNG_LNG
|
||||||
|| t1 == _C_LNG_LNG
|
|| t1 == _C_LNG_LNG
|
||||||
#endif
|
#endif
|
||||||
)) return;
|
)) return s1 == s2 ? YES : NO;
|
||||||
|
|
||||||
if ((c == _C_UINT || c == _C_ULNG
|
if ((c == _C_UINT || c == _C_ULNG
|
||||||
#ifdef _C_LNG_LNG
|
#ifdef _C_LNG_LNG
|
||||||
|| c == _C_ULNG_LNG
|
|| c == _C_ULNG_LNG
|
||||||
|
@ -217,17 +248,19 @@ typeCheck(char t1, char t2)
|
||||||
#ifdef _C_LNG_LNG
|
#ifdef _C_LNG_LNG
|
||||||
|| t1 == _C_ULNG_LNG
|
|| t1 == _C_ULNG_LNG
|
||||||
#endif
|
#endif
|
||||||
)) return;
|
)) return s1 == s2 ? YES : NO;
|
||||||
|
|
||||||
/* HACK also allow float and double to be used interchangably as MacOS-X
|
/* HACK also allow float and double to be used interchangably as MacOS-X
|
||||||
* intorduced CGFloat, which may be aither a float or a double.
|
* intorduced CGFloat, which may be aither a float or a double.
|
||||||
*/
|
*/
|
||||||
if ((c == _C_FLT || c == _C_DBL) && (t1 == _C_FLT || t1 == _C_DBL))
|
if ((c == _C_FLT || c == _C_DBL) && (t1 == _C_FLT || t1 == _C_DBL))
|
||||||
return;
|
return NO;
|
||||||
|
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"expected %s and got %s",
|
format: @"expected %s and got %s",
|
||||||
typeToName1(t1), typeToName2(t2)];
|
typeToName1(t1), typeToName2(t2)];
|
||||||
}
|
}
|
||||||
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PREFIX "GNUstep archive"
|
#define PREFIX "GNUstep archive"
|
||||||
|
@ -951,8 +984,8 @@ static Class NSDataMallocClass;
|
||||||
|
|
||||||
case _GSC_SHT:
|
case _GSC_SHT:
|
||||||
case _GSC_USHT:
|
case _GSC_USHT:
|
||||||
typeCheck(*type, info & _GSC_MASK);
|
if (YES == typeCheck(*type, info & _GSC_MASK)
|
||||||
if ((info & _GSC_SIZE) == _GSC_S_SHT)
|
&& (info & _GSC_SIZE) == _GSC_S_SHT)
|
||||||
{
|
{
|
||||||
(*desImp)(src, desSel, address, type, &cursor, nil);
|
(*desImp)(src, desSel, address, type, &cursor, nil);
|
||||||
return;
|
return;
|
||||||
|
@ -961,8 +994,8 @@ static Class NSDataMallocClass;
|
||||||
|
|
||||||
case _GSC_INT:
|
case _GSC_INT:
|
||||||
case _GSC_UINT:
|
case _GSC_UINT:
|
||||||
typeCheck(*type, info & _GSC_MASK);
|
if (YES == typeCheck(*type, info & _GSC_MASK)
|
||||||
if ((info & _GSC_SIZE) == _GSC_S_INT)
|
&& (info & _GSC_SIZE) == _GSC_S_INT)
|
||||||
{
|
{
|
||||||
(*desImp)(src, desSel, address, type, &cursor, nil);
|
(*desImp)(src, desSel, address, type, &cursor, nil);
|
||||||
return;
|
return;
|
||||||
|
@ -971,8 +1004,8 @@ static Class NSDataMallocClass;
|
||||||
|
|
||||||
case _GSC_LNG:
|
case _GSC_LNG:
|
||||||
case _GSC_ULNG:
|
case _GSC_ULNG:
|
||||||
typeCheck(*type, info & _GSC_MASK);
|
if (YES == typeCheck(*type, info & _GSC_MASK)
|
||||||
if ((info & _GSC_SIZE) == _GSC_S_LNG)
|
&& (info & _GSC_SIZE) == _GSC_S_LNG)
|
||||||
{
|
{
|
||||||
(*desImp)(src, desSel, address, type, &cursor, nil);
|
(*desImp)(src, desSel, address, type, &cursor, nil);
|
||||||
return;
|
return;
|
||||||
|
@ -982,8 +1015,8 @@ static Class NSDataMallocClass;
|
||||||
#ifdef _C_LNG_LNG
|
#ifdef _C_LNG_LNG
|
||||||
case _GSC_LNG_LNG:
|
case _GSC_LNG_LNG:
|
||||||
case _GSC_ULNG_LNG:
|
case _GSC_ULNG_LNG:
|
||||||
typeCheck(*type, info & _GSC_MASK);
|
if (YES == typeCheck(*type, info & _GSC_MASK)
|
||||||
if ((info & _GSC_SIZE) == _GSC_S_LNG_LNG)
|
&& (info & _GSC_SIZE) == _GSC_S_LNG_LNG)
|
||||||
{
|
{
|
||||||
(*desImp)(src, desSel, address, type, &cursor, nil);
|
(*desImp)(src, desSel, address, type, &cursor, nil);
|
||||||
return;
|
return;
|
||||||
|
@ -992,8 +1025,8 @@ static Class NSDataMallocClass;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
case _GSC_FLT:
|
case _GSC_FLT:
|
||||||
typeCheck(*type, _GSC_FLT);
|
if (YES == typeCheck(*type, _GSC_FLT)
|
||||||
if (*type == _C_FLT)
|
&& *type == _C_FLT)
|
||||||
{
|
{
|
||||||
(*desImp)(src, desSel, address, type, &cursor, nil);
|
(*desImp)(src, desSel, address, type, &cursor, nil);
|
||||||
}
|
}
|
||||||
|
@ -1009,8 +1042,8 @@ static Class NSDataMallocClass;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case _GSC_DBL:
|
case _GSC_DBL:
|
||||||
typeCheck(*type, _GSC_DBL);
|
if (YES == typeCheck(*type, _GSC_DBL)
|
||||||
if (*type == _C_DBL)
|
&& *type == _C_DBL)
|
||||||
{
|
{
|
||||||
(*desImp)(src, desSel, address, type, &cursor, nil);
|
(*desImp)(src, desSel, address, type, &cursor, nil);
|
||||||
}
|
}
|
||||||
|
@ -1095,31 +1128,31 @@ static Class NSDataMallocClass;
|
||||||
/*
|
/*
|
||||||
* Now we copy from the 'bigval' to the destination location.
|
* Now we copy from the 'bigval' to the destination location.
|
||||||
*/
|
*/
|
||||||
switch (info & _GSC_MASK)
|
switch (*type)
|
||||||
{
|
{
|
||||||
case _GSC_SHT:
|
case _C_SHT:
|
||||||
*(short*)address = (short)bigval;
|
*(short*)address = (short)bigval;
|
||||||
return;
|
return;
|
||||||
case _GSC_USHT:
|
case _C_USHT:
|
||||||
*(unsigned short*)address = (unsigned short)bigval;
|
*(unsigned short*)address = (unsigned short)bigval;
|
||||||
return;
|
return;
|
||||||
case _GSC_INT:
|
case _C_INT:
|
||||||
*(int*)address = (int)bigval;
|
*(int*)address = (int)bigval;
|
||||||
return;
|
return;
|
||||||
case _GSC_UINT:
|
case _C_UINT:
|
||||||
*(unsigned int*)address = (unsigned int)bigval;
|
*(unsigned int*)address = (unsigned int)bigval;
|
||||||
return;
|
return;
|
||||||
case _GSC_LNG:
|
case _C_LNG:
|
||||||
*(long*)address = (long)bigval;
|
*(long*)address = (long)bigval;
|
||||||
return;
|
return;
|
||||||
case _GSC_ULNG:
|
case _C_ULNG:
|
||||||
*(unsigned long*)address = (unsigned long)bigval;
|
*(unsigned long*)address = (unsigned long)bigval;
|
||||||
return;
|
return;
|
||||||
#ifdef _C_LNG_LNG
|
#ifdef _C_LNG_LNG
|
||||||
case _GSC_LNG_LNG:
|
case _C_LNG_LNG:
|
||||||
*(long long*)address = (long long)bigval;
|
*(long long*)address = (long long)bigval;
|
||||||
return;
|
return;
|
||||||
case _GSC_ULNG_LNG:
|
case _C_ULNG_LNG:
|
||||||
*(unsigned long long*)address = (unsigned long long)bigval;
|
*(unsigned long long*)address = (unsigned long long)bigval;
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue