Skip to content

Commit

Permalink
MSVC fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eliaskosunen committed Nov 26, 2023
1 parent e30b908 commit 73991ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions include/scn/detail/stdin_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <atomic>
#include <mutex>
#include <optional>
#include <utility>

namespace scn {
Expand Down Expand Up @@ -54,9 +55,9 @@ namespace scn {
stdin_view make_view();

private:
constexpr stdin_manager() = default;
stdin_manager() = default;

std::optional<char> extract_char() const;
SCN_NODISCARD std::optional<char> extract_char() const;

void auto_sync();

Expand All @@ -67,7 +68,6 @@ namespace scn {

std::mutex m_mutex;
std::string m_putback_buffer{};
// std::optional<char> m_latest_read{};
std::atomic<std::ptrdiff_t> m_end_index{-1};
std::atomic<bool> m_require_locking{true};
bool m_never_read{true};
Expand Down
9 changes: 5 additions & 4 deletions src/scn/impl/unicode/unicode.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,17 +474,18 @@ namespace scn {
return 0;
}

constexpr auto src_enc = get_encoding<SourceCharT>();
constexpr auto dest_enc = get_encoding<DestCharT>();

if constexpr (src_enc == dest_enc) {
if constexpr (get_encoding<SourceCharT>() ==
get_encoding<DestCharT>()) {
SCN_EXPECT(output.size() >= input.size());
std::memcpy(output.data(), input.data(),
input.size() * sizeof(SourceCharT));
return input.size();
}

const auto result = [&]() {
constexpr auto src_enc = get_encoding<SourceCharT>();
constexpr auto dest_enc = get_encoding<DestCharT>();

if constexpr (src_enc == encoding::utf8) {
if constexpr (dest_enc == encoding::utf16) {
return simdutf::convert_utf8_to_utf16_with_errors(
Expand Down

0 comments on commit 73991ef

Please sign in to comment.