From 5b53c0b88bda6b67691ae80ecfbaa858279ce99d Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Thu, 5 Nov 2015 21:00:42 -0700 Subject: [PATCH] user32: Avoid double initialization. Signed-off-by: Alex Henrie Signed-off-by: Alexandre Julliard --- 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 e891c58e3b0..c744ee57345 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 ea3f2ef4b45..7d8d620d2e0 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 7a30ed25272..633331d2ad6 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 ddbfa863fcf..d66d2e0ed5d 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 9d834a84742..d2a79f2a9b6 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 3b48fbb52f1..8df38c941d4 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 488141b87ec..ca40ed07164 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 090ec17267c..f674b2ce35e 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 93c28221275..95cb51331e6 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 cf065e4e7a2..b73aa79e0d1 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 41b50774492..d0a472a3cb8 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 2db18b4e7a8..c07a8cbc448 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 42bd9bbb23f..96e7f2e7dcd 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 00f2bd95fda..2ba98c98c48 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 5c1dc692830..1dea98d9908 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 1f762418cac..55722c16edd 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 66a35d29f7f..642da5763b1 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 66749e32ea5..87bc97be784 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;