Commit d640c94d authored by Johannes Schindelin's avatar Johannes Schindelin

LibVNCClient: make sure that the port is initialized correctly.

While at it, adjust coding style.
Signed-off-by: 's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
parent a2ad6175
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment