mirror of https://github.com/kiwix/libkiwix.git
Explicit std
Removed headers were `using namespace std`. So we have to be explicit everywhere.
This commit is contained in:
parent
69931fb347
commit
71e2df7406
|
@ -130,7 +130,7 @@ kainjow::mustache::data buildPagination(
|
|||
auto nbPages = lastPage + 1;
|
||||
|
||||
auto firstPageGenerated = currentPage > 4 ? currentPage-4 : 0;
|
||||
auto lastPageGenerated = min(currentPage+4, lastPage);
|
||||
auto lastPageGenerated = std::min(currentPage+4, lastPage);
|
||||
|
||||
if (nbPages != 1) {
|
||||
if (firstPageGenerated!=0) {
|
||||
|
@ -188,7 +188,7 @@ std::string SearchRenderer::renderTemplate(const std::string& tmpl_str)
|
|||
results.set("count", kiwix::beautifyInteger(estimatedResultCount));
|
||||
results.set("hasResults", estimatedResultCount != 0);
|
||||
results.set("start", kiwix::beautifyInteger(resultStart));
|
||||
results.set("end", kiwix::beautifyInteger(min(resultStart+pageLength-1, estimatedResultCount)));
|
||||
results.set("end", kiwix::beautifyInteger(std::min(resultStart+pageLength-1, estimatedResultCount)));
|
||||
|
||||
// pagination
|
||||
auto pagination = buildPagination(
|
||||
|
|
|
@ -89,7 +89,7 @@ class SearchInfo {
|
|||
|
||||
typedef kainjow::mustache::data MustacheData;
|
||||
typedef ConcurrentCache<SearchInfo, std::shared_ptr<zim::Search>> SearchCache;
|
||||
typedef ConcurrentCache<string, std::shared_ptr<zim::SuggestionSearcher>> SuggestionSearcherCache;
|
||||
typedef ConcurrentCache<std::string, std::shared_ptr<zim::SuggestionSearcher>> SuggestionSearcherCache;
|
||||
|
||||
class OPDSDumper;
|
||||
|
||||
|
|
|
@ -53,18 +53,18 @@ std::string get_mime_type(const zim::Item& item)
|
|||
{
|
||||
try {
|
||||
return item.getMimetype();
|
||||
} catch (exception& e) {
|
||||
} catch (std::exception& e) {
|
||||
return "application/octet-stream";
|
||||
}
|
||||
}
|
||||
|
||||
bool is_compressible_mime_type(const std::string& mimeType)
|
||||
{
|
||||
return mimeType.find("text/") != string::npos
|
||||
|| mimeType.find("application/javascript") != string::npos
|
||||
|| mimeType.find("application/atom") != string::npos
|
||||
|| mimeType.find("application/opensearchdescription") != string::npos
|
||||
|| mimeType.find("application/json") != string::npos;
|
||||
return mimeType.find("text/") != std::string::npos
|
||||
|| mimeType.find("application/javascript") != std::string::npos
|
||||
|| mimeType.find("application/atom") != std::string::npos
|
||||
|| mimeType.find("application/opensearchdescription") != std::string::npos
|
||||
|| mimeType.find("application/json") != std::string::npos;
|
||||
}
|
||||
|
||||
bool compress(std::string &content) {
|
||||
|
@ -307,7 +307,7 @@ static ssize_t callback_reader_from_item(void* cls,
|
|||
{
|
||||
RunningResponse* response = static_cast<RunningResponse*>(cls);
|
||||
|
||||
size_t max_size_to_set = min<size_t>(
|
||||
size_t max_size_to_set = std::min<size_t>(
|
||||
max,
|
||||
response->item.getSize() - pos - response->range_start);
|
||||
|
||||
|
|
|
@ -692,11 +692,11 @@ struct TestData
|
|||
std::string url = "/ROOT/search?" + query;
|
||||
|
||||
if ( start >= 0 ) {
|
||||
url += "&start=" + to_string(start);
|
||||
url += "&start=" + std::to_string(start);
|
||||
}
|
||||
|
||||
if ( resultsPerPage != 0 ) {
|
||||
url += "&pageLength=" + to_string(resultsPerPage);
|
||||
url += "&pageLength=" + std::to_string(resultsPerPage);
|
||||
}
|
||||
|
||||
return url;
|
||||
|
@ -750,9 +750,9 @@ struct TestData
|
|||
)";
|
||||
|
||||
const size_t lastResultIndex = std::min(totalResultCount, firstResultIndex + results.size() - 1);
|
||||
header = replace(header, "FIRSTRESULT", to_string(firstResultIndex));
|
||||
header = replace(header, "LASTRESULT", to_string(lastResultIndex));
|
||||
header = replace(header, "RESULTCOUNT", to_string(totalResultCount));
|
||||
header = replace(header, "FIRSTRESULT", std::to_string(firstResultIndex));
|
||||
header = replace(header, "LASTRESULT", std::to_string(lastResultIndex));
|
||||
header = replace(header, "RESULTCOUNT", std::to_string(totalResultCount));
|
||||
header = replace(header, "PATTERN", getPattern());
|
||||
return header;
|
||||
}
|
||||
|
@ -824,9 +824,9 @@ struct TestData
|
|||
const auto realResultsPerPage = resultsPerPage?resultsPerPage:25;
|
||||
const auto url = makeUrl(query + "&format=xml", firstResultIndex, realResultsPerPage);
|
||||
header = replace(header, "URL", replace(url, "&", "&"));
|
||||
header = replace(header, "FIRSTRESULT", to_string(firstResultIndex));
|
||||
header = replace(header, "ITEMCOUNT", to_string(realResultsPerPage));
|
||||
header = replace(header, "RESULTCOUNT", to_string(totalResultCount));
|
||||
header = replace(header, "FIRSTRESULT", std::to_string(firstResultIndex));
|
||||
header = replace(header, "ITEMCOUNT", std::to_string(realResultsPerPage));
|
||||
header = replace(header, "RESULTCOUNT", std::to_string(totalResultCount));
|
||||
header = replace(header, "PATTERN", getPattern());
|
||||
auto queryLang = getLang();
|
||||
if (queryLang.empty()) {
|
||||
|
|
Loading…
Reference in New Issue