Const correctness, pointer cast correctness, removed extraneous ';'.

This commit is contained in:
Eric Pouech 2004-06-14 17:04:34 +00:00 committed by Alexandre Julliard
parent b0fd2ade62
commit 62a860988c
10 changed files with 33 additions and 29 deletions

View File

@ -1827,7 +1827,7 @@ static int next_line(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi)
* *
*/ */
static int write_block(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi, static int write_block(HANDLE hCon, CONSOLE_SCREEN_BUFFER_INFO* csbi,
DWORD mode, LPWSTR ptr, int len) DWORD mode, LPCWSTR ptr, int len)
{ {
int blk; /* number of chars to write on current line */ int blk; /* number of chars to write on current line */
int done; /* number of chars already written */ int done; /* number of chars already written */
@ -1875,7 +1875,7 @@ BOOL WINAPI WriteConsoleW(HANDLE hConsoleOutput, LPCVOID lpBuffer, DWORD nNumber
{ {
DWORD mode; DWORD mode;
DWORD nw = 0; DWORD nw = 0;
WCHAR* psz = (WCHAR*)lpBuffer; const WCHAR* psz = lpBuffer;
CONSOLE_SCREEN_BUFFER_INFO csbi; CONSOLE_SCREEN_BUFFER_INFO csbi;
int k, first = 0; int k, first = 0;

View File

@ -215,7 +215,7 @@ static DWORD DOSMEM_GetTicksSinceMidnight(void)
*/ */
static void DOSMEM_FillBiosSegments(void) static void DOSMEM_FillBiosSegments(void)
{ {
BYTE *pBiosSys = DOSMEM_dosmem + 0xf0000; char *pBiosSys = DOSMEM_dosmem + 0xf0000;
BYTE *pBiosROMTable = pBiosSys+0xe6f5; BYTE *pBiosROMTable = pBiosSys+0xe6f5;
BIOSDATA *pBiosData = DOSMEM_BiosData(); BIOSDATA *pBiosData = DOSMEM_BiosData();
@ -261,7 +261,7 @@ static void DOSMEM_FillBiosSegments(void)
*(pBiosROMTable+0x9) = 0x00; /* feature byte 5 */ *(pBiosROMTable+0x9) = 0x00; /* feature byte 5 */
/* BIOS date string */ /* BIOS date string */
strcpy((char *)pBiosSys+0xfff5, "13/01/99"); strcpy(pBiosSys+0xfff5, "13/01/99");
/* BIOS ID */ /* BIOS ID */
*(pBiosSys+0xfffe) = 0xfc; *(pBiosSys+0xfffe) = 0xfc;

View File

@ -90,7 +90,7 @@ static INT load_messageW( HMODULE instance, UINT id, WORD lang,
if (i>0) { if (i>0) {
if (mre->Flags & MESSAGE_RESOURCE_UNICODE) if (mre->Flags & MESSAGE_RESOURCE_UNICODE)
lstrcpynW(buffer, (LPWSTR)mre->Text, i); lstrcpynW(buffer, (LPCWSTR)mre->Text, i);
else else
MultiByteToWideChar( CP_ACP, 0, mre->Text, -1, buffer, i); MultiByteToWideChar( CP_ACP, 0, mre->Text, -1, buffer, i);
buffer[i]=0; buffer[i]=0;
@ -170,8 +170,8 @@ DWORD WINAPI FormatMessageA(
from = NULL; from = NULL;
if (dwFlags & FORMAT_MESSAGE_FROM_STRING) if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
{ {
from = HeapAlloc( GetProcessHeap(), 0, strlen((LPSTR)lpSource)+1 ); from = HeapAlloc( GetProcessHeap(), 0, strlen((LPCSTR)lpSource)+1 );
strcpy( from, (LPSTR)lpSource ); strcpy( from, (LPCSTR)lpSource );
} }
else { else {
bufsize = 0; bufsize = 0;
@ -398,9 +398,9 @@ DWORD WINAPI FormatMessageW(
FIXME("line wrapping not supported.\n"); FIXME("line wrapping not supported.\n");
from = NULL; from = NULL;
if (dwFlags & FORMAT_MESSAGE_FROM_STRING) { if (dwFlags & FORMAT_MESSAGE_FROM_STRING) {
from = HeapAlloc( GetProcessHeap(), 0, (strlenW((LPWSTR)lpSource) + 1) * from = HeapAlloc( GetProcessHeap(), 0, (strlenW((LPCWSTR)lpSource) + 1) *
sizeof(WCHAR) ); sizeof(WCHAR) );
strcpyW( from, (LPWSTR)lpSource ); strcpyW( from, (LPCWSTR)lpSource );
} }
else { else {
bufsize = 0; bufsize = 0;

View File

@ -516,7 +516,7 @@ HGLOBAL WINAPI GlobalHandle(
maybe_intern = HANDLE_TO_INTERN( handle ); maybe_intern = HANDLE_TO_INTERN( handle );
if (maybe_intern->Magic == MAGIC_GLOBAL_USED) { if (maybe_intern->Magic == MAGIC_GLOBAL_USED) {
test = maybe_intern->Pointer; test = maybe_intern->Pointer;
if (HeapValidate( GetProcessHeap(), 0, (char *)test - HGLOBAL_STORAGE ) && /* obj(-handle) valid arena? */ if (HeapValidate( GetProcessHeap(), 0, (const char *)test - HGLOBAL_STORAGE ) && /* obj(-handle) valid arena? */
HeapValidate( GetProcessHeap(), 0, maybe_intern )) /* intern valid arena? */ HeapValidate( GetProcessHeap(), 0, maybe_intern )) /* intern valid arena? */
break; /* valid moveable block */ break; /* valid moveable block */
} }

View File

@ -275,7 +275,7 @@ static BYTE *INSTR_GetOperandAddr( CONTEXT86 *context, BYTE *instr,
wine_ldt_get_entry( seg, &entry ); wine_ldt_get_entry( seg, &entry );
if (wine_ldt_is_empty( &entry )) return NULL; if (wine_ldt_is_empty( &entry )) return NULL;
if (wine_ldt_get_limit(&entry) < (base + (index << ss))) return NULL; if (wine_ldt_get_limit(&entry) < (base + (index << ss))) return NULL;
return (char *)wine_ldt_get_base(&entry) + base + (index << ss); return (BYTE *)wine_ldt_get_base(&entry) + base + (index << ss);
#undef GET_VAL #undef GET_VAL
} }

View File

@ -40,6 +40,7 @@
#include "wine/unicode.h" #include "wine/unicode.h"
#include "winnls.h" #include "winnls.h"
#include "winerror.h" #include "winerror.h"
#include "winver.h"
#include "thread.h" #include "thread.h"
#include "kernel_private.h" #include "kernel_private.h"
#include "wine/debug.h" #include "wine/debug.h"
@ -464,8 +465,8 @@ END:
*/ */
static int charset_cmp( const void *name, const void *entry ) static int charset_cmp( const void *name, const void *entry )
{ {
const struct charset_entry *charset = (struct charset_entry *)entry; const struct charset_entry *charset = (const struct charset_entry *)entry;
return strcasecmp( (char *)name, charset->charset_name ); return strcasecmp( (const char *)name, charset->charset_name );
} }
/*********************************************************************** /***********************************************************************

View File

@ -1048,7 +1048,7 @@ static int PROFILE_GetPrivateProfileString( LPCWSTR section, LPCWSTR entry,
BOOL allow_section_name_copy ) BOOL allow_section_name_copy )
{ {
int ret; int ret;
LPWSTR pDefVal = NULL; LPCWSTR pDefVal = NULL;
if (!filename) if (!filename)
filename = wininiW; filename = wininiW;
@ -1070,13 +1070,16 @@ static int PROFILE_GetPrivateProfileString( LPCWSTR section, LPCWSTR entry,
if (*p == ' ') /* ouch, contained trailing ' ' */ if (*p == ' ') /* ouch, contained trailing ' ' */
{ {
int len = (int)(p - def_val); int len = (int)(p - def_val);
pDefVal = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); LPWSTR p;
strncpyW(pDefVal, def_val, len);
pDefVal[len] = '\0'; p = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
strncpyW(p, def_val, len);
p[len] = '\0';
pDefVal = p;
} }
} }
if (!pDefVal) if (!pDefVal)
pDefVal = (LPWSTR)def_val; pDefVal = (LPCWSTR)def_val;
RtlEnterCriticalSection( &PROFILE_CritSect ); RtlEnterCriticalSection( &PROFILE_CritSect );
@ -1094,7 +1097,7 @@ static int PROFILE_GetPrivateProfileString( LPCWSTR section, LPCWSTR entry,
RtlLeaveCriticalSection( &PROFILE_CritSect ); RtlLeaveCriticalSection( &PROFILE_CritSect );
if (pDefVal != def_val) /* allocated */ if (pDefVal != def_val) /* allocated */
HeapFree(GetProcessHeap(), 0, pDefVal); HeapFree(GetProcessHeap(), 0, (void*)pDefVal);
TRACE("returning %s, %d\n", debugstr_w(buffer), ret); TRACE("returning %s, %d\n", debugstr_w(buffer), ret);

View File

@ -479,12 +479,12 @@ static struct mapls_entry *first_entry;
SEGPTR WINAPI MapLS( LPCVOID ptr ) SEGPTR WINAPI MapLS( LPCVOID ptr )
{ {
struct mapls_entry *entry, *free = NULL; struct mapls_entry *entry, *free = NULL;
void *base; const void *base;
SEGPTR ret = 0; SEGPTR ret = 0;
if (!HIWORD(ptr)) return (SEGPTR)ptr; if (!HIWORD(ptr)) return (SEGPTR)ptr;
base = (char *)ptr - ((unsigned int)ptr & 0x7fff); base = (const char *)ptr - ((unsigned int)ptr & 0x7fff);
HeapLock( GetProcessHeap() ); HeapLock( GetProcessHeap() );
for (entry = first_entry; entry; entry = entry->next) for (entry = first_entry; entry; entry = entry->next)
{ {
@ -507,11 +507,11 @@ SEGPTR WINAPI MapLS( LPCVOID ptr )
first_entry = free; first_entry = free;
} }
SetSelectorBase( free->sel, (DWORD)base ); SetSelectorBase( free->sel, (DWORD)base );
free->addr = base; free->addr = (void*)base;
entry = free; entry = free;
} }
entry->count++; entry->count++;
ret = MAKESEGPTR( entry->sel, (char *)ptr - (char *)entry->addr ); ret = MAKESEGPTR( entry->sel, (const char *)ptr - (char *)entry->addr );
done: done:
HeapUnlock( GetProcessHeap() ); HeapUnlock( GetProcessHeap() );
return ret; return ret;

View File

@ -625,28 +625,28 @@ __ASM_GLOBAL_FUNC( SetLastError,
"movl 4(%esp),%eax\n\t" "movl 4(%esp),%eax\n\t"
".byte 0x64\n\t" ".byte 0x64\n\t"
"movl %eax,0x34\n\t" "movl %eax,0x34\n\t"
"ret $4" ); "ret $4" )
/*********************************************************************** /***********************************************************************
* GetLastError (KERNEL.148) * GetLastError (KERNEL.148)
* GetLastError (KERNEL32.@) * GetLastError (KERNEL32.@)
*/ */
/* DWORD WINAPI GetLastError(void); */ /* DWORD WINAPI GetLastError(void); */
__ASM_GLOBAL_FUNC( GetLastError, ".byte 0x64\n\tmovl 0x34,%eax\n\tret" ); __ASM_GLOBAL_FUNC( GetLastError, ".byte 0x64\n\tmovl 0x34,%eax\n\tret" )
/*********************************************************************** /***********************************************************************
* GetCurrentProcessId (KERNEL.471) * GetCurrentProcessId (KERNEL.471)
* GetCurrentProcessId (KERNEL32.@) * GetCurrentProcessId (KERNEL32.@)
*/ */
/* DWORD WINAPI GetCurrentProcessId(void) */ /* DWORD WINAPI GetCurrentProcessId(void) */
__ASM_GLOBAL_FUNC( GetCurrentProcessId, ".byte 0x64\n\tmovl 0x20,%eax\n\tret" ); __ASM_GLOBAL_FUNC( GetCurrentProcessId, ".byte 0x64\n\tmovl 0x20,%eax\n\tret" )
/*********************************************************************** /***********************************************************************
* GetCurrentThreadId (KERNEL.462) * GetCurrentThreadId (KERNEL.462)
* GetCurrentThreadId (KERNEL32.@) * GetCurrentThreadId (KERNEL32.@)
*/ */
/* DWORD WINAPI GetCurrentThreadId(void) */ /* DWORD WINAPI GetCurrentThreadId(void) */
__ASM_GLOBAL_FUNC( GetCurrentThreadId, ".byte 0x64\n\tmovl 0x24,%eax\n\tret" ); __ASM_GLOBAL_FUNC( GetCurrentThreadId, ".byte 0x64\n\tmovl 0x24,%eax\n\tret" )
#else /* __i386__ */ #else /* __i386__ */

View File

@ -322,7 +322,7 @@ struct _w31_valent {
}; };
/* recursive helper function to display a directory tree [Internal] */ /* recursive helper function to display a directory tree [Internal] */
static void _w31_dumptree(unsigned short idx, unsigned char *txt, static void _w31_dumptree(unsigned short idx, char *txt,
struct _w31_tabent *tab, struct _w31_header *head, struct _w31_tabent *tab, struct _w31_header *head,
HKEY hkey, ULONG lastmodified, int level) HKEY hkey, ULONG lastmodified, int level)
{ {
@ -398,7 +398,7 @@ static void _w31_loadreg( const WCHAR *path )
UNICODE_STRING nameW; UNICODE_STRING nameW;
struct _w31_header head; struct _w31_header head;
struct _w31_tabent* tab = NULL; struct _w31_tabent* tab = NULL;
unsigned char* txt = NULL; char* txt = NULL;
unsigned int len; unsigned int len;
ULONG lastmodified; ULONG lastmodified;
NTSTATUS status; NTSTATUS status;