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>
#define FREE(Area) free(Area)
#define MALLOC(Size) malloc(Size)
#define ZEROMEMORY(Area, Size) memset((Area), '\0', (Size))
#define MEMCPY(Dest, Src, Size) memcpy((Dest), (Src), (Size))
#define MALLOC(Size) malloc((size_t)(Size))
#define ZEROMEMORY(Area, Size) memset((Area), '\0', (size_t)(Size))
#define MEMCPY(Dest, Src, Size) memcpy((Dest), (Src), (size_t)(Size))
#define INF_STATUS_SUCCESS 0
#define INF_STATUS_NO_MEMORY ENOMEM

View file

@ -100,7 +100,7 @@ InfHostOpenFile(PHINF InfHandle,
DPRINT("fopen() successful\n");
/* 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);
fclose(File);
@ -114,10 +114,10 @@ InfHostOpenFile(PHINF InfHandle,
fclose(File);
return -1;
}
DPRINT("File size: %lu\n", FileLength);
DPRINT("File size: %u\n", (UINT)FileLength);
/* Rewind */
if (fseek(File, 0, SEEK_SET))
if (fseek(File, (size_t)0, SEEK_SET))
{
DPRINT1("fseek() to BOF failed (errno %d)\n", errno);
fclose(File);
@ -134,7 +134,7 @@ InfHostOpenFile(PHINF InfHandle,
}
/* 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);
fclose(File);

View file

@ -43,7 +43,7 @@ InfHostWriteFile(HINF InfHandle, const CHAR *FileName,
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);
fclose(File);

View file

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