From f8d525b1290641917bbb379325a9694803436c4a Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 9 Jul 2014 17:02:27 +0200 Subject: [PATCH] String literals are constant --- vncviewer/vncviewer.cxx | 10 ++++++---- win/vncconfig/vncconfig.cxx | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx index eaf94ba6..3f039379 100644 --- a/vncviewer/vncviewer.cxx +++ b/vncviewer/vncviewer.cxx @@ -313,8 +313,8 @@ static void createTunnel(const char *gatewayHost, const char *remoteHost, int remotePort, int localPort) { - char *cmd = getenv("VNC_VIA_CMD"); - char *percent; + const char *cmd = getenv("VNC_VIA_CMD"); + char *cmd2, *percent; char lport[10], rport[10]; sprintf(lport, "%d", localPort); sprintf(rport, "%d", remotePort); @@ -325,9 +325,11 @@ createTunnel(const char *gatewayHost, const char *remoteHost, if (!cmd) cmd = "/usr/bin/ssh -f -L \"$L\":\"$H\":\"$R\" \"$G\" sleep 20"; /* Compatibility with TigerVNC's method. */ - while ((percent = strchr(cmd, '%')) != NULL) + cmd2 = strdup(cmd); + while ((percent = strchr(cmd2, '%')) != NULL) *percent = '$'; - system(cmd); + system(cmd2); + free(cmd2); } static int mktunnel() diff --git a/win/vncconfig/vncconfig.cxx b/win/vncconfig/vncconfig.cxx index 16bf1727..57193979 100644 --- a/win/vncconfig/vncconfig.cxx +++ b/win/vncconfig/vncconfig.cxx @@ -159,7 +159,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, char* cmdLine, int cmdShow) { HICON icon = (HICON)LoadImage(inst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 0, 0, LR_SHARED); // Create the PropertySheet handler - TCHAR* propSheetTitle = _T("VNC Server Properties (Service-Mode)"); + const TCHAR* propSheetTitle = _T("VNC Server Properties (Service-Mode)"); if (configKey == HKEY_CURRENT_USER) propSheetTitle = _T("VNC Server Properties (User-Mode)"); PropSheet sheet(inst, propSheetTitle, pages, icon); -- 2.39.5