Unified · Split
| @@ -190,7 +190,10 @@ vm_string_t::vm_string_t(std::size_t encoded_str_len, const uint8_t *encoded_str · 189 unmodified lines | |||
| 190 | , _length_max{ sizeof(_mem.local) } | 190 | , _length_max{ sizeof(_mem.local) } |
| 191 | , _mem{} | 191 | , _mem{} |
| 192 | { | 192 | { |
| 193 | assert((encoded_str_len > 0 && encoded_str != nullptr) || (encoded_str_len == 0 && encoded_str == nullptr)); | 193 | assert((encoded_str_len > 0 && encoded_str != nullptr) || encoded_str_len == 0); |
| 194 | if (encoded_str_len == 0) | ||
| 195 | encoded_str = nullptr; | ||
| 196 | |||
| 194 | const auto utf8_length = utf8::count_codepoints(encoded_str, encoded_str_len); | 197 | const auto utf8_length = utf8::count_codepoints(encoded_str, encoded_str_len); |
| 195 | 198 | ||
| 196 | // Check if the supplied string is completely valid UTF-8 - only valid UTF-8 strings can be DisVM strings. | 199 | // Check if the supplied string is completely valid UTF-8 - only valid UTF-8 strings can be DisVM strings. |
| @@ -41,8 +41,8 @@ namespace disvm · 40 unmodified lines | |||
| 41 | enum class cfs_flags_t | 41 | enum class cfs_flags_t |
| 42 | { | 42 | { |
| 43 | none = 0, | 43 | none = 0, |
| 44 | atomic = 1, | 44 | atomic = 1 << 0, |
| 45 | ensure_create = 2, | 45 | ensure_create = 1 << 1, |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | DEFINE_ENUM_FLAG_OPERATORS(cfs_flags_t); | 48 | DEFINE_ENUM_FLAG_OPERATORS(cfs_flags_t); |
| @@ -91,7 +91,8 @@ vm_config_t::vm_config_t(vm_config_t &&other) · 90 unmodified lines | |||
| 91 | { } | 91 | { } |
| 92 | 92 | ||
| 93 | vm_t::vm_t() | 93 | vm_t::vm_t() |
| 94 | : _last_syscall_error_message_lock{ ATOMIC_FLAG_INIT } | 94 | : _last_syscall_error_message{} |
| 95 | , _last_syscall_error_message_lock{ ATOMIC_FLAG_INIT } | ||
| 95 | { | 96 | { |
| 96 | // Initialize built-in modules. | 97 | // Initialize built-in modules. |
| 97 | builtin::initialize_builtin_modules(); | 98 | builtin::initialize_builtin_modules(); |
| @@ -102,6 +103,7 @@ vm_t::vm_t() · 4 unmodified lines | |||
| 102 | } | 103 | } |
| 103 | 104 | ||
| 104 | vm_t::vm_t(vm_config_t config) | 105 | vm_t::vm_t(vm_config_t config) |
| 106 | : _last_syscall_error_message{} | ||
| 105 | { | 107 | { |
| 106 | // Initialize built-in modules. | 108 | // Initialize built-in modules. |
| 107 | builtin::initialize_builtin_modules(); | 109 | builtin::initialize_builtin_modules(); |