mirror of https://github.com/acidanthera/audk.git
StdLib: Fix a "potentially uninitialized variable" error.
gdtoa/gdtoa.c: Several "goto" paths allowed the initialization of a variable to be bypassed. Initialized it at the top of the function in order to eliminate the error. Updated the file header and copyright notices. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16324 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
931b2cff42
commit
2a7e98a8cc
|
@ -1,6 +1,15 @@
|
|||
/* $NetBSD: gdtoa.c,v 1.1.1.1.4.1.4.1 2008/04/08 21:10:55 jdc Exp $ */
|
||||
/** @file
|
||||
|
||||
/****************************************************************
|
||||
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
***************************************************************
|
||||
|
||||
The author of this software is David M. Gay.
|
||||
|
||||
|
@ -26,10 +35,11 @@ IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
|
||||
****************************************************************/
|
||||
Please send bug reports to David M. Gay (dmg at acm dot org,
|
||||
with " at " changed at "@" and " dot " changed to ".").
|
||||
|
||||
/* Please send bug reports to David M. Gay (dmg at acm dot org,
|
||||
* with " at " changed at "@" and " dot " changed to "."). */
|
||||
NetBSD: gdtoa.c,v 1.1.1.1.4.1.4.1 2008/04/08 21:10:55 jdc Exp
|
||||
**/
|
||||
#include <LibConfig.h>
|
||||
|
||||
#include "gdtoaimp.h"
|
||||
|
@ -78,9 +88,9 @@ bitstob(ULong *bits, int nbits, int *bbits)
|
|||
}
|
||||
b->wds = i + 1;
|
||||
*bbits = i*ULbits + 32 - hi0bits(b->x[i]);
|
||||
ret:
|
||||
ret:
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string.
|
||||
*
|
||||
|
@ -162,6 +172,8 @@ gdtoa
|
|||
double d, d2, ds, eps;
|
||||
char *s, *s0;
|
||||
|
||||
mlo = NULL;
|
||||
|
||||
#ifndef MULTIPLE_THREADS
|
||||
if (dtoa_result) {
|
||||
freedtoa(dtoa_result);
|
||||
|
@ -198,7 +210,7 @@ gdtoa
|
|||
}
|
||||
if (!b->wds) {
|
||||
Bfree(b);
|
||||
ret_zero:
|
||||
ret_zero:
|
||||
*decpt = 1;
|
||||
return nrv_alloc("0", rve, 1);
|
||||
}
|
||||
|
@ -437,7 +449,7 @@ gdtoa
|
|||
#ifndef No_leftright
|
||||
}
|
||||
#endif
|
||||
fast_failed:
|
||||
fast_failed:
|
||||
s = s0;
|
||||
dval(d) = d2;
|
||||
k = k0;
|
||||
|
@ -477,7 +489,7 @@ gdtoa
|
|||
}
|
||||
dval(d) += dval(d);
|
||||
if (dval(d) > ds || (dval(d) == ds && L & 1)) {
|
||||
bump_up:
|
||||
bump_up:
|
||||
inex = STRTOG_Inexhi;
|
||||
while(*--s == '9')
|
||||
if (s == s0) {
|
||||
|
@ -497,7 +509,8 @@ gdtoa
|
|||
|
||||
m2 = b2;
|
||||
m5 = b5;
|
||||
mhi = mlo = 0;
|
||||
mhi = NULL;
|
||||
mlo = NULL;
|
||||
if (leftright) {
|
||||
if (mode < 2) {
|
||||
i = nbits - bbits;
|
||||
|
@ -621,12 +634,12 @@ gdtoa
|
|||
if (ilim <= 0 && mode > 2) {
|
||||
if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0) {
|
||||
/* no digits, fcvt style */
|
||||
no_digits:
|
||||
no_digits:
|
||||
k = -1 - ndigits;
|
||||
inex = STRTOG_Inexlo;
|
||||
goto ret;
|
||||
}
|
||||
one_digit:
|
||||
one_digit:
|
||||
inex = STRTOG_Inexhi;
|
||||
*s++ = '1';
|
||||
k++;
|
||||
|
@ -721,13 +734,13 @@ gdtoa
|
|||
}
|
||||
if (b->wds > 1 || b->x[0])
|
||||
inex = STRTOG_Inexlo;
|
||||
accept:
|
||||
accept:
|
||||
*s++ = dig;
|
||||
goto ret;
|
||||
}
|
||||
if (jj1 > 0 && rdir != 2) {
|
||||
if (dig == '9') { /* possible if i == 1 */
|
||||
round_9_up:
|
||||
round_9_up:
|
||||
*s++ = '9';
|
||||
inex = STRTOG_Inexhi;
|
||||
goto roundoff;
|
||||
|
@ -779,7 +792,7 @@ gdtoa
|
|||
return NULL;
|
||||
j = cmp(b, S);
|
||||
if (j > 0 || (j == 0 && dig & 1)) {
|
||||
roundoff:
|
||||
roundoff:
|
||||
inex = STRTOG_Inexhi;
|
||||
while(*--s == '9')
|
||||
if (s == s0) {
|
||||
|
@ -790,20 +803,20 @@ gdtoa
|
|||
++*s++;
|
||||
}
|
||||
else {
|
||||
chopzeros:
|
||||
chopzeros:
|
||||
if (b->wds > 1 || b->x[0])
|
||||
inex = STRTOG_Inexlo;
|
||||
while(*--s == '0'){}
|
||||
s++;
|
||||
}
|
||||
ret:
|
||||
ret:
|
||||
Bfree(S);
|
||||
if (mhi) {
|
||||
if (mlo && mlo != mhi)
|
||||
Bfree(mlo);
|
||||
Bfree(mhi);
|
||||
}
|
||||
ret1:
|
||||
ret1:
|
||||
Bfree(b);
|
||||
*s = 0;
|
||||
*decpt = k + 1;
|
||||
|
@ -811,4 +824,4 @@ gdtoa
|
|||
*rve = s;
|
||||
*kindp |= inex;
|
||||
return s0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue