1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Make sure relevant std::stringstreams are set to binary

This commit is contained in:
sfan5 2021-09-11 21:06:57 +02:00 committed by GitHub
parent 766e885a1b
commit 75bf9b75ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 54 additions and 66 deletions

View file

@ -127,8 +127,7 @@ void Database_Redis::loadBlock(const v3s16 &pos, std::string *block)
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
block->assign(reply->str, reply->len);
freeReplyObject(reply);
return;
}
@ -141,8 +140,7 @@ void Database_Redis::loadBlock(const v3s16 &pos, std::string *block)
"Redis command 'HGET %s %s' errored: ") + errstr);
}
case REDIS_REPLY_NIL: {
*block = "";
// block not found in database
block->clear();
freeReplyObject(reply);
return;
}