summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-12-16 15:51:18 +0000
committertruelight <truelight@openttd.org>2004-12-16 15:51:18 +0000
commitda24f97483fca2c1dc467167db8a9d8f591b7f36 (patch)
tree7e023bb0130485de337655e17316e8a36d7ace04
parentf04d49ca172991ce57ee3640f8fb85873da98181 (diff)
downloadopenttd-da24f97483fca2c1dc467167db8a9d8f591b7f36.tar.xz
(svn r1137) -Fix: [Network] Replaces all strncpy with ttd_strlcpy.. windows really
does not like strncpy for some silly reason.
-rw-r--r--console_cmds.c4
-rw-r--r--network.c8
2 files changed, 5 insertions, 7 deletions
diff --git a/console_cmds.c b/console_cmds.c
index 9724c2f63..7299505d4 100644
--- a/console_cmds.c
+++ b/console_cmds.c
@@ -684,7 +684,7 @@ DEF_CONSOLE_CMD(ConSet) {
if (strncmp(argv[2], "*", NETWORK_PASSWORD_LENGTH) == 0) {
_network_player_info[_local_player].password[0] = '\0';
} else {
- strncpy(_network_player_info[_local_player].password, argv[2], sizeof(_network_player_info[_local_player].password));
+ ttd_strlcpy(_network_player_info[_local_player].password, argv[2], sizeof(_network_player_info[_local_player].password));
}
if (!_network_server)
SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(_network_player_info[_local_player].password);
@@ -733,7 +733,7 @@ DEF_CONSOLE_CMD(ConSet) {
return NULL;
}
if (argc == 3) {
- strncpy(_network_server_name, argv[2], sizeof(_network_server_name));
+ ttd_strlcpy(_network_server_name, argv[2], sizeof(_network_server_name));
IConsolePrintF(_iconsole_color_warning, "Server-name changed to '%s'", _network_server_name);
ttd_strlcpy(_network_game_info.server_name, _network_server_name, sizeof(_network_game_info.server_name));
} else {
diff --git a/network.c b/network.c
index 2215d8acd..c8b36eb65 100644
--- a/network.c
+++ b/network.c
@@ -795,8 +795,6 @@ bool NetworkClientConnectGame(const byte* host, unsigned short port)
return _networking;
}
-extern const char _openttd_revision[];
-
void NetworkInitGameInfo(void)
{
NetworkClientInfo *ci;
@@ -813,7 +811,7 @@ void NetworkInitGameInfo(void)
_network_game_info.clients_on = 1;
_network_game_info.dedicated = false;
}
- strncpy(_network_game_info.server_revision, _openttd_revision, sizeof(_network_game_info.server_revision));
+ ttd_strlcpy(_network_game_info.server_revision, _openttd_revision, sizeof(_network_game_info.server_revision));
_network_game_info.spectators_on = 0;
_network_game_info.game_date = _date;
_network_game_info.start_date = ConvertIntDate(_patches.starting_date);
@@ -837,8 +835,8 @@ void NetworkInitGameInfo(void)
ci->client_playas = OWNER_SPECTATOR;
else
ci->client_playas = _local_player + 1;
- strncpy(ci->client_name, _network_player_name, sizeof(ci->client_name));
- strncpy(ci->unique_id, _network_unique_id, sizeof(ci->unique_id));
+ ttd_strlcpy(ci->client_name, _network_player_name, sizeof(ci->client_name));
+ ttd_strlcpy(ci->unique_id, _network_unique_id, sizeof(ci->unique_id));
}
bool NetworkServerStart(void)