From 8e1ebdffba02e651c399dacef841f8941f6ad6e4 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 13 Feb 2026 12:33:11 +0100 Subject: [PATCH] Remove some unused assignments Mainly to keep eslint happy with its new recommended rules. But it also makes the code more clear to not have unused stuff in it. The des code got a bit more refactoring since eslint was upset about the final "i++" as it was technically an unused assignment. --- app/ui.js | 4 +--- core/crypto/des.js | 8 ++++---- core/decoders/zrle.js | 2 +- core/rfb.js | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/ui.js b/app/ui.js index 6ed89d68..24d32d55 100644 --- a/app/ui.js +++ b/app/ui.js @@ -138,10 +138,8 @@ const UI = { let autoconnect = UI.getSetting('autoconnect'); if (autoconnect === 'true' || autoconnect == '1') { - autoconnect = true; UI.connect(); } else { - autoconnect = false; // Show the connect panel on first load unless autoconnecting UI.openConnectPanel(); } @@ -1213,7 +1211,7 @@ const UI = { }, securityFailed(e) { - let msg = ""; + let msg; // On security failures we might get a string with a reason // directly from the server. Note that we can't control if // this string is translated or not. diff --git a/core/crypto/des.js b/core/crypto/des.js index 8dab31fb..34ee7a60 100644 --- a/core/crypto/des.js +++ b/core/crypto/des.js @@ -181,11 +181,11 @@ class DES { // Encrypt 8 bytes of text enc8(text) { const b = text.slice(); - let i = 0, l, r, x; // left, right, accumulator + let l, r, x; // left, right, accumulator // Squash 8 bytes to 2 ints - l = b[i++]<<24 | b[i++]<<16 | b[i++]<<8 | b[i++]; - r = b[i++]<<24 | b[i++]<<16 | b[i++]<<8 | b[i++]; + l = b[0]<<24 | b[1]<<16 | b[2]<<8 | b[3]; + r = b[4]<<24 | b[5]<<16 | b[6]<<8 | b[7]; x = ((l >>> 4) ^ r) & 0x0f0f0f0f; r ^= x; @@ -252,7 +252,7 @@ class DES { // Spread ints to bytes x = [r, l]; - for (i = 0; i < 8; i++) { + for (let i = 0; i < 8; i++) { b[i] = (x[i>>>2] >>> (8 * (3 - (i % 4)))) % 256; if (b[i] < 0) { b[i] += 256; } // unsigned } diff --git a/core/decoders/zrle.js b/core/decoders/zrle.js index ef1726f6..b1df317a 100644 --- a/core/decoders/zrle.js +++ b/core/decoders/zrle.js @@ -175,7 +175,7 @@ export default class ZRLEDecoder { _readRLELength() { let length = 0; - let current = 0; + let current; do { current = this._inflator.inflate(1)[0]; length += current; diff --git a/core/rfb.js b/core/rfb.js index 1073a878..8994317b 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -2949,7 +2949,7 @@ export default class RFB extends EventTargetMixin { // We need to handle errors when we requested the resize. if (this._FBU.x === 1 && this._FBU.y !== 0) { - let msg = ""; + let msg; // The y-position indicates the status code from the server switch (this._FBU.y) { case 1: