Author: tkreuzer Date: Sun Dec 16 14:23:05 2012 New Revision: 57924
URL: http://svn.reactos.org/svn/reactos?rev=57924&view=rev Log: [FREELDR] Fix / silence a number of warnings/errors detected with VS-analyze
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c trunk/reactos/boot/freeldr/freeldr/arch/i386/ntoskrnl.c trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c trunk/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c trunk/reactos/boot/freeldr/freeldr/debug.c trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c trunk/reactos/boot/freeldr/freeldr/include/winldr.h trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c trunk/reactos/boot/freeldr/freeldr/version.c trunk/reactos/boot/freeldr/freeldr/windows/conversion.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] Sun Dec 16 14:23:05 2012 @@ -1241,7 +1241,8 @@ }
-static BOOLEAN +//static +BOOLEAN DetectKeyboardDevice(VOID) { UCHAR Status; @@ -1321,8 +1322,8 @@ PCONFIGURATION_COMPONENT_DATA PeripheralKey; ULONG Size;
- /* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2 */ - if (TRUE || DetectKeyboardDevice()) + /* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2 + if (DetectKeyboardDevice()) */ { /* Set 'Configuration Data' value */ Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/ntoskrnl.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/ntoskrnl.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/ntoskrnl.c [iso-8859-1] Sun Dec 16 14:23:05 2012 @@ -12,6 +12,7 @@ IN EVENT_TYPE Type, IN BOOLEAN State) { + memset(Event, 0, sizeof(*Event)); }
VOID
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c [iso-8859-1] Sun Dec 16 14:23:05 2012 @@ -285,8 +285,8 @@ /* Add the descriptor */ MapCount = AddMemoryDescriptor(PcMemoryMap, MAX_BIOS_DESCRIPTORS, - RealBaseAddress / MM_PAGE_SIZE, - RealSize / MM_PAGE_SIZE, + (PFN_NUMBER)(RealBaseAddress / MM_PAGE_SIZE), + (PFN_NUMBER)(RealSize / MM_PAGE_SIZE), MemoryType); }
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcvideo.c [iso-8859-1] Sun Dec 16 14:23:05 2012 @@ -17,6 +17,7 @@ */
#include <freeldr.h> +#include <suppress.h>
#define NDEBUG #include <debug.h> @@ -1047,6 +1048,7 @@ BufPtr < (USHORT *) (VIDEOTEXT_MEM_ADDRESS + VIDEOTEXT_MEM_SIZE); BufPtr++) { + _PRAGMA_WARNING_SUPPRESS(__WARNING_DEREF_NULL_PTR) *BufPtr = AttrChar; } }
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] Sun Dec 16 14:23:05 2012 @@ -327,11 +327,11 @@ USHORT i; ULONG Size; BOOLEAN Changed; - + /* Count the number of visible drives */ DiskReportError(FALSE); DiskCount = 0; - + /* There are some really broken BIOSes out there. There are even BIOSes * that happily report success when you ask them to read from non-existent * harddisks. So, we set the buffer to known contents first, then try to @@ -357,9 +357,9 @@ DiskReportError(TRUE); TRACE("BIOS reports %d harddisk%s\n", (int)DiskCount, (DiskCount == 1) ? "": "s"); - + //DetectBiosFloppyController(BusKey); - + /* Allocate resource descriptor */ Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount; @@ -369,7 +369,7 @@ ERR("Failed to allocate resource descriptor\n"); return; } - + /* Initialize resource descriptor */ memset(PartialResourceList, 0, Size); PartialResourceList->Version = 1; @@ -380,7 +380,7 @@ PartialResourceList->PartialDescriptors[0].Flags = 0; PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize = sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount; - + /* Get harddisk Int13 geometry data */ Int13Drives = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST)); for (i = 0; i < DiskCount; i++) @@ -392,7 +392,7 @@ Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.Sectors; Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1; Int13Drives[i].NumberDrives = DiskCount; - + TRACE( "Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n", 0x80 + i, @@ -402,7 +402,7 @@ Geometry.BytesPerSector); } } - + FldrCreateComponentKey(BusKey, ControllerClass, DiskController, @@ -414,14 +414,12 @@ Size, &ControllerKey); TRACE("Created key: DiskController\0\n"); - + MmHeapFree(PartialResourceList); - + /* Create and fill subkey for each harddisk */ for (i = 0; i < DiskCount; i++) { - PCM_PARTIAL_RESOURCE_LIST PartialResourceList; - ULONG Size; CHAR Identifier[20];
/* Get disk values */
Modified: trunk/reactos/boot/freeldr/freeldr/debug.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/debug.... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/debug.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/debug.c [iso-8859-1] Sun Dec 16 14:23:05 2012 @@ -275,7 +275,7 @@ iLevel = TRACE_LEVEL; else return FALSE; - + if(strcmp(channel, "memory") == 0) iChannel = DPRINT_MEMORY; else if(strcmp(channel, "filesystem") == 0) iChannel = DPRINT_FILESYSTEM; else if(strcmp(channel, "inifile") == 0) iChannel = DPRINT_INIFILE; @@ -289,7 +289,7 @@ else if(strcmp(channel, "peloader") == 0) iChannel = DPRINT_PELOADER; else if(strcmp(channel, "scsiport") == 0) iChannel = DPRINT_SCSIPORT; else if(strcmp(channel, "heap") == 0) iChannel = DPRINT_HEAP; - else if(strcmp(channel, "all") == 0) + else if(strcmp(channel, "all") == 0) { int i;
@@ -309,7 +309,7 @@ DbgChannels[iChannel] |= iLevel; else DbgChannels[iChannel] &= ~iLevel; - + return TRUE; }
@@ -411,7 +411,7 @@ { if (Message) { - DbgPrint("Assertion '%s' failed at %s line %d: %s\n", + DbgPrint("Assertion '%s' failed at %s line %u: %s\n", (PCHAR)FailedAssertion, (PCHAR)FileName, LineNumber, @@ -419,7 +419,7 @@ } else { - DbgPrint("Assertion '%s' failed at %s line %d\n", + DbgPrint("Assertion '%s' failed at %s line %u\n", (PCHAR)FailedAssertion, (PCHAR)FileName, LineNumber);
Modified: trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/ntf... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c [iso-8859-1] Sun Dec 16 14:23:05 2012 @@ -66,7 +66,7 @@ DataRun++; for (i = 0; i < DataRunLengthSize; i++) { - *DataRunLength += *DataRun << (i << 3); + *DataRunLength += ((ULONG64)*DataRun) << (i * 8); DataRun++; }
@@ -79,11 +79,11 @@ { for (i = 0; i < DataRunOffsetSize - 1; i++) { - *DataRunOffset += *DataRun << (i << 3); + *DataRunOffset += ((ULONG64)*DataRun) << (i * 8); DataRun++; } /* The last byte contains sign so we must process it different way. */ - *DataRunOffset = ((CHAR)(*(DataRun++)) << (i << 3)) + *DataRunOffset; + *DataRunOffset = ((LONG64)(CHAR)(*(DataRun++)) << (i * 8)) + *DataRunOffset; }
TRACE("DataRunOffsetSize: %x\n", DataRunOffsetSize); @@ -387,7 +387,7 @@ ListBuffer = MmHeapAlloc((ULONG)ListSize); else ListBuffer = NULL; - + if(!ListBuffer) { TRACE("Failed to allocate memory: %x\n", (ULONG)ListSize); @@ -616,7 +616,7 @@ BitmapData = MmHeapAlloc((ULONG)BitmapDataSize); else BitmapData = NULL; - + if (BitmapData == NULL) { MmHeapFree(IndexRecord);
Modified: trunk/reactos/boot/freeldr/freeldr/include/winldr.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/winldr.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/winldr.h [iso-8859-1] Sun Dec 16 14:23:05 2012 @@ -86,7 +86,7 @@ // conversion.c PVOID VaToPa(PVOID Va); PVOID PaToVa(PVOID Pa); -VOID List_PaToVa(LIST_ENTRY *ListEntry); +VOID List_PaToVa(_In_ LIST_ENTRY *ListEntry); VOID ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start);
// peloader.c
Modified: trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inffil... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c [iso-8859-1] Sun Dec 16 14:23:05 2012 @@ -560,7 +560,7 @@ return p + 1;
default: - if (!isspace(*p)) + if (!isspace((unsigned char)*p)) { parser->start = p; set_state( parser, KEY_NAME ); @@ -633,7 +633,7 @@ set_state( parser, EOL_BACKSLASH ); return p; default: - if (!isspace(*p)) token_end = p + 1; + if (!isspace((unsigned char)*p)) token_end = p + 1; else { push_token( parser, p ); @@ -685,7 +685,7 @@ set_state( parser, EOL_BACKSLASH ); return p; default: - if (!isspace(*p)) token_end = p + 1; + if (!isspace((unsigned char)*p)) token_end = p + 1; else { push_token( parser, p ); @@ -730,7 +730,7 @@ return p + 1;
default: - if (isspace(*p)) + if (isspace((unsigned char)*p)) continue; push_token( parser, p ); pop_state( parser ); @@ -787,7 +787,7 @@ set_state( parser, EOL_BACKSLASH ); return p; } - if (!isspace(*p)) + if (!isspace((unsigned char)*p)) break; } parser->start = p; @@ -808,7 +808,7 @@ set_state( parser, EOL_BACKSLASH ); return p; } - if (!isspace(*p)) + if (!isspace((unsigned char)*p)) break; } pop_state( parser );
Modified: trunk/reactos/boot/freeldr/freeldr/version.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/versio... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/version.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/version.c [iso-8859-1] Sun Dec 16 14:23:05 2012 @@ -23,14 +23,11 @@
PCHAR GetFreeLoaderVersionString(VOID) { - if (FREELOADER_PATCH_VERSION == 0) - { - sprintf(FreeLoaderVersionString, "FreeLoader v%d.%d", FREELOADER_MAJOR_VERSION, FREELOADER_MINOR_VERSION); - } - else - { - sprintf(FreeLoaderVersionString, "FreeLoader v%d.%d.%d", FREELOADER_MAJOR_VERSION, FREELOADER_MINOR_VERSION, FREELOADER_PATCH_VERSION); - } +#if (FREELOADER_PATCH_VERSION == 0) + sprintf(FreeLoaderVersionString, "FreeLoader v%d.%d", FREELOADER_MAJOR_VERSION, FREELOADER_MINOR_VERSION); +#else + sprintf(FreeLoaderVersionString, "FreeLoader v%d.%d.%d", FREELOADER_MAJOR_VERSION, FREELOADER_MINOR_VERSION, FREELOADER_PATCH_VERSION); +#endif
return FreeLoaderVersionString; }
Modified: trunk/reactos/boot/freeldr/freeldr/windows/conversion.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/window... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/windows/conversion.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/windows/conversion.c [iso-8859-1] Sun Dec 16 14:23:05 2012 @@ -45,7 +45,7 @@ #endif
VOID -List_PaToVa(PLIST_ENTRY ListHeadPa) +List_PaToVa(_In_ PLIST_ENTRY ListHeadPa) { PLIST_ENTRY EntryPa, NextPa;