mirror of https://github.com/OpenTTD/OpenTTD
(svn r14555) -Codechange: replace ttd_strlcat and ttd_strlcpy with strecat and strecpy where direct conversion is possible
parent
c03e55b32a
commit
706dd0f86c
|
@ -250,8 +250,8 @@ DEF_CONSOLE_CMD(ConLoad)
|
||||||
_switch_mode = SM_LOAD;
|
_switch_mode = SM_LOAD;
|
||||||
SetFiosType(item->type);
|
SetFiosType(item->type);
|
||||||
|
|
||||||
ttd_strlcpy(_file_to_saveload.name, FiosBrowseTo(item), sizeof(_file_to_saveload.name));
|
strecpy(_file_to_saveload.name, FiosBrowseTo(item), lastof(_file_to_saveload.name));
|
||||||
ttd_strlcpy(_file_to_saveload.title, item->title, sizeof(_file_to_saveload.title));
|
strecpy(_file_to_saveload.title, item->title, lastof(_file_to_saveload.title));
|
||||||
} break;
|
} break;
|
||||||
default: IConsolePrintF(CC_ERROR, "%s: Not a savegame.", file);
|
default: IConsolePrintF(CC_ERROR, "%s: Not a savegame.", file);
|
||||||
}
|
}
|
||||||
|
@ -1230,7 +1230,7 @@ bool NetworkChangeCompanyPassword(byte argc, char *argv[])
|
||||||
|
|
||||||
if (strcmp(argv[0], "*") == 0) argv[0][0] = '\0';
|
if (strcmp(argv[0], "*") == 0) argv[0][0] = '\0';
|
||||||
|
|
||||||
ttd_strlcpy(_network_company_info[_local_company].password, argv[0], sizeof(_network_company_info[_local_company].password));
|
strecpy(_network_company_info[_local_company].password, argv[0], lastof(_network_company_info[_local_company].password));
|
||||||
|
|
||||||
if (!_network_server) {
|
if (!_network_server) {
|
||||||
NetworkClientSetPassword();
|
NetworkClientSetPassword();
|
||||||
|
|
|
@ -163,7 +163,7 @@ const char *GetDebugString()
|
||||||
|
|
||||||
for (i++; i != endof(debug_level); i++) {
|
for (i++; i != endof(debug_level); i++) {
|
||||||
snprintf(dbgval, sizeof(dbgval), ", %s=%d", i->name, *i->level);
|
snprintf(dbgval, sizeof(dbgval), ", %s=%d", i->name, *i->level);
|
||||||
ttd_strlcat(dbgstr, dbgval, sizeof(dbgstr));
|
strecat(dbgstr, dbgval, lastof(dbgstr));
|
||||||
}
|
}
|
||||||
|
|
||||||
return dbgstr;
|
return dbgstr;
|
||||||
|
|
|
@ -310,7 +310,7 @@ FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath sp, Subd
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
|
|
||||||
if (subdir == NO_DIRECTORY) {
|
if (subdir == NO_DIRECTORY) {
|
||||||
ttd_strlcpy(buf, filename, lengthof(buf));
|
strecpy(buf, filename, lastof(buf));
|
||||||
} else {
|
} else {
|
||||||
snprintf(buf, lengthof(buf), "%s%s%s", _searchpaths[sp], _subdirs[subdir], filename);
|
snprintf(buf, lengthof(buf), "%s%s%s", _searchpaths[sp], _subdirs[subdir], filename);
|
||||||
}
|
}
|
||||||
|
|
14
src/fios.cpp
14
src/fios.cpp
|
@ -216,14 +216,14 @@ static FiosItem *FiosGetFileList(SaveLoadDialogMode mode, fios_getlist_callback_
|
||||||
fios = _fios_items.Append();
|
fios = _fios_items.Append();
|
||||||
fios->type = FIOS_TYPE_PARENT;
|
fios->type = FIOS_TYPE_PARENT;
|
||||||
fios->mtime = 0;
|
fios->mtime = 0;
|
||||||
ttd_strlcpy(fios->name, "..", lengthof(fios->name));
|
strecpy(fios->name, "..", lastof(fios->name));
|
||||||
ttd_strlcpy(fios->title, ".. (Parent directory)", lengthof(fios->title));
|
strecpy(fios->title, ".. (Parent directory)", lastof(fios->title));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show subdirectories */
|
/* Show subdirectories */
|
||||||
if (mode != SLD_NEW_GAME && (dir = ttd_opendir(_fios_path)) != NULL) {
|
if (mode != SLD_NEW_GAME && (dir = ttd_opendir(_fios_path)) != NULL) {
|
||||||
while ((dirent = readdir(dir)) != NULL) {
|
while ((dirent = readdir(dir)) != NULL) {
|
||||||
ttd_strlcpy(d_name, FS2OTTD(dirent->d_name), sizeof(d_name));
|
strecpy(d_name, FS2OTTD(dirent->d_name), lastof(d_name));
|
||||||
|
|
||||||
/* found file must be directory, but not '.' or '..' */
|
/* found file must be directory, but not '.' or '..' */
|
||||||
if (FiosIsValidFile(_fios_path, dirent, &sb) && (sb.st_mode & S_IFDIR) &&
|
if (FiosIsValidFile(_fios_path, dirent, &sb) && (sb.st_mode & S_IFDIR) &&
|
||||||
|
@ -232,7 +232,7 @@ static FiosItem *FiosGetFileList(SaveLoadDialogMode mode, fios_getlist_callback_
|
||||||
fios = _fios_items.Append();
|
fios = _fios_items.Append();
|
||||||
fios->type = FIOS_TYPE_DIR;
|
fios->type = FIOS_TYPE_DIR;
|
||||||
fios->mtime = 0;
|
fios->mtime = 0;
|
||||||
ttd_strlcpy(fios->name, d_name, lengthof(fios->name));
|
strecpy(fios->name, d_name, lastof(fios->name));
|
||||||
snprintf(fios->title, lengthof(fios->title), "%s" PATHSEP " (Directory)", d_name);
|
snprintf(fios->title, lengthof(fios->title), "%s" PATHSEP " (Directory)", d_name);
|
||||||
str_validate(fios->title);
|
str_validate(fios->title);
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ static FiosItem *FiosGetFileList(SaveLoadDialogMode mode, fios_getlist_callback_
|
||||||
while ((dirent = readdir(dir)) != NULL) {
|
while ((dirent = readdir(dir)) != NULL) {
|
||||||
char fios_title[64];
|
char fios_title[64];
|
||||||
char *t;
|
char *t;
|
||||||
ttd_strlcpy(d_name, FS2OTTD(dirent->d_name), sizeof(d_name));
|
strecpy(d_name, FS2OTTD(dirent->d_name), lastof(d_name));
|
||||||
|
|
||||||
if (!FiosIsValidFile(_fios_path, dirent, &sb) || !(sb.st_mode & S_IFREG) || FiosIsHiddenFile(dirent)) continue;
|
if (!FiosIsValidFile(_fios_path, dirent, &sb) || !(sb.st_mode & S_IFREG) || FiosIsHiddenFile(dirent)) continue;
|
||||||
|
|
||||||
|
@ -270,12 +270,12 @@ static FiosItem *FiosGetFileList(SaveLoadDialogMode mode, fios_getlist_callback_
|
||||||
fios = _fios_items.Append();
|
fios = _fios_items.Append();
|
||||||
fios->mtime = sb.st_mtime;
|
fios->mtime = sb.st_mtime;
|
||||||
fios->type = type;
|
fios->type = type;
|
||||||
ttd_strlcpy(fios->name, d_name, lengthof(fios->name));
|
strecpy(fios->name, d_name, lastof(fios->name));
|
||||||
|
|
||||||
/* Some callbacks want to lookup the title of the file. Allow that.
|
/* Some callbacks want to lookup the title of the file. Allow that.
|
||||||
* If we just copy the title from the filename, strip the extension */
|
* If we just copy the title from the filename, strip the extension */
|
||||||
t = (fios_title[0] == '\0') ? *t = '\0', d_name : fios_title;
|
t = (fios_title[0] == '\0') ? *t = '\0', d_name : fios_title;
|
||||||
ttd_strlcpy(fios->title, t, lengthof(fios->title));
|
strecpy(fios->title, t, lastof(fios->title));
|
||||||
str_validate(fios->title);
|
str_validate(fios->title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -986,7 +986,7 @@ skip_cont:;
|
||||||
int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw)
|
int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw)
|
||||||
{
|
{
|
||||||
char buffer[DRAW_STRING_BUFFER];
|
char buffer[DRAW_STRING_BUFFER];
|
||||||
ttd_strlcpy(buffer, str, sizeof(buffer));
|
strecpy(buffer, str, lastof(buffer));
|
||||||
TruncateString(buffer, maxw);
|
TruncateString(buffer, maxw);
|
||||||
return DoDrawString(buffer, x, y, color);
|
return DoDrawString(buffer, x, y, color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1488,7 +1488,7 @@ struct SaveLoadWindow : public QueryStringBaseWindow {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ttd_strlcpy(o_dir.name, _personal_dir, lengthof(o_dir.name));
|
strecpy(o_dir.name, _personal_dir, lastof(o_dir.name));
|
||||||
}
|
}
|
||||||
|
|
||||||
this->vscroll.cap = 10;
|
this->vscroll.cap = 10;
|
||||||
|
@ -1574,14 +1574,14 @@ struct SaveLoadWindow : public QueryStringBaseWindow {
|
||||||
_switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD;
|
_switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD;
|
||||||
|
|
||||||
SetFiosType(file->type);
|
SetFiosType(file->type);
|
||||||
ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
|
strecpy(_file_to_saveload.name, name, lastof(_file_to_saveload.name));
|
||||||
ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title));
|
strecpy(_file_to_saveload.title, file->title, lastof(_file_to_saveload.title));
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
} else if (_saveload_mode == SLD_LOAD_HEIGHTMAP) {
|
} else if (_saveload_mode == SLD_LOAD_HEIGHTMAP) {
|
||||||
SetFiosType(file->type);
|
SetFiosType(file->type);
|
||||||
ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
|
strecpy(_file_to_saveload.name, name, lastof(_file_to_saveload.name));
|
||||||
ttd_strlcpy(_file_to_saveload.title, file->title, sizeof(_file_to_saveload.title));
|
strecpy(_file_to_saveload.title, file->title, lastof(_file_to_saveload.title));
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
ShowHeightmapLoad();
|
ShowHeightmapLoad();
|
||||||
|
|
|
@ -34,7 +34,7 @@ void MusicDriver_ExtMidi::Stop()
|
||||||
|
|
||||||
void MusicDriver_ExtMidi::PlaySong(const char* filename)
|
void MusicDriver_ExtMidi::PlaySong(const char* filename)
|
||||||
{
|
{
|
||||||
ttd_strlcpy(this->song, filename, lengthof(this->song));
|
strecpy(this->song, filename, lastof(this->song));
|
||||||
this->DoStop();
|
this->DoStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,19 +212,19 @@ void CDECL NetworkTextMessage(NetworkAction action, ConsoleColour color, bool se
|
||||||
SetDParamStr(0, name);
|
SetDParamStr(0, name);
|
||||||
SetDParamStr(1, buf);
|
SetDParamStr(1, buf);
|
||||||
GetString(temp, self_send ? STR_NETWORK_CHAT_TO_COMPANY : STR_NETWORK_CHAT_COMPANY, lastof(temp));
|
GetString(temp, self_send ? STR_NETWORK_CHAT_TO_COMPANY : STR_NETWORK_CHAT_COMPANY, lastof(temp));
|
||||||
ttd_strlcpy(message, temp, sizeof(message));
|
strecpy(message, temp, lastof(message));
|
||||||
break;
|
break;
|
||||||
case NETWORK_ACTION_CHAT_CLIENT:
|
case NETWORK_ACTION_CHAT_CLIENT:
|
||||||
SetDParamStr(0, name);
|
SetDParamStr(0, name);
|
||||||
SetDParamStr(1, buf);
|
SetDParamStr(1, buf);
|
||||||
GetString(temp, self_send ? STR_NETWORK_CHAT_TO_CLIENT : STR_NETWORK_CHAT_CLIENT, lastof(temp));
|
GetString(temp, self_send ? STR_NETWORK_CHAT_TO_CLIENT : STR_NETWORK_CHAT_CLIENT, lastof(temp));
|
||||||
ttd_strlcpy(message, temp, sizeof(message));
|
strecpy(message, temp, lastof(message));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SetDParamStr(0, name);
|
SetDParamStr(0, name);
|
||||||
SetDParamStr(1, buf);
|
SetDParamStr(1, buf);
|
||||||
GetString(temp, STR_NETWORK_CHAT_ALL, lastof(temp));
|
GetString(temp, STR_NETWORK_CHAT_ALL, lastof(temp));
|
||||||
ttd_strlcpy(message, temp, sizeof(message));
|
strecpy(message, temp, lastof(message));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -734,9 +734,9 @@ void NetworkAddServer(const char *b)
|
||||||
char host[NETWORK_HOSTNAME_LENGTH];
|
char host[NETWORK_HOSTNAME_LENGTH];
|
||||||
uint16 rport;
|
uint16 rport;
|
||||||
|
|
||||||
ttd_strlcpy(host, b, lengthof(host));
|
strecpy(host, b, lastof(host));
|
||||||
|
|
||||||
ttd_strlcpy(_settings_client.network.connect_to_ip, b, lengthof(_settings_client.network.connect_to_ip));
|
strecpy(_settings_client.network.connect_to_ip, b, lastof(_settings_client.network.connect_to_ip));
|
||||||
rport = NETWORK_DEFAULT_PORT;
|
rport = NETWORK_DEFAULT_PORT;
|
||||||
|
|
||||||
ParseConnectionString(&company, &port, host);
|
ParseConnectionString(&company, &port, host);
|
||||||
|
@ -774,7 +774,7 @@ bool NetworkClientConnectGame(const char *host, uint16 port)
|
||||||
|
|
||||||
if (port == 0) return false;
|
if (port == 0) return false;
|
||||||
|
|
||||||
ttd_strlcpy(_settings_client.network.last_host, host, sizeof(_settings_client.network.last_host));
|
strecpy(_settings_client.network.last_host, host, lastof(_settings_client.network.last_host));
|
||||||
_settings_client.network.last_port = port;
|
_settings_client.network.last_port = port;
|
||||||
|
|
||||||
NetworkDisconnect();
|
NetworkDisconnect();
|
||||||
|
@ -815,8 +815,8 @@ static void NetworkInitGameInfo()
|
||||||
ci->client_index = NETWORK_SERVER_INDEX;
|
ci->client_index = NETWORK_SERVER_INDEX;
|
||||||
ci->client_playas = _network_dedicated ? COMPANY_SPECTATOR : _local_company;
|
ci->client_playas = _network_dedicated ? COMPANY_SPECTATOR : _local_company;
|
||||||
|
|
||||||
ttd_strlcpy(ci->client_name, _settings_client.network.client_name, sizeof(ci->client_name));
|
strecpy(ci->client_name, _settings_client.network.client_name, lastof(ci->client_name));
|
||||||
ttd_strlcpy(ci->unique_id, _settings_client.network.network_id, sizeof(ci->unique_id));
|
strecpy(ci->unique_id, _settings_client.network.network_id, lastof(ci->unique_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NetworkServerStart()
|
bool NetworkServerStart()
|
||||||
|
|
|
@ -97,7 +97,7 @@ void CDECL NetworkAddChatMessage(uint16 color, uint8 duration, const char *messa
|
||||||
|
|
||||||
for (bufp = buf; lines != 0; lines--) {
|
for (bufp = buf; lines != 0; lines--) {
|
||||||
ChatMessage *cmsg = &_chatmsg_list[msg_count++];
|
ChatMessage *cmsg = &_chatmsg_list[msg_count++];
|
||||||
ttd_strlcpy(cmsg->message, bufp, sizeof(cmsg->message));
|
strecpy(cmsg->message, bufp, lastof(cmsg->message));
|
||||||
|
|
||||||
/* The default colour for a message is company colour. Replace this with
|
/* The default colour for a message is company colour. Replace this with
|
||||||
* white for any additional lines */
|
* white for any additional lines */
|
||||||
|
|
|
@ -84,10 +84,10 @@ void HashCurrentCompanyPassword()
|
||||||
if (StrEmpty(_network_company_info[_local_company].password)) return;
|
if (StrEmpty(_network_company_info[_local_company].password)) return;
|
||||||
|
|
||||||
_password_game_seed = _settings_game.game_creation.generation_seed;
|
_password_game_seed = _settings_game.game_creation.generation_seed;
|
||||||
ttd_strlcpy(_password_server_unique_id, _settings_client.network.network_id, sizeof(_password_server_unique_id));
|
strecpy(_password_server_unique_id, _settings_client.network.network_id, lastof(_password_server_unique_id));
|
||||||
|
|
||||||
const char *new_pw = GenerateCompanyPasswordHash(_network_company_info[_local_company].password);
|
const char *new_pw = GenerateCompanyPasswordHash(_network_company_info[_local_company].password);
|
||||||
ttd_strlcpy(_network_company_info[_local_company].password, new_pw, sizeof(_network_company_info[_local_company].password));
|
strecpy(_network_company_info[_local_company].password, new_pw, lastof(_network_company_info[_local_company].password));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO)
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->client_playas = playas;
|
ci->client_playas = playas;
|
||||||
ttd_strlcpy(ci->client_name, name, sizeof(ci->client_name));
|
strecpy(ci->client_name, name, lastof(ci->client_name));
|
||||||
|
|
||||||
InvalidateWindow(WC_CLIENT_LIST, 0);
|
InvalidateWindow(WC_CLIENT_LIST, 0);
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO)
|
||||||
ci->client_index = index;
|
ci->client_index = index;
|
||||||
ci->client_playas = playas;
|
ci->client_playas = playas;
|
||||||
|
|
||||||
ttd_strlcpy(ci->client_name, name, sizeof(ci->client_name));
|
strecpy(ci->client_name, name, lastof(ci->client_name));
|
||||||
|
|
||||||
InvalidateWindow(WC_CLIENT_LIST, 0);
|
InvalidateWindow(WC_CLIENT_LIST, 0);
|
||||||
|
|
||||||
|
@ -951,7 +951,7 @@ void NetworkUpdateClientName()
|
||||||
} else {
|
} else {
|
||||||
if (NetworkFindName(_settings_client.network.client_name)) {
|
if (NetworkFindName(_settings_client.network.client_name)) {
|
||||||
NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, "%s", _settings_client.network.client_name);
|
NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, "%s", _settings_client.network.client_name);
|
||||||
ttd_strlcpy(ci->client_name, _settings_client.network.client_name, sizeof(ci->client_name));
|
strecpy(ci->client_name, _settings_client.network.client_name, lastof(ci->client_name));
|
||||||
NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
|
NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, Comma
|
||||||
c.callback = 0; // _callback_table[0] == NULL
|
c.callback = 0; // _callback_table[0] == NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
ttd_strlcpy(c.text, (_cmd_text != NULL) ? _cmd_text : "", lengthof(c.text));
|
strecpy(c.text, (_cmd_text != NULL) ? _cmd_text : "", lastof(c.text));
|
||||||
|
|
||||||
if (_network_server) {
|
if (_network_server) {
|
||||||
/* If we are the server, we queue the command in our 'special' queue.
|
/* If we are the server, we queue the command in our 'special' queue.
|
||||||
|
|
|
@ -672,9 +672,9 @@ public:
|
||||||
|
|
||||||
/* The name is only allowed when it starts with a letter! */
|
/* The name is only allowed when it starts with a letter! */
|
||||||
if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') {
|
if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') {
|
||||||
ttd_strlcpy(_settings_client.network.client_name, this->edit_str_buf, lengthof(_settings_client.network.client_name));
|
strecpy(_settings_client.network.client_name, this->edit_str_buf, lastof(_settings_client.network.client_name));
|
||||||
} else {
|
} else {
|
||||||
ttd_strlcpy(_settings_client.network.client_name, "Player", lengthof(_settings_client.network.client_name));
|
strecpy(_settings_client.network.client_name, "Player", lastof(_settings_client.network.client_name));
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -1003,8 +1003,8 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
SetFiosType(this->map->type);
|
SetFiosType(this->map->type);
|
||||||
_file_to_saveload.filetype = FT_SCENARIO;
|
_file_to_saveload.filetype = FT_SCENARIO;
|
||||||
ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
|
strecpy(_file_to_saveload.name, name, lastof(_file_to_saveload.name));
|
||||||
ttd_strlcpy(_file_to_saveload.title, this->map->title, sizeof(_file_to_saveload.title));
|
strecpy(_file_to_saveload.title, this->map->title, lastof(_file_to_saveload.title));
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
SwitchMode(SM_START_SCENARIO);
|
SwitchMode(SM_START_SCENARIO);
|
||||||
|
@ -1049,7 +1049,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
|
||||||
if (this->field == NSSW_GAMENAME) {
|
if (this->field == NSSW_GAMENAME) {
|
||||||
if (this->HandleEditBoxKey(NSSW_GAMENAME, key, keycode, state) == HEBR_CONFIRM) return state;
|
if (this->HandleEditBoxKey(NSSW_GAMENAME, key, keycode, state) == HEBR_CONFIRM) return state;
|
||||||
|
|
||||||
ttd_strlcpy(_settings_client.network.server_name, this->text.buf, sizeof(_settings_client.network.server_name));
|
strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
|
@ -1060,7 +1060,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
|
||||||
if (str == NULL) return;
|
if (str == NULL) return;
|
||||||
|
|
||||||
if (this->widget_id == NSSW_SETPWD) {
|
if (this->widget_id == NSSW_SETPWD) {
|
||||||
ttd_strlcpy(_settings_client.network.server_password, str, lengthof(_settings_client.network.server_password));
|
strecpy(_settings_client.network.server_password, str, lastof(_settings_client.network.server_password));
|
||||||
} else {
|
} else {
|
||||||
int32 value = atoi(str);
|
int32 value = atoi(str);
|
||||||
this->InvalidateWidget(this->widget_id);
|
this->InvalidateWidget(this->widget_id);
|
||||||
|
|
|
@ -679,7 +679,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN)
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need a valid name.. make it Player
|
// We need a valid name.. make it Player
|
||||||
if (StrEmpty(name)) ttd_strlcpy(name, "Player", sizeof(name));
|
if (StrEmpty(name)) strecpy(name, "Player", lastof(name));
|
||||||
|
|
||||||
if (!NetworkFindName(name)) { // Change name if duplicate
|
if (!NetworkFindName(name)) { // Change name if duplicate
|
||||||
// We could not create a name for this client
|
// We could not create a name for this client
|
||||||
|
@ -689,8 +689,8 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN)
|
||||||
|
|
||||||
ci = DEREF_CLIENT_INFO(cs);
|
ci = DEREF_CLIENT_INFO(cs);
|
||||||
|
|
||||||
ttd_strlcpy(ci->client_name, name, sizeof(ci->client_name));
|
strecpy(ci->client_name, name, lastof(ci->client_name));
|
||||||
ttd_strlcpy(ci->unique_id, unique_id, sizeof(ci->unique_id));
|
strecpy(ci->unique_id, unique_id, lastof(ci->unique_id));
|
||||||
ci->client_playas = playas;
|
ci->client_playas = playas;
|
||||||
ci->client_lang = client_lang;
|
ci->client_lang = client_lang;
|
||||||
|
|
||||||
|
@ -1194,7 +1194,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_SET_PASSWORD)
|
||||||
ci = DEREF_CLIENT_INFO(cs);
|
ci = DEREF_CLIENT_INFO(cs);
|
||||||
|
|
||||||
if (IsValidCompanyID(ci->client_playas)) {
|
if (IsValidCompanyID(ci->client_playas)) {
|
||||||
ttd_strlcpy(_network_company_info[ci->client_playas].password, password, sizeof(_network_company_info[0].password));
|
strecpy(_network_company_info[ci->client_playas].password, password, lastof(_network_company_info[0].password));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,7 +1218,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_SET_NAME)
|
||||||
// Display change
|
// Display change
|
||||||
if (NetworkFindName(client_name)) {
|
if (NetworkFindName(client_name)) {
|
||||||
NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, "%s", client_name);
|
NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, "%s", client_name);
|
||||||
ttd_strlcpy(ci->client_name, client_name, sizeof(ci->client_name));
|
strecpy(ci->client_name, client_name, lastof(ci->client_name));
|
||||||
NetworkUpdateClientInfo(ci->client_index);
|
NetworkUpdateClientInfo(ci->client_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1313,11 +1313,11 @@ void NetworkPopulateCompanyInfo()
|
||||||
|
|
||||||
FOR_ALL_COMPANIES(c) {
|
FOR_ALL_COMPANIES(c) {
|
||||||
// Clean the info but not the password
|
// Clean the info but not the password
|
||||||
ttd_strlcpy(password, _network_company_info[c->index].password, sizeof(password));
|
strecpy(password, _network_company_info[c->index].password, lastof(password));
|
||||||
months_empty = _network_company_info[c->index].months_empty;
|
months_empty = _network_company_info[c->index].months_empty;
|
||||||
memset(&_network_company_info[c->index], 0, sizeof(NetworkCompanyInfo));
|
memset(&_network_company_info[c->index], 0, sizeof(NetworkCompanyInfo));
|
||||||
_network_company_info[c->index].months_empty = months_empty;
|
_network_company_info[c->index].months_empty = months_empty;
|
||||||
ttd_strlcpy(_network_company_info[c->index].password, password, sizeof(_network_company_info[c->index].password));
|
strecpy(_network_company_info[c->index].password, password, lastof(_network_company_info[c->index].password));
|
||||||
|
|
||||||
// Grap the company name
|
// Grap the company name
|
||||||
SetDParam(0, c->index);
|
SetDParam(0, c->index);
|
||||||
|
@ -1372,7 +1372,7 @@ void NetworkPopulateCompanyInfo()
|
||||||
ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
|
ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
|
||||||
// Register local company (if not dedicated)
|
// Register local company (if not dedicated)
|
||||||
if (ci != NULL && IsValidCompanyID(ci->client_playas))
|
if (ci != NULL && IsValidCompanyID(ci->client_playas))
|
||||||
ttd_strlcpy(_network_company_info[ci->client_playas].clients, ci->client_name, sizeof(_network_company_info[0].clients));
|
strecpy(_network_company_info[ci->client_playas].clients, ci->client_name, lastof(_network_company_info[0].clients));
|
||||||
|
|
||||||
FOR_ALL_CLIENTS(cs) {
|
FOR_ALL_CLIENTS(cs) {
|
||||||
char client_name[NETWORK_CLIENT_NAME_LENGTH];
|
char client_name[NETWORK_CLIENT_NAME_LENGTH];
|
||||||
|
@ -1382,10 +1382,10 @@ void NetworkPopulateCompanyInfo()
|
||||||
ci = DEREF_CLIENT_INFO(cs);
|
ci = DEREF_CLIENT_INFO(cs);
|
||||||
if (ci != NULL && IsValidCompanyID(ci->client_playas)) {
|
if (ci != NULL && IsValidCompanyID(ci->client_playas)) {
|
||||||
if (!StrEmpty(_network_company_info[ci->client_playas].clients)) {
|
if (!StrEmpty(_network_company_info[ci->client_playas].clients)) {
|
||||||
ttd_strlcat(_network_company_info[ci->client_playas].clients, ", ", lengthof(_network_company_info[0].clients));
|
strecat(_network_company_info[ci->client_playas].clients, ", ", lastof(_network_company_info[0].clients));
|
||||||
}
|
}
|
||||||
|
|
||||||
ttd_strlcat(_network_company_info[ci->client_playas].clients, client_name, lengthof(_network_company_info[0].clients));
|
strecat(_network_company_info[ci->client_playas].clients, client_name, lastof(_network_company_info[0].clients));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,9 +94,9 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_FIND_SERVER)
|
||||||
ngi.dedicated = _network_dedicated;
|
ngi.dedicated = _network_dedicated;
|
||||||
ngi.grfconfig = _grfconfig;
|
ngi.grfconfig = _grfconfig;
|
||||||
|
|
||||||
ttd_strlcpy(ngi.map_name, _network_game_info.map_name, lengthof(ngi.map_name));
|
strecpy(ngi.map_name, _network_game_info.map_name, lastof(ngi.map_name));
|
||||||
ttd_strlcpy(ngi.server_name, _settings_client.network.server_name, lengthof(ngi.server_name));
|
strecpy(ngi.server_name, _settings_client.network.server_name, lastof(ngi.server_name));
|
||||||
ttd_strlcpy(ngi.server_revision, _openttd_revision, lengthof(ngi.server_revision));
|
strecpy(ngi.server_revision, _openttd_revision, lastof(ngi.server_revision));
|
||||||
|
|
||||||
Packet packet(PACKET_UDP_SERVER_RESPONSE);
|
Packet packet(PACKET_UDP_SERVER_RESPONSE);
|
||||||
this->Send_NetworkGameInfo(&packet, &ngi);
|
this->Send_NetworkGameInfo(&packet, &ngi);
|
||||||
|
@ -209,8 +209,8 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_GET_NEWGRFS)
|
||||||
char name[NETWORK_GRF_NAME_LENGTH];
|
char name[NETWORK_GRF_NAME_LENGTH];
|
||||||
|
|
||||||
/* The name could be an empty string, if so take the filename */
|
/* The name could be an empty string, if so take the filename */
|
||||||
ttd_strlcpy(name, (in_reply[i]->name != NULL && !StrEmpty(in_reply[i]->name)) ?
|
strecpy(name, (in_reply[i]->name != NULL && !StrEmpty(in_reply[i]->name)) ?
|
||||||
in_reply[i]->name : in_reply[i]->filename, sizeof(name));
|
in_reply[i]->name : in_reply[i]->filename, lastof(name));
|
||||||
this->Send_GRFIdentifier(&packet, in_reply[i]);
|
this->Send_GRFIdentifier(&packet, in_reply[i]);
|
||||||
packet.Send_string(name);
|
packet.Send_string(name);
|
||||||
}
|
}
|
||||||
|
@ -465,8 +465,8 @@ void NetworkUDPQueryServer(const char* host, unsigned short port, bool manually)
|
||||||
|
|
||||||
if (StrEmpty(item->info.server_name)) {
|
if (StrEmpty(item->info.server_name)) {
|
||||||
memset(&item->info, 0, sizeof(item->info));
|
memset(&item->info, 0, sizeof(item->info));
|
||||||
ttd_strlcpy(item->info.server_name, host, lengthof(item->info.server_name));
|
strecpy(item->info.server_name, host, lastof(item->info.server_name));
|
||||||
ttd_strlcpy(item->info.hostname, host, lengthof(item->info.hostname));
|
strecpy(item->info.hostname, host, lastof(item->info.hostname));
|
||||||
item->online = false;
|
item->online = false;
|
||||||
}
|
}
|
||||||
item->manually = manually;
|
item->manually = manually;
|
||||||
|
|
|
@ -446,7 +446,7 @@ char *FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create)
|
||||||
grf = CallocT<UnknownGRF>(1);
|
grf = CallocT<UnknownGRF>(1);
|
||||||
grf->grfid = grfid;
|
grf->grfid = grfid;
|
||||||
grf->next = unknown_grfs;
|
grf->next = unknown_grfs;
|
||||||
ttd_strlcpy(grf->name, UNKNOWN_GRF_NAME_PLACEHOLDER, sizeof(grf->name));
|
strecpy(grf->name, UNKNOWN_GRF_NAME_PLACEHOLDER, lastof(grf->name));
|
||||||
memcpy(grf->md5sum, md5sum, sizeof(grf->md5sum));
|
memcpy(grf->md5sum, md5sum, sizeof(grf->md5sum));
|
||||||
|
|
||||||
unknown_grfs = grf;
|
unknown_grfs = grf;
|
||||||
|
|
|
@ -424,11 +424,11 @@ int ttd_main(int argc, char *argv[])
|
||||||
|
|
||||||
while ((i = MyGetOpt(&mgo)) != -1) {
|
while ((i = MyGetOpt(&mgo)) != -1) {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 'I': ttd_strlcpy(graphics_set, mgo.opt, sizeof(graphics_set)); break;
|
case 'I': strecpy(graphics_set, mgo.opt, lastof(graphics_set)); break;
|
||||||
case 'm': ttd_strlcpy(musicdriver, mgo.opt, sizeof(musicdriver)); break;
|
case 'm': strecpy(musicdriver, mgo.opt, lastof(musicdriver)); break;
|
||||||
case 's': ttd_strlcpy(sounddriver, mgo.opt, sizeof(sounddriver)); break;
|
case 's': strecpy(sounddriver, mgo.opt, lastof(sounddriver)); break;
|
||||||
case 'v': ttd_strlcpy(videodriver, mgo.opt, sizeof(videodriver)); break;
|
case 'v': strecpy(videodriver, mgo.opt, lastof(videodriver)); break;
|
||||||
case 'b': ttd_strlcpy(blitter, mgo.opt, sizeof(blitter)); break;
|
case 'b': strecpy(blitter, mgo.opt, lastof(blitter)); break;
|
||||||
#if defined(ENABLE_NETWORK)
|
#if defined(ENABLE_NETWORK)
|
||||||
case 'D':
|
case 'D':
|
||||||
strcpy(musicdriver, "null");
|
strcpy(musicdriver, "null");
|
||||||
|
@ -467,7 +467,7 @@ int ttd_main(int argc, char *argv[])
|
||||||
case 'i': _use_palette = (mgo.opt == NULL || atoi(mgo.opt) == 0) ? PAL_DOS : PAL_WINDOWS; break;
|
case 'i': _use_palette = (mgo.opt == NULL || atoi(mgo.opt) == 0) ? PAL_DOS : PAL_WINDOWS; break;
|
||||||
case 'g':
|
case 'g':
|
||||||
if (mgo.opt != NULL) {
|
if (mgo.opt != NULL) {
|
||||||
ttd_strlcpy(_file_to_saveload.name, mgo.opt, sizeof(_file_to_saveload.name));
|
strecpy(_file_to_saveload.name, mgo.opt, lastof(_file_to_saveload.name));
|
||||||
_switch_mode = SM_LOAD;
|
_switch_mode = SM_LOAD;
|
||||||
_file_to_saveload.mode = SL_LOAD;
|
_file_to_saveload.mode = SL_LOAD;
|
||||||
|
|
||||||
|
@ -522,11 +522,11 @@ int ttd_main(int argc, char *argv[])
|
||||||
|
|
||||||
|
|
||||||
/* override config? */
|
/* override config? */
|
||||||
if (!StrEmpty(graphics_set)) ttd_strlcpy(_ini_graphics_set, graphics_set, sizeof(_ini_graphics_set));
|
if (!StrEmpty(graphics_set)) strecpy(_ini_graphics_set, graphics_set, lastof(_ini_graphics_set));
|
||||||
if (!StrEmpty(musicdriver)) ttd_strlcpy(_ini_musicdriver, musicdriver, sizeof(_ini_musicdriver));
|
if (!StrEmpty(musicdriver)) strecpy(_ini_musicdriver, musicdriver, lastof(_ini_musicdriver));
|
||||||
if (!StrEmpty(sounddriver)) ttd_strlcpy(_ini_sounddriver, sounddriver, sizeof(_ini_sounddriver));
|
if (!StrEmpty(sounddriver)) strecpy(_ini_sounddriver, sounddriver, lastof(_ini_sounddriver));
|
||||||
if (!StrEmpty(videodriver)) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver));
|
if (!StrEmpty(videodriver)) strecpy(_ini_videodriver, videodriver, lastof(_ini_videodriver));
|
||||||
if (!StrEmpty(blitter)) ttd_strlcpy(_ini_blitter, blitter, sizeof(_ini_blitter));
|
if (!StrEmpty(blitter)) strecpy(_ini_blitter, blitter, lastof(_ini_blitter));
|
||||||
if (resolution.width != 0) { _cur_resolution = resolution; }
|
if (resolution.width != 0) { _cur_resolution = resolution; }
|
||||||
if (startyear != INVALID_YEAR) _settings_newgame.game_creation.starting_year = startyear;
|
if (startyear != INVALID_YEAR) _settings_newgame.game_creation.starting_year = startyear;
|
||||||
if (generation_seed != GENERATE_NEW_SEED) _settings_newgame.game_creation.generation_seed = generation_seed;
|
if (generation_seed != GENERATE_NEW_SEED) _settings_newgame.game_creation.generation_seed = generation_seed;
|
||||||
|
@ -1109,7 +1109,7 @@ static void DoAutosave()
|
||||||
SetDParam(0, _local_company);
|
SetDParam(0, _local_company);
|
||||||
SetDParam(1, _date);
|
SetDParam(1, _date);
|
||||||
GetString(buf, STR_4004, lastof(buf));
|
GetString(buf, STR_4004, lastof(buf));
|
||||||
ttd_strlcat(buf, ".sav", lengthof(buf));
|
strecat(buf, ".sav", lastof(buf));
|
||||||
} else {
|
} else {
|
||||||
/* generate a savegame name and number according to _settings_client.gui.max_num_autosaves */
|
/* generate a savegame name and number according to _settings_client.gui.max_num_autosaves */
|
||||||
snprintf(buf, sizeof(buf), "autosave%d.sav", _autosave_ctr);
|
snprintf(buf, sizeof(buf), "autosave%d.sav", _autosave_ctr);
|
||||||
|
|
|
@ -75,7 +75,7 @@ void FiosGetDrives()
|
||||||
#else
|
#else
|
||||||
snprintf(fios->name, lengthof(fios->name), "%c:", disk);
|
snprintf(fios->name, lengthof(fios->name), "%c:", disk);
|
||||||
#endif
|
#endif
|
||||||
ttd_strlcpy(fios->title, fios->name, lengthof(fios->title));
|
strecpy(fios->title, fios->name, lastof(fios->title));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -548,7 +548,7 @@ static char *MakeScreenshotName(const char *ext)
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if (_game_mode == GM_EDITOR || _game_mode == GM_MENU || _local_company == COMPANY_SPECTATOR) {
|
if (_game_mode == GM_EDITOR || _game_mode == GM_MENU || _local_company == COMPANY_SPECTATOR) {
|
||||||
ttd_strlcpy(_screenshot_name, "screenshot", lengthof(_screenshot_name));
|
strecpy(_screenshot_name, "screenshot", lastof(_screenshot_name));
|
||||||
} else {
|
} else {
|
||||||
SetDParam(0, _local_company);
|
SetDParam(0, _local_company);
|
||||||
SetDParam(1, _date);
|
SetDParam(1, _date);
|
||||||
|
|
|
@ -1190,15 +1190,15 @@ struct CustomCurrencyWindow : Window {
|
||||||
|
|
||||||
case CUSTCURR_SEPARATOR: /* Thousands seperator */
|
case CUSTCURR_SEPARATOR: /* Thousands seperator */
|
||||||
_custom_currency.separator = StrEmpty(str) ? ' ' : str[0];
|
_custom_currency.separator = StrEmpty(str) ? ' ' : str[0];
|
||||||
ttd_strlcpy(this->separator, str, lengthof(this->separator));
|
strecpy(this->separator, str, lastof(this->separator));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUSTCURR_PREFIX:
|
case CUSTCURR_PREFIX:
|
||||||
ttd_strlcpy(_custom_currency.prefix, str, lengthof(_custom_currency.prefix));
|
strecpy(_custom_currency.prefix, str, lastof(_custom_currency.prefix));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUSTCURR_SUFFIX:
|
case CUSTCURR_SUFFIX:
|
||||||
ttd_strlcpy(_custom_currency.suffix, str, lengthof(_custom_currency.suffix));
|
strecpy(_custom_currency.suffix, str, lastof(_custom_currency.suffix));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CUSTCURR_TO_EURO: { /* Year to switch to euro */
|
case CUSTCURR_TO_EURO: { /* Year to switch to euro */
|
||||||
|
|
|
@ -643,11 +643,11 @@ static void HandlePragma(char *str)
|
||||||
if (!memcmp(str, "id ", 3)) {
|
if (!memcmp(str, "id ", 3)) {
|
||||||
_next_string_id = strtoul(str + 3, NULL, 0);
|
_next_string_id = strtoul(str + 3, NULL, 0);
|
||||||
} else if (!memcmp(str, "name ", 5)) {
|
} else if (!memcmp(str, "name ", 5)) {
|
||||||
ttd_strlcpy(_lang_name, str + 5, sizeof(_lang_name));
|
strecpy(_lang_name, str + 5, lastof(_lang_name));
|
||||||
} else if (!memcmp(str, "ownname ", 8)) {
|
} else if (!memcmp(str, "ownname ", 8)) {
|
||||||
ttd_strlcpy(_lang_ownname, str + 8, sizeof(_lang_ownname));
|
strecpy(_lang_ownname, str + 8, lastof(_lang_ownname));
|
||||||
} else if (!memcmp(str, "isocode ", 8)) {
|
} else if (!memcmp(str, "isocode ", 8)) {
|
||||||
ttd_strlcpy(_lang_isocode, str + 8, sizeof(_lang_isocode));
|
strecpy(_lang_isocode, str + 8, lastof(_lang_isocode));
|
||||||
} else if (!memcmp(str, "plural ", 7)) {
|
} else if (!memcmp(str, "plural ", 7)) {
|
||||||
_lang_pluralform = atoi(str + 7);
|
_lang_pluralform = atoi(str + 7);
|
||||||
if (_lang_pluralform >= lengthof(_plural_form_counts))
|
if (_lang_pluralform >= lengthof(_plural_form_counts))
|
||||||
|
@ -668,7 +668,7 @@ static void HandlePragma(char *str)
|
||||||
|
|
||||||
if (s == NULL) break;
|
if (s == NULL) break;
|
||||||
if (_numgenders >= MAX_NUM_GENDER) error("Too many genders, max %d", MAX_NUM_GENDER);
|
if (_numgenders >= MAX_NUM_GENDER) error("Too many genders, max %d", MAX_NUM_GENDER);
|
||||||
ttd_strlcpy(_genders[_numgenders], s, sizeof(_genders[_numgenders]));
|
strecpy(_genders[_numgenders], s, lastof(_genders[_numgenders]));
|
||||||
_numgenders++;
|
_numgenders++;
|
||||||
}
|
}
|
||||||
} else if (!memcmp(str, "case ", 5)) {
|
} else if (!memcmp(str, "case ", 5)) {
|
||||||
|
@ -679,7 +679,7 @@ static void HandlePragma(char *str)
|
||||||
|
|
||||||
if (s == NULL) break;
|
if (s == NULL) break;
|
||||||
if (_numcases >= MAX_NUM_CASES) error("Too many cases, max %d", MAX_NUM_CASES);
|
if (_numcases >= MAX_NUM_CASES) error("Too many cases, max %d", MAX_NUM_CASES);
|
||||||
ttd_strlcpy(_cases[_numcases], s, sizeof(_cases[_numcases]));
|
strecpy(_cases[_numcases], s, lastof(_cases[_numcases]));
|
||||||
_numcases++;
|
_numcases++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1271,7 +1271,7 @@ bool ReadLanguagePack(int lang_index)
|
||||||
_langpack_offs = langpack_offs;
|
_langpack_offs = langpack_offs;
|
||||||
|
|
||||||
const char *c_file = strrchr(_dynlang.ent[lang_index].file, PATHSEPCHAR) + 1;
|
const char *c_file = strrchr(_dynlang.ent[lang_index].file, PATHSEPCHAR) + 1;
|
||||||
ttd_strlcpy(_dynlang.curr_file, c_file, lengthof(_dynlang.curr_file));
|
strecpy(_dynlang.curr_file, c_file, lastof(_dynlang.curr_file));
|
||||||
|
|
||||||
_dynlang.curr = lang_index;
|
_dynlang.curr = lang_index;
|
||||||
_dynlang.text_dir = (TextDirection)lang_pack->text_dir;
|
_dynlang.text_dir = (TextDirection)lang_pack->text_dir;
|
||||||
|
|
|
@ -154,7 +154,7 @@ static const char *convert_tofrom_fs(iconv_t convd, const char *name)
|
||||||
size_t outlen = sizeof(buf) - 1;
|
size_t outlen = sizeof(buf) - 1;
|
||||||
size_t inlen = strlen(name);
|
size_t inlen = strlen(name);
|
||||||
|
|
||||||
ttd_strlcpy(outbuf, name, sizeof(buf));
|
strecpy(outbuf, name, lastof(buf));
|
||||||
|
|
||||||
iconv(convd, NULL, NULL, NULL, NULL);
|
iconv(convd, NULL, NULL, NULL, NULL);
|
||||||
if (iconv(convd, &inbuf, &inlen, &outbuf, &outlen) == (size_t)(-1)) {
|
if (iconv(convd, &inbuf, &inlen, &outbuf, &outlen) == (size_t)(-1)) {
|
||||||
|
|
|
@ -803,7 +803,7 @@ void FiosGetDrives()
|
||||||
fios->type = FIOS_TYPE_DRIVE;
|
fios->type = FIOS_TYPE_DRIVE;
|
||||||
fios->mtime = 0;
|
fios->mtime = 0;
|
||||||
snprintf(fios->name, lengthof(fios->name), PATHSEP "");
|
snprintf(fios->name, lengthof(fios->name), PATHSEP "");
|
||||||
ttd_strlcpy(fios->title, fios->name, lengthof(fios->title));
|
strecpy(fios->title, fios->name, lastof(fios->title));
|
||||||
#else
|
#else
|
||||||
TCHAR drives[256];
|
TCHAR drives[256];
|
||||||
const TCHAR *s;
|
const TCHAR *s;
|
||||||
|
@ -814,7 +814,7 @@ void FiosGetDrives()
|
||||||
fios->type = FIOS_TYPE_DRIVE;
|
fios->type = FIOS_TYPE_DRIVE;
|
||||||
fios->mtime = 0;
|
fios->mtime = 0;
|
||||||
snprintf(fios->name, lengthof(fios->name), "%c:", s[0] & 0xFF);
|
snprintf(fios->name, lengthof(fios->name), "%c:", s[0] & 0xFF);
|
||||||
ttd_strlcpy(fios->title, fios->name, lengthof(fios->title));
|
strecpy(fios->title, fios->name, lastof(fios->title));
|
||||||
while (*s++ != '\0') { /* Nothing */ }
|
while (*s++ != '\0') { /* Nothing */ }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1127,7 +1127,7 @@ bool InsertTextBufferClipboard(Textbuf *tb)
|
||||||
cbuf = GetClipboardData(CF_TEXT);
|
cbuf = GetClipboardData(CF_TEXT);
|
||||||
|
|
||||||
ptr = (const char*)GlobalLock(cbuf);
|
ptr = (const char*)GlobalLock(cbuf);
|
||||||
ttd_strlcpy(utf8_buf, FS2OTTD(ptr), lengthof(utf8_buf));
|
strecpy(utf8_buf, FS2OTTD(ptr), lastof(utf8_buf));
|
||||||
|
|
||||||
GlobalUnlock(cbuf);
|
GlobalUnlock(cbuf);
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
|
Loading…
Reference in New Issue