Mercurial > hg > openttd
changeset 9097:c0865d047758 draft
(svn r12957) -Codechange: do not misuse snprintf when you just want to copy a string, also use DEBUG instead of fprintf in one case.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Mon, 05 May 2008 18:27:57 +0000 |
parents | 6ff3a3b70026 |
children | 2336da6eea60 |
files | config.lib src/network/network_client.cpp src/saveload.cpp |
diffstat | 3 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/config.lib +++ b/config.lib @@ -934,7 +934,7 @@ fi if [ $cc_version -ge 30 ]; then - CFLAGS="$CFLAGS -W -Wno-unused-parameter" + CFLAGS="$CFLAGS -W -Wno-unused-parameter -Wformat=2" fi if [ $cc_version -ge 34 ]; then
--- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -82,10 +82,10 @@ if (StrEmpty(_network_player_info[_local_player].password)) return; _password_game_seed = _patches.generation_seed; - snprintf(_password_server_unique_id, sizeof(_password_server_unique_id), _network_unique_id); + ttd_strlcpy(_password_server_unique_id, _network_unique_id, sizeof(_password_server_unique_id)); const char *new_pw = GenerateCompanyPasswordHash(_network_player_info[_local_player].password); - snprintf(_network_player_info[_local_player].password, sizeof(_network_player_info[_local_player].password), new_pw); + ttd_strlcpy(_network_player_info[_local_player].password, new_pw, sizeof(_network_player_info[_local_player].password)); }