Const correctness, pointer cast correctness, removed extraneous ';'.
diff --git a/dlls/kernel/console.c b/dlls/kernel/console.c
index 3be2025..96f9b19 100644
--- a/dlls/kernel/console.c
+++ b/dlls/kernel/console.c
@@ -1827,7 +1827,7 @@
*
*/
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 done; /* number of chars already written */
@@ -1875,7 +1875,7 @@
{
DWORD mode;
DWORD nw = 0;
- WCHAR* psz = (WCHAR*)lpBuffer;
+ const WCHAR* psz = lpBuffer;
CONSOLE_SCREEN_BUFFER_INFO csbi;
int k, first = 0;
diff --git a/dlls/kernel/dosmem.c b/dlls/kernel/dosmem.c
index 10f8861..9023961 100644
--- a/dlls/kernel/dosmem.c
+++ b/dlls/kernel/dosmem.c
@@ -215,7 +215,7 @@
*/
static void DOSMEM_FillBiosSegments(void)
{
- BYTE *pBiosSys = DOSMEM_dosmem + 0xf0000;
+ char *pBiosSys = DOSMEM_dosmem + 0xf0000;
BYTE *pBiosROMTable = pBiosSys+0xe6f5;
BIOSDATA *pBiosData = DOSMEM_BiosData();
@@ -261,7 +261,7 @@
*(pBiosROMTable+0x9) = 0x00; /* feature byte 5 */
/* BIOS date string */
- strcpy((char *)pBiosSys+0xfff5, "13/01/99");
+ strcpy(pBiosSys+0xfff5, "13/01/99");
/* BIOS ID */
*(pBiosSys+0xfffe) = 0xfc;
diff --git a/dlls/kernel/format_msg.c b/dlls/kernel/format_msg.c
index 6df1160..54412eb 100644
--- a/dlls/kernel/format_msg.c
+++ b/dlls/kernel/format_msg.c
@@ -90,7 +90,7 @@
if (i>0) {
if (mre->Flags & MESSAGE_RESOURCE_UNICODE)
- lstrcpynW(buffer, (LPWSTR)mre->Text, i);
+ lstrcpynW(buffer, (LPCWSTR)mre->Text, i);
else
MultiByteToWideChar( CP_ACP, 0, mre->Text, -1, buffer, i);
buffer[i]=0;
@@ -170,8 +170,8 @@
from = NULL;
if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
{
- from = HeapAlloc( GetProcessHeap(), 0, strlen((LPSTR)lpSource)+1 );
- strcpy( from, (LPSTR)lpSource );
+ from = HeapAlloc( GetProcessHeap(), 0, strlen((LPCSTR)lpSource)+1 );
+ strcpy( from, (LPCSTR)lpSource );
}
else {
bufsize = 0;
@@ -398,9 +398,9 @@
FIXME("line wrapping not supported.\n");
from = NULL;
if (dwFlags & FORMAT_MESSAGE_FROM_STRING) {
- from = HeapAlloc( GetProcessHeap(), 0, (strlenW((LPWSTR)lpSource) + 1) *
+ from = HeapAlloc( GetProcessHeap(), 0, (strlenW((LPCWSTR)lpSource) + 1) *
sizeof(WCHAR) );
- strcpyW( from, (LPWSTR)lpSource );
+ strcpyW( from, (LPCWSTR)lpSource );
}
else {
bufsize = 0;
diff --git a/dlls/kernel/heap.c b/dlls/kernel/heap.c
index dd680f6..2e67cb9 100644
--- a/dlls/kernel/heap.c
+++ b/dlls/kernel/heap.c
@@ -516,7 +516,7 @@
maybe_intern = HANDLE_TO_INTERN( handle );
if (maybe_intern->Magic == MAGIC_GLOBAL_USED) {
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? */
break; /* valid moveable block */
}
diff --git a/dlls/kernel/instr.c b/dlls/kernel/instr.c
index 2eb6ba5..dcb3301 100644
--- a/dlls/kernel/instr.c
+++ b/dlls/kernel/instr.c
@@ -275,7 +275,7 @@
wine_ldt_get_entry( seg, &entry );
if (wine_ldt_is_empty( &entry )) 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
}
diff --git a/dlls/kernel/locale.c b/dlls/kernel/locale.c
index ed9ca0c..c6f765b 100644
--- a/dlls/kernel/locale.c
+++ b/dlls/kernel/locale.c
@@ -40,6 +40,7 @@
#include "wine/unicode.h"
#include "winnls.h"
#include "winerror.h"
+#include "winver.h"
#include "thread.h"
#include "kernel_private.h"
#include "wine/debug.h"
@@ -464,8 +465,8 @@
*/
static int charset_cmp( const void *name, const void *entry )
{
- const struct charset_entry *charset = (struct charset_entry *)entry;
- return strcasecmp( (char *)name, charset->charset_name );
+ const struct charset_entry *charset = (const struct charset_entry *)entry;
+ return strcasecmp( (const char *)name, charset->charset_name );
}
/***********************************************************************
diff --git a/dlls/kernel/profile.c b/dlls/kernel/profile.c
index 83ff47a..61df663 100644
--- a/dlls/kernel/profile.c
+++ b/dlls/kernel/profile.c
@@ -1048,7 +1048,7 @@
BOOL allow_section_name_copy )
{
int ret;
- LPWSTR pDefVal = NULL;
+ LPCWSTR pDefVal = NULL;
if (!filename)
filename = wininiW;
@@ -1070,13 +1070,16 @@
if (*p == ' ') /* ouch, contained trailing ' ' */
{
int len = (int)(p - def_val);
- pDefVal = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
- strncpyW(pDefVal, def_val, len);
- pDefVal[len] = '\0';
+ LPWSTR p;
+
+ p = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
+ strncpyW(p, def_val, len);
+ p[len] = '\0';
+ pDefVal = p;
}
}
if (!pDefVal)
- pDefVal = (LPWSTR)def_val;
+ pDefVal = (LPCWSTR)def_val;
RtlEnterCriticalSection( &PROFILE_CritSect );
@@ -1094,7 +1097,7 @@
RtlLeaveCriticalSection( &PROFILE_CritSect );
if (pDefVal != def_val) /* allocated */
- HeapFree(GetProcessHeap(), 0, pDefVal);
+ HeapFree(GetProcessHeap(), 0, (void*)pDefVal);
TRACE("returning %s, %d\n", debugstr_w(buffer), ret);
diff --git a/dlls/kernel/selector.c b/dlls/kernel/selector.c
index cae4e56..42e29d9 100644
--- a/dlls/kernel/selector.c
+++ b/dlls/kernel/selector.c
@@ -479,12 +479,12 @@
SEGPTR WINAPI MapLS( LPCVOID ptr )
{
struct mapls_entry *entry, *free = NULL;
- void *base;
+ const void *base;
SEGPTR ret = 0;
if (!HIWORD(ptr)) return (SEGPTR)ptr;
- base = (char *)ptr - ((unsigned int)ptr & 0x7fff);
+ base = (const char *)ptr - ((unsigned int)ptr & 0x7fff);
HeapLock( GetProcessHeap() );
for (entry = first_entry; entry; entry = entry->next)
{
@@ -507,11 +507,11 @@
first_entry = free;
}
SetSelectorBase( free->sel, (DWORD)base );
- free->addr = base;
+ free->addr = (void*)base;
entry = free;
}
entry->count++;
- ret = MAKESEGPTR( entry->sel, (char *)ptr - (char *)entry->addr );
+ ret = MAKESEGPTR( entry->sel, (const char *)ptr - (char *)entry->addr );
done:
HeapUnlock( GetProcessHeap() );
return ret;
diff --git a/dlls/kernel/thread.c b/dlls/kernel/thread.c
index 3c5bbd9..ee8fffe 100644
--- a/dlls/kernel/thread.c
+++ b/dlls/kernel/thread.c
@@ -625,28 +625,28 @@
"movl 4(%esp),%eax\n\t"
".byte 0x64\n\t"
"movl %eax,0x34\n\t"
- "ret $4" );
+ "ret $4" )
/***********************************************************************
* GetLastError (KERNEL.148)
* GetLastError (KERNEL32.@)
*/
/* 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 (KERNEL32.@)
*/
/* 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 (KERNEL32.@)
*/
/* 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__ */
diff --git a/misc/registry.c b/misc/registry.c
index f75f1f4..ffc6a3f 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -322,7 +322,7 @@
};
/* 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,
HKEY hkey, ULONG lastmodified, int level)
{
@@ -398,7 +398,7 @@
UNICODE_STRING nameW;
struct _w31_header head;
struct _w31_tabent* tab = NULL;
- unsigned char* txt = NULL;
+ char* txt = NULL;
unsigned int len;
ULONG lastmodified;
NTSTATUS status;