From 1dada12aba4c21eb0166db7d637f64c099c42f80 Mon Sep 17 00:00:00 2001 From: shiagarw Date: Mon, 21 Dec 2020 00:05:44 +0530 Subject: [PATCH] fixing overload made changes in wrong overload by mistake --- include/mio/detail/mmap.ipp | 34 +++++++++++++++++----------------- single_include/mio/mio.hpp | 34 +++++++++++++++++----------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/include/mio/detail/mmap.ipp b/include/mio/detail/mmap.ipp index eef5db5..1b6dc4d 100644 --- a/include/mio/detail/mmap.ipp +++ b/include/mio/detail/mmap.ipp @@ -52,22 +52,6 @@ inline DWORD int64_low(int64_t n) noexcept return n & 0xffffffff; } -template< - typename String, - typename = typename std::enable_if< - std::is_same::type, char>::value - >::type -> file_handle_type open_file_helper(const String& path, const access_mode mode) -{ - return ::CreateFileA(c_str(path), - mode == access_mode::read ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - 0, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - 0); -} - std::wstring s_2_ws(const std::string& s) { if (s.empty()) @@ -78,13 +62,29 @@ std::wstring s_2_ws(const std::string& s) return std::wstring(buf.data(), wide_char_count); } +template< + typename String, + typename = typename std::enable_if< + std::is_same::type, char>::value + >::type +> file_handle_type open_file_helper(const String& path, const access_mode mode) +{ + return ::CreateFileW(s_2_ws(path).c_str(), + mode == access_mode::read ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + 0, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + 0); +} + template typename std::enable_if< std::is_same::type, wchar_t>::value, file_handle_type >::type open_file_helper(const String& path, const access_mode mode) { - return ::CreateFileW(s_2_ws(path).c_str(), + return ::CreateFileW(c_str(path), mode == access_mode::read ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, diff --git a/single_include/mio/mio.hpp b/single_include/mio/mio.hpp index 124f1fd..c568a46 100644 --- a/single_include/mio/mio.hpp +++ b/single_include/mio/mio.hpp @@ -794,22 +794,6 @@ inline DWORD int64_low(int64_t n) noexcept return n & 0xffffffff; } -template< - typename String, - typename = typename std::enable_if< - std::is_same::type, char>::value - >::type -> file_handle_type open_file_helper(const String& path, const access_mode mode) -{ - return ::CreateFileA(c_str(path), - mode == access_mode::read ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - 0, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - 0); -} - std::wstring s_2_ws(const std::string& s) { if (s.empty()) @@ -820,13 +804,29 @@ std::wstring s_2_ws(const std::string& s) return std::wstring(buf.data(), wide_char_count); } +template< + typename String, + typename = typename std::enable_if< + std::is_same::type, char>::value + >::type +> file_handle_type open_file_helper(const String& path, const access_mode mode) +{ + return ::CreateFileW(s_2_ws(path).c_str(), + mode == access_mode::read ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + 0, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + 0); +} + template typename std::enable_if< std::is_same::type, wchar_t>::value, file_handle_type >::type open_file_helper(const String& path, const access_mode mode) { - return ::CreateFileW(s_2_ws(path).c_str(), + return ::CreateFileW(c_str(path), mode == access_mode::read ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,