# HG changeset patch # User serb # Date 1500902783 -3600 # Node ID 02e2b83365a6897d077a0000e63e748312b80c49 # Parent 851cd45750d26e3c939034fc7ecfe641aaa822be 8080492: [Parfait] Uninitialised variable in jdk/src/java/desktop/windows/native/libawt/ Reviewed-by: prr, vadim diff -r 851cd45750d2 -r 02e2b83365a6 src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp --- a/src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp Mon Jul 24 14:23:48 2017 +0100 +++ b/src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp Mon Jul 24 14:26:23 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -508,8 +508,10 @@ RETURN_STATUS_IF_NULL(srcOps->pResource, E_FAIL); RETURN_STATUS_IF_NULL(dstOps->pResource, E_FAIL); - if ((pSrc = srcOps->pResource->GetTexture()) == NULL || - FAILED(res = d3dc->BeginScene(STATE_TEXTUREOP) || + pSrc = srcOps->pResource->GetTexture(); + RETURN_STATUS_IF_NULL(pSrc, E_FAIL); + + if (FAILED(res = d3dc->BeginScene(STATE_TEXTUREOP) || FAILED(res = d3dc->SetTexture(pSrc)))) { J2dRlsTraceLn(J2D_TRACE_ERROR, diff -r 851cd45750d2 -r 02e2b83365a6 src/windows/native/sun/java2d/d3d/D3DTextRenderer.cpp --- a/src/windows/native/sun/java2d/d3d/D3DTextRenderer.cpp Mon Jul 24 14:23:48 2017 +0100 +++ b/src/windows/native/sun/java2d/d3d/D3DTextRenderer.cpp Mon Jul 24 14:26:23 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -355,7 +355,7 @@ jint dx1, dy1, dx2, dy2; D3DResource *pCachedDestTexRes; IDirect3DSurface9 *pCachedDestSurface, *pDst; - HRESULT res; + HRESULT res = S_OK; if (isCachedDestValid && INSIDE(gx1, gy1, gx2, gy2, cachedDestBounds)) { // glyph is already within the cached destination bounds; no need diff -r 851cd45750d2 -r 02e2b83365a6 src/windows/native/sun/windows/ShellFolder2.cpp --- a/src/windows/native/sun/windows/ShellFolder2.cpp Mon Jul 24 14:23:48 2017 +0100 +++ b/src/windows/native/sun/windows/ShellFolder2.cpp Mon Jul 24 14:26:23 2017 +0100 @@ -673,6 +673,9 @@ case STRRET_WSTR : wstr = strret.pOleStr; break; + + default: + return NULL; } IShellLinkW* psl; diff -r 851cd45750d2 -r 02e2b83365a6 src/windows/native/sun/windows/awt_Component.cpp --- a/src/windows/native/sun/windows/awt_Component.cpp Mon Jul 24 14:23:48 2017 +0100 +++ b/src/windows/native/sun/windows/awt_Component.cpp Mon Jul 24 14:26:23 2017 +0100 @@ -5177,6 +5177,8 @@ message = WM_MBUTTONDOWN; break; case java_awt_event_MouseEvent_BUTTON2: message = WM_RBUTTONDOWN; break; + default: + return; } break; } @@ -5188,6 +5190,8 @@ message = WM_MBUTTONUP; break; case java_awt_event_MouseEvent_BUTTON2: message = WM_RBUTTONUP; break; + default: + return; } break; } diff -r 851cd45750d2 -r 02e2b83365a6 src/windows/native/sun/windows/awt_DesktopProperties.cpp --- a/src/windows/native/sun/windows/awt_DesktopProperties.cpp Mon Jul 24 14:23:48 2017 +0100 +++ b/src/windows/native/sun/windows/awt_DesktopProperties.cpp Mon Jul 24 14:26:23 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -371,7 +371,7 @@ } BOOL fontSmoothing = FALSE, settingsChanged; - UINT fontSmoothingType=0, fontSmoothingContrast=0, subPixelOrder; + UINT fontSmoothingType=0, fontSmoothingContrast=0, subPixelOrder=0; if (firstTime) { SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &fontSmoothing, 0); diff -r 851cd45750d2 -r 02e2b83365a6 src/windows/native/sun/windows/awt_Font.cpp --- a/src/windows/native/sun/windows/awt_Font.cpp Mon Jul 24 14:23:48 2017 +0100 +++ b/src/windows/native/sun/windows/awt_Font.cpp Mon Jul 24 14:26:23 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -264,7 +264,7 @@ cfnum = 0; } - LPCWSTR wName; + LPCWSTR wName = NULL; awtFont = new AwtFont(cfnum, env, font); @@ -1178,7 +1178,7 @@ } LONG AwtFontCache::IncRefCount(Item* item){ - LONG newVal; + LONG newVal = 0; if(NULL != item){ newVal = InterlockedIncrement((long*)&item->refCount); @@ -1187,7 +1187,7 @@ } LONG AwtFontCache::DecRefCount(Item* item){ - LONG newVal; + LONG newVal = 0; if(NULL != item){ newVal = InterlockedDecrement((long*)&item->refCount); diff -r 851cd45750d2 -r 02e2b83365a6 src/windows/native/sun/windows/awt_Frame.cpp --- a/src/windows/native/sun/windows/awt_Frame.cpp Mon Jul 24 14:23:48 2017 +0100 +++ b/src/windows/native/sun/windows/awt_Frame.cpp Mon Jul 24 14:26:23 2017 +0100 @@ -145,7 +145,7 @@ PDATA pData; HWND hwndParent = NULL; - AwtFrame* frame; + AwtFrame* frame = NULL; jclass cls = NULL; jclass inputMethodWindowCls = NULL; jobject target = NULL; @@ -920,7 +920,9 @@ AwtComponent::SetFocusedWindow(GetHWnd()); } else { - if (!::IsWindow(AwtWindow::GetModalBlocker(opposite))) { + if (::IsWindow(AwtWindow::GetModalBlocker(opposite))) { + return mrConsume; + } else { // If deactivation happens because of press on grabbing // window - this is nonsense, since grabbing window is // assumed to have focus and watch for deactivation. But diff -r 851cd45750d2 -r 02e2b83365a6 src/windows/native/sun/windows/awt_Label.cpp --- a/src/windows/native/sun/windows/awt_Label.cpp Mon Jul 24 14:23:48 2017 +0100 +++ b/src/windows/native/sun/windows/awt_Label.cpp Mon Jul 24 14:26:23 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -146,15 +146,16 @@ jint alignment = env->GetIntField(target, AwtLabel::alignmentID); switch (alignment) { - case java_awt_Label_LEFT: - x = r.left + 2; - break; case java_awt_Label_CENTER: x = (r.left + r.right - size.cx) / 2; break; case java_awt_Label_RIGHT: x = r.right - 2 - size.cx; break; + case java_awt_Label_LEFT: + default: + x = r.left + 2; + break; } /* draw string */ if (isEnabled()) { diff -r 851cd45750d2 -r 02e2b83365a6 src/windows/native/sun/windows/awt_PrintJob.cpp --- a/src/windows/native/sun/windows/awt_PrintJob.cpp Mon Jul 24 14:23:48 2017 +0100 +++ b/src/windows/native/sun/windows/awt_PrintJob.cpp Mon Jul 24 14:26:23 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1072,7 +1072,7 @@ // check for collation HGLOBAL hDevNames = AwtPrintControl::getPrintHDName(env, self); if (hDevNames != NULL) { - DWORD dmFields; + DWORD dmFields = 0; DEVNAMES *devnames = (DEVNAMES *)::GlobalLock(hDevNames); if (devnames != NULL) { diff -r 851cd45750d2 -r 02e2b83365a6 src/windows/native/sun/windows/awt_TextComponent.cpp --- a/src/windows/native/sun/windows/awt_TextComponent.cpp Mon Jul 24 14:23:48 2017 +0100 +++ b/src/windows/native/sun/windows/awt_TextComponent.cpp Mon Jul 24 14:26:23 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -129,6 +129,7 @@ scroll_style = WS_HSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL; break; case java_awt_TextArea_SCROLLBARS_BOTH: + default: scroll_style = WS_VSCROLL | WS_HSCROLL | ES_AUTOVSCROLL | ES_AUTOHSCROLL; break;