History

Minor updates to elinor's PR regarding building on MAC.

arr committed 9 years ago

Commit 0217bda1 parent 34cadb24 files · +10 −10Browse files

Showing the changes to src/vm/string.cpp (1 of 4 files). Show all

Unified · Split

src/vm/string.cpp+5−5
@@ -43,7 +43,7 @@ namespace · 42 unmodified lines
43 43
44 // Compare function for character types.44 // Compare function for character types.
45 template <typename CharacterType1, typename CharacterType2>45 template <typename CharacterType1, typename CharacterType2>
46 int _compare(word_t len, CharacterType1 *s1, CharacterType2 *s2)46 int _compare(word_t len, const CharacterType1 *s1, const CharacterType2 *s2)
47 {47 {
48 for (auto i = word_t{ 0 }; i < len; ++i)48 for (auto i = word_t{ 0 }; i < len; ++i)
49 {49 {
@@ -62,7 +62,7 @@ int vm_string_t::compare(const vm_string_t *s1, const vm_string_t *s2) · 12 unmodified lines
62{62{
63 auto len_1 = word_t{ 0 };63 auto len_1 = word_t{ 0 };
64 auto scen_1 = ascii_idx;64 auto scen_1 = ascii_idx;
65 void *str_mem_1 = const_cast<char *>("");65 const void *str_mem_1 = "";
66 if (s1 != nullptr)66 if (s1 != nullptr)
67 {67 {
68 len_1 = s1->_length;68 len_1 = s1->_length;
@@ -72,7 +72,7 @@ int vm_string_t::compare(const vm_string_t *s1, const vm_string_t *s2) · 3 unmodified lines
72 72
73 auto len_2 = word_t{ 0 };73 auto len_2 = word_t{ 0 };
74 auto scen_2 = ascii_idx;74 auto scen_2 = ascii_idx;
75 void *str_mem_2 = const_cast<char *>("");75 const void *str_mem_2 = "";
76 if (s2 != nullptr)76 if (s2 != nullptr)
77 {77 {
78 len_2 = s2->_length;78 len_2 = s2->_length;
@@ -97,10 +97,10 @@ int vm_string_t::compare(const vm_string_t *s1, const vm_string_t *s2) · 18 unmodified lines
97 result = std::memcmp(str_mem_1, str_mem_2, min_length);97 result = std::memcmp(str_mem_1, str_mem_2, min_length);
98 break;98 break;
99 case compare_case_t::ascii_rune:99 case compare_case_t::ascii_rune:
100 result = _compare(min_length, reinterpret_cast<char *>(str_mem_1), reinterpret_cast<rune_t *>(str_mem_2));100 result = _compare(min_length, reinterpret_cast<const char *>(str_mem_1), reinterpret_cast<const runtime::rune_t *>(str_mem_2));
101 break;101 break;
102 case compare_case_t::rune_ascii:102 case compare_case_t::rune_ascii:
103 result = _compare(min_length, reinterpret_cast<rune_t *>(str_mem_1), reinterpret_cast<char *>(str_mem_2));103 result = _compare(min_length, reinterpret_cast<const runtime::rune_t *>(str_mem_1), reinterpret_cast<const char *>(str_mem_2));
104 break;104 break;
105 }105 }
106 106