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:
@@ -180,7 +180,7 @@ void CoreTextFontCache::SetFontSize(int pixels)
|
||||
Debug(fontcache, 2, "Loaded font '{}' with size {}", this->font_name, pixels);
|
||||
}
|
||||
|
||||
GlyphID CoreTextFontCache::MapCharToGlyph(WChar key)
|
||||
GlyphID CoreTextFontCache::MapCharToGlyph(char32_t key)
|
||||
{
|
||||
assert(IsPrintable(key));
|
||||
|
||||
@@ -205,7 +205,7 @@ GlyphID CoreTextFontCache::MapCharToGlyph(WChar key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const void *CoreTextFontCache::InternalGetFontTable(uint32 tag, size_t &length)
|
||||
const void *CoreTextFontCache::InternalGetFontTable(uint32_t tag, size_t &length)
|
||||
{
|
||||
CFAutoRelease<CFDataRef> data(CTFontCopyTable(this->font.get(), (CTFontTableTag)tag, kCTFontTableOptionNoOptions));
|
||||
if (!data) return nullptr;
|
||||
@@ -246,8 +246,8 @@ const Sprite *CoreTextFontCache::InternalGetGlyph(GlyphID key, bool use_aa)
|
||||
sprite.colours = (use_aa ? SCC_PAL | SCC_ALPHA : SCC_PAL);
|
||||
sprite.width = width;
|
||||
sprite.height = height;
|
||||
sprite.x_offs = (int16)std::round(CGRectGetMinX(bounds));
|
||||
sprite.y_offs = this->ascender - (int16)std::ceil(CGRectGetMaxY(bounds));
|
||||
sprite.x_offs = (int16_t)std::round(CGRectGetMinX(bounds));
|
||||
sprite.y_offs = this->ascender - (int16_t)std::ceil(CGRectGetMaxY(bounds));
|
||||
|
||||
if (bounds.size.width > 0) {
|
||||
/* Glyph is not a white-space glyph. Render it to a bitmap context. */
|
||||
|
||||
@@ -23,13 +23,13 @@ class CoreTextFontCache : public TrueTypeFontCache {
|
||||
|
||||
void SetFontSize(int pixels);
|
||||
const Sprite *InternalGetGlyph(GlyphID key, bool use_aa) override;
|
||||
const void *InternalGetFontTable(uint32 tag, size_t &length) override;
|
||||
const void *InternalGetFontTable(uint32_t tag, size_t &length) override;
|
||||
public:
|
||||
CoreTextFontCache(FontSize fs, CFAutoRelease<CTFontDescriptorRef> &&font, int pixels);
|
||||
~CoreTextFontCache() {}
|
||||
|
||||
void ClearFontCache() override;
|
||||
GlyphID MapCharToGlyph(WChar key) override;
|
||||
GlyphID MapCharToGlyph(char32_t key) override;
|
||||
std::string GetFontName() override { return font_name; }
|
||||
bool IsBuiltInFont() override { return false; }
|
||||
const void *GetOSHandle() override { return font.get(); }
|
||||
|
||||
@@ -38,7 +38,7 @@ bool IsMonospaceFont(CFStringRef name);
|
||||
|
||||
void MacOSSetThreadName(const char *name);
|
||||
|
||||
uint64 MacOSGetPhysicalMemory();
|
||||
uint64_t MacOSGetPhysicalMemory();
|
||||
|
||||
|
||||
/** Deleter that calls CFRelease rather than deleting the pointer. */
|
||||
|
||||
@@ -268,7 +268,7 @@ void MacOSSetThreadName(const char *name)
|
||||
}
|
||||
}
|
||||
|
||||
uint64 MacOSGetPhysicalMemory()
|
||||
uint64_t MacOSGetPhysicalMemory()
|
||||
{
|
||||
return [ [ NSProcessInfo processInfo ] physicalMemory ];
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
int CountRuns() const override { return 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
|
||||
{
|
||||
/* CoreText uses UTF-16 internally which means we need to account for surrogate pairs. */
|
||||
return c >= 0x010000U ? 2 : 1;
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
static CGFloat SpriteFontGetWidth(void *ref_con)
|
||||
{
|
||||
FontSize fs = (FontSize)((size_t)ref_con >> 24);
|
||||
WChar c = (WChar)((size_t)ref_con & 0xFFFFFF);
|
||||
char32_t c = (char32_t)((size_t)ref_con & 0xFFFFFF);
|
||||
|
||||
return GetGlyphWidth(fs, c);
|
||||
}
|
||||
@@ -185,7 +185,7 @@ static CTRunDelegateCallbacks _sprite_font_callback = {
|
||||
}
|
||||
CFAttributedStringSetAttribute(str.get(), CFRangeMake(last, i.first - last), kCTFontAttributeName, font);
|
||||
|
||||
CGColorRef color = CGColorCreateGenericGray((uint8)i.second->colour / 255.0f, 1.0f); // We don't care about the real colours, just that they are different.
|
||||
CGColorRef color = CGColorCreateGenericGray((uint8_t)i.second->colour / 255.0f, 1.0f); // We don't care about the real colours, just that they are different.
|
||||
CFAttributedStringSetAttribute(str.get(), CFRangeMake(last, i.first - last), kCTForegroundColorAttributeName, color);
|
||||
CGColorRelease(color);
|
||||
|
||||
@@ -351,7 +351,7 @@ int MacOSStringCompare(std::string_view s1, std::string_view s2)
|
||||
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((UniChar)c);
|
||||
} else {
|
||||
|
||||
@@ -61,7 +61,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. */
|
||||
|
||||
Reference in New Issue
Block a user