Fix ICC compatibility issues

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8616 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
mdkinney 2009-06-20 17:05:16 +00:00
parent e189fded67
commit a00ec39b52
8 changed files with 80 additions and 75 deletions

View File

@ -159,6 +159,7 @@ AddModHandle (
PDB_NAME_TO_MOD_HANDLE *Array; PDB_NAME_TO_MOD_HANDLE *Array;
UINTN PreviousSize; UINTN PreviousSize;
PDB_NAME_TO_MOD_HANDLE *TempArray; PDB_NAME_TO_MOD_HANDLE *TempArray;
HANDLE Handle;
Array = mPdbNameModHandleArray; Array = mPdbNameModHandleArray;
for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) { for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
@ -166,7 +167,8 @@ AddModHandle (
// //
// Make a copy of the stirng and store the ModHandle // 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, HEAP_ZERO_MEMORY,
AsciiStrLen (ImageContext->PdbPointer) + 1 AsciiStrLen (ImageContext->PdbPointer) + 1
); );

View File

@ -41,7 +41,7 @@ WinNtResetSystem (
IN EFI_RESET_TYPE ResetType, IN EFI_RESET_TYPE ResetType,
IN EFI_STATUS ResetStatus, IN EFI_STATUS ResetStatus,
IN UINTN DataSize, IN UINTN DataSize,
IN CHAR16 *ResetData OPTIONAL IN VOID *ResetData OPTIONAL
); );
@ -90,7 +90,7 @@ WinNtResetSystem (
IN EFI_RESET_TYPE ResetType, IN EFI_RESET_TYPE ResetType,
IN EFI_STATUS ResetStatus, IN EFI_STATUS ResetStatus,
IN UINTN DataSize, IN UINTN DataSize,
IN CHAR16 *ResetData OPTIONAL IN VOID *ResetData OPTIONAL
) )
/*++ /*++

View File

@ -42,7 +42,7 @@ SNPNT32_GLOBAL_DATA gSnpNt32GlobalData = {
{ {
0, 0,
0, 0,
0 EfiLockUninitialized
}, // Lock }, // Lock
// //
// Private functions // Private functions
@ -1083,7 +1083,7 @@ SnpNt32InitializeGlobalData (
// //
// Get the WinNT thunk // Get the WinNT thunk
// //
Status = gBS->LocateProtocol (&gEfiWinNtThunkProtocolGuid, NULL, &This->WinNtThunk); Status = gBS->LocateProtocol (&gEfiWinNtThunkProtocolGuid, NULL, (VOID **)&This->WinNtThunk);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;

View File

@ -139,7 +139,7 @@ EFI_STATUS
// //
#define SNP_NT32_DRIVER_SIGNATURE SIGNATURE_32 ('W', 'S', 'N', 'P') #define SNP_NT32_DRIVER_SIGNATURE SIGNATURE_32 ('W', 'S', 'N', 'P')
typedef struct _SNPNT32_GLOBAL_DATA { struct _SNPNT32_GLOBAL_DATA {
UINT32 Signature; UINT32 Signature;
// //
@ -160,14 +160,14 @@ typedef struct _SNPNT32_GLOBAL_DATA {
SNPNT32_INITIALIZE_GLOBAL_DATA InitializeGlobalData; SNPNT32_INITIALIZE_GLOBAL_DATA InitializeGlobalData;
SNPNT32_INITIALIZE_INSTANCE_DATA InitializeInstanceData; SNPNT32_INITIALIZE_INSTANCE_DATA InitializeInstanceData;
SNPNT32_CLOSE_INSTANCE CloseInstance; SNPNT32_CLOSE_INSTANCE CloseInstance;
} SNPNT32_GLOBAL_DATA; };
// //
// Instance data for each fake SNP instance // Instance data for each fake SNP instance
// //
#define SNP_NT32_INSTANCE_SIGNATURE SIGNATURE_32 ('w', 'S', 'N', 'P') #define SNP_NT32_INSTANCE_SIGNATURE SIGNATURE_32 ('w', 'S', 'N', 'P')
typedef struct _SNPNT32_INSTANCE_DATA { struct _SNPNT32_INSTANCE_DATA {
UINT32 Signature; UINT32 Signature;
// //
@ -188,7 +188,7 @@ typedef struct _SNPNT32_INSTANCE_DATA {
// //
// Private functions // Private functions
// //
} SNPNT32_INSTANCE_DATA; };
#define SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS(a) \ #define SNP_NT32_INSTANCE_DATA_FROM_SNP_THIS(a) \
CR ( \ CR ( \

View File

@ -1089,7 +1089,6 @@ This function extends the capability of SetFilePointer to accept 64 bit paramete
{ {
EFI_STATUS Status; EFI_STATUS Status;
LARGE_INTEGER LargeInt; LARGE_INTEGER LargeInt;
UINT32 ErrorCode;
LargeInt.QuadPart = DistanceToMove; LargeInt.QuadPart = DistanceToMove;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
@ -1101,8 +1100,7 @@ This function extends the capability of SetFilePointer to accept 64 bit paramete
MoveMethod MoveMethod
); );
if (LargeInt.LowPart == -1 && if (LargeInt.LowPart == -1 && Private->WinNtThunk->GetLastError () != NO_ERROR) {
(ErrorCode = Private->WinNtThunk->GetLastError ()) != NO_ERROR) {
Status = EFI_INVALID_PARAMETER; Status = EFI_INVALID_PARAMETER;
} }

View File

@ -140,13 +140,13 @@ WinNtGopConvertParamToEfiKey (
// Set toggle state // Set toggle state
// //
case VK_NUMLOCK: case VK_NUMLOCK:
Private->NumLock = !Private->NumLock; Private->NumLock = (BOOLEAN)(!Private->NumLock);
break; break;
case VK_SCROLL: case VK_SCROLL:
Private->ScrollLock = !Private->ScrollLock; Private->ScrollLock = (BOOLEAN)(!Private->ScrollLock);
break; break;
case VK_CAPITAL: case VK_CAPITAL:
Private->CapsLock = !Private->CapsLock; Private->CapsLock = (BOOLEAN)(!Private->CapsLock);
break; break;
} }
@ -821,7 +821,6 @@ WinNtGopThreadWinMain (
{ {
MSG Message; MSG Message;
GOP_PRIVATE_DATA *Private; GOP_PRIVATE_DATA *Private;
ATOM Atom;
RECT Rect; RECT Rect;
Private = (GOP_PRIVATE_DATA *) lpParameter; Private = (GOP_PRIVATE_DATA *) lpParameter;
@ -857,7 +856,7 @@ WinNtGopThreadWinMain (
// Class, including the callback function, unless the Class is unregistered and // Class, including the callback function, unless the Class is unregistered and
// successfully registered again. // successfully registered again.
// //
Atom = Private->WinNtThunk->RegisterClassEx (&Private->WindowsClass); Private->WinNtThunk->RegisterClassEx (&Private->WindowsClass);
// //
// Setting Rect values to allow for the AdjustWindowRect to provide // Setting Rect values to allow for the AdjustWindowRect to provide
@ -882,7 +881,7 @@ WinNtGopThreadWinMain (
NULL, NULL,
NULL, NULL,
NULL, NULL,
&Private (VOID **)&Private
); );
// //
@ -1050,8 +1049,6 @@ WinNtGopDestructor (
GOP_PRIVATE_DATA *Private GOP_PRIVATE_DATA *Private
) )
{ {
UINT32 UnregisterReturn;
if (!Private->HardwareNeedsStarting) { if (!Private->HardwareNeedsStarting) {
// //
// BugBug: Shutdown GOP Hardware and any child devices. // BugBug: Shutdown GOP Hardware and any child devices.
@ -1071,10 +1068,10 @@ WinNtGopDestructor (
Private->WinNtThunk->TlsFree (mTlsIndex); Private->WinNtThunk->TlsFree (mTlsIndex);
mTlsIndex = TLS_OUT_OF_INDEXES; mTlsIndex = TLS_OUT_OF_INDEXES;
UnregisterReturn = Private->WinNtThunk->UnregisterClass ( Private->WinNtThunk->UnregisterClass (
Private->WindowsClass.lpszClassName, Private->WindowsClass.lpszClassName,
Private->WindowsClass.hInstance Private->WindowsClass.hInstance
); );
} }
WinNtGopDestroySimpleTextInForWindow (Private); WinNtGopDestroySimpleTextInForWindow (Private);
@ -1111,6 +1108,5 @@ KillNtGopThread (
IN VOID *Context IN VOID *Context
) )
{ {
EFI_STATUS Status; WinNtGopDestructor (Context);
Status = WinNtGopDestructor (Context);
} }

View File

@ -192,7 +192,7 @@ Returns:
DevicePathNodeLength((EFI_DEVICE_PATH_PROTOCOL *)UartNode) != sizeof(UART_DEVICE_PATH)) { DevicePathNodeLength((EFI_DEVICE_PATH_PROTOCOL *)UartNode) != sizeof(UART_DEVICE_PATH)) {
goto Error; goto Error;
} }
if (UartNode->BaudRate < 0 || UartNode->BaudRate > SERIAL_PORT_MAX_BAUD_RATE) { if ( UartNode->BaudRate > SERIAL_PORT_MAX_BAUD_RATE) {
goto Error; goto Error;
} }
if (UartNode->Parity < NoParity || UartNode->Parity > SpaceParity) { if (UartNode->Parity < NoParity || UartNode->Parity > SpaceParity) {
@ -339,9 +339,9 @@ Returns:
Node.BaudRate, Node.BaudRate,
SerialIo->Mode->ReceiveFifoDepth, SerialIo->Mode->ReceiveFifoDepth,
SerialIo->Mode->Timeout, SerialIo->Mode->Timeout,
Node.Parity, (EFI_PARITY_TYPE)Node.Parity,
Node.DataBits, Node.DataBits,
Node.StopBits (EFI_STOP_BITS_TYPE)Node.StopBits
); );
} }
break; break;
@ -699,9 +699,9 @@ Returns:
This->Mode->BaudRate, This->Mode->BaudRate,
This->Mode->ReceiveFifoDepth, This->Mode->ReceiveFifoDepth,
This->Mode->Timeout, This->Mode->Timeout,
This->Mode->Parity, (EFI_PARITY_TYPE)This->Mode->Parity,
(UINT8) This->Mode->DataBits, (UINT8) This->Mode->DataBits,
This->Mode->StopBits (EFI_STOP_BITS_TYPE)This->Mode->StopBits
); );
} }
@ -774,7 +774,7 @@ Returns:
} }
if (Parity == DefaultParity) { if (Parity == DefaultParity) {
Parity = FixedPcdGet8 (PcdUartDefaultParity); Parity = (EFI_PARITY_TYPE) (FixedPcdGet8 (PcdUartDefaultParity));
} }
if (DataBits == 0) { if (DataBits == 0) {

View File

@ -837,6 +837,7 @@ Returns:
BOOLEAN LoopFinish; BOOLEAN LoopFinish;
UINTN InfoSize; UINTN InfoSize;
EFI_FILE_INFO *Info; EFI_FILE_INFO *Info;
UINTN Size;
// //
// Check for obvious invalid parameters. // Check for obvious invalid parameters.
@ -951,7 +952,10 @@ OpenRoot:
StrCpy (NewPrivateFile->FilePath, PrivateFile->FilePath); 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) { if (NewPrivateFile->FileName == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto Done; goto Done;
@ -1107,7 +1111,9 @@ OpenRoot:
// //
if (NewPrivateFile->IsDirectoryPath) { if (NewPrivateFile->IsDirectoryPath) {
TempFileName = AllocatePool (StrSize (NewPrivateFile->FileName) + StrSize (L"\\*")); Size = StrSize (NewPrivateFile->FileName);
Size += StrSize (L"\\*");
TempFileName = AllocatePool (Size);
if (TempFileName == NULL) { if (TempFileName == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto Done; goto Done;
@ -1560,12 +1566,12 @@ Returns:
} }
Status = PrivateFile->WinNtThunk->ReadFile ( Status = PrivateFile->WinNtThunk->ReadFile (
PrivateFile->LHandle, PrivateFile->LHandle,
Buffer, Buffer,
*BufferSize, *BufferSize,
BufferSize, (LPDWORD)BufferSize,
NULL NULL
) ? EFI_SUCCESS : EFI_DEVICE_ERROR; ) ? EFI_SUCCESS : EFI_DEVICE_ERROR;
goto Done; goto Done;
} }
@ -1731,12 +1737,12 @@ Returns:
} }
Status = PrivateFile->WinNtThunk->WriteFile ( Status = PrivateFile->WinNtThunk->WriteFile (
PrivateFile->LHandle, PrivateFile->LHandle,
Buffer, Buffer,
*BufferSize, *BufferSize,
BufferSize, (LPDWORD)BufferSize,
NULL NULL
) ? EFI_SUCCESS : EFI_DEVICE_ERROR; ) ? EFI_SUCCESS : EFI_DEVICE_ERROR;
Done: Done:
gBS->RestoreTPL (OldTpl); gBS->RestoreTPL (OldTpl);
@ -1780,6 +1786,7 @@ Returns:
UINT32 PosHigh; UINT32 PosHigh;
CHAR16 *FileName; CHAR16 *FileName;
EFI_TPL OldTpl; EFI_TPL OldTpl;
UINTN Size;
if (This == NULL) { if (This == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -1795,7 +1802,9 @@ Returns:
goto Done; goto Done;
} }
FileName = AllocatePool (StrSize (PrivateFile->FileName) + StrSize (L"\\*")); Size = StrSize (PrivateFile->FileName);
Size += StrSize (L"\\*");
FileName = AllocatePool (Size);
if (FileName == NULL) { if (FileName == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto Done; goto Done;
@ -1825,7 +1834,7 @@ Returns:
} else { } else {
PosHigh = (UINT32) RShiftU64 (Position, 32); 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; Status = (PosLow == 0xFFFFFFFF) ? EFI_DEVICE_ERROR : EFI_SUCCESS;
@ -1888,11 +1897,11 @@ Returns:
PositionHigh = 0; PositionHigh = 0;
*Position = PrivateFile->WinNtThunk->SetFilePointer ( *Position = PrivateFile->WinNtThunk->SetFilePointer (
PrivateFile->LHandle, PrivateFile->LHandle,
0, 0,
&PositionHigh, (PLONG)&PositionHigh,
FILE_CURRENT FILE_CURRENT
); );
Status = *Position == 0xffffffff ? EFI_DEVICE_ERROR : EFI_SUCCESS; Status = *Position == 0xffffffff ? EFI_DEVICE_ERROR : EFI_SUCCESS;
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -2199,10 +2208,10 @@ Returns:
// //
NtStatus = PrivateFile->WinNtThunk->GetDiskFreeSpace ( NtStatus = PrivateFile->WinNtThunk->GetDiskFreeSpace (
DriveNameFound ? DriveName : NULL, DriveNameFound ? DriveName : NULL,
&SectorsPerCluster, (LPDWORD)&SectorsPerCluster,
&BytesPerSector, (LPDWORD)&BytesPerSector,
&FreeClusters, (LPDWORD)&FreeClusters,
&TotalClusters (LPDWORD)&TotalClusters
); );
if (DriveName) { if (DriveName) {
FreePool (DriveName); FreePool (DriveName);
@ -2331,6 +2340,7 @@ Returns:
WIN32_FIND_DATA FindBuf; WIN32_FIND_DATA FindBuf;
EFI_FILE_SYSTEM_INFO *NewFileSystemInfo; EFI_FILE_SYSTEM_INFO *NewFileSystemInfo;
EFI_TPL OldTpl; EFI_TPL OldTpl;
UINTN Size;
// //
// Check for invalid parameters. // Check for invalid parameters.
@ -2459,25 +2469,20 @@ Returns:
// //
// Make full pathname from new filename and rootpath. // Make full pathname from new filename and rootpath.
// //
if (NewFileInfo->FileName[0] == '\\') { Size = StrSize (PrivateRoot->FilePath);
NewFileName = AllocatePool (StrSize (PrivateRoot->FilePath) + StrSize (L"\\") + StrSize (NewFileInfo->FileName)); Size += StrSize (L"\\");
if (NewFileName == NULL) { Size += StrSize (NewFileInfo->FileName);
Status = EFI_OUT_OF_RESOURCES; NewFileName = AllocatePool (Size);
goto Done; if (NewFileName == NULL) {
} Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
StrCpy (NewFileName, PrivateRoot->FilePath); StrCpy (NewFileName, PrivateRoot->FilePath);
StrCat (NewFileName, L"\\"); StrCat (NewFileName, L"\\");
if (NewFileInfo->FileName[0] == '\\') {
StrCat (NewFileName, NewFileInfo->FileName + 1); StrCat (NewFileName, NewFileInfo->FileName + 1);
} else { } 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); StrCat (NewFileName, NewFileInfo->FileName);
} }
@ -2588,7 +2593,9 @@ Returns:
StrCpy (PrivateFile->FileName, NewFileName); StrCpy (PrivateFile->FileName, NewFileName);
TempFileName = AllocatePool (StrSize (NewFileName) + StrSize (L"\\*")); Size = StrSize (NewFileName);
Size += StrSize (L"\\*");
TempFileName = AllocatePool (Size);
StrCpy (TempFileName, NewFileName); StrCpy (TempFileName, NewFileName);
@ -2638,7 +2645,9 @@ Reopen: ;
goto Done; goto Done;
} }
TempFileName = AllocatePool (StrSize (OldFileName) + StrSize (L"\\*")); Size = StrSize (OldFileName);
Size += StrSize (L"\\*");
TempFileName = AllocatePool (Size);
StrCpy (TempFileName, OldFileName); StrCpy (TempFileName, OldFileName);