kernel: Constify some formal parameters.

This commit is contained in:
Andrew Talbot 2006-08-30 22:24:28 +01:00 committed by Alexandre Julliard
parent d998543edb
commit a5bf67ef9b
2 changed files with 95 additions and 95 deletions

View File

@ -388,10 +388,10 @@ FARPROC16 WINAPI SetResourceHandler16( HMODULE16 hModule, LPCSTR typeId, FARPROC
return prevHandler; return prevHandler;
} }
static inline DWORD get_dword(LPVOID *p) static inline DWORD get_dword(LPCVOID *p)
{ {
DWORD ret = *(DWORD*)*p; DWORD ret = *(const DWORD *)*p;
*p = (DWORD *)*p + 1; *p = (const DWORD *)*p + 1;
return ret; return ret;
} }
@ -401,10 +401,10 @@ static inline void put_dword(LPVOID *p, DWORD d)
*p = (DWORD *)*p + 1; *p = (DWORD *)*p + 1;
} }
static inline WORD get_word(LPVOID *p) static inline WORD get_word(LPCVOID *p)
{ {
WORD ret = *(WORD*)*p; WORD ret = *(const WORD *)*p;
*p = (WORD *)*p + 1; *p = (const WORD *)*p + 1;
return ret; return ret;
} }
@ -414,10 +414,10 @@ static inline void put_word(LPVOID *p, WORD w)
*p = (WORD *)*p + 1; *p = (WORD *)*p + 1;
} }
static inline BYTE get_byte(LPVOID *p) static inline BYTE get_byte(LPCVOID *p)
{ {
BYTE ret = *(BYTE *)*p; BYTE ret = *(const BYTE *)*p;
*p = (BYTE *)*p + 1; *p = (const BYTE *)*p + 1;
return ret; return ret;
} }
@ -428,10 +428,10 @@ static inline void put_byte(LPVOID *p, BYTE b)
} }
/* convert a resource name */ /* convert a resource name */
static void convert_name( LPVOID *dst, LPVOID *src ) static void convert_name( LPVOID *dst, LPCVOID *src )
{ {
int len; int len;
switch (*((WORD *)*src)) switch (*(const WORD *)*src)
{ {
case 0x0000: case 0x0000:
get_word( src ); get_word( src );
@ -445,7 +445,7 @@ static void convert_name( LPVOID *dst, LPVOID *src )
default: default:
len = WideCharToMultiByte( CP_ACP, 0, *src, -1, *dst, 0x7fffffff, NULL,NULL ); len = WideCharToMultiByte( CP_ACP, 0, *src, -1, *dst, 0x7fffffff, NULL,NULL );
*dst = (char *)*dst + len; *dst = (char *)*dst + len;
*src = (WCHAR *)*src + strlenW( (WCHAR *)*src ) + 1; *src = (LPCWSTR)*src + strlenW( *src ) + 1;
break; break;
} }
} }
@ -453,7 +453,7 @@ static void convert_name( LPVOID *dst, LPVOID *src )
/********************************************************************** /**********************************************************************
* ConvertDialog32To16 (KERNEL.615) * ConvertDialog32To16 (KERNEL.615)
*/ */
VOID WINAPI ConvertDialog32To16( LPVOID dialog32, DWORD size, LPVOID dialog16 ) VOID WINAPI ConvertDialog32To16( LPCVOID dialog32, DWORD size, LPVOID dialog16 )
{ {
WORD nbItems, data, dialogEx; WORD nbItems, data, dialogEx;
DWORD style; DWORD style;
@ -469,7 +469,7 @@ VOID WINAPI ConvertDialog32To16( LPVOID dialog32, DWORD size, LPVOID dialog16 )
put_dword( &dialog16, style ); /* style */ put_dword( &dialog16, style ); /* style */
} }
else else
dialog32 = (DWORD *)dialog32 + 1; /* exStyle ignored in 16-bit standard dialog */ dialog32 = (const DWORD *)dialog32 + 1; /* exStyle ignored in 16-bit standard dialog */
nbItems = get_word( &dialog32 ); nbItems = get_word( &dialog32 );
put_byte( &dialog16, nbItems ); put_byte( &dialog16, nbItems );
@ -486,8 +486,8 @@ VOID WINAPI ConvertDialog32To16( LPVOID dialog32, DWORD size, LPVOID dialog16 )
/* Transfer window caption */ /* Transfer window caption */
WideCharToMultiByte( CP_ACP, 0, dialog32, -1, dialog16, 0x7fffffff, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, dialog32, -1, dialog16, 0x7fffffff, NULL, NULL );
dialog16 = (LPSTR)dialog16 + strlen( (LPSTR)dialog16 ) + 1; dialog16 = (LPSTR)dialog16 + strlen( dialog16 ) + 1;
dialog32 = (LPWSTR)dialog32 + strlenW( (LPWSTR)dialog32 ) + 1; dialog32 = (LPCWSTR)dialog32 + strlenW( dialog32 ) + 1;
/* Transfer font info */ /* Transfer font info */
if (style & DS_SETFONT) if (style & DS_SETFONT)
@ -498,16 +498,16 @@ VOID WINAPI ConvertDialog32To16( LPVOID dialog32, DWORD size, LPVOID dialog16 )
put_word( &dialog16, get_word( &dialog32 ) ); /* weight */ put_word( &dialog16, get_word( &dialog32 ) ); /* weight */
put_word( &dialog16, get_word( &dialog32 ) ); /* italic */ put_word( &dialog16, get_word( &dialog32 ) ); /* italic */
} }
WideCharToMultiByte( CP_ACP, 0, (LPWSTR)dialog32, -1, (LPSTR)dialog16, 0x7fffffff, NULL, NULL ); /* faceName */ WideCharToMultiByte( CP_ACP, 0, dialog32, -1, dialog16, 0x7fffffff, NULL, NULL ); /* faceName */
dialog16 = (LPSTR)dialog16 + strlen( (LPSTR)dialog16 ) + 1; dialog16 = (LPSTR)dialog16 + strlen( dialog16 ) + 1;
dialog32 = (LPWSTR)dialog32 + strlenW( (LPWSTR)dialog32 ) + 1; dialog32 = (LPCWSTR)dialog32 + strlenW( dialog32 ) + 1;
} }
/* Transfer dialog items */ /* Transfer dialog items */
while (nbItems) while (nbItems)
{ {
/* align on DWORD boundary (32-bit only) */ /* align on DWORD boundary (32-bit only) */
dialog32 = (LPVOID)(((UINT_PTR)dialog32 + 3) & ~3); dialog32 = (LPCVOID)(((UINT_PTR)dialog32 + 3) & ~3);
if (dialogEx) if (dialogEx)
{ {
@ -517,8 +517,8 @@ VOID WINAPI ConvertDialog32To16( LPVOID dialog32, DWORD size, LPVOID dialog16 )
} }
else else
{ {
style = get_dword( &dialog32 ); /* save style */ style = get_dword( &dialog32 ); /* save style */
dialog32 = (DWORD *)dialog32 + 1; /* ignore exStyle */ dialog32 = (const DWORD *)dialog32 + 1; /* ignore exStyle */
} }
put_word( &dialog16, get_word( &dialog32 ) ); /* x */ put_word( &dialog16, get_word( &dialog32 ) ); /* x */
@ -535,7 +535,7 @@ VOID WINAPI ConvertDialog32To16( LPVOID dialog32, DWORD size, LPVOID dialog16 )
} }
/* Transfer class name */ /* Transfer class name */
switch (*(WORD *)dialog32) switch (*(const WORD *)dialog32)
{ {
case 0x0000: case 0x0000:
get_word( &dialog32 ); get_word( &dialog32 );
@ -546,9 +546,9 @@ VOID WINAPI ConvertDialog32To16( LPVOID dialog32, DWORD size, LPVOID dialog16 )
put_byte( &dialog16, get_word( &dialog32 ) ); put_byte( &dialog16, get_word( &dialog32 ) );
break; break;
default: default:
WideCharToMultiByte( CP_ACP, 0, (LPWSTR)dialog32, -1, (LPSTR)dialog16, 0x7fffffff, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, dialog32, -1, dialog16, 0x7fffffff, NULL, NULL );
dialog16 = (LPSTR)dialog16 + strlen( (LPSTR)dialog16 ) + 1; dialog16 = (LPSTR)dialog16 + strlen( dialog16 ) + 1;
dialog32 = (LPWSTR)dialog32 + strlenW( (LPWSTR)dialog32 ) + 1; dialog32 = (LPCWSTR)dialog32 + strlenW( dialog32 ) + 1;
break; break;
} }
@ -566,7 +566,7 @@ VOID WINAPI ConvertDialog32To16( LPVOID dialog32, DWORD size, LPVOID dialog16 )
{ {
memcpy( dialog16, dialog32, data ); memcpy( dialog16, dialog32, data );
dialog16 = (BYTE *)dialog16 + data; dialog16 = (BYTE *)dialog16 + data;
dialog32 = (BYTE *)dialog32 + data; dialog32 = (const BYTE *)dialog32 + data;
} }
/* Next item */ /* Next item */
@ -578,9 +578,9 @@ VOID WINAPI ConvertDialog32To16( LPVOID dialog32, DWORD size, LPVOID dialog16 )
/********************************************************************** /**********************************************************************
* GetDialog32Size (KERNEL.618) * GetDialog32Size (KERNEL.618)
*/ */
WORD WINAPI GetDialog32Size16( LPVOID dialog32 ) WORD WINAPI GetDialog32Size16( LPCVOID dialog32 )
{ {
LPVOID p = dialog32; LPCVOID p = dialog32;
WORD nbItems, data, dialogEx; WORD nbItems, data, dialogEx;
DWORD style; DWORD style;
@ -588,110 +588,110 @@ WORD WINAPI GetDialog32Size16( LPVOID dialog32 )
dialogEx = (style == 0xffff0001); /* DIALOGEX resource */ dialogEx = (style == 0xffff0001); /* DIALOGEX resource */
if (dialogEx) if (dialogEx)
{ {
p = (DWORD *)p + 1; /* helpID */ p = (const DWORD *)p + 1; /* helpID */
p = (DWORD *)p + 1; /* exStyle */ p = (const DWORD *)p + 1; /* exStyle */
style = get_dword(&p); /* style */ style = get_dword(&p); /* style */
} }
else else
p = (DWORD *)p + 1; /* exStyle */ p = (const DWORD *)p + 1; /* exStyle */
nbItems = get_word(&p); nbItems = get_word(&p);
p = (WORD *)p + 1; /* x */ p = (const DWORD *)p + 1; /* x */
p = (WORD *)p + 1; /* y */ p = (const DWORD *)p + 1; /* y */
p = (WORD *)p + 1; /* cx */ p = (const DWORD *)p + 1; /* cx */
p = (WORD *)p + 1; /* cy */ p = (const DWORD *)p + 1; /* cy */
/* Skip menu name */ /* Skip menu name */
switch (*((WORD *)p)) switch (*(const DWORD *)p)
{ {
case 0x0000: p = (WORD *)p + 1; break; case 0x0000: p = (const DWORD *)p + 1; break;
case 0xffff: p = (WORD *)p + 2; break; case 0xffff: p = (const DWORD *)p + 2; break;
default: p = (LPWSTR)p + strlenW( (LPWSTR)p ) + 1; break; default: p = (LPCWSTR)p + strlenW( p ) + 1; break;
} }
/* Skip class name */ /* Skip class name */
switch (*((WORD *)p)) switch (*(const DWORD *)p)
{ {
case 0x0000: p = (WORD *)p + 1; break; case 0x0000: p = (const DWORD *)p + 1; break;
case 0xffff: p = (WORD *)p + 2; break; case 0xffff: p = (const DWORD *)p + 2; break;
default: p = (LPWSTR)p + strlenW( (LPWSTR)p ) + 1; break; default: p = (LPCWSTR)p + strlenW( p ) + 1; break;
} }
/* Skip window caption */ /* Skip window caption */
p = (LPWSTR)p + strlenW( (LPWSTR)p ) + 1; p = (LPCWSTR)p + strlenW( p ) + 1;
/* Skip font info */ /* Skip font info */
if (style & DS_SETFONT) if (style & DS_SETFONT)
{ {
p = (WORD *)p + 1; /* pointSize */ p = (const DWORD *)p + 1; /* pointSize */
if (dialogEx) if (dialogEx)
{ {
p = (WORD *)p + 1; /* weight */ p = (const DWORD *)p + 1; /* weight */
p = (WORD *)p + 1; /* italic */ p = (const DWORD *)p + 1; /* italic */
} }
p = (LPWSTR)p + strlenW( (LPWSTR)p ) + 1; /* faceName */ p = (LPCWSTR)p + strlenW( p ) + 1; /* faceName */
} }
/* Skip dialog items */ /* Skip dialog items */
while (nbItems) while (nbItems)
{ {
/* align on DWORD boundary */ /* align on DWORD boundary */
p = (LPVOID)(((UINT_PTR)p + 3) & ~3); p = (LPCVOID)(((UINT_PTR)p + 3) & ~3);
if (dialogEx) if (dialogEx)
{ {
p = (DWORD *)p + 1; /* helpID */ p = (const DWORD *)p + 1; /* helpID */
p = (DWORD *)p + 1; /* exStyle */ p = (const DWORD *)p + 1; /* exStyle */
p = (DWORD *)p + 1; /* style */ p = (const DWORD *)p + 1; /* style */
} }
else else
{ {
p = (DWORD *)p + 1; /* style */ p = (const DWORD *)p + 1; /* style */
p = (DWORD *)p + 1; /* exStyle */ p = (const DWORD *)p + 1; /* exStyle */
} }
p = (WORD *)p + 1; /* x */ p = (const DWORD *)p + 1; /* x */
p = (WORD *)p + 1; /* y */ p = (const DWORD *)p + 1; /* y */
p = (WORD *)p + 1; /* cx */ p = (const DWORD *)p + 1; /* cx */
p = (WORD *)p + 1; /* cy */ p = (const DWORD *)p + 1; /* cy */
if (dialogEx) if (dialogEx)
p = (DWORD *)p + 1; /* ID */ p = (const DWORD *)p + 1; /* ID */
else else
p = (WORD *)p + 1; /* ID */ p = (const DWORD *)p + 1; /* ID */
/* Skip class name */ /* Skip class name */
switch (*((WORD *)p)) switch (*(const DWORD *)p)
{ {
case 0x0000: p = (WORD *)p + 1; break; case 0x0000: p = (const DWORD *)p + 1; break;
case 0xffff: p = (WORD *)p + 2; break; case 0xffff: p = (const DWORD *)p + 2; break;
default: p = (LPWSTR)p + strlenW( (LPWSTR)p ) + 1; break; default: p = (LPCWSTR)p + strlenW( p ) + 1; break;
} }
/* Skip window name */ /* Skip window name */
switch (*((WORD *)p)) switch (*(const DWORD *)p)
{ {
case 0x0000: p = (WORD *)p + 1; break; case 0x0000: p = (const DWORD *)p + 1; break;
case 0xffff: p = (WORD *)p + 2; break; case 0xffff: p = (const DWORD *)p + 2; break;
default: p = (LPWSTR)p + strlenW( (LPWSTR)p ) + 1; break; default: p = (LPCWSTR)p + strlenW( p ) + 1; break;
} }
/* Skip data */ /* Skip data */
data = get_word(&p); data = get_word(&p);
p = (BYTE *)p + data; p = (const BYTE *)p + data;
/* Next item */ /* Next item */
nbItems--; nbItems--;
} }
return (WORD)((LPSTR)p - (LPSTR)dialog32); return (WORD)((LPCSTR)p - (LPCSTR)dialog32);
} }
/********************************************************************** /**********************************************************************
* ConvertMenu32To16 (KERNEL.616) * ConvertMenu32To16 (KERNEL.616)
*/ */
VOID WINAPI ConvertMenu32To16( LPVOID menu32, DWORD size, LPVOID menu16 ) VOID WINAPI ConvertMenu32To16( LPCVOID menu32, DWORD size, LPVOID menu16 )
{ {
WORD version, headersize, flags, level = 1; WORD version, headersize, flags, level = 1;
@ -703,7 +703,7 @@ VOID WINAPI ConvertMenu32To16( LPVOID menu32, DWORD size, LPVOID menu16 )
{ {
memcpy( menu16, menu32, headersize ); memcpy( menu16, menu32, headersize );
menu16 = (BYTE *)menu16 + headersize; menu16 = (BYTE *)menu16 + headersize;
menu32 = (BYTE *)menu32 + headersize; menu32 = (const BYTE *)menu32 + headersize;
} }
while ( level ) while ( level )
@ -716,9 +716,9 @@ VOID WINAPI ConvertMenu32To16( LPVOID menu32, DWORD size, LPVOID menu16 )
else else
level++; level++;
WideCharToMultiByte( CP_ACP, 0, (LPWSTR)menu32, -1, (LPSTR)menu16, 0x7fffffff, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, menu32, -1, menu16, 0x7fffffff, NULL, NULL );
menu16 = (LPSTR)menu16 + strlen( (LPSTR)menu16 ) + 1; menu16 = (LPSTR)menu16 + strlen( menu16 ) + 1;
menu32 = (LPWSTR)menu32 + strlenW( (LPWSTR)menu32 ) + 1; menu32 = (LPCWSTR)menu32 + strlenW( menu32 ) + 1;
if ( flags & MF_END ) if ( flags & MF_END )
level--; level--;
@ -731,12 +731,12 @@ VOID WINAPI ConvertMenu32To16( LPVOID menu32, DWORD size, LPVOID menu16 )
flags = get_word( &menu32 ); flags = get_word( &menu32 );
put_byte(&menu16,flags); put_byte(&menu16,flags);
WideCharToMultiByte( CP_ACP, 0, (LPWSTR)menu32, -1, (LPSTR)menu16, 0x7fffffff, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, menu32, -1, menu16, 0x7fffffff, NULL, NULL );
menu16 = (LPSTR)menu16 + strlen( (LPSTR)menu16 ) + 1; menu16 = (LPSTR)menu16 + strlen( menu16 ) + 1;
menu32 = (LPWSTR)menu32 + strlenW( (LPWSTR)menu32 ) + 1; menu32 = (LPCWSTR)menu32 + strlenW( menu32 ) + 1;
/* align on DWORD boundary (32-bit only) */ /* align on DWORD boundary (32-bit only) */
menu32 = (LPVOID)(((UINT_PTR)menu32 + 3) & ~3); menu32 = (LPCVOID)(((UINT_PTR)menu32 + 3) & ~3);
/* If popup, transfer helpid */ /* If popup, transfer helpid */
if ( flags & 1) if ( flags & 1)
@ -754,45 +754,45 @@ VOID WINAPI ConvertMenu32To16( LPVOID menu32, DWORD size, LPVOID menu16 )
/********************************************************************** /**********************************************************************
* GetMenu32Size (KERNEL.617) * GetMenu32Size (KERNEL.617)
*/ */
WORD WINAPI GetMenu32Size16( LPVOID menu32 ) WORD WINAPI GetMenu32Size16( LPCVOID menu32 )
{ {
LPVOID p = menu32; LPCVOID p = menu32;
WORD version, headersize, flags, level = 1; WORD version, headersize, flags, level = 1;
version = get_word(&p); version = get_word(&p);
headersize = get_word(&p); headersize = get_word(&p);
p = (BYTE *)p + headersize; p = (const BYTE *)p + headersize;
while ( level ) while ( level )
if ( version == 0 ) /* standard */ if ( version == 0 ) /* standard */
{ {
flags = get_word(&p); flags = get_word(&p);
if ( !(flags & MF_POPUP) ) if ( !(flags & MF_POPUP) )
p = (WORD *)p + 1; /* ID */ p = (const WORD *)p + 1; /* ID */
else else
level++; level++;
p = (LPWSTR)p + strlenW( (LPWSTR)p ) + 1; p = (LPCWSTR)p + strlenW( p ) + 1;
if ( flags & MF_END ) if ( flags & MF_END )
level--; level--;
} }
else /* extended */ else /* extended */
{ {
p = (DWORD *)p + 1; /* fType */ p = (const DWORD *)p + 1; /* fType */
p = (DWORD *)p + 1; /* fState */ p = (const DWORD *)p + 1; /* fState */
p = (DWORD *)p + 1; /* ID */ p = (const DWORD *)p + 1; /* ID */
flags = get_word(&p); flags = get_word(&p);
p = (LPWSTR)p + strlenW( (LPWSTR)p ) + 1; p = (LPCWSTR)p + strlenW( p ) + 1;
/* align on DWORD boundary (32-bit only) */ /* align on DWORD boundary (32-bit only) */
p = (LPVOID)(((UINT_PTR)p + 3) & ~3); p = (LPCVOID)(((UINT_PTR)p + 3) & ~3);
/* If popup, skip helpid */ /* If popup, skip helpid */
if ( flags & 1) if ( flags & 1)
{ {
p = (DWORD *)p + 1; p = (const DWORD *)p + 1;
level++; level++;
} }
@ -800,14 +800,14 @@ WORD WINAPI GetMenu32Size16( LPVOID menu32 )
level--; level--;
} }
return (WORD)((LPSTR)p - (LPSTR)menu32); return (WORD)((LPCSTR)p - (LPCSTR)menu32);
} }
/********************************************************************** /**********************************************************************
* ConvertAccelerator32To16 * ConvertAccelerator32To16
*/ */
static void ConvertAccelerator32To16( LPVOID acc32, DWORD size, LPVOID acc16 ) static void ConvertAccelerator32To16( LPCVOID acc32, DWORD size, LPVOID acc16 )
{ {
BYTE type; BYTE type;
@ -831,7 +831,7 @@ static void ConvertAccelerator32To16( LPVOID acc32, DWORD size, LPVOID acc16 )
/********************************************************************** /**********************************************************************
* NE_LoadPEResource * NE_LoadPEResource
*/ */
static HGLOBAL16 NE_LoadPEResource( NE_MODULE *pModule, WORD type, LPVOID bits, DWORD size ) static HGLOBAL16 NE_LoadPEResource( NE_MODULE *pModule, WORD type, LPCVOID bits, DWORD size )
{ {
HGLOBAL16 handle; HGLOBAL16 handle;

View File

@ -963,7 +963,7 @@ INT16 WINAPI lstrcmpi16(LPCSTR,LPCSTR);
typedef VOID (*SYSTEMTIMERPROC)(WORD); typedef VOID (*SYSTEMTIMERPROC)(WORD);
void WINAPI ConvertDialog32To16(LPVOID,DWORD,LPVOID); void WINAPI ConvertDialog32To16(LPCVOID,DWORD,LPVOID);
WORD WINAPI CreateSystemTimer(WORD,SYSTEMTIMERPROC); WORD WINAPI CreateSystemTimer(WORD,SYSTEMTIMERPROC);
VOID WINAPI DisableSystemTimers16(void); VOID WINAPI DisableSystemTimers16(void);
VOID WINAPI EnableSystemTimers16(void); VOID WINAPI EnableSystemTimers16(void);