Code analysis violations Bug in scheduler - race during with worker thread shutdown.
Showing the changes to src/vm/string.cpp (1 of 18 files). Show all
Unified · Split
| @@ -22,7 +22,7 @@ std::shared_ptr<const type_descriptor_t> vm_string_t::type_desc() · 21 unmodified lines | |||
| 22 | namespace | 22 | namespace |
| 23 | { | 23 | { |
| 24 | // Enumeration for character type compare cases. | 24 | // Enumeration for character type compare cases. |
| 25 | enum class compare_case | 25 | enum class compare_case_t |
| 26 | { | 26 | { |
| 27 | ascii_ascii, | 27 | ascii_ascii, |
| 28 | ascii_rune, | 28 | ascii_rune, |
| @@ -31,10 +31,10 @@ namespace · 2 unmodified lines | |||
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | // Scenario matrix for compare cases | 33 | // Scenario matrix for compare cases |
| 34 | const compare_case scenario_matrix[][2] = | 34 | const compare_case_t scenario_matrix[][2] = |
| 35 | { | 35 | { |
| 36 | { compare_case::ascii_ascii, compare_case::ascii_rune }, | 36 | { compare_case_t::ascii_ascii, compare_case_t::ascii_rune }, |
| 37 | { compare_case::rune_ascii, compare_case::rune_rune }, | 37 | { compare_case_t::rune_ascii, compare_case_t::rune_rune }, |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | // Case indices | 40 | // Case indices |
| @@ -92,14 +92,14 @@ int vm_string_t::compare(const vm_string_t *s1, const vm_string_t *s2) · 51 unmodified lines | |||
| 92 | { | 92 | { |
| 93 | default: | 93 | default: |
| 94 | assert(false && "Unknown compare scenario"); | 94 | assert(false && "Unknown compare scenario"); |
| 95 | case compare_case::ascii_ascii: | 95 | case compare_case_t::ascii_ascii: |
| 96 | case compare_case::rune_rune: | 96 | case compare_case_t::rune_rune: |
| 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::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<char *>(str_mem_1), reinterpret_cast<rune_t *>(str_mem_2)); |
| 101 | break; | 101 | break; |
| 102 | case compare_case::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<rune_t *>(str_mem_1), reinterpret_cast<char *>(str_mem_2)); |
| 104 | break; | 104 | break; |
| 105 | } | 105 | } |
| @@ -281,7 +281,7 @@ vm_string_t::vm_string_t(const vm_string_t &other, word_t begin_index, word_t en · 175 unmodified lines | |||
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | // Copy over string content starting at the correct index (char vs. rune_t) | 283 | // Copy over string content starting at the correct index (char vs. rune_t) |
| 284 | ::memcpy(dest, (src + (begin_index * _character_size)), length_in_bytes); | 284 | std::memcpy(dest, (src + (begin_index * _character_size)), length_in_bytes); |
| 285 | debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "copy: vm string: %#" PRIxPTR " %d %d %#" PRIxPTR "\n", &other, begin_index, end_index, this); | 285 | debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "copy: vm string: %#" PRIxPTR " %d %d %#" PRIxPTR "\n", &other, begin_index, end_index, this); |
| 286 | } | 286 | } |
| 287 | 287 | ||