From a00ec39b52224a40bf9a0a813b69cb43e14407a8 Mon Sep 17 00:00:00 2001 From: mdkinney Date: Sat, 20 Jun 2009 17:05:16 +0000 Subject: [PATCH] Fix ICC compatibility issues git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8616 6f19259b-4bc3-4df7-8a09-765794883524 --- .../DxeNt32PeCoffExtraActionLib.c | 4 +- Nt32Pkg/ResetRuntimeDxe/reset.c | 4 +- Nt32Pkg/SnpNt32Dxe/SnpNt32.c | 4 +- Nt32Pkg/SnpNt32Dxe/SnpNt32.h | 8 +- Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c | 4 +- Nt32Pkg/WinNtGopDxe/WinNtGopScreen.c | 24 ++--- Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c | 12 +-- .../WinNtSimpleFileSystem.c | 95 ++++++++++--------- 8 files changed, 80 insertions(+), 75 deletions(-) diff --git a/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c b/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c index 23c19017df..0991fc6b96 100644 --- a/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c +++ b/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c @@ -159,6 +159,7 @@ AddModHandle ( PDB_NAME_TO_MOD_HANDLE *Array; UINTN PreviousSize; PDB_NAME_TO_MOD_HANDLE *TempArray; + HANDLE Handle; Array = mPdbNameModHandleArray; for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) { @@ -166,7 +167,8 @@ AddModHandle ( // // Make a copy of the stirng and store the ModHandle // - Array->PdbPointer = mWinNt->HeapAlloc ( mWinNt->GetProcessHeap (), + Handle = mWinNt->GetProcessHeap (); + Array->PdbPointer = mWinNt->HeapAlloc ( Handle, HEAP_ZERO_MEMORY, AsciiStrLen (ImageContext->PdbPointer) + 1 ); diff --git a/Nt32Pkg/ResetRuntimeDxe/reset.c b/Nt32Pkg/ResetRuntimeDxe/reset.c index 21e44fb33f..e498a3415d 100644 --- a/Nt32Pkg/ResetRuntimeDxe/reset.c +++ b/Nt32Pkg/ResetRuntimeDxe/reset.c @@ -41,7 +41,7 @@ WinNtResetSystem ( IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINTN DataSize, - IN CHAR16 *ResetData OPTIONAL + IN VOID *ResetData OPTIONAL ); @@ -90,7 +90,7 @@ WinNtResetSystem ( IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINTN DataSize, - IN CHAR16 *ResetData OPTIONAL + IN VOID *ResetData OPTIONAL ) /*++ diff --git a/Nt32Pkg/SnpNt32Dxe/SnpNt32.c b/Nt32Pkg/SnpNt32Dxe/SnpNt32.c index 29cee4f915..be9eb78fb5 100644 --- a/Nt32Pkg/SnpNt32Dxe/SnpNt32.c +++ b/Nt32Pkg/SnpNt32Dxe/SnpNt32.c @@ -42,7 +42,7 @@ SNPNT32_GLOBAL_DATA gSnpNt32GlobalData = { { 0, 0, - 0 + EfiLockUninitialized }, // Lock // // Private functions @@ -1083,7 +1083,7 @@ SnpNt32InitializeGlobalData ( // // Get the WinNT thunk // - Status = gBS->LocateProtocol (&gEfiWinNtThunkProtocolGuid, NULL, &This->WinNtThunk); + Status = gBS->LocateProtocol (&gEfiWinNtThunkProtocolGuid, NULL, (VOID **)&This->WinNtThunk); if (EFI_ERROR (Status)) { return Status; diff --git a/Nt32Pkg/SnpNt32Dxe/SnpNt32.h b/Nt32Pkg/SnpNt32Dxe/SnpNt32.h index d0e04ce404..8b84ef9d95 100644 --- a/Nt32Pkg/SnpNt32Dxe/SnpNt32.h +++ b/Nt32Pkg/SnpNt32Dxe/SnpNt32.h @@ -139,7 +139,7 @@ EFI_STATUS // #define SNP_NT32_DRIVER_SIGNATURE SIGNATURE_32 ('W', 'S', 'N', 'P') -typedef struct _SNPNT32_GLOBAL_DATA { +struct _SNPNT32_GLOBAL_DATA { UINT32 Signature; // @@ -160,14 +160,14 @@ typedef struct _SNPNT32_GLOBAL_DATA { SNPNT32_INITIALIZE_GLOBAL_DATA InitializeGlobalData; SNPNT32_INITIALIZE_INSTANCE_DATA InitializeInstanceData; SNPNT32_CLOSE_INSTANCE CloseInstance; -} SNPNT32_GLOBAL_DATA; +}; // // Instance data for each fake SNP instance // #define SNP_NT32_INSTANCE_SIGNATURE SIGNATURE_32 ('w', 'S', 'N', 'P') -typedef struct _SNPNT32_INSTANCE_DATA { +struct _SNPNT32_INSTANCE_DATA { UINT32 Signature; // @@ -188,7 +188,7 @@ typedef struct _SNPNT32_INSTANCE_DATA { // // Private functions // -} SNPNT32_INSTANCE_DATA; +}; #define SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS(a) \ CR ( \ diff --git a/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c b/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c index f020d6baed..291f7a08e2 100644 --- a/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c +++ b/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c @@ -1089,7 +1089,6 @@ This function extends the capability of SetFilePointer to accept 64 bit paramete { EFI_STATUS Status; LARGE_INTEGER LargeInt; - UINT32 ErrorCode; LargeInt.QuadPart = DistanceToMove; Status = EFI_SUCCESS; @@ -1101,8 +1100,7 @@ This function extends the capability of SetFilePointer to accept 64 bit paramete MoveMethod ); - if (LargeInt.LowPart == -1 && - (ErrorCode = Private->WinNtThunk->GetLastError ()) != NO_ERROR) { + if (LargeInt.LowPart == -1 && Private->WinNtThunk->GetLastError () != NO_ERROR) { Status = EFI_INVALID_PARAMETER; } diff --git a/Nt32Pkg/WinNtGopDxe/WinNtGopScreen.c b/Nt32Pkg/WinNtGopDxe/WinNtGopScreen.c index 3e2c158ea1..1fa6223b86 100644 --- a/Nt32Pkg/WinNtGopDxe/WinNtGopScreen.c +++ b/Nt32Pkg/WinNtGopDxe/WinNtGopScreen.c @@ -140,13 +140,13 @@ WinNtGopConvertParamToEfiKey ( // Set toggle state // case VK_NUMLOCK: - Private->NumLock = !Private->NumLock; + Private->NumLock = (BOOLEAN)(!Private->NumLock); break; case VK_SCROLL: - Private->ScrollLock = !Private->ScrollLock; + Private->ScrollLock = (BOOLEAN)(!Private->ScrollLock); break; case VK_CAPITAL: - Private->CapsLock = !Private->CapsLock; + Private->CapsLock = (BOOLEAN)(!Private->CapsLock); break; } @@ -821,7 +821,6 @@ WinNtGopThreadWinMain ( { MSG Message; GOP_PRIVATE_DATA *Private; - ATOM Atom; RECT Rect; Private = (GOP_PRIVATE_DATA *) lpParameter; @@ -857,7 +856,7 @@ WinNtGopThreadWinMain ( // Class, including the callback function, unless the Class is unregistered and // successfully registered again. // - Atom = Private->WinNtThunk->RegisterClassEx (&Private->WindowsClass); + Private->WinNtThunk->RegisterClassEx (&Private->WindowsClass); // // Setting Rect values to allow for the AdjustWindowRect to provide @@ -882,7 +881,7 @@ WinNtGopThreadWinMain ( NULL, NULL, NULL, - &Private + (VOID **)&Private ); // @@ -1050,8 +1049,6 @@ WinNtGopDestructor ( GOP_PRIVATE_DATA *Private ) { - UINT32 UnregisterReturn; - if (!Private->HardwareNeedsStarting) { // // BugBug: Shutdown GOP Hardware and any child devices. @@ -1071,10 +1068,10 @@ WinNtGopDestructor ( Private->WinNtThunk->TlsFree (mTlsIndex); mTlsIndex = TLS_OUT_OF_INDEXES; - UnregisterReturn = Private->WinNtThunk->UnregisterClass ( - Private->WindowsClass.lpszClassName, - Private->WindowsClass.hInstance - ); + Private->WinNtThunk->UnregisterClass ( + Private->WindowsClass.lpszClassName, + Private->WindowsClass.hInstance + ); } WinNtGopDestroySimpleTextInForWindow (Private); @@ -1111,6 +1108,5 @@ KillNtGopThread ( IN VOID *Context ) { - EFI_STATUS Status; - Status = WinNtGopDestructor (Context); + WinNtGopDestructor (Context); } diff --git a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c index e12f14dc29..5a55fa428c 100644 --- a/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c +++ b/Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c @@ -192,7 +192,7 @@ Returns: DevicePathNodeLength((EFI_DEVICE_PATH_PROTOCOL *)UartNode) != sizeof(UART_DEVICE_PATH)) { goto Error; } - if (UartNode->BaudRate < 0 || UartNode->BaudRate > SERIAL_PORT_MAX_BAUD_RATE) { + if ( UartNode->BaudRate > SERIAL_PORT_MAX_BAUD_RATE) { goto Error; } if (UartNode->Parity < NoParity || UartNode->Parity > SpaceParity) { @@ -339,9 +339,9 @@ Returns: Node.BaudRate, SerialIo->Mode->ReceiveFifoDepth, SerialIo->Mode->Timeout, - Node.Parity, + (EFI_PARITY_TYPE)Node.Parity, Node.DataBits, - Node.StopBits + (EFI_STOP_BITS_TYPE)Node.StopBits ); } break; @@ -699,9 +699,9 @@ Returns: This->Mode->BaudRate, This->Mode->ReceiveFifoDepth, This->Mode->Timeout, - This->Mode->Parity, + (EFI_PARITY_TYPE)This->Mode->Parity, (UINT8) This->Mode->DataBits, - This->Mode->StopBits + (EFI_STOP_BITS_TYPE)This->Mode->StopBits ); } @@ -774,7 +774,7 @@ Returns: } if (Parity == DefaultParity) { - Parity = FixedPcdGet8 (PcdUartDefaultParity); + Parity = (EFI_PARITY_TYPE) (FixedPcdGet8 (PcdUartDefaultParity)); } if (DataBits == 0) { diff --git a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c index 7da3eef9ce..1abb84185e 100644 --- a/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c +++ b/Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c @@ -837,6 +837,7 @@ Returns: BOOLEAN LoopFinish; UINTN InfoSize; EFI_FILE_INFO *Info; + UINTN Size; // // Check for obvious invalid parameters. @@ -951,7 +952,10 @@ OpenRoot: StrCpy (NewPrivateFile->FilePath, PrivateFile->FilePath); } - NewPrivateFile->FileName = AllocatePool (StrSize (NewPrivateFile->FilePath) + StrSize (L"\\") + StrSize (FileName)); + Size = StrSize (NewPrivateFile->FilePath); + Size += StrSize (L"\\"); + Size += StrSize (FileName); + NewPrivateFile->FileName = AllocatePool (Size); if (NewPrivateFile->FileName == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -1107,7 +1111,9 @@ OpenRoot: // if (NewPrivateFile->IsDirectoryPath) { - TempFileName = AllocatePool (StrSize (NewPrivateFile->FileName) + StrSize (L"\\*")); + Size = StrSize (NewPrivateFile->FileName); + Size += StrSize (L"\\*"); + TempFileName = AllocatePool (Size); if (TempFileName == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -1560,12 +1566,12 @@ Returns: } Status = PrivateFile->WinNtThunk->ReadFile ( - PrivateFile->LHandle, - Buffer, - *BufferSize, - BufferSize, - NULL - ) ? EFI_SUCCESS : EFI_DEVICE_ERROR; + PrivateFile->LHandle, + Buffer, + *BufferSize, + (LPDWORD)BufferSize, + NULL + ) ? EFI_SUCCESS : EFI_DEVICE_ERROR; goto Done; } @@ -1731,12 +1737,12 @@ Returns: } Status = PrivateFile->WinNtThunk->WriteFile ( - PrivateFile->LHandle, - Buffer, - *BufferSize, - BufferSize, - NULL - ) ? EFI_SUCCESS : EFI_DEVICE_ERROR; + PrivateFile->LHandle, + Buffer, + *BufferSize, + (LPDWORD)BufferSize, + NULL + ) ? EFI_SUCCESS : EFI_DEVICE_ERROR; Done: gBS->RestoreTPL (OldTpl); @@ -1780,6 +1786,7 @@ Returns: UINT32 PosHigh; CHAR16 *FileName; EFI_TPL OldTpl; + UINTN Size; if (This == NULL) { return EFI_INVALID_PARAMETER; @@ -1795,7 +1802,9 @@ Returns: goto Done; } - FileName = AllocatePool (StrSize (PrivateFile->FileName) + StrSize (L"\\*")); + Size = StrSize (PrivateFile->FileName); + Size += StrSize (L"\\*"); + FileName = AllocatePool (Size); if (FileName == NULL) { Status = EFI_OUT_OF_RESOURCES; goto Done; @@ -1825,7 +1834,7 @@ Returns: } else { PosHigh = (UINT32) RShiftU64 (Position, 32); - PosLow = PrivateFile->WinNtThunk->SetFilePointer (PrivateFile->LHandle, (ULONG) Position, &PosHigh, FILE_BEGIN); + PosLow = PrivateFile->WinNtThunk->SetFilePointer (PrivateFile->LHandle, (ULONG) Position, (PLONG)&PosHigh, FILE_BEGIN); } Status = (PosLow == 0xFFFFFFFF) ? EFI_DEVICE_ERROR : EFI_SUCCESS; @@ -1888,11 +1897,11 @@ Returns: PositionHigh = 0; *Position = PrivateFile->WinNtThunk->SetFilePointer ( - PrivateFile->LHandle, - 0, - &PositionHigh, - FILE_CURRENT - ); + PrivateFile->LHandle, + 0, + (PLONG)&PositionHigh, + FILE_CURRENT + ); Status = *Position == 0xffffffff ? EFI_DEVICE_ERROR : EFI_SUCCESS; if (EFI_ERROR (Status)) { @@ -2199,10 +2208,10 @@ Returns: // NtStatus = PrivateFile->WinNtThunk->GetDiskFreeSpace ( DriveNameFound ? DriveName : NULL, - &SectorsPerCluster, - &BytesPerSector, - &FreeClusters, - &TotalClusters + (LPDWORD)&SectorsPerCluster, + (LPDWORD)&BytesPerSector, + (LPDWORD)&FreeClusters, + (LPDWORD)&TotalClusters ); if (DriveName) { FreePool (DriveName); @@ -2331,6 +2340,7 @@ Returns: WIN32_FIND_DATA FindBuf; EFI_FILE_SYSTEM_INFO *NewFileSystemInfo; EFI_TPL OldTpl; + UINTN Size; // // Check for invalid parameters. @@ -2459,25 +2469,20 @@ Returns: // // Make full pathname from new filename and rootpath. // - if (NewFileInfo->FileName[0] == '\\') { - NewFileName = AllocatePool (StrSize (PrivateRoot->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName)); - if (NewFileName == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto Done; - } + Size = StrSize (PrivateRoot->FilePath); + Size += StrSize (L"\\"); + Size += StrSize (NewFileInfo->FileName); + NewFileName = AllocatePool (Size); + if (NewFileName == NULL) { + Status = EFI_OUT_OF_RESOURCES; + goto Done; + } - StrCpy (NewFileName, PrivateRoot->FilePath); - StrCat (NewFileName, L"\\"); + StrCpy (NewFileName, PrivateRoot->FilePath); + StrCat (NewFileName, L"\\"); + if (NewFileInfo->FileName[0] == '\\') { StrCat (NewFileName, NewFileInfo->FileName + 1); } else { - NewFileName = AllocatePool (StrSize (PrivateFile->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName)); - if (NewFileName == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto Done; - } - - StrCpy (NewFileName, PrivateFile->FilePath); - StrCat (NewFileName, L"\\"); StrCat (NewFileName, NewFileInfo->FileName); } @@ -2588,7 +2593,9 @@ Returns: StrCpy (PrivateFile->FileName, NewFileName); - TempFileName = AllocatePool (StrSize (NewFileName) + StrSize (L"\\*")); + Size = StrSize (NewFileName); + Size += StrSize (L"\\*"); + TempFileName = AllocatePool (Size); StrCpy (TempFileName, NewFileName); @@ -2638,7 +2645,9 @@ Reopen: ; goto Done; } - TempFileName = AllocatePool (StrSize (OldFileName) + StrSize (L"\\*")); + Size = StrSize (OldFileName); + Size += StrSize (L"\\*"); + TempFileName = AllocatePool (Size); StrCpy (TempFileName, OldFileName); -- 2.39.2