@@ -132,7 +132,7 @@ struct FileStringReader : StringReader {
|
||||
|
||||
char *ReadLine(char *buffer, const char *last) override
|
||||
{
|
||||
char *result = fgets(buffer, ClampTo<uint16>(last - buffer + 1), this->fh);
|
||||
char *result = fgets(buffer, ClampTo<uint16_t>(last - buffer + 1), this->fh);
|
||||
if (result == nullptr && this->fh2 != nullptr) {
|
||||
fclose(this->fh);
|
||||
this->fh = this->fh2;
|
||||
@@ -190,14 +190,14 @@ void FileStringReader::HandlePragma(char *str)
|
||||
if (langid > (long)UINT16_MAX || langid < 0) {
|
||||
error("Invalid winlangid %s", buf);
|
||||
}
|
||||
_lang.winlangid = (uint16)langid;
|
||||
_lang.winlangid = (uint16_t)langid;
|
||||
} else if (!memcmp(str, "grflangid ", 10)) {
|
||||
const char *buf = str + 10;
|
||||
long langid = std::strtol(buf, nullptr, 16);
|
||||
if (langid >= 0x7F || langid < 0) {
|
||||
error("Invalid grflangid %s", buf);
|
||||
}
|
||||
_lang.newgrflangid = (uint8)langid;
|
||||
_lang.newgrflangid = (uint8_t)langid;
|
||||
} else if (!memcmp(str, "gender ", 7)) {
|
||||
if (this->master) error("Genders are not allowed in the base translation.");
|
||||
char *buf = str + 7;
|
||||
|
||||
@@ -183,7 +183,7 @@ struct Buffer : std::vector<byte> {
|
||||
* Add an Unicode character encoded in UTF-8 to the buffer.
|
||||
* @param value The character to add.
|
||||
*/
|
||||
void AppendUtf8(uint32 value)
|
||||
void AppendUtf8(uint32_t value)
|
||||
{
|
||||
if (value < 0x80) {
|
||||
this->push_back(value);
|
||||
@@ -207,7 +207,7 @@ struct Buffer : std::vector<byte> {
|
||||
|
||||
size_t Utf8Validate(const char *s)
|
||||
{
|
||||
uint32 c;
|
||||
uint32_t c;
|
||||
|
||||
if (!HasBit(s[0], 7)) {
|
||||
/* 1 byte */
|
||||
@@ -429,7 +429,7 @@ static uint ResolveCaseName(const char *str, size_t len)
|
||||
memcpy(case_str, str, len);
|
||||
case_str[len] = '\0';
|
||||
|
||||
uint8 case_idx = _lang.GetCaseIndex(case_str);
|
||||
uint8_t case_idx = _lang.GetCaseIndex(case_str);
|
||||
if (case_idx >= MAX_NUM_CASES) strgen_fatal("Invalid case-name '%s'", case_str);
|
||||
return case_idx + 1;
|
||||
}
|
||||
@@ -657,7 +657,7 @@ void StringReader::HandleString(char *str)
|
||||
size_t len = Utf8Validate(tmp);
|
||||
if (len == 0) strgen_fatal("Invalid UTF-8 sequence in '%s'", s);
|
||||
|
||||
WChar c;
|
||||
char32_t c;
|
||||
Utf8Decode(&c, tmp);
|
||||
if (c <= 0x001F || // ASCII control character range
|
||||
c == 0x200B || // Zero width space
|
||||
|
||||
Reference in New Issue
Block a user