summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-14 19:44:42 +0000
committertron <tron@openttd.org>2005-01-14 19:44:42 +0000
commit3a838447a8b07f880567b452f274e732c0c712b4 (patch)
treed828e21ec23baa344c4322a92d6bca5c68aa692a
parent4136f395bf45b537d9756efb045c7db4bafa975d (diff)
downloadopenttd-3a838447a8b07f880567b452f274e732c0c712b4.tar.xz
(svn r1509) Const correctness and add static where appropriate while touching the lines anyway
-rw-r--r--network.c6
-rw-r--r--settings.c10
-rw-r--r--ttd.c2
-rw-r--r--unix.c2
4 files changed, 11 insertions, 9 deletions
diff --git a/network.c b/network.c
index dc26e4063..ebbc8d2f9 100644
--- a/network.c
+++ b/network.c
@@ -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");
diff --git a/ttd.c b/ttd.c
index d71f8c9ef..82dbd4e9c 100644
--- a/ttd.c
+++ b/ttd.c
@@ -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;
diff --git a/unix.c b/unix.c
index 46feb28d5..825e6f3c1 100644
--- a/unix.c
+++ b/unix.c
@@ -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++ = '/';