Codechange: automatic adding of _t to (u)int types, and WChar to char32_t

for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
Rubidium
2023-05-08 19:01:06 +02:00
committed by rubidium42
parent 4f4810dc28
commit eaae0bb5e7
564 changed files with 4561 additions and 4561 deletions

View File

@@ -136,14 +136,14 @@ void FileStringReader::HandlePragma(char *str)
if (langid > (long)UINT16_MAX || langid < 0) {
FatalError("Invalid winlangid {}", 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) {
FatalError("Invalid grflangid {}", buf);
}
_lang.newgrflangid = (uint8)langid;
_lang.newgrflangid = (uint8_t)langid;
} else if (!memcmp(str, "gender ", 7)) {
if (this->master) FatalError("Genders are not allowed in the base translation.");
char *buf = str + 7;

View File

@@ -189,7 +189,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);
@@ -213,7 +213,7 @@ struct Buffer : std::vector<byte> {
size_t Utf8Validate(const char *s)
{
uint32 c;
uint32_t c;
if (!HasBit(s[0], 7)) {
/* 1 byte */
@@ -435,7 +435,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) StrgenFatal("Invalid case-name '{}'", case_str);
return case_idx + 1;
}
@@ -663,7 +663,7 @@ void StringReader::HandleString(char *str)
size_t len = Utf8Validate(tmp);
if (len == 0) StrgenFatal("Invalid UTF-8 sequence in '{}'", s);
WChar c;
char32_t c;
Utf8Decode(&c, tmp);
if (c <= 0x001F || // ASCII control character range
c == 0x200B || // Zero width space