Mercurial > dedupe
comparison FileDBLink.cpp @ 9:b5943e4bf676
Fix up header includes.
Introduce outer catch.
Fix coding style.
Remove spurious debug output.
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Wed, 22 Aug 2012 18:48:07 +0200 |
| parents | 2833b7f8884a |
| children | 9463c0c22969 |
comparison
equal
deleted
inserted
replaced
| 8:d7b384b4a834 | 9:b5943e4bf676 |
|---|---|
| 1 #include "EditDistance.hpp" | |
| 1 #include "FileDBLink.hpp" | 2 #include "FileDBLink.hpp" |
| 3 #include "PermissionException.hpp" | |
| 2 | 4 |
| 3 #include <QtCore/QDebug> | 5 #include <QtCore/QDebug> |
| 4 #include <QtCore/QtConcurrentMap> | 6 #include <QtCore/QtConcurrentMap> |
| 5 | 7 |
| 6 #include "PermissionException.hpp" | 8 #include <boost/bind.hpp> |
| 7 #include "EditDistance.hpp" | |
| 8 | 9 |
| 10 #include <algorithm> | |
| 9 #include <cassert> | 11 #include <cassert> |
| 10 | |
| 11 #include <functional> | 12 #include <functional> |
| 12 #include <algorithm> | |
| 13 #include <iostream> | 13 #include <iostream> |
| 14 | |
| 15 #include <boost/bind.hpp> | |
| 16 | 14 |
| 17 void FileDBLink::updateIfModified(const QString& path) | 15 void FileDBLink::updateIfModified(const QString& path) |
| 18 { | 16 { |
| 19 QFileInfo fileinfo(path); | 17 QFileInfo fileinfo(path); |
| 20 FileDBLink::DBStatus status = existsWithMtime(path, fileinfo.lastModified()); | 18 FileDBLink::DBStatus status = existsWithMtime(path, fileinfo.lastModified()); |
| 44 if ( file.open( QIODevice::ReadOnly ) ) { | 42 if ( file.open( QIODevice::ReadOnly ) ) { |
| 45 hash.addData( file.readAll() ); | 43 hash.addData( file.readAll() ); |
| 46 } | 44 } |
| 47 else { | 45 else { |
| 48 QString errorMsg = path + ": " + file.errorString(); | 46 QString errorMsg = path + ": " + file.errorString(); |
| 49 qDebug()<<file.error(); | 47 |
| 50 switch (file.error()) { | 48 switch (file.error()) { |
| 51 case QFile::PermissionsError: | 49 case QFile::PermissionsError: |
| 52 throw PermissionException(errorMsg); | 50 throw PermissionException(errorMsg); |
| 53 default: | 51 default: |
| 54 throw IOException(errorMsg); | 52 throw IOException(errorMsg); |
| 71 if ( file.open( QIODevice::ReadOnly ) ) { | 69 if ( file.open( QIODevice::ReadOnly ) ) { |
| 72 hash.addData( file.readAll() ); | 70 hash.addData( file.readAll() ); |
| 73 } | 71 } |
| 74 else { | 72 else { |
| 75 QString errorMsg = path + ": " + file.errorString(); | 73 QString errorMsg = path + ": " + file.errorString(); |
| 76 qDebug()<<file.error(); | 74 |
| 77 switch (file.error()) { | 75 switch (file.error()) { |
| 78 case QFile::PermissionsError: | 76 case QFile::PermissionsError: |
| 79 throw PermissionException(errorMsg); | 77 throw PermissionException(errorMsg); |
| 80 default: | 78 default: |
| 81 throw IOException(errorMsg); | 79 throw IOException(errorMsg); |
