Fix gcc 4.0 warnings.

This commit is contained in:
Mike McCormack 2005-09-08 11:04:53 +00:00 committed by Alexandre Julliard
parent b4c69e0f12
commit fe1ec78841
3 changed files with 44 additions and 38 deletions

View File

@ -72,31 +72,33 @@ static struct {
*/
static HRESULT AVIFILE_CLSIDFromString(LPCSTR idstr, LPCLSID id)
{
BYTE const *s = (BYTE const*)idstr;
BYTE const *s;
BYTE *p;
INT i;
BYTE table[256];
if (!s) {
if (!idstr) {
memset(id, 0, sizeof(CLSID));
return S_OK;
} else { /* validate the CLSID string */
if (lstrlenA(s) != 38)
return CO_E_CLASSSTRING;
}
if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') ||
(s[24]!='-') || (s[37]!='}'))
return CO_E_CLASSSTRING;
/* validate the CLSID string */
if (lstrlenA(idstr) != 38)
return CO_E_CLASSSTRING;
for (i = 1; i < 37; i++) {
if ((i == 9) || (i == 14) || (i == 19) || (i == 24))
continue;
if (!(((s[i] >= '0') && (s[i] <= '9')) ||
((s[i] >= 'a') && (s[i] <= 'f')) ||
((s[i] >= 'A') && (s[i] <= 'F')))
)
return CO_E_CLASSSTRING;
}
s = (BYTE const*)idstr;
if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') ||
(s[24]!='-') || (s[37]!='}'))
return CO_E_CLASSSTRING;
for (i = 1; i < 37; i++) {
if ((i == 9) || (i == 14) || (i == 19) || (i == 24))
continue;
if (!(((s[i] >= '0') && (s[i] <= '9')) ||
((s[i] >= 'a') && (s[i] <= 'f')) ||
((s[i] >= 'A') && (s[i] <= 'F')))
)
return CO_E_CLASSSTRING;
}
TRACE("%s -> %p\n", s, id);

View File

@ -72,6 +72,12 @@ BOOL WINAPI cdtInit(int *width, int *height)
return TRUE;
}
static DWORD do_blt(HDC hdc, int x, int y, int dx, int dy, HDC hMemoryDC, DWORD rasterOp )
{
if((cardWidth == dx) && (cardHeight == dy))
return BitBlt(hdc, x, y, cardWidth, cardHeight, hMemoryDC, 0, 0, rasterOp);
return StretchBlt(hdc, x, y, dx, dy, hMemoryDC, 0, 0, cardWidth, cardHeight, rasterOp);
}
/***********************************************************************
* Draw a card. Unlike cdtDrawCard, this version allows you to stretch
@ -85,7 +91,6 @@ BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int mode
HGDIOBJ result;
DWORD rasterOp = SRCCOPY;
BOOL roundCornersFlag;
COLORREF savedPixels[12];
BOOL eraseFlag = FALSE;
BOOL drawFlag = TRUE;
@ -170,6 +175,8 @@ BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int mode
if(roundCornersFlag)
{
COLORREF savedPixels[12];
savedPixels[0] = GetPixel(hdc, x, y);
savedPixels[1] = GetPixel(hdc, x + 1, y);
savedPixels[2] = GetPixel(hdc, x, y + 1);
@ -182,15 +189,9 @@ BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int mode
savedPixels[9] = GetPixel(hdc, x + dx - 1, y + dy - 1);
savedPixels[10] = GetPixel(hdc, x + dx - 2, y + dy - 1);
savedPixels[11] = GetPixel(hdc, x + dx - 1, y + dy - 2);
}
if((cardWidth == dx) && (cardHeight == dy))
BitBlt(hdc, x, y, cardWidth, cardHeight, hMemoryDC, 0, 0, rasterOp);
else
StretchBlt(hdc, x, y, dx, dy, hMemoryDC, 0, 0, cardWidth, cardHeight, rasterOp);
do_blt(hdc, x, y, dx, dy, hMemoryDC, rasterOp);
if(roundCornersFlag)
{
SetPixel(hdc, x, y, savedPixels[0]);
SetPixel(hdc, x + 1, y, savedPixels[1]);
SetPixel(hdc, x, y + 1, savedPixels[2]);
@ -204,6 +205,8 @@ BOOL WINAPI cdtDrawExt(HDC hdc, int x, int y, int dx, int dy, int card, int mode
SetPixel(hdc, x + dx - 2, y + dy - 1, savedPixels[10]);
SetPixel(hdc, x + dx - 1, y + dy - 2, savedPixels[11]);
}
else
do_blt(hdc, x, y, dx, dy, hMemoryDC, rasterOp);
}
DeleteDC(hMemoryDC);

View File

@ -172,7 +172,7 @@ static const IMAGE_DOS_HEADER *find_dll_descr( const char *dllname, const char *
/* check the dll file name */
if (!NE_strcasecmp( builtin_dlls[i].file_name, dllname ) ||
/* check the dll module name (without extension) */
(!NE_strncasecmp( dllname, name_table+1, *name_table ) &&
(!NE_strncasecmp( dllname, (const char*)name_table+1, *name_table ) &&
!strcmp( dllname + *name_table, ".dll" )))
{
*file_name = builtin_dlls[i].file_name;
@ -311,7 +311,7 @@ void NE_DumpModule( HMODULE16 hModule )
/* Dump the resident name table */
DPRINTF( "---\n" );
DPRINTF( "Resident-name table:\n" );
pstr = (char *)pModule + pModule->ne_restab;
pstr = (BYTE*) pModule + pModule->ne_restab;
while (*pstr)
{
DPRINTF( "%*.*s: %d\n", *pstr, *pstr, pstr + 1,
@ -357,7 +357,7 @@ void NE_DumpModule( HMODULE16 hModule )
DPRINTF( "Non-resident names table:\n" );
if (pModule->nrname_handle)
{
pstr = (char *)GlobalLock16( pModule->nrname_handle );
pstr = GlobalLock16( pModule->nrname_handle );
while (*pstr)
{
DPRINTF( "%*.*s: %d\n", *pstr, *pstr, pstr + 1,
@ -428,7 +428,8 @@ static void NE_InitResourceHandler( HMODULE16 hModule )
*/
WORD NE_GetOrdinal( HMODULE16 hModule, const char *name )
{
unsigned char buffer[256], *cpnt;
char buffer[256], *p;
BYTE *cpnt;
BYTE len;
NE_MODULE *pModule;
@ -444,18 +445,18 @@ WORD NE_GetOrdinal( HMODULE16 hModule, const char *name )
/* Now copy and uppercase the string */
strcpy( buffer, name );
for (cpnt = buffer; *cpnt; cpnt++) *cpnt = RtlUpperChar(*cpnt);
len = cpnt - buffer;
for (p = buffer; *p; p++) *p = RtlUpperChar(*p);
len = p - buffer;
/* First search the resident names */
cpnt = (char *)pModule + pModule->ne_restab;
cpnt = (BYTE *)pModule + pModule->ne_restab;
/* Skip the first entry (module name) */
cpnt += *cpnt + 1 + sizeof(WORD);
while (*cpnt)
{
if (((BYTE)*cpnt == len) && !memcmp( cpnt+1, buffer, len ))
if ((*cpnt == len) && !memcmp( cpnt+1, buffer, len ))
{
WORD ordinal;
memcpy( &ordinal, cpnt + *cpnt + 1, sizeof(ordinal) );
@ -468,13 +469,13 @@ WORD NE_GetOrdinal( HMODULE16 hModule, const char *name )
/* Now search the non-resident names table */
if (!pModule->nrname_handle) return 0; /* No non-resident table */
cpnt = (char *)GlobalLock16( pModule->nrname_handle );
cpnt = GlobalLock16( pModule->nrname_handle );
/* Skip the first entry (module description string) */
cpnt += *cpnt + 1 + sizeof(WORD);
while (*cpnt)
{
if (((BYTE)*cpnt == len) && !memcmp( cpnt+1, buffer, len ))
if ((*cpnt == len) && !memcmp( cpnt+1, buffer, len ))
{
WORD ordinal;
memcpy( &ordinal, cpnt + *cpnt + 1, sizeof(ordinal) );
@ -1491,7 +1492,7 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
if (pModule->ne_flags & NE_FFLAGS_WIN32) continue;
name_table = (BYTE *)pModule + pModule->ne_restab;
if ((*name_table == len) && !strncmp(name, name_table+1, len))
if ((*name_table == len) && !strncmp(name, (char*) name_table+1, len))
return hModule;
}
@ -1513,7 +1514,7 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
* 'i' compare is just a quickfix until the loader handles that
* correctly. -MM 990705
*/
if ((*name_table == len) && !NE_strncasecmp(tmpstr, name_table+1, len))
if ((*name_table == len) && !NE_strncasecmp(tmpstr, (const char*)name_table+1, len))
return hModule;
}
@ -1865,7 +1866,7 @@ static HMODULE16 NE_GetModuleByFilename( LPCSTR name )
if (pModule->ne_flags & NE_FFLAGS_WIN32) continue;
name_table = (BYTE *)pModule + pModule->ne_restab;
if ((*name_table == len) && !NE_strncasecmp(s, name_table+1, len))
if ((*name_table == len) && !NE_strncasecmp(s, (const char*)name_table+1, len))
return hModule;
}