summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2010-01-16 11:29:33 +0100
committerJohannes Schindelin <johannes.schindelin@gmx.de>2010-01-16 11:29:33 +0100
commitd640c94d701d2decac8eeb5d56ed84f73041f85f (patch)
tree290d9192fd0000f2329de4deea2c3496e881c348
parenta2ad61755fb01031193bf89421f6bc2c8e706165 (diff)
downloadlibvncserver-d640c94d701d2decac8eeb5d56ed84f73041f85f.zip
libvncserver-d640c94d701d2decac8eeb5d56ed84f73041f85f.tar.gz
LibVNCClient: make sure that the port is initialized correctly.
While at it, adjust coding style. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
-rw-r--r--libvncclient/vncviewer.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c
index fa150cd..155bb47 100644
--- a/libvncclient/vncviewer.c
+++ b/libvncclient/vncviewer.c
@@ -306,16 +306,17 @@ rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) {
if(client->serverHost)
free(client->serverHost);
+ client->serverPort = 5900;
if(colon) {
- client->serverHost=strdup(argv[i]);
- client->serverHost[(int)(colon-argv[i])]='\0';
- client->serverPort=atoi(colon+1);
+ client->serverHost = strdup(argv[i]);
+ client->serverHost[(int)(colon-argv[i])] = '\0';
+ client->serverPort = atoi(colon+1);
} else {
- client->serverHost=strdup(argv[i]);
+ client->serverHost = strdup(argv[i]);
}
- if(client->serverPort>=0 && client->serverPort<5900)
- client->serverPort+=5900;
+ if(client->serverPort >= 0 && client->serverPort < 5900)
+ client->serverPort += 5900;
}
/* purge arguments */
if (j>i) {
OpenPOWER on IntegriCloud