(svn r1509) Const correctness and add static where appropriate while touching the lines anyway

This commit is contained in:
tron 2005-01-14 19:44:42 +00:00
parent 4136f395bf
commit 3a838447a8
4 changed files with 11 additions and 9 deletions

View File

@ -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);
}

View File

@ -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");

2
ttd.c
View File

@ -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;

2
unix.c
View File

@ -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++ = '/';