comparison FileDBLink.cpp @ 86:af7962f3274b

Use quint64 for sizes, rather than qint64.
author Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no>
date Thu, 10 Oct 2013 16:07:35 +0200
parents 1f9e27a0bd7f
children a5788991ca9f
comparison
equal deleted inserted replaced
85:1f9e27a0bd7f 86:af7962f3274b
54 } 54 }
55 } 55 }
56 return hash.result(); 56 return hash.result();
57 } 57 }
58 58
59 bool FileDBLink::updateAllWithSize(qint64 size) 59 bool FileDBLink::updateAllWithSize(quint64 size)
60 { 60 {
61 const QList<dbinf_ptr_t> others = filesWithSize(size); 61 const QList<dbinf_ptr_t> others = filesWithSize(size);
62 if (!others.empty()) { 62 if (!others.empty()) {
63 foreach( const dbinf_ptr_t other, others) { 63 foreach( const dbinf_ptr_t other, others) {
64 if (other->checksum().isEmpty()) { 64 if (other->checksum().isEmpty()) {
69 return true; 69 return true;
70 } 70 }
71 return false; 71 return false;
72 } 72 }
73 73
74 void FileDBLink::addFile(const QString& path, qint64 size, 74 void FileDBLink::addFile(const QString& path, quint64 size,
75 const QDateTime& lastModified, bool lazy) 75 const QDateTime& lastModified, bool lazy)
76 { 76 {
77 QByteArray hash; 77 QByteArray hash;
78 // std::cout << path.toStdString() << "::" << lazy << std::endl; 78 // std::cout << path.toStdString() << "::" << lazy << std::endl;
79 if (!lazy || updateAllWithSize(size)) 79 if (!lazy || updateAllWithSize(size))
85 { 85 {
86 updateFile(fileinfo.absoluteFilePath(), fileinfo.size(), 86 updateFile(fileinfo.absoluteFilePath(), fileinfo.size(),
87 fileinfo.lastModified(), lazy); 87 fileinfo.lastModified(), lazy);
88 } 88 }
89 89
90 void FileDBLink::updateFile(const QString& path, qint64 size, 90 void FileDBLink::updateFile(const QString& path, quint64 size,
91 const QDateTime& lastModified, bool lazy) 91 const QDateTime& lastModified, bool lazy)
92 { 92 {
93 QByteArray hash; 93 QByteArray hash;
94 if (!lazy || updateAllWithSize(size)) 94 if (!lazy || updateAllWithSize(size))
95 hash = computeHash(path); 95 hash = computeHash(path);
193 #endif 193 #endif
194 return list; 194 return list;
195 } 195 }
196 196
197 197
198 const QList<FileDBLink::dbinf_ptr_t> 198 const QList<FileDBLink::dbinf_ptr_t>
199 FileDBLink::filesWithSize(qint64 size, const QString& prefix) const 199 FileDBLink::filesWithSize(quint64 size, const QString& prefix) const
200 { 200 {
201 QList<dbinf_ptr_t> retVal; 201 QList<dbinf_ptr_t> retVal;
202 const QList<dbinf_ptr_t> vals = values(prefix); 202 const QList<dbinf_ptr_t> vals = values(prefix);
203 foreach (const dbinf_ptr_t val, vals) { 203 foreach (const dbinf_ptr_t val, vals) {
204 QString path = val->path(); 204 QString path = val->path();