From f3120e401efc3f179d5246e93c3fed65519b3754 Mon Sep 17 00:00:00 2001 From: Brian Hinz Date: Tue, 4 Oct 2011 23:53:01 +0000 Subject: [PATCH] Fixes for bug #3418258. Cleans up all of the 'unchecked' and 'deprecated' linter warnings. Several of the redundant casts have been intentionally left for clarity. Set '-serial' and '-cast' linter flags to reduce the number of warnings (it should be safe to ignore serial because the end product is a jar rather than individual class files. AFAIK, there is no performance penalty for redundant casts in Java). If anyone objects to the linter flags they can be removed (the linter flags, that is). git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4694 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- java/src/com/tigervnc/rfb/CSecurityTLS.java | 4 ++-- java/src/com/tigervnc/rfb/TightDecoder.java | 4 ++-- java/src/com/tigervnc/vncviewer/CConn.java | 8 ++++---- java/src/com/tigervnc/vncviewer/DesktopWindow.java | 8 ++++---- java/src/com/tigervnc/vncviewer/Makefile | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/java/src/com/tigervnc/rfb/CSecurityTLS.java b/java/src/com/tigervnc/rfb/CSecurityTLS.java index 355d08f4..2fbd5aab 100644 --- a/java/src/com/tigervnc/rfb/CSecurityTLS.java +++ b/java/src/com/tigervnc/rfb/CSecurityTLS.java @@ -66,7 +66,7 @@ public class CSecurityTLS extends CSecurity { if (anon) { String[] supported; - ArrayList enabled = new ArrayList(); + ArrayList enabled = new ArrayList(); supported = ssl.getSupportedCipherSuites(); @@ -74,7 +74,7 @@ public class CSecurityTLS extends CSecurity { if (supported[i].matches("TLS_DH_anon.*")) enabled.add(supported[i]); - ssl.setEnabledCipherSuites((String[])enabled.toArray(new String[0])); + ssl.setEnabledCipherSuites(enabled.toArray(new String[0])); } else { ssl.setEnabledCipherSuites(ssl.getSupportedCipherSuites()); } diff --git a/java/src/com/tigervnc/rfb/TightDecoder.java b/java/src/com/tigervnc/rfb/TightDecoder.java index 529b904d..5cce3a93 100644 --- a/java/src/com/tigervnc/rfb/TightDecoder.java +++ b/java/src/com/tigervnc/rfb/TightDecoder.java @@ -271,7 +271,7 @@ public class TightDecoder extends Decoder { } private static int[] convertByteArrayToIntArray(byte[] bytes) { vlog.info("convertByteArrayToIntArray"); - ArrayList integers = new ArrayList(); + ArrayList integers = new ArrayList(); for (int index = 0; index < bytes.length; index += 4) { byte[] fourBytes = new byte[4]; fourBytes[0] = bytes[index]; @@ -283,7 +283,7 @@ public class TightDecoder extends Decoder { } int[] ints = new int[bytes.length/4]; for (int index = 0; index < integers.size() ; index++) { - ints[index] = ((Integer)integers.get(index)).intValue(); + ints[index] = (integers.get(index)).intValue(); } return ints; } diff --git a/java/src/com/tigervnc/vncviewer/CConn.java b/java/src/com/tigervnc/vncviewer/CConn.java index 636bfacf..87847501 100644 --- a/java/src/com/tigervnc/vncviewer/CConn.java +++ b/java/src/com/tigervnc/vncviewer/CConn.java @@ -942,8 +942,8 @@ public class CConn extends CConnection } clipboardDialog.setSendingEnabled(viewer.sendClipboard.getValue()); - menuKey = (int)(options.menuKey.getSelectedIndex()+0xFFBE); - F8Menu.f8.setLabel("Send F"+(menuKey-Keysyms.F1+1)); + menuKey = (options.menuKey.getSelectedIndex()+0xFFBE); + F8Menu.f8.setText("Send F"+(menuKey-Keysyms.F1+1)); shared = options.shared.isSelected(); setShared(shared); @@ -1185,9 +1185,9 @@ public class CConn extends CConnection if (cp.width != desktop.scaledWidth || cp.height != desktop.scaledHeight) { int sx = (desktop.scaleWidthRatio == 1.00) - ? ev.getX() : (int)Math.floor(ev.getX()/(float)desktop.scaleWidthRatio); + ? ev.getX() : (int)Math.floor(ev.getX()/desktop.scaleWidthRatio); int sy = (desktop.scaleHeightRatio == 1.00) - ? ev.getY() : (int)Math.floor(ev.getY()/(float)desktop.scaleHeightRatio); + ? ev.getY() : (int)Math.floor(ev.getY()/desktop.scaleHeightRatio); ev.translatePoint(sx - ev.getX(), sy - ev.getY()); writer().writePointerEvent(new Point(ev.getX(),ev.getY()), buttonMask); } else { diff --git a/java/src/com/tigervnc/vncviewer/DesktopWindow.java b/java/src/com/tigervnc/vncviewer/DesktopWindow.java index b1457c33..d6704e01 100644 --- a/java/src/com/tigervnc/vncviewer/DesktopWindow.java +++ b/java/src/com/tigervnc/vncviewer/DesktopWindow.java @@ -339,8 +339,8 @@ class DesktopWindow extends JPanel implements } } } - scaleWidthRatio = (float)((float)scaledWidth / (float)cc.cp.width); - scaleHeightRatio = (float)((float)scaledHeight / (float)cc.cp.height); + scaleWidthRatio = (float)scaledWidth / (float)cc.cp.width; + scaleHeightRatio = (float)scaledHeight / (float)cc.cp.height; } synchronized public void paintComponent(Graphics g) { @@ -475,8 +475,8 @@ class DesktopWindow extends JPanel implements cursorVisible = true; if (softCursor != null) return; - int cursorLeft = (int)cursor.hotspot.x; - int cursorTop = (int)cursor.hotspot.y; + int cursorLeft = cursor.hotspot.x; + int cursorTop = cursor.hotspot.y; int cursorRight = cursorLeft + cursor.width(); int cursorBottom = cursorTop + cursor.height(); diff --git a/java/src/com/tigervnc/vncviewer/Makefile b/java/src/com/tigervnc/vncviewer/Makefile index 136899b4..614057b5 100644 --- a/java/src/com/tigervnc/vncviewer/Makefile +++ b/java/src/com/tigervnc/vncviewer/Makefile @@ -4,7 +4,7 @@ CP = cp JC = javac -JCFLAGS = -target 1.5 -classpath ../../../ +JCFLAGS = -target 1.5 -Xlint:all,-serial,-cast -classpath ../../../ JAR = jar ARCHIVE = VncViewer.jar MANIFEST = MANIFEST.MF -- 2.39.5