History

Fix some issues when building on mac

elinor fung committed 9 years ago

Commit 34cadb21 parent db76c0c12 files · +47 −44Browse files

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

Unified · Split

src/vm/string.cpp+10−10
@@ -47,8 +47,8 @@ namespace · 46 unmodified lines
4747 {
4848 for (auto i = word_t{ 0 }; i < len; ++i)
4949 {
50− const auto sc1 = static_cast<rune_t>(s1[i]);
51− const auto sc2 = static_cast<rune_t>(s2[i]);
50+ const auto sc1 = static_cast<runtime::rune_t>(s1[i]);
51+ const auto sc2 = static_cast<runtime::rune_t>(s2[i]);
5252
5353 if (sc1 != sc2)
5454 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
6262 {
6363 auto len_1 = word_t{ 0 };
6464 auto scen_1 = ascii_idx;
65− void *str_mem_1 = "";
65+ void *str_mem_1 = const_cast<char *>("");
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 = "";
75+ void *str_mem_2 = const_cast<char *>("");
7676 if (s2 != nullptr)
7777 {
7878 len_2 = s2->_length;
@@ -128,10 +128,10 @@ namespace · 49 unmodified lines
128128 }
129129
130130 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)
132132 {
133133 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)));
135135 }
136136
137137 void combine(
@@ -146,14 +146,14 @@ namespace · 8 unmodified lines
146146 {
147147 if (dest_is_rune)
148148 {
149− auto dest_rune = reinterpret_cast<rune_t *>(dest);
149+ auto dest_rune = reinterpret_cast<runtime::rune_t *>(dest);
150150 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);
152152 else
153153 copy_characters_to(dest_rune, 0, source1, source1_length);
154154
155155 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);
157157 else
158158 copy_characters_to(dest_rune, source1_length, source2, source2_length);
159159 }
@@ -381,7 +381,7 @@ word_t vm_string_t::get_length() const · 221 unmodified lines
381381 return _length;
382382 }
383383
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
385385 {
386386 if (index < 0 && _length <= index)
387387 throw index_out_of_range_memory{ 0, _length - 1, index };