mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-23 03:52:35 -04:00
Use the to_string
function in kiwix lib instead of redefine it.
This commit is contained in:
parent
bf40d4ff91
commit
fd4f228a41
@ -106,15 +106,6 @@ static pthread_mutex_t searchLock = PTHREAD_MUTEX_INITIALIZER;
|
|||||||
static pthread_mutex_t compressorLock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t compressorLock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static pthread_mutex_t regexLock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t regexLock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
inline std::string _tostring(const T& value)
|
|
||||||
{
|
|
||||||
std::ostringstream stream;
|
|
||||||
stream << value;
|
|
||||||
return stream.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::pair<kiwix::Reader*, kiwix::Searcher*>
|
std::pair<kiwix::Reader*, kiwix::Searcher*>
|
||||||
get_from_humanReadableBookId(const std::string& humanReadableBookId) {
|
get_from_humanReadableBookId(const std::string& humanReadableBookId) {
|
||||||
kiwix::Searcher* searcher
|
kiwix::Searcher* searcher
|
||||||
@ -385,7 +376,7 @@ static struct MHD_Response* build_callback_response_from_entry(
|
|||||||
MHD_add_response_header(response, MHD_HTTP_HEADER_CONTENT_RANGE, oss.str().c_str());
|
MHD_add_response_header(response, MHD_HTTP_HEADER_CONTENT_RANGE, oss.str().c_str());
|
||||||
|
|
||||||
MHD_add_response_header(response, MHD_HTTP_HEADER_CONTENT_LENGTH,
|
MHD_add_response_header(response, MHD_HTTP_HEADER_CONTENT_LENGTH,
|
||||||
_tostring(range_len).c_str());
|
kiwix::to_string(range_len).c_str());
|
||||||
|
|
||||||
/* Specify the mime type */
|
/* Specify the mime type */
|
||||||
MHD_add_response_header(
|
MHD_add_response_header(
|
||||||
@ -694,6 +685,7 @@ static struct MHD_Response* handle_catalog(RequestContext* request)
|
|||||||
kiwix::OPDSDumper opdsDumper;
|
kiwix::OPDSDumper opdsDumper;
|
||||||
opdsDumper.setRootLocation(rootLocation);
|
opdsDumper.setRootLocation(rootLocation);
|
||||||
opdsDumper.setSearchDescriptionUrl("catalog/searchdescription.xml");
|
opdsDumper.setSearchDescriptionUrl("catalog/searchdescription.xml");
|
||||||
|
opdsDumper.setId(kiwix::to_string(uuid));
|
||||||
mimeType = "application/atom+xml;profile=opds-catalog;kind=acquisition; charset=utf-8";
|
mimeType = "application/atom+xml;profile=opds-catalog;kind=acquisition; charset=utf-8";
|
||||||
std::vector<std::string> bookIdsToDump;
|
std::vector<std::string> bookIdsToDump;
|
||||||
if (url == "root.xml") {
|
if (url == "root.xml") {
|
||||||
@ -714,11 +706,6 @@ static struct MHD_Response* handle_catalog(RequestContext* request)
|
|||||||
return build_404(request, "");
|
return build_404(request, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
std::stringstream ss;
|
|
||||||
ss << uuid;
|
|
||||||
opdsDumper.setId(ss.str());
|
|
||||||
}
|
|
||||||
opdsDumper.setLibrary(&library);
|
opdsDumper.setLibrary(&library);
|
||||||
content = opdsDumper.dumpOPDSFeed(bookIdsToDump);
|
content = opdsDumper.dumpOPDSFeed(bookIdsToDump);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user