Fixup for 10.5 compat

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27960 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-02-23 11:20:29 +00:00
parent 1be05b5cd7
commit 845a701069
2 changed files with 38 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2009-02-23 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPortCoder.m:
make float and double interchangable to cope with MacOS-X 10.5
API which can use either for CGFloat.
2009-02-23 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Foundation/NSGeometry.h:

View file

@ -260,6 +260,12 @@ typeCheck(char t1, char t2)
#endif
)) return;
/* HACK also allow float and double to be used interchangably as MacOS-X
* intorduced CGFloat, which may be aither a float or a double.
*/
if ((c == _C_FLT || c == _C_DBL) && (t1 == _C_FLT || t1 == _C_DBL))
return;
[NSException raise: NSInternalInconsistencyException
format: @"expected %s and got %s",
typeToName1(t1), typeToName2(t2)];
@ -923,12 +929,36 @@ static IMP _xRefImp; /* Serialize a crossref. */
#endif
case _GSC_FLT:
typeCheck(*type, _GSC_FLT);
(*_dDesImp)(_src, dDesSel, address, type, &_cursor, nil);
if (*type == _C_FLT)
{
(*_dDesImp)(_src, dDesSel, address, type, &_cursor, nil);
}
else
{
float val;
/* We found a float when expecting a double ... handle it.
*/
(*_dDesImp)(_src, dDesSel, &val, @encode(float), &_cursor, nil);
*(double*)address = (double)val;
}
return;
case _GSC_DBL:
typeCheck(*type, _GSC_DBL);
(*_dDesImp)(_src, dDesSel, address, type, &_cursor, nil);
if (*type == _C_DBL)
{
(*_dDesImp)(_src, dDesSel, address, type, &_cursor, nil);
}
else
{
double val;
/* We found a double when expecting a float ... handle it.
*/
(*_dDesImp)(_src, dDesSel, &val, @encode(double), &_cursor, nil);
*(float*)address = (float)val;
}
return;
default: