Fix some compiler warnings, improve formatting, diagnostic messages.

svn path=/trunk/; revision=58591
This commit is contained in:
Dmitry Gorbachev 2013-03-23 17:59:35 +00:00
parent fad117e7de
commit 99afe97aa2
6 changed files with 48 additions and 43 deletions

View file

@ -1,4 +1,6 @@
/*
* Generates assembly definitions from the target headers.
*/
#include <stdio.h>
#include <stdlib.h>
@ -104,7 +106,7 @@ int main(int argc, char* argv[])
/* Verify the PE signature */
if (signature != 0x4550)
{
fprintf(stderr, "Invalid signature: 0x%lx.\n", signature);
fprintf(stderr, "Invalid signature: 0x%x.\n", signature);
goto quit;
}

View file

@ -430,7 +430,7 @@ registry_callback (HINF hInf, PWCHAR Section, BOOL Delete)
else
{
/* get flags */
if (InfHostGetIntField (Context, 4, &Flags) != 0)
if (InfHostGetIntField (Context, 4, (INT *)&Flags) != 0)
Flags = 0;
}

View file

@ -562,6 +562,8 @@ RegQueryValueExA(
rc = RegQueryValueExW(hKey, lpValueNameW, lpReserved, lpType, lpData, lpcbData);
if (lpValueNameW)
free(lpValueNameW);
if (rc != ERROR_SUCCESS)
return rc;
return ERROR_UNSUCCESSFUL;
}

View file

@ -6,6 +6,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifndef _MSC_VER
@ -19,7 +20,8 @@ typedef unsigned __int32 uint32_t;
#define SW_SHOWNORMAL 1
#define SW_SHOWMINNOACTIVE 7
typedef struct _GUID {
typedef struct _GUID
{
uint32_t Data1;
uint16_t Data2;
uint16_t Data3;
@ -167,7 +169,7 @@ int main(int argc, const char *argv[])
{
unsigned Data4Tmp[8], j;
sscanf(argv[++i], "{%8lx-%4hx-%4hx-%2x%2x-%2x%2x%2x%2x%2x%2x}",
sscanf(argv[++i], "{%8x-%4hx-%4hx-%2x%2x-%2x%2x%2x%2x%2x%2x}",
&Guid.Data1, &Guid.Data2, &Guid.Data3,
&Data4Tmp[0], &Data4Tmp[1], &Data4Tmp[2], &Data4Tmp[3],
&Data4Tmp[4], &Data4Tmp[5], &Data4Tmp[6], &Data4Tmp[7]);

View file

@ -51,7 +51,7 @@ RelocateSection(
break;
default:
printf("Unknown relocatation type %ld address %ld\n",
printf("Unknown relocatation type %d, address 0x%lx\n",
pReloc->Type, pReloc->VirtualAddress);
}
@ -107,7 +107,7 @@ int main(int argc, char *argv[])
{
free(pData);
fclose(pSourceFile);
fprintf(stderr, "Failed to read source file: %ld\n", nFileSize);
fprintf(stderr, "Failed to read %ld bytes from source file\n", nFileSize);
return -4;
}
@ -119,7 +119,7 @@ int main(int argc, char *argv[])
if (!pDestFile)
{
free(pData);
fprintf(stderr, "Couldn't open dest file '%s'\n", pszDestFile);
fprintf(stderr, "Couldn't open destination file '%s'\n", pszDestFile);
return -5;
}
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
for (i = 0; i < pFileHeader->NumberOfSections; i++)
{
/* Check if this is '.text' section */
if ((strcmp(pSectionHeader->Name, ".text") == 0) &&
if ((strcmp((char*)pSectionHeader->Name, ".text") == 0) &&
(pSectionHeader->SizeOfRawData != 0))
{
RelocateSection(pData,
@ -146,7 +146,7 @@ int main(int argc, char *argv[])
{
free(pData);
fclose(pDestFile);
fprintf(stderr, "Failed to write data %ld\n",
fprintf(stderr, "Failed to write %ld bytes to destination file\n",
pSectionHeader->SizeOfRawData);
return -6;
}
@ -162,4 +162,3 @@ int main(int argc, char *argv[])
return 0;
}

View file

@ -528,7 +528,7 @@ CreateOutputFile(FILE *OutFile, void *InData,
if ((0 == StartOfRawData
|| InSectionHeaders[Section].PointerToRawData < StartOfRawData)
&& 0 != InSectionHeaders[Section].PointerToRawData
&& 0 != (strncmp(InSectionHeaders[Section].Name, ".stab", 5)))
&& 0 != (strncmp((char *) InSectionHeaders[Section].Name, ".stab", 5)))
{
StartOfRawData = InSectionHeaders[Section].PointerToRawData;
}
@ -580,7 +580,7 @@ CreateOutputFile(FILE *OutFile, void *InData,
OutRelocSection = NULL;
for (Section = 0; Section < InFileHeader->NumberOfSections; Section++)
{
if (0 != (strncmp(InSectionHeaders[Section].Name, ".stab", 5)))
if (0 != (strncmp((char *) InSectionHeaders[Section].Name, ".stab", 5)))
{
*CurrentSectionHeader = InSectionHeaders[Section];
CurrentSectionHeader->PointerToLinenumbers = 0;