Replace CopyMem() which can be replaced by BaseLib's Read/WriteUnalianedXX() as these are applied to base data type such as UINT32.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7175 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2009-01-04 06:01:35 +00:00
parent 8a38e4510e
commit 3a306c1006
2 changed files with 7 additions and 7 deletions

View File

@ -117,7 +117,7 @@ IfrLibExtractClassFromHiiHandle (
// //
Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER); Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
Offset2 = 0; Offset2 = 0;
CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32)); PackageListLength = ReadUnaligned32 (&HiiPackageList->PackageLength);
while (Offset < PackageListLength) { while (Offset < PackageListLength) {
Package = ((UINT8 *) HiiPackageList) + Offset; Package = ((UINT8 *) HiiPackageList) + Offset;

View File

@ -56,7 +56,7 @@ GetPackageDataFromPackageList (
Package = NULL; Package = NULL;
Index = 0; Index = 0;
Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER); Offset = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
CopyMem (&PackageListLength, &HiiPackageList->PackageLength, sizeof (UINT32)); PackageListLength = ReadUnaligned32 (&HiiPackageList->PackageLength);
while (Offset < PackageListLength) { while (Offset < PackageListLength) {
Package = (EFI_HII_PACKAGE_HEADER *) (((UINT8 *) HiiPackageList) + Offset); Package = (EFI_HII_PACKAGE_HEADER *) (((UINT8 *) HiiPackageList) + Offset);
CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER)); CopyMem (&PackageHeader, Package, sizeof (EFI_HII_PACKAGE_HEADER));
@ -178,7 +178,7 @@ UpdateFormPackageData (
} }
ExtendOpCode = ((EFI_IFR_GUID_LABEL *) IfrOpHdr)->ExtendOpCode; ExtendOpCode = ((EFI_IFR_GUID_LABEL *) IfrOpHdr)->ExtendOpCode;
CopyMem (&LabelNumber, &((EFI_IFR_GUID_LABEL *)IfrOpHdr)->Number, sizeof (UINT16)); LabelNumber = ReadUnaligned16 (&((EFI_IFR_GUID_LABEL *)IfrOpHdr)->Number);
if ((ExtendOpCode != EFI_IFR_EXTEND_OP_LABEL) || (LabelNumber != Label) if ((ExtendOpCode != EFI_IFR_EXTEND_OP_LABEL) || (LabelNumber != Label)
|| !CompareGuid ((EFI_GUID *)(UINTN)(&((EFI_IFR_GUID_LABEL *)IfrOpHdr)->Guid), &mIfrVendorGuid)) { || !CompareGuid ((EFI_GUID *)(UINTN)(&((EFI_IFR_GUID_LABEL *)IfrOpHdr)->Guid), &mIfrVendorGuid)) {
// //
@ -436,7 +436,7 @@ IfrLibUpdateForm (
// Update package list length // Update package list length
// //
BufferSize = UpdateBufferPos - (UINT8 *) UpdateBuffer; BufferSize = UpdateBufferPos - (UINT8 *) UpdateBuffer;
CopyMem (&UpdateBuffer->PackageLength, &BufferSize, sizeof (UINT32)); WriteUnaligned32 (&UpdateBuffer->PackageLength, (UINT32)BufferSize);
FreePool (HiiPackageList); FreePool (HiiPackageList);
@ -493,13 +493,13 @@ IfrLibExtractDefault(
VA_START (Args, Number); VA_START (Args, Number);
for (Index = 0; Index < Number; Index++) { for (Index = 0; Index < Number; Index++) {
BufCfgArray = (UINT8 *) VA_ARG (Args, VOID *); BufCfgArray = (UINT8 *) VA_ARG (Args, VOID *);
CopyMem (&TotalLen, BufCfgArray, sizeof (UINT32)); TotalLen = ReadUnaligned32 ((UINT32 *)BufCfgArray);
BufferPos = BufCfgArray + sizeof (UINT32); BufferPos = BufCfgArray + sizeof (UINT32);
while ((UINT32)(BufferPos - BufCfgArray) < TotalLen) { while ((UINT32)(BufferPos - BufCfgArray) < TotalLen) {
CopyMem (&Offset, BufferPos, sizeof (UINT16)); Offset = ReadUnaligned16 ((UINT16 *)BufferPos);
BufferPos += sizeof (UINT16); BufferPos += sizeof (UINT16);
CopyMem (&Width, BufferPos, sizeof (UINT16)); Width = ReadUnaligned16 ((UINT16 *)BufferPos);
BufferPos += sizeof (UINT16); BufferPos += sizeof (UINT16);
Value = BufferPos; Value = BufferPos;
BufferPos += Width; BufferPos += Width;