From 53e1e5c647b73e45569ed6e8b8a0a5b276aa685e Mon Sep 17 00:00:00 2001 From: darylm503 Date: Tue, 28 Jun 2011 02:34:10 +0000 Subject: =?UTF-8?q?Add=20device=20abstraction=20code=20for=20the=20UEFI=20?= =?UTF-8?q?Console=20and=20UEFI=20Shell-based=20file=20systems.=20Make=20a?= =?UTF-8?q?rgv=20use=20narrow=20characters=20instead=20of=20wide=20charact?= =?UTF-8?q?ers.=20Add=20setenv=20functionality.=20Add=20poll()=20system=20?= =?UTF-8?q?call.=20Change=20signal=20names=20into=20macros=20=E2=80=93=20r?= =?UTF-8?q?equired=20for=20standards=20compliance.=20=20The=20enums=20were?= =?UTF-8?q?=20renamed=20and=20moved=20to=20sys/signal.h=20and=20the=20new?= =?UTF-8?q?=20macros=20reference=20the=20enums.=20Added=20SIGBREAK,=20whic?= =?UTF-8?q?h=20is=20required=20for=20Python.=20Modify=20stdio=20functions?= =?UTF-8?q?=20to=20fail=20cleanly=20when=20called=20with=20a=20NULL=20File?= =?UTF-8?q?=20Pointer=20argument.=20Added=20=20that=20just=20?= =?UTF-8?q?includes=20.=20=20By=20adding=20this=20wrapper,?= =?UTF-8?q?=20we=20improve=20compatibility=20with=20*nix=20files=20which?= =?UTF-8?q?=20assume=20=20exists.=20Add=20=20Added=20m?= =?UTF-8?q?acros=20for=20bcopy(),=20bcmp()=20and=20strsep().=20Modify=20th?= =?UTF-8?q?e=20clock()=20function=20so=20that=20it=20does=20not=20hang=20w?= =?UTF-8?q?hen=20running=20under=20an=20emulation=20environment=20such=20a?= =?UTF-8?q?s=20NT32.=20Move=20TM=20structure=20specific=20macros=20from=20?= =?UTF-8?q?the=20private=20tzfile.h=20into=20=20Add=20strncasecmp?= =?UTF-8?q?=20function.=20Add=20strptime=20function.=20Add=20gettimeofday?= =?UTF-8?q?=20function.=20Add=20getcwd=20function.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11908 6f19259b-4bc3-4df7-8a09-765794883524 --- StdLib/LibC/Wchar/ConsDecons.c | 27 +++++++++++++++++---------- StdLib/LibC/Wchar/Searching.c | 6 ++++-- StdLib/LibC/Wchar/Wchar.inf | 2 +- 3 files changed, 22 insertions(+), 13 deletions(-) (limited to 'StdLib/LibC/Wchar') diff --git a/StdLib/LibC/Wchar/ConsDecons.c b/StdLib/LibC/Wchar/ConsDecons.c index ab139405fc..534d3e3b08 100644 --- a/StdLib/LibC/Wchar/ConsDecons.c +++ b/StdLib/LibC/Wchar/ConsDecons.c @@ -5,19 +5,17 @@ two wide characters the same way as two integers of the underlying integer type designated by wchar_t. - Copyright (c) 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
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. + http://opensource.org/licenses/bsd-license. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include -#include -#include -#include +#include #include @@ -36,11 +34,17 @@ __wchar_construct( IN EFI_SYSTEM_TABLE *SystemTable ) { + EFI_STATUS Status; + if( __wchar_bitmap == NULL) { __wchar_bitmap_size = (WCHAR_MAX + 8) / 8U; - __wchar_bitmap = AllocatePool(__wchar_bitmap_size); - if( __wchar_bitmap == NULL) { - EFIerrno = RETURN_OUT_OF_RESOURCES; + + Status = SystemTable->BootServices->AllocatePool( + EfiBootServicesData, __wchar_bitmap_size, (VOID **)&__wchar_bitmap); + ASSERT(__wchar_bitmap != NULL); + if (EFI_ERROR (Status)) { + __wchar_bitmap = NULL; + EFIerrno = Status; errno = ENOMEM; return EFIerrno; } @@ -56,9 +60,12 @@ __wchar_deconstruct( IN EFI_SYSTEM_TABLE *SystemTable ) { + EFI_STATUS Status = RETURN_SUCCESS; + if( __wchar_bitmap != NULL) { - FreePool( __wchar_bitmap); + Status = SystemTable->BootServices->FreePool( __wchar_bitmap); + ASSERT_EFI_ERROR (Status); __wchar_bitmap = NULL; } - return RETURN_SUCCESS; + return Status; } diff --git a/StdLib/LibC/Wchar/Searching.c b/StdLib/LibC/Wchar/Searching.c index c345dfe838..12556bd757 100644 --- a/StdLib/LibC/Wchar/Searching.c +++ b/StdLib/LibC/Wchar/Searching.c @@ -5,7 +5,7 @@ two wide characters the same way as two integers of the underlying integer type designated by wchar_t. - Copyright (c) 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
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 @@ -86,12 +86,14 @@ size_t wcscspn(const wchar_t *s1, const wchar_t *s2) const wchar_t *str; UINT8 bit; int index; + size_t s1len; if(*s1 == 0) return 0; + s1len = wcslen(s1); BuildBitmap( __wchar_bitmap, s2, __wchar_bitmap_size); - for(str = s1; ; str++) { + for(str = s1; str < &s1[s1len] ; str++) { index = WHICH8(*str); bit = WHICH_BIT(*str); if ((__wchar_bitmap[index] & bit) != 0) diff --git a/StdLib/LibC/Wchar/Wchar.inf b/StdLib/LibC/Wchar/Wchar.inf index 427d615742..5a88233600 100644 --- a/StdLib/LibC/Wchar/Wchar.inf +++ b/StdLib/LibC/Wchar/Wchar.inf @@ -52,7 +52,7 @@ # DO NOT use them when building your application! # Nasty things could happen if you do. # -# /Oi is required for Microsoft VC++ to allow "intrinsic" functions to be +# /Oi- is required for Microsoft VC++ to allow "intrinsic" functions to be # defined in this library. # [BuildOptions] -- cgit v1.2.3