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

@@ -117,7 +117,7 @@ static void StrMakeValid(T &dst, const char *str, const char *last, StringValida
while (str <= last && *str != '\0') {
size_t len = Utf8EncodedCharLen(*str);
WChar c;
char32_t c;
/* If the first byte does not look like the first byte of an encoded
* character, i.e. encoded length is 0, then this byte is definitely bad
* and it should be skipped.
@@ -240,7 +240,7 @@ bool StrValid(const char *str, const char *last)
* within the encoding of an UTF8 character. */
if (len == 0 || str + len > last) return false;
WChar c;
char32_t c;
len = Utf8Decode(&c, str);
if (!IsPrintable(c) || (c >= SCC_SPRITE_START && c <= SCC_SPRITE_END)) {
return false;
@@ -436,7 +436,7 @@ bool strtolower(std::string &str, std::string::size_type offs)
* @param afilter the filter to use
* @return true or false depending if the character is printable/valid or not
*/
bool IsValidChar(WChar key, CharSetFilter afilter)
bool IsValidChar(char32_t key, CharSetFilter afilter)
{
switch (afilter) {
case CS_ALPHANUMERAL: return IsPrintable(key);
@@ -459,7 +459,7 @@ bool IsValidChar(WChar key, CharSetFilter afilter)
* @param s Character stream to retrieve character from.
* @return Number of characters in the sequence.
*/
size_t Utf8Decode(WChar *c, const char *s)
size_t Utf8Decode(char32_t *c, const char *s)
{
assert(c != nullptr);
@@ -500,7 +500,7 @@ size_t Utf8Decode(WChar *c, const char *s)
* @return Number of characters in the encoded sequence.
*/
template <class T>
inline size_t Utf8Encode(T buf, WChar c)
inline size_t Utf8Encode(T buf, char32_t c)
{
if (c < 0x80) {
*buf = c;
@@ -526,17 +526,17 @@ inline size_t Utf8Encode(T buf, WChar c)
return 1;
}
size_t Utf8Encode(char *buf, WChar c)
size_t Utf8Encode(char *buf, char32_t c)
{
return Utf8Encode<char *>(buf, c);
}
size_t Utf8Encode(std::ostreambuf_iterator<char> &buf, WChar c)
size_t Utf8Encode(std::ostreambuf_iterator<char> &buf, char32_t c)
{
return Utf8Encode<std::ostreambuf_iterator<char> &>(buf, c);
}
size_t Utf8Encode(std::back_insert_iterator<std::string> &buf, WChar c)
size_t Utf8Encode(std::back_insert_iterator<std::string> &buf, char32_t c)
{
return Utf8Encode<std::back_insert_iterator<std::string> &>(buf, c);
}
@@ -687,7 +687,7 @@ public:
while (*s != '\0') {
size_t idx = s - string_base;
WChar c = Utf8Consume(&s);
char32_t c = Utf8Consume(&s);
if (c < 0x10000) {
this->utf16_str.push_back((UChar)c);
} else {
@@ -742,7 +742,7 @@ public:
* break point, but we only want word starts. Move to the next location in
* case the new position points to whitespace. */
while (pos != icu::BreakIterator::DONE &&
IsWhitespace(Utf16DecodeChar((const uint16 *)&this->utf16_str[pos]))) {
IsWhitespace(Utf16DecodeChar((const uint16_t *)&this->utf16_str[pos]))) {
int32_t new_pos = this->word_itr->next();
/* Don't set it to DONE if it was valid before. Otherwise we'll return END
* even though the iterator wasn't at the end of the string before. */
@@ -774,7 +774,7 @@ public:
* break point, but we only want word starts. Move to the previous location in
* case the new position points to whitespace. */
while (pos != icu::BreakIterator::DONE &&
IsWhitespace(Utf16DecodeChar((const uint16 *)&this->utf16_str[pos]))) {
IsWhitespace(Utf16DecodeChar((const uint16_t *)&this->utf16_str[pos]))) {
int32_t new_pos = this->word_itr->previous();
/* Don't set it to DONE if it was valid before. Otherwise we'll return END
* even though the iterator wasn't at the start of the string before. */
@@ -836,13 +836,13 @@ public:
switch (what) {
case ITER_CHARACTER: {
WChar c;
char32_t c;
this->cur_pos += Utf8Decode(&c, this->string + this->cur_pos);
return this->cur_pos;
}
case ITER_WORD: {
WChar c;
char32_t c;
/* Consume current word. */
size_t offs = Utf8Decode(&c, this->string + this->cur_pos);
while (this->cur_pos < this->len && !IsWhitespace(c)) {
@@ -878,7 +878,7 @@ public:
case ITER_WORD: {
const char *s = this->string + this->cur_pos;
WChar c;
char32_t c;
/* Consume preceding whitespace. */
do {
s = Utf8PrevChar(s);