mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r14560) -Fix [FS#2396](r14555): lengthof() can't be simply replaced by lastof() in some cases (part by Aali)
This commit is contained in:
parent
808d9255a8
commit
7dd0b0dc07
|
@ -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))
|
||||||
strecpy(_network_company_info[ci->client_playas].clients, ci->client_name, lastof(_network_company_info[0].clients));
|
strecpy(_network_company_info[ci->client_playas].clients, ci->client_name, lastof(_network_company_info[ci->client_playas].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)) {
|
||||||
strecat(_network_company_info[ci->client_playas].clients, ", ", lastof(_network_company_info[0].clients));
|
strecat(_network_company_info[ci->client_playas].clients, ", ", lastof(_network_company_info[ci->client_playas].clients));
|
||||||
}
|
}
|
||||||
|
|
||||||
strecat(_network_company_info[ci->client_playas].clients, client_name, lastof(_network_company_info[0].clients));
|
strecat(_network_company_info[ci->client_playas].clients, client_name, lastof(_network_company_info[ci->client_playas].clients));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
strecpy(outbuf, name, lastof(buf));
|
strecpy(outbuf, name, outbuf + outlen);
|
||||||
|
|
||||||
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)) {
|
||||||
|
|
Loading…
Reference in New Issue