1
0
Fork 0

(svn r8168) -Regression (r6783): ParseConnectionstring didn't use the port parameter if a player was also specified. (both IP#Player:Port and IP:Port#Player btw)

release/0.6
Darkvater 2007-01-16 23:01:06 +00:00
parent 96b19ca23e
commit 1f3ea708c3
1 changed files with 15 additions and 14 deletions

View File

@ -525,24 +525,25 @@ unsigned long NetworkResolveHost(const char *hostname)
return ip; return ip;
} }
// Converts a string to ip/port/player /** Converts a string to ip/port/player
// Format: IP#player:port * Format: IP#player:port
// *
// connection_string will be re-terminated to seperate out the hostname, and player and port will * connection_string will be re-terminated to seperate out the hostname, and player and port will
// be set to the player and port strings given by the user, inside the memory area originally * be set to the player and port strings given by the user, inside the memory area originally
// occupied by connection_string. * occupied by connection_string. */
void ParseConnectionString(const char **player, const char **port, char *connection_string) void ParseConnectionString(const char **player, const char **port, char *connection_string)
{ {
char *p; char *p;
for (p = connection_string; *p != '\0'; p++) { for (p = connection_string; *p != '\0'; p++) {
if (*p == '#') { switch (*p) {
*p = '\0'; case '#':
*player = ++p; *player = p + 1;
while (IsValidChar(*p, CS_NUMERAL)) p++; *p = '\0';
if (*p == '\0') break; break;
} else if (*p == ':') { case ':':
*port = p + 1; *port = p + 1;
*p = '\0'; *p = '\0';
break;
} }
} }
} }