From 6469ecfb2b08408e2a37f52454fd3320c6d94f53 Mon Sep 17 00:00:00 2001 From: Stefan Ginsberg Date: Thu, 10 Sep 2009 17:41:44 +0000 Subject: [PATCH] - Fix various warnings in inflib (thanks to Ged for help with what appears to be a gcc bug in push_token) - Disable useless gcc warning in libjpeg - Fix a 64-bit warning in pefixup svn path=/trunk/; revision=43024 --- reactos/dll/3rdparty/libjpeg/libjpeg.rbuild | 1 + reactos/lib/inflib/infcore.c | 16 +++++++++++++--- reactos/lib/inflib/infget.c | 8 ++++---- reactos/lib/inflib/infpriv.h | 10 +++++----- reactos/lib/inflib/infput.c | 6 +++--- reactos/tools/pefixup.c | 3 ++- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/reactos/dll/3rdparty/libjpeg/libjpeg.rbuild b/reactos/dll/3rdparty/libjpeg/libjpeg.rbuild index e3083df6efe..990e595377f 100644 --- a/reactos/dll/3rdparty/libjpeg/libjpeg.rbuild +++ b/reactos/dll/3rdparty/libjpeg/libjpeg.rbuild @@ -1,6 +1,7 @@ + -Wno-main diff --git a/reactos/lib/inflib/infcore.c b/reactos/lib/inflib/infcore.c index 9662e9cf255..8bdffb76a47 100644 --- a/reactos/lib/inflib/infcore.c +++ b/reactos/lib/inflib/infcore.c @@ -48,7 +48,7 @@ struct parser PINFCACHESECTION cur_section; /* pointer to the section being parsed*/ PINFCACHELINE line; /* current line */ unsigned int line_pos; /* current line position in file */ - unsigned int error; /* error code */ + INFSTATUS error; /* error code */ unsigned int token_len; /* current token len */ TCHAR token[MAX_FIELD_LEN+1]; /* current token */ }; @@ -391,7 +391,17 @@ static int push_token( struct parser *parser, const CHAR *pos ) parser->token_len += len; for ( ; len > 0; len--, dst++, src++) - *dst = *src ? (TCHAR)*src : L' '; + { + if (*src) + { + *dst = *src; + } + else + { + *dst = _T(' '); + } + } + *dst = 0; parser->start = pos; @@ -808,7 +818,7 @@ InfpParseBuffer (PINFCACHE file, { if (error_line) *error_line = parser.line_pos; - return (INFSTATUS)parser.error; + return parser.error; } /* find the [strings] section */ diff --git a/reactos/lib/inflib/infget.c b/reactos/lib/inflib/infget.c index 87c0776ddc1..104cb3d1691 100644 --- a/reactos/lib/inflib/infget.c +++ b/reactos/lib/inflib/infget.c @@ -305,7 +305,7 @@ InfpGetIntField(PINFCONTEXT Context, Ptr = CacheField->Data; } - *IntegerValue = _tcstol(Ptr, NULL, 0); + *IntegerValue = (LONG)_tcstol(Ptr, NULL, 0); return INF_STATUS_SUCCESS; } @@ -348,7 +348,7 @@ InfpGetMultiSzField(PINFCONTEXT Context, Size = 0; while (FieldPtr != NULL) { - Size += (_tcslen (FieldPtr->Data) + 1); + Size += ((ULONG)_tcslen (FieldPtr->Data) + 1); FieldPtr = FieldPtr->Next; } Size++; @@ -366,7 +366,7 @@ InfpGetMultiSzField(PINFCONTEXT Context, FieldPtr = CacheField; while (FieldPtr != NULL) { - Size = _tcslen (FieldPtr->Data) + 1; + Size = (ULONG)_tcslen (FieldPtr->Data) + 1; _tcscpy (Ptr, FieldPtr->Data); @@ -420,7 +420,7 @@ InfpGetStringField(PINFCONTEXT Context, Ptr = CacheField->Data; } - Size = _tcslen (Ptr) + 1; + Size = (ULONG)_tcslen (Ptr) + 1; if (RequiredSize != NULL) *RequiredSize = Size; diff --git a/reactos/lib/inflib/infpriv.h b/reactos/lib/inflib/infpriv.h index 3446f8d3ce1..479651513c7 100644 --- a/reactos/lib/inflib/infpriv.h +++ b/reactos/lib/inflib/infpriv.h @@ -13,11 +13,11 @@ #define FIELD_OFFSET(t,f) ((ptrdiff_t)&(((t*)0)->f)) #endif -#define INF_STATUS_INSUFFICIENT_RESOURCES (0xC000009A) -#define INF_STATUS_BAD_SECTION_NAME_LINE (0xC0700001) -#define INF_STATUS_SECTION_NAME_TOO_LONG (0xC0700002) -#define INF_STATUS_WRONG_INF_STYLE (0xC0700003) -#define INF_STATUS_NOT_ENOUGH_MEMORY (0xC0700004) +#define INF_STATUS_INSUFFICIENT_RESOURCES ((INFSTATUS)0xC000009A) +#define INF_STATUS_BAD_SECTION_NAME_LINE ((INFSTATUS)0xC0700001) +#define INF_STATUS_SECTION_NAME_TOO_LONG ((INFSTATUS)0xC0700002) +#define INF_STATUS_WRONG_INF_STYLE ((INFSTATUS)0xC0700003) +#define INF_STATUS_NOT_ENOUGH_MEMORY ((INFSTATUS)0xC0700004) typedef struct _INFCACHEFIELD { diff --git a/reactos/lib/inflib/infput.c b/reactos/lib/inflib/infput.c index a970b3f7665..1d82fde1534 100644 --- a/reactos/lib/inflib/infput.c +++ b/reactos/lib/inflib/infput.c @@ -37,7 +37,7 @@ Output(POUTPUTBUFFER OutBuf, PCTSTR Text) } /* Doesn't fit? */ - Length = _tcslen(Text); + Length = (ULONG)_tcslen(Text); if (OutBuf->FreeSize < Length + 1 && INF_SUCCESS(OutBuf->Status)) { DPRINT("Out of free space. TotalSize %u FreeSize %u Length %u\n", @@ -145,8 +145,8 @@ InfpBuildFileBuffer(PINFCACHE Cache, NeedQuotes = FALSE; while (_T('\0') != *p && ! NeedQuotes) { - NeedQuotes = _T(',') == *p || _T(';') == *p || - _T('\\') == *p; + NeedQuotes = (BOOLEAN)(_T(',') == *p || _T(';') == *p || + _T('\\') == *p); p++; } if (NeedQuotes) diff --git a/reactos/tools/pefixup.c b/reactos/tools/pefixup.c index f26c2b7a396..8c0ca7a3288 100644 --- a/reactos/tools/pefixup.c +++ b/reactos/tools/pefixup.c @@ -39,6 +39,7 @@ typedef unsigned char BYTE, *PBYTE; typedef unsigned short WORD; typedef unsigned int DWORD; typedef int LONG; +typedef long LONG_PTR; #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 #define IMAGE_SIZEOF_SHORT_NAME 8 @@ -46,7 +47,7 @@ typedef int LONG; #define IMAGE_NT_SIGNATURE 0x00004550 #define IMAGE_SCN_MEM_DISCARDABLE 0x2000000 #define IMAGE_SCN_MEM_NOT_PAGED 0x8000000 -#define FIELD_OFFSET(t,f) ((LONG)&(((t*)0)->f)) +#define FIELD_OFFSET(t,f) ((LONG)(LONG_PTR)&(((t*)0)->f)) #define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((unsigned long)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader)) #define IMAGE_DIRECTORY_ENTRY_EXPORT 0