Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 5deb2cd

Browse files
committed
[[ Bug 19045 ]] Make sure test compiles on windows
This patch removes the use of a dynamic stack allocated array which the version of MSVC we use does not support.
1 parent 437dc69 commit 5deb2cd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

libfoundation/test/test_string.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,16 @@ static void check_bidi_of_surrogate_range(int p_lower, int p_upper)
143143
{
144144
int t_size = p_upper - p_lower;
145145

146-
unichar_t t_pua_chars[t_size * 2];
146+
MCAutoArray<unichar_t> t_pua_chars;
147+
ASSERT_TRUE(t_pua_chars.Resize(t_size * 2));
147148
for(int i = 0; i < t_size; i++)
148149
{
149-
MCUnicodeCodepointToSurrogates(i + p_lower, t_pua_chars + i * 2);
150+
MCUnicodeCodepointToSurrogates(i + p_lower, t_pua_chars.Ptr() + i * 2);
150151
}
151152

152-
uint8_t t_props[t_size];
153-
MCUnicodeGetProperty(t_pua_chars, t_size, kMCUnicodePropertyBidiClass, kMCUnicodePropertyTypeUint8, t_props);
153+
MCAutoArray<uint8_t> t_props;
154+
ASSERT_TRUE(t_props.Resize(t_size));
155+
MCUnicodeGetProperty(t_pua_chars.Ptr(), t_size, kMCUnicodePropertyBidiClass, kMCUnicodePropertyTypeUint8, t_props.Ptr());
154156

155157
for(int i = 0; i < t_size; i++)
156158
{
@@ -167,7 +169,7 @@ TEST(string, surrogate_unicode_props)
167169
const int kSPUA_A_Lower = 0xF0000;
168170
const int kSPUA_A_Upper = 0xFFFFD + 1; // non-inclusive
169171
check_bidi_of_surrogate_range(kSPUA_A_Lower, kSPUA_A_Upper);
170-
172+
171173
const int kSPUA_B_Lower = 0x100000;
172174
const int kSPUA_B_Upper = 0x10FFFD + 1; // non-inclusive
173175
check_bidi_of_surrogate_range(kSPUA_B_Lower, kSPUA_B_Upper);

0 commit comments

Comments
 (0)