mirror of https://github.com/kiwix/libkiwix.git
+ add checksum checks methods in the kiwix::reader and in the XPOM zimAccessor component
This commit is contained in:
parent
ddea078734
commit
1edd7ebd01
|
@ -236,4 +236,22 @@ namespace kiwix {
|
|||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/* Check if the file has as checksum */
|
||||
bool Reader::canCheckIntegrity() {
|
||||
return this->zimFileHandler->getChecksum() != "";
|
||||
}
|
||||
|
||||
/* Return true if corrupted, false otherwise */
|
||||
bool Reader::isCorrupted() {
|
||||
try {
|
||||
if (this->zimFileHandler->verify() == true)
|
||||
return false;
|
||||
} catch (exception &e) {
|
||||
cerr << e.what() << endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ namespace kiwix {
|
|||
bool getContentByUrl(const string &url, string &content, unsigned int &contentLength, string &contentType);
|
||||
bool searchSuggestions(const string &prefix, unsigned int suggestionsCount);
|
||||
bool getNextSuggestion(string &title);
|
||||
bool canCheckIntegrity();
|
||||
bool isCorrupted();
|
||||
|
||||
protected:
|
||||
zim::File* zimFileHandler;
|
||||
|
|
Loading…
Reference in New Issue