mirror of https://github.com/kiwix/libkiwix.git
Remove unnecessary checks.
`Reader` cannot be created with a null `zimArchive`. We don't have to check for zimArchive being not null.
This commit is contained in:
parent
d51000c4a9
commit
1002c15e0d
|
@ -339,10 +339,6 @@ string Reader::getOrigId() const
|
||||||
|
|
||||||
Entry Reader::getEntryFromPath(const std::string& path) const
|
Entry Reader::getEntryFromPath(const std::string& path) const
|
||||||
{
|
{
|
||||||
if (!this->zimArchive) {
|
|
||||||
throw NoEntry();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path.empty() || path == "/") {
|
if (path.empty() || path == "/") {
|
||||||
return getMainPage();
|
return getMainPage();
|
||||||
}
|
}
|
||||||
|
@ -361,10 +357,6 @@ Entry Reader::getEntryFromEncodedPath(const std::string& path) const
|
||||||
|
|
||||||
Entry Reader::getEntryFromTitle(const std::string& title) const
|
Entry Reader::getEntryFromTitle(const std::string& title) const
|
||||||
{
|
{
|
||||||
if (!this->zimArchive) {
|
|
||||||
throw NoEntry();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return zimArchive->getEntryByTitle(title);
|
return zimArchive->getEntryByTitle(title);
|
||||||
} catch(zim::EntryNotFound& e) {
|
} catch(zim::EntryNotFound& e) {
|
||||||
|
@ -374,22 +366,12 @@ Entry Reader::getEntryFromTitle(const std::string& title) const
|
||||||
|
|
||||||
bool Reader::pathExists(const string& path) const
|
bool Reader::pathExists(const string& path) const
|
||||||
{
|
{
|
||||||
if (!zimArchive)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return zimArchive->hasEntryByPath(path);
|
return zimArchive->hasEntryByPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Does the ZIM file has a fulltext index */
|
/* Does the ZIM file has a fulltext index */
|
||||||
bool Reader::hasFulltextIndex() const
|
bool Reader::hasFulltextIndex() const
|
||||||
{
|
{
|
||||||
if (!zimArchive)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return zimArchive->hasFulltextIndex();
|
return zimArchive->hasFulltextIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,9 +575,6 @@ bool Reader::isCorrupted() const
|
||||||
/* Return the file size, works also for splitted files */
|
/* Return the file size, works also for splitted files */
|
||||||
unsigned int Reader::getFileSize() const
|
unsigned int Reader::getFileSize() const
|
||||||
{
|
{
|
||||||
if (!zimArchive) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return zimArchive->getFilesize() / 1024;
|
return zimArchive->getFilesize() / 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue