#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "../pecoff.h"
+#include <typedefs.h>
+#include <pecoff.h>
static
void
break;
default:
- printf("Unknown relocatation type %ld address %ld\n",
- pReloc->Type, pReloc->VirtualAddress);
+ printf("Unknown relocation type %u, address 0x%x\n",
+ pReloc->Type, (unsigned)pReloc->VirtualAddress);
}
pReloc++;
if (!pData)
{
fclose(pSourceFile);
- fprintf(stderr, "Failed to allocate %ld bytes\n", nFileSize);
+ fprintf(stderr, "Failed to allocate %lu bytes\n", nFileSize);
return -3;
}
{
free(pData);
fclose(pSourceFile);
- fprintf(stderr, "Failed to read source file: %ld\n", nFileSize);
+ fprintf(stderr, "Failed to read %lu bytes from source file\n", nFileSize);
return -4;
}
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;
}
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,
{
free(pData);
fclose(pDestFile);
- fprintf(stderr, "Failed to write data %ld\n",
- pSectionHeader->SizeOfRawData);
+ fprintf(stderr, "Failed to write %u bytes to destination file\n",
+ (unsigned int)pSectionHeader->SizeOfRawData);
return -6;
}
return 0;
}
-