[PATCH] user32: Avoid double initialization.

Alex Henrie alexhenrie24 at gmail.com
Thu Nov 5 22:00:42 CST 2015


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/user32/combo.c      |  2 +-
 dlls/user32/cursoricon.c |  4 ++--
 dlls/user32/dde_client.c |  6 +++---
 dlls/user32/dde_misc.c   |  4 ++--
 dlls/user32/dde_server.c | 14 +++++++-------
 dlls/user32/dialog.c     |  4 ++--
 dlls/user32/edit.c       |  8 +++-----
 dlls/user32/hook.c       |  2 +-
 dlls/user32/icontitle.c  |  2 +-
 dlls/user32/listbox.c    |  4 ++--
 dlls/user32/mdi.c        |  2 +-
 dlls/user32/menu.c       |  2 +-
 dlls/user32/message.c    |  2 +-
 dlls/user32/msgbox.c     |  2 +-
 dlls/user32/painting.c   |  2 +-
 dlls/user32/sysparams.c  |  2 +-
 dlls/user32/text.c       |  2 +-
 dlls/user32/win.c        |  4 ++--
 18 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c
index e891c58..c744ee5 100644
--- a/dlls/user32/combo.c
+++ b/dlls/user32/combo.c
@@ -974,7 +974,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
     HMONITOR monitor;
     MONITORINFO mon_info;
    RECT rect,r;
-   int nItems = 0;
+   int nItems;
    int nDroppedHeight;
 
    TRACE("[%p]: drop down\n", lphc->self);
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index ea3f2ef..7d8d620 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -1094,9 +1094,9 @@ static HCURSOR CURSORICON_CreateIconFromANI( const BYTE *bits, DWORD bits_size,
     struct cursoricon_object *info;
     DWORD *frame_rates = NULL;
     DWORD *frame_seq = NULL;
-    ani_header header = {0};
+    ani_header header;
     BOOL use_seq = FALSE;
-    HCURSOR cursor = 0;
+    HCURSOR cursor;
     UINT i;
     BOOL error = FALSE;
     HICON *frames;
diff --git a/dlls/user32/dde_client.c b/dlls/user32/dde_client.c
index 7a30ed2..633331d 100644
--- a/dlls/user32/dde_client.c
+++ b/dlls/user32/dde_client.c
@@ -97,7 +97,7 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
 {
     HWND		hwndClient;
     WDML_INSTANCE*	pInstance;
-    WDML_CONV*		pConv = NULL;
+    WDML_CONV*		pConv;
     ATOM		aSrv = 0, aTpc = 0;
 
     TRACE("(0x%x,%p,%p,%p)\n", idInst, hszService, hszTopic, pCC);
@@ -1135,7 +1135,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
 {
     WDML_CONV*		pConv;
     WDML_XACT*		pXAct;
-    HDDEDATA		hDdeData = 0;
+    HDDEDATA		hDdeData;
 
     TRACE("(%p,%d,%p,%p,%x,%x,%d,%p)\n",
 	  pData, cbData, hConv, hszItem, wFmt, wType, dwTimeout, pdwResult);
@@ -1373,7 +1373,7 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA
  */
 BOOL WINAPI DdeDisconnect(HCONV hConv)
 {
-    WDML_CONV*	pConv = NULL;
+    WDML_CONV*	pConv;
     WDML_XACT*	pXAct;
     BOOL	ret = FALSE;
 
diff --git a/dlls/user32/dde_misc.c b/dlls/user32/dde_misc.c
index ddbfa86..d66d2e0 100644
--- a/dlls/user32/dde_misc.c
+++ b/dlls/user32/dde_misc.c
@@ -1881,7 +1881,7 @@ static void WDML_RemoveAllLinks(WDML_INSTANCE* pInstance, WDML_CONV* pConv, WDML
 WDML_LINK* 	WDML_FindLink(WDML_INSTANCE* pInstance, HCONV hConv, WDML_SIDE side,
 			      HSZ hszItem, BOOL use_fmt, UINT uFmt)
 {
-    WDML_LINK*	pCurrent = NULL;
+    WDML_LINK*	pCurrent;
 
     for (pCurrent = pInstance->links[side]; pCurrent != NULL; pCurrent = pCurrent->next)
     {
@@ -2061,7 +2061,7 @@ WDML_CONV*	WDML_AddConv(WDML_INSTANCE* pInstance, WDML_SIDE side,
 WDML_CONV*	WDML_FindConv(WDML_INSTANCE* pInstance, WDML_SIDE side,
 			      HSZ hszService, HSZ hszTopic)
 {
-    WDML_CONV*	pCurrent = NULL;
+    WDML_CONV*	pCurrent;
 
     for (pCurrent = pInstance->convs[side]; pCurrent != NULL; pCurrent = pCurrent->next)
     {
diff --git a/dlls/user32/dde_server.c b/dlls/user32/dde_server.c
index 9d834a8..d2a79f2 100644
--- a/dlls/user32/dde_server.c
+++ b/dlls/user32/dde_server.c
@@ -60,12 +60,12 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND, UINT, WPARAM, LPARAM);
  */
 BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem)
 {
-    WDML_INSTANCE*	pInstance = NULL;
-    WDML_LINK*		pLink = NULL;
-    HDDEDATA		hDdeData = 0;
-    HGLOBAL             hItemData = 0;
-    WDML_CONV*		pConv = NULL;
-    ATOM		atom = 0;
+    WDML_INSTANCE*	pInstance;
+    WDML_LINK*		pLink;
+    HDDEDATA		hDdeData;
+    HGLOBAL		hItemData;
+    WDML_CONV*		pConv;
+    ATOM		atom;
     UINT		count;
 
     TRACE("(%d,%p,%p)\n", idInst, hszTopic, hszItem);
@@ -378,7 +378,7 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
 {
     HWND		hwndClient;
     HSZ			hszApp, hszTop;
-    HDDEDATA		hDdeData = 0;
+    HDDEDATA		hDdeData;
     WDML_INSTANCE*	pInstance;
     UINT_PTR		uiLo, uiHi;
 
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index 3b48fbb..8df38c9 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -489,7 +489,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
     POINT pos;
     SIZE size;
     DLG_TEMPLATE template;
-    DIALOGINFO * dlgInfo = NULL;
+    DIALOGINFO * dlgInfo;
     DWORD units = GetDialogBaseUnits();
     BOOL ownerEnabled = TRUE;
     HMENU hMenu = 0;
@@ -917,7 +917,7 @@ INT_PTR WINAPI DialogBoxIndirectParamW(HINSTANCE hInstance, LPCDLGTEMPLATEW temp
  */
 BOOL WINAPI EndDialog( HWND hwnd, INT_PTR retval )
 {
-    BOOL wasEnabled = TRUE;
+    BOOL wasEnabled;
     DIALOGINFO * dlgInfo;
     HWND owner;
 
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index 488141b..ca40ed0 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -498,7 +498,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta
 	LINEDEF *current_line;
 	LINEDEF *previous_line;
 	LINEDEF *start_line;
-	INT line_index = 0, nstart_line = 0, nstart_index = 0;
+	INT line_index = 0, nstart_line, nstart_index;
 	INT line_count = es->line_count;
 	INT orig_net_length;
 	RECT rc;
@@ -1079,7 +1079,7 @@ static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap)
 	INT x = 0;
 	INT y = 0;
 	INT w;
-	INT lw = 0;
+	INT lw;
 	LINEDEF *line_def;
 
 	index = min(index, len);
@@ -4299,7 +4299,7 @@ static LRESULT EDIT_EM_GetThumb(EDITSTATE *es)
 static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es)
 {
     LONG buflen;
-    LPWSTR lpCompStr = NULL;
+    LPWSTR lpCompStr;
     LPSTR lpCompStrAttr = NULL;
     DWORD dwBufLenAttr;
 
@@ -4342,8 +4342,6 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es)
                     dwBufLenAttr);
             lpCompStrAttr[dwBufLenAttr] = 0;
         }
-        else
-            lpCompStrAttr = NULL;
     }
 
     /* check for change in composition start */
diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c
index 090ec17..f674b2c 100644
--- a/dlls/user32/hook.c
+++ b/dlls/user32/hook.c
@@ -475,7 +475,7 @@ LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL uni
 {
     struct user_thread_info *thread_info = get_user_thread_info();
     struct hook_info info;
-    DWORD_PTR ret = 0;
+    DWORD_PTR ret;
 
     USER_CheckNotLock();
 
diff --git a/dlls/user32/icontitle.c b/dlls/user32/icontitle.c
index 93c2822..95cb513 100644
--- a/dlls/user32/icontitle.c
+++ b/dlls/user32/icontitle.c
@@ -135,7 +135,7 @@ static BOOL ICONTITLE_Paint( HWND hwnd, HWND owner, HDC hDC, BOOL bActive )
 {
     RECT rect;
     HFONT hPrevFont;
-    HBRUSH hBrush = 0;
+    HBRUSH hBrush;
     COLORREF textColor = 0;
 
     if( bActive )
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index cf065e4..b73aa79 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -835,7 +835,7 @@ static inline INT LISTBOX_lstrcmpiW( LCID lcid, LPCWSTR str1, LPCWSTR str2 )
  */
 static INT LISTBOX_FindStringPos( LB_DESCR *descr, LPCWSTR str, BOOL exact )
 {
-    INT index, min, max, res = -1;
+    INT index, min, max, res;
 
     if (!(descr->style & LBS_SORT)) return -1;  /* Add it at the end */
     min = 0;
@@ -878,7 +878,7 @@ static INT LISTBOX_FindStringPos( LB_DESCR *descr, LPCWSTR str, BOOL exact )
  */
 static INT LISTBOX_FindFileStrPos( LB_DESCR *descr, LPCWSTR str )
 {
-    INT min, max, res = -1;
+    INT min, max, res;
 
     if (!HAS_STRINGS(descr))
         return LISTBOX_FindStringPos( descr, str, FALSE );
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c
index 41b5077..d0a472a 100644
--- a/dlls/user32/mdi.c
+++ b/dlls/user32/mdi.c
@@ -838,7 +838,7 @@ static void MDITile( HWND client, MDICLIENTINFO *ci, WPARAM wParam )
 static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild )
 {
     HMENU menu = GetMenu( frame );
-    HMENU  	hSysPopup = 0;
+    HMENU  	hSysPopup;
     HBITMAP hSysMenuBitmap = 0;
     HICON hIcon;
 
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 2db18b4..c07a8cb 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -1742,7 +1742,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc,
  */
 static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu )
 {
-    HBRUSH hPrevBrush = 0, brush = GetSysColorBrush( COLOR_MENU );
+    HBRUSH hPrevBrush, brush = GetSysColorBrush( COLOR_MENU );
     RECT rect;
     POPUPMENU *menu = MENU_GetMenu( hmenu );
 
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 42bd9bb..96e7f2e 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -1996,7 +1996,7 @@ static BOOL post_dde_message( struct packed_message *data, const struct send_mes
     void*       ptr = NULL;
     int         size = 0;
     UINT_PTR    uiLo, uiHi;
-    LPARAM      lp = 0;
+    LPARAM      lp;
     HGLOBAL     hunlock = 0;
     int         i;
     DWORD       res;
diff --git a/dlls/user32/msgbox.c b/dlls/user32/msgbox.c
index 00f2bd9..2ba98c9 100644
--- a/dlls/user32/msgbox.c
+++ b/dlls/user32/msgbox.c
@@ -71,7 +71,7 @@ static void MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
     int bspace, bw, bh, theight, tleft, wwidth, wheight, wleft, wtop, bpos;
     int borheight, borwidth, iheight, ileft, iwidth, twidth, tiheight;
     NONCLIENTMETRICSW nclm;
-    HMONITOR monitor = 0;
+    HMONITOR monitor;
     MONITORINFO mon_info;
     LPCWSTR lpszText;
     WCHAR *buffer = NULL;
diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c
index 5c1dc69..1dea98d 100644
--- a/dlls/user32/painting.c
+++ b/dlls/user32/painting.c
@@ -1220,7 +1220,7 @@ BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags )
     else  /* need to build a list of the region rectangles */
     {
         DWORD size;
-        RGNDATA *data = NULL;
+        RGNDATA *data;
 
         if (!(size = GetRegionData( hrgn, 0, NULL ))) return FALSE;
         if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE;
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c
index 1f76241..55722c1 100644
--- a/dlls/user32/sysparams.c
+++ b/dlls/user32/sysparams.c
@@ -536,7 +536,7 @@ static BOOL get_base_keys( enum parameter_key index, HKEY *base_key, HKEY *volat
 /* load a value to a registry entry */
 static DWORD load_entry( struct sysparam_entry *entry, void *data, DWORD size )
 {
-    DWORD type, count = 0;
+    DWORD type, count;
     HKEY base_key, volatile_key;
 
     if (!get_base_keys( entry->regval[0], &base_key, &volatile_key )) return FALSE;
diff --git a/dlls/user32/text.c b/dlls/user32/text.c
index 66a35d2..642da57 100644
--- a/dlls/user32/text.c
+++ b/dlls/user32/text.c
@@ -1214,7 +1214,7 @@ static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb, GRAYSTRINGPROC fn, LPARAM lp, IN
     HFONT hfsave;
     HDC memdc;
     int slen = len;
-    BOOL retval = TRUE;
+    BOOL retval;
     COLORREF fg, bg;
 
     if(!hdc) return FALSE;
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 66749e3..87bc97b 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -354,7 +354,7 @@ static HWND *list_window_parents( HWND hwnd )
 {
     WND *win;
     HWND current, *list;
-    int i, pos = 0, size = 16, count = 0;
+    int i, pos = 0, size = 16, count;
 
     if (!(list = HeapAlloc( GetProcessHeap(), 0, size * sizeof(HWND) ))) return NULL;
 
@@ -1911,7 +1911,7 @@ BOOL WINAPI OpenIcon( HWND hwnd )
  */
 HWND WINAPI FindWindowExW( HWND parent, HWND child, LPCWSTR className, LPCWSTR title )
 {
-    HWND *list = NULL;
+    HWND *list;
     HWND retvalue = 0;
     int i = 0, len = 0;
     WCHAR *buffer = NULL;
-- 
2.6.2




More information about the wine-patches mailing list