Improved command building & fixed native client crash

This commit is contained in:
WolverinDEV 2020-02-02 18:33:17 +01:00
parent 0b0f957ead
commit 6604c1554e
2 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ find_package(DataPipes REQUIRED)
include_directories(${DataPipes_INCLUDE_DIR}) include_directories(${DataPipes_INCLUDE_DIR})
# LibEvent fucks up the CMAKE_FIND_LIBRARY_SUFFIXES variable # LibEvent fucks up the CMAKE_FIND_LIBRARY_SUFFIXES variable
if (NOT find_event AND FALSE) if (NOT find_event)
function(find_event static) function(find_event static)
if(static) if(static)
set(LIBEVENT_STATIC_LINK TRUE) set(LIBEVENT_STATIC_LINK TRUE)

View File

@ -154,11 +154,11 @@ namespace ts {
result.append(this->_identifier); result.append(this->_identifier);
for(auto it = this->bulks.begin(); it != this->bulks.end(); it++) { for(auto it = this->bulks.begin(); it != this->bulks.end(); it++) {
if(it->empty() && !with_empty) continue; if(it->find(' ') == std::string::npos && !with_empty) continue;
result.append(*it, 0, it->length() - 1); if(it != this->bulks.begin())
if(it + 1 != this->bulks.end())
result.append(" |"); result.append(" |");
result.append(*it, 0, it->length() - 1);
} }
if(!with_empty && result.ends_with('|')) if(!with_empty && result.ends_with('|'))
this->builded = result.substr(0, result.length() - 1); this->builded = result.substr(0, result.length() - 1);
@ -214,7 +214,7 @@ namespace ts {
this->put_unchecked(index, key, std::string_view{data}); this->put_unchecked(index, key, std::string_view{data});
} }
private: 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, typename vector_t::iterator begin, typename vector_t::iterator 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) { 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}); auto escaped_value = ts::query::escape(std::string{value});