Skip to content

Commit

Permalink
fixup! Adapt to new api introduced in kiwix/libkiwix#991
Browse files Browse the repository at this point in the history
  • Loading branch information
mgautierfr committed Oct 6, 2023
1 parent f7a4001 commit b5c722b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/manager/kiwix-manage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,18 @@ void usage()
<< std::endl;
}

int handle_show(kiwix::ConstLibraryPtr library, const std::string& libraryPath,
int handle_show(const kiwix::Library& library, const std::string& libraryPath,
int argc, char* argv[])
{
if (argc > 3 ) {
for(auto i=3; i<argc; i++) {
std::string bookId = argv[i];
show(*library, bookId);
show(library, bookId);
}
} else {
auto booksIds = library->getBooksIds();
auto booksIds = library.getBooksIds();
for(auto& bookId: booksIds) {
show(*library, bookId);
show(library, bookId);
}
}
return(0);
Expand Down Expand Up @@ -182,11 +182,11 @@ int handle_add(kiwix::LibraryPtr library, const std::string& libraryPath,
return(resultCode);
}

int handle_remove(kiwix::LibraryPtr library, const std::string& libraryPath,
int handle_remove(kiwix::Library& library, const std::string& libraryPath,
int argc, char* argv[])
{
std::string bookId;
const unsigned int totalBookCount = library->getBookCount(true, true);
const unsigned int totalBookCount = library.getBookCount(true, true);
int exitCode = 0;

if (argc <= 3) {
Expand All @@ -203,7 +203,7 @@ int handle_remove(kiwix::LibraryPtr library, const std::string& libraryPath,
for (int i = 3; i<argc; i++) {
bookId = argv[i];

if (!library->removeBookById(bookId)) {
if (!library.removeBookById(bookId)) {
std::cerr << "Invalid book id '" << bookId << "'." << std::endl;
exitCode = 1;
}
Expand Down Expand Up @@ -273,13 +273,13 @@ int main(int argc, char** argv)
int exitCode = 0;
switch (action) {
case SHOW:
exitCode = handle_show(library, libraryPath, argc, argv);
exitCode = handle_show(*library, libraryPath, argc, argv);
break;
case ADD:
exitCode = handle_add(library, libraryPath, argc, argv);
break;
case REMOVE:
exitCode = handle_remove(library, libraryPath, argc, argv);
exitCode = handle_remove(*library, libraryPath, argc, argv);
break;
case NONE:
break;
Expand Down
2 changes: 1 addition & 1 deletion src/server/kiwix-serve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ int main(int argc, char** argv)
#endif

std::string rootLocation = "/";
kiwix::LibraryPtr library;
auto library = kiwix::Library::create();
unsigned int nb_threads = DEFAULT_THREADS;
std::vector<std::string> zimPathes;
std::string libraryPath;
Expand Down

0 comments on commit b5c722b

Please sign in to comment.