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:
48
src/3rdparty/md5/md5.cpp
vendored
48
src/3rdparty/md5/md5.cpp
vendored
@@ -60,7 +60,7 @@
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
#define T_MASK ((uint32)~0)
|
||||
#define T_MASK ((uint32_t)~0)
|
||||
#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87)
|
||||
#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9)
|
||||
#define T3 0x242070db
|
||||
@@ -126,31 +126,31 @@
|
||||
#define T63 0x2ad7d2bb
|
||||
#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
|
||||
|
||||
static inline void Md5Set1(const uint32 *X, uint32 *a, const uint32 *b, const uint32 *c, const uint32 *d, const uint8 k, const uint8 s, const uint32 Ti)
|
||||
static inline void Md5Set1(const uint32_t *X, uint32_t *a, const uint32_t *b, const uint32_t *c, const uint32_t *d, const uint8_t k, const uint8_t s, const uint32_t Ti)
|
||||
{
|
||||
uint32 t = (*b & *c) | (~*b & *d);
|
||||
uint32_t t = (*b & *c) | (~*b & *d);
|
||||
t += *a + X[k] + Ti;
|
||||
*a = ROL(t, s) + *b;
|
||||
}
|
||||
|
||||
static inline void Md5Set2(const uint32 *X, uint32 *a, const uint32 *b, const uint32 *c, const uint32 *d, const uint8 k, const uint8 s, const uint32 Ti)
|
||||
static inline void Md5Set2(const uint32_t *X, uint32_t *a, const uint32_t *b, const uint32_t *c, const uint32_t *d, const uint8_t k, const uint8_t s, const uint32_t Ti)
|
||||
{
|
||||
uint32 t = (*b & *d) | (*c & ~*d);
|
||||
uint32_t t = (*b & *d) | (*c & ~*d);
|
||||
t += *a + X[k] + Ti;
|
||||
*a = ROL(t, s) + *b;
|
||||
}
|
||||
|
||||
|
||||
static inline void Md5Set3(const uint32 *X, uint32 *a, const uint32 *b, const uint32 *c, const uint32 *d, const uint8 k, const uint8 s, const uint32 Ti)
|
||||
static inline void Md5Set3(const uint32_t *X, uint32_t *a, const uint32_t *b, const uint32_t *c, const uint32_t *d, const uint8_t k, const uint8_t s, const uint32_t Ti)
|
||||
{
|
||||
uint32 t = *b ^ *c ^ *d;
|
||||
uint32_t t = *b ^ *c ^ *d;
|
||||
t += *a + X[k] + Ti;
|
||||
*a = ROL(t, s) + *b;
|
||||
}
|
||||
|
||||
static inline void Md5Set4(const uint32 *X, uint32 *a, const uint32 *b, const uint32 *c, const uint32 *d, const uint8 k, const uint8 s, const uint32 Ti)
|
||||
static inline void Md5Set4(const uint32_t *X, uint32_t *a, const uint32_t *b, const uint32_t *c, const uint32_t *d, const uint8_t k, const uint8_t s, const uint32_t Ti)
|
||||
{
|
||||
uint32 t = *c ^ (*b | ~*d);
|
||||
uint32_t t = *c ^ (*b | ~*d);
|
||||
t += *a + X[k] + Ti;
|
||||
*a = ROL(t, s) + *b;
|
||||
}
|
||||
@@ -165,17 +165,17 @@ Md5::Md5()
|
||||
abcd[3] = 0x10325476;
|
||||
}
|
||||
|
||||
void Md5::Process(const uint8 *data /*[64]*/)
|
||||
void Md5::Process(const uint8_t *data /*[64]*/)
|
||||
{
|
||||
uint32 a = this->abcd[0];
|
||||
uint32 b = this->abcd[1];
|
||||
uint32 c = this->abcd[2];
|
||||
uint32 d = this->abcd[3];
|
||||
uint32_t a = this->abcd[0];
|
||||
uint32_t b = this->abcd[1];
|
||||
uint32_t c = this->abcd[2];
|
||||
uint32_t d = this->abcd[3];
|
||||
|
||||
uint32 X[16];
|
||||
uint32_t X[16];
|
||||
|
||||
/* Convert the uint8 data to uint32 LE */
|
||||
const uint32 *px = (const uint32 *)data;
|
||||
/* Convert the uint8_t data to uint32_t LE */
|
||||
const uint32_t *px = (const uint32_t *)data;
|
||||
for (uint i = 0; i < 16; i++) {
|
||||
X[i] = TO_LE32(*px);
|
||||
px++;
|
||||
@@ -264,15 +264,15 @@ void Md5::Process(const uint8 *data /*[64]*/)
|
||||
|
||||
void Md5::Append(const void *data, const size_t nbytes)
|
||||
{
|
||||
const uint8 *p = (const uint8 *)data;
|
||||
const uint8_t *p = (const uint8_t *)data;
|
||||
size_t left = nbytes;
|
||||
const size_t offset = (this->count[0] >> 3) & 63;
|
||||
const uint32 nbits = (uint32)(nbytes << 3);
|
||||
const uint32_t nbits = (uint32_t)(nbytes << 3);
|
||||
|
||||
if (nbytes <= 0) return;
|
||||
|
||||
/* Update the message length. */
|
||||
this->count[1] += (uint32)(nbytes >> 29);
|
||||
this->count[1] += (uint32_t)(nbytes >> 29);
|
||||
this->count[0] += nbits;
|
||||
|
||||
if (this->count[0] < nbits) this->count[1]++;
|
||||
@@ -299,17 +299,17 @@ void Md5::Append(const void *data, const size_t nbytes)
|
||||
|
||||
void Md5::Finish(MD5Hash &digest)
|
||||
{
|
||||
static const uint8 pad[64] = {
|
||||
static const uint8_t pad[64] = {
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
uint8 data[8];
|
||||
uint8_t data[8];
|
||||
|
||||
/* Save the length before padding. */
|
||||
for (uint i = 0; i < 8; ++i) {
|
||||
data[i] = (uint8)(this->count[i >> 2] >> ((i & 3) << 3));
|
||||
data[i] = (uint8_t)(this->count[i >> 2] >> ((i & 3) << 3));
|
||||
}
|
||||
|
||||
/* Pad to 56 bytes mod 64. */
|
||||
@@ -318,6 +318,6 @@ void Md5::Finish(MD5Hash &digest)
|
||||
this->Append(data, 8);
|
||||
|
||||
for (uint i = 0; i < 16; ++i) {
|
||||
digest[i] = (uint8)(this->abcd[i >> 2] >> ((i & 3) << 3));
|
||||
digest[i] = (uint8_t)(this->abcd[i >> 2] >> ((i & 3) << 3));
|
||||
}
|
||||
}
|
||||
|
8
src/3rdparty/md5/md5.h
vendored
8
src/3rdparty/md5/md5.h
vendored
@@ -74,11 +74,11 @@ struct MD5Hash : std::array<byte, MD5_HASH_BYTES> {
|
||||
|
||||
struct Md5 {
|
||||
private:
|
||||
uint32 count[2]; ///< message length in bits, lsw first
|
||||
uint32 abcd[4]; ///< digest buffer
|
||||
uint8 buf[64]; ///< accumulate block
|
||||
uint32_t count[2]; ///< message length in bits, lsw first
|
||||
uint32_t abcd[4]; ///< digest buffer
|
||||
uint8_t buf[64]; ///< accumulate block
|
||||
|
||||
void Process(const uint8 *data);
|
||||
void Process(const uint8_t *data);
|
||||
|
||||
public:
|
||||
Md5();
|
||||
|
2
src/3rdparty/squirrel/include/squirrel.h
vendored
2
src/3rdparty/squirrel/include/squirrel.h
vendored
@@ -179,7 +179,7 @@ typedef void (*SQPRINTFUNCTION)(HSQUIRRELVM,const std::string &);
|
||||
typedef SQInteger (*SQWRITEFUNC)(SQUserPointer,SQUserPointer,SQInteger);
|
||||
typedef SQInteger (*SQREADFUNC)(SQUserPointer,SQUserPointer,SQInteger);
|
||||
|
||||
typedef WChar (*SQLEXREADFUNC)(SQUserPointer);
|
||||
typedef char32_t (*SQLEXREADFUNC)(SQUserPointer);
|
||||
|
||||
typedef struct tagSQRegFunction{
|
||||
const SQChar *name;
|
||||
|
6
src/3rdparty/squirrel/squirrel/sqapi.cpp
vendored
6
src/3rdparty/squirrel/squirrel/sqapi.cpp
vendored
@@ -1259,9 +1259,9 @@ struct BufState{
|
||||
SQInteger size;
|
||||
};
|
||||
|
||||
WChar buf_lexfeed(SQUserPointer file)
|
||||
char32_t buf_lexfeed(SQUserPointer file)
|
||||
{
|
||||
/* Convert an UTF-8 character into a WChar */
|
||||
/* Convert an UTF-8 character into a char32_t */
|
||||
BufState *buf = (BufState *)file;
|
||||
const char *p = &buf->buf[buf->ptr];
|
||||
|
||||
@@ -1279,7 +1279,7 @@ WChar buf_lexfeed(SQUserPointer file)
|
||||
buf->ptr += len;
|
||||
|
||||
/* Convert the character, and when definitely invalid, bail out as well. */
|
||||
WChar c;
|
||||
char32_t c;
|
||||
if (Utf8Decode(&c, p) != len) return -1;
|
||||
|
||||
return c;
|
||||
|
6
src/3rdparty/squirrel/squirrel/sqlexer.cpp
vendored
6
src/3rdparty/squirrel/squirrel/sqlexer.cpp
vendored
@@ -26,7 +26,7 @@ SQLexer::~SQLexer()
|
||||
_keywords->Release();
|
||||
}
|
||||
|
||||
void SQLexer::APPEND_CHAR(WChar c)
|
||||
void SQLexer::APPEND_CHAR(char32_t c)
|
||||
{
|
||||
char buf[4];
|
||||
size_t chars = Utf8Encode(buf, c);
|
||||
@@ -101,7 +101,7 @@ NORETURN void SQLexer::Error(const SQChar *err)
|
||||
|
||||
void SQLexer::Next()
|
||||
{
|
||||
WChar t = _readf(_up);
|
||||
char32_t t = _readf(_up);
|
||||
if(t > MAX_CHAR) Error("Invalid character");
|
||||
if(t != 0) {
|
||||
_currdata = t;
|
||||
@@ -287,7 +287,7 @@ SQInteger SQLexer::GetIDType(SQChar *s)
|
||||
}
|
||||
|
||||
|
||||
SQInteger SQLexer::ReadString(WChar ndelim,bool verbatim)
|
||||
SQInteger SQLexer::ReadString(char32_t ndelim,bool verbatim)
|
||||
{
|
||||
INIT_TEMP_STRING();
|
||||
NEXT();
|
||||
|
6
src/3rdparty/squirrel/squirrel/sqlexer.h
vendored
6
src/3rdparty/squirrel/squirrel/sqlexer.h
vendored
@@ -11,7 +11,7 @@ struct SQLexer
|
||||
const SQChar *Tok2Str(SQInteger tok);
|
||||
private:
|
||||
SQInteger GetIDType(SQChar *s);
|
||||
SQInteger ReadString(WChar ndelim,bool verbatim);
|
||||
SQInteger ReadString(char32_t ndelim,bool verbatim);
|
||||
SQInteger ReadNumber();
|
||||
void LexBlockComment();
|
||||
SQInteger ReadID();
|
||||
@@ -19,7 +19,7 @@ private:
|
||||
SQInteger _curtoken;
|
||||
SQTable *_keywords;
|
||||
void INIT_TEMP_STRING() { _longstr.resize(0); }
|
||||
void APPEND_CHAR(WChar c);
|
||||
void APPEND_CHAR(char32_t c);
|
||||
void TERMINATE_BUFFER() { _longstr.push_back('\0'); }
|
||||
|
||||
public:
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
SQFloat _fvalue;
|
||||
SQLEXREADFUNC _readf;
|
||||
SQUserPointer _up;
|
||||
WChar _currdata;
|
||||
char32_t _currdata;
|
||||
SQSharedState *_sharedstate;
|
||||
sqvector<SQChar> _longstr;
|
||||
CompilerErrorFunc _errfunc;
|
||||
|
Reference in New Issue
Block a user