From 24dcb5e50a4492ae2c4616d04e99794f6c19cfac Mon Sep 17 00:00:00 2001 From: xli24 Date: Wed, 24 Sep 2008 04:17:16 +0000 Subject: [PATCH] Update BaseLib according to code review comments. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5956 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BaseLib/BaseLibInternals.h | 33 +--- MdePkg/Library/BaseLib/CheckSum.c | 42 ++--- .../Library/BaseLib/Ia32DivS64x64Remainder.c | 8 +- MdePkg/Library/BaseLib/LinkedList.c | 10 +- MdePkg/Library/BaseLib/Math64.c | 12 +- MdePkg/Library/BaseLib/String.c | 175 ++++++++++-------- MdePkg/Library/BaseLib/SwitchStack.c | 3 +- 7 files changed, 142 insertions(+), 141 deletions(-) diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h b/MdePkg/Library/BaseLib/BaseLibInternals.h index 984c0cdfc3..9c6044b606 100644 --- a/MdePkg/Library/BaseLib/BaseLibInternals.h +++ b/MdePkg/Library/BaseLib/BaseLibInternals.h @@ -1,7 +1,7 @@ /** @file Declaration of internal functions in BaseLib. - Copyright (c) 2006 - 2007, Intel Corporation
+ Copyright (c) 2006 - 2008, 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 which accompanies this distribution. The full text of the license may be found at @@ -22,19 +22,6 @@ #include #include - -#define QUIENT_MAX_UINTN_DIVIDED_BY_10 ((UINTN) -1 / 10) -#define REMINDER_MAX_UINTN_DIVIDED_BY_10 ((UINTN) -1 % 10) - -#define QUIENT_MAX_UINTN_DIVIDED_BY_16 ((UINTN) -1 / 16) -#define REMINDER_MAX_UINTN_DIVIDED_BY_16 ((UINTN) -1 % 16) - -#define QUIENT_MAX_UINT64_DIVIDED_BY_10 ((UINT64) -1 / 10) -#define REMINDER_MAX_UINT64_DIVIDED_BY_10 ((UINT64) -1 % 10) - -#define QUIENT_MAX_UINT64_DIVIDED_BY_16 ((UINT64) -1 / 16) -#define REMINDER_MAX_UINT64_DIVIDED_BY_16 ((UINT64) -1 % 16) - // // Math functions // @@ -150,7 +137,7 @@ InternalMathRRotU64 ( @param Operand A 64-bit unsigned value. - @return The byte swaped Operand. + @return The byte swapped Operand. **/ UINT64 @@ -209,7 +196,7 @@ InternalMathMultU64x64 ( unsigned value Divisor and generates a 64-bit unsigned quotient. This function returns the 64-bit unsigned quotient. - @param Dividend A 64-bit unsigned value. + @param Dividend A 64-bit unsigned value. @param Divisor A 32-bit unsigned value. @return Dividend / Divisor @@ -295,12 +282,12 @@ InternalMathDivRemU64x64 ( /** Divides a 64-bit signed integer by a 64-bit signed integer and - generates a 64-bit signed result and a optional 64-bit signed remainder. + generates a 64-bit signed result and an optional 64-bit signed remainder. - This function divides the 64-bit unsigned value Dividend by the 64-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder - is not NULL, then the 64-bit unsigned remainder is returned in Remainder. - This function returns the 64-bit unsigned quotient. + This function divides the 64-bit signed value Dividend by the 64-bit + signed value Divisor and generates a 64-bit signed quotient. If Remainder + is not NULL, then the 64-bit signed remainder is returned in Remainder. + This function returns the 64-bit signed quotient. @param Dividend A 64-bit signed value. @param Divisor A 64-bit signed value. @@ -354,7 +341,7 @@ InternalSwitchStack ( /** - Worker function that locates the Node in the List + Worker function that locates the Node in the List. By searching the List, finds the location of the Node in List. At the same time, verifies the validity of this list. @@ -474,7 +461,7 @@ InternalSyncCompareExchange64 ( /** - Worker function that returns a bit field from Operand + Worker function that returns a bit field from Operand. Returns the bitfield specified by the StartBit and the EndBit from Operand. diff --git a/MdePkg/Library/BaseLib/CheckSum.c b/MdePkg/Library/BaseLib/CheckSum.c index 4991923f47..9d031bafa2 100644 --- a/MdePkg/Library/BaseLib/CheckSum.c +++ b/MdePkg/Library/BaseLib/CheckSum.c @@ -2,7 +2,7 @@ Utility functions to generate checksum based on 2's complement algorithm. - Copyright (c) 2007, Intel Corporation
+ Copyright (c) 2007 - 2008, 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 which accompanies this distribution. The full text of the license may be found at @@ -38,8 +38,8 @@ UINT8 EFIAPI CalculateSum8 ( - IN CONST UINT8 *Buffer, - IN UINTN Length + IN CONST UINT8 *Buffer, + IN UINTN Length ) { UINT8 Sum; @@ -71,14 +71,14 @@ CalculateSum8 ( @param Buffer Pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. - @return Checksum The 2's complement checksum of Buffer. + @return Checksum The 2's complement checksum of Buffer. **/ UINT8 EFIAPI CalculateCheckSum8 ( - IN CONST UINT8 *Buffer, - IN UINTN Length + IN CONST UINT8 *Buffer, + IN UINTN Length ) { UINT8 CheckSum; @@ -113,8 +113,8 @@ CalculateCheckSum8 ( UINT16 EFIAPI CalculateSum16 ( - IN CONST UINT16 *Buffer, - IN UINTN Length + IN CONST UINT16 *Buffer, + IN UINTN Length ) { UINT16 Sum; @@ -152,14 +152,14 @@ CalculateSum16 ( @param Buffer Pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. - @return Checksum The 2's complement checksum of Buffer. + @return Checksum The 2's complement checksum of Buffer. **/ UINT16 EFIAPI CalculateCheckSum16 ( - IN CONST UINT16 *Buffer, - IN UINTN Length + IN CONST UINT16 *Buffer, + IN UINTN Length ) { UINT16 CheckSum; @@ -195,8 +195,8 @@ CalculateCheckSum16 ( UINT32 EFIAPI CalculateSum32 ( - IN CONST UINT32 *Buffer, - IN UINTN Length + IN CONST UINT32 *Buffer, + IN UINTN Length ) { UINT32 Sum; @@ -234,14 +234,14 @@ CalculateSum32 ( @param Buffer Pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. - @return Checksum The 2's complement checksum of Buffer. + @return Checksum The 2's complement checksum of Buffer. **/ UINT32 EFIAPI CalculateCheckSum32 ( - IN CONST UINT32 *Buffer, - IN UINTN Length + IN CONST UINT32 *Buffer, + IN UINTN Length ) { UINT32 CheckSum; @@ -277,8 +277,8 @@ CalculateCheckSum32 ( UINT64 EFIAPI CalculateSum64 ( - IN CONST UINT64 *Buffer, - IN UINTN Length + IN CONST UINT64 *Buffer, + IN UINTN Length ) { UINT64 Sum; @@ -316,14 +316,14 @@ CalculateSum64 ( @param Buffer Pointer to the buffer to carry out the checksum operation. @param Length The size, in bytes, of Buffer. - @return Checksum The 2's complement checksum of Buffer. + @return Checksum The 2's complement checksum of Buffer. **/ UINT64 EFIAPI CalculateCheckSum64 ( - IN CONST UINT64 *Buffer, - IN UINTN Length + IN CONST UINT64 *Buffer, + IN UINTN Length ) { UINT64 CheckSum; diff --git a/MdePkg/Library/BaseLib/Ia32DivS64x64Remainder.c b/MdePkg/Library/BaseLib/Ia32DivS64x64Remainder.c index 6d3b5a47a1..c5e894f287 100644 --- a/MdePkg/Library/BaseLib/Ia32DivS64x64Remainder.c +++ b/MdePkg/Library/BaseLib/Ia32DivS64x64Remainder.c @@ -18,10 +18,10 @@ Worker function that Divides a 64-bit signed integer by a 64-bit signed integer and generates a 64-bit signed result and a optional 64-bit signed remainder. - This function divides the 64-bit unsigned value Dividend by the 64-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder - is not NULL, then the 64-bit unsigned remainder is returned in Remainder. - This function returns the 64-bit unsigned quotient. + This function divides the 64-bit signed value Dividend by the 64-bit + signed value Divisor and generates a 64-bit signed quotient. If Remainder + is not NULL, then the 64-bit signed remainder is returned in Remainder. + This function returns the 64-bit signed quotient. @param Dividend A 64-bit signed value. @param Divisor A 64-bit signed value. diff --git a/MdePkg/Library/BaseLib/LinkedList.c b/MdePkg/Library/BaseLib/LinkedList.c index 86bc495cc9..d20c146c11 100644 --- a/MdePkg/Library/BaseLib/LinkedList.c +++ b/MdePkg/Library/BaseLib/LinkedList.c @@ -25,7 +25,7 @@ If List is NULL, then ASSERT(). If List->ForwardLink is NULL, then ASSERT(). - If List->backLink is NULL, then ASSERT(). + If List->BackLink is NULL, then ASSERT(). If Node is NULL, then ASSERT(); If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number of nodes in ListHead, including the ListHead node, is greater than or @@ -384,7 +384,7 @@ IsNodeAtEnd ( @param FirstEntry A pointer to a node in a linked list. @param SecondEntry A pointer to another node in the same linked list. - @return SecondEntry + @return SecondEntry after the nodes are swapped **/ LIST_ENTRY * @@ -411,7 +411,7 @@ SwapListEntries ( Ptr = RemoveEntryList (FirstEntry); // - // If FirstEntry immediately follows SecondEntry, FirstEntry willl be placed + // If FirstEntry immediately follows SecondEntry, FirstEntry will be placed // immediately in front of SecondEntry // if (Ptr->BackLink == SecondEntry) { @@ -452,7 +452,9 @@ SwapListEntries ( @param Entry A pointer to a node in a linked list - @return Entry + @return The node following Entry in the doubly linked list. + If Entry is the only node in the linked list, then + the head node of the linked list is returned. **/ LIST_ENTRY * diff --git a/MdePkg/Library/BaseLib/Math64.c b/MdePkg/Library/BaseLib/Math64.c index 5a932ac8a5..6c5f732033 100644 --- a/MdePkg/Library/BaseLib/Math64.c +++ b/MdePkg/Library/BaseLib/Math64.c @@ -2,7 +2,7 @@ Leaf math worker functions that require 64-bit arithmetic support from the compiler. - Copyright (c) 2006, Intel Corporation
+ Copyright (c) 2006 - 2008, 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 which accompanies this distribution. The full text of the license may be found at @@ -343,12 +343,12 @@ InternalMathDivRemU64x64 ( /** Divides a 64-bit signed integer by a 64-bit signed integer and - generates a 64-bit signed result and a optional 64-bit signed remainder. + generates a 64-bit signed result and a optional 64-bit signed remainder. - This function divides the 64-bit unsigned value Dividend by the 64-bit - unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder - is not NULL, then the 64-bit unsigned remainder is returned in Remainder. - This function returns the 64-bit unsigned quotient. + This function divides the 64-bit signed value Dividend by the 64-bit + signed value Divisor and generates a 64-bit signed quotient. If Remainder + is not NULL, then the 64-bit signed remainder is returned in Remainder. + This function returns the 64-bit signed quotient. @param Dividend A 64-bit signed value. @param Divisor A 64-bit signed value. diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c index 872642e958..d292c5852a 100644 --- a/MdePkg/Library/BaseLib/String.c +++ b/MdePkg/Library/BaseLib/String.c @@ -1,7 +1,7 @@ /** @file Unicode and ASCII string primatives. - Copyright (c) 2006 - 2007, Intel Corporation
+ Copyright (c) 2006 - 2008, 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 which accompanies this distribution. The full text of the license may be found at @@ -17,6 +17,18 @@ #include "BaseLibInternals.h" +#define QUOTIENT_MAX_UINTN_DIVIDED_BY_10 ((UINTN) -1 / 10) +#define REMAINDER_MAX_UINTN_DIVIDED_BY_10 ((UINTN) -1 % 10) + +#define QUOTIENT_MAX_UINTN_DIVIDED_BY_16 ((UINTN) -1 / 16) +#define REMAINDER_MAX_UINTN_DIVIDED_BY_16 ((UINTN) -1 % 16) + +#define QUOTIENT_MAX_UINT64_DIVIDED_BY_10 ((UINT64) -1 / 10) +#define REMAINDER_MAX_UINT64_DIVIDED_BY_10 ((UINT64) -1 % 10) + +#define QUOTIENT_MAX_UINT64_DIVIDED_BY_16 ((UINT64) -1 / 16) +#define REMAINDER_MAX_UINT64_DIVIDED_BY_16 ((UINT64) -1 % 16) + /** Copies one Null-terminated Unicode string to another Null-terminated Unicode string and returns the new Unicode string. @@ -37,7 +49,7 @@ @param Destination Pointer to a Null-terminated Unicode string. @param Source Pointer to a Null-terminated Unicode string. - @return Destiantion + @return Destination pointing to the copied string. **/ CHAR16 * @@ -53,7 +65,7 @@ StrCpy ( // Destination cannot be NULL // ASSERT (Destination != NULL); - ASSERT (((UINTN) Destination & 0x01) == 0); + ASSERT (((UINTN) Destination & BIT0) == 0); // // Destination and source cannot overlap @@ -95,7 +107,7 @@ StrCpy ( @param Source Pointer to a Null-terminated Unicode string. @param Length Maximum number of Unicode characters to copy. - @return Destination + @return Destination pointing to the copied string. **/ CHAR16 * @@ -116,11 +128,10 @@ StrnCpy ( // Destination cannot be NULL if Length is not zero // ASSERT (Destination != NULL); - ASSERT (((UINTN) Destination & 0x01) == 0); + ASSERT (((UINTN) Destination & BIT0) == 0); // // Destination and source cannot overlap - // Q: Does Source have to be NULL-terminated? // ASSERT ((UINTN)(Destination - Source) > StrLen (Source)); ASSERT ((UINTN)(Source - Destination) >= Length); @@ -162,7 +173,7 @@ StrLen ( UINTN Length; ASSERT (String != NULL); - ASSERT (((UINTN) String & 0x01) == 0); + ASSERT (((UINTN) String & BIT0) == 0); for (Length = 0; *String != L'\0'; String++, Length++) { // @@ -228,7 +239,8 @@ StrSize ( @param SecondString Pointer to a Null-terminated Unicode string. @retval 0 FirstString is identical to SecondString. - @return others FirstString is not identical to SecondString. + @return The first mismatched Unicode character in SecondString subtracted + from the first mismatched Unicode character in FirstString. **/ INTN @@ -278,7 +290,8 @@ StrCmp ( @param Length Maximum number of Unicode characters to compare. @retval 0 FirstString is identical to SecondString. - @return others FirstString is not identical to SecondString. + @return The value returned is the first mismatched Unicode character in SecondString + subtracted from the first mismatched Unicode character in FirstString. **/ INTN @@ -338,7 +351,7 @@ StrnCmp ( @param Destination Pointer to a Null-terminated Unicode string. @param Source Pointer to a Null-terminated Unicode string. - @return Destination + @return Destination pointing to the concatenated Unicode string. **/ CHAR16 * @@ -392,7 +405,7 @@ StrCat ( @param Length Maximum number of Unicode characters to concatenate from Source. - @return Destination + @return Destination pointing to the concatenated Unicode string. **/ CHAR16 * @@ -432,11 +445,11 @@ StrnCat ( or String contains more than PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT(). - @param String Pointer to a Null-terminated Unicode string. + @param String Pointer to a Null-terminated Unicode string. @param SearchString Pointer to a Null-terminated Unicode string to search for. - @retval NULL If the SearchString does not appear in String. - @return others If there is a match. + @retval NULL If the SearchString does not appear in String. + @return Pointer to the matching sub-string. **/ CHAR16 * @@ -495,7 +508,7 @@ StrStr ( @param Char The character to check against. @retval TRUE If the Char is a decmial character. - @retval FALSE Otherwise. + @retval FALSE If the Char is not a decmial character. **/ BOOLEAN @@ -512,7 +525,7 @@ InternalIsDecimalDigitCharacter ( it maps to a valid small-case ASCII character. This internal function only deal with Unicode character - which maps to a valid small-case ASII character, i.e. + which maps to a valid small-case ASCII character, i.e. L'a' to L'z'. For other Unicode character, the input character is returned directly. @@ -546,7 +559,7 @@ InternalCharToUpper ( @param Char The character to convert. - @retval UINTN The numerical value converted. + @return The numerical value converted. **/ UINTN @@ -573,7 +586,7 @@ InternalHexCharToUintn ( @param Char The character to check against. @retval TRUE If the Char is a hexadecmial character. - @retval FALSE Otherwise. + @retval FALSE If the Char is not a hexadecmial character. **/ BOOLEAN @@ -619,7 +632,7 @@ InternalIsHexaDecimalDigitCharacter ( @param String Pointer to a Null-terminated Unicode string. - @retval UINTN + @return The value of type UINTN converted. **/ UINTN @@ -657,9 +670,9 @@ StrDecimalToUintn ( // If the number represented by String overflows according // to the range defined by UINTN, then ASSERT(). // - ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_10) || - ((QUIENT_MAX_UINTN_DIVIDED_BY_10 == Result) && - (*String - L'0') <= REMINDER_MAX_UINTN_DIVIDED_BY_10) + ASSERT ((Result < QUOTIENT_MAX_UINTN_DIVIDED_BY_10) || + ((QUOTIENT_MAX_UINTN_DIVIDED_BY_10 == Result) && + (*String - L'0') <= REMAINDER_MAX_UINTN_DIVIDED_BY_10) ); Result = Result * 10 + (*String - L'0'); @@ -701,7 +714,7 @@ StrDecimalToUintn ( @param String Pointer to a Null-terminated Unicode string. - @retval UINT64 + @return The value of type UINT64 converted. **/ UINT64 @@ -739,9 +752,9 @@ StrDecimalToUint64 ( // If the number represented by String overflows according // to the range defined by UINTN, then ASSERT(). // - ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_10) || - ((QUIENT_MAX_UINT64_DIVIDED_BY_10 == Result) && - (*String - L'0') <= REMINDER_MAX_UINT64_DIVIDED_BY_10) + ASSERT ((Result < QUOTIENT_MAX_UINT64_DIVIDED_BY_10) || + ((QUOTIENT_MAX_UINT64_DIVIDED_BY_10 == Result) && + (*String - L'0') <= REMAINDER_MAX_UINT64_DIVIDED_BY_10) ); Result = MultU64x32 (Result, 10) + (*String - L'0'); @@ -783,7 +796,7 @@ StrDecimalToUint64 ( @param String Pointer to a Null-terminated Unicode string. - @retval UINTN + @return The value of type UINTN converted. **/ UINTN @@ -832,9 +845,9 @@ StrHexToUintn ( // If the Hex Number represented by String overflows according // to the range defined by UINTN, then ASSERT(). // - ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_16) || - ((QUIENT_MAX_UINTN_DIVIDED_BY_16 == Result) && - (InternalHexCharToUintn (*String) <= REMINDER_MAX_UINTN_DIVIDED_BY_16)) + ASSERT ((Result < QUOTIENT_MAX_UINTN_DIVIDED_BY_16) || + ((QUOTIENT_MAX_UINTN_DIVIDED_BY_16 == Result) && + (InternalHexCharToUintn (*String) <= REMAINDER_MAX_UINTN_DIVIDED_BY_16)) ); Result = (Result << 4) + InternalHexCharToUintn (*String); @@ -877,7 +890,7 @@ StrHexToUintn ( @param String Pointer to a Null-terminated Unicode string. - @retval UINT64 + @return The value of type UINT64 converted. **/ UINT64 @@ -926,9 +939,9 @@ StrHexToUint64 ( // If the Hex Number represented by String overflows according // to the range defined by UINTN, then ASSERT(). // - ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_16)|| - ((QUIENT_MAX_UINT64_DIVIDED_BY_16 == Result) && - (InternalHexCharToUintn (*String) <= REMINDER_MAX_UINT64_DIVIDED_BY_16)) + ASSERT ((Result < QUOTIENT_MAX_UINT64_DIVIDED_BY_16)|| + ((QUOTIENT_MAX_UINT64_DIVIDED_BY_16 == Result) && + (InternalHexCharToUintn (*String) <= REMAINDER_MAX_UINT64_DIVIDED_BY_16)) ); Result = LShiftU64 (Result, 4); @@ -949,7 +962,7 @@ StrHexToUint64 ( @param Char The character to check against. @retval TRUE If the Char is a decmial character. - @retval FALSE Otherwise. + @retval FALSE If the Char is not a decmial character. **/ BOOLEAN @@ -972,7 +985,7 @@ InternalAsciiIsDecimalDigitCharacter ( @param Char The character to check against. @retval TRUE If the Char is a hexadecmial character. - @retval FALSE Otherwise. + @retval FALSE If the Char is not a hexadecmial character. **/ BOOLEAN @@ -1017,7 +1030,7 @@ InternalAsciiIsHexaDecimalDigitCharacter ( @param Source Pointer to a Null-terminated Unicode string. @param Destination Pointer to a Null-terminated ASCII string. - @return Destination + @return Destination pointing to the converted ASCII string. **/ CHAR8 * @@ -1084,7 +1097,7 @@ UnicodeStrToAsciiStr ( @param Destination Pointer to a Null-terminated ASCII string. @param Source Pointer to a Null-terminated ASCII string. - @return Destination + @return Destination pointing to the copied string. **/ CHAR8 * @@ -1138,7 +1151,7 @@ AsciiStrCpy ( @param Source Pointer to a Null-terminated ASCII string. @param Length Maximum number of ASCII characters to copy. - @return Destination + @return Destination pointing to the copied string. **/ CHAR8 * @@ -1264,7 +1277,8 @@ AsciiStrSize ( @param SecondString Pointer to a Null-terminated ASCII string. @retval 0 FirstString is identical to SecondString. - @return others FirstString is not identical to SecondString. + @return The first mismatched ASCII character in SecondString subtracted + from the first mismatched ASCII character in FirstString. **/ INTN @@ -1289,7 +1303,7 @@ AsciiStrCmp ( } /** - Converts a lowercase Ascii character to upper one + Converts a lowercase Ascii character to upper one. If Chr is lowercase Ascii character, then converts it to upper one. @@ -1320,7 +1334,7 @@ AsciiToUpper ( @param Char The character to convert. - @retval UINTN The numerical value converted. + @return The numerical value converted. **/ UINTN @@ -1362,8 +1376,8 @@ InternalAsciiHexCharToUintn ( @retval 0 FirstString is identical to SecondString using case insensitive comparisons. - @return others FirstString is not identical to SecondString using case - insensitive comparisons. + @return The first mismatched lower case ASCII character in SecondString subtracted + from the first mismatched lower case ASCII character in FirstString. **/ INTN @@ -1419,7 +1433,8 @@ AsciiStriCmp ( @param Length Maximum number of ASCII characters to compare. @retval 0 FirstString is identical to SecondString. - @return others FirstString is not identical to SecondString. + @return The first mismatched ASCII character in SecondString subtracted from the + first mismatched ASCII character in FirstString. **/ INTN @@ -1474,7 +1489,7 @@ AsciiStrnCmp ( @param Destination Pointer to a Null-terminated ASCII string. @param Source Pointer to a Null-terminated ASCII string. - @return Destination + @return Destination pointing to the concatenated ASCII string. **/ CHAR8 * @@ -1525,7 +1540,7 @@ AsciiStrCat ( @param Length Maximum number of ASCII characters to concatenate from Source. - @return Destination + @return Destination pointing to the concatenated ASCII string. **/ CHAR8 * @@ -1566,7 +1581,7 @@ AsciiStrnCat ( @param SearchString Pointer to a Null-terminated ASCII string to search for. @retval NULL If the SearchString does not appear in String. - @return others If there is a match. + @return Pointer to the matching sub-string. **/ CHAR8 * @@ -1641,7 +1656,7 @@ AsciiStrStr ( @param String Pointer to a Null-terminated ASCII string. - @retval UINTN + @return The value of type UINTN converted. **/ UINTN @@ -1678,9 +1693,9 @@ AsciiStrDecimalToUintn ( // If the number represented by String overflows according // to the range defined by UINTN, then ASSERT(). // - ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_10) || - ((QUIENT_MAX_UINTN_DIVIDED_BY_10 == Result) && - (*String - '0') <= REMINDER_MAX_UINTN_DIVIDED_BY_10) + ASSERT ((Result < QUOTIENT_MAX_UINTN_DIVIDED_BY_10) || + ((QUOTIENT_MAX_UINTN_DIVIDED_BY_10 == Result) && + (*String - '0') <= REMAINDER_MAX_UINTN_DIVIDED_BY_10) ); Result = Result * 10 + (*String - '0'); @@ -1718,7 +1733,7 @@ AsciiStrDecimalToUintn ( @param String Pointer to a Null-terminated ASCII string. - @retval UINT64 + @return The value of type UINT64 converted. **/ UINT64 @@ -1755,9 +1770,9 @@ AsciiStrDecimalToUint64 ( // If the number represented by String overflows according // to the range defined by UINTN, then ASSERT(). // - ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_10) || - ((QUIENT_MAX_UINT64_DIVIDED_BY_10 == Result) && - (*String - '0') <= REMINDER_MAX_UINT64_DIVIDED_BY_10) + ASSERT ((Result < QUOTIENT_MAX_UINT64_DIVIDED_BY_10) || + ((QUOTIENT_MAX_UINT64_DIVIDED_BY_10 == Result) && + (*String - '0') <= REMAINDER_MAX_UINT64_DIVIDED_BY_10) ); Result = MultU64x32 (Result, 10) + (*String - '0'); @@ -1798,7 +1813,7 @@ AsciiStrDecimalToUint64 ( @param String Pointer to a Null-terminated ASCII string. - @retval UINTN + @return The value of type UINTN converted. **/ UINTN @@ -1846,9 +1861,9 @@ AsciiStrHexToUintn ( // If the Hex Number represented by String overflows according // to the range defined by UINTN, then ASSERT(). // - ASSERT ((Result < QUIENT_MAX_UINTN_DIVIDED_BY_16) || - ((QUIENT_MAX_UINTN_DIVIDED_BY_16 == Result) && - (InternalAsciiHexCharToUintn (*String) <= REMINDER_MAX_UINTN_DIVIDED_BY_16)) + ASSERT ((Result < QUOTIENT_MAX_UINTN_DIVIDED_BY_16) || + ((QUOTIENT_MAX_UINTN_DIVIDED_BY_16 == Result) && + (InternalAsciiHexCharToUintn (*String) <= REMAINDER_MAX_UINTN_DIVIDED_BY_16)) ); Result = (Result << 4) + InternalAsciiHexCharToUintn (*String); @@ -1890,7 +1905,7 @@ AsciiStrHexToUintn ( @param String Pointer to a Null-terminated ASCII string. - @retval UINT64 + @return The value of type UINT64 converted. **/ UINT64 @@ -1941,9 +1956,9 @@ AsciiStrHexToUint64 ( // If the Hex Number represented by String overflows according // to the range defined by UINTN, then ASSERT(). // - ASSERT ((Result < QUIENT_MAX_UINT64_DIVIDED_BY_16) || - ((QUIENT_MAX_UINT64_DIVIDED_BY_16 == Result) && - (InternalAsciiHexCharToUintn (*String) <= REMINDER_MAX_UINT64_DIVIDED_BY_16)) + ASSERT ((Result < QUOTIENT_MAX_UINT64_DIVIDED_BY_16) || + ((QUOTIENT_MAX_UINT64_DIVIDED_BY_16 == Result) && + (InternalAsciiHexCharToUintn (*String) <= REMAINDER_MAX_UINT64_DIVIDED_BY_16)) ); Result = LShiftU64 (Result, 4); @@ -1979,7 +1994,7 @@ AsciiStrHexToUint64 ( @param Source Pointer to a Null-terminated ASCII string. @param Destination Pointer to a Null-terminated Unicode string. - @return Destination + @return Destination pointing to the converted Unicode string. **/ CHAR16 * @@ -2032,7 +2047,7 @@ AsciiStrToUnicodeStr ( @param Value The 8-bit value to convert to BCD. Range 0..99. - @return The BCD value + @return The BCD value converted. **/ UINT8 @@ -2056,7 +2071,7 @@ DecimalToBcd8 ( @param Value The 8-bit BCD value to convert to an 8-bit value. - @return The 8-bit value is returned. + @return The 8-bit decimal value converted. **/ UINT8 @@ -2082,7 +2097,7 @@ BcdToDecimal8 ( @param Nibble The nibble which is in the low 4 bits of the input byte. - @retval CHAR16 The Unicode hexadecimal character. + @return The Unicode hexadecimal character. **/ CHAR16 @@ -2113,18 +2128,17 @@ NibbleToHexChar ( the input buffer for a 64-bits unsigned integrer 0x12345678abcdef1234 will be converted to a Unicode string equal to L"12345678abcdef1234". - @param String On input, String is pointed to the buffer allocated for the convertion. - @param StringLen The Length of String buffer to hold the output String. The length must include the tailing '\0' character. - The StringLen required to convert a N bytes Buffer will be a least equal to or greater - than 2*N + 1. - @param Buffer The pointer to a input buffer. - @param BufferSizeInBytes Lenth in bytes of the input buffer. + @param String Pointer to the buffer allocated for the convertion. + @param StringLen On input: Pointer to length in bytes of buffer to hold the Unicode string. + On output:If return EFI_SUCCESS, pointer to length of Unicode string converted. + If return EFI_BUFFER_TOO_SMALL, pointer to length of string buffer desired. + @param Buffer The pointer to a input buffer. + @param BufferSizeInBytes Lenth in bytes of the input buffer. - - @retval EFI_SUCCESS The convertion is successfull. All bytes in Buffer has been convert to the corresponding - Unicode character and placed into the right place in String. - @retval EFI_BUFFER_TOO_SMALL StringSizeInBytes is smaller than 2 * N + 1the number of bytes required to - complete the convertion. + @retval EFI_SUCCESS The convertion is successfull. All bytes in Buffer has been convert to the corresponding + Unicode character and placed into the right place in String. + @retval EFI_BUFFER_TOO_SMALL StringSizeInBytes is smaller than 2 * N + 1the number of bytes required to + complete the convertion. **/ RETURN_STATUS EFIAPI @@ -2275,10 +2289,9 @@ HexStringToBuf ( Unicode character is converted to a byte. For example, Unicode character L'A' will be converted to 0x0A. - If Digit is NULL, then ASSERT. + If Digit is NULL, then ASSERT(). @param Digit The output hexadecimal digit. - @param Char The input Unicode character. @retval TRUE Char is in the range of Hexadecimal number. Digit is updated diff --git a/MdePkg/Library/BaseLib/SwitchStack.c b/MdePkg/Library/BaseLib/SwitchStack.c index ab71856773..b2a4af683b 100644 --- a/MdePkg/Library/BaseLib/SwitchStack.c +++ b/MdePkg/Library/BaseLib/SwitchStack.c @@ -1,7 +1,7 @@ /** @file Switch Stack functions. - Copyright (c) 2006 - 2007, Intel Corporation
+ Copyright (c) 2006 - 2008, 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 which accompanies this distribution. The full text of the license may be found at @@ -39,7 +39,6 @@ function. @param NewStack A pointer to the new stack to use for the EntryPoint function. - @param ... Extended parameters. **/ VOID -- 2.39.2