From 58d5a0a786012672d1b0b349c346158d93b9694c Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Sat, 29 Jul 2000 21:58:17 +0000
Subject: [PATCH] Removed some unnecessary inclusions of wingdi.h and winuser.h

---
 debugger/winedbg.c        |  3 ++-
 dlls/crtdll/crtdll.spec   |  4 ++--
 dlls/crtdll/crtdll_main.c | 25 -------------------------
 graphics/painting.c       |  4 +---
 graphics/x11drv/xfont.c   |  7 +++----
 if1632/snoop.c            |  2 --
 include/winbase.h         | 24 ++++++++++++++++++------
 include/winuser.h         | 13 -------------
 loader/resource.c         |  5 +----
 memory/atom.c             |  3 ---
 memory/environ.c          |  2 --
 misc/comm.c               |  2 --
 misc/lstr.c               |  2 +-
 objects/gdiobj.c          |  3 +--
 objects/region.c          |  1 -
 objects/text.c            |  1 -
 relay32/builtin32.c       |  2 --
 relay32/snoop.c           |  6 ++----
 win32/device.c            |  2 --
 win32/except.c            |  2 --
 20 files changed, 31 insertions(+), 82 deletions(-)

diff --git a/debugger/winedbg.c b/debugger/winedbg.c
index bcd75ed0696..9cc3a6e635b 100644
--- a/debugger/winedbg.c
+++ b/debugger/winedbg.c
@@ -6,6 +6,7 @@
  */
 
 #include <stdlib.h>
+#include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
 #include "debugger.h"
@@ -49,7 +50,7 @@ int	DEBUG_Printf(int chn, const char* format, ...)
     int		len;
 
     va_start(valist, format);
-    len = wvsnprintf(buf, sizeof(buf), format, valist);
+    len = vsnprintf(buf, sizeof(buf), format, valist);
     va_end(valist);
 
     if (len <= -1) {
diff --git a/dlls/crtdll/crtdll.spec b/dlls/crtdll/crtdll.spec
index 92d1aac1d68..22a9404932e 100644
--- a/dlls/crtdll/crtdll.spec
+++ b/dlls/crtdll/crtdll.spec
@@ -322,7 +322,7 @@ import	ntdll
 @ cdecl _unlink(str) CRTDLL__unlink
 @ stub _unloaddll
 @ stub _utime
-@ cdecl _vsnprintf(ptr long ptr ptr) CRTDLL__vsnprintf
+@ cdecl _vsnprintf(ptr long ptr ptr) vsnprintf
 @ stub _vsnwprintf
 @ cdecl _wcsdup(wstr) CRTDLL__wcsdup
 @ forward _wcsicmp ntdll._wcsicmp
@@ -504,7 +504,7 @@ import	ntdll
 @ cdecl vfprintf(ptr str ptr) CRTDLL_vfprintf
 @ stub vfwprintf
 @ stub vprintf
-@ cdecl vsprintf(ptr str ptr) CRTDLL_vsprintf
+@ cdecl vsprintf(ptr str ptr) vsprintf
 @ cdecl vswprintf(ptr wstr ptr) CRTDLL_vswprintf
 @ stub vwprintf
 @ forward wcscat ntdll.wcscat
diff --git a/dlls/crtdll/crtdll_main.c b/dlls/crtdll/crtdll_main.c
index 765096536fc..e6d4c311b7e 100644
--- a/dlls/crtdll/crtdll_main.c
+++ b/dlls/crtdll/crtdll_main.c
@@ -931,22 +931,6 @@ int __cdecl CRTDLL__mbsicmp(unsigned char *x,unsigned char *y)
 }
 
 
-/*********************************************************************
- *                  vsprintf      (CRTDLL.500)
- */
-INT __cdecl CRTDLL_vsprintf( LPSTR buffer, LPCSTR spec, va_list args )
-{
-    return wvsprintfA( buffer, spec, args );
-}
-
-/*********************************************************************
- *                  _vsnprintf      (CRTDLL.@)
- */
-INT __cdecl CRTDLL__vsnprintf(LPSTR buffer,DWORD size,LPCSTR spec,va_list args )
-{
-    return wvsnprintfA( buffer, size, spec, args );
-}
-
 /*********************************************************************
  *                  vswprintf      (CRTDLL.501)
  */
@@ -1639,15 +1623,6 @@ LPSTR __cdecl CRTDLL_tmpnam(LPSTR s)
 
 }
 
-/*********************************************************************
- *                  _itoa           (CRTDLL.165)
- */
-LPSTR  __cdecl CRTDLL__itoa(INT x,LPSTR buf,INT buflen)
-{
-    wsnprintfA(buf,buflen,"%d",x);
-    return buf;
-}
-
 
 typedef VOID (*sig_handler_type)(VOID);
 
diff --git a/graphics/painting.c b/graphics/painting.c
index a8a1312b708..3cfe190763d 100644
--- a/graphics/painting.c
+++ b/graphics/painting.c
@@ -18,10 +18,8 @@
 #include "winerror.h"
 #include "windef.h"
 #include "wingdi.h"
-#include "winuser.h"
-#include "wine/winuser16.h"
 
-DEFAULT_DEBUG_CHANNEL(gdi)
+DEFAULT_DEBUG_CHANNEL(gdi);
 
 
 /***********************************************************************
diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c
index 1822f8189bc..b67c94baad5 100644
--- a/graphics/x11drv/xfont.c
+++ b/graphics/x11drv/xfont.c
@@ -26,7 +26,6 @@
 
 #include "windef.h"
 #include "wingdi.h"
-#include "winuser.h"
 #include "winnls.h"
 #include "heap.h"
 #include "options.h"
@@ -1307,7 +1306,7 @@ static void XFONT_WindowsNames(void)
 	    }
 
 	lpch = fr->lfFaceName;
-	wsnprintfA( fr->lfFaceName, sizeof(fr->lfFaceName), "%s %s",
+	snprintf( fr->lfFaceName, sizeof(fr->lfFaceName), "%s %s",
 					  /* prepend vendor name */
 					  (pfr==fr) ? "" : fr->resource->foundry,
 					  fr->resource->family);
@@ -1570,7 +1569,7 @@ static void XFONT_LoadAliases(void)
     {
         BOOL bHaveAlias, bSubst;
 	char subsection[32];
-        wsnprintfA( subsection, sizeof subsection, "%s%i", INIAliasSection, i++ );
+        snprintf( subsection, sizeof subsection, "%s%i", INIAliasSection, i++ );
 
 	bHaveAlias = PROFILE_GetWineIniString( INIFontSection, 
 						subsection, "", buffer, sizeof buffer);
@@ -1700,7 +1699,7 @@ static void XFONT_LoadIgnores(void)
     /* Others from INI file */
     do
     {
-	wsprintfA( subsection, "%s%i", INIIgnoreSection, i++ );
+	sprintf( subsection, "%s%i", INIIgnoreSection, i++ );
 
 	if( PROFILE_GetWineIniString( INIFontSection,
 				      subsection, "", buffer, sizeof buffer) )
diff --git a/if1632/snoop.c b/if1632/snoop.c
index fd6bc73c13e..352ced28379 100644
--- a/if1632/snoop.c
+++ b/if1632/snoop.c
@@ -9,8 +9,6 @@
 #include <stdio.h>
 #include "winbase.h"
 #include "windef.h"
-#include "wingdi.h"
-#include "winuser.h"
 #include "winnt.h"
 #include "heap.h"
 #include "global.h"
diff --git a/include/winbase.h b/include/winbase.h
index d40efbb5780..26c610162d7 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -1711,6 +1711,7 @@ UINT      WINAPI GetAtomNameW(ATOM,LPWSTR,INT);
 UINT      WINAPI GetCurrentDirectoryA(UINT,LPSTR);
 UINT      WINAPI GetCurrentDirectoryW(UINT,LPWSTR);
 #define     GetCurrentDirectory WINELIB_NAME_AW(GetCurrentDirectory)
+#define     GetCurrentTime() GetTickCount()
 BOOL      WINAPI GetDiskFreeSpaceA(LPCSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
 BOOL      WINAPI GetDiskFreeSpaceW(LPCWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
 #define     GetDiskFreeSpace WINELIB_NAME_AW(GetDiskFreeSpace)
@@ -1720,6 +1721,7 @@ BOOL      WINAPI GetDiskFreeSpaceExW(LPCWSTR,PULARGE_INTEGER,PULARGE_INTEGER,PUL
 UINT      WINAPI GetDriveTypeA(LPCSTR);
 UINT      WINAPI GetDriveTypeW(LPCWSTR);
 #define     GetDriveType WINELIB_NAME_AW(GetDriveType)
+BOOL        WINAPI GetExitCodeProcess(HANDLE,LPDWORD);
 DWORD       WINAPI GetFileAttributesA(LPCSTR);
 DWORD       WINAPI GetFileAttributesW(LPCWSTR);
 #define     GetFileAttributes WINELIB_NAME_AW(GetFileAttributes)
@@ -1771,26 +1773,36 @@ BOOL      WINAPI GetStringTypeW(DWORD,LPCWSTR,INT,LPWORD);
 UINT      WINAPI GetSystemDirectoryA(LPSTR,UINT);
 UINT      WINAPI GetSystemDirectoryW(LPWSTR,UINT);
 #define     GetSystemDirectory WINELIB_NAME_AW(GetSystemDirectory)
-UINT      WINAPI GetTempFileNameA(LPCSTR,LPCSTR,UINT,LPSTR);
-UINT      WINAPI GetTempFileNameW(LPCWSTR,LPCWSTR,UINT,LPWSTR);
+DWORD       WINAPI GetTickCount(void);
+UINT        WINAPI GetTempFileNameA(LPCSTR,LPCSTR,UINT,LPSTR);
+UINT        WINAPI GetTempFileNameW(LPCWSTR,LPCWSTR,UINT,LPWSTR);
 #define     GetTempFileName WINELIB_NAME_AW(GetTempFileName)
 UINT      WINAPI GetTempPathA(UINT,LPSTR);
 UINT      WINAPI GetTempPathW(UINT,LPWSTR);
 #define     GetTempPath WINELIB_NAME_AW(GetTempPath)
 LONG        WINAPI GetVersion(void);
-BOOL      WINAPI GetExitCodeProcess(HANDLE,LPDWORD);
 BOOL      WINAPI GetVolumeInformationA(LPCSTR,LPSTR,DWORD,LPDWORD,LPDWORD,LPDWORD,LPSTR,DWORD);
 BOOL      WINAPI GetVolumeInformationW(LPCWSTR,LPWSTR,DWORD,LPDWORD,LPDWORD,LPDWORD,LPWSTR,DWORD);
 #define     GetVolumeInformation WINELIB_NAME_AW(GetVolumeInformation)
 UINT      WINAPI GetWindowsDirectoryA(LPSTR,UINT);
 UINT      WINAPI GetWindowsDirectoryW(LPWSTR,UINT);
 #define     GetWindowsDirectory WINELIB_NAME_AW(GetWindowsDirectory)
+ATOM        WINAPI GlobalAddAtomA(LPCSTR);
+ATOM        WINAPI GlobalAddAtomW(LPCWSTR);
+#define     GlobalAddAtom WINELIB_NAME_AW(GlobalAddAtom)
 HGLOBAL16   WINAPI GlobalAlloc16(UINT16,DWORD);
-HGLOBAL   WINAPI GlobalAlloc(UINT,DWORD);
+HGLOBAL     WINAPI GlobalAlloc(UINT,DWORD);
 DWORD       WINAPI GlobalCompact(DWORD);
-UINT      WINAPI GlobalFlags(HGLOBAL);
+ATOM        WINAPI GlobalDeleteAtom(ATOM);
+ATOM        WINAPI GlobalFindAtomA(LPCSTR);
+ATOM        WINAPI GlobalFindAtomW(LPCWSTR);
+#define     GlobalFindAtom WINELIB_NAME_AW(GlobalFindAtom)
+UINT        WINAPI GlobalFlags(HGLOBAL);
 HGLOBAL16   WINAPI GlobalFree16(HGLOBAL16);
-HGLOBAL   WINAPI GlobalFree(HGLOBAL);
+HGLOBAL     WINAPI GlobalFree(HGLOBAL);
+UINT        WINAPI GlobalGetAtomNameA(ATOM,LPSTR,INT);
+UINT        WINAPI GlobalGetAtomNameW(ATOM,LPWSTR,INT);
+#define     GlobalGetAtomName WINELIB_NAME_AW(GlobalGetAtomName)
 HGLOBAL   WINAPI GlobalHandle(LPCVOID);
 WORD        WINAPI GlobalFix16(HGLOBAL16);
 VOID        WINAPI GlobalFix(HGLOBAL);
diff --git a/include/winuser.h b/include/winuser.h
index 5e9ba94c1c3..666f86e1986 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -3097,14 +3097,11 @@ DWORD       WINAPI GetMenuCheckMarkDimensions(void);
 LONG        WINAPI GetMessageExtraInfo(void);
 DWORD       WINAPI GetMessagePos(void);
 LONG        WINAPI GetMessageTime(void);
-DWORD       WINAPI GetTickCount(void);
-ATOM        WINAPI GlobalDeleteAtom(ATOM);
 DWORD       WINAPI OemKeyScan(WORD);
 BOOL        WINAPI ReleaseCapture(void);
 BOOL        WINAPI SetKeyboardState(LPBYTE);
 VOID        WINAPI WaitMessage(void);
 
-
 /* Declarations for functions that change between Win16 and Win32 */
 
 BOOL      WINAPI AdjustWindowRect(LPRECT,DWORD,BOOL);
@@ -3369,7 +3366,6 @@ INT       WINAPI GetClipboardFormatNameW(UINT,LPWSTR,INT);
 HWND      WINAPI GetClipboardOwner(void);
 HWND      WINAPI GetClipboardViewer(void);
 BOOL      WINAPI GetClipCursor(LPRECT);
-#define     GetCurrentTime() GetTickCount()
 HCURSOR   WINAPI GetCursor(void);
 BOOL      WINAPI GetCursorPos(LPPOINT);
 HDC       WINAPI GetDC(HWND);
@@ -3453,15 +3449,6 @@ INT       WINAPI GetWindowTextLengthA(HWND);
 INT       WINAPI GetWindowTextLengthW(HWND);
 #define     GetWindowTextLength WINELIB_NAME_AW(GetWindowTextLength)
 WORD        WINAPI GetWindowWord(HWND,INT);
-ATOM        WINAPI GlobalAddAtomA(LPCSTR);
-ATOM        WINAPI GlobalAddAtomW(LPCWSTR);
-#define     GlobalAddAtom WINELIB_NAME_AW(GlobalAddAtom)
-ATOM        WINAPI GlobalFindAtomA(LPCSTR);
-ATOM        WINAPI GlobalFindAtomW(LPCWSTR);
-#define     GlobalFindAtom WINELIB_NAME_AW(GlobalFindAtom)
-UINT      WINAPI GlobalGetAtomNameA(ATOM,LPSTR,INT);
-UINT      WINAPI GlobalGetAtomNameW(ATOM,LPWSTR,INT);
-#define     GlobalGetAtomName WINELIB_NAME_AW(GlobalGetAtomName)
 BOOL      WINAPI GrayStringA(HDC,HBRUSH,GRAYSTRINGPROC,LPARAM,
                                  INT,INT,INT,INT,INT);
 BOOL      WINAPI GrayStringW(HDC,HBRUSH,GRAYSTRINGPROC,LPARAM,
diff --git a/loader/resource.c b/loader/resource.c
index 05681c08e16..9c5d982ae3b 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -12,12 +12,9 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include "winbase.h"
 #include "windef.h"
-#include "wingdi.h"
-#include "winuser.h"
+#include "winbase.h"
 #include "wine/winbase16.h"
-#include "wine/winuser16.h"
 #include "wine/exception.h"
 #include "ldt.h"
 #include "global.h"
diff --git a/memory/atom.c b/memory/atom.c
index fadbe6111e8..df7a36e70df 100644
--- a/memory/atom.c
+++ b/memory/atom.c
@@ -17,10 +17,7 @@
 #include <ctype.h>
 
 #include "windef.h"
-#include "wingdi.h"
-#include "winuser.h"
 #include "wine/winbase16.h"
-#include "wine/winuser16.h"
 #include "winerror.h"
 #include "instance.h"
 #include "ldt.h"
diff --git a/memory/environ.c b/memory/environ.c
index 07f8c97f497..e6adfa73c80 100644
--- a/memory/environ.c
+++ b/memory/environ.c
@@ -7,8 +7,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include "windef.h"
-#include "wingdi.h"
-#include "winuser.h"
 #include "wine/winestring.h"
 #include "process.h"
 #include "heap.h"
diff --git a/misc/comm.c b/misc/comm.c
index f990a9a5fdb..14f11258958 100644
--- a/misc/comm.c
+++ b/misc/comm.c
@@ -52,8 +52,6 @@
 #include <unistd.h>
 
 #include "windef.h"
-#include "wingdi.h"
-#include "wine/winuser16.h"
 #include "comm.h"
 #ifdef HAVE_SYS_MODEM_H
 # include <sys/modem.h>
diff --git a/misc/lstr.c b/misc/lstr.c
index cc4ca066fe4..5379a04e93b 100644
--- a/misc/lstr.c
+++ b/misc/lstr.c
@@ -579,7 +579,7 @@ DWORD WINAPI FormatMessage16(
 			argliststart=args+insertnr-1;
 		       
 			/* CMF - This makes a BIG assumption about va_list */
-			while (wvsnprintf16(b, sz, fmtstr, (va_list) argliststart) < 0) {
+			while (vsnprintf(b, sz, fmtstr, (va_list) argliststart) < 0) {
 			    b = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, b, sz += 100);
 			}
 			for (x=b; *x; x++) ADD_TO_T(*x);
diff --git a/objects/gdiobj.c b/objects/gdiobj.c
index 40a0b4e2145..a711a93b08c 100644
--- a/objects/gdiobj.c
+++ b/objects/gdiobj.c
@@ -23,9 +23,8 @@
 #include "tweak.h"
 #include "windef.h"
 #include "wingdi.h"
-#include "winuser.h"
 
-DEFAULT_DEBUG_CHANNEL(gdi)
+DEFAULT_DEBUG_CHANNEL(gdi);
 
 /**********************************************************************/
 
diff --git a/objects/region.c b/objects/region.c
index d397cf35da4..e644a88a9e6 100644
--- a/objects/region.c
+++ b/objects/region.c
@@ -85,7 +85,6 @@ SOFTWARE.
 #include <string.h>
 #include "windef.h"
 #include "wingdi.h"
-#include "winuser.h"
 #include "debugtools.h"
 #include "region.h"
 #include "heap.h"
diff --git a/objects/text.c b/objects/text.c
index 137c7be92f6..3f956ab8366 100644
--- a/objects/text.c
+++ b/objects/text.c
@@ -11,7 +11,6 @@
 #include "wingdi.h"
 #include "wine/winuser16.h"
 #include "winbase.h"
-#include "winuser.h"
 #include "winerror.h"
 #include "dc.h"
 #include "gdi.h"
diff --git a/relay32/builtin32.c b/relay32/builtin32.c
index 954acf23af3..453b22f6a97 100644
--- a/relay32/builtin32.c
+++ b/relay32/builtin32.c
@@ -20,8 +20,6 @@
 
 #include "windef.h"
 #include "wine/winbase16.h"
-#include "wingdi.h"
-#include "winuser.h"
 #include "builtin32.h"
 #include "elfdll.h"
 #include "file.h"
diff --git a/relay32/snoop.c b/relay32/snoop.c
index 692a097a8ee..1ed608d7328 100644
--- a/relay32/snoop.c
+++ b/relay32/snoop.c
@@ -10,8 +10,6 @@
 #include <stdio.h>
 #include <string.h>
 #include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
 #include "winnt.h"
 #include "heap.h"
 #include "builtin32.h"
@@ -231,7 +229,7 @@ SNOOP_PrintArg(DWORD x) {
 		}
 		if (!nostring) {
 			if (i>5) {
-				wsnprintfA(buf,sizeof(buf),"%08lx %s",x,debugstr_an((LPSTR)x,sizeof(buf)-10));
+				snprintf(buf,sizeof(buf),"%08lx %s",x,debugstr_an((LPSTR)x,sizeof(buf)-10));
 				ret=buf;
 			}
 		}
@@ -251,7 +249,7 @@ SNOOP_PrintArg(DWORD x) {
 		}
 		if (!nostring) {
 			if (i>5) {
-				wsnprintfA(buf,sizeof(buf),"%08lx %s",x,debugstr_wn((LPWSTR)x,sizeof(buf)-10));
+				snprintf(buf,sizeof(buf),"%08lx %s",x,debugstr_wn((LPWSTR)x,sizeof(buf)-10));
 				ret=buf;
 			}
 		}
diff --git a/win32/device.c b/win32/device.c
index a0846278395..d087de77f53 100644
--- a/win32/device.c
+++ b/win32/device.c
@@ -23,9 +23,7 @@
 #include <stdarg.h>
 #include <time.h>
 #include "windef.h"
-#include "wingdi.h"
 #include "winbase.h"
-#include "winuser.h"
 #include "winreg.h"
 #include "winerror.h"
 #include "winversion.h"
diff --git a/win32/except.c b/win32/except.c
index 889b0c881e5..5350a7a976a 100644
--- a/win32/except.c
+++ b/win32/except.c
@@ -25,8 +25,6 @@
 #include <assert.h>
 #include <stdio.h>
 #include "windef.h"
-#include "wingdi.h"
-#include "winuser.h"
 #include "winerror.h"
 #include "ntddk.h"
 #include "wine/exception.h"