Showing the changes to src/vm/string.cpp (1 of 4 files). Show all
Unified · Split
| @@ -43,7 +43,7 @@ namespace · 42 unmodified lines | ||
| 43 | 43 | |
| 44 | 44 | // Compare function for character types. |
| 45 | 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 | 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 | 63 | auto len_1 = word_t{ 0 }; |
| 64 | 64 | auto scen_1 = ascii_idx; |
| 65 | − void *str_mem_1 = const_cast<char *>(""); | |
| 65 | + const void *str_mem_1 = ""; | |
| 66 | 66 | if (s1 != nullptr) |
| 67 | 67 | { |
| 68 | 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 | 73 | auto len_2 = word_t{ 0 }; |
| 74 | 74 | auto scen_2 = ascii_idx; |
| 75 | − void *str_mem_2 = const_cast<char *>(""); | |
| 75 | + const void *str_mem_2 = ""; | |
| 76 | 76 | if (s2 != nullptr) |
| 77 | 77 | { |
| 78 | 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 | 97 | result = std::memcmp(str_mem_1, str_mem_2, min_length); |
| 98 | 98 | break; |
| 99 | 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 | 101 | break; |
| 102 | 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 | 104 | break; |
| 105 | 105 | } |
| 106 | 106 | |