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

@@ -71,26 +71,26 @@ static inline size_t ttd_strnlen(const char *str, size_t maxlen)
return t - str;
}
bool IsValidChar(WChar key, CharSetFilter afilter);
bool IsValidChar(char32_t key, CharSetFilter afilter);
size_t Utf8Decode(WChar *c, const char *s);
size_t Utf8Encode(char *buf, WChar c);
size_t Utf8Encode(std::ostreambuf_iterator<char> &buf, WChar c);
size_t Utf8Encode(std::back_insert_iterator<std::string> &buf, WChar c);
size_t Utf8Decode(char32_t *c, const char *s);
size_t Utf8Encode(char *buf, char32_t c);
size_t Utf8Encode(std::ostreambuf_iterator<char> &buf, char32_t c);
size_t Utf8Encode(std::back_insert_iterator<std::string> &buf, char32_t c);
size_t Utf8TrimString(char *s, size_t maxlen);
static inline WChar Utf8Consume(const char **s)
static inline char32_t Utf8Consume(const char **s)
{
WChar c;
char32_t c;
*s += Utf8Decode(&c, *s);
return c;
}
template <class Titr>
static inline WChar Utf8Consume(Titr &s)
static inline char32_t Utf8Consume(Titr &s)
{
WChar c;
char32_t c;
s += Utf8Decode(&c, &*s);
return c;
}
@@ -100,7 +100,7 @@ static inline WChar Utf8Consume(Titr &s)
* @param c Unicode character.
* @return Length of UTF-8 encoding for character.
*/
static inline int8 Utf8CharLen(WChar c)
static inline int8_t Utf8CharLen(char32_t c)
{
if (c < 0x80) return 1;
if (c < 0x800) return 2;
@@ -119,7 +119,7 @@ static inline int8 Utf8CharLen(WChar c)
* @param c char to query length of
* @return requested size
*/
static inline int8 Utf8EncodedCharLen(char c)
static inline int8_t Utf8EncodedCharLen(char c)
{
if (GB(c, 3, 5) == 0x1E) return 4;
if (GB(c, 4, 4) == 0x0E) return 3;
@@ -187,7 +187,7 @@ static inline bool Utf16IsTrailSurrogate(uint c)
* @param trail Trail surrogate code point.
* @return Decoded Unicode character.
*/
static inline WChar Utf16DecodeSurrogate(uint lead, uint trail)
static inline char32_t Utf16DecodeSurrogate(uint lead, uint trail)
{
return 0x10000 + (((lead - 0xD800) << 10) | (trail - 0xDC00));
}
@@ -197,7 +197,7 @@ static inline WChar Utf16DecodeSurrogate(uint lead, uint trail)
* @param c Pointer to one or two UTF-16 code points.
* @return Decoded Unicode character.
*/
static inline WChar Utf16DecodeChar(const uint16 *c)
static inline char32_t Utf16DecodeChar(const uint16_t *c)
{
if (Utf16IsLeadSurrogate(c[0])) {
return Utf16DecodeSurrogate(c[0], c[1]);
@@ -212,7 +212,7 @@ static inline WChar Utf16DecodeChar(const uint16 *c)
* @return true iff the character is used to influence
* the text direction.
*/
static inline bool IsTextDirectionChar(WChar c)
static inline bool IsTextDirectionChar(char32_t c)
{
switch (c) {
case CHAR_TD_LRM:
@@ -229,7 +229,7 @@ static inline bool IsTextDirectionChar(WChar c)
}
}
static inline bool IsPrintable(WChar c)
static inline bool IsPrintable(char32_t c)
{
if (c < 0x20) return false;
if (c < 0xE000) return true;
@@ -244,7 +244,7 @@ static inline bool IsPrintable(WChar c)
* @return a boolean value whether 'c' is a whitespace character or not
* @see http://www.fileformat.info/info/unicode/category/Zs/list.htm
*/
static inline bool IsWhitespace(WChar c)
static inline bool IsWhitespace(char32_t c)
{
return c == 0x0020 /* SPACE */ || c == 0x3000; /* IDEOGRAPHIC SPACE */
}