[Pkg-owncloud-commits] [owncloud-client] 49/60: Journal: 64bit inodes, fix storing uint64s generally

Sandro Knauß hefee at debian.org
Sat Dec 16 10:38:14 UTC 2017


This is an automated email from the git hooks/post-receive script.

hefee pushed a commit to branch upstream
in repository owncloud-client.

commit dcf0baa9de7b0a2bad65742ea380102d87bdca65
Author: Christian Kamm <mail at ckamm.de>
Date:   Mon Dec 11 14:47:49 2017 +0100

    Journal: 64bit inodes, fix storing uint64s generally
    
    In addition to using the right function when retrieving inodes this
    *also* fixes a more general bug ownsql had with storing uint64 values
    that didn't fit into an int64.
---
 src/common/ownsql.cpp        | 1 +
 src/common/syncjournaldb.cpp | 2 +-
 test/testsyncjournaldb.cpp   | 7 +++++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/common/ownsql.cpp b/src/common/ownsql.cpp
index 55dbec4..c4277a1 100644
--- a/src/common/ownsql.cpp
+++ b/src/common/ownsql.cpp
@@ -344,6 +344,7 @@ void SqlQuery::bindValue(int pos, const QVariant &value)
         break;
     case QVariant::UInt:
     case QVariant::LongLong:
+    case QVariant::ULongLong:
         res = sqlite3_bind_int64(_stmt, pos, value.toLongLong());
         break;
     case QVariant::DateTime: {
diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp
index b263cdc..e5b2f2d 100644
--- a/src/common/syncjournaldb.cpp
+++ b/src/common/syncjournaldb.cpp
@@ -45,7 +45,7 @@ Q_LOGGING_CATEGORY(lcDb, "sync.database", QtInfoMsg)
 static void fillFileRecordFromGetQuery(SyncJournalFileRecord &rec, SqlQuery &query)
 {
     rec._path = query.baValue(0);
-    rec._inode = query.intValue(1);
+    rec._inode = query.int64Value(1);
     rec._modtime = query.int64Value(2);
     rec._type = query.intValue(3);
     rec._etag = query.baValue(4);
diff --git a/test/testsyncjournaldb.cpp b/test/testsyncjournaldb.cpp
index 0575c0e..cb86a16 100644
--- a/test/testsyncjournaldb.cpp
+++ b/test/testsyncjournaldb.cpp
@@ -50,7 +50,9 @@ private slots:
         QVERIFY(!record.isValid());
 
         record._path = "foo";
-        record._inode = 1234;
+        // Use a value that exceeds uint32 and isn't representable by the
+        // signed int being cast to uint64 either (like uint64::max would be)
+        record._inode = std::numeric_limits<quint32>::max() + 12ull;
         record._modtime = dropMsecs(QDateTime::currentDateTime());
         record._type = 5;
         record._etag = "789789";
@@ -71,8 +73,9 @@ private slots:
         QVERIFY(storedRecord == record);
 
         // Update metadata
-        record._inode = 12345;
         record._modtime = dropMsecs(QDateTime::currentDateTime().addDays(1));
+        // try a value that only fits uint64, not int64
+        record._inode = std::numeric_limits<quint64>::max() - std::numeric_limits<quint32>::max() - 1;
         record._type = 7;
         record._etag = "789FFF";
         record._fileId = "efg";

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list