diff --git a/Minetestmapper/CMakeLists.txt b/Minetestmapper/CMakeLists.txt index 1c0732c..758b4fb 100644 --- a/Minetestmapper/CMakeLists.txt +++ b/Minetestmapper/CMakeLists.txt @@ -89,12 +89,17 @@ if(USE_POSTGRESQL) endif(WIN32) endif() +set(redis_lib "") +if(USE_REDIS) + set(redis_lib ${REDIS_LIBRARY}) +endif() + #link_directories (../wingetopt) # Fügen Sie der ausführbaren Datei für dieses Projekt eine Quelle hinzu. add_executable (Minetestmapper ${sources}) set_target_properties(Minetestmapper PROPERTIES COMPILE_FLAGS -DBUILDER_STATIC_DEFINE) -target_link_libraries(Minetestmapper ${wingetopt_lib} ${LIBGD_LIBRARY} ${ZLIB_LIBRARY} ${SQLITE3_LIBRARY} ${leveldb_lib} ${postgresql_lib}) +target_link_libraries(Minetestmapper ${wingetopt_lib} ${LIBGD_LIBRARY} ${ZLIB_LIBRARY} ${SQLITE3_LIBRARY} ${leveldb_lib} ${postgresql_lib} ${redis_lib}) # TODO: Fügen Sie bei Bedarf Tests und Installationsziele hinzu. diff --git a/Minetestmapper/db-redis.cpp b/Minetestmapper/db-redis.cpp index 9c6d705..ce7d848 100644 --- a/Minetestmapper/db-redis.cpp +++ b/Minetestmapper/db-redis.cpp @@ -6,7 +6,6 @@ #include #include #include "db-redis.h" -#include "types.h" #include "Settings.h" static inline int64_t stoi64(const std::string &s) @@ -84,11 +83,11 @@ const DB::BlockPosList &DBRedis::getBlockPosList() } -DB::Block DBRedis::getBlockOnPos(const BlockPos &pos) +const DB::Block DBRedis::getBlockOnPos(const BlockPos &pos) { redisReply *reply; std::string tmp; - Block block(pos,reinterpret_cast("")); + Block block(pos, {}); m_blocksQueriedCount++; @@ -97,7 +96,7 @@ DB::Block DBRedis::getBlockOnPos(const BlockPos &pos) throw std::runtime_error(std::string("redis command 'HGET %s %s' failed: ") + ctx->errstr); if (reply->type == REDIS_REPLY_STRING && reply->len != 0) { m_blocksReadCount++; - block = Block(pos, ustring(reinterpret_cast(reply->str), reply->len)); + block = Block(pos, reinterpret_cast(reply->str), reply->len); } else throw std::runtime_error("Got wrong response to 'HGET %s %s' command"); freeReplyObject(reply); diff --git a/Minetestmapper/db-redis.h b/Minetestmapper/db-redis.h index 197161e..d3c7bb0 100644 --- a/Minetestmapper/db-redis.h +++ b/Minetestmapper/db-redis.h @@ -14,7 +14,7 @@ public: virtual int getBlocksQueriedCount(void); virtual int getBlocksReadCount(void); virtual const BlockPosList &getBlockPosList(); - virtual Block getBlockOnPos(const BlockPos &pos); + virtual const Block getBlockOnPos(const BlockPos &pos); ~DBRedis(); private: int m_blocksReadCount;