Get inflib_host to build warning-free

svn path=/trunk/; revision=32104
This commit is contained in:
Colin Finck 2008-02-03 13:36:10 +00:00
parent 720b53c4b2
commit bec6c89c6d
4 changed files with 15 additions and 15 deletions

View file

@ -16,9 +16,9 @@
#include <errno.h> #include <errno.h>
#define FREE(Area) free(Area) #define FREE(Area) free(Area)
#define MALLOC(Size) malloc(Size) #define MALLOC(Size) malloc((size_t)(Size))
#define ZEROMEMORY(Area, Size) memset((Area), '\0', (Size)) #define ZEROMEMORY(Area, Size) memset((Area), '\0', (size_t)(Size))
#define MEMCPY(Dest, Src, Size) memcpy((Dest), (Src), (Size)) #define MEMCPY(Dest, Src, Size) memcpy((Dest), (Src), (size_t)(Size))
#define INF_STATUS_SUCCESS 0 #define INF_STATUS_SUCCESS 0
#define INF_STATUS_NO_MEMORY ENOMEM #define INF_STATUS_NO_MEMORY ENOMEM

View file

@ -100,7 +100,7 @@ InfHostOpenFile(PHINF InfHandle,
DPRINT("fopen() successful\n"); DPRINT("fopen() successful\n");
/* Query file size */ /* Query file size */
if (fseek(File, 0, SEEK_END)) if (fseek(File, (size_t)0, SEEK_END))
{ {
DPRINT1("fseek() to EOF failed (errno %d)\n", errno); DPRINT1("fseek() to EOF failed (errno %d)\n", errno);
fclose(File); fclose(File);
@ -114,10 +114,10 @@ InfHostOpenFile(PHINF InfHandle,
fclose(File); fclose(File);
return -1; return -1;
} }
DPRINT("File size: %lu\n", FileLength); DPRINT("File size: %u\n", (UINT)FileLength);
/* Rewind */ /* Rewind */
if (fseek(File, 0, SEEK_SET)) if (fseek(File, (size_t)0, SEEK_SET))
{ {
DPRINT1("fseek() to BOF failed (errno %d)\n", errno); DPRINT1("fseek() to BOF failed (errno %d)\n", errno);
fclose(File); fclose(File);
@ -134,7 +134,7 @@ InfHostOpenFile(PHINF InfHandle,
} }
/* Read file */ /* Read file */
if (FileLength != fread(FileBuffer, 1, FileLength, File)) if (FileLength != fread(FileBuffer, (size_t)1, (size_t)FileLength, File))
{ {
DPRINT1("fread() failed (errno %d)\n", errno); DPRINT1("fread() failed (errno %d)\n", errno);
fclose(File); fclose(File);

View file

@ -43,7 +43,7 @@ InfHostWriteFile(HINF InfHandle, const CHAR *FileName,
fprintf(File, "; %s\r\n\r\n", HeaderComment); fprintf(File, "; %s\r\n\r\n", HeaderComment);
} }
if (BufferSize != fwrite(Buffer, 1, BufferSize, File)) if (BufferSize != fwrite(Buffer, (size_t)1, (size_t)BufferSize, File))
{ {
DPRINT1("fwrite() failed (errno %d)\n", errno); DPRINT1("fwrite() failed (errno %d)\n", errno);
fclose(File); fclose(File);

View file

@ -40,13 +40,13 @@ Output(POUTPUTBUFFER OutBuf, PCTSTR Text)
Length = _tcslen(Text); Length = _tcslen(Text);
if (OutBuf->FreeSize < Length + 1 && INF_SUCCESS(OutBuf->Status)) if (OutBuf->FreeSize < Length + 1 && INF_SUCCESS(OutBuf->Status))
{ {
DPRINT("Out of free space. TotalSize %lu FreeSize %lu Length %u\n", DPRINT("Out of free space. TotalSize %u FreeSize %u Length %u\n",
OutBuf->TotalSize, OutBuf->FreeSize, Length); (UINT)OutBuf->TotalSize, (UINT)OutBuf->FreeSize, (UINT)Length);
/* Round up to next SIZE_INC */ /* Round up to next SIZE_INC */
NewSize = OutBuf->TotalSize + NewSize = OutBuf->TotalSize +
(((Length + 1) - OutBuf->FreeSize + (SIZE_INC - 1)) / (((Length + 1) - OutBuf->FreeSize + (SIZE_INC - 1)) /
SIZE_INC) * SIZE_INC; SIZE_INC) * SIZE_INC;
DPRINT("NewSize %lu\n", NewSize); DPRINT("NewSize %u\n", (UINT)NewSize);
NewBuf = MALLOC(NewSize); NewBuf = MALLOC(NewSize);
/* Abort if failed */ /* Abort if failed */
if (NULL == NewBuf) if (NULL == NewBuf)
@ -59,8 +59,8 @@ Output(POUTPUTBUFFER OutBuf, PCTSTR Text)
/* Need to copy old contents? */ /* Need to copy old contents? */
if (NULL != OutBuf->Buffer) if (NULL != OutBuf->Buffer)
{ {
DPRINT("Copying %lu bytes from old content\n", DPRINT("Copying %u bytes from old content\n",
OutBuf->TotalSize - OutBuf->FreeSize); (UINT)(OutBuf->TotalSize - OutBuf->FreeSize));
MEMCPY(NewBuf, OutBuf->Buffer, OutBuf->TotalSize - OutBuf->FreeSize); MEMCPY(NewBuf, OutBuf->Buffer, OutBuf->TotalSize - OutBuf->FreeSize);
OutBuf->Current = NewBuf + (OutBuf->Current - OutBuf->Buffer); OutBuf->Current = NewBuf + (OutBuf->Current - OutBuf->Buffer);
FREE(OutBuf->Buffer); FREE(OutBuf->Buffer);
@ -72,8 +72,8 @@ Output(POUTPUTBUFFER OutBuf, PCTSTR Text)
OutBuf->Buffer = NewBuf; OutBuf->Buffer = NewBuf;
OutBuf->FreeSize += NewSize - OutBuf->TotalSize; OutBuf->FreeSize += NewSize - OutBuf->TotalSize;
OutBuf->TotalSize = NewSize; OutBuf->TotalSize = NewSize;
DPRINT("After reallocation TotalSize %lu FreeSize %lu\n", DPRINT("After reallocation TotalSize %u FreeSize %u\n",
OutBuf->TotalSize, OutBuf->FreeSize); (UINT)OutBuf->TotalSize, (UINT)OutBuf->FreeSize);
} }
/* We're guaranteed to have enough room now. Copy char by char because of /* We're guaranteed to have enough room now. Copy char by char because of