Showing the changes to src/vm/string.cpp (1 of 12 files). Show all
Unified · Split
| @@ -47,8 +47,8 @@ namespace · 46 unmodified lines | |||
| 47 | { | 47 | { |
| 48 | for (auto i = word_t{ 0 }; i < len; ++i) | 48 | for (auto i = word_t{ 0 }; i < len; ++i) |
| 49 | { | 49 | { |
| 50 | const auto sc1 = static_cast<rune_t>(s1[i]); | 50 | const auto sc1 = static_cast<runtime::rune_t>(s1[i]); |
| 51 | const auto sc2 = static_cast<rune_t>(s2[i]); | 51 | const auto sc2 = static_cast<runtime::rune_t>(s2[i]); |
| 52 | 52 | ||
| 53 | if (sc1 != sc2) | 53 | if (sc1 != sc2) |
| 54 | return (sc1 < sc2) ? (-1) : 1; | 54 | return (sc1 < sc2) ? (-1) : 1; |
| @@ -62,7 +62,7 @@ int vm_string_t::compare(const vm_string_t *s1, const vm_string_t *s2) · 7 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 = ""; | 65 | void *str_mem_1 = const_cast<char *>(""); |
| 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 = ""; | 75 | void *str_mem_2 = const_cast<char *>(""); |
| 76 | if (s2 != nullptr) | 76 | if (s2 != nullptr) |
| 77 | { | 77 | { |
| 78 | len_2 = s2->_length; | 78 | len_2 = s2->_length; |
| @@ -128,10 +128,10 @@ namespace · 49 unmodified lines | |||
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | template<> | 130 | template<> |
| 131 | void copy_characters_to(rune_t *dest, word_t dest_start, const rune_t *source, word_t source_length) | 131 | void copy_characters_to(runtime::rune_t *dest, word_t dest_start, const runtime::rune_t *source, word_t source_length) |
| 132 | { | 132 | { |
| 133 | assert(dest != nullptr && source != nullptr); | 133 | assert(dest != nullptr && source != nullptr); |
| 134 | std::memcpy((dest + dest_start), source, (source_length * sizeof(rune_t))); | 134 | std::memcpy((dest + dest_start), source, (source_length * sizeof(runtime::rune_t))); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | void combine( | 137 | void combine( |
| @@ -146,14 +146,14 @@ namespace · 8 unmodified lines | |||
| 146 | { | 146 | { |
| 147 | if (dest_is_rune) | 147 | if (dest_is_rune) |
| 148 | { | 148 | { |
| 149 | auto dest_rune = reinterpret_cast<rune_t *>(dest); | 149 | auto dest_rune = reinterpret_cast<runtime::rune_t *>(dest); |
| 150 | if (source1_is_rune) | 150 | if (source1_is_rune) |
| 151 | copy_characters_to(dest_rune, 0, reinterpret_cast<const rune_t *>(source1), source1_length); | 151 | copy_characters_to(dest_rune, 0, reinterpret_cast<const runtime::rune_t *>(source1), source1_length); |
| 152 | else | 152 | else |
| 153 | copy_characters_to(dest_rune, 0, source1, source1_length); | 153 | copy_characters_to(dest_rune, 0, source1, source1_length); |
| 154 | 154 | ||
| 155 | if (source2_is_rune) | 155 | if (source2_is_rune) |
| 156 | copy_characters_to(dest_rune, source1_length, reinterpret_cast<const rune_t *>(source2), source2_length); | 156 | copy_characters_to(dest_rune, source1_length, reinterpret_cast<const runtime::rune_t *>(source2), source2_length); |
| 157 | else | 157 | else |
| 158 | copy_characters_to(dest_rune, source1_length, source2, source2_length); | 158 | copy_characters_to(dest_rune, source1_length, source2, source2_length); |
| 159 | } | 159 | } |
| @@ -381,7 +381,7 @@ word_t vm_string_t::get_length() const · 221 unmodified lines | |||
| 381 | return _length; | 381 | return _length; |
| 382 | } | 382 | } |
| 383 | 383 | ||
| 384 | rune_t vm_string_t::get_rune(word_t index) const | 384 | runtime::rune_t vm_string_t::get_rune(word_t index) const |
| 385 | { | 385 | { |
| 386 | if (index < 0 && _length <= index) | 386 | if (index < 0 && _length <= index) |
| 387 | throw index_out_of_range_memory{ 0, _length - 1, index }; | 387 | throw index_out_of_range_memory{ 0, _length - 1, index }; |