mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
OSX compatibility fix
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35532 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0fea583bc5
commit
b9bcf33a8d
2 changed files with 19 additions and 16 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2012-09-05 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSScanner.m: Compatibility tweak reported by hns@computer.org
|
||||||
|
A string like '1.2eX' where X is not a numeric exponent, needs to be
|
||||||
|
scanned as a float/double up to (but not including) the 'e' (or 'E')
|
||||||
|
rather than being treated as a badly formatted float/double.
|
||||||
|
|
||||||
2012-09-04 Fred Kiefer <FredKiefer@gmx.de>
|
2012-09-04 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Tests/base/NSXMLDocument/cdata.m: New test case for CDATA.
|
* Tests/base/NSXMLDocument/cdata.m: New test case for CDATA.
|
||||||
|
|
|
@ -724,32 +724,28 @@ typedef GSString *ivars;
|
||||||
/* Check for trailing exponent */
|
/* Check for trailing exponent */
|
||||||
if ((_scanLocation < myLength()) && ((c == 'e') || (c == 'E')))
|
if ((_scanLocation < myLength()) && ((c == 'e') || (c == 'E')))
|
||||||
{
|
{
|
||||||
|
unsigned int expScanLocation = _scanLocation;
|
||||||
int expval;
|
int expval;
|
||||||
|
|
||||||
|
|
||||||
_scanLocation++;
|
_scanLocation++;
|
||||||
if ([self _scanInt: &expval])
|
if ([self _scanInt: &expval])
|
||||||
{
|
{
|
||||||
/* Check for exponent overflow */
|
/* Check for exponent overflow */
|
||||||
if (num)
|
if (num)
|
||||||
{
|
{
|
||||||
if ((exponent > 0) && (expval > (LONG_MAX - exponent)))
|
if ((exponent > 0) && (expval > (LONG_MAX - exponent)))
|
||||||
exponent = LONG_MAX;
|
exponent = LONG_MAX;
|
||||||
else if ((exponent < 0) && (expval < (LONG_MIN - exponent)))
|
else if ((exponent < 0) && (expval < (LONG_MIN - exponent)))
|
||||||
exponent = LONG_MIN;
|
exponent = LONG_MIN;
|
||||||
else
|
else
|
||||||
exponent += expval;
|
exponent += expval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _ACCEPT_BAD_EXPONENTS_
|
|
||||||
/* Numbers like 1.23eFOO are accepted (as 1.23). */
|
/* Numbers like 1.23eFOO are accepted (as 1.23). */
|
||||||
_scanLocation = expScanLocation;
|
_scanLocation = expScanLocation;
|
||||||
#else
|
|
||||||
/* Numbers like 1.23eFOO are rejected. */
|
|
||||||
_scanLocation = saveScanLocation;
|
|
||||||
return NO;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (value)
|
if (value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue