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:
@@ -90,16 +90,16 @@ public:
|
||||
}
|
||||
|
||||
struct DebugFileInfo {
|
||||
uint32 size;
|
||||
uint32 crc32;
|
||||
uint32_t size;
|
||||
uint32_t crc32;
|
||||
SYSTEMTIME file_time;
|
||||
};
|
||||
|
||||
static uint32 _crc_table[256];
|
||||
static uint32_t _crc_table[256];
|
||||
|
||||
static void MakeCRCTable()
|
||||
{
|
||||
uint32 crc, poly = 0xEDB88320L;
|
||||
uint32_t crc, poly = 0xEDB88320L;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
@@ -112,7 +112,7 @@ static void MakeCRCTable()
|
||||
}
|
||||
}
|
||||
|
||||
static uint32 CalcCRC(byte *data, uint size, uint32 crc)
|
||||
static uint32_t CalcCRC(byte *data, uint size, uint32_t crc)
|
||||
{
|
||||
for (; size > 0; size--) {
|
||||
crc = ((crc >> 8) & 0x00FFFFFF) ^ _crc_table[(crc ^ *data++) & 0xFF];
|
||||
@@ -129,9 +129,9 @@ static void GetFileInfo(DebugFileInfo *dfi, const wchar_t *filename)
|
||||
if (file != INVALID_HANDLE_VALUE) {
|
||||
byte buffer[1024];
|
||||
DWORD numread;
|
||||
uint32 filesize = 0;
|
||||
uint32_t filesize = 0;
|
||||
FILETIME write_time;
|
||||
uint32 crc = (uint32)-1;
|
||||
uint32_t crc = (uint32_t)-1;
|
||||
|
||||
for (;;) {
|
||||
if (ReadFile(file, buffer, sizeof(buffer), &numread, nullptr) == 0 || numread == 0) {
|
||||
@@ -141,7 +141,7 @@ static void GetFileInfo(DebugFileInfo *dfi, const wchar_t *filename)
|
||||
crc = CalcCRC(buffer, numread, crc);
|
||||
}
|
||||
dfi->size = filesize;
|
||||
dfi->crc32 = crc ^ (uint32)-1;
|
||||
dfi->crc32 = crc ^ (uint32_t)-1;
|
||||
|
||||
if (GetFileTime(file, nullptr, nullptr, &write_time)) {
|
||||
FileTimeToSystemTime(&write_time, &dfi->file_time);
|
||||
@@ -308,15 +308,15 @@ static void PrintModuleInfo(std::back_insert_iterator<std::string> &output_itera
|
||||
{
|
||||
fmt::format_to(output_iterator, "Stack trace:\n");
|
||||
#ifdef _M_AMD64
|
||||
uint32 *b = (uint32*)ep->ContextRecord->Rsp;
|
||||
uint32_t *b = (uint32_t*)ep->ContextRecord->Rsp;
|
||||
#elif defined(_M_IX86)
|
||||
uint32 *b = (uint32*)ep->ContextRecord->Esp;
|
||||
uint32_t *b = (uint32_t*)ep->ContextRecord->Esp;
|
||||
#elif defined(_M_ARM64)
|
||||
uint32 *b = (uint32*)ep->ContextRecord->Sp;
|
||||
uint32_t *b = (uint32_t*)ep->ContextRecord->Sp;
|
||||
#endif
|
||||
for (int j = 0; j != 24; j++) {
|
||||
for (int i = 0; i != 8; i++) {
|
||||
if (IsBadReadPtr(b, sizeof(uint32))) {
|
||||
if (IsBadReadPtr(b, sizeof(uint32_t))) {
|
||||
fmt::format_to(output_iterator, " ????????"); // OCR: WAS - , 0);
|
||||
} else {
|
||||
fmt::format_to(output_iterator, " {:08X}", *b);
|
||||
@@ -658,7 +658,7 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARA
|
||||
const char *unix_nl = CrashLogWindows::current->crashlog.data();
|
||||
char dos_nl[65536];
|
||||
char *p = dos_nl;
|
||||
WChar c;
|
||||
char32_t c;
|
||||
while ((c = Utf8Consume(&unix_nl)) && p < lastof(dos_nl) - 4) { // 4 is max number of bytes per character
|
||||
if (c == '\n') p += Utf8Encode(p, '\r');
|
||||
p += Utf8Encode(p, c);
|
||||
|
@@ -279,7 +279,7 @@ void Win32FontCache::ClearFontCache()
|
||||
return new_glyph.sprite;
|
||||
}
|
||||
|
||||
/* virtual */ GlyphID Win32FontCache::MapCharToGlyph(WChar key)
|
||||
/* virtual */ GlyphID Win32FontCache::MapCharToGlyph(char32_t key)
|
||||
{
|
||||
assert(IsPrintable(key));
|
||||
|
||||
@@ -302,7 +302,7 @@ void Win32FontCache::ClearFontCache()
|
||||
return glyphs[0] != 0xFFFF ? glyphs[0] : 0;
|
||||
}
|
||||
|
||||
/* virtual */ const void *Win32FontCache::InternalGetFontTable(uint32 tag, size_t &length)
|
||||
/* virtual */ const void *Win32FontCache::InternalGetFontTable(uint32_t tag, size_t &length)
|
||||
{
|
||||
DWORD len = GetFontData(this->dc, tag, 0, nullptr, 0);
|
||||
|
||||
|
@@ -26,14 +26,14 @@ private:
|
||||
void SetFontSize(FontSize fs, int pixels);
|
||||
|
||||
protected:
|
||||
const void *InternalGetFontTable(uint32 tag, size_t &length) override;
|
||||
const void *InternalGetFontTable(uint32_t tag, size_t &length) override;
|
||||
const Sprite *InternalGetGlyph(GlyphID key, bool aa) override;
|
||||
|
||||
public:
|
||||
Win32FontCache(FontSize fs, const LOGFONT &logfont, int pixels);
|
||||
~Win32FontCache();
|
||||
void ClearFontCache() override;
|
||||
GlyphID MapCharToGlyph(WChar key) override;
|
||||
GlyphID MapCharToGlyph(char32_t key) override;
|
||||
std::string GetFontName() override { return this->fontname; }
|
||||
const void *GetOSHandle() override { return &this->logfont; }
|
||||
};
|
||||
|
@@ -54,7 +54,7 @@ struct UniscribeRun {
|
||||
};
|
||||
|
||||
/** Break a string into language formatting ranges. */
|
||||
static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutFactory::CharType *buff, int32 length);
|
||||
static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutFactory::CharType *buff, int32_t length);
|
||||
/** Generate and place glyphs for a run of characters. */
|
||||
static bool UniscribeShapeRun(const UniscribeParagraphLayoutFactory::CharType *buff, UniscribeRun &range);
|
||||
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
int CountRuns() const override { return (uint)this->size(); }
|
||||
const VisualRun &GetVisualRun(int run) const override { return this->at(run); }
|
||||
|
||||
int GetInternalCharLength(WChar c) const override
|
||||
int GetInternalCharLength(char32_t c) const override
|
||||
{
|
||||
/* Uniscribe uses UTF-16 internally which means we need to account for surrogate pairs. */
|
||||
return c >= 0x010000U ? 2 : 1;
|
||||
@@ -247,7 +247,7 @@ static bool UniscribeShapeRun(const UniscribeParagraphLayoutFactory::CharType *b
|
||||
return true;
|
||||
}
|
||||
|
||||
static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutFactory::CharType *buff, int32 length)
|
||||
static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutFactory::CharType *buff, int32_t length)
|
||||
{
|
||||
/* Itemize text. */
|
||||
SCRIPT_CONTROL control;
|
||||
@@ -280,7 +280,7 @@ static std::vector<SCRIPT_ITEM> UniscribeItemizeString(UniscribeParagraphLayoutF
|
||||
|
||||
/* static */ ParagraphLayouter *UniscribeParagraphLayoutFactory::GetParagraphLayout(CharType *buff, CharType *buff_end, FontMap &fontMapping)
|
||||
{
|
||||
int32 length = buff_end - buff;
|
||||
int32_t length = buff_end - buff;
|
||||
/* Can't layout an empty string. */
|
||||
if (length == 0) return nullptr;
|
||||
|
||||
@@ -534,7 +534,7 @@ const int *UniscribeParagraphLayout::UniscribeVisualRun::GetGlyphToCharMap() con
|
||||
while (*s != '\0') {
|
||||
size_t idx = s - string_base;
|
||||
|
||||
WChar c = Utf8Consume(&s);
|
||||
char32_t c = Utf8Consume(&s);
|
||||
if (c < 0x10000) {
|
||||
utf16_str.push_back((wchar_t)c);
|
||||
} else {
|
||||
@@ -552,7 +552,7 @@ const int *UniscribeParagraphLayout::UniscribeVisualRun::GetGlyphToCharMap() con
|
||||
|
||||
if (utf16_str.size() > 0) {
|
||||
/* Itemize string into language runs. */
|
||||
std::vector<SCRIPT_ITEM> runs = UniscribeItemizeString(&utf16_str[0], (int32)utf16_str.size());
|
||||
std::vector<SCRIPT_ITEM> runs = UniscribeItemizeString(&utf16_str[0], (int32_t)utf16_str.size());
|
||||
|
||||
for (std::vector<SCRIPT_ITEM>::const_iterator run = runs.begin(); runs.size() > 0 && run != runs.end() - 1; run++) {
|
||||
/* Get information on valid word and character break.s */
|
||||
|
@@ -43,7 +43,7 @@ public:
|
||||
* @param c The character to add.
|
||||
* @return The number of buffer spaces that were used.
|
||||
*/
|
||||
static size_t AppendToBuffer(CharType *buff, const CharType *buffer_last, WChar c)
|
||||
static size_t AppendToBuffer(CharType *buff, const CharType *buffer_last, char32_t c)
|
||||
{
|
||||
if (c >= 0x010000U) {
|
||||
/* Character is encoded using surrogates in UTF-16. */
|
||||
|
@@ -193,16 +193,16 @@ void FiosGetDrives(FileList &file_list)
|
||||
bool FiosIsValidFile(const std::string &path, const struct dirent *ent, struct stat *sb)
|
||||
{
|
||||
/* hectonanoseconds between Windows and POSIX epoch */
|
||||
static const int64 posix_epoch_hns = 0x019DB1DED53E8000LL;
|
||||
static const int64_t posix_epoch_hns = 0x019DB1DED53E8000LL;
|
||||
const WIN32_FIND_DATA *fd = &ent->dir->fd;
|
||||
|
||||
sb->st_size = ((uint64) fd->nFileSizeHigh << 32) + fd->nFileSizeLow;
|
||||
sb->st_size = ((uint64_t) fd->nFileSizeHigh << 32) + fd->nFileSizeLow;
|
||||
/* UTC FILETIME to seconds-since-1970 UTC
|
||||
* we just have to subtract POSIX epoch and scale down to units of seconds.
|
||||
* http://www.gamedev.net/community/forums/topic.asp?topic_id=294070&whichpage=1�
|
||||
* XXX - not entirely correct, since filetimes on FAT aren't UTC but local,
|
||||
* this won't entirely be correct, but we use the time only for comparison. */
|
||||
sb->st_mtime = (time_t)((*(const uint64*)&fd->ftLastWriteTime - posix_epoch_hns) / 1E7);
|
||||
sb->st_mtime = (time_t)((*(const uint64_t*)&fd->ftLastWriteTime - posix_epoch_hns) / 1E7);
|
||||
sb->st_mode = (fd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)? S_IFDIR : S_IFREG;
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user