summaryrefslogtreecommitdiff
path: root/StdLib/LibC
AgeCommit message (Collapse)Author
2015-07-30StdLib: Add support for AArch64Harry Liebel
- Use some files from ARM version. - Use NetBSD software floating point library to provide floating point operations not handled directly by hardware floating point enabled GCC compiler. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Harry Liebel <Harry.Liebel@arm.com> Reviewed-by: Olivier Martin <Olivier.Martin@arm.com> Reviewed-by: Daryl McDaniel <edk2-lists@mc2research.org> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18118 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-30StdLib/LibC: Provide missing ARM symbolsHarry Liebel
Provide missing functionality by using files from LLVM. Changes made: - Formatting changes (tabs to spaces, DOS line endings etc). - Simplified 'int_endianness.h' to work for our case. - Added LLVM licence to the individual files. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Harry Liebel <Harry.Liebel@arm.com> Reviewed-by: Olivier Martin <Olivier.Martin@arm.com> Reviewed-by: Daryl McDaniel <edk2-lists@mc2research.org> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18117 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-30StdLib/LibC: Add software floating point library from NetBSDNetBSD project
Floating point processing is not supported on ARM for UEFI. In order to support UEFI applications in AppPkg we use this library to provide the required functionality. Changes as compared to the NetBSD version: - Formatting changes (tabs to spaces, DOS line endings etc). - Disable exceptions as described in the float_raise() function. - Disable definition of 'Symbolic Boolean literals' in milieu.h. Source originally from: NetBSD project - Source: http://cvsweb.netbsd.org/bsdweb.cgi/?only_with_tag=MAIN - Licensing and Copyright: http://www.netbsd.org/about/redistribution.html Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Harry Liebel <Harry.Liebel@arm.com> Reviewed-by: Olivier Martin <Olivier.Martin@arm.com> Reviewed-by: Daryl McDaniel <edk2-lists@mc2research.org> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18116 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-26StdLib: Do not define memcpy for AARCH64 buildsScott Duplichan
For AARCH64, do not define a memcpy function in stdlib because it is already defined in CompilerIntrinsicsLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Scott Duplichan <scott@notabs.org> Reviewed-by: Daryl McDaniel <edk2-lists@mc2research.org> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18063 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-13StdLib: Move libraries from ShellPkg into MdeModulePkg and MdePkg.Daryl McDaniel
The following libraries are being migrated out of ShellPkg in order to make their functionality more widely available. • PathLib: Incorporate into MdePkg/Library/BaseLib • FileHandleLib: MdePkg/Library/UefiFileHandleLib • BaseSortLib: MdeModulePkg/Library/BaseSortLib • UefiSortLib: MdeModulePkg/Library/UefiSortLib AppPkg.dsc: StdLib.dsc: StdLib.inc: Delete PathLib LibraryClass description. Update FileHandleLib LibraryClass description to reflect its new location. Update SortLib LibraryClass description to reflect its new location. StdLib.inf: Delete PathLib from LibraryClasses. realpath.c: Delete include of PathLib.h. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Lee Rosenbaum <lee.g.rosenbaum@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16608 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-11StdLib/AppPkg: Add the NOOPT build target and fix a type conversion problem ↵Daryl McDaniel
with VS2005. AppPkg.dsc: Remove IPF support and add NOOPT build target. StdLib.dsc: Add NOOPT build target. daConsole.c: Cast a comparison to BOOLEAN before assigning it to a BOOLEAN. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16331 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-10StdLib: Fix a "potentially uninitialized variable" error.Daryl McDaniel
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
2014-10-31StdLib: Fix more GCC warnings/errors caused by variables being set but not used.Olivier Martin
Removed variables that had no effect on code behavior. Normalized comment formatting. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> Reviewed by: Daryl McDaniel <daryl.mcdaniel@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16286 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-30StdLib: Fix GCC warnings/errors caused by variables being set but not used.Olivier Martin
Removed variables that had no effect on code behavior. Fifo.c::FIFO_Dequeue: Replaced instances of "Self->ElementSize" with preexisting variable "SizeOfElement". IIOutilities.c::IIO_GetInChar: Fixed variable of wrong, but compatible, type and made updating of housekeeping variables dependent upon successful completion of reading from the buffer. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> Reviewed by: Daryl McDaniel <daryl.mcdaniel@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16276 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-28StdLib: Some deployed versions of the Simple Text Input Protocol randomly ↵Daryl McDaniel
return either NUL characters or Scan Codes when just typing normal text. These changes filter out NUL characters and make Scan Code and error handling more robust. StdLibPrivateInternalFiles/Include/Device/Console.h: Change UnGetKey, in the ConInstance structure, from an EFI_INPUT_KEY structure to a CHAR16 variable. Include/sys/termios.h: Add CHAR_SUB and CHAR_ESC for translation of '^Z' and the Escape Scan Code into the EOF and ESC characters, respectively. LibC/Uefi/Devices/Console/daConsole.c: Add da_ConRawRead() function to simplify the read logic. Discard NUL characters from the input stream. In Blocking mode, retry until a non-NUL character is received. In NonBlocking mode, a NUL causes an EAGAIN error to be returned. Translate the Escape Scan Code into an ESC character. If Scan Codes are ignored, retry if in Blocking mode else return an EAGAIN error. UnGetKey becomes a single wide character instead of a structure. Change da_Poll() to use da_ConRawRead(). LibC/Uefi/InteractiveIO/IIOutilities.c: BUG fix. Return the processed input character instead of the raw character. Allows EOF propagation. LibC/Uefi/InteractiveIO/CanonRead.c: Enable EOF propagation. LibC/Uefi/InteractiveIO/IIOechoCtrl.h: Use symbols defined in termios.h instead of hard-coded constant numbers. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16254 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-18StdLib: Produce DevMedia as a library class alternative to DevShell.Daryl McDaniel
AppPkg: Replace existing DevShell dependencies with DevMedia. These patches will NOT cause existing code which uses DevShell to break. During an interim period, either DevShell or DevMedia may be used. In the future, DevShell will be removed from the code base. During the interim, DevShell and DevMedia refer to the same library. StdLib/LibC/Uefi/Devices/daShell.inf Make this library also satisfy the DevMedia library class. StdLib/StdLib.inc Add a library class definition for DevMedia AppPkg/Applications/OrderedCollectionTest/OrderedCollectionTest.inf AppPkg/Applications/Python/PythonCore.inf AppPkg/Applications/Sockets/GetAddrInfo/GetAddrInfo.inf AppPkg/Applications/Sockets/GetHostByAddr/GetHostByAddr.inf AppPkg/Applications/Sockets/GetHostByDns/GetHostByDns.inf AppPkg/Applications/Sockets/GetHostByName/GetHostByName.inf AppPkg/Applications/Sockets/GetNameInfo/GetNameInfo.inf AppPkg/Applications/Sockets/GetNetByAddr/GetNetByAddr.inf AppPkg/Applications/Sockets/GetNetByName/GetNetByName.inf AppPkg/Applications/Sockets/GetServByName/GetServByName.inf AppPkg/Applications/Sockets/GetServByPort/GetServByPort.inf AppPkg/Applications/Sockets/RecvDgram/RecvDgram.inf AppPkg/Applications/Sockets/SetHostName/SetHostName.inf AppPkg/Applications/Sockets/SetSockOpt/SetSockOpt.inf AppPkg/Applications/Sockets/TftpServer/TftpServer.inf AppPkg/Applications/Sockets/WebServer/WebServer.inf Change LibraryClass dependency from DevShell to DevMedia Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16142 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-11StdLib: Fix some build problems and obscure bugs.daryl.mcdaniel
StdLib\ BsdSocketLib\ ns_print.c Use "%lu" format instead of "%Lu". A capital 'L' specifies (long double) in print formats. Add a cast from char to (unsigned int) to match its sprintf format. res_debug.c Use "%lu" format instead of "%Lu". A capital 'L' specifies (long double) in print formats. EfiSocketLib\ Socket.c Update copyright & correct formatting Include\ sys\ EfiCdefs.h Update copyright date Change type of LONGN and ULONGN to INTN and UINTN, respectively. errno.h Update copyright date Add enum member '__ESUCCESS = 0' fcntl.h Update copyright date Improve comment for O_EXCL stat.h Update copyright date Reorder the S_* flags Put the S_* predicate macros in the same order as their flag definitions Add a function header comment to the stat() function declaration. errno.h Update copyright date Define new ESUCCESS error code wchar.h Update copyright date Correct the description of the Nptr parameter to the wcstol, wcstoll, wcstoul, and wcstoull functions. x86\float.h Update copyright date Define 'long double' limits for non-Microsoft compilers LibC\ Containers\Queues\Fifo.c Rewrite to make more robust and secure (zeros out old data) StdLib\realpath.c Update copyright date Reformat descriptive comment for realpath() Add terminating CRLF Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16096 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-09StdLib: Changes needed to support XCODE5Andrew Fish
I had to make the following changes to make this build work: >build -p AppPkg/AppPkg.dsc -a X64 -t XCODE5 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Andrew Fish <afish@apple.com> Reviewed-by: Daryl McDaniel <daryl.mcdaniel@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16081 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-21StdLib/LibC/gdtoa: Initialize variables before use, update the Kmax definition.Daryl McDaniel
gdtoaimp.h: update the Kmax definition. strtodg.c: initialize variables before use. general: Remove conditional sections for VAX and IBM mainframe. Remove conditional sections for pre-ANSI (K&R) function prototypes. 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> Reviewed-by: Jaben carsey <Jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15874 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-20StdLib: reinstate the use of va_arg() to handle long double arguments in ↵Olivier Martin
vfscanf. NOTE: Replaces the previous version which was a file from the wrong project. 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> 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@15859 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-20StdLib/LibC: Fix ARM symbol problemsHarry Liebel
StdLibPrivateInternalFiles: Add AArch64 support Disable 'memcpy' symbol for ARM in LibC. It is already provided by the ARM compiler intrinsics library. Add missing 'strtold' symbol. Use the same fallback as IPF for now. Use Include definitions as provided by ARM version. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Harry Liebel <Harry.Liebel@arm.com> Reviewed-By: Olivier Martin <olivier.martin@arm.com> Reviewed-By: Daryl McDaniel <daryl.mcdaniel@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15858 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-20StdLib: reinstate the use of va_arg() to handle long double arguments in ↵Olivier Martin
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
2014-08-20StdLib: Add a runtime helper function for VC++ 64-bit right shift on Ia32 ↵Daryl McDaniel
target architectures. Add new file StdLib/LibC/CRT/Ia32/llshr.c Add references to the new file to StdLib/LibC/LibC.inf 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@15855 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-11StdLib/LibC/Stdio: fix "missing braces around initializer"Laszlo Ersek
The member "fext._ub" is a structure (of type "struct __sbuf"), and the current initializer triggers StdLib/LibC/Stdio/vswscanf.c: In function 'vswscanf': StdLib/LibC/Stdio/vswscanf.c:75:10: error: missing braces around initializer [-Werror=missing-braces] StdLib/LibC/Stdio/vswscanf.c:75:10: error: (near initialization for 'fext._ub') [-Werror=missing-braces] cc1: all warnings being treated as errors Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15786 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-11StdLib/LibC/gdtoa: fix "missing braces around initializer"Laszlo Ersek
The member "u.L" is an array, and the current initializer triggers StdLib/LibC/gdtoa/strtof.c: In function '_strtof': StdLib/LibC/gdtoa/strtof.c:53:9: error: missing braces around initializer [-Werror=missing-braces] StdLib/LibC/gdtoa/strtof.c:53:9: error: (near initialization for 'u.L') [-Werror=missing-braces] cc1: all warnings being treated as errors Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15785 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-06StdLib: The formatting for double float values, within the gdtoa library, is ↵Daryl McDaniel
improper. When running Enquire.efi, several errors similar to the following are produced: Maximum exponent = 128 Maximum number = 3.40282347e+38 *** WARNING: Possibly bad output from printf above expected value around 3.40282347e38, bit pattern: 11111111 11111111 01111111 01111111 sscanf gave -inf, bit pattern: 00000000 00000000 10000000 11111111 difference= inf Overflow doesn’t seem to generate a trap The memory allocation tests will also fail, sometimes leaving all available memory consumed. The correct output in the above example is: Maximum exponent = 128 Maximum number = 3.40282347e+38 Overflow doesn't seem to generate a trap The root cause is that all operations on values of Long or ULong type, within the gdtoa library, must be 32-bit operations. A previous change replaced the Long and ULong definitions with INTN and UINTN, respectively. While this is correct for a lot of Linux and NetBSD code, it was not correct for this library. This fix reverts the definitions of ULong and Long back to 32-bit types. A descriptive comment has also been added to the U union. Additional white-space has been added to tidy up the definitions of the word0 and word1 macros. Verified with Enquire.efi and the ISO/IEC C Library compliance Validation Suite. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15765 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-24StdLib/LibC/StdLib/Malloc.c: Revert cast removal to fix GCC build breakage.Daryl McDaniel
The cast to (void**) is needed for the last parameter of the AllocatePool call in malloc(). This is because type CPOOL_HEAD** is not automatically promoted to void**, as required by AllocatePool(). This was originally addressed in SVN revision 15474 but removed again in 15664. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed by: Stefan Kaeser <stefankaeser@hotmail.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15677 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-17StdLib: Simple code cleanupDaryl McDaniel
StdLib/LibC/Main/Main.c Change Print to Debug statements. Ensure errno is initialized to 0 before calling main(). StdLib/LibC/StdLib/Malloc.c Aesthetic Cleanup: remove unnecessary cast, fix two whitespace alignment problems. StdLib/LibC/Uefi/InteractiveIO/NonCanonRead.c Change Include order. StdLib/Include/paths.h Add definition _PATH_LIB for the path to the library directory: /Efi/StdLib/lib. StdLib/LibC/Stdio/vfwscanf.c Align declarations and initializations. Initialize the multipurpose pointer, p, to NULL. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15664 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-17StdLib: Move GetPass.c out of Uefi and into PosixLib. Create LibPosix to ↵Daryl McDaniel
contain all functions from PosixLib instead of individual libraries. Retains the ability to use the individual libraries, except GetPass, for backwards compatibility. StdLib/LibC/Uefi/GetPass.c COPY to StdLib/PosixLib/GetPass/GetPass.c DELETE StdLib/PosixLib/GetPass/GetPass.c NEW, COPIED from StdLib/LibC/Uefi/GetPass.c StdLib/PosixLib/PosixLib.inf Create a LibPosix library class to build all PosixLib functions into a single library. Move GetPass from LibC/Uefi to PosixLib.inf StdLib/LibC/Uefi/Uefi.inf Remove GetPass.c from sources. Remove IPF from VALID_ARCHITECTURES Update VERSION_STRING Align [Defines] on a two-character boundary 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@15663 6f19259b-4bc3-4df7-8a09-765794883524
2014-04-17StdLib: StdLib/Malloc.cPaulo Alcantara
This patch fixes the following warning: "expected ‘void **’ but argument is of type ‘struct CPOOL_HEAD **’" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Paulo Alcantara <pcacjr@zytor.com> Reviewed by: Daryl McDaniel <daryl.mcdaniel@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15474 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-07StdLib: Modify the memory allocation routines to not be dependent upon the ↵Daryl McDaniel
internal structure of the EDK II memory pool. StdLib/LibC/StdLib/Malloc.c Create a private data structure, CPOOL_HEAD, which contains housekeeping information for StdLib’s memory allocation functions. An instance of this structure is prepended to every chunk of allocated memory. The structure links the allocation into a doubly-linked list and keeps track of the size of each allocation unit. This information is then available for use by the realloc function. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> Reviewed-by: Rosenbaum, Lee G <lee.g.rosenbaum@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15319 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-10StdLib: Update Copyright Notices.Daryl McDaniel
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Matthew Stanbro <Matthew.A.Stanbro@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14960 6f19259b-4bc3-4df7-8a09-765794883524
2013-12-10StdLib: Remove an unnecessary dependency from LibWchar.Daryl McDaniel
LibWchar is now a standalone library which can be used independent of the rest of StdLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Matthew Stanbro <Matthew.A.Stanbro@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14959 6f19259b-4bc3-4df7-8a09-765794883524
2013-09-13StdLib: Fix pointer arithmetic issues in the strncasecmp function.Daryl McDaniel
The original Linux code tried to be too fancy so the internal pointers got out of sync. Rewrote the function to at least be more clear. Regardless, it now works properly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed by: matthew.stanbro@intel.com Reviewed by: erik.c.bjorge@intel.com git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14664 6f19259b-4bc3-4df7-8a09-765794883524
2013-09-10StdLib: Fix IA32 and X64 build issues.Daryl McDaniel
Building with the Intel Compiler V11 produces the following error: StdLib\LibC\Containers\Queues\Fifo.c(223): error #186: pointless comparison of unsigned integer with zero assert(Count >= 0); Deleted the assert. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed by: erik.c.bjorge@intel.com git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14648 6f19259b-4bc3-4df7-8a09-765794883524
2013-05-15StdLib/LibC/Locale/multibyte_Utf8.c: Fix obscure corner cases in wide to ↵darylm503
multibyte and multibyte to wide character conversions. The majority of problems center around the interpretation of the Length or Limit parameter when the Destination parameter is NULL. DecodeOneStateful: Properly handle combinations of Src, Dest, or Len being NULL or 0. EncodeUtf8: Do not zero-terminate the result string in this worker function. mbsrtowcs: Remove test for **src == '\0', as per ISO/IEC 9899:199409. Allows "". wcsrtombs: The C Language standard, ISO/IEC 9899:199409, states that the wcsrtombs() function will stop before encountering the terminating NUL character only if Dest is NOT NULL. This implies that if Dest is NULL, the Limit parameter will be ignored. In order to avoid system hangs, if Dest is NULL a Limit value of ASCII_STRING_MAX is automatically used. Also fixed a typo in the function header comment. With these changes, StdLib now passes all of the C Language Standards Compliance Tests for ISO/IEC 9899:199409 (C95). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14358 6f19259b-4bc3-4df7-8a09-765794883524
2013-03-11StdLib: Fix printf issues with floating point and wide character strings. ↵darylm503
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
2013-01-16StdLib: Correct two instances of mismatch between function declaration and ↵darylm503
definition causing GCC compile errors. StdLib\Include\Containers\Fifo.h Change return type of cFIFO_Truncate to size_t. Makes declaration match definition. Update comment to describe what is returned. StdLib\LibC\Uefi\InteractiveIO\IIOutilities.c Change return type of IIO_CursorDelta to int. Makes declaration match definition. Change other types from INT32 to int, for consistency. Update comment for returned values. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14060 6f19259b-4bc3-4df7-8a09-765794883524
2012-12-21StdLib: Fix issue with Canonical output expansion of NL to CR NL and similar ↵darylm503
expansions. SysCalls.c: Add IGNSPEC to the "sane" termios settings so that, by default, function keys and other special keys are ignored. fvwrite.c: Line 109: Change test to less-than zero since zero is a valid value. Line 113: Change test to greater-than zero since we only want to loop when there are characters available. Line 114: Force uio_resid to zero since it might have become negative on line 113. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com Reviewed-by: lee.g.rosenbaum@intel.com Reviewed-by: jaben.carsey@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14013 6f19259b-4bc3-4df7-8a09-765794883524
2012-12-11StdLib: Add terminal type line editing (Interactive IO) for console devices.darylm503
Adds a subset of the terminal I/O capabilities described in the Single Unix Specification, V4. Supports: Erase previous character. Default is Backspace or ^H Erase line. Default is ^U TAB characters are supported and, by default, are rendered as 8 spaces. They will still be read as a single TAB character. Both Canonical and Non-Canonical modes are supported. If a terminal device is opened with O_TTY_INIT in the mode, the device will be initialized to "sane" values for interactive use. It will be in Canonical mode, Enter will be translated to NewLine and on output, a NewLine is translated to CRLF. Echoing will be on, control characters are output as ^X, and TABs are expanded. See the new <sys/termios.h> file for more information. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com Reviewed-by: leroy.p.leahy@intel.com Reviewed-by: lee.g.rosenbaum@intel.com Reviewed-by: jaben.carsey@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13989 6f19259b-4bc3-4df7-8a09-765794883524
2012-10-12StdLib: Reverse a previous change resulting in string pointers that were not ↵darylm503
being incremented sufficiently to accommodate the terminating NUL. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: Fernandes, Cristiano <cristiano.fernandes@hp.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13834 6f19259b-4bc3-4df7-8a09-765794883524
2012-10-05StdLib: Fix several problems where characters were not being correctly ↵darylm503
converted between wide and MBCS. Add utility functions for determining character length of strings. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com Reviewed-by: lee.g.rosenbaum@intel.com StdLib/LibC/ Locale/multibyte_Utf8.c Improve comments. Define implementation-specific MBCS utility functions, as declared in <stdlib.h>. Enhance functionality of EncodeUtf8() and improve error handling. Set correct conversion state in wcrtomb(). Bug fixes in wcsrtombs(). Make wctob() properly MBCS compliant. Main/Main.c Remove code obsoleted by new wcsrtombs() implementation. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13785 6f19259b-4bc3-4df7-8a09-765794883524
2012-09-24StdLib/LibC/StdLib/Malloc.c: Make the free() function conform to the ↵darylm503
ISO/IEC 9899 (C95) specification. The C95 specification states: "The free function causes the space pointed to by ptr to be deallocated, that is, made available for further allocation. If ptr is a null pointer, no action occurs". The UEFI FreePool() function, which the StdLib implementation of free() uses, does not make this check. This fix adds a check for null to the free() function such that if the pointer argument is NULL, nothing is done. Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: erik.c.bjorge@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13739 6f19259b-4bc3-4df7-8a09-765794883524
2012-09-20StdLib, StdLibPrivateInternalFiles: Clean up comments, Remove debugging ↵darylm503
code, Define MAX_OUTPUT, the Maximum number of bytes in a single terminal output operation. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Jaben Carsey <jcarsey@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13735 6f19259b-4bc3-4df7-8a09-765794883524
2012-07-18StdLib/LibC/Uefi/Devices/Console/daConsole.c: Fix bug where unconvertable ↵darylm503
wide characters would cause the code to hang or generate an exception. When the WideTtyCvt() function encountered an unconvertable character, it properly replaced it but did not update the byte count, numB, to 1 and instead left it at -1. This fix sets numB to 1 when an unconvertable character is replaced. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: tim.lewis@insidesw.com Reviewed-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13540 6f19259b-4bc3-4df7-8a09-765794883524
2012-06-20StdLib/LibC/Uefi/Devices/Console/daConsole.c: Fix name of the XY offset union.darylm503
The XYoffset union typedef has been renamed to XY_OFFSET to conform to the C Coding Standards. Fixes a build error. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13462 6f19259b-4bc3-4df7-8a09-765794883524
2012-06-15StdLib: Add multi-byte character support. The normal "narrow" character set ↵darylm503
is now UTF-8 instead of ASCII. Add library classes which are required by StdLib, but not commonly defined in Platform DSC files, to StdLib.inc. Modify MB_LEN_MAX to be 4, the maximum length of UTF-8 characters. Adjust size of internal buffers to be multiples of MB_LEN_MAX instead of assuming 1-byte characters. Make the XYoffset object public and move its declaration into EfiSysCall.h. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: daryl.mcdaniel@intel.com Reviewed-by: erik.c.bjorge@intel.com Reviewed-by: lee.g.rosenbaum@intel.com Reviewed-by: leroy.p.leahy@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13457 6f19259b-4bc3-4df7-8a09-765794883524
2012-03-24EADK (StdLib, AppPkg, StdLibPrivateInternalFiles): Python Beta Release.darylm503
Clean up and clearly differentiate required and optional items in configuration files. Enable the system command and synchronize configuration options between all CPU architectures. Replace the UEFI_ENV macro with UEFI_C_SOURCE to align with Linux and Posix conventions. Update copyrights and versions and make minor cosmetic enhancements to files. Fix compiler-specific build errors. Add Python-specific ReadMe file. Signed-off-by: darylm503 Reviewed-by: geekboy15a Reviewed-by: jljusten Reviewed-by: leegrosenbaum git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13119 6f19259b-4bc3-4df7-8a09-765794883524
2012-02-01StdLib: Fix compiler compatibility issues:darylm503
tcp.h: Fix packed structure syntax. cdefs.h is not included so the existing __packed attribute was not properly expanded. Non-GCC compilers were also not handled correctly. Changing to the pack(n) pragma is compatible between all supported compilers. SysCalls.c: The utimes() function has a fixed number of arguments and calls a function that takes a va_list argument. GCC will not allow the va_start, etc., macros to be used in a function with a fixed number of arguments, even though that is valid C. The workaround was to create a worker function for utimes() that takes a variable number of arguments. The worker function then uses the va_* macros. Signed-off-by: darylm503 Reviewed-by: leegrosenbaum git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12977 6f19259b-4bc3-4df7-8a09-765794883524
2011-11-30StdLib: Add isDirSep character classification macro and function. Implement ↵darylm503
several Posix functions and clean up EfiSysCall.h. Align file mode handling with UEFI file protocol flags. Include/ctype.h: Function declaration and Macro definition of isDirSep Include/unistd.h: Declarations added from EfiSysCall.h Include/utime.h: New file. For the Posix utime() function. Include/sys/_ctype.h: Update character class bit maps. Include/sys/EfiSysCall.h: Move declarations to unistd.h Include/sys/fcntl.h: Improve comments. Add UEFI-specific macros. Include/sys/filio.h: Remove declarations for unsupported file ioctls. Include/sys/stat.h: Fix flags. Add macros and declarations. Include/sys/time.h: Add declarations for new functions Tm2Efi() and Time2Efi(). Include/sys/types.h: Use EFI-specific instead of BSD-specific definitions for typedefs. Include/sys/unistd.h: Delete inappropriate content. Guard macro definitions. LibC/Locale/setlocale.c LibC/Stdio/{fdopen.c, findfp.c, fopen.c, freopen.c, gettemp.c, makebuf.c, mktemp.c, remove.c, stdio.c, tempnam.c, tmpfile.c, tmpnam.c} LibC/Time/{itimer.c, ZoneProc.c} LibC/Uefi/SysCalls.c LibC/Uefi/Devices/Console/daConsole.c LibC/Uefi/Devices/UefiShell/daShell.c PosixLib/Gen/readdir.c Include unistd.h instead of EfiSysCall.h LibC/Ctype/CClass.c: Character classification function implementation for isDirSep. LibC/Ctype/iCtype.c: Update character classification and case conversion tables. LibC/Time/TimeEfi.c: Improve comments. Implement new functions Tm2Efi() and Time2Efi(). LibC/Uefi/StubFunctions.c: Add missing include. Cosmetic changes to declarations. LibC/Uefi/SysCalls.c: Add support function for utime(). LibC/Uefi/Uefi.inf: Add LibGen library class dependency. LibC/Uefi/Xform.c: Enhance Omode2EFI(). LibC/Uefi/Devices/UefiShell/daShell.c: Enhance da_ShellMkdir. Implement da_ShellIoctl to set file times. PosixLib/Gen/access.c: New file. Implement the access() function. PosixLib/Gen/dirname.c: Enhance to use isDirSep and differentiate between the device, path, and filename components of UEFI Shell-style paths. PosixLib/Gen/utime.c: New file. Implement the utime() function. PosixLib/Gen/LibGen.inf: Change MODULE_TYPE. Add new files. Signed-off-by: darylm503 Reviewed-by: geekboy15a Reviewed-by: jljusten Reviewed-by: Rahul Khana Reviewed-by: leegrosenbaum git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12800 6f19259b-4bc3-4df7-8a09-765794883524
2011-11-11StdLib: Eliminate TimerLib dependencies.darylm503
Implement the clock() function using the EFI time-of-day clock instead of a TimerLib instance. Signed-off-by: darylm503 Reviewed-by: jljusten Reviewed-by: geekboy15a git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12683 6f19259b-4bc3-4df7-8a09-765794883524
2011-11-03StdLib: Move the declarations for ffs() and bzero() from extern.h to strings.h.darylm503
Signed-off-by: darylm503 Reviewed-by: jljusten git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12654 6f19259b-4bc3-4df7-8a09-765794883524
2011-11-03StdLib: Make the vfscanf function public.darylm503
Signed-off-by: darylm503 Reviewed-by: geekboy15a git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12653 6f19259b-4bc3-4df7-8a09-765794883524
2011-11-03StdLib: Revise the meaning of several feature macros.darylm503
Feature macros, defined in StdLibPrivateInternalFiles/Include/LibConfig.h are defined to cause the named feature to be included. When originally added, several features were guarded using reversed logic. Signed-off-by: darylm503 Reviewed-by: geekboy15a git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12652 6f19259b-4bc3-4df7-8a09-765794883524
2011-11-02StdLib: Add directory access functions to PosixLib.darylm503
Update <dirent.h> and <sys/dirent.h> to latest version. Enable the tempnam function. Fix assignments within predicate expressions so that it is clear where assignment is intended and where comparison occurs. Remove internal.h and DirFunctions.c with its non-portable opendir, closedir, and readdir functions. Add modified versions of the NetBSD opendir, closedir, and readdir functions. Fix the declaration of stat() to be standards compliant and consistent with code. Clean up indentation and declarations of non-existent objects. Signed-off-by: darylm503 Reviewed-by: lgrosenb Reviewed-by: lpleahy Reviewed-by: jljusten git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12649 6f19259b-4bc3-4df7-8a09-765794883524