tweaks to keep static analyzer happy

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36527 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-04-14 16:25:27 +00:00
parent 54ff9b7de5
commit 97cecc058e
12 changed files with 158 additions and 118 deletions

View file

@ -1251,20 +1251,25 @@ GSScanDouble(unichar *buf, unsigned length, double *result)
{
pos++;
}
if (pos >= length)
{
return NO;
}
/* Check for sign */
if (pos < length)
switch (buf[pos])
{
switch (buf[pos])
{
case '+':
pos++;
break;
case '-':
negativeMantissa = YES;
pos++;
break;
}
case '+':
pos++;
break;
case '-':
negativeMantissa = YES;
pos++;
break;
}
if (pos >= length)
{
return NO;
}
/* Scan the mantissa ... at most 18 digits and a decimal point.
@ -1280,16 +1285,15 @@ GSScanDouble(unichar *buf, unsigned length, double *result)
}
dotPos = mantissaLength;
}
mantissaLength++;
else
{
mantissaLength++;
}
}
if (dotPos < 0)
{
dotPos = mantissaLength;
}
else
{
mantissaLength -= 1;
}
if (0 == mantissaLength)
{
@ -1308,22 +1312,12 @@ GSScanDouble(unichar *buf, unsigned length, double *result)
{
c = *ptr;
ptr += 1;
if ('.' == c)
{
c = *ptr;
ptr += 1;
}
hi = hi * 10 + (c - '0');
}
for (; mantissaLength > 0; mantissaLength -= 1)
{
c = *ptr;
ptr += 1;
if ('.' == c)
{
c = *ptr;
ptr += 1;
}
lo = lo * 10 + (c - '0');
}
value = (1.0e9 * hi) + lo;