diff options
Diffstat (limited to 'common/storage_lmdb.cpp')
-rw-r--r-- | common/storage_lmdb.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index e3377b2..981d4ef 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp | |||
@@ -382,7 +382,7 @@ DataStore::NamedDatabase::~NamedDatabase() | |||
382 | bool DataStore::NamedDatabase::write(const size_t key, const QByteArray &value, | 382 | bool DataStore::NamedDatabase::write(const size_t key, const QByteArray &value, |
383 | const std::function<void(const DataStore::Error &error)> &errorHandler) | 383 | const std::function<void(const DataStore::Error &error)> &errorHandler) |
384 | { | 384 | { |
385 | auto baKey = QByteArray::fromRawData(reinterpret_cast<const char *>(&key), sizeof(key)); | 385 | auto baKey = sizeTToByteArray(key); |
386 | return write(baKey, value, errorHandler); | 386 | return write(baKey, value, errorHandler); |
387 | } | 387 | } |
388 | 388 | ||
@@ -425,7 +425,7 @@ bool DataStore::NamedDatabase::write(const QByteArray &sKey, const QByteArray &s | |||
425 | void DataStore::NamedDatabase::remove( | 425 | void DataStore::NamedDatabase::remove( |
426 | const size_t key, const std::function<void(const DataStore::Error &error)> &errorHandler) | 426 | const size_t key, const std::function<void(const DataStore::Error &error)> &errorHandler) |
427 | { | 427 | { |
428 | auto baKey = QByteArray::fromRawData(reinterpret_cast<const char *>(&key), sizeof(key)); | 428 | auto baKey = sizeTToByteArray(key); |
429 | return remove(baKey, errorHandler); | 429 | return remove(baKey, errorHandler); |
430 | } | 430 | } |
431 | 431 | ||
@@ -437,7 +437,7 @@ void DataStore::NamedDatabase::remove(const QByteArray &k, const std::function<v | |||
437 | void DataStore::NamedDatabase::remove(const size_t key, const QByteArray &value, | 437 | void DataStore::NamedDatabase::remove(const size_t key, const QByteArray &value, |
438 | const std::function<void(const DataStore::Error &error)> &errorHandler) | 438 | const std::function<void(const DataStore::Error &error)> &errorHandler) |
439 | { | 439 | { |
440 | auto baKey = QByteArray::fromRawData(reinterpret_cast<const char *>(&key), sizeof(key)); | 440 | auto baKey = sizeTToByteArray(key); |
441 | return remove(baKey, value, errorHandler); | 441 | return remove(baKey, value, errorHandler); |
442 | } | 442 | } |
443 | 443 | ||
@@ -478,10 +478,10 @@ int DataStore::NamedDatabase::scan(const size_t key, | |||
478 | const std::function<bool(size_t key, const QByteArray &value)> &resultHandler, | 478 | const std::function<bool(size_t key, const QByteArray &value)> &resultHandler, |
479 | const std::function<void(const DataStore::Error &error)> &errorHandler, bool skipInternalKeys) const | 479 | const std::function<void(const DataStore::Error &error)> &errorHandler, bool skipInternalKeys) const |
480 | { | 480 | { |
481 | auto baKey = QByteArray::fromRawData(reinterpret_cast<const char *>(&key), sizeof(key)); | 481 | auto baKey = sizeTToByteArray(key); |
482 | return scan(baKey, | 482 | return scan(baKey, |
483 | [&resultHandler](const QByteArray &key, const QByteArray &value) { | 483 | [&resultHandler](const QByteArray &key, const QByteArray &value) { |
484 | size_t integerKey = *reinterpret_cast<const size_t *>(key.constData()); | 484 | size_t integerKey = byteArrayToSizeT(value); |
485 | return resultHandler(integerKey, value); | 485 | return resultHandler(integerKey, value); |
486 | }, | 486 | }, |
487 | errorHandler, /* findSubstringKeys = */ false, skipInternalKeys); | 487 | errorHandler, /* findSubstringKeys = */ false, skipInternalKeys); |
@@ -650,8 +650,8 @@ int DataStore::NamedDatabase::findAllInRange(const size_t lowerBound, const size | |||
650 | const std::function<void(const QByteArray &key, const QByteArray &value)> &resultHandler, | 650 | const std::function<void(const QByteArray &key, const QByteArray &value)> &resultHandler, |
651 | const std::function<void(const DataStore::Error &error)> &errorHandler) const | 651 | const std::function<void(const DataStore::Error &error)> &errorHandler) const |
652 | { | 652 | { |
653 | auto baLowerBound = QByteArray::fromRawData(reinterpret_cast<const char *>(&lowerBound), sizeof(size_t)); | 653 | auto baLowerBound = sizeTToByteArray(lowerBound); |
654 | auto baUpperBound = QByteArray::fromRawData(reinterpret_cast<const char *>(&upperBound), sizeof(size_t)); | 654 | auto baUpperBound = sizeTToByteArray(upperBound); |
655 | return findAllInRange(baLowerBound, baUpperBound, resultHandler, errorHandler); | 655 | return findAllInRange(baLowerBound, baUpperBound, resultHandler, errorHandler); |
656 | } | 656 | } |
657 | 657 | ||