Skip to content

Commit

Permalink
ntfs_file::get_filename: use utf16_to_utf8
Browse files Browse the repository at this point in the history
  • Loading branch information
maharmstone committed Aug 7, 2022
1 parent bd8f4ee commit 033b832
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/ntfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,7 @@ string ntfs_file::get_filename() {
parts.pop_back();
}

wstring_convert<codecvt_utf8_utf16<char16_t>, char16_t> convert;

return convert.to_bytes((char16_t*)retw.data(), (char16_t*)&retw[retw.length()]);
return utf16_to_utf8(retw);
}

void ntfs::seek(uint64_t pos) {
Expand Down
2 changes: 1 addition & 1 deletion src/ntfs2btrfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ static constexpr void utf16_to_utf8_span(u16string_view sv, span<char> t) noexce
}
}

static constexpr string utf16_to_utf8(u16string_view sv) {
string utf16_to_utf8(u16string_view sv) {
if (sv.empty())
return "";

Expand Down
3 changes: 3 additions & 0 deletions src/ntfs2btrfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,6 @@ extern "C" void blake2b(void *out, size_t outlen, const void* in, size_t inlen);

// rollback.cpp
void rollback(const std::string& fn);

// ntfs2btrfs.cpp
std::string utf16_to_utf8(std::u16string_view sv);

0 comments on commit 033b832

Please sign in to comment.