changeset 91:a5788991ca9f

Refactor lazy update, with one common routine.
author Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no>
date Mon, 21 Oct 2013 16:21:54 +0200
parents 7b7a959c993b
children f49023c61dac
files FileDBLink.cpp
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/FileDBLink.cpp	Mon Oct 21 16:20:38 2013 +0200
+++ b/FileDBLink.cpp	Mon Oct 21 16:21:54 2013 +0200
@@ -26,6 +26,16 @@
   }
 }
 
+void FileDBLink::addFile(const QString& path, quint64 size,
+			 const QDateTime& lastModified, bool lazy)
+{
+  QByteArray hash;
+  //if (!lazy || updateAllWithSize(size))
+  if (!lazy)
+      hash = computeHash(path);
+  addFile(path, size, lastModified, hash);
+}
+
 void FileDBLink::addFile(const QFileInfo& fileinfo, bool lazy)
 {
   addFile(fileinfo.absoluteFilePath(), fileinfo.size(),
@@ -71,16 +81,6 @@
   return false;
 }
 
-void FileDBLink::addFile(const QString& path, quint64 size,
-			 const QDateTime& lastModified, bool lazy)
-{
-  QByteArray hash;
-  //  std::cout << path.toStdString() << "::" << lazy << std::endl;
-  if (!lazy || updateAllWithSize(size))
-      hash = computeHash(path);
-  addFile(path, size, lastModified, hash);
-}
-
 void FileDBLink::updateFile(const QFileInfo& fileinfo, bool lazy)
 {
   updateFile(fileinfo.absoluteFilePath(), fileinfo.size(),
@@ -91,7 +91,8 @@
 			    const QDateTime& lastModified, bool lazy)
 {
   QByteArray hash;
-  if (!lazy || updateAllWithSize(size))
+  //if (!lazy || updateAllWithSize(size))
+  if (!lazy)
       hash = computeHash(path);
   updateFile(path, size, lastModified, hash);
 }