diff options
Diffstat (limited to 'common/storage_common.cpp')
-rw-r--r-- | common/storage_common.cpp | 7 |
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 | ||
36 | static const char *s_internalPrefix = "__internal"; | 36 | static const char *s_internalPrefix = "__internal"; |
37 | static const int s_internalPrefixSize = strlen(s_internalPrefix); | 37 | static const int s_internalPrefixSize = strlen(s_internalPrefix); |
38 | static const int s_lengthOfUid = 38; | ||
38 | 39 | ||
39 | DbLayout::DbLayout() | 40 | DbLayout::DbLayout() |
40 | { | 41 | { |
@@ -196,18 +197,18 @@ bool DataStore::isInternalKey(const QByteArray &key) | |||
196 | QByteArray DataStore::assembleKey(const QByteArray &key, qint64 revision) | 197 | QByteArray 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 | ||
203 | QByteArray DataStore::uidFromKey(const QByteArray &key) | 204 | QByteArray DataStore::uidFromKey(const QByteArray &key) |
204 | { | 205 | { |
205 | return key.mid(0, 38); | 206 | return key.mid(0, s_lengthOfUid); |
206 | } | 207 | } |
207 | 208 | ||
208 | qint64 DataStore::revisionFromKey(const QByteArray &key) | 209 | qint64 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 | ||
213 | QByteArray DataStore::generateUid() | 214 | QByteArray DataStore::generateUid() |