Use local version EfiScriptLibAsciiStrLen() and EfiScriptLibStrLen() function to get string length so that this library doesn't depend on other EDK libraries and it can be linked together with EdkIIGlueLib.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10711 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2010-07-29 05:38:39 +00:00
parent a4902cccdf
commit 2a0879aa03
1 changed files with 51 additions and 3 deletions

View File

@ -1,6 +1,6 @@
/*++ /*++
Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -23,6 +23,54 @@ Abstract:
EFI_BOOT_SCRIPT_SAVE_PROTOCOL *mBootScriptSave; EFI_BOOT_SCRIPT_SAVE_PROTOCOL *mBootScriptSave;
UINTN
EfiScriptLibAsciiStrLen (
IN CHAR8 *String
)
/*++
Routine Description:
Return the number of Ascii characters in String. This is not the same as
the length of the string in bytes.
Arguments:
String - String to process
Returns:
Number of Ascii characters in String
--*/
{
UINTN Length;
for (Length=0; *String; String++, Length++);
return Length;
}
UINTN
EfiScriptLibStrLen (
IN CHAR16 *String
)
/*++
Routine Description:
Return the number of Unicode characters in String. This is not the same as
the length of the string in bytes.
Arguments:
String - String to process
Returns:
Number of Unicode characters in String
--*/
{
UINTN Length;
for (Length=0; *String; String++, Length++);
return Length;
}
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
BootScriptSaveInitialize ( BootScriptSaveInitialize (
@ -622,7 +670,7 @@ Returns:
{ {
return BootScriptSaveInformation ( return BootScriptSaveInformation (
TableName, TableName,
(UINT32) EfiStrLen (String) * 2 + 2, (UINT32) EfiScriptLibStrLen (String) * 2 + 2,
(EFI_PHYSICAL_ADDRESS) (UINTN) String (EFI_PHYSICAL_ADDRESS) (UINTN) String
); );
} }
@ -655,7 +703,7 @@ Returns:
{ {
return BootScriptSaveInformation ( return BootScriptSaveInformation (
TableName, TableName,
(UINT32) EfiAsciiStrLen (String) + 1, (UINT32) EfiScriptLibAsciiStrLen (String) + 1,
(EFI_PHYSICAL_ADDRESS) (UINTN) String (EFI_PHYSICAL_ADDRESS) (UINTN) String
); );
} }