StdLib: Fix printf issues with floating point and wide character strings. Also resolves a compilation issue with VS2010. See ISSUES.txt items 1, 11.

ISSUES.txt:  Added issue 11, updated status of issue 1.

gdtoa/gdtoaimp.h:  Fix definition of union U.

Locale/_wcstod.h:  Return 0.0 instead of 0 in the "no_convert" case.

Locale/multibyte_Utf8.c:  In wcsrtombs(), if both the destination pointer is NULL and the size, Limit, is 0; return the estimated length of the converted string up to ASCII_STRING_MAX bytes.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by:  daryl.mcdaniel@intel.com
Reviewed-by:    Aniruddha_Herekar@Dell.com


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14171 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
darylm503 2013-03-11 18:00:30 +00:00
parent f149129429
commit 05c7d5f615
4 changed files with 70 additions and 63 deletions

View File

@ -14,16 +14,17 @@ StdLib Issues
============= =============
Category TOOLs Reported Status Category TOOLs Reported Status
------------------------ -------- -------------- ----------- ------------------------ -------- -------------- -----------
1: Compilation Error vs2010 2012 Understood 1: Compilation Error vs2010 2012 Fixed 3/2013
stdlib\libc\gdtoa\strtod.c(825) : warning C4789: destination of memory copy is too small stdlib\libc\gdtoa\strtod.c(825) : warning C4789: destination of memory copy is too small
runtime crashes when using floating-point formats with printf
2: Compilation Error ALL 2012 Fixed 1/2012 2: Compilation Error ALL 2012 Fixed 1/2012
StdLib/LibC/Uefi/SysCalls.c: In function 'utimes': error: 'va_start' used in function with fixed args StdLib/LibC/Uefi/SysCalls.c: In function 'utimes': error: 'va_start' used in function with fixed args
3: Usage Clarification 2012 Understood/Document 3: Usage Clarification 2012 Document
Clarify that the current StdLib may not be used for developing drivers. Clarify that the current StdLib may not be used for developing drivers.
4: Execution/Compile errors 2012 Understood 4: Execution/Compile errors 2012 Fixed 1/2013
Mismatch in use of EFIAPI between declaration and definition of some functions. Mismatch in use of EFIAPI between declaration and definition of some functions.
5: Error message Quality during execution 2012 Verified 5: Error message Quality during execution 2012 Verified
@ -48,6 +49,9 @@ StdLib Issues
If the Shell does not have a current volume or directory, file operations If the Shell does not have a current volume or directory, file operations
may hang or fail. may hang or fail.
11: printf("-%ls-", L"test") will only print "--" 2013 Fixed 3/2013
PosixLib PosixLib
============= =============
Category TOOLs Reported Status Category TOOLs Reported Status

View File

@ -121,6 +121,6 @@ _FUNCNAME(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
no_convert: no_convert:
if (endptr != NULL) if (endptr != NULL)
*endptr = __UNCONST(nptr); *endptr = __UNCONST(nptr);
return 0; return 0.0;
} }
#endif /*__WCSTOD_H_*/ #endif /*__WCSTOD_H_*/

View File

@ -14,6 +14,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <wchar.h> #include <wchar.h>
#include <sys/types.h> #include <sys/types.h>
#include <limits.h>
typedef int ch_UCS4; typedef int ch_UCS4;
@ -913,6 +914,9 @@ wcsrtombs(
return (0); return (0);
if (Dest == NULL) { if (Dest == NULL) {
if(MaxBytes <= 0) {
MaxBytes = ASCII_STRING_MAX;
}
NumStored = EstimateWtoM(*Src, MaxBytes, NULL); NumStored = EstimateWtoM(*Src, MaxBytes, NULL);
} }
else { else {

View File

@ -283,8 +283,7 @@ extern "C" {
Exactly one of IEEE_LITTLE_ENDIAN, IEEE_BIG_ENDIAN, VAX, or IBM should be defined. Exactly one of IEEE_LITTLE_ENDIAN, IEEE_BIG_ENDIAN, VAX, or IBM should be defined.
#endif #endif
typedef union { double d; ULong L[2]; } U; typedef union { double d; UINT32 L[2]; } U;
//typedef union { double d; UINT32 L[2]; } U;
#ifdef YES_ALIAS #ifdef YES_ALIAS
#define dval(x) x #define dval(x) x