Skip to content

Commit db15031

Browse files
committed
Revert "Merge pull request livecode#6046 from runrevmark/bugfix-20504"
This reverts commit d8e24fa, reversing changes made to 5ca0f9d.
1 parent e81322e commit db15031

File tree

5 files changed

+22
-69
lines changed

5 files changed

+22
-69
lines changed

docs/notes/bugfix-20504.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

libcpptest/libcpptest.gyp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
'GTEST_HAS_PTHREAD=0',
4545
'GTEST_HAS_RTTI=0',
4646
'GTEST_HAS_EXCEPTIONS=0',
47-
'GTEST_LANG_CXX11=0',
4847
],
4948

5049
'all_dependent_settings':
@@ -55,7 +54,6 @@
5554
'GTEST_HAS_PTHREAD=0',
5655
'GTEST_HAS_RTTI=0',
5756
'GTEST_HAS_EXCEPTIONS=0',
58-
'GTEST_LANG_CXX11=0',
5957
],
6058

6159
'include_dirs':

libfoundation/src/foundation-string.cpp

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6088,6 +6088,9 @@ static void __MCStringSetFlags(MCStringRef self, uindex_t basic, uindex_t trivia
60886088
if (native == kMCStringFlagSetTrue)
60896089
{
60906090
self -> flags |= kMCStringFlagCanBeNative;
6091+
self -> flags |= kMCStringFlagIsTrivial;
6092+
self -> flags |= kMCStringFlagIsBasic;
6093+
return;
60916094
}
60926095
else if (native == kMCStringFlagSetFalse)
60936096
{
@@ -6103,6 +6106,7 @@ static void __MCStringSetFlags(MCStringRef self, uindex_t basic, uindex_t trivia
61036106
else if (trivial == kMCStringFlagSetFalse)
61046107
{
61056108
self -> flags &= ~kMCStringFlagIsTrivial;
6109+
self -> flags &= ~kMCStringFlagCanBeNative;
61066110
}
61076111

61086112
if (basic == kMCStringFlagSetTrue)
@@ -6823,54 +6827,37 @@ static void __MCStringCheck(MCStringRef self)
68236827
if (__MCStringCanBeNative(self))
68246828
return;
68256829

6826-
bool t_can_be_native, t_is_trivial, t_is_basic;
6830+
bool t_can_be_native;
68276831
t_can_be_native = true;
6828-
t_is_trivial = true;
6829-
t_is_basic = true;
68306832

68316833
for (uindex_t i = 0; i < self -> char_count; i++)
68326834
{
68336835
if (MCStringIsValidSurrogatePair(self, i))
68346836
{
68356837
__MCStringSetFlags(self, false, false, false);
68366838
t_can_be_native = false;
6837-
t_is_trivial = false;
6838-
t_is_basic = false;
68396839
break;
68406840
}
68416841

68426842
if (!MCUnicodeIsGraphemeClusterBoundary(self -> chars[i], self -> chars[i + 1]))
68436843
{
6844-
/* There is no boundary between i and i+1, so check that the pair of
6845-
* codeunits won't map to native (e.g. e,acute).
6846-
* If they do map to native, check that there is a boundary after
6847-
* the second codeunit - otherwise it is more than 2 cu sequence which
6848-
* cannot be native. */
6849-
char_t t_native_char;
6850-
if (!MCUnicodeMapToNative(self->chars+i, 2, t_native_char) ||
6851-
(i+1 < self->char_count &&
6852-
!MCUnicodeIsGraphemeClusterBoundary(self->chars[i+1], self->chars[i+2])))
6853-
{
6854-
t_can_be_native = false;
6855-
}
6856-
6857-
t_is_trivial = false;
6858-
6859-
/* At this point i is the first codeunit of a 2-codeunit combining
6860-
* sequence which maps to a native, so we can skip the combiner. */
6861-
i++;
6862-
6863-
continue;
6844+
__MCStringSetFlags(self, kMCStringFlagNoChange, false, false);
6845+
t_can_be_native = false;
6846+
break;
68646847
}
68656848

68666849
char_t t_native;
68676850
if (!MCUnicodeCharMapToNative(self -> chars[i], t_native))
68686851
{
68696852
t_can_be_native = false;
6853+
break;
68706854
}
68716855
}
68726856

6873-
__MCStringSetFlags(self, t_is_basic, t_is_trivial, t_can_be_native);
6857+
if (t_can_be_native)
6858+
{
6859+
__MCStringSetFlags(self, true, true, true);
6860+
}
68746861

68756862
self -> flags |= kMCStringFlagIsChecked;
68766863
}

libfoundation/src/foundation-unicode.cpp

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,27 +1743,15 @@ bool MCUnicodeMapToNativePair_MacRoman(uinteger_t x, uinteger_t y, char_t& r_cha
17431743

17441744
bool MCUnicodeMapToNativePair_ISO8859_1(uinteger_t x, uinteger_t y, char_t& r_char)
17451745
{
1746-
static const uinteger_t s_pairs[] =
1747-
{
1748-
/* A */ 0xC0410300, 0xC1410301, 0xC2410302, 0xC3410303, 0xC4410308, 0xC541030A,
1749-
/* C */ 0xC7430327,
1750-
/* E */ 0xC8450300, 0xC9450301, 0xCA450302, 0xCB450308,
1751-
/* I */ 0xCC490300, 0xCD490301, 0xCE490302, 0xCF490308,
1752-
/* N */ 0xD14E0303,
1753-
/* O */ 0xD24F0300, 0xD34F0301, 0xD44F0302, 0xD54F0303, 0xD64F0308,
1754-
/* U */ 0xD9550300, 0xDA550301, 0xDB550302, 0xDC550308,
1755-
/* Y */ 0xDD590301,
1756-
1757-
/* a */ 0xE0610300, 0xE1610301, 0xE2610302, 0xE3610303, 0xE4610308, 0xE561030A,
1758-
/* c */ 0xE7630327,
1759-
/* e */ 0xE8650300, 0xE9650301, 0xEA650302, 0xEB650308,
1760-
/* i */ 0xEC690300, 0xED690301, 0xEE690302, 0xEF690308,
1761-
/* n */ 0xF16E0303,
1762-
/* i */ 0xF26F0300, 0xF36F0301, 0xF46F0302, 0xF56F0303, 0xF66F0308,
1763-
/* u */ 0xF9750300, 0xFA750301, 0xFB750302, 0xFC750308,
1764-
/* y */ 0xFD790301, 0xFF790308,
1765-
};
1766-
1746+
static const uinteger_t s_pairs[] =
1747+
{
1748+
/* S */ 0xA653030C,
1749+
/* Y */ 0xBE590308,
1750+
/* Z */ 0x8E5A030C,
1751+
/* s */ 0xA873030C,
1752+
/* z */ 0xB87A030C
1753+
};
1754+
17671755
uinteger_t z;
17681756
z = (x << 16) | y;
17691757

libfoundation/test/test_string.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -174,22 +174,3 @@ TEST(string, surrogate_unicode_props)
174174
const int kSPUA_B_Upper = 0x10FFFD + 1; // non-inclusive
175175
check_bidi_of_surrogate_range(kSPUA_B_Lower, kSPUA_B_Upper);
176176
}
177-
178-
TEST(string, normalize_compare)
179-
{
180-
static unichar_t s_decomposed_string[7] = { 0x65, 0x301, 0x65, 0x301, 0x65, 0x301, 0x0 };
181-
static unichar_t s_composed_string[4] = { 0xE9, 0xE9, 0xE9, 0x0 };
182-
183-
MCAutoStringRef t_decomposed;
184-
MCStringCreateWithWString(s_decomposed_string, &t_decomposed);
185-
186-
MCAutoStringRef t_composed;
187-
MCStringCreateWithWString(s_composed_string, &t_composed);
188-
189-
ASSERT_TRUE(MCStringIsEqualTo(*t_decomposed, *t_composed, kMCStringOptionCompareCaseless));
190-
191-
MCRange t_range;
192-
MCStringMapGraphemeIndices(*t_decomposed, MCRangeMake(0, 1), t_range);
193-
194-
ASSERT_TRUE(MCStringIsEqualTo(*t_decomposed, *t_composed, kMCStringOptionCompareCaseless));
195-
}

0 commit comments

Comments
 (0)