From 7b530100b0a4d96e88ff6dc340bbe94b1bc0c9af Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Mon, 5 Jan 2026 12:03:38 +0000 Subject: [PATCH 1/5] [ci] Hardcode latest haxe version for setup-haxe This avoids the invalid url error caused by relative redirect of the "latest" file. --- .github/workflows/setup/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/setup/action.yml b/.github/workflows/setup/action.yml index c5e4d60ed..2bf232b35 100644 --- a/.github/workflows/setup/action.yml +++ b/.github/workflows/setup/action.yml @@ -9,7 +9,7 @@ runs: - name: install haxe uses: Aidan63/setup-haxe@3d3101bcd0a2001699fc8295f4d9eddd0724d3e9 with: - haxe-version: ${{ inputs.haxe }} + haxe-version: ${{ inputs.haxe == 'latest' && '2026-01-05_development_3aed86e' || inputs.haxe }} - name: install haxe libraries shell: pwsh @@ -34,4 +34,4 @@ runs: - name: build hxcpp working-directory: tools/hxcpp shell: pwsh - run: haxe compile.hxml \ No newline at end of file + run: haxe compile.hxml From 052ce40a16e99f3a6dacdbace932bafbb5ada384 Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Mon, 5 Jan 2026 18:57:05 +0000 Subject: [PATCH 2/5] Apply Aidan's patch for encoding errors --- include/cpp/encoding/Utf16.hpp | 3 +++ include/cpp/encoding/Utf8.hpp | 3 +++ include/null.h | 5 ++++- src/Dynamic.cpp | 1 + src/cpp/encoding/Utf16.cpp | 17 ++++++++++++++++- src/cpp/encoding/Utf8.cpp | 17 ++++++++++++++++- 6 files changed, 43 insertions(+), 3 deletions(-) diff --git a/include/cpp/encoding/Utf16.hpp b/include/cpp/encoding/Utf16.hpp index 992c0635d..e24415ac7 100644 --- a/include/cpp/encoding/Utf16.hpp +++ b/include/cpp/encoding/Utf16.hpp @@ -8,12 +8,15 @@ namespace cpp { static bool isEncoded(const String& string); + static int getByteCount(const null& _); static int getByteCount(const char32_t& codepoint); static int64_t getByteCount(const String& string); + static int getCharCount(const null& _); static int getCharCount(const char32_t& codepoint); static int64_t getCharCount(const String& string); + static int encode(const null& _, const cpp::marshal::View& buffer); static int encode(const char32_t& codepoint, const cpp::marshal::View& buffer); static int64_t encode(const String& string, const cpp::marshal::View& buffer); diff --git a/include/cpp/encoding/Utf8.hpp b/include/cpp/encoding/Utf8.hpp index 11497a692..ddaa17489 100644 --- a/include/cpp/encoding/Utf8.hpp +++ b/include/cpp/encoding/Utf8.hpp @@ -6,12 +6,15 @@ namespace cpp { struct Utf8 final { + static int getByteCount(const null& _); static int getByteCount(const char32_t& codepoint); static int64_t getByteCount(const String& string); + static int getCharCount(const null& _); static int getCharCount(const char32_t& codepoint); static int64_t getCharCount(const String& string); + static int encode(const null& _, const cpp::marshal::View& buffer); static int encode(const char32_t& codepoint, const cpp::marshal::View& buffer); static int64_t encode(const String& string, const cpp::marshal::View& buffer); diff --git a/include/null.h b/include/null.h index d01f97ad8..98dd40a8b 100644 --- a/include/null.h +++ b/include/null.h @@ -91,6 +91,7 @@ class null operator unsigned char () { return 0; } operator signed char () { return 0; } operator char16_t () { return 0; } + operator char32_t () { return 0; } operator short () { return 0; } operator unsigned short () { return 0; } operator cpp::UInt64 () { return 0; } @@ -145,7 +146,8 @@ class null HX_NULL_COMPARE_OPS(unsigned short) HX_NULL_COMPARE_OPS(signed char) HX_NULL_COMPARE_OPS(unsigned char) - HX_NULL_COMPARE_OPS(char16_t) + HX_NULL_COMPARE_OPS(char16_t) + HX_NULL_COMPARE_OPS(char32_t) HX_NULL_COMPARE_OPS(cpp::Int64) HX_NULL_COMPARE_OPS(cpp::UInt64) HX_NULL_COMPARE_MOST_OPS(String) @@ -215,6 +217,7 @@ HX_COMPARE_NULL_OPS(unsigned short) HX_COMPARE_NULL_OPS(signed char) HX_COMPARE_NULL_OPS(unsigned char) HX_COMPARE_NULL_OPS(char16_t) +HX_COMPARE_NULL_OPS(char32_t) HX_COMPARE_NULL_OPS(cpp::UInt64) HX_COMPARE_NULL_OPS(cpp::Int64) diff --git a/src/Dynamic.cpp b/src/Dynamic.cpp index 1e3631b8f..0f6514740 100644 --- a/src/Dynamic.cpp +++ b/src/Dynamic.cpp @@ -502,6 +502,7 @@ DYN_OP_ADD(unsigned short) DYN_OP_ADD(signed char) DYN_OP_ADD(unsigned char) DYN_OP_ADD(char16_t) +DYN_OP_ADD(char32_t) DYN_OP_ADD(cpp::Int64) DYN_OP_ADD(cpp::UInt64) diff --git a/src/cpp/encoding/Utf16.cpp b/src/cpp/encoding/Utf16.cpp index f3b595a09..e86e9cbf1 100644 --- a/src/cpp/encoding/Utf16.cpp +++ b/src/cpp/encoding/Utf16.cpp @@ -68,6 +68,11 @@ bool cpp::encoding::Utf16::isEncoded(const String& string) return string.isUTF16Encoded(); } +int cpp::encoding::Utf16::getByteCount(const null& _) +{ + hx::NullReference("String", false); +} + int cpp::encoding::Utf16::getByteCount(const char32_t& codepoint) { return codepoint <= 0xFFFF ? 2 : 4; @@ -96,6 +101,11 @@ int64_t cpp::encoding::Utf16::getByteCount(const String& string) } } +int cpp::encoding::Utf16::getCharCount(const null& _) +{ + hx::NullReference("String", false); +} + int cpp::encoding::Utf16::getCharCount(const char32_t& codepoint) { return getByteCount(codepoint) / sizeof(char16_t); @@ -106,6 +116,11 @@ int64_t cpp::encoding::Utf16::getCharCount(const String& string) return getByteCount(string) / sizeof(char16_t); } +int cpp::encoding::Utf16::encode(const null& _, const cpp::marshal::View& buffer) +{ + hx::NullReference("String", false); +} + int64_t cpp::encoding::Utf16::encode(const String& string, const cpp::marshal::View& buffer) { if (null() == string) @@ -258,4 +273,4 @@ char32_t cpp::encoding::Utf16::codepoint(const cpp::marshal::View& buff { return static_cast(first); } -} \ No newline at end of file +} diff --git a/src/cpp/encoding/Utf8.cpp b/src/cpp/encoding/Utf8.cpp index b6b7c4eb5..f4896aedc 100644 --- a/src/cpp/encoding/Utf8.cpp +++ b/src/cpp/encoding/Utf8.cpp @@ -24,6 +24,11 @@ namespace } } +int cpp::encoding::Utf8::getByteCount(const null& _) +{ + hx::NullReference("String", false); +} + int cpp::encoding::Utf8::getByteCount(const char32_t& codepoint) { if (codepoint <= 0x7F) @@ -77,6 +82,11 @@ int64_t cpp::encoding::Utf8::getByteCount(const String& string) #endif } +int cpp::encoding::Utf8::getCharCount(const null& _) +{ + hx::NullReference("String", false); +} + int cpp::encoding::Utf8::getCharCount(const char32_t& codepoint) { return getByteCount(codepoint) / sizeof(char); @@ -87,6 +97,11 @@ int64_t cpp::encoding::Utf8::getCharCount(const String& string) return getByteCount(string) / sizeof(char); } +int cpp::encoding::Utf8::encode(const null& _, const cpp::marshal::View& buffer) +{ + hx::NullReference("String", false); +} + int64_t cpp::encoding::Utf8::encode(const String& string, const cpp::marshal::View& buffer) { if (null() == string) @@ -282,4 +297,4 @@ char32_t cpp::encoding::Utf8::codepoint(const cpp::marshal::View& buffe { return int{ hx::Throw(HX_CSTRING("Failed to read codepoint")) }; } -} \ No newline at end of file +} From c931ac574c414ff658c5fd0f7a143e51af61b48c Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Mon, 5 Jan 2026 18:58:10 +0000 Subject: [PATCH 3/5] Avoid warnings from string encoding code --- src/cpp/encoding/Utf16.cpp | 3 +++ src/cpp/encoding/Utf8.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/cpp/encoding/Utf16.cpp b/src/cpp/encoding/Utf16.cpp index e86e9cbf1..97c634dbb 100644 --- a/src/cpp/encoding/Utf16.cpp +++ b/src/cpp/encoding/Utf16.cpp @@ -71,6 +71,7 @@ bool cpp::encoding::Utf16::isEncoded(const String& string) int cpp::encoding::Utf16::getByteCount(const null& _) { hx::NullReference("String", false); + return 0; } int cpp::encoding::Utf16::getByteCount(const char32_t& codepoint) @@ -104,6 +105,7 @@ int64_t cpp::encoding::Utf16::getByteCount(const String& string) int cpp::encoding::Utf16::getCharCount(const null& _) { hx::NullReference("String", false); + return 0; } int cpp::encoding::Utf16::getCharCount(const char32_t& codepoint) @@ -119,6 +121,7 @@ int64_t cpp::encoding::Utf16::getCharCount(const String& string) int cpp::encoding::Utf16::encode(const null& _, const cpp::marshal::View& buffer) { hx::NullReference("String", false); + return 0; } int64_t cpp::encoding::Utf16::encode(const String& string, const cpp::marshal::View& buffer) diff --git a/src/cpp/encoding/Utf8.cpp b/src/cpp/encoding/Utf8.cpp index f4896aedc..82fb6f19b 100644 --- a/src/cpp/encoding/Utf8.cpp +++ b/src/cpp/encoding/Utf8.cpp @@ -27,6 +27,7 @@ namespace int cpp::encoding::Utf8::getByteCount(const null& _) { hx::NullReference("String", false); + return 0; } int cpp::encoding::Utf8::getByteCount(const char32_t& codepoint) @@ -85,6 +86,7 @@ int64_t cpp::encoding::Utf8::getByteCount(const String& string) int cpp::encoding::Utf8::getCharCount(const null& _) { hx::NullReference("String", false); + return 0; } int cpp::encoding::Utf8::getCharCount(const char32_t& codepoint) @@ -100,6 +102,7 @@ int64_t cpp::encoding::Utf8::getCharCount(const String& string) int cpp::encoding::Utf8::encode(const null& _, const cpp::marshal::View& buffer) { hx::NullReference("String", false); + return 0; } int64_t cpp::encoding::Utf8::encode(const String& string, const cpp::marshal::View& buffer) From ba3c29f7486aa4eef02425b6c495c0ccae503d5d Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Tue, 6 Jan 2026 13:33:29 +0000 Subject: [PATCH 4/5] [ci] Switch to patched setup-haxe version --- .github/workflows/setup/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/setup/action.yml b/.github/workflows/setup/action.yml index 2bf232b35..49905937e 100644 --- a/.github/workflows/setup/action.yml +++ b/.github/workflows/setup/action.yml @@ -7,9 +7,9 @@ runs: using: composite steps: - name: install haxe - uses: Aidan63/setup-haxe@3d3101bcd0a2001699fc8295f4d9eddd0724d3e9 + uses: krdlab/setup-haxe@hotfix/download-failure with: - haxe-version: ${{ inputs.haxe == 'latest' && '2026-01-05_development_3aed86e' || inputs.haxe }} + haxe-version: ${{ inputs.haxe }} - name: install haxe libraries shell: pwsh From ce80c273a84e5d04c61ac40ef53a7cbf84d1d29c Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Tue, 6 Jan 2026 14:30:44 +0000 Subject: [PATCH 5/5] Omit name for unusued null arguments --- include/cpp/encoding/Utf16.hpp | 8 ++++---- include/cpp/encoding/Utf8.hpp | 8 ++++---- src/cpp/encoding/Utf16.cpp | 6 +++--- src/cpp/encoding/Utf8.cpp | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/cpp/encoding/Utf16.hpp b/include/cpp/encoding/Utf16.hpp index e24415ac7..ae2aacf31 100644 --- a/include/cpp/encoding/Utf16.hpp +++ b/include/cpp/encoding/Utf16.hpp @@ -8,15 +8,15 @@ namespace cpp { static bool isEncoded(const String& string); - static int getByteCount(const null& _); + static int getByteCount(const null&); static int getByteCount(const char32_t& codepoint); static int64_t getByteCount(const String& string); - static int getCharCount(const null& _); + static int getCharCount(const null&); static int getCharCount(const char32_t& codepoint); static int64_t getCharCount(const String& string); - static int encode(const null& _, const cpp::marshal::View& buffer); + static int encode(const null&, const cpp::marshal::View& buffer); static int encode(const char32_t& codepoint, const cpp::marshal::View& buffer); static int64_t encode(const String& string, const cpp::marshal::View& buffer); @@ -24,4 +24,4 @@ namespace cpp static String decode(const cpp::marshal::View& buffer); }; } -} \ No newline at end of file +} diff --git a/include/cpp/encoding/Utf8.hpp b/include/cpp/encoding/Utf8.hpp index ddaa17489..9636b8b51 100644 --- a/include/cpp/encoding/Utf8.hpp +++ b/include/cpp/encoding/Utf8.hpp @@ -6,15 +6,15 @@ namespace cpp { struct Utf8 final { - static int getByteCount(const null& _); + static int getByteCount(const null&); static int getByteCount(const char32_t& codepoint); static int64_t getByteCount(const String& string); - static int getCharCount(const null& _); + static int getCharCount(const null&); static int getCharCount(const char32_t& codepoint); static int64_t getCharCount(const String& string); - static int encode(const null& _, const cpp::marshal::View& buffer); + static int encode(const null&, const cpp::marshal::View& buffer); static int encode(const char32_t& codepoint, const cpp::marshal::View& buffer); static int64_t encode(const String& string, const cpp::marshal::View& buffer); @@ -22,4 +22,4 @@ namespace cpp static String decode(const cpp::marshal::View& buffer); }; } -} \ No newline at end of file +} diff --git a/src/cpp/encoding/Utf16.cpp b/src/cpp/encoding/Utf16.cpp index 97c634dbb..930513259 100644 --- a/src/cpp/encoding/Utf16.cpp +++ b/src/cpp/encoding/Utf16.cpp @@ -68,7 +68,7 @@ bool cpp::encoding::Utf16::isEncoded(const String& string) return string.isUTF16Encoded(); } -int cpp::encoding::Utf16::getByteCount(const null& _) +int cpp::encoding::Utf16::getByteCount(const null&) { hx::NullReference("String", false); return 0; @@ -102,7 +102,7 @@ int64_t cpp::encoding::Utf16::getByteCount(const String& string) } } -int cpp::encoding::Utf16::getCharCount(const null& _) +int cpp::encoding::Utf16::getCharCount(const null&) { hx::NullReference("String", false); return 0; @@ -118,7 +118,7 @@ int64_t cpp::encoding::Utf16::getCharCount(const String& string) return getByteCount(string) / sizeof(char16_t); } -int cpp::encoding::Utf16::encode(const null& _, const cpp::marshal::View& buffer) +int cpp::encoding::Utf16::encode(const null&, const cpp::marshal::View& buffer) { hx::NullReference("String", false); return 0; diff --git a/src/cpp/encoding/Utf8.cpp b/src/cpp/encoding/Utf8.cpp index 82fb6f19b..6ff51af96 100644 --- a/src/cpp/encoding/Utf8.cpp +++ b/src/cpp/encoding/Utf8.cpp @@ -24,7 +24,7 @@ namespace } } -int cpp::encoding::Utf8::getByteCount(const null& _) +int cpp::encoding::Utf8::getByteCount(const null&) { hx::NullReference("String", false); return 0; @@ -83,7 +83,7 @@ int64_t cpp::encoding::Utf8::getByteCount(const String& string) #endif } -int cpp::encoding::Utf8::getCharCount(const null& _) +int cpp::encoding::Utf8::getCharCount(const null&) { hx::NullReference("String", false); return 0; @@ -99,7 +99,7 @@ int64_t cpp::encoding::Utf8::getCharCount(const String& string) return getByteCount(string) / sizeof(char); } -int cpp::encoding::Utf8::encode(const null& _, const cpp::marshal::View& buffer) +int cpp::encoding::Utf8::encode(const null&, const cpp::marshal::View& buffer) { hx::NullReference("String", false); return 0;