diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2010-01-16 11:29:33 +0100 |
---|---|---|
committer | Johannes Schindelin <johannes.schindelin@gmx.de> | 2010-01-16 11:29:33 +0100 |
commit | d640c94d701d2decac8eeb5d56ed84f73041f85f (patch) | |
tree | 290d9192fd0000f2329de4deea2c3496e881c348 /libvncclient | |
parent | a2ad61755fb01031193bf89421f6bc2c8e706165 (diff) | |
download | libtdevnc-d640c94d701d2decac8eeb5d56ed84f73041f85f.tar.gz libtdevnc-d640c94d701d2decac8eeb5d56ed84f73041f85f.zip |
LibVNCClient: make sure that the port is initialized correctly.
While at it, adjust coding style.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 'libvncclient')
-rw-r--r-- | libvncclient/vncviewer.c | 13 |
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) { |