Skip to content

Commit 26a23b4

Browse files
authored
[ci] Switch to patched setup-haxe version (#1286)
* [ci] Hardcode latest haxe version for setup-haxe This avoids the invalid url error caused by relative redirect of the "latest" file. * Apply Aidan's patch for encoding errors * Avoid warnings from string encoding code * [ci] Switch to patched setup-haxe version * Omit name for unusued null arguments
1 parent 4cff17a commit 26a23b4

File tree

7 files changed

+53
-7
lines changed

7 files changed

+53
-7
lines changed

.github/workflows/setup/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ runs:
77
using: composite
88
steps:
99
- name: install haxe
10-
uses: Aidan63/setup-haxe@3d3101bcd0a2001699fc8295f4d9eddd0724d3e9
10+
uses: krdlab/setup-haxe@hotfix/download-failure
1111
with:
1212
haxe-version: ${{ inputs.haxe }}
1313

@@ -34,4 +34,4 @@ runs:
3434
- name: build hxcpp
3535
working-directory: tools/hxcpp
3636
shell: pwsh
37-
run: haxe compile.hxml
37+
run: haxe compile.hxml

include/cpp/encoding/Utf16.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ namespace cpp
88
{
99
static bool isEncoded(const String& string);
1010

11+
static int getByteCount(const null&);
1112
static int getByteCount(const char32_t& codepoint);
1213
static int64_t getByteCount(const String& string);
1314

15+
static int getCharCount(const null&);
1416
static int getCharCount(const char32_t& codepoint);
1517
static int64_t getCharCount(const String& string);
1618

19+
static int encode(const null&, const cpp::marshal::View<uint8_t>& buffer);
1720
static int encode(const char32_t& codepoint, const cpp::marshal::View<uint8_t>& buffer);
1821
static int64_t encode(const String& string, const cpp::marshal::View<uint8_t>& buffer);
1922

2023
static char32_t codepoint(const cpp::marshal::View<uint8_t>& buffer);
2124
static String decode(const cpp::marshal::View<uint8_t>& buffer);
2225
};
2326
}
24-
}
27+
}

include/cpp/encoding/Utf8.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ namespace cpp
66
{
77
struct Utf8 final
88
{
9+
static int getByteCount(const null&);
910
static int getByteCount(const char32_t& codepoint);
1011
static int64_t getByteCount(const String& string);
1112

13+
static int getCharCount(const null&);
1214
static int getCharCount(const char32_t& codepoint);
1315
static int64_t getCharCount(const String& string);
1416

17+
static int encode(const null&, const cpp::marshal::View<uint8_t>& buffer);
1518
static int encode(const char32_t& codepoint, const cpp::marshal::View<uint8_t>& buffer);
1619
static int64_t encode(const String& string, const cpp::marshal::View<uint8_t>& buffer);
1720

1821
static char32_t codepoint(const cpp::marshal::View<uint8_t>& buffer);
1922
static String decode(const cpp::marshal::View<uint8_t>& buffer);
2023
};
2124
}
22-
}
25+
}

include/null.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class null
9191
operator unsigned char () { return 0; }
9292
operator signed char () { return 0; }
9393
operator char16_t () { return 0; }
94+
operator char32_t () { return 0; }
9495
operator short () { return 0; }
9596
operator unsigned short () { return 0; }
9697
operator cpp::UInt64 () { return 0; }
@@ -145,7 +146,8 @@ class null
145146
HX_NULL_COMPARE_OPS(unsigned short)
146147
HX_NULL_COMPARE_OPS(signed char)
147148
HX_NULL_COMPARE_OPS(unsigned char)
148-
HX_NULL_COMPARE_OPS(char16_t)
149+
HX_NULL_COMPARE_OPS(char16_t)
150+
HX_NULL_COMPARE_OPS(char32_t)
149151
HX_NULL_COMPARE_OPS(cpp::Int64)
150152
HX_NULL_COMPARE_OPS(cpp::UInt64)
151153
HX_NULL_COMPARE_MOST_OPS(String)
@@ -215,6 +217,7 @@ HX_COMPARE_NULL_OPS(unsigned short)
215217
HX_COMPARE_NULL_OPS(signed char)
216218
HX_COMPARE_NULL_OPS(unsigned char)
217219
HX_COMPARE_NULL_OPS(char16_t)
220+
HX_COMPARE_NULL_OPS(char32_t)
218221
HX_COMPARE_NULL_OPS(cpp::UInt64)
219222
HX_COMPARE_NULL_OPS(cpp::Int64)
220223

src/Dynamic.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ DYN_OP_ADD(unsigned short)
502502
DYN_OP_ADD(signed char)
503503
DYN_OP_ADD(unsigned char)
504504
DYN_OP_ADD(char16_t)
505+
DYN_OP_ADD(char32_t)
505506
DYN_OP_ADD(cpp::Int64)
506507
DYN_OP_ADD(cpp::UInt64)
507508

src/cpp/encoding/Utf16.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ bool cpp::encoding::Utf16::isEncoded(const String& string)
6868
return string.isUTF16Encoded();
6969
}
7070

71+
int cpp::encoding::Utf16::getByteCount(const null&)
72+
{
73+
hx::NullReference("String", false);
74+
return 0;
75+
}
76+
7177
int cpp::encoding::Utf16::getByteCount(const char32_t& codepoint)
7278
{
7379
return codepoint <= 0xFFFF ? 2 : 4;
@@ -96,6 +102,12 @@ int64_t cpp::encoding::Utf16::getByteCount(const String& string)
96102
}
97103
}
98104

105+
int cpp::encoding::Utf16::getCharCount(const null&)
106+
{
107+
hx::NullReference("String", false);
108+
return 0;
109+
}
110+
99111
int cpp::encoding::Utf16::getCharCount(const char32_t& codepoint)
100112
{
101113
return getByteCount(codepoint) / sizeof(char16_t);
@@ -106,6 +118,12 @@ int64_t cpp::encoding::Utf16::getCharCount(const String& string)
106118
return getByteCount(string) / sizeof(char16_t);
107119
}
108120

121+
int cpp::encoding::Utf16::encode(const null&, const cpp::marshal::View<uint8_t>& buffer)
122+
{
123+
hx::NullReference("String", false);
124+
return 0;
125+
}
126+
109127
int64_t cpp::encoding::Utf16::encode(const String& string, const cpp::marshal::View<uint8_t>& buffer)
110128
{
111129
if (null() == string)
@@ -258,4 +276,4 @@ char32_t cpp::encoding::Utf16::codepoint(const cpp::marshal::View<uint8_t>& buff
258276
{
259277
return static_cast<char32_t>(first);
260278
}
261-
}
279+
}

src/cpp/encoding/Utf8.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ namespace
2424
}
2525
}
2626

27+
int cpp::encoding::Utf8::getByteCount(const null&)
28+
{
29+
hx::NullReference("String", false);
30+
return 0;
31+
}
32+
2733
int cpp::encoding::Utf8::getByteCount(const char32_t& codepoint)
2834
{
2935
if (codepoint <= 0x7F)
@@ -77,6 +83,12 @@ int64_t cpp::encoding::Utf8::getByteCount(const String& string)
7783
#endif
7884
}
7985

86+
int cpp::encoding::Utf8::getCharCount(const null&)
87+
{
88+
hx::NullReference("String", false);
89+
return 0;
90+
}
91+
8092
int cpp::encoding::Utf8::getCharCount(const char32_t& codepoint)
8193
{
8294
return getByteCount(codepoint) / sizeof(char);
@@ -87,6 +99,12 @@ int64_t cpp::encoding::Utf8::getCharCount(const String& string)
8799
return getByteCount(string) / sizeof(char);
88100
}
89101

102+
int cpp::encoding::Utf8::encode(const null&, const cpp::marshal::View<uint8_t>& buffer)
103+
{
104+
hx::NullReference("String", false);
105+
return 0;
106+
}
107+
90108
int64_t cpp::encoding::Utf8::encode(const String& string, const cpp::marshal::View<uint8_t>& buffer)
91109
{
92110
if (null() == string)
@@ -282,4 +300,4 @@ char32_t cpp::encoding::Utf8::codepoint(const cpp::marshal::View<uint8_t>& buffe
282300
{
283301
return int{ hx::Throw(HX_CSTRING("Failed to read codepoint")) };
284302
}
285-
}
303+
}

0 commit comments

Comments
 (0)