Authors: Andreas Mohr <amohr@codeweavers.com>, Dimitrie O. Paun <dimi@cs.toronto.edu>, Patrik Stridvall <ps@leissner.se>
Various warning fixes.

diff --git a/controls/edit.c b/controls/edit.c
index cebb44c..7a9664b 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -14,6 +14,7 @@
 #include "config.h"
 
 #include <string.h>
+#include <stdlib.h>
 
 #include "winbase.h"
 #include "winnt.h"
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 0933f31..2ca516e 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -43,6 +43,7 @@
 
 #include <ctype.h>
 #include <string.h>
+#include <stdlib.h>
 
 #include "winbase.h"
 #include "heap.h"
@@ -1182,7 +1183,7 @@
 }
 
 
-static void LISTVIEW_PrintSelectionRanges(hwnd)
+static void LISTVIEW_PrintSelectionRanges(HWND hwnd)
 {
   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
   LISTVIEW_SELECTION *selection;
@@ -1935,7 +1936,7 @@
  * over the item for a certain period of time.
  * 
  */
-static LRESULT LISTVIEW_MouseHover(hwnd, wParam, lParam)
+static LRESULT LISTVIEW_MouseHover(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
   POINT pt;
@@ -4113,7 +4114,7 @@
  *   SUCCESS : HWND
  *   FAILURE : 0
  */
-static LRESULT LISTVIEW_GetEditControl(hwnd)
+static LRESULT LISTVIEW_GetEditControl(HWND hwnd)
 {
   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
   return infoPtr->hwndEdit;
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index c251289..1eaeb37 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -18,6 +18,7 @@
 
 #include <math.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "winbase.h"
 #include "windef.h"
diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index 5af7244..8fe2c8e 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -1410,8 +1410,8 @@
     HFONT hFont;
     HFONT hOldFont = 0; /* stop uninitialized warning */
 
-    INT nEscapement;
-    INT nOrientation;
+    INT nEscapement = 0; /* stop uninitialized warning */
+    INT nOrientation = 0; /* stop uninitialized warning */
     INT iPointSize;
 
     /* used to center the icon and text in the tab */
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 65c58ea..b04678f 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -27,6 +27,8 @@
 #include <assert.h>
 #include <string.h>
 #include <limits.h>
+#include <stdlib.h>
+
 #include "winbase.h"
 #include "wingdi.h"
 #include "wine/winestring.h"
diff --git a/dlls/ddraw/ddraw/dga.c b/dlls/ddraw/ddraw/dga.c
index bc6b1f1..1695ea3 100644
--- a/dlls/ddraw/ddraw/dga.c
+++ b/dlls/ddraw/ddraw/dga.c
@@ -423,7 +423,7 @@
     }
     if ( IsEqualGUID( &IID_IDirectDraw7, refiid ) ) {
 	IDirectDraw4Impl	*dd = HeapAlloc(GetProcessHeap(),0,sizeof(*dd));
-	ICOM_VTBL(dd) = &dga_dd7vt;dd->ref = 1;dd->d = This->d;This->d++;
+	ICOM_VTBL(dd) = (ICOM_VTABLE(IDirectDraw4)*)&dga_dd7vt;dd->ref = 1;dd->d = This->d;This->d++;
 	*obj = dd;
 
 	IDirectDraw7_AddRef(iface);
diff --git a/dlls/ddraw/ddraw/x11.c b/dlls/ddraw/ddraw/x11.c
index cd54c0b..b827e81 100644
--- a/dlls/ddraw/ddraw/x11.c
+++ b/dlls/ddraw/ddraw/x11.c
@@ -152,13 +152,13 @@
 static XF86VidModeModeInfo *orig_mode = NULL;
 
 void
-xf86vmode_setdisplaymode(width,height) {
+xf86vmode_setdisplaymode(DWORD width, DWORD height) {
     int i, mode_count;
     XF86VidModeModeInfo **all_modes, *vidmode = NULL;
     XF86VidModeModeLine mod_tmp;
     /* int dotclock_tmp; */
 
-    /* save original video mode and set fullscreen if available*/
+    /* save original video mode and set fullscreen if available */
     orig_mode = (XF86VidModeModeInfo *)malloc(sizeof(XF86VidModeModeInfo));  
     TSXF86VidModeGetModeLine(display, DefaultScreen(display), &orig_mode->dotclock, &mod_tmp);
     orig_mode->hdisplay = mod_tmp.hdisplay; 
@@ -216,7 +216,7 @@
     orig_mode = NULL;
 }
 #else
-void xf86vmode_setdisplaymode(width,height) {}
+void xf86vmode_setdisplaymode(DWORD width, DWORD height) {}
 void xf86vmode_restore() {}
 #endif
 
diff --git a/dlls/ddraw/x11_private.h b/dlls/ddraw/x11_private.h
index c13fdee..bba192a 100644
--- a/dlls/ddraw/x11_private.h
+++ b/dlls/ddraw/x11_private.h
@@ -23,7 +23,7 @@
 extern XF86VidModeModeInfo *orig_mode;
 #endif /* defined(HAVE_LIBXXF86VM) */
 
-extern void xf86vmode_setdisplaymode(int,int);
+extern void xf86vmode_setdisplaymode(DWORD,DWORD);
 extern void xf86vmode_restore();
 
 #ifdef HAVE_XVIDEO
diff --git a/dlls/kernel/time.c b/dlls/kernel/time.c
index 0d3d3ee..8bfdd21 100644
--- a/dlls/kernel/time.c
+++ b/dlls/kernel/time.c
@@ -6,6 +6,7 @@
 
 #include <string.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <sys/time.h>
 #include <sys/times.h>
 #include "file.h"
diff --git a/dlls/kernel/win87em.c b/dlls/kernel/win87em.c
index fa32bc5..7646c5c 100644
--- a/dlls/kernel/win87em.c
+++ b/dlls/kernel/win87em.c
@@ -92,8 +92,10 @@
     {
     case 0: /* install (increase instanceref) emulator, install NMI vector */
         RefCount++;
+#if 0
         if (Installed)
-            /* InstallIntVecs02hAnd75h(); */    ;
+            InstallIntVecs02hAnd75h();
+#endif
         WIN87_Init(context);
         AX_reg(context) = 0;
         break;
@@ -106,8 +108,11 @@
              * if zero. Every '0' call should have a matching '2' call.
              */
         WIN87_Init(context);
-        if (!(--RefCount) && (Installed))
-            /* RestoreInt02h() */   ;
+	RefCount--;
+#if 0
+        if (!RefCount && Installed)
+            RestoreInt02h();
+#endif
         
         break;
 
diff --git a/dlls/msvideo/drawdib.c b/dlls/msvideo/drawdib.c
index 8429f2a..a9e5275 100644
--- a/dlls/msvideo/drawdib.c
+++ b/dlls/msvideo/drawdib.c
@@ -157,7 +157,7 @@
 		DrawDibEnd(hdd);
 
 	if (lpbi->biCompression) {
-		DWORD size;
+		DWORD size = 0;
 
 		whdd->hic = ICOpen(ICTYPE_VIDEO,lpbi->biCompression,ICMODE_DECOMPRESS);
 		if (!whdd->hic) {
@@ -280,7 +280,7 @@
 
 	whdd = GlobalLock16(hdd);
 
-#define CHANGED(x) (whdd->##x != ##x)
+#define CHANGED(x) (whdd->x != x)
 
 	if ((!whdd->begun) || (!(wFlags & DDF_SAME_HDC) && CHANGED(hdc)) || (!(wFlags & DDF_SAME_DRAW) &&
 		 (CHANGED(lpbi) || CHANGED(dxSrc) || CHANGED(dySrc) || CHANGED(dxDst) || CHANGED(dyDst)))) {
diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index 0895c54..379764b 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -3070,8 +3070,10 @@
  */
 HRESULT WINAPI VarDateFromStr(OLECHAR* strIn, LCID lcid, ULONG dwFlags, DATE* pdateOut)
 {
-	HRESULT ret = S_OK;
-    struct tm TM = { 0,0,0,0,0,0,0,0,0 };
+    HRESULT ret = S_OK;
+    struct tm TM;
+
+    memset( &TM, 0, sizeof(TM) );
 
     TRACE("( %p, %lx, %lx, %p ), stub\n", strIn, lcid, dwFlags, pdateOut );
 
@@ -3264,8 +3266,9 @@
  */
 HRESULT WINAPI VarBstrFromDate(DATE dateIn, LCID lcid, ULONG dwFlags, BSTR* pbstrOut)
 {
-		struct tm TM = {0,0,0,0,0,0,0,0,0};
-	 
+    struct tm TM;
+    memset( &TM, 0, sizeof(TM) );
+
     TRACE("( %f, %ld, %ld, %p ), stub\n", dateIn, lcid, dwFlags, pbstrOut );
 
     if( DateToTm( dateIn, lcid, &TM ) == FALSE )
diff --git a/dlls/setupapi/setupx_main.c b/dlls/setupapi/setupx_main.c
index 4131c1b..33d9098 100644
--- a/dlls/setupapi/setupx_main.c
+++ b/dlls/setupapi/setupx_main.c
@@ -88,7 +88,7 @@
 
 RETERR16 WINAPI vcpOpen16(LPWORD p1, LPWORD p2)
 {
-    FIXME("(%p, %p, stub.\n", p1, p2);
+    FIXME("(%p, %p), stub.\n", p1, p2);
     return OK;
 }
 
diff --git a/dlls/shell32/shlmenu.c b/dlls/shell32/shlmenu.c
index 09840a6..2154aa3 100644
--- a/dlls/shell32/shlmenu.c
+++ b/dlls/shell32/shlmenu.c
@@ -686,7 +686,10 @@
 	mii.fMask = MIIM_SUBMENU;
 
 	GetMenuItemInfoA(hMenu, uID, FALSE, &mii );
-	if ( mii.hSubMenu );
+	if ( mii.hSubMenu )
+	{
+	  /* FIXME: Do what? */
+	}
 
 	DeleteMenu(hMenu, MF_BYCOMMAND, uID);
 	return TRUE;
@@ -706,7 +709,10 @@
 	mii.fMask = MIIM_SUBMENU;
 
 	GetMenuItemInfoA(hMenu, uPos, TRUE, &mii );
-	if ( mii.hSubMenu );
+	if ( mii.hSubMenu )
+	{
+	  /* FIXME: Do what? */
+	}
 
 	DeleteMenu(hMenu, MF_BYPOSITION, uPos);
 	return TRUE;
diff --git a/dlls/shell32/shv_bg_cmenu.c b/dlls/shell32/shv_bg_cmenu.c
index e058a04..de52ddf 100644
--- a/dlls/shell32/shv_bg_cmenu.c
+++ b/dlls/shell32/shv_bg_cmenu.c
@@ -194,7 +194,7 @@
 	
 	TRACE("\n");
 
-	if(SUCCEEDED(pOleGetClipboard(&pda)));
+	if(SUCCEEDED(pOleGetClipboard(&pda)))
 	{
 	  STGMEDIUM medium;
 	  FORMATETC formatetc;
diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c
index 502953d..ff68a19 100644
--- a/graphics/x11drv/xfont.c
+++ b/graphics/x11drv/xfont.c
@@ -927,7 +927,9 @@
 	       sprintf(resy_string,  "%d", resy);
 	   }
 	   else
-	       ; /* FIXME - synth width */
+	   {
+	       /* FIXME - synth width */
+           }
        }	   
        aLFD.resolution_y = resy_string;
    }
diff --git a/loader/ne/segment.c b/loader/ne/segment.c
index d3f6aa0..9459ef5a8 100644
--- a/loader/ne/segment.c
+++ b/loader/ne/segment.c
@@ -473,7 +473,7 @@
 	entry = (ET_ENTRY *)((BYTE *)bundle+6);
 	while (num_entries--)
     {
-	    /*TRACE(module, "entry: %p, entry->segnum: %d, entry->offs: %04x\n", entry, entry->segnum, entry->offs);*/
+	    /*TRACE_(module)("entry: %p, entry->segnum: %d, entry->offs: %04x\n", entry, entry->segnum, entry->offs);*/
 	    if (entry->segnum == segnum)
         {
 		pFunc = ((BYTE *)pSeg+entry->offs);
diff --git a/misc/cpu.c b/misc/cpu.c
index b1c47a9..7b75d6f 100644
--- a/misc/cpu.c
+++ b/misc/cpu.c
@@ -168,7 +168,7 @@
 		}
 		if (!strncasecmp(line,"processor",strlen("processor"))) {
 			/* processor number counts up...*/
-			int	x;
+			unsigned int x;
 
 			if (sscanf(value,"%d",&x))
 				if (x+1>cachedsi.dwNumberOfProcessors)
diff --git a/misc/error.c b/misc/error.c
index 216417d..03c581a 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -97,11 +97,11 @@
 static const char *GetErrorString(UINT16 uErr) 
 {
   static char buffer[80];
-  int i;
+  unsigned int n;
 
-  for (i = 0; i < ErrorStringCount; i++) {
-    if (uErr == ErrorStrings[i].constant)
-      return ErrorStrings[i].name;
+  for (n = 0; n < ErrorStringCount; n++) {
+    if (uErr == ErrorStrings[n].constant)
+      return ErrorStrings[n].name;
   }
 
   sprintf(buffer, "%x", uErr);
@@ -122,11 +122,11 @@
 		buffer[0] = '\0';
 
 	{
-		int i;
+		unsigned int n;
 
-		for (i = 0; i < ParamErrorStringCount; i++) {
-			if (uErr == ParamErrorStrings[i].constant) {
-				strcat(buffer, ParamErrorStrings[i].name);
+		for (n = 0; n < ParamErrorStringCount; n++) {
+			if (uErr == ParamErrorStrings[n].constant) {
+				strcat(buffer, ParamErrorStrings[n].name);
 				return buffer;
 			}
 		}
diff --git a/misc/options.c b/misc/options.c
index 68cc4a3..e1e7154 100644
--- a/misc/options.c
+++ b/misc/options.c
@@ -225,15 +225,15 @@
 static void inherit_options( char *buffer )
 {
     char *argv[256];
-    int i;
+    unsigned int n;
 
     char *p = strtok( buffer, " \t" );
-    for (i = 0; i < sizeof(argv)/sizeof(argv[0])-1 && p; i++)
+    for (n = 0; n < sizeof(argv)/sizeof(argv[0])-1 && p; n++)
     {
-        argv[i] = p;
+        argv[n] = p;
         p = strtok( NULL, " \t" );
     }
-    argv[i] = NULL;
+    argv[n] = NULL;
     parse_options( argv );
     if (argv[0])  /* an option remains */
     {
diff --git a/misc/registry.c b/misc/registry.c
index 64e7899..7d9117e 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -706,7 +706,7 @@
 static int _nt_parse_nk(HKEY hkey, char * base, nt_nk * nk, int level)
 {
 	char * name;
-	int i;
+	unsigned int n;
 	DWORD * vl;
 	HKEY subkey = hkey;
 
@@ -740,9 +740,9 @@
 
 	/* loop trough the value list */
 	vl = (DWORD *)(base+nk->valuelist_off+4);
-	for (i=0; i<nk->nr_values; i++)
+	for (n=0; n<nk->nr_values; n++)
 	{
-	  nt_vk * vk = (nt_vk*)(base+vl[i]+4);
+	  nt_vk * vk = (nt_vk*)(base+vl[n]+4);
 	  if (!_nt_parse_vk(subkey, base, vk)) goto error1;
 	}
 
@@ -1306,7 +1306,7 @@
 	struct _w31_header	head;
 	struct _w31_tabent	*tab;
 	unsigned char		*txt;
-	int			len;
+	unsigned int		len;
 	OFSTRUCT		ofs;
 	BY_HANDLE_FILE_INFORMATION hfinfo;
 	time_t			lastmodified;
@@ -1470,7 +1470,7 @@
     /* test %windir%/system32/config/system --> winnt */
     strcpy(path, windir);
     strncat(path, "\\system32\\config\\system", MAX_PATHNAME_LEN - strlen(path) - 1);
-    if(GetFileAttributesA(path) != -1) 
+    if(GetFileAttributesA(path) != (DWORD)-1) 
     {
       systemtype = REG_WINNT;
     }
@@ -1479,7 +1479,7 @@
        /* test %windir%/system.dat --> win95 */
       strcpy(path, windir);
       strncat(path, "\\system.dat", MAX_PATHNAME_LEN - strlen(path) - 1);
-      if(GetFileAttributesA(path) != -1)
+      if(GetFileAttributesA(path) != (DWORD)-1)
       {
         systemtype = REG_WIN95;
       }
@@ -1616,7 +1616,7 @@
   if (PROFILE_GetWineIniBool("registry", "LoadHomeRegistryFiles", 1))
   {
       const char *confdir = get_config_dir();
-      int len = strlen(confdir) + 20;
+      unsigned int len = strlen(confdir) + 20;
       char *fn = path;
 
       if (len > sizeof(path)) fn = HeapAlloc( GetProcessHeap(), 0, len );
diff --git a/msdos/devices.c b/msdos/devices.c
index 57146ed..f0e1efa 100644
--- a/msdos/devices.c
+++ b/msdos/devices.c
@@ -439,7 +439,7 @@
 {
   DOS_DATASEG *dataseg;
   UINT16 seg;
-  int n;
+  unsigned int n;
 
   /* allocate DOS data segment or something */
   DOS_LOLSeg = GlobalDOSAlloc16(sizeof(DOS_DATASEG));
diff --git a/msdos/vga.c b/msdos/vga.c
index 13a716b..a17aa5a 100644
--- a/msdos/vga.c
+++ b/msdos/vga.c
@@ -221,9 +221,8 @@
 void CALLBACK VGA_Poll( ULONG_PTR arg )
 {
     char *dat;
-    unsigned Pitch,Height,Width;
+    unsigned int Pitch,Height,Width,Y,X;
     char *surf;
-    int Y,X;
 
     if (!InterlockedExchangeAdd(&vga_polling, 1)) {
         /* FIXME: optimize by doing this only if the data has actually changed
diff --git a/msdos/vxd.c b/msdos/vxd.c
index 727ec58..adb00de 100644
--- a/msdos/vxd.c
+++ b/msdos/vxd.c
@@ -48,7 +48,7 @@
 {
     unsigned service = AX_reg(context);
 
-    TRACE("[%04x] VMM  \n", (UINT16)service);
+    TRACE("[%04x] VMM\n", (UINT16)service);
 
     switch(service)
     {
@@ -121,7 +121,7 @@
 {
     unsigned service = AX_reg(context);
 
-    TRACE("[%04x] VMM  \n", (UINT16)service);
+    TRACE("[%04x] Reboot\n", (UINT16)service);
 
     switch(service)
     {
@@ -142,7 +142,7 @@
 {
     unsigned service = AX_reg(context);
 
-    TRACE("[%04x] VDD  \n", (UINT16)service);
+    TRACE("[%04x] VDD\n", (UINT16)service);
 
     switch(service)
     {
@@ -163,7 +163,7 @@
 {
     unsigned service = AX_reg(context);
 
-    TRACE("[%04x] VMD  \n", (UINT16)service);
+    TRACE("[%04x] VMD\n", (UINT16)service);
 
     switch(service)
     {
@@ -380,7 +380,7 @@
 {
     unsigned service = AX_reg(context);
 
-    TRACE("[%04x] TimerAPI  \n", (UINT16)service);
+    TRACE("[%04x] TimerAPI\n", (UINT16)service);
 
     switch(service)
     {
@@ -413,7 +413,7 @@
 {
     unsigned service = AX_reg(context);
 
-    TRACE("[%04x] ConfigMG  \n", (UINT16)service);
+    TRACE("[%04x] ConfigMG\n", (UINT16)service);
 
     switch(service)
     {
@@ -434,7 +434,7 @@
 {
     unsigned service = AX_reg(context);
 
-    TRACE("[%04x] Enable  \n", (UINT16)service);
+    TRACE("[%04x] Enable\n", (UINT16)service);
 
     switch(service)
     {
@@ -455,7 +455,7 @@
 {
     unsigned service = AX_reg(context);
 
-    TRACE("[%04x] APM  \n", (UINT16)service);
+    TRACE("[%04x] APM\n", (UINT16)service);
 
     switch(service)
     {
@@ -753,7 +753,7 @@
         IMAGE_SECTION_HEADER *pe_seg = PE_SECTIONS(module->baseAddr);
 
         HFILE image = _lopen(module->pathName, OF_READ);
-        BOOL error = (image == INVALID_HANDLE_VALUE);
+        BOOL error = (image == HFILE_ERROR);
         UINT i;
 
         TRACE("MapModule: Loading %s\n", module->pathName);
diff --git a/objects/dib.c b/objects/dib.c
index 4650d89..67143ac 100644
--- a/objects/dib.c
+++ b/objects/dib.c
@@ -5,6 +5,8 @@
  *
  */
 
+#include <stdlib.h>
+
 #include "winbase.h"
 #include "bitmap.h"
 #include "callback.h"
diff --git a/relay32/snoop.c b/relay32/snoop.c
index f24dbce..082175c 100644
--- a/relay32/snoop.c
+++ b/relay32/snoop.c
@@ -61,7 +61,7 @@
 	HMODULE	hmod;
 	SNOOP_FUN	*funs;
 	LPCSTR		name;
-	int		nrofordinals;
+	DWORD		nrofordinals;
 	struct tagSNOOP_DLL	*next;
 } SNOOP_DLL;
 typedef struct tagSNOOP_RETURNENTRY {
@@ -192,7 +192,7 @@
 		return origfun;
 	if (!SNOOP_ShowDebugmsgSnoop(dll->name,ordinal,name))
 		return origfun;
-	assert(ordinal<dll->nrofordinals);
+	assert(ordinal < dll->nrofordinals);
 	fun = dll->funs+ordinal;
 	if (!fun->name) fun->name = HEAP_strdupA(GetProcessHeap(),0,name);
 	fun->lcall	= 0xe8;
diff --git a/scheduler/process.c b/scheduler/process.c
index 730ce63..acf14d8 100644
--- a/scheduler/process.c
+++ b/scheduler/process.c
@@ -41,7 +41,7 @@
 
 static char **main_exe_argv;
 static char main_exe_name[MAX_PATH];
-static HFILE main_exe_file = INVALID_HANDLE_VALUE;
+static HANDLE main_exe_file = INVALID_HANDLE_VALUE;
 
 unsigned int server_startticks;
 
@@ -740,7 +740,7 @@
     const char *unixfilename = NULL;
     const char *unixdir = NULL;
     DOS_FULL_NAME full_name;
-    HANDLE load_done_evt = -1;
+    HANDLE load_done_evt = (HANDLE)-1;
 
     info->hThread = info->hProcess = INVALID_HANDLE_VALUE;
 
@@ -824,7 +824,7 @@
     if (!ret || (pid == -1)) goto error;
 
     /* Wait until process is initialized (or initialization failed) */
-    if (load_done_evt != -1)
+    if (load_done_evt != (HANDLE)-1)
     {
         DWORD res;
         HANDLE handles[2];
@@ -845,7 +845,7 @@
     return TRUE;
 
 error:
-    if (load_done_evt != -1) CloseHandle( load_done_evt );
+    if (load_done_evt != (HANDLE)-1) CloseHandle( load_done_evt );
     if (info->hThread != INVALID_HANDLE_VALUE) CloseHandle( info->hThread );
     if (info->hProcess != INVALID_HANDLE_VALUE) CloseHandle( info->hProcess );
     return FALSE;
@@ -941,16 +941,16 @@
 
     case GPD_STARTF_SIZE:
         x = current_startupinfo.dwXSize;
-        if ( x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
+        if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
         y = current_startupinfo.dwYSize;
-        if ( y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
+        if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
         return MAKELONG( x, y );
 
     case GPD_STARTF_POSITION:
         x = current_startupinfo.dwX;
-        if ( x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
+        if ( (INT)x == CW_USEDEFAULT ) x = CW_USEDEFAULT16;
         y = current_startupinfo.dwY;
-        if ( y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
+        if ( (INT)y == CW_USEDEFAULT ) y = CW_USEDEFAULT16;
         return MAKELONG( x, y );
 
     case GPD_STARTF_FLAGS:
@@ -1168,7 +1168,7 @@
                                        DWORD maxset)
 {
     FIXME("(0x%08x,%ld,%ld): stub - harmless\n",hProcess,minset,maxset);
-    if(( minset == -1) && (maxset == -1)) {
+    if(( minset == (DWORD)-1) && (maxset == (DWORD)-1)) {
         /* Trim the working set to zero */
         /* Swap the process out of physical RAM */
     }
diff --git a/scheduler/timer.c b/scheduler/timer.c
index a5de434..a0aa575 100644
--- a/scheduler/timer.c
+++ b/scheduler/timer.c
@@ -37,7 +37,7 @@
         ret = req->handle;
     }
     SERVER_END_REQ;
-    if (ret == -1) ret = 0; /* must return 0 on failure, not -1 */
+    if (ret == INVALID_HANDLE_VALUE) ret = 0; /* must return 0 on failure, not -1 */
     return ret;
 }
 
@@ -66,7 +66,7 @@
         ret = req->handle;
     }
     SERVER_END_REQ;
-    if (ret == -1) ret = 0; /* must return 0 on failure, not -1 */
+    if (ret == INVALID_HANDLE_VALUE) ret = 0; /* must return 0 on failure, not -1 */
     return ret;
 }
 
@@ -94,7 +94,7 @@
         ret = req->handle;
     }
     SERVER_END_REQ;
-    if (ret == -1) ret = 0; /* must return 0 on failure, not -1 */
+    if (ret == INVALID_HANDLE_VALUE) ret = 0; /* must return 0 on failure, not -1 */
     return ret;
 }
 
@@ -122,7 +122,7 @@
         ret = req->handle;
     }
     SERVER_END_REQ;
-    if (ret == -1) ret = 0; /* must return 0 on failure, not -1 */
+    if (ret == INVALID_HANDLE_VALUE) ret = 0; /* must return 0 on failure, not -1 */
     return ret;
 }
 
diff --git a/server/atom.c b/server/atom.c
index 5e65b23..0e9f477 100644
--- a/server/atom.c
+++ b/server/atom.c
@@ -268,7 +268,7 @@
 static size_t get_atom_name( struct atom_table *table, int atom,
                              WCHAR *str, size_t maxsize, int *count )
 {
-    int len = 0;
+    size_t len = 0;
     struct atom_entry *entry = get_atom_entry( table, atom );
     *count = -1;
     if (entry)
diff --git a/server/mapping.c b/server/mapping.c
index 0ad6a57..ab98a62 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -55,7 +55,7 @@
 /* These are always the same on an i386, and it will be faster this way */
 # define page_mask  0xfff
 # define page_shift 12
-# define init_page_size() /* nothing */
+# define init_page_size() do { /* nothing */ } while(0)
 
 #else  /* __i386__ */
 
diff --git a/server/request.c b/server/request.c
index 8865604..083c601 100644
--- a/server/request.c
+++ b/server/request.c
@@ -72,7 +72,7 @@
 
 
 struct thread *current = NULL;  /* thread handling the current request */
-int global_error = 0;  /* global error code for when no thread is current */
+unsigned int global_error = 0;  /* global error code for when no thread is current */
 
 static struct master_socket *master_socket;  /* the master socket object */
 
diff --git a/server/thread.h b/server/thread.h
index f0f170b..c0db481 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -47,7 +47,7 @@
     struct thread_wait *wait;        /* current wait condition if sleeping */
     struct thread_apc  *apc_head;    /* queue of async procedure calls */
     struct thread_apc  *apc_tail;    /* queue of async procedure calls */
-    int                 error;     /* current error code */
+    unsigned int        error;       /* current error code */
     int                 pass_fd;   /* fd to pass to the client */
     enum run_state      state;     /* running state */
     int                 attached;  /* is thread attached with ptrace? */
@@ -108,10 +108,10 @@
 extern int write_thread_int( struct thread *thread, int *addr, int data, unsigned int mask );
 extern void *get_thread_ip( struct thread *thread );
 
-extern int global_error;  /* global error code for when no thread is current */
+extern unsigned int global_error;  /* global error code for when no thread is current */
 
-static inline int get_error(void)       { return current ? current->error : global_error; }
-static inline void set_error( int err ) { global_error = err; if (current) current->error = err; }
+static inline unsigned int get_error(void)       { return current ? current->error : global_error; }
+static inline void set_error( unsigned int err ) { global_error = err; if (current) current->error = err; }
 static inline void clear_error(void)    { set_error(0); }
 
 static inline void *get_thread_id( struct thread *thread ) { return thread; }
diff --git a/win32/console.c b/win32/console.c
index eca18e5..fc828e1 100644
--- a/win32/console.c
+++ b/win32/console.c
@@ -93,8 +93,8 @@
 };
 
 /* FIXME:  Should be in an internal header file.  OK, so which one?
-   Used by CONSOLE_makecomplex. */
-int wine_openpty(int *master, int *slave, char *name,
+   Used by CONSOLE_make_complex. */
+extern int wine_openpty(int *master, int *slave, char *name,
                  struct termios *term, struct winsize *winsize);
 
 /****************************************************************************
@@ -553,7 +553,7 @@
  * This makes simple commandline tools pipeable, while complex commandline 
  * tools work without getting messed up by debugoutput.
  * 
- * All other functions should work indedependend from this call.
+ * All other functions should work independent from this call.
  *
  * To test for complex console: pid == 0 -> simple, otherwise complex.
  */
@@ -1002,7 +1002,7 @@
                               LPDWORD lpNumberOfCharsRead,
                               LPVOID lpReserved )
 {
-    int		charsread = 0;
+    DWORD	charsread = 0;
     LPSTR	xbuf = (LPSTR)lpBuffer;
 
     TRACE("(%d,%p,%ld,%p,%p)\n",
@@ -1462,7 +1462,7 @@
     COORD dwCoord,
     LPDWORD lpNumCharsWritten)
 {
-    long 	count;
+    DWORD 	count;
     DWORD	xlen;
 
     SetConsoleCursorPosition(hConsoleOutput,dwCoord);
@@ -1493,7 +1493,7 @@
                                            COORD dwCoord, 
                                             LPDWORD lpNumCharsWritten)
 {
-    long	count;
+    DWORD	count;
     DWORD	xlen;
 
     SetConsoleCursorPosition(hConsoleOutput,dwCoord);
diff --git a/windows/dialog.c b/windows/dialog.c
index 0b9b3c7..7af5da4 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -859,8 +859,8 @@
 	hwndPreInitFocus = GetFocus();
 	if (SendMessageA( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ))
         {
-            /* check where the focus is again, some controls status might have changed in
-               WM_INITDIALOG */
+            /* check where the focus is again,
+	     * some controls status might have changed in WM_INITDIALOG */
             dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE); 
             SetFocus( dlgInfo->hwndFocus );
         }
@@ -1334,10 +1334,10 @@
 /***********************************************************************
  *           DIALOG_FindMsgDestination
  *
- * The messages that IsDialogMessage send may not go to the dialog
+ * The messages that IsDialogMessage sends may not go to the dialog
  * calling IsDialogMessage if that dialog is a child, and it has the
  * DS_CONTROL style set.
- * We propagate up until we hit a that does not have DS_CONTROL, or
+ * We propagate up until we hit one that does not have DS_CONTROL, or
  * whose parent is not a dialog.
  *
  * This is undocumented behaviour.
@@ -1966,7 +1966,8 @@
 
     if(hwndCtrl)
     {
-        /* if the hwndCtrl is the child of the control in the hwndDlg then the hwndDlg has to be the parent of the hwndCtrl */
+        /* if the hwndCtrl is the child of the control in the hwndDlg,
+	 * then the hwndDlg has to be the parent of the hwndCtrl */
         if(GetParent(hwndCtrl) != hwndDlg && GetParent(GetParent(hwndCtrl)) == hwndDlg)
             hwndDlg = GetParent(hwndCtrl);
     }
diff --git a/windows/x11drv/clipboard.c b/windows/x11drv/clipboard.c
index d9290a7..1440456 100644
--- a/windows/x11drv/clipboard.c
+++ b/windows/x11drv/clipboard.c
@@ -49,6 +49,7 @@
 
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
 
@@ -291,7 +292,7 @@
         TRACE("Waiting for clipboard server to acquire selection\n");
 
         if ( WaitForSingleObject( selectionClearEvent, 60000 ) != WAIT_OBJECT_0 )
-            TRACE("Server could not acquire selection, or a time out occured!\n");
+            TRACE("Server could not acquire selection, or a timeout occurred!\n");
         else
             TRACE("Server successfully acquired selection\n");