mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
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:
parent
1be05b5cd7
commit
845a701069
2 changed files with 38 additions and 2 deletions
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue