Skip to content

Commit

Permalink
fixup! Update kiwix::book to use libzim structure
Browse files Browse the repository at this point in the history
  • Loading branch information
maneeshpm committed Jul 3, 2021
1 parent ce920e8 commit 280262a
Showing 1 changed file with 1 addition and 39 deletions.
40 changes: 1 addition & 39 deletions src/tools/archiveTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,6 @@
#include <zim/error.h>
#include <zim/item.h>

inline char hi(char v)
{
char hex[] = "0123456789abcdef";
return hex[(v >> 4) & 0xf];
}

inline char lo(char v)
{
char hex[] = "0123456789abcdef";
return hex[v & 0xf];
}

std::string hexUUID(std::string in)
{
std::ostringstream out;
for (unsigned n = 0; n < 4; ++n) {
out << hi(in[n]) << lo(in[n]);
}
out << '-';
for (unsigned n = 4; n < 6; ++n) {
out << hi(in[n]) << lo(in[n]);
}
out << '-';
for (unsigned n = 6; n < 8; ++n) {
out << hi(in[n]) << lo(in[n]);
}
out << '-';
for (unsigned n = 8; n < 10; ++n) {
out << hi(in[n]) << lo(in[n]);
}
out << '-';
for (unsigned n = 10; n < 16; ++n) {
out << hi(in[n]) << lo(in[n]);
}
std::string op = out.str();
return op;
}

namespace kiwix
{
std::string getMetadata(const zim::Archive& archive, const std::string& name) {
Expand Down Expand Up @@ -155,7 +117,7 @@ std::string getArchiveOrigId(const zim::Archive& archive) {
temp += id[i];
}
}
origID = hexUUID(tempArray);
origID = (std::string) zim::Uuid::generate(tempArray);
return origID;
}

Expand Down

0 comments on commit 280262a

Please sign in to comment.