diff options
author | tron <tron@openttd.org> | 2005-01-14 19:44:42 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-01-14 19:44:42 +0000 |
commit | 3a838447a8b07f880567b452f274e732c0c712b4 (patch) | |
tree | d828e21ec23baa344c4322a92d6bca5c68aa692a | |
parent | 4136f395bf45b537d9756efb045c7db4bafa975d (diff) | |
download | openttd-3a838447a8b07f880567b452f274e732c0c712b4.tar.xz |
(svn r1509) Const correctness and add static where appropriate while touching the lines anyway
-rw-r--r-- | network.c | 6 | ||||
-rw-r--r-- | settings.c | 10 | ||||
-rw-r--r-- | ttd.c | 2 | ||||
-rw-r--r-- | unix.c | 2 |
4 files changed, 11 insertions, 9 deletions
@@ -188,12 +188,14 @@ void NetworkError(StringID error_string) _switch_mode_errorstr = error_string; } -void ClientStartError(char *error) { +static void ClientStartError(const char *error) +{ DEBUG(net, 0)("[NET] Client could not start network: %s",error); NetworkError(STR_NETWORK_ERR_CLIENT_START); } -void ServerStartError(char *error) { +static void ServerStartError(const char *error) +{ DEBUG(net, 0)("[NET] Server could not start network: %s",error); NetworkError(STR_NETWORK_ERR_SERVER_START); } diff --git a/settings.c b/settings.c index 6d95a37b1..3ebce5e17 100644 --- a/settings.c +++ b/settings.c @@ -493,7 +493,7 @@ static const void *string_to_val(const SettingDesc *desc, const char *str) if (*end != 0) ShowInfoF("ini: trailing characters at end of setting '%s'", desc->name); return (void*)val; case SDT_ONEOFMANY: { - int r = lookup_oneofmany((char*)desc->b, str, -1); + int r = lookup_oneofmany((const char*)desc->b, str, -1); if (r != -1) return (void*)r; ShowInfoF("ini: invalid value '%s' for '%s'", str, desc->name); return 0; @@ -516,7 +516,7 @@ static const void *string_to_val(const SettingDesc *desc, const char *str) case SDT_STRINGBUF: case SDT_STRINGQUOT: case SDT_INTLIST: - return (void*)str; + return str; } return NULL; @@ -575,7 +575,7 @@ static void load_setting_desc(IniFile *ini, const SettingDesc *desc, const void break; case SDT_STRING: if (*(char**)ptr) free(*(char**)ptr); - *(char**)ptr = strdup((char*)p); + *(char**)ptr = strdup((const char*)p); break; case SDT_STRINGBUF: case SDT_STRINGQUOT: @@ -681,10 +681,10 @@ static void save_setting_desc(IniFile *ini, const SettingDesc *desc, const void sprintf(buf, "%d", i); break; case SDT_ONEOFMANY: - make_oneofmany(buf, (char*)desc->b, i); + make_oneofmany(buf, (const char*)desc->b, i); break; case SDT_MANYOFMANY: - make_manyofmany(buf, (char*)desc->b, i); + make_manyofmany(buf, (const char*)desc->b, i); break; case SDT_BOOLX: strcpy(buf, i ? "true" : "false"); @@ -554,7 +554,7 @@ int ttd_main(int argc, char* argv[]) bool network = false; char *network_conn = NULL; char *language = NULL; - char *optformat; + const char *optformat; char musicdriver[16], sounddriver[16], videodriver[16]; int resolution[2] = {0,0}; uint startdate = -1; @@ -263,7 +263,7 @@ char *FiosBrowseTo(const FiosItem *item) break; case FIOS_TYPE_DIR: - s = strchr((char*)item->name, '/'); + s = strchr(item->name, '/'); if (s) *s = 0; while (*path) path++; *path++ = '/'; |