Last modified: 2013-08-08 19:29:01 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T52930, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 50930 - zimlib file.h getArticle()
zimlib file.h getArticle()
Status: RESOLVED FIXED
Product: openZIM
Classification: Unclassified
zimlib (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Tommi Mäkitalo
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-08 10:13 UTC by Kiran Mathew Koshy
Modified: 2013-08-08 19:29 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kiran Mathew Koshy 2013-07-08 10:13:44 UTC
In zimlib (file.h), getArticle(size_type idx) is used to obtain the article having ID ad idx.

However, when idx provided  is not found in any article in the ZIM file, the function returns an article with the index as idx itself.

Similar functions, like getArticle(char ns, const std::string& url) does not have this bug. If the required article is not found, they return an article with index 4294967295.(maximum value of unsigned int).(in other words, the default article, zim::Article(). )


I think getArticle(size_type idx) should also return zim::Article() instead of a modified version.


Error reproduction code:

zim::File file (filename.zim);
std::cout<<"\n"<<file.getArticle(500).getIndex();   //Make sure the file has less than 500 articles.

std::cout<<"\n"<<file.getArticle('X',"an_Article_which_doesn't_exist");

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links