mirror of
https://github.com/acidanthera/audk.git
synced 2025-05-04 14:40:11 +02:00
StdLib: reinstate the use of va_arg() to handle long double arguments in vfscanf.
Applies the patch, submitted by Olivier Martin, to use va_arg for long double. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <Olivier.Martin@arm.com> Reviewed-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Also initializes an array so that strings will be properly terminated. Includes some cosmetic changes to enhance readability. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Olivier Martin <Olivier.Martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15856 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
dfa8858555
commit
9792ff7c5d
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implementation of scanf internals for <stdio.h>.
|
Implementation of scanf internals for <stdio.h>.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License that accompanies this
|
under the terms and conditions of the BSD License that accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
@ -124,7 +124,8 @@ int __scanfdebug = 0;
|
|||||||
static int
|
static int
|
||||||
__collate_range_cmp(int c1, int c2)
|
__collate_range_cmp(int c1, int c2)
|
||||||
{
|
{
|
||||||
static char s1[2], s2[2];
|
static char s1[2] = { {0}, {0} };
|
||||||
|
static char s2[2] = { {0}, {0} };
|
||||||
|
|
||||||
s1[0] = (char)c1;
|
s1[0] = (char)c1;
|
||||||
s2[0] = (char)c2;
|
s2[0] = (char)c2;
|
||||||
@ -843,12 +844,8 @@ literal:
|
|||||||
goto match_failure;
|
goto match_failure;
|
||||||
if ((flags & SUPPRESS) == 0) {
|
if ((flags & SUPPRESS) == 0) {
|
||||||
if (flags & LONGDBL) {
|
if (flags & LONGDBL) {
|
||||||
long double **mp = (long double **)ap;
|
|
||||||
long double res = strtold(buf, &p);
|
long double res = strtold(buf, &p);
|
||||||
|
*va_arg(ap, long double *) = res;
|
||||||
*(*mp) = res;
|
|
||||||
ap += sizeof(long double *);
|
|
||||||
/*???*/ //*va_arg(ap, long double *) = res;
|
|
||||||
} else if (flags & LONG) {
|
} else if (flags & LONG) {
|
||||||
double res = strtod(buf, &p);
|
double res = strtod(buf, &p);
|
||||||
*va_arg(ap, double *) = res;
|
*va_arg(ap, double *) = res;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user