aboutsummaryrefslogtreecommitdiff
path: root/cmake
Commit message (Expand)AuthorAge
* Add LibGMPest312015-05-11
* Make Git version detection use VERSION_STRING instead of tagsShadowNinja2015-05-05
* Better version detection for shallow clonesest312015-05-03
* Fix typo in OpenGL ES 2 CMake fileShadowNinja2015-03-27
* Clean up and tweak build systemShadowNinja2015-03-27
* Fix cmake po detection bugest312015-03-23
* Improve FindIrrlicht.cmake moduleMarkus Koschany2015-02-21
* Remove included SQLite3ShadowNinja2015-01-08
* OS X compatibility fixesMartin Doege2014-06-29
* Add CURL_DLL search to show up CURL_DLL in cmake gui and don't silently ignor...sapier2013-11-17
* Show git hash in version string at top left corner of windowKahrl2013-09-28
* Always use builtin JThread librarykwolekr2013-09-15
* build with ogles2 driverproller2013-03-16
* fix link if system json lib existsproller2013-03-05
* new auto masterserverproller2013-02-22
* Prefer shared cURL library instead of the static one.Ilya Zhuravlev2012-12-21
* Tweak CMake files for cURLsfan52012-12-18
* Added ability to fetch media from remote server (using cURL library)Ilya Zhuravlev2012-12-16
* Add OGG_INCLUDE_DIR to SOUND_INCLUDE_DIRSPerttu Ahola2012-03-25
* celeron55's sound system initial frameworkPerttu Ahola2012-03-24
* Flatten share/ and user/ in the source and for the RUN_IN_PLACE buildPerttu Ahola2012-03-20
* Gettext fix for *BSD - require special linkage as glibc is not usedq662011-08-11
* Locale dir should be parallel to global data dirGiuseppe Bilotta2011-07-24
* Bring po update out of cmake againGiuseppe Bilotta2011-07-24
* updated cmakerules to autodetect if gettext can be usedConstantin Wenger2011-07-23
* updatepo cmake ruleGiuseppe Bilotta2011-07-22
* Refactor mo creation/installationGiuseppe Bilotta2011-07-22
* fixed not finding dll for gettext in MSVCConstantin Wenger2011-07-21
* Find correct library for MSVC vs MingW in WinowsGiuseppe Bilotta2011-07-21
* updated some path because the dlls are mostly under bin not libConstantin Wenger2011-07-21
* Refactor and clean up gettext managementGiuseppe Bilotta2011-07-21
* Use system sqlite3/jthread libs if availableGiuseppe Bilotta2011-07-20
* Added libIrrlicht.dll.a to searched library names for non-MSVC windowsPerttu Ahola2011-05-17
* forgot some test code in...Perttu Ahola2011-02-16
* Hopefully fixed some of the errors in cmake's finding of irrlichtPerttu Ahola2011-02-16
* might work good on cmake+msvc nowPerttu Ahola2011-02-15
* Hopefully fixed the problem of IRRLICHT_SOURCE_DIR being not considered when ...Perttu Ahola2011-02-01
* Mainly small build system fixesPerttu Ahola2011-01-09
* CMake stuff works now on linux and windows... and should be possible to make ...Perttu Ahola2011-01-08
* CMake working on Linux (not on windows)Perttu Ahola2011-01-08
span>::npos ? redisConnectUnix(addr) : redisConnect(addr, port); if (!ctx) { throw DatabaseException("Cannot allocate redis context"); } else if (ctx->err) { std::string err = std::string("Connection error: ") + ctx->errstr; redisFree(ctx); throw DatabaseException(err); } if (conf.exists("redis_password")) { tmp = conf.get("redis_password"); redisReply *reply = static_cast<redisReply *>(redisCommand(ctx, "AUTH %s", tmp.c_str())); if (!reply) throw DatabaseException("Redis authentication failed"); if (reply->type == REDIS_REPLY_ERROR) { std::string err = "Redis authentication failed: " + std::string(reply->str, reply->len); freeReplyObject(reply); throw DatabaseException(err); } freeReplyObject(reply); } } Database_Redis::~Database_Redis() { redisFree(ctx); } void Database_Redis::beginSave() { redisReply *reply = static_cast<redisReply *>(redisCommand(ctx, "MULTI")); if (!reply) { throw DatabaseException(std::string( "Redis command 'MULTI' failed: ") + ctx->errstr); } freeReplyObject(reply); } void Database_Redis::endSave() { redisReply *reply = static_cast<redisReply *>(redisCommand(ctx, "EXEC")); if (!reply) { throw DatabaseException(std::string( "Redis command 'EXEC' failed: ") + ctx->errstr); } freeReplyObject(reply); } bool Database_Redis::saveBlock(const v3s16 &pos, const std::string &data) { std::string tmp = i64tos(getBlockAsInteger(pos)); redisReply *reply = static_cast<redisReply *>(redisCommand(ctx, "HSET %s %s %b", hash.c_str(), tmp.c_str(), data.c_str(), data.size())); if (!reply) { warningstream << "saveBlock: redis command 'HSET' failed on " "block " << PP(pos) << ": " << ctx->errstr << std::endl; freeReplyObject(reply); return false; } if (reply->type == REDIS_REPLY_ERROR) { warningstream << "saveBlock: saving block " << PP(pos) << " failed: " << std::string(reply->str, reply->len) << std::endl; freeReplyObject(reply); return false; } freeReplyObject(reply); return true; } void Database_Redis::loadBlock(const v3s16 &pos, std::string *block) { std::string tmp = i64tos(getBlockAsInteger(pos)); redisReply *reply = static_cast<redisReply *>(redisCommand(ctx, "HGET %s %s", hash.c_str(), tmp.c_str())); if (!reply) { throw DatabaseException(std::string( "Redis command 'HGET %s %s' failed: ") + ctx->errstr); } switch (reply->type) { case REDIS_REPLY_STRING: { *block = std::string(reply->str, reply->len); // std::string copies the memory so this won't cause any problems freeReplyObject(reply); return; } case REDIS_REPLY_ERROR: { std::string errstr(reply->str, reply->len); freeReplyObject(reply); errorstream << "loadBlock: loading block " << PP(pos) << " failed: " << errstr << std::endl; throw DatabaseException(std::string( "Redis command 'HGET %s %s' errored: ") + errstr); } case REDIS_REPLY_NIL: { *block = ""; // block not found in database freeReplyObject(reply); return; } } errorstream << "loadBlock: loading block " << PP(pos) << " returned invalid reply type " << reply->type << ": " << std::string(reply->str, reply->len) << std::endl; freeReplyObject(reply); throw DatabaseException(std::string( "Redis command 'HGET %s %s' gave invalid reply.")); } bool Database_Redis::deleteBlock(const v3s16 &pos) { std::string tmp = i64tos(getBlockAsInteger(pos)); redisReply *reply = static_cast<redisReply *>(redisCommand(ctx, "HDEL %s %s", hash.c_str(), tmp.c_str())); if (!reply) { throw DatabaseException(std::string( "Redis command 'HDEL %s %s' failed: ") + ctx->errstr); } else if (reply->type == REDIS_REPLY_ERROR) { warningstream << "deleteBlock: deleting block " << PP(pos) << " failed: " << std::string(reply->str, reply->len) << std::endl; freeReplyObject(reply); return false; } freeReplyObject(reply); return true; } void Database_Redis::listAllLoadableBlocks(std::vector<v3s16> &dst) { redisReply *reply = static_cast<redisReply *>(redisCommand(ctx, "HKEYS %s", hash.c_str())); if (!reply) { throw DatabaseException(std::string( "Redis command 'HKEYS %s' failed: ") + ctx->errstr); } switch (reply->type) { case REDIS_REPLY_ARRAY: dst.reserve(reply->elements); for (size_t i = 0; i < reply->elements; i++) { assert(reply->element[i]->type == REDIS_REPLY_STRING); dst.push_back(getIntegerAsBlock(stoi64(reply->element[i]->str))); } break; case REDIS_REPLY_ERROR: throw DatabaseException(std::string( "Failed to get keys from database: ") + std::string(reply->str, reply->len)); } freeReplyObject(reply); } #endif // USE_REDIS