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
4343
4444 // Compare function for character types.
4545 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)
4747 {
4848 for (auto i = word_t{ 0 }; i < len; ++i)
4949 {
@@ -62,7 +62,7 @@ int vm_string_t::compare(const vm_string_t *s1, const vm_string_t *s2) · 12 unmodified lines
6262 {
6363 auto len_1 = word_t{ 0 };
6464 auto scen_1 = ascii_idx;
65− void *str_mem_1 = const_cast<char *>("");
65+ const void *str_mem_1 = "";
6666 if (s1 != nullptr)
6767 {
6868 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
7272
7373 auto len_2 = word_t{ 0 };
7474 auto scen_2 = ascii_idx;
75− void *str_mem_2 = const_cast<char *>("");
75+ const void *str_mem_2 = "";
7676 if (s2 != nullptr)
7777 {
7878 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
9797 result = std::memcmp(str_mem_1, str_mem_2, min_length);
9898 break;
9999 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));
101101 break;
102102 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));
104104 break;
105105 }
106106