diff options
Diffstat (limited to '')
| -rw-r--r-- | src/common/string_util.cpp | 4 | ||||
| -rw-r--r-- | src/common/string_util.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index a1360dd26..959f278aa 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -214,13 +214,13 @@ std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, std::size_t | |||
| 214 | return std::string(buffer, len); | 214 | return std::string(buffer, len); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | std::u16string UTF16StringFromFixedZeroTerminatedBuffer(const char16_t* buffer, | 217 | std::u16string UTF16StringFromFixedZeroTerminatedBuffer(std::u16string_view buffer, |
| 218 | std::size_t max_len) { | 218 | std::size_t max_len) { |
| 219 | std::size_t len = 0; | 219 | std::size_t len = 0; |
| 220 | while (len < max_len && buffer[len] != '\0') | 220 | while (len < max_len && buffer[len] != '\0') |
| 221 | ++len; | 221 | ++len; |
| 222 | 222 | ||
| 223 | return std::u16string(buffer, len); | 223 | return std::u16string(buffer.begin(), buffer.begin() + len); |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | const char* TrimSourcePath(const char* path, const char* root) { | 226 | const char* TrimSourcePath(const char* path, const char* root) { |
diff --git a/src/common/string_util.h b/src/common/string_util.h index 95b7badaf..583fd05e6 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h | |||
| @@ -68,10 +68,10 @@ std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, std::size_t | |||
| 68 | 68 | ||
| 69 | /** | 69 | /** |
| 70 | * Creates a UTF-16 std::u16string from a fixed-size NUL-terminated char buffer. If the buffer isn't | 70 | * Creates a UTF-16 std::u16string from a fixed-size NUL-terminated char buffer. If the buffer isn't |
| 71 | * NUL-terminated, then the string ends at the greatest multiple of two less then or equal to | 71 | * null-terminated, then the string ends at the greatest multiple of two less then or equal to |
| 72 | * max_len_bytes. | 72 | * max_len_bytes. |
| 73 | */ | 73 | */ |
| 74 | std::u16string UTF16StringFromFixedZeroTerminatedBuffer(const char16_t* buffer, | 74 | std::u16string UTF16StringFromFixedZeroTerminatedBuffer(std::u16string_view buffer, |
| 75 | std::size_t max_len); | 75 | std::size_t max_len); |
| 76 | 76 | ||
| 77 | /** | 77 | /** |