From 3a76f91710e1cd0bde217bcb875daabc83c663b9 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sun, 31 Jul 2005 23:39:05 +0000 Subject: [PATCH] fixed some warnings when compiling with -O3 svn path=/trunk/; revision=16928 --- reactos/drivers/bus/serenum/detect.c | 2 +- reactos/drivers/dd/sndblst/irq.c | 2 +- reactos/drivers/input/i8042prt/i8042prt.c | 2 +- reactos/drivers/input/i8042prt/mouse.c | 2 +- reactos/lib/advapi32/token/token.c | 7 ++----- reactos/lib/kernel32/misc/time.c | 2 +- reactos/ntoskrnl/cm/regfile.c | 4 ++++ reactos/ntoskrnl/mm/elf.inc.h | 4 ++-- reactos/ntoskrnl/mm/pe.c | 15 ++++++++------- reactos/ntoskrnl/mm/region.c | 2 +- reactos/subsys/csrss/win32csr/conio.c | 2 +- reactos/subsys/system/regedit/regproc.c | 2 +- 12 files changed, 24 insertions(+), 22 deletions(-) diff --git a/reactos/drivers/bus/serenum/detect.c b/reactos/drivers/bus/serenum/detect.c index ca64d2c45f5..a2813c24551 100644 --- a/reactos/drivers/bus/serenum/detect.c +++ b/reactos/drivers/bus/serenum/detect.c @@ -472,7 +472,7 @@ SerenumDetectLegacyDevice( ULONG Command; SERIAL_TIMEOUTS Timeouts; SERIAL_LINE_CONTROL LCR; - ULONG i, Count; + ULONG i, Count = 0; UCHAR Buffer[16]; UNICODE_STRING DeviceDescription; UNICODE_STRING DeviceId; diff --git a/reactos/drivers/dd/sndblst/irq.c b/reactos/drivers/dd/sndblst/irq.c index b9ffbff695f..efa09ff56f2 100644 --- a/reactos/drivers/dd/sndblst/irq.c +++ b/reactos/drivers/dd/sndblst/irq.c @@ -65,7 +65,7 @@ NTSTATUS EnableIRQ(PDEVICE_OBJECT DeviceObject) ULONG Vector; KIRQL IRQ_Level; KAFFINITY Affinity; - NTSTATUS Status; + NTSTATUS Status = STATUS_SUCCESS; Vector = HalGetInterruptVector(Isa, // FIX THIS 0, // FIX THIS diff --git a/reactos/drivers/input/i8042prt/i8042prt.c b/reactos/drivers/input/i8042prt/i8042prt.c index b3593c3fe3c..ce3324da880 100644 --- a/reactos/drivers/input/i8042prt/i8042prt.c +++ b/reactos/drivers/input/i8042prt/i8042prt.c @@ -511,7 +511,7 @@ NTSTATUS STDCALL I8042CreateDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) static NTSTATUS STDCALL I8042BasicDetect(PDEVICE_EXTENSION DevExt) { NTSTATUS Status; - UCHAR Value; + UCHAR Value = 0; UINT Counter; I8042Flush(); diff --git a/reactos/drivers/input/i8042prt/mouse.c b/reactos/drivers/input/i8042prt/mouse.c index 50c429a413c..a4664e54598 100644 --- a/reactos/drivers/input/i8042prt/mouse.c +++ b/reactos/drivers/input/i8042prt/mouse.c @@ -111,7 +111,7 @@ BOOLEAN STDCALL I8042MouseResetIsr(PDEVICE_EXTENSION DevExt, UCHAR Status, PUCHAR Value) { - BOOLEAN ToReturn; + BOOLEAN ToReturn = FALSE; if (I8042MouseCallIsrHook(DevExt, Status, Value, &ToReturn)) return ToReturn; diff --git a/reactos/lib/advapi32/token/token.c b/reactos/lib/advapi32/token/token.c index c58657d9aa3..bd4a95be90c 100644 --- a/reactos/lib/advapi32/token/token.c +++ b/reactos/lib/advapi32/token/token.c @@ -327,8 +327,7 @@ CheckTokenMembership (HANDLE ExistingTokenHandle, PSID SidToCheck, PBOOL IsMember) { - HANDLE AccessToken; - BOOL ReleaseToken = FALSE; + HANDLE AccessToken = NULL; BOOL Result = FALSE; DWORD dwSize; DWORD i; @@ -353,7 +352,6 @@ CheckTokenMembership (HANDLE ExistingTokenHandle, goto ByeBye; } CloseHandle(ExistingTokenHandle); - ReleaseToken = TRUE; } else { @@ -364,7 +362,6 @@ CheckTokenMembership (HANDLE ExistingTokenHandle, /* Duplicate token to have a impersonation token */ if (!DuplicateToken(ExistingTokenHandle, SecurityAnonymous, &AccessToken)) return FALSE; - ReleaseToken = TRUE; } else AccessToken = ExistingTokenHandle; @@ -395,7 +392,7 @@ CheckTokenMembership (HANDLE ExistingTokenHandle, ByeBye: if (lpGroups != NULL) HeapFree(GetProcessHeap(), 0, lpGroups); - if (ReleaseToken) + if (AccessToken != NULL && AccessToken != ExistingTokenHandle) CloseHandle(AccessToken); return Result; diff --git a/reactos/lib/kernel32/misc/time.c b/reactos/lib/kernel32/misc/time.c index 7a7b3f36cce..3b90f2efa46 100644 --- a/reactos/lib/kernel32/misc/time.c +++ b/reactos/lib/kernel32/misc/time.c @@ -50,7 +50,7 @@ FileTimeToDosDateTime( { PDOSTIME pdtime=(PDOSTIME) lpFatTime; PDOSDATE pddate=(PDOSDATE) lpFatDate; - SYSTEMTIME SystemTime; + SYSTEMTIME SystemTime = { 0 }; if ( lpFileTime == NULL ) return FALSE; diff --git a/reactos/ntoskrnl/cm/regfile.c b/reactos/ntoskrnl/cm/regfile.c index 9ec1dd98222..7cb510c4336 100644 --- a/reactos/ntoskrnl/cm/regfile.c +++ b/reactos/ntoskrnl/cm/regfile.c @@ -4065,6 +4065,10 @@ CmiCopyKey (PREGISTRY_HIVE DstHive, } NewKeyCell->HashTableOffset = NewHashTableOffset; } + else + { + NewHashTableCell = NULL; + } /* Allocate and copy value list and values */ if (SrcKeyCell->NumberOfValues != 0) diff --git a/reactos/ntoskrnl/mm/elf.inc.h b/reactos/ntoskrnl/mm/elf.inc.h index a15f06a44cb..3d3e27e4bf5 100644 --- a/reactos/ntoskrnl/mm/elf.inc.h +++ b/reactos/ntoskrnl/mm/elf.inc.h @@ -519,8 +519,8 @@ Elf64FmtCreateSection Elf_Off nFileOffset; Elf_Addr nVirtualAddr; Elf_Size nAdj; - Elf_Size nVirtualSize; - Elf_Size nFileSize; + Elf_Size nVirtualSize = 0; + Elf_Size nFileSize = 0; ASSERT(j <= nPHdrCount); diff --git a/reactos/ntoskrnl/mm/pe.c b/reactos/ntoskrnl/mm/pe.c index bb4d19d9c82..b863d186aef 100644 --- a/reactos/ntoskrnl/mm/pe.c +++ b/reactos/ntoskrnl/mm/pe.c @@ -188,12 +188,12 @@ NTSTATUS NTAPI PeFmtCreateSection ) { NTSTATUS nStatus; - ULONG cbFileHeaderOffsetSize; - ULONG cbSectionHeadersOffset; + ULONG cbFileHeaderOffsetSize = 0; + ULONG cbSectionHeadersOffset = 0; ULONG cbSectionHeadersSize; - ULONG cbSectionHeadersOffsetSize; + ULONG cbSectionHeadersOffsetSize = 0; ULONG cbOptHeaderSize; - ULONG cbHeadersSize; + ULONG cbHeadersSize = 0; ULONG nSectionAlignment; ULONG nFileAlignment; const IMAGE_DOS_HEADER * pidhDosHeader; @@ -203,8 +203,8 @@ NTSTATUS NTAPI PeFmtCreateSection PMM_SECTION_SEGMENT pssSegments; LARGE_INTEGER lnOffset; PVOID pBuffer; - ULONG nPrevVirtualEndOfSegment; - ULONG nFileSizeOfHeaders; + ULONG nPrevVirtualEndOfSegment = 0; + ULONG nFileSizeOfHeaders = 0; ULONG i; ASSERT(FileHeader); @@ -277,6 +277,7 @@ NTSTATUS NTAPI PeFmtCreateSection PVOID pData; l_ReadHeaderFromFile: + cbNtHeaderSize = 0; lnOffset.QuadPart = pidhDosHeader->e_lfanew; /* read the header from the file */ @@ -330,7 +331,7 @@ l_ReadHeaderFromFile: } else { - ULONG cbOptHeaderOffsetSize; + ULONG cbOptHeaderOffsetSize = 0; nStatus = STATUS_INVALID_IMAGE_FORMAT; diff --git a/reactos/ntoskrnl/mm/region.c b/reactos/ntoskrnl/mm/region.c index 5ee161a7ea1..03427dbd37f 100644 --- a/reactos/ntoskrnl/mm/region.c +++ b/reactos/ntoskrnl/mm/region.c @@ -110,7 +110,7 @@ MmAlterRegion(PMADDRESS_SPACE AddressSpace, PVOID BaseAddress, ULONG NewType, ULONG NewProtect, PMM_ALTER_REGION_FUNC AlterFunc) { PMM_REGION InitialRegion; - PVOID InitialBaseAddress; + PVOID InitialBaseAddress = NULL; PMM_REGION NewRegion; PLIST_ENTRY CurrentEntry; PMM_REGION CurrentRegion = NULL; diff --git a/reactos/subsys/csrss/win32csr/conio.c b/reactos/subsys/csrss/win32csr/conio.c index 2ec7b459702..62b8a89da5a 100644 --- a/reactos/subsys/csrss/win32csr/conio.c +++ b/reactos/subsys/csrss/win32csr/conio.c @@ -224,7 +224,7 @@ CsrInitConsole(PCSRSS_CONSOLE Console) CSR_API(CsrAllocConsole) { PCSRSS_CONSOLE Console; - NTSTATUS Status; + NTSTATUS Status = STATUS_SUCCESS; BOOLEAN NewConsole = FALSE; DPRINT("CsrAllocConsole\n"); diff --git a/reactos/subsys/system/regedit/regproc.c b/reactos/subsys/system/regedit/regproc.c index cf0c13366fc..9d597f8613a 100644 --- a/reactos/subsys/system/regedit/regproc.c +++ b/reactos/subsys/system/regedit/regproc.c @@ -384,7 +384,7 @@ void REGPROC_unescape_string(LPSTR str) HRESULT setValue(LPSTR val_name, LPSTR val_data) { HRESULT hRes; - DWORD dwDataType, dwParseType; + DWORD dwDataType, dwParseType = REG_BINARY; LPBYTE lpbData; BYTE convert[KEY_MAX_LEN]; BYTE *bBigBuffer = 0;