From 34084855bf8a08f461a233aaec69675bdfced99c Mon Sep 17 00:00:00 2001 From: Marco Fortina Date: Sat, 16 May 2026 06:46:24 +0000 Subject: [PATCH] libvncserver: use zlib stream for Tight level zero --- src/libvncserver/tight.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/libvncserver/tight.c b/src/libvncserver/tight.c index 2dcf1ab8e..b1506c707 100644 --- a/src/libvncserver/tight.c +++ b/src/libvncserver/tight.c @@ -820,12 +820,7 @@ SendMonoRect(rfbClientPtr cl, dataLen = (w + 7) / 8; dataLen *= h; - if (tightConf[cl->tightCompressLevel].monoZlibLevel == 0 && - cl->tightEncoding != rfbEncodingTightPng) - cl->updateBuf[cl->ublen++] = - (char)((rfbTightNoZlib | rfbTightExplicitFilter) << 4); - else - cl->updateBuf[cl->ublen++] = (streamId | rfbTightExplicitFilter) << 4; + cl->updateBuf[cl->ublen++] = (streamId | rfbTightExplicitFilter) << 4; cl->updateBuf[cl->ublen++] = rfbTightFilterPalette; cl->updateBuf[cl->ublen++] = 1; @@ -897,12 +892,7 @@ SendIndexedRect(palettePtr palette, } /* Prepare tight encoding header. */ - if (tightConf[cl->tightCompressLevel].idxZlibLevel == 0 && - cl->tightEncoding != rfbEncodingTightPng) - cl->updateBuf[cl->ublen++] = - (char)((rfbTightNoZlib | rfbTightExplicitFilter) << 4); - else - cl->updateBuf[cl->ublen++] = (streamId | rfbTightExplicitFilter) << 4; + cl->updateBuf[cl->ublen++] = (streamId | rfbTightExplicitFilter) << 4; cl->updateBuf[cl->ublen++] = rfbTightFilterPalette; cl->updateBuf[cl->ublen++] = (char)(palette->numColors - 1); @@ -973,11 +963,7 @@ SendFullColorRect(rfbClientPtr cl, return FALSE; } - if (tightConf[cl->tightCompressLevel].rawZlibLevel == 0 && - cl->tightEncoding != rfbEncodingTightPng) - cl->updateBuf[cl->ublen++] = (char)(rfbTightNoZlib << 4); - else - cl->updateBuf[cl->ublen++] = 0x00; /* stream id = 0, no flushing, no filter */ + cl->updateBuf[cl->ublen++] = 0x00; /* stream id = 0, no flushing, no filter */ rfbStatRecordEncodingSentAdd(cl, cl->tightEncoding, 1); if (cl->tightUsePixelFormat24) { @@ -1008,9 +994,6 @@ CompressData(rfbClientPtr cl, return TRUE; } - if (zlibLevel == 0) - return rfbSendCompressedDataTight(cl, cl->beforeEncBuf, dataLen); - pz = &cl->zsStruct[streamId]; /* Initialize compression stream if needed. */