diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-12-01 02:32:12 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-12-01 02:32:12 +0000 |
commit | ac7e320cb8326befd240020db709151884c889bc (patch) | |
tree | 0244f130be9838647093dbabad4ee7d0d7b5348a /MdeModulePkg/Universal/Network | |
parent | 48bd50c5a1e4c31818bba1d2ce88f9270b2f2440 (diff) | |
download | edk2-ac7e320cb8326befd240020db709151884c889bc.zip edk2-ac7e320cb8326befd240020db709151884c889bc.tar.gz edk2-ac7e320cb8326befd240020db709151884c889bc.tar.bz2 |
Remove NibbleToHexChar() function from BaseLib
Move IsHexDigit, BufToHexString, HexStringToBuf from BaseLib to MdeModulePkg IfrSupportLib. The reason is:
1) IsHexDigit function provides the logic to check Hex Digit and convert it to Decimal value, which is required by IScsi LUN and HII user input. But this logic is not provided by any functions in MdeLib. So, it can't be deleted. It is moved to IfrSupportLib.
2) BufToHexString function converts a array of buffers to hex string. If the buffer length is less than sizeof (UINT64), it can be directly replaced by UnicodeValueToString(). But HII modules may use BufToHexString to convert the buffers whose length > sizeof (UINT64). For example:
.\MdeModulePkg\Universal\HiiDatabaseDxe\ConfigRouting.c line 201, 1148
.\Universal\SetupBrowserDxe\Setup.c line line 1457, 1503
Like this case, it is not easy to use UnicodeValueToString to replace BufToHexString. So, BufToHexString is still kept. Because such usages are in HII modules, this function is moved to IfrSupportLib.
3) HexStringToBuf is moved to IfrSupportLib. The reason is similar to BufToHexString.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6782 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network')
-rw-r--r-- | MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c index 53de070..7cbf362 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c @@ -22,7 +22,7 @@ Abstract: #include "IScsiImpl.h"
-CONST CHAR8 IScsiHexString[] = "0123456789ABCDEFabcdef";
+GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 IScsiHexString[] = "0123456789ABCDEFabcdef";
/**
Removes (trims) specified leading and trailing characters from a string.
@@ -216,9 +216,9 @@ IScsiLunToUnicodeStr ( StrCpy (TempStr, L"0-");
} else {
TempStr[0] = (CHAR16) IScsiHexString[Lun[2 * Index] >> 4];
- TempStr[1] = (CHAR16) IScsiHexString[Lun[2 * Index] & 0xf];
+ TempStr[1] = (CHAR16) IScsiHexString[Lun[2 * Index] & 0x0F];
TempStr[2] = (CHAR16) IScsiHexString[Lun[2 * Index + 1] >> 4];
- TempStr[3] = (CHAR16) IScsiHexString[Lun[2 * Index + 1] & 0xf];
+ TempStr[3] = (CHAR16) IScsiHexString[Lun[2 * Index + 1] & 0x0F];
TempStr[4] = L'-';
TempStr[5] = 0;
@@ -388,8 +388,8 @@ IScsiMacAddrToStr ( UINT32 Index;
for (Index = 0; Index < Len; Index++) {
- Str[3 * Index] = NibbleToHexChar ((UINT8) (Mac->Addr[Index] >> 4));
- Str[3 * Index + 1] = NibbleToHexChar (Mac->Addr[Index]);
+ Str[3 * Index] = (CHAR16) IScsiHexString[(Mac->Addr[Index] >> 4) & 0x0F];
+ Str[3 * Index + 1] = (CHAR16) IScsiHexString[Mac->Addr[Index] & 0x0F];
Str[3 * Index + 2] = L'-';
}
@@ -441,7 +441,7 @@ IScsiBinToHex ( for (Index = 0; Index < BinLength; Index++) {
HexStr[Index * 2 + 2] = IScsiHexString[BinBuffer[Index] >> 4];
- HexStr[Index * 2 + 3] = IScsiHexString[BinBuffer[Index] & 0xf];
+ HexStr[Index * 2 + 3] = IScsiHexString[BinBuffer[Index] & 0x0F];
}
HexStr[Index * 2 + 2] = '\0';
|