summaryrefslogtreecommitdiffstats
path: root/common/storage_common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/storage_common.cpp')
-rw-r--r--common/storage_common.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/common/storage_common.cpp b/common/storage_common.cpp
index 78d4c84..057dce4 100644
--- a/common/storage_common.cpp
+++ b/common/storage_common.cpp
@@ -35,6 +35,7 @@ namespace Storage {
35 35
36static const char *s_internalPrefix = "__internal"; 36static const char *s_internalPrefix = "__internal";
37static const int s_internalPrefixSize = strlen(s_internalPrefix); 37static const int s_internalPrefixSize = strlen(s_internalPrefix);
38static const int s_lengthOfUid = 38;
38 39
39DbLayout::DbLayout() 40DbLayout::DbLayout()
40{ 41{
@@ -196,18 +197,18 @@ bool DataStore::isInternalKey(const QByteArray &key)
196QByteArray DataStore::assembleKey(const QByteArray &key, qint64 revision) 197QByteArray DataStore::assembleKey(const QByteArray &key, qint64 revision)
197{ 198{
198 Q_ASSERT(revision <= 9223372036854775807); 199 Q_ASSERT(revision <= 9223372036854775807);
199 Q_ASSERT(key.size() == 38); 200 Q_ASSERT(key.size() == s_lengthOfUid);
200 return key + QByteArray::number(revision).rightJustified(19, '0', false); 201 return key + QByteArray::number(revision).rightJustified(19, '0', false);
201} 202}
202 203
203QByteArray DataStore::uidFromKey(const QByteArray &key) 204QByteArray DataStore::uidFromKey(const QByteArray &key)
204{ 205{
205 return key.mid(0, 38); 206 return key.mid(0, s_lengthOfUid);
206} 207}
207 208
208qint64 DataStore::revisionFromKey(const QByteArray &key) 209qint64 DataStore::revisionFromKey(const QByteArray &key)
209{ 210{
210 return key.mid(39).toLongLong(); 211 return key.mid(s_lengthOfUid + 1).toLongLong();
211} 212}
212 213
213QByteArray DataStore::generateUid() 214QByteArray DataStore::generateUid()