Explicit std

Removed headers were `using namespace std`.
So we have to be explicit everywhere.
This commit is contained in:
Matthieu Gautier 2022-06-22 17:51:08 +02:00 committed by Emmanuel Engelhart
parent 69931fb347
commit 71e2df7406
No known key found for this signature in database
GPG Key ID: 120B30D020B553D3
4 changed files with 18 additions and 18 deletions

View File

@ -130,7 +130,7 @@ kainjow::mustache::data buildPagination(
auto nbPages = lastPage + 1; auto nbPages = lastPage + 1;
auto firstPageGenerated = currentPage > 4 ? currentPage-4 : 0; auto firstPageGenerated = currentPage > 4 ? currentPage-4 : 0;
auto lastPageGenerated = min(currentPage+4, lastPage); auto lastPageGenerated = std::min(currentPage+4, lastPage);
if (nbPages != 1) { if (nbPages != 1) {
if (firstPageGenerated!=0) { if (firstPageGenerated!=0) {
@ -188,7 +188,7 @@ std::string SearchRenderer::renderTemplate(const std::string& tmpl_str)
results.set("count", kiwix::beautifyInteger(estimatedResultCount)); results.set("count", kiwix::beautifyInteger(estimatedResultCount));
results.set("hasResults", estimatedResultCount != 0); results.set("hasResults", estimatedResultCount != 0);
results.set("start", kiwix::beautifyInteger(resultStart)); 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 // pagination
auto pagination = buildPagination( auto pagination = buildPagination(

View File

@ -89,7 +89,7 @@ class SearchInfo {
typedef kainjow::mustache::data MustacheData; typedef kainjow::mustache::data MustacheData;
typedef ConcurrentCache<SearchInfo, std::shared_ptr<zim::Search>> SearchCache; 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; class OPDSDumper;

View File

@ -53,18 +53,18 @@ std::string get_mime_type(const zim::Item& item)
{ {
try { try {
return item.getMimetype(); return item.getMimetype();
} catch (exception& e) { } catch (std::exception& e) {
return "application/octet-stream"; return "application/octet-stream";
} }
} }
bool is_compressible_mime_type(const std::string& mimeType) bool is_compressible_mime_type(const std::string& mimeType)
{ {
return mimeType.find("text/") != string::npos return mimeType.find("text/") != std::string::npos
|| mimeType.find("application/javascript") != string::npos || mimeType.find("application/javascript") != std::string::npos
|| mimeType.find("application/atom") != string::npos || mimeType.find("application/atom") != std::string::npos
|| mimeType.find("application/opensearchdescription") != string::npos || mimeType.find("application/opensearchdescription") != std::string::npos
|| mimeType.find("application/json") != string::npos; || mimeType.find("application/json") != std::string::npos;
} }
bool compress(std::string &content) { bool compress(std::string &content) {
@ -307,7 +307,7 @@ static ssize_t callback_reader_from_item(void* cls,
{ {
RunningResponse* response = static_cast<RunningResponse*>(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, max,
response->item.getSize() - pos - response->range_start); response->item.getSize() - pos - response->range_start);

View File

@ -692,11 +692,11 @@ struct TestData
std::string url = "/ROOT/search?" + query; std::string url = "/ROOT/search?" + query;
if ( start >= 0 ) { if ( start >= 0 ) {
url += "&start=" + to_string(start); url += "&start=" + std::to_string(start);
} }
if ( resultsPerPage != 0 ) { if ( resultsPerPage != 0 ) {
url += "&pageLength=" + to_string(resultsPerPage); url += "&pageLength=" + std::to_string(resultsPerPage);
} }
return url; return url;
@ -750,9 +750,9 @@ struct TestData
)"; )";
const size_t lastResultIndex = std::min(totalResultCount, firstResultIndex + results.size() - 1); const size_t lastResultIndex = std::min(totalResultCount, firstResultIndex + results.size() - 1);
header = replace(header, "FIRSTRESULT", to_string(firstResultIndex)); header = replace(header, "FIRSTRESULT", std::to_string(firstResultIndex));
header = replace(header, "LASTRESULT", to_string(lastResultIndex)); header = replace(header, "LASTRESULT", std::to_string(lastResultIndex));
header = replace(header, "RESULTCOUNT", to_string(totalResultCount)); header = replace(header, "RESULTCOUNT", std::to_string(totalResultCount));
header = replace(header, "PATTERN", getPattern()); header = replace(header, "PATTERN", getPattern());
return header; return header;
} }
@ -824,9 +824,9 @@ struct TestData
const auto realResultsPerPage = resultsPerPage?resultsPerPage:25; const auto realResultsPerPage = resultsPerPage?resultsPerPage:25;
const auto url = makeUrl(query + "&format=xml", firstResultIndex, realResultsPerPage); const auto url = makeUrl(query + "&format=xml", firstResultIndex, realResultsPerPage);
header = replace(header, "URL", replace(url, "&", "&amp;")); header = replace(header, "URL", replace(url, "&", "&amp;"));
header = replace(header, "FIRSTRESULT", to_string(firstResultIndex)); header = replace(header, "FIRSTRESULT", std::to_string(firstResultIndex));
header = replace(header, "ITEMCOUNT", to_string(realResultsPerPage)); header = replace(header, "ITEMCOUNT", std::to_string(realResultsPerPage));
header = replace(header, "RESULTCOUNT", to_string(totalResultCount)); header = replace(header, "RESULTCOUNT", std::to_string(totalResultCount));
header = replace(header, "PATTERN", getPattern()); header = replace(header, "PATTERN", getPattern());
auto queryLang = getLang(); auto queryLang = getLang();
if (queryLang.empty()) { if (queryLang.empty()) {