Browse Source

Use c32 type instead unsigned for UTF-32 code units

1vanK 3 years ago
parent
commit
2d7a20f180

+ 22 - 27
Source/Tools/BindingGenerator/ASUtils.cpp

@@ -55,10 +55,10 @@ string CppPrimitiveTypeToAS(const string& cppType)
 
 
     // Types below are registered in Manual.cpp
     // Types below are registered in Manual.cpp
     
     
-    if (cppType == "long")
+    if (cppType == "long") // Size is compiler-dependent
         return "long";
         return "long";
 
 
-    if (cppType == "unsigned long")
+    if (cppType == "unsigned long") // Size is compiler-dependent
         return "ulong";
         return "ulong";
 
 
     if (cppType == "size_t")
     if (cppType == "size_t")
@@ -67,9 +67,26 @@ string CppPrimitiveTypeToAS(const string& cppType)
     if (cppType == "SDL_JoystickID")
     if (cppType == "SDL_JoystickID")
         return "SDL_JoystickID";
         return "SDL_JoystickID";
 
 
+    if (cppType == "c32")
+        return "c32";
+
     throw Exception(cppType + " not a primitive type");
     throw Exception(cppType + " not a primitive type");
 }
 }
 
 
+static bool IsKnownPrimitiveCppType(const string& cppType)
+{
+    try
+    {
+        CppPrimitiveTypeToAS(cppType);
+    }
+    catch (...)
+    {
+        return false;
+    }
+
+    return true;
+}
+
 string JoinASDeclarations(const vector<ConvertedVariable>& vars)
 string JoinASDeclarations(const vector<ConvertedVariable>& vars)
 {
 {
     string result;
     string result;
@@ -142,31 +159,6 @@ bool IsKnownCppType(const string& name)
 {
 {
     static vector<string> _knownTypes = {
     static vector<string> _knownTypes = {
         "void",
         "void",
-        "bool",
-        "size_t",
-        "char",
-        "signed char",
-        "i8",
-        "unsigned char",
-        "u8",
-        "short",
-        "i16",
-        "unsigned short",
-        "u16",
-        "int",
-        "i32",
-        "long", // Size is compiler-dependent
-        "unsigned",
-        "unsigned int",
-        "u32",
-        "unsigned long", // Size is compiler-dependent
-        "long long",
-        "i64",
-        "unsigned long long",
-        "u64",
-        "float",
-        "double",
-        "SDL_JoystickID",
 
 
         // TODO: Remove
         // TODO: Remove
         "VariantMap",
         "VariantMap",
@@ -175,6 +167,9 @@ bool IsKnownCppType(const string& name)
     if (CONTAINS(_knownTypes, name))
     if (CONTAINS(_knownTypes, name))
         return true;
         return true;
 
 
+    if (IsKnownPrimitiveCppType(name))
+        return true;
+
     if (SourceData::classesByName_.find(name) != SourceData::classesByName_.end())
     if (SourceData::classesByName_.find(name) != SourceData::classesByName_.end())
         return true;
         return true;
 
 

+ 19 - 19
Source/Urho3D/AngelScript/Generated_Members.h

@@ -4945,8 +4945,8 @@ template <class T> void RegisterMembers_String(asIScriptEngine* engine, const ch
     // String& String::Append(char c)
     // String& String::Append(char c)
     engine->RegisterObjectMethod(className, "String& Append(int8)", AS_METHODPR(T, Append, (char), String&), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "String& Append(int8)", AS_METHODPR(T, Append, (char), String&), AS_CALL_THISCALL);
 
 
-    // String& String::AppendUTF8(unsigned unicodeChar)
-    engine->RegisterObjectMethod(className, "String& AppendUTF8(uint)", AS_METHODPR(T, AppendUTF8, (unsigned), String&), AS_CALL_THISCALL);
+    // String& String::AppendUTF8(c32 unicodeChar)
+    engine->RegisterObjectMethod(className, "String& AppendUTF8(c32)", AS_METHODPR(T, AppendUTF8, (c32), String&), AS_CALL_THISCALL);
 
 
     // char& String::At(i32 index)
     // char& String::At(i32 index)
     engine->RegisterObjectMethod(className, "int8& At(int)", AS_METHODPR(T, At, (i32), char&), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "int8& At(int)", AS_METHODPR(T, At, (i32), char&), AS_CALL_THISCALL);
@@ -4954,8 +4954,8 @@ template <class T> void RegisterMembers_String(asIScriptEngine* engine, const ch
     // const char& String::At(i32 index) const
     // const char& String::At(i32 index) const
     engine->RegisterObjectMethod(className, "const int8& At(int) const", AS_METHODPR(T, At, (i32) const, const char&), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "const int8& At(int) const", AS_METHODPR(T, At, (i32) const, const char&), AS_CALL_THISCALL);
 
 
-    // unsigned String::AtUTF8(i32 index) const
-    engine->RegisterObjectMethod(className, "uint AtUTF8(int) const", AS_METHODPR(T, AtUTF8, (i32) const, unsigned), AS_CALL_THISCALL);
+    // c32 String::AtUTF8(i32 index) const
+    engine->RegisterObjectMethod(className, "c32 AtUTF8(int) const", AS_METHODPR(T, AtUTF8, (i32) const, c32), AS_CALL_THISCALL);
 
 
     // char String::Back() const
     // char String::Back() const
     engine->RegisterObjectMethod(className, "int8 Back() const", AS_METHODPR(T, Back, () const, char), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "int8 Back() const", AS_METHODPR(T, Back, () const, char), AS_CALL_THISCALL);
@@ -5026,8 +5026,8 @@ template <class T> void RegisterMembers_String(asIScriptEngine* engine, const ch
     engine->RegisterObjectMethod(className, "int LengthUTF8() const", AS_METHODPR(T, LengthUTF8, () const, i32), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "int LengthUTF8() const", AS_METHODPR(T, LengthUTF8, () const, i32), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "int get_utf8Length() const", AS_METHODPR(T, LengthUTF8, () const, i32), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "int get_utf8Length() const", AS_METHODPR(T, LengthUTF8, () const, i32), AS_CALL_THISCALL);
 
 
-    // unsigned String::NextUTF8Char(i32& byteOffset) const
-    engine->RegisterObjectMethod(className, "uint NextUTF8Char(int&) const", AS_METHODPR(T, NextUTF8Char, (i32&) const, unsigned), AS_CALL_THISCALL);
+    // c32 String::NextUTF8Char(i32& byteOffset) const
+    engine->RegisterObjectMethod(className, "c32 NextUTF8Char(int&) const", AS_METHODPR(T, NextUTF8Char, (i32&) const, c32), AS_CALL_THISCALL);
 
 
     // String String::operator +(const String& rhs) const
     // String String::operator +(const String& rhs) const
     engine->RegisterObjectMethod(className, "String opAdd(const String&in) const", AS_METHODPR(T, operator+, (const String&) const, String), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "String opAdd(const String&in) const", AS_METHODPR(T, operator+, (const String&) const, String), AS_CALL_THISCALL);
@@ -5089,8 +5089,8 @@ template <class T> void RegisterMembers_String(asIScriptEngine* engine, const ch
     // String String::Replaced(const String& replaceThis, const String& replaceWith, bool caseSensitive = true) const
     // String String::Replaced(const String& replaceThis, const String& replaceWith, bool caseSensitive = true) const
     engine->RegisterObjectMethod(className, "String Replaced(const String&in, const String&in, bool = true) const", AS_METHODPR(T, Replaced, (const String&, const String&, bool) const, String), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "String Replaced(const String&in, const String&in, bool = true) const", AS_METHODPR(T, Replaced, (const String&, const String&, bool) const, String), AS_CALL_THISCALL);
 
 
-    // void String::ReplaceUTF8(i32 index, unsigned unicodeChar)
-    engine->RegisterObjectMethod(className, "void ReplaceUTF8(int, uint)", AS_METHODPR(T, ReplaceUTF8, (i32, unsigned), void), AS_CALL_THISCALL);
+    // void String::ReplaceUTF8(i32 index, c32 unicodeChar)
+    engine->RegisterObjectMethod(className, "void ReplaceUTF8(int, c32)", AS_METHODPR(T, ReplaceUTF8, (i32, c32), void), AS_CALL_THISCALL);
 
 
     // void String::Reserve(i32 newCapacity)
     // void String::Reserve(i32 newCapacity)
     engine->RegisterObjectMethod(className, "void Reserve(int)", AS_METHODPR(T, Reserve, (i32), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void Reserve(int)", AS_METHODPR(T, Reserve, (i32), void), AS_CALL_THISCALL);
@@ -5140,9 +5140,9 @@ template <class T> void RegisterMembers_String(asIScriptEngine* engine, const ch
     // Error: type "const char*" can not automatically bind
     // Error: type "const char*" can not automatically bind
     // static String String::Joined(const Vector<String>& subStrings, const String& glue)
     // static String String::Joined(const Vector<String>& subStrings, const String& glue)
     // Not registered because have @manualbind mark
     // Not registered because have @manualbind mark
-    // static void String::EncodeUTF8(char*& dest, unsigned unicodeChar)
+    // static void String::EncodeUTF8(char*& dest, c32 unicodeChar)
     // Error: type "char*&" can not automatically bind
     // Error: type "char*&" can not automatically bind
-    // static unsigned String::DecodeUTF8(const char*& src)
+    // static c32 String::DecodeUTF8(const char*& src)
     // Error: type "const char*&" can not automatically bind
     // Error: type "const char*&" can not automatically bind
     // static i32 String::CStringLength(const char* str)
     // static i32 String::CStringLength(const char* str)
     // Error: type "const char*" can not automatically bind
     // Error: type "const char*" can not automatically bind
@@ -7953,13 +7953,13 @@ template <class T> void RegisterMembers_FontFace(asIScriptEngine* engine, const
 {
 {
     RegisterMembers_RefCounted<T>(engine, className);
     RegisterMembers_RefCounted<T>(engine, className);
 
 
-    // virtual const FontGlyph* FontFace::GetGlyph(unsigned c)
+    // virtual const FontGlyph* FontFace::GetGlyph(c32 c)
     // Error: type "const FontGlyph*" can not automatically bind
     // Error: type "const FontGlyph*" can not automatically bind
     // virtual bool FontFace::Load(const unsigned char* fontData, unsigned fontDataSize, float pointSize) = 0
     // virtual bool FontFace::Load(const unsigned char* fontData, unsigned fontDataSize, float pointSize) = 0
     // Error: type "const unsigned char*" can not automatically bind
     // Error: type "const unsigned char*" can not automatically bind
 
 
-    // float FontFace::GetKerning(unsigned c, unsigned d) const
-    engine->RegisterObjectMethod(className, "float GetKerning(uint, uint) const", AS_METHODPR(T, GetKerning, (unsigned, unsigned) const, float), AS_CALL_THISCALL);
+    // float FontFace::GetKerning(c32 c, c32 d) const
+    engine->RegisterObjectMethod(className, "float GetKerning(c32, c32) const", AS_METHODPR(T, GetKerning, (c32, c32) const, float), AS_CALL_THISCALL);
 
 
     // float FontFace::GetPointSize() const
     // float FontFace::GetPointSize() const
     engine->RegisterObjectMethod(className, "float GetPointSize() const", AS_METHODPR(T, GetPointSize, () const, float), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "float GetPointSize() const", AS_METHODPR(T, GetPointSize, () const, float), AS_CALL_THISCALL);
@@ -22200,9 +22200,9 @@ template <class T> void RegisterMembers_LineEdit(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "uint GetCursorPosition() const", AS_METHODPR(T, GetCursorPosition, () const, unsigned), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "uint GetCursorPosition() const", AS_METHODPR(T, GetCursorPosition, () const, unsigned), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "uint get_cursorPosition() const", AS_METHODPR(T, GetCursorPosition, () const, unsigned), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "uint get_cursorPosition() const", AS_METHODPR(T, GetCursorPosition, () const, unsigned), AS_CALL_THISCALL);
 
 
-    // unsigned LineEdit::GetEchoCharacter() const
-    engine->RegisterObjectMethod(className, "uint GetEchoCharacter() const", AS_METHODPR(T, GetEchoCharacter, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_echoCharacter() const", AS_METHODPR(T, GetEchoCharacter, () const, unsigned), AS_CALL_THISCALL);
+    // c32 LineEdit::GetEchoCharacter() const
+    engine->RegisterObjectMethod(className, "c32 GetEchoCharacter() const", AS_METHODPR(T, GetEchoCharacter, () const, c32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "c32 get_echoCharacter() const", AS_METHODPR(T, GetEchoCharacter, () const, c32), AS_CALL_THISCALL);
 
 
     // unsigned LineEdit::GetMaxLength() const
     // unsigned LineEdit::GetMaxLength() const
     engine->RegisterObjectMethod(className, "uint GetMaxLength() const", AS_METHODPR(T, GetMaxLength, () const, unsigned), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "uint GetMaxLength() const", AS_METHODPR(T, GetMaxLength, () const, unsigned), AS_CALL_THISCALL);
@@ -22240,9 +22240,9 @@ template <class T> void RegisterMembers_LineEdit(asIScriptEngine* engine, const
     engine->RegisterObjectMethod(className, "void SetCursorPosition(uint)", AS_METHODPR(T, SetCursorPosition, (unsigned), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void SetCursorPosition(uint)", AS_METHODPR(T, SetCursorPosition, (unsigned), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_cursorPosition(uint)", AS_METHODPR(T, SetCursorPosition, (unsigned), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_cursorPosition(uint)", AS_METHODPR(T, SetCursorPosition, (unsigned), void), AS_CALL_THISCALL);
 
 
-    // void LineEdit::SetEchoCharacter(unsigned c)
-    engine->RegisterObjectMethod(className, "void SetEchoCharacter(uint)", AS_METHODPR(T, SetEchoCharacter, (unsigned), void), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void set_echoCharacter(uint)", AS_METHODPR(T, SetEchoCharacter, (unsigned), void), AS_CALL_THISCALL);
+    // void LineEdit::SetEchoCharacter(c32 c)
+    engine->RegisterObjectMethod(className, "void SetEchoCharacter(c32)", AS_METHODPR(T, SetEchoCharacter, (c32), void), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void set_echoCharacter(c32)", AS_METHODPR(T, SetEchoCharacter, (c32), void), AS_CALL_THISCALL);
 
 
     // void LineEdit::SetMaxLength(unsigned length)
     // void LineEdit::SetMaxLength(unsigned length)
     engine->RegisterObjectMethod(className, "void SetMaxLength(uint)", AS_METHODPR(T, SetMaxLength, (unsigned), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void SetMaxLength(uint)", AS_METHODPR(T, SetMaxLength, (unsigned), void), AS_CALL_THISCALL);

+ 1 - 0
Source/Urho3D/AngelScript/Manual.cpp

@@ -89,6 +89,7 @@ void ASRegisterManualFirst(asIScriptEngine* engine)
         engine->RegisterTypedef("size_t", "uint64");
         engine->RegisterTypedef("size_t", "uint64");
 
 
     engine->RegisterTypedef("SDL_JoystickID", "int");
     engine->RegisterTypedef("SDL_JoystickID", "int");
+    engine->RegisterTypedef("c32", "uint");
 
 
     ASRegisterManualFirst_Addons(engine);
     ASRegisterManualFirst_Addons(engine);
     ASRegisterManualFirst_Graphics(engine);
     ASRegisterManualFirst_Graphics(engine);

+ 5 - 0
Source/Urho3D/Base/PrimitiveTypes.h

@@ -8,6 +8,7 @@
 
 
 // https://en.cppreference.com/w/cpp/language/types
 // https://en.cppreference.com/w/cpp/language/types
 static_assert(CHAR_BIT == 8);
 static_assert(CHAR_BIT == 8);
+static_assert(sizeof(short) == 2);
 static_assert(sizeof(int) == 4);
 static_assert(sizeof(int) == 4);
 static_assert(sizeof(long) == 4 || sizeof(long) == 8); // (Win32, Win64, Unix32) || Unix64
 static_assert(sizeof(long) == 4 || sizeof(long) == 8); // (Win32, Win64, Unix32) || Unix64
 static_assert(sizeof(long long) == 8);
 static_assert(sizeof(long long) == 8);
@@ -21,3 +22,7 @@ typedef int32_t  i32;
 typedef uint32_t u32;
 typedef uint32_t u32;
 typedef int64_t  i64;
 typedef int64_t  i64;
 typedef uint64_t u64;
 typedef uint64_t u64;
+
+// Unicode code point (UTF-32 code unit)
+static_assert(sizeof(char32_t) == 4);
+typedef char32_t c32;

+ 6 - 0
Source/Urho3D/Container/Hash.h

@@ -86,6 +86,12 @@ template <> inline unsigned MakeHash(const char& value)
     return (unsigned)value;
     return (unsigned)value;
 }
 }
 
 
+/// Unicode code point hash function.
+template <> inline unsigned MakeHash(const c32& value)
+{
+    return (unsigned)value;
+}
+
 /// Unsigned char hash function.
 /// Unsigned char hash function.
 template <> inline unsigned MakeHash(const unsigned char& value)
 template <> inline unsigned MakeHash(const unsigned char& value)
 {
 {

+ 1 - 1
Source/Urho3D/Container/HashMap.h

@@ -253,7 +253,7 @@ public:
     }
     }
 
 
     /// Move-assign a hash map.
     /// Move-assign a hash map.
-    HashMap& operator =(HashMap<T, U> && rhs) noexcept
+    HashMap& operator =(HashMap<T, U>&& rhs) noexcept
     {
     {
         Swap(rhs);
         Swap(rhs);
         return *this;
         return *this;

+ 37 - 37
Source/Urho3D/Container/Str.cpp

@@ -787,7 +787,7 @@ void String::SetUTF8FromLatin1(const char* str)
     while (*str)
     while (*str)
     {
     {
         char* dest = temp;
         char* dest = temp;
-        EncodeUTF8(dest, (unsigned)*str++);
+        EncodeUTF8(dest, (c32)*str++);
         *dest = 0;
         *dest = 0;
         Append(temp);
         Append(temp);
     }
     }
@@ -805,7 +805,7 @@ void String::SetUTF8FromWChar(const wchar_t* str)
 #ifdef _WIN32
 #ifdef _WIN32
     while (*str)
     while (*str)
     {
     {
-        unsigned unicodeChar = DecodeUTF16(str);
+        c32 unicodeChar = DecodeUTF16(str);
         char* dest = temp;
         char* dest = temp;
         EncodeUTF8(dest, unicodeChar);
         EncodeUTF8(dest, unicodeChar);
         *dest = 0;
         *dest = 0;
@@ -815,7 +815,7 @@ void String::SetUTF8FromWChar(const wchar_t* str)
     while (*str)
     while (*str)
     {
     {
         char* dest = temp;
         char* dest = temp;
-        EncodeUTF8(dest, (unsigned)*str++);
+        EncodeUTF8(dest, (c32)*str++);
         *dest = 0;
         *dest = 0;
         Append(temp);
         Append(temp);
     }
     }
@@ -858,24 +858,24 @@ i32 String::ByteOffsetUTF8(i32 index) const
     return byteOffset;
     return byteOffset;
 }
 }
 
 
-unsigned String::NextUTF8Char(i32& byteOffset) const
+c32 String::NextUTF8Char(i32& byteOffset) const
 {
 {
     const char* buffer = GetBuffer();
     const char* buffer = GetBuffer();
 
 
     const char* src = buffer + byteOffset;
     const char* src = buffer + byteOffset;
-    unsigned ret = DecodeUTF8(src);
+    c32 ret = DecodeUTF8(src);
     byteOffset = (i32)(src - buffer);
     byteOffset = (i32)(src - buffer);
 
 
     return ret;
     return ret;
 }
 }
 
 
-unsigned String::AtUTF8(i32 index) const
+c32 String::AtUTF8(i32 index) const
 {
 {
     i32 byteOffset = ByteOffsetUTF8(index);
     i32 byteOffset = ByteOffsetUTF8(index);
     return NextUTF8Char(byteOffset);
     return NextUTF8Char(byteOffset);
 }
 }
 
 
-void String::ReplaceUTF8(i32 index, unsigned unicodeChar)
+void String::ReplaceUTF8(i32 index, c32 unicodeChar)
 {
 {
     i32 utfPos = 0;
     i32 utfPos = 0;
     i32 byteOffset = 0;
     i32 byteOffset = 0;
@@ -901,7 +901,7 @@ void String::ReplaceUTF8(i32 index, unsigned unicodeChar)
     Replace(beginCharPos, byteOffset - beginCharPos, temp, (i32)(dest - temp));
     Replace(beginCharPos, byteOffset - beginCharPos, temp, (i32)(dest - temp));
 }
 }
 
 
-String& String::AppendUTF8(unsigned unicodeChar)
+String& String::AppendUTF8(c32 unicodeChar)
 {
 {
     char temp[7];
     char temp[7];
     char* dest = temp;
     char* dest = temp;
@@ -941,7 +941,7 @@ String String::SubstringUTF8(i32 pos, i32 length) const
     return ret;
     return ret;
 }
 }
 
 
-void String::EncodeUTF8(char*& dest, unsigned unicodeChar)
+void String::EncodeUTF8(char*& dest, c32 unicodeChar)
 {
 {
     if (unicodeChar < 0x80)
     if (unicodeChar < 0x80)
         *dest++ = unicodeChar;
         *dest++ = unicodeChar;
@@ -987,19 +987,19 @@ void String::EncodeUTF8(char*& dest, unsigned unicodeChar)
     }
     }
 }
 }
 
 
-#define GET_NEXT_CONTINUATION_BYTE(ptr) *(ptr); if ((unsigned char)*(ptr) < 0x80 || (unsigned char)*(ptr) >= 0xc0) return '?'; else ++(ptr);
+#define GET_NEXT_CONTINUATION_BYTE(ptr) *(ptr); if ((u8)*(ptr) < 0x80 || (u8)*(ptr) >= 0xc0) return '?'; else ++(ptr);
 
 
-unsigned String::DecodeUTF8(const char*& src)
+c32 String::DecodeUTF8(const char*& src)
 {
 {
     if (src == nullptr)
     if (src == nullptr)
         return 0;
         return 0;
 
 
-    unsigned char char1 = *src++;
+    u8 char1 = *src++;
 
 
     // Check if we are in the middle of a UTF8 character
     // Check if we are in the middle of a UTF8 character
     if (char1 >= 0x80 && char1 < 0xc0)
     if (char1 >= 0x80 && char1 < 0xc0)
     {
     {
-        while ((unsigned char)*src >= 0x80 && (unsigned char)*src < 0xc0)
+        while ((u8)*src >= 0x80 && (u8)*src < 0xc0)
             ++src;
             ++src;
         return '?';
         return '?';
     }
     }
@@ -1008,45 +1008,45 @@ unsigned String::DecodeUTF8(const char*& src)
         return char1;
         return char1;
     else if (char1 < 0xe0)
     else if (char1 < 0xe0)
     {
     {
-        unsigned char char2 = GET_NEXT_CONTINUATION_BYTE(src);
-        return (unsigned)((char2 & 0x3fu) | ((char1 & 0x1fu) << 6u));
+        u8 char2 = GET_NEXT_CONTINUATION_BYTE(src);
+        return (c32)((char2 & 0x3fu) | ((char1 & 0x1fu) << 6u));
     }
     }
     else if (char1 < 0xf0)
     else if (char1 < 0xf0)
     {
     {
-        unsigned char char2 = GET_NEXT_CONTINUATION_BYTE(src);
-        unsigned char char3 = GET_NEXT_CONTINUATION_BYTE(src);
-        return (unsigned)((char3 & 0x3fu) | ((char2 & 0x3fu) << 6u) | ((char1 & 0xfu) << 12u));
+        u8 char2 = GET_NEXT_CONTINUATION_BYTE(src);
+        u8 char3 = GET_NEXT_CONTINUATION_BYTE(src);
+        return (c32)((char3 & 0x3fu) | ((char2 & 0x3fu) << 6u) | ((char1 & 0xfu) << 12u));
     }
     }
     else if (char1 < 0xf8)
     else if (char1 < 0xf8)
     {
     {
-        unsigned char char2 = GET_NEXT_CONTINUATION_BYTE(src);
-        unsigned char char3 = GET_NEXT_CONTINUATION_BYTE(src);
-        unsigned char char4 = GET_NEXT_CONTINUATION_BYTE(src);
-        return (unsigned)((char4 & 0x3fu) | ((char3 & 0x3fu) << 6u) | ((char2 & 0x3fu) << 12u) | ((char1 & 0x7u) << 18u));
+        u8 char2 = GET_NEXT_CONTINUATION_BYTE(src);
+        u8 char3 = GET_NEXT_CONTINUATION_BYTE(src);
+        u8 char4 = GET_NEXT_CONTINUATION_BYTE(src);
+        return (c32)((char4 & 0x3fu) | ((char3 & 0x3fu) << 6u) | ((char2 & 0x3fu) << 12u) | ((char1 & 0x7u) << 18u));
     }
     }
     else if (char1 < 0xfc)
     else if (char1 < 0xfc)
     {
     {
-        unsigned char char2 = GET_NEXT_CONTINUATION_BYTE(src);
-        unsigned char char3 = GET_NEXT_CONTINUATION_BYTE(src);
-        unsigned char char4 = GET_NEXT_CONTINUATION_BYTE(src);
-        unsigned char char5 = GET_NEXT_CONTINUATION_BYTE(src);
-        return (unsigned)((char5 & 0x3fu) | ((char4 & 0x3fu) << 6u) | ((char3 & 0x3fu) << 12u) | ((char2 & 0x3fu) << 18u) |
+        u8 char2 = GET_NEXT_CONTINUATION_BYTE(src);
+        u8 char3 = GET_NEXT_CONTINUATION_BYTE(src);
+        u8 char4 = GET_NEXT_CONTINUATION_BYTE(src);
+        u8 char5 = GET_NEXT_CONTINUATION_BYTE(src);
+        return (c32)((char5 & 0x3fu) | ((char4 & 0x3fu) << 6u) | ((char3 & 0x3fu) << 12u) | ((char2 & 0x3fu) << 18u) |
                           ((char1 & 0x3u) << 24u));
                           ((char1 & 0x3u) << 24u));
     }
     }
     else
     else
     {
     {
-        unsigned char char2 = GET_NEXT_CONTINUATION_BYTE(src);
-        unsigned char char3 = GET_NEXT_CONTINUATION_BYTE(src);
-        unsigned char char4 = GET_NEXT_CONTINUATION_BYTE(src);
-        unsigned char char5 = GET_NEXT_CONTINUATION_BYTE(src);
-        unsigned char char6 = GET_NEXT_CONTINUATION_BYTE(src);
-        return (unsigned)((char6 & 0x3fu) | ((char5 & 0x3fu) << 6u) | ((char4 & 0x3fu) << 12u) | ((char3 & 0x3fu) << 18u) |
+        u8 char2 = GET_NEXT_CONTINUATION_BYTE(src);
+        u8 char3 = GET_NEXT_CONTINUATION_BYTE(src);
+        u8 char4 = GET_NEXT_CONTINUATION_BYTE(src);
+        u8 char5 = GET_NEXT_CONTINUATION_BYTE(src);
+        u8 char6 = GET_NEXT_CONTINUATION_BYTE(src);
+        return (c32)((char6 & 0x3fu) | ((char5 & 0x3fu) << 6u) | ((char4 & 0x3fu) << 12u) | ((char3 & 0x3fu) << 18u) |
                           ((char2 & 0x3fu) << 24u) | ((char1 & 0x1u) << 30u));
                           ((char2 & 0x3fu) << 24u) | ((char1 & 0x1u) << 30u));
     }
     }
 }
 }
 
 
 #ifdef _WIN32
 #ifdef _WIN32
-void String::EncodeUTF16(wchar_t*& dest, unsigned unicodeChar)
+void String::EncodeUTF16(wchar_t*& dest, c32 unicodeChar)
 {
 {
     if (unicodeChar < 0x10000)
     if (unicodeChar < 0x10000)
         *dest++ = unicodeChar;
         *dest++ = unicodeChar;
@@ -1058,12 +1058,12 @@ void String::EncodeUTF16(wchar_t*& dest, unsigned unicodeChar)
     }
     }
 }
 }
 
 
-unsigned String::DecodeUTF16(const wchar_t*& src)
+c32 String::DecodeUTF16(const wchar_t*& src)
 {
 {
     if (src == nullptr)
     if (src == nullptr)
         return 0;
         return 0;
 
 
-    unsigned short word1 = *src++;
+    u16 word1 = *src++;
 
 
     // Check if we are at a low surrogate
     // Check if we are at a low surrogate
     if (word1 >= 0xdc00 && word1 < 0xe000)
     if (word1 >= 0xdc00 && word1 < 0xe000)
@@ -1077,7 +1077,7 @@ unsigned String::DecodeUTF16(const wchar_t*& src)
         return word1;
         return word1;
     else
     else
     {
     {
-        unsigned short word2 = *src++;
+        u16 word2 = *src++;
         if (word2 < 0xdc00 || word2 >= 0xe000)
         if (word2 < 0xdc00 || word2 >= 0xe000)
         {
         {
             --src;
             --src;

+ 8 - 8
Source/Urho3D/Container/Str.h

@@ -442,13 +442,13 @@ public:
     /// Return byte offset to char in UTF8 content.
     /// Return byte offset to char in UTF8 content.
     i32 ByteOffsetUTF8(i32 index) const;
     i32 ByteOffsetUTF8(i32 index) const;
     /// Return next Unicode character from UTF8 content and increase byte offset.
     /// Return next Unicode character from UTF8 content and increase byte offset.
-    unsigned NextUTF8Char(i32& byteOffset) const;
+    c32 NextUTF8Char(i32& byteOffset) const;
     /// Return Unicode character at index from UTF8 content.
     /// Return Unicode character at index from UTF8 content.
-    unsigned AtUTF8(i32 index) const;
+    c32 AtUTF8(i32 index) const;
     /// Replace Unicode character at index from UTF8 content.
     /// Replace Unicode character at index from UTF8 content.
-    void ReplaceUTF8(i32 index, unsigned unicodeChar);
+    void ReplaceUTF8(i32 index, c32 unicodeChar);
     /// Append Unicode character at the end as UTF8.
     /// Append Unicode character at the end as UTF8.
-    String& AppendUTF8(unsigned unicodeChar);
+    String& AppendUTF8(c32 unicodeChar);
     /// Return a UTF8 substring from position to end.
     /// Return a UTF8 substring from position to end.
     String SubstringUTF8(i32 pos) const;
     String SubstringUTF8(i32 pos) const;
     /// Return a UTF8 substring with length from position.
     /// Return a UTF8 substring with length from position.
@@ -474,14 +474,14 @@ public:
     /// @manualbind
     /// @manualbind
     static String Joined(const Vector<String>& subStrings, const String& glue);
     static String Joined(const Vector<String>& subStrings, const String& glue);
     /// Encode Unicode character to UTF8. Pointer will be incremented.
     /// Encode Unicode character to UTF8. Pointer will be incremented.
-    static void EncodeUTF8(char*& dest, unsigned unicodeChar);
+    static void EncodeUTF8(char*& dest, c32 unicodeChar);
     /// Decode Unicode character from UTF8. Pointer will be incremented.
     /// Decode Unicode character from UTF8. Pointer will be incremented.
-    static unsigned DecodeUTF8(const char*& src);
+    static c32 DecodeUTF8(const char*& src);
 #ifdef _WIN32
 #ifdef _WIN32
     /// Encode Unicode character to UTF16. Pointer will be incremented.
     /// Encode Unicode character to UTF16. Pointer will be incremented.
-    static void EncodeUTF16(wchar_t*& dest, unsigned unicodeChar);
+    static void EncodeUTF16(wchar_t*& dest, c32 unicodeChar);
     /// Decode Unicode character from UTF16. Pointer will be incremented.
     /// Decode Unicode character from UTF16. Pointer will be incremented.
-    static unsigned DecodeUTF16(const wchar_t*& src);
+    static c32 DecodeUTF16(const wchar_t*& src);
 #endif
 #endif
 
 
     /// Return length of a C string.
     /// Return length of a C string.

+ 1 - 1
Source/Urho3D/Core/ProcessUtils.cpp

@@ -341,7 +341,7 @@ String GetConsoleInput()
         ReadConsoleInputW(input, &record, 1, &readEvents);
         ReadConsoleInputW(input, &record, 1, &readEvents);
         if (record.EventType == KEY_EVENT && record.Event.KeyEvent.bKeyDown)
         if (record.EventType == KEY_EVENT && record.Event.KeyEvent.bKeyDown)
         {
         {
-            unsigned c = record.Event.KeyEvent.uChar.UnicodeChar;
+            c32 c = record.Event.KeyEvent.uChar.UnicodeChar;
             if (c)
             if (c)
             {
             {
                 if (c == '\b')
                 if (c == '\b')

+ 5 - 5
Source/Urho3D/UI/FontFace.cpp

@@ -32,9 +32,9 @@ FontFace::~FontFace()
     }
     }
 }
 }
 
 
-const FontGlyph* FontFace::GetGlyph(unsigned c)
+const FontGlyph* FontFace::GetGlyph(c32 c)
 {
 {
-    HashMap<unsigned, FontGlyph>::Iterator i = glyphMapping_.Find(c);
+    HashMap<c32, FontGlyph>::Iterator i = glyphMapping_.Find(c);
     if (i != glyphMapping_.End())
     if (i != glyphMapping_.End())
     {
     {
         FontGlyph& glyph = i->second_;
         FontGlyph& glyph = i->second_;
@@ -45,7 +45,7 @@ const FontGlyph* FontFace::GetGlyph(unsigned c)
         return nullptr;
         return nullptr;
 }
 }
 
 
-float FontFace::GetKerning(unsigned c, unsigned d) const
+float FontFace::GetKerning(c32 c, c32 d) const
 {
 {
     if (kerningMapping_.Empty())
     if (kerningMapping_.Empty())
         return 0;
         return 0;
@@ -56,9 +56,9 @@ float FontFace::GetKerning(unsigned c, unsigned d) const
     if (c > 0xffff || d > 0xffff)
     if (c > 0xffff || d > 0xffff)
         return 0;
         return 0;
 
 
-    unsigned value = (c << 16u) + d;
+    u32 value = (c << 16u) + d;
 
 
-    HashMap<unsigned, float>::ConstIterator i = kerningMapping_.Find(value);
+    HashMap<u32, float>::ConstIterator i = kerningMapping_.Find(value);
     if (i != kerningMapping_.End())
     if (i != kerningMapping_.End())
         return i->second_;
         return i->second_;
 
 

+ 4 - 4
Source/Urho3D/UI/FontFace.h

@@ -54,13 +54,13 @@ public:
     /// Load font face.
     /// Load font face.
     virtual bool Load(const unsigned char* fontData, unsigned fontDataSize, float pointSize) = 0;
     virtual bool Load(const unsigned char* fontData, unsigned fontDataSize, float pointSize) = 0;
     /// Return pointer to the glyph structure corresponding to a character. Return null if glyph not found.
     /// Return pointer to the glyph structure corresponding to a character. Return null if glyph not found.
-    virtual const FontGlyph* GetGlyph(unsigned c);
+    virtual const FontGlyph* GetGlyph(c32 c);
 
 
     /// Return if font face uses mutable glyphs.
     /// Return if font face uses mutable glyphs.
     virtual bool HasMutableGlyphs() const { return false; }
     virtual bool HasMutableGlyphs() const { return false; }
 
 
     /// Return the kerning for a character and the next character.
     /// Return the kerning for a character and the next character.
-    float GetKerning(unsigned c, unsigned d) const;
+    float GetKerning(c32 c, c32 d) const;
     /// Return true when one of the texture has a data loss.
     /// Return true when one of the texture has a data loss.
     bool IsDataLost() const;
     bool IsDataLost() const;
 
 
@@ -83,9 +83,9 @@ protected:
     /// Parent font.
     /// Parent font.
     Font* font_{};
     Font* font_{};
     /// Glyph mapping.
     /// Glyph mapping.
-    HashMap<unsigned, FontGlyph> glyphMapping_;
+    HashMap<c32, FontGlyph> glyphMapping_;
     /// Kerning mapping.
     /// Kerning mapping.
-    HashMap<unsigned, float> kerningMapping_;
+    HashMap<u32, float> kerningMapping_;
     /// Glyph texture pages.
     /// Glyph texture pages.
     Vector<SharedPtr<Texture2D> > textures_;
     Vector<SharedPtr<Texture2D> > textures_;
     /// Point size.
     /// Point size.

+ 5 - 5
Source/Urho3D/UI/FontFaceBitmap.cpp

@@ -170,7 +170,7 @@ bool FontFaceBitmap::Load(FontFace* fontFace, bool usedGlyphs)
     int maxTextureSize = font_->GetSubsystem<UI>()->GetMaxFontTextureSize();
     int maxTextureSize = font_->GetSubsystem<UI>()->GetMaxFontTextureSize();
     AreaAllocator allocator(FONT_TEXTURE_MIN_SIZE, FONT_TEXTURE_MIN_SIZE, maxTextureSize, maxTextureSize);
     AreaAllocator allocator(FONT_TEXTURE_MIN_SIZE, FONT_TEXTURE_MIN_SIZE, maxTextureSize, maxTextureSize);
 
 
-    for (HashMap<unsigned, FontGlyph>::ConstIterator i = fontFace->glyphMapping_.Begin(); i != fontFace->glyphMapping_.End(); ++i)
+    for (HashMap<c32, FontGlyph>::ConstIterator i = fontFace->glyphMapping_.Begin(); i != fontFace->glyphMapping_.End(); ++i)
     {
     {
         FontGlyph fontGlyph = i->second_;
         FontGlyph fontGlyph = i->second_;
         if (!fontGlyph.used_)
         if (!fontGlyph.used_)
@@ -220,7 +220,7 @@ bool FontFaceBitmap::Load(FontFace* fontFace, bool usedGlyphs)
         newImages[i] = image;
         newImages[i] = image;
     }
     }
 
 
-    for (HashMap<unsigned, FontGlyph>::Iterator i = glyphMapping_.Begin(); i != glyphMapping_.End(); ++i)
+    for (HashMap<c32, FontGlyph>::Iterator i = glyphMapping_.Begin(); i != glyphMapping_.End(); ++i)
     {
     {
         FontGlyph& newGlyph = i->second_;
         FontGlyph& newGlyph = i->second_;
         const FontGlyph& oldGlyph = fontFace->glyphMapping_[i->first_];
         const FontGlyph& oldGlyph = fontFace->glyphMapping_[i->first_];
@@ -232,7 +232,7 @@ bool FontFaceBitmap::Load(FontFace* fontFace, bool usedGlyphs)
     for (unsigned i = 0; i < newImages.Size(); ++i)
     for (unsigned i = 0; i < newImages.Size(); ++i)
         textures_[i] = LoadFaceTexture(newImages[i]);
         textures_[i] = LoadFaceTexture(newImages[i]);
 
 
-    for (HashMap<unsigned, float>::ConstIterator i = fontFace->kerningMapping_.Begin(); i != fontFace->kerningMapping_.End(); ++i)
+    for (HashMap<u32, float>::ConstIterator i = fontFace->kerningMapping_.Begin(); i != fontFace->kerningMapping_.End(); ++i)
     {
     {
         unsigned first = (i->first_) >> 16u;
         unsigned first = (i->first_) >> 16u;
         unsigned second = (i->first_) & 0xffffu;
         unsigned second = (i->first_) & 0xffffu;
@@ -290,7 +290,7 @@ bool FontFaceBitmap::Save(Serializer& dest, int pointSize, const String& indenta
     unsigned numGlyphs = glyphMapping_.Size();
     unsigned numGlyphs = glyphMapping_.Size();
     charsElem.SetInt("count", numGlyphs);
     charsElem.SetInt("count", numGlyphs);
 
 
-    for (HashMap<unsigned, FontGlyph>::ConstIterator i = glyphMapping_.Begin(); i != glyphMapping_.End(); ++i)
+    for (HashMap<c32, FontGlyph>::ConstIterator i = glyphMapping_.Begin(); i != glyphMapping_.End(); ++i)
     {
     {
         // Char
         // Char
         XMLElement charElem = charsElem.CreateChild("char");
         XMLElement charElem = charsElem.CreateChild("char");
@@ -310,7 +310,7 @@ bool FontFaceBitmap::Save(Serializer& dest, int pointSize, const String& indenta
     if (!kerningMapping_.Empty())
     if (!kerningMapping_.Empty())
     {
     {
         XMLElement kerningsElem = rootElem.CreateChild("kernings");
         XMLElement kerningsElem = rootElem.CreateChild("kernings");
-        for (HashMap<unsigned, float>::ConstIterator i = kerningMapping_.Begin(); i != kerningMapping_.End(); ++i)
+        for (HashMap<u32, float>::ConstIterator i = kerningMapping_.Begin(); i != kerningMapping_.End(); ++i)
         {
         {
             XMLElement kerningElem = kerningsElem.CreateChild("kerning");
             XMLElement kerningElem = kerningsElem.CreateChild("kerning");
             kerningElem.SetInt("first", i->first_ >> 16u);
             kerningElem.SetInt("first", i->first_ >> 16u);

+ 4 - 4
Source/Urho3D/UI/FontFaceFreeType.cpp

@@ -271,9 +271,9 @@ bool FontFaceFreeType::Load(const unsigned char* fontData, unsigned fontDataSize
     return true;
     return true;
 }
 }
 
 
-const FontGlyph* FontFaceFreeType::GetGlyph(unsigned c)
+const FontGlyph* FontFaceFreeType::GetGlyph(c32 c)
 {
 {
-    HashMap<unsigned, FontGlyph>::Iterator i = glyphMapping_.Find(c);
+    HashMap<c32, FontGlyph>::Iterator i = glyphMapping_.Find(c);
     if (i != glyphMapping_.End())
     if (i != glyphMapping_.End())
     {
     {
         FontGlyph& glyph = i->second_;
         FontGlyph& glyph = i->second_;
@@ -283,7 +283,7 @@ const FontGlyph* FontFaceFreeType::GetGlyph(unsigned c)
 
 
     if (LoadCharGlyph(c))
     if (LoadCharGlyph(c))
     {
     {
-        HashMap<unsigned, FontGlyph>::Iterator i = glyphMapping_.Find(c);
+        HashMap<c32, FontGlyph>::Iterator i = glyphMapping_.Find(c);
         if (i != glyphMapping_.End())
         if (i != glyphMapping_.End())
         {
         {
             FontGlyph& glyph = i->second_;
             FontGlyph& glyph = i->second_;
@@ -373,7 +373,7 @@ void FontFaceFreeType::BoxFilter(unsigned char* dest, size_t destSize, const uns
     }
     }
 }
 }
 
 
-bool FontFaceFreeType::LoadCharGlyph(unsigned charCode, Image* image)
+bool FontFaceFreeType::LoadCharGlyph(c32 charCode, Image* image)
 {
 {
     if (!face_)
     if (!face_)
         return false;
         return false;

+ 2 - 2
Source/Urho3D/UI/FontFaceFreeType.h

@@ -23,7 +23,7 @@ public:
     /// Load font face.
     /// Load font face.
     bool Load(const unsigned char* fontData, unsigned fontDataSize, float pointSize) override;
     bool Load(const unsigned char* fontData, unsigned fontDataSize, float pointSize) override;
     /// Return pointer to the glyph structure corresponding to a character. Return null if glyph not found.
     /// Return pointer to the glyph structure corresponding to a character. Return null if glyph not found.
-    const FontGlyph* GetGlyph(unsigned c) override;
+    const FontGlyph* GetGlyph(c32 c) override;
 
 
     /// Return if font face uses mutable glyphs.
     /// Return if font face uses mutable glyphs.
     bool HasMutableGlyphs() const override { return hasMutableGlyph_; }
     bool HasMutableGlyphs() const override { return hasMutableGlyph_; }
@@ -32,7 +32,7 @@ private:
     /// Setup next texture.
     /// Setup next texture.
     bool SetupNextTexture(int textureWidth, int textureHeight);
     bool SetupNextTexture(int textureWidth, int textureHeight);
     /// Load char glyph.
     /// Load char glyph.
-    bool LoadCharGlyph(unsigned charCode, Image* image = nullptr);
+    bool LoadCharGlyph(c32 charCode, Image* image = nullptr);
     /// Smooth one row of a horizontally oversampled glyph image.
     /// Smooth one row of a horizontally oversampled glyph image.
     void BoxFilter(unsigned char* dest, size_t destSize, const unsigned char* src, size_t srcSize);
     void BoxFilter(unsigned char* dest, size_t destSize, const unsigned char* src, size_t srcSize);
 
 

+ 4 - 4
Source/Urho3D/UI/LineEdit.cpp

@@ -65,7 +65,7 @@ void LineEdit::RegisterObject(Context* context)
     URHO3D_ACCESSOR_ATTRIBUTE("Is Text Selectable", IsTextSelectable, SetTextSelectable, bool, true, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Is Text Selectable", IsTextSelectable, SetTextSelectable, bool, true, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Is Text Copyable", IsTextCopyable, SetTextCopyable, bool, true, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Is Text Copyable", IsTextCopyable, SetTextCopyable, bool, true, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Cursor Blink Rate", GetCursorBlinkRate, SetCursorBlinkRate, float, 1.0f, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Cursor Blink Rate", GetCursorBlinkRate, SetCursorBlinkRate, float, 1.0f, AM_FILE);
-    URHO3D_ATTRIBUTE("Echo Character", int, echoCharacter_, 0, AM_FILE);
+    URHO3D_ATTRIBUTE("Echo Character", unsigned, echoCharacter_, 0, AM_FILE);
 }
 }
 
 
 void LineEdit::ApplyAttributes()
 void LineEdit::ApplyAttributes()
@@ -494,7 +494,7 @@ void LineEdit::SetMaxLength(unsigned length)
     maxLength_ = length;
     maxLength_ = length;
 }
 }
 
 
-void LineEdit::SetEchoCharacter(unsigned c)
+void LineEdit::SetEchoCharacter(c32 c)
 {
 {
     echoCharacter_ = c;
     echoCharacter_ = c;
     UpdateText();
     UpdateText();
@@ -545,7 +545,7 @@ bool LineEdit::FilterImplicitAttributes(XMLElement& dest) const
 
 
 void LineEdit::UpdateText()
 void LineEdit::UpdateText()
 {
 {
-    unsigned utf8Length = line_.LengthUTF8();
+    i32 utf8Length = line_.LengthUTF8();
 
 
     // If maxLength_ nonzero, truncate line to enforce length
     // If maxLength_ nonzero, truncate line to enforce length
     if (maxLength_ && utf8Length > maxLength_)
     if (maxLength_ && utf8Length > maxLength_)
@@ -561,7 +561,7 @@ void LineEdit::UpdateText()
     else
     else
     {
     {
         String echoText;
         String echoText;
-        for (unsigned i = 0; i < utf8Length; ++i)
+        for (i32 i = 0; i < utf8Length; ++i)
             echoText.AppendUTF8(echoCharacter_);
             echoText.AppendUTF8(echoCharacter_);
         text_->SetText(echoText);
         text_->SetText(echoText);
     }
     }

+ 3 - 3
Source/Urho3D/UI/LineEdit.h

@@ -65,7 +65,7 @@ public:
     void SetMaxLength(unsigned length);
     void SetMaxLength(unsigned length);
     /// Set echo character for password entry and such. 0 (default) shows the actual text.
     /// Set echo character for password entry and such. 0 (default) shows the actual text.
     /// @property
     /// @property
-    void SetEchoCharacter(unsigned c);
+    void SetEchoCharacter(c32 c);
     /// Set whether can move cursor with arrows or mouse, default true.
     /// Set whether can move cursor with arrows or mouse, default true.
     /// @property
     /// @property
     void SetCursorMovable(bool enable);
     void SetCursorMovable(bool enable);
@@ -94,7 +94,7 @@ public:
 
 
     /// Return echo character.
     /// Return echo character.
     /// @property
     /// @property
-    unsigned GetEchoCharacter() const { return echoCharacter_; }
+    c32 GetEchoCharacter() const { return echoCharacter_; }
 
 
     /// Return whether can move cursor with arrows or mouse.
     /// Return whether can move cursor with arrows or mouse.
     /// @property
     /// @property
@@ -147,7 +147,7 @@ protected:
     /// Maximum text length.
     /// Maximum text length.
     unsigned maxLength_;
     unsigned maxLength_;
     /// Echo character.
     /// Echo character.
-    unsigned echoCharacter_;
+    c32 echoCharacter_;
     /// Cursor movable flag.
     /// Cursor movable flag.
     bool cursorMovable_;
     bool cursorMovable_;
     /// Text selectable flag.
     /// Text selectable flag.

+ 3 - 3
Source/Urho3D/UI/Text.cpp

@@ -501,7 +501,7 @@ void Text::UpdateText(bool onResize)
             for (unsigned i = 0; i < unicodeText_.Size(); ++i)
             for (unsigned i = 0; i < unicodeText_.Size(); ++i)
             {
             {
                 unsigned j;
                 unsigned j;
-                unsigned c = unicodeText_[i];
+                u32 c = unicodeText_[i];
 
 
                 if (c != '\n')
                 if (c != '\n')
                 {
                 {
@@ -594,7 +594,7 @@ void Text::UpdateText(bool onResize)
 
 
         for (unsigned i = 0; i < printText_.Size(); ++i)
         for (unsigned i = 0; i < printText_.Size(); ++i)
         {
         {
-            unsigned c = printText_[i];
+            c32 c = printText_[i];
 
 
             if (c != '\n')
             if (c != '\n')
             {
             {
@@ -686,7 +686,7 @@ void Text::UpdateCharLocations()
         CharLocation loc;
         CharLocation loc;
         loc.position_ = Vector2(x, y);
         loc.position_ = Vector2(x, y);
 
 
-        unsigned c = printText_[i];
+        c32 c = printText_[i];
         if (c != '\n')
         if (c != '\n')
         {
         {
             const FontGlyph* glyph = face->GetGlyph(c);
             const FontGlyph* glyph = face->GetGlyph(c);

+ 2 - 2
Source/Urho3D/UI/Text.h

@@ -267,9 +267,9 @@ protected:
     /// Row height.
     /// Row height.
     float rowHeight_;
     float rowHeight_;
     /// Text as Unicode characters.
     /// Text as Unicode characters.
-    PODVector<unsigned> unicodeText_;
+    PODVector<c32> unicodeText_;
     /// Text modified into printed form.
     /// Text modified into printed form.
-    PODVector<unsigned> printText_;
+    PODVector<c32> printText_;
     /// Mapping of printed form back to original char indices.
     /// Mapping of printed form back to original char indices.
     PODVector<unsigned> printToText_;
     PODVector<unsigned> printToText_;
     /// Row widths.
     /// Row widths.