Skip to content

Commit

Permalink
ZlibLevel parameter marked deprecated
Browse files Browse the repository at this point in the history
Trying to set the ZlibLevel will set off a warning to users.
  • Loading branch information
adamhalim committed Jul 20, 2023
1 parent 8051f19 commit e7d14cc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common/rfb/ZRLEEncoder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

using namespace rfb;

IntParameter zlibLevel("ZlibLevel","Zlib compression level",-1);
IntParameter zlibLevel("ZlibLevel","[DEPRECATED] Zlib compression level",-1);

ZRLEEncoder::ZRLEEncoder(SConnection* conn)
: Encoder(conn, encodingZRLE, EncoderPlain, 127),
Expand Down
15 changes: 15 additions & 0 deletions unix/x0vncserver/x0vncserver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ static void CleanupSignalHandler(int /*sig*/)
caughtSignal = true;
}

static void migrateDeprecatedOptions()
{
rfb::VoidParameter* param = Configuration::getParam("ZlibLevel");
if (param == NULL)
return;

int compressLevel = *((rfb::IntParameter*) param);
if (compressLevel != -1) {
vlog.info("ZlibLevel is deprecated, let clients set the compression level instead.");
param->setParam("-1");
}
}


class FileTcpFilter : public TcpFilter
{
Expand Down Expand Up @@ -275,6 +288,8 @@ int main(int argc, char** argv)
usage();
}

migrateDeprecatedOptions();

if (!(dpy = XOpenDisplay(displayname))) {
// FIXME: Why not vlog.error(...)?
fprintf(stderr,"%s: unable to open display \"%s\"\r\n",
Expand Down

0 comments on commit e7d14cc

Please sign in to comment.