[app] BooksUtil::computeFileHash should take const BooksTask pointer

And so should BooksUtil::computeFileHashAndSetAttr
This commit is contained in:
Slava Monich 2018-02-02 01:11:23 +03:00
parent 09fc0cbe3e
commit 76b1e20e1a
2 changed files with 4 additions and 4 deletions

View file

@ -90,7 +90,7 @@ shared_ptr<Book> BooksUtil::bookFromFile(std::string aPath)
return book; return book;
} }
QByteArray BooksUtil::computeFileHash(QString aPath, BooksTask* aTask) QByteArray BooksUtil::computeFileHash(QString aPath, const BooksTask* aTask)
{ {
QByteArray result; QByteArray result;
QFile file(aPath); QFile file(aPath);
@ -157,7 +157,7 @@ bool BooksUtil::setFileHashAttr(QString aPath, QByteArray aHash)
return false; return false;
} }
QByteArray BooksUtil::computeFileHashAndSetAttr(QString aPath, BooksTask* aTask) QByteArray BooksUtil::computeFileHashAndSetAttr(QString aPath, const BooksTask* aTask)
{ {
QByteArray hash = computeFileHash(aPath, aTask); QByteArray hash = computeFileHash(aPath, aTask);
if (!hash.isEmpty()) { if (!hash.isEmpty()) {

View file

@ -48,8 +48,8 @@ namespace BooksUtil {
bool isValidFileName(QString aName); bool isValidFileName(QString aName);
QByteArray fileHashAttr(QString aPath); QByteArray fileHashAttr(QString aPath);
bool setFileHashAttr(QString aPath, QByteArray aHash); bool setFileHashAttr(QString aPath, QByteArray aHash);
QByteArray computeFileHash(QString aPath, BooksTask* aTask = NULL); QByteArray computeFileHash(QString aPath, const BooksTask* aTask = NULL);
QByteArray computeFileHashAndSetAttr(QString aPath, BooksTask* aTask = NULL); QByteArray computeFileHashAndSetAttr(QString aPath, const BooksTask* aTask = NULL);
} }
inline shared_ptr<Book> BooksUtil::bookFromFile(QString aPath) inline shared_ptr<Book> BooksUtil::bookFromFile(QString aPath)