+ add checksum checks methods in the kiwix::reader and in the XPOM zimAccessor component

This commit is contained in:
kelson42 2011-03-04 14:05:59 +00:00
parent ddea078734
commit 1edd7ebd01
2 changed files with 20 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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;