Some small windows compile fixes

This commit is contained in:
WolverinDEV 2020-02-02 18:22:39 +01:00
parent 0b0f957ead
commit 66a73c31cb
No known key found for this signature in database
GPG Key ID: 77A6C15085150EEB
2 changed files with 18 additions and 15 deletions

View File

@ -26,7 +26,7 @@ find_package(DataPipes REQUIRED)
include_directories(${DataPipes_INCLUDE_DIR})
# LibEvent fucks up the CMAKE_FIND_LIBRARY_SUFFIXES variable
if (NOT find_event AND FALSE)
if (NOT find_event)
function(find_event static)
if(static)
set(LIBEVENT_STATIC_LINK TRUE)
@ -66,18 +66,20 @@ else()
endif()
if (MSVC)
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
add_compile_options("/EHsc") #We require exception handling
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
add_compile_options("/EHsc") #We require exception handling
else()
set(CMAKE_CXX_FLAGS_RELEASE "-O3") #-DNDEBUG We want assert!
endif()

View File

@ -4,6 +4,7 @@
#include <cstddef>
#include <vector>
#include <optional>
#include <string_view>
#include "escape.h"
#include "converters/converter.h"
@ -131,7 +132,7 @@ namespace ts {
std::vector<std::string_view> flags{};
};
template <typename vector_t = std::vector<std::string>>
template <class vector_t = std::vector<std::string>, class vector_iter = std::vector<std::string>::iterator>
class command_builder_impl {
public:
explicit command_builder_impl(std::string command, size_t expected_bulk_size = 128, size_t expected_bulks = 1) : _identifier{std::move(command)}, expected_bulk_size{expected_bulk_size} {
@ -214,7 +215,7 @@ namespace ts {
this->put_unchecked(index, key, std::string_view{data});
}
private:
command_builder_impl(size_t expected, size_t identifier, vector_t::iterator begin, vector_t::iterator end) : expected_bulk_size{expected}, _identifier{identifier}, bulks{begin, end} {}
command_builder_impl(size_t expected, size_t identifier, vector_iter begin, vector_iter end) : expected_bulk_size{expected}, _identifier{identifier}, bulks{begin, end} {}
void impl_put_unchecked(std::string& data, size_t index, const std::string_view& key, const std::string_view& value) {
auto escaped_value = ts::query::escape(std::string{value});