diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2020-03-20 12:38:09 +0200 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2020-03-23 12:09:09 +0200 |
commit | d15b9c1f9c1afa29175ba2e398adc680e66147e6 (patch) | |
tree | 6bf426ae77d7386a6bbdee30444974bbc5dd76d0 /platform/default | |
parent | 37802eec36aae3cb84c7f73a48652d9959489243 (diff) | |
download | qtlocation-mapboxgl-d15b9c1f9c1afa29175ba2e398adc680e66147e6.tar.gz |
[core] Fix performance-unnecessary-value-param errors
As reported by clang-tidy-8.
Diffstat (limited to 'platform/default')
14 files changed, 95 insertions, 94 deletions
diff --git a/platform/default/include/mbgl/gfx/headless_frontend.hpp b/platform/default/include/mbgl/gfx/headless_frontend.hpp index 8a98b4112d..9b079f9333 100644 --- a/platform/default/include/mbgl/gfx/headless_frontend.hpp +++ b/platform/default/include/mbgl/gfx/headless_frontend.hpp @@ -26,12 +26,12 @@ public: HeadlessFrontend(float pixelRatio_, gfx::HeadlessBackend::SwapBehaviour swapBehviour = gfx::HeadlessBackend::SwapBehaviour::NoFlush, gfx::ContextMode mode = gfx::ContextMode::Unique, - const optional<std::string> localFontFamily = {}); + const optional<std::string>& localFontFamily = {}); HeadlessFrontend(Size, float pixelRatio_, gfx::HeadlessBackend::SwapBehaviour swapBehviour = gfx::HeadlessBackend::SwapBehaviour::NoFlush, gfx::ContextMode mode = gfx::ContextMode::Unique, - const optional<std::string> localFontFamily = {}); + const optional<std::string>& localFontFamily = {}); ~HeadlessFrontend() override; void reset() override; diff --git a/platform/default/include/mbgl/storage/local_file_request.hpp b/platform/default/include/mbgl/storage/local_file_request.hpp index 590ae8bbc7..15354d36a4 100644 --- a/platform/default/include/mbgl/storage/local_file_request.hpp +++ b/platform/default/include/mbgl/storage/local_file_request.hpp @@ -8,6 +8,6 @@ template <typename> class ActorRef; class FileSourceRequest; -void requestLocalFile(const std::string&, ActorRef<FileSourceRequest>); +void requestLocalFile(const std::string&, const ActorRef<FileSourceRequest>&); } // namespace mbgl diff --git a/platform/default/src/mbgl/gfx/headless_frontend.cpp b/platform/default/src/mbgl/gfx/headless_frontend.cpp index 996006bfe2..9cdc5941a1 100644 --- a/platform/default/src/mbgl/gfx/headless_frontend.cpp +++ b/platform/default/src/mbgl/gfx/headless_frontend.cpp @@ -14,14 +14,14 @@ namespace mbgl { HeadlessFrontend::HeadlessFrontend(float pixelRatio_, gfx::HeadlessBackend::SwapBehaviour swapBehavior, const gfx::ContextMode contextMode, - const optional<std::string> localFontFamily) + const optional<std::string>& localFontFamily) : HeadlessFrontend({256, 256}, pixelRatio_, swapBehavior, contextMode, localFontFamily) {} HeadlessFrontend::HeadlessFrontend(Size size_, float pixelRatio_, gfx::HeadlessBackend::SwapBehaviour swapBehavior, const gfx::ContextMode contextMode, - const optional<std::string> localFontFamily) + const optional<std::string>& localFontFamily) : size(size_), pixelRatio(pixelRatio_), frameTime(0), @@ -144,7 +144,7 @@ HeadlessFrontend::RenderResult HeadlessFrontend::render(Map& map) { HeadlessFrontend::RenderResult result; std::exception_ptr error; - map.renderStill([&](std::exception_ptr e) { + map.renderStill([&](const std::exception_ptr& e) { if (e) { error = e; } else { diff --git a/platform/default/src/mbgl/i18n/collator.cpp b/platform/default/src/mbgl/i18n/collator.cpp index f46accff8a..f04fe3eca8 100644 --- a/platform/default/src/mbgl/i18n/collator.cpp +++ b/platform/default/src/mbgl/i18n/collator.cpp @@ -50,10 +50,8 @@ namespace platform { class Collator::Impl { public: - Impl(bool caseSensitive_, bool diacriticSensitive_, optional<std::string>) - : caseSensitive(caseSensitive_) - , diacriticSensitive(diacriticSensitive_) - {} + Impl(bool caseSensitive_, bool diacriticSensitive_, const optional<std::string>&) + : caseSensitive(caseSensitive_), diacriticSensitive(diacriticSensitive_) {} bool operator==(const Impl& other) const { return caseSensitive == other.caseSensitive && diacriticSensitive == other.diacriticSensitive; @@ -94,8 +92,8 @@ std::string Collator::resolvedLocale() const { return impl->resolvedLocale(); } -Collator::Collator(bool caseSensitive, bool diacriticSensitive, optional<std::string> locale) - : impl(std::make_shared<Impl>(caseSensitive, diacriticSensitive, std::move(locale))) {} +Collator::Collator(bool caseSensitive, bool diacriticSensitive, const optional<std::string>& locale) + : impl(std::make_shared<Impl>(caseSensitive, diacriticSensitive, locale)) {} } // namespace platform } // namespace mbgl diff --git a/platform/default/src/mbgl/map/map_snapshotter.cpp b/platform/default/src/mbgl/map/map_snapshotter.cpp index fe051d8ca1..421d885dc4 100644 --- a/platform/default/src/mbgl/map/map_snapshotter.cpp +++ b/platform/default/src/mbgl/map/map_snapshotter.cpp @@ -14,6 +14,7 @@ #include <mbgl/util/exception.hpp> #include <mbgl/util/logging.hpp> #include <mbgl/util/thread.hpp> +#include <utility> namespace mbgl { @@ -49,12 +50,12 @@ private: class SnapshotterRenderer final : public RendererObserver { public: - SnapshotterRenderer(Size size, float pixelRatio, optional<std::string> localFontFamily) + SnapshotterRenderer(Size size, float pixelRatio, const optional<std::string>& localFontFamily) : frontend(size, pixelRatio, gfx::HeadlessBackend::SwapBehaviour::NoFlush, gfx::ContextMode::Unique, - std::move(localFontFamily)) {} + localFontFamily) {} void reset() { hasPendingStillImageRequest = false; @@ -178,11 +179,11 @@ public: Attributions attributions, PointForFn pfn, LatLngForFn latLonFn) { - cb(ptr, std::move(image), std::move(attributions), std::move(pfn), std::move(latLonFn)); + cb(std::move(ptr), std::move(image), std::move(attributions), std::move(pfn), std::move(latLonFn)); renderStillCallback.reset(); }); - map.renderStill([this, actorRef = renderStillCallback->self()](std::exception_ptr error) { + map.renderStill([this, actorRef = renderStillCallback->self()](const std::exception_ptr& error) { // Create lambda that captures the current transform state // and can be used to translate for geographic to screen // coordinates diff --git a/platform/default/src/mbgl/storage/asset_file_source.cpp b/platform/default/src/mbgl/storage/asset_file_source.cpp index a9ede06508..278411026e 100644 --- a/platform/default/src/mbgl/storage/asset_file_source.cpp +++ b/platform/default/src/mbgl/storage/asset_file_source.cpp @@ -19,11 +19,9 @@ namespace mbgl { class AssetFileSource::Impl { public: - Impl(ActorRef<Impl>, std::string root_) - : root(std::move(root_)) { - } + Impl(const ActorRef<Impl>&, std::string root_) : root(std::move(root_)) {} - void request(const std::string& url, ActorRef<FileSourceRequest> req) { + void request(const std::string& url, const ActorRef<FileSourceRequest>& req) { if (!acceptsURL(url)) { Response response; response.error = std::make_unique<Response::Error>(Response::Error::Reason::Other, @@ -35,7 +33,7 @@ public: // Cut off the protocol and prefix with path. const auto path = root + "/" + mbgl::util::percentDecode(url.substr(std::char_traits<char>::length(util::ASSET_PROTOCOL))); - requestLocalFile(path, std::move(req)); + requestLocalFile(path, req); } private: diff --git a/platform/default/src/mbgl/storage/database_file_source.cpp b/platform/default/src/mbgl/storage/database_file_source.cpp index 276482faa0..4dff99b5b8 100644 --- a/platform/default/src/mbgl/storage/database_file_source.cpp +++ b/platform/default/src/mbgl/storage/database_file_source.cpp @@ -12,14 +12,15 @@ #include <mbgl/util/thread.hpp> #include <map> +#include <utility> namespace mbgl { class DatabaseFileSourceThread { public: - DatabaseFileSourceThread(std::shared_ptr<FileSource> onlineFileSource_, std::string cachePath) - : db(std::make_unique<OfflineDatabase>(cachePath)), onlineFileSource(onlineFileSource_) {} + DatabaseFileSourceThread(std::shared_ptr<FileSource> onlineFileSource_, const std::string& cachePath) + : db(std::make_unique<OfflineDatabase>(cachePath)), onlineFileSource(std::move(onlineFileSource_)) {} - void request(const Resource& resource, ActorRef<FileSourceRequest> req) { + void request(const Resource& resource, const ActorRef<FileSourceRequest>& req) { auto offlineResponse = db->get(resource); if (!offlineResponse) { offlineResponse.emplace(); @@ -33,61 +34,63 @@ public: req.invoke(&FileSourceRequest::setResponse, *offlineResponse); } - void setDatabasePath(const std::string& path, std::function<void()> callback) { + void setDatabasePath(const std::string& path, const std::function<void()>& callback) { db->changePath(path); if (callback) { callback(); } } - void forward(const Resource& resource, const Response& response, std::function<void()> callback) { + void forward(const Resource& resource, const Response& response, const std::function<void()>& callback) { db->put(resource, response); if (callback) { callback(); } } - void resetDatabase(std::function<void(std::exception_ptr)> callback) { callback(db->resetDatabase()); } + void resetDatabase(const std::function<void(std::exception_ptr)>& callback) { callback(db->resetDatabase()); } - void packDatabase(std::function<void(std::exception_ptr)> callback) { callback(db->pack()); } + void packDatabase(const std::function<void(std::exception_ptr)>& callback) { callback(db->pack()); } void runPackDatabaseAutomatically(bool autopack) { db->runPackDatabaseAutomatically(autopack); } void put(const Resource& resource, const Response& response) { db->put(resource, response); } - void invalidateAmbientCache(std::function<void(std::exception_ptr)> callback) { + void invalidateAmbientCache(const std::function<void(std::exception_ptr)>& callback) { callback(db->invalidateAmbientCache()); } - void clearAmbientCache(std::function<void(std::exception_ptr)> callback) { callback(db->clearAmbientCache()); } + void clearAmbientCache(const std::function<void(std::exception_ptr)>& callback) { + callback(db->clearAmbientCache()); + } - void setMaximumAmbientCacheSize(uint64_t size, std::function<void(std::exception_ptr)> callback) { + void setMaximumAmbientCacheSize(uint64_t size, const std::function<void(std::exception_ptr)>& callback) { callback(db->setMaximumAmbientCacheSize(size)); } - void listRegions(std::function<void(expected<OfflineRegions, std::exception_ptr>)> callback) { + void listRegions(const std::function<void(expected<OfflineRegions, std::exception_ptr>)>& callback) { callback(db->listRegions()); } void createRegion(const OfflineRegionDefinition& definition, const OfflineRegionMetadata& metadata, - std::function<void(expected<OfflineRegion, std::exception_ptr>)> callback) { + const std::function<void(expected<OfflineRegion, std::exception_ptr>)>& callback) { callback(db->createRegion(definition, metadata)); } void mergeOfflineRegions(const std::string& sideDatabasePath, - std::function<void(expected<OfflineRegions, std::exception_ptr>)> callback) { + const std::function<void(expected<OfflineRegions, std::exception_ptr>)>& callback) { callback(db->mergeDatabase(sideDatabasePath)); } void updateMetadata(const int64_t regionID, const OfflineRegionMetadata& metadata, - std::function<void(expected<OfflineRegionMetadata, std::exception_ptr>)> callback) { + const std::function<void(expected<OfflineRegionMetadata, std::exception_ptr>)>& callback) { callback(db->updateMetadata(regionID, metadata)); } void getRegionStatus(int64_t regionID, - std::function<void(expected<OfflineRegionStatus, std::exception_ptr>)> callback) { + const std::function<void(expected<OfflineRegionStatus, std::exception_ptr>)>& callback) { if (auto download = getDownload(regionID)) { callback(download.value()->getStatus()); } else { @@ -95,12 +98,12 @@ public: } } - void deleteRegion(OfflineRegion region, std::function<void(std::exception_ptr)> callback) { + void deleteRegion(OfflineRegion region, const std::function<void(std::exception_ptr)>& callback) { downloads.erase(region.getID()); callback(db->deleteRegion(std::move(region))); } - void invalidateRegion(int64_t regionID, std::function<void(std::exception_ptr)> callback) { + void invalidateRegion(int64_t regionID, const std::function<void(std::exception_ptr)>& callback) { callback(db->invalidateRegion(regionID)); } @@ -223,35 +226,35 @@ void DatabaseFileSource::setMaximumAmbientCacheSize(uint64_t size, std::function void DatabaseFileSource::listOfflineRegions( std::function<void(expected<OfflineRegions, std::exception_ptr>)> callback) { - impl->actor().invoke(&DatabaseFileSourceThread::listRegions, callback); + impl->actor().invoke(&DatabaseFileSourceThread::listRegions, std::move(callback)); } void DatabaseFileSource::createOfflineRegion( const OfflineRegionDefinition& definition, const OfflineRegionMetadata& metadata, std::function<void(expected<OfflineRegion, std::exception_ptr>)> callback) { - impl->actor().invoke(&DatabaseFileSourceThread::createRegion, definition, metadata, callback); + impl->actor().invoke(&DatabaseFileSourceThread::createRegion, definition, metadata, std::move(callback)); } void DatabaseFileSource::mergeOfflineRegions( const std::string& sideDatabasePath, std::function<void(expected<OfflineRegions, std::exception_ptr>)> callback) { - impl->actor().invoke(&DatabaseFileSourceThread::mergeOfflineRegions, sideDatabasePath, callback); + impl->actor().invoke(&DatabaseFileSourceThread::mergeOfflineRegions, sideDatabasePath, std::move(callback)); } void DatabaseFileSource::updateOfflineMetadata( const int64_t regionID, const OfflineRegionMetadata& metadata, std::function<void(expected<OfflineRegionMetadata, std::exception_ptr>)> callback) { - impl->actor().invoke(&DatabaseFileSourceThread::updateMetadata, regionID, metadata, callback); + impl->actor().invoke(&DatabaseFileSourceThread::updateMetadata, regionID, metadata, std::move(callback)); } -void DatabaseFileSource::deleteOfflineRegion(OfflineRegion region, std::function<void(std::exception_ptr)> callback) { - impl->actor().invoke(&DatabaseFileSourceThread::deleteRegion, std::move(region), callback); +void DatabaseFileSource::deleteOfflineRegion(OfflineRegion& region, std::function<void(std::exception_ptr)> callback) { + impl->actor().invoke(&DatabaseFileSourceThread::deleteRegion, region, std::move(callback)); } void DatabaseFileSource::invalidateOfflineRegion(OfflineRegion& region, std::function<void(std::exception_ptr)> callback) { - impl->actor().invoke(&DatabaseFileSourceThread::invalidateRegion, region.getID(), callback); + impl->actor().invoke(&DatabaseFileSourceThread::invalidateRegion, region.getID(), std::move(callback)); } void DatabaseFileSource::setOfflineRegionObserver(OfflineRegion& region, @@ -265,7 +268,7 @@ void DatabaseFileSource::setOfflineRegionDownloadState(OfflineRegion& region, Of void DatabaseFileSource::getOfflineRegionStatus( OfflineRegion& region, std::function<void(expected<OfflineRegionStatus, std::exception_ptr>)> callback) const { - impl->actor().invoke(&DatabaseFileSourceThread::getRegionStatus, region.getID(), callback); + impl->actor().invoke(&DatabaseFileSourceThread::getRegionStatus, region.getID(), std::move(callback)); } void DatabaseFileSource::setOfflineMapboxTileCountLimit(uint64_t limit) const { diff --git a/platform/default/src/mbgl/storage/local_file_request.cpp b/platform/default/src/mbgl/storage/local_file_request.cpp index 9f2351a5b7..1f00ebdb85 100644 --- a/platform/default/src/mbgl/storage/local_file_request.cpp +++ b/platform/default/src/mbgl/storage/local_file_request.cpp @@ -11,7 +11,7 @@ namespace mbgl { -void requestLocalFile(const std::string& path, ActorRef<FileSourceRequest> req) { +void requestLocalFile(const std::string& path, const ActorRef<FileSourceRequest>& req) { Response response; struct stat buf; int result = stat(path.c_str(), &buf); diff --git a/platform/default/src/mbgl/storage/local_file_source.cpp b/platform/default/src/mbgl/storage/local_file_source.cpp index 5009146c8e..b505303fc0 100644 --- a/platform/default/src/mbgl/storage/local_file_source.cpp +++ b/platform/default/src/mbgl/storage/local_file_source.cpp @@ -19,9 +19,9 @@ namespace mbgl { class LocalFileSource::Impl { public: - Impl(ActorRef<Impl>) {} + Impl(const ActorRef<Impl>&) {} - void request(const std::string& url, ActorRef<FileSourceRequest> req) { + void request(const std::string& url, const ActorRef<FileSourceRequest>& req) { if (!acceptsURL(url)) { Response response; response.error = std::make_unique<Response::Error>(Response::Error::Reason::Other, @@ -32,7 +32,7 @@ public: // Cut off the protocol and prefix with path. const auto path = mbgl::util::percentDecode(url.substr(std::char_traits<char>::length(util::FILE_PROTOCOL))); - requestLocalFile(path, std::move(req)); + requestLocalFile(path, req); } }; diff --git a/platform/default/src/mbgl/storage/main_resource_loader.cpp b/platform/default/src/mbgl/storage/main_resource_loader.cpp index aa8d745170..0e7ea367e3 100644 --- a/platform/default/src/mbgl/storage/main_resource_loader.cpp +++ b/platform/default/src/mbgl/storage/main_resource_loader.cpp @@ -25,7 +25,7 @@ public: localFileSource(std::move(localFileSource_)), onlineFileSource(std::move(onlineFileSource_)) {} - void request(AsyncRequest* req, Resource resource, ActorRef<FileSourceRequest> ref) { + void request(AsyncRequest* req, const Resource& resource, const ActorRef<FileSourceRequest>& ref) { auto callback = [ref](const Response& res) { ref.invoke(&FileSourceRequest::setResponse, res); }; auto requestFromNetwork = [=](const Resource& res, @@ -38,7 +38,7 @@ public: std::shared_ptr<AsyncRequest> parentKeepAlive = std::move(parent); MBGL_TIMING_START(watch); - return onlineFileSource->request(res, [=, ptr = parentKeepAlive](Response response) { + return onlineFileSource->request(res, [=, ptr = parentKeepAlive](const Response& response) { if (databaseFileSource) { databaseFileSource->forward(res, response); } @@ -72,7 +72,7 @@ public: tasks[req] = databaseFileSource->request(resource, callback); } else { // Cache request with fallback to network with cache control - tasks[req] = databaseFileSource->request(resource, [=](Response response) { + tasks[req] = databaseFileSource->request(resource, [=](const Response& response) { Resource res = resource; // Resource is in the cache diff --git a/platform/default/src/mbgl/storage/offline_download.cpp b/platform/default/src/mbgl/storage/offline_download.cpp index e1413b61b0..c502e12b0b 100644 --- a/platform/default/src/mbgl/storage/offline_download.cpp +++ b/platform/default/src/mbgl/storage/offline_download.cpp @@ -236,7 +236,7 @@ void OfflineDownload::activateDownload() { styleResource.setPriority(Resource::Priority::Low); styleResource.setUsage(Resource::Usage::Offline); - ensureResource(std::move(styleResource), [&](Response styleResponse) { + ensureResource(std::move(styleResource), [&](const Response& styleResponse) { status.requiredResourceCountIsPrecise = true; style::Parser parser; @@ -258,7 +258,7 @@ void OfflineDownload::activateDownload() { sourceResource.setPriority(Resource::Priority::Low); sourceResource.setUsage(Resource::Usage::Offline); - ensureResource(std::move(sourceResource), [=](Response sourceResponse) { + ensureResource(std::move(sourceResource), [=](const Response& sourceResponse) { style::conversion::Error error; optional<Tileset> tileset = style::conversion::convertJSON<Tileset>(*sourceResponse.data, error); if (tileset) { @@ -275,45 +275,45 @@ void OfflineDownload::activateDownload() { }; switch (type) { - case SourceType::Vector: { - const auto& vectorSource = *source->as<VectorSource>(); - handleTiledSource(vectorSource.getURLOrTileset(), util::tileSize); - break; - } + case SourceType::Vector: { + const auto& vectorSource = *source->as<VectorSource>(); + handleTiledSource(vectorSource.getURLOrTileset(), util::tileSize); + break; + } - case SourceType::Raster: { - const auto& rasterSource = *source->as<RasterSource>(); - handleTiledSource(rasterSource.getURLOrTileset(), rasterSource.getTileSize()); - break; - } + case SourceType::Raster: { + const auto& rasterSource = *source->as<RasterSource>(); + handleTiledSource(rasterSource.getURLOrTileset(), rasterSource.getTileSize()); + break; + } - case SourceType::RasterDEM: { - const auto& rasterDEMSource = *source->as<RasterDEMSource>(); - handleTiledSource(rasterDEMSource.getURLOrTileset(), rasterDEMSource.getTileSize()); - break; - } + case SourceType::RasterDEM: { + const auto& rasterDEMSource = *source->as<RasterDEMSource>(); + handleTiledSource(rasterDEMSource.getURLOrTileset(), rasterDEMSource.getTileSize()); + break; + } - case SourceType::GeoJSON: { - const auto& geojsonSource = *source->as<GeoJSONSource>(); - if (geojsonSource.getURL()) { - queueResource(Resource::source(*geojsonSource.getURL())); + case SourceType::GeoJSON: { + const auto& geojsonSource = *source->as<GeoJSONSource>(); + if (geojsonSource.getURL()) { + queueResource(Resource::source(*geojsonSource.getURL())); + } + break; } - break; - } - case SourceType::Image: { - const auto& imageSource = *source->as<ImageSource>(); - auto imageUrl = imageSource.getURL(); - if (imageUrl && !imageUrl->empty()) { - queueResource(Resource::image(*imageUrl)); + case SourceType::Image: { + const auto& imageSource = *source->as<ImageSource>(); + auto imageUrl = imageSource.getURL(); + if (imageUrl && !imageUrl->empty()) { + queueResource(Resource::image(*imageUrl)); + } + break; } - break; - } - case SourceType::Video: - case SourceType::Annotations: - case SourceType::CustomVector: - break; + case SourceType::Video: + case SourceType::Annotations: + case SourceType::CustomVector: + break; } } @@ -481,7 +481,7 @@ void OfflineDownload::ensureResource(Resource&& resource, } auto fileRequestsIt = requests.insert(requests.begin(), nullptr); - *fileRequestsIt = onlineFileSource.request(resource, [=](Response onlineResponse) { + *fileRequestsIt = onlineFileSource.request(resource, [=](const Response& onlineResponse) { if (onlineResponse.error) { observer->responseError(*onlineResponse.error); if (onlineResponse.error->reason == Response::Error::Reason::NotFound) { diff --git a/platform/default/src/mbgl/storage/online_file_source.cpp b/platform/default/src/mbgl/storage/online_file_source.cpp index f578eb1479..6dc4de0ac7 100644 --- a/platform/default/src/mbgl/storage/online_file_source.cpp +++ b/platform/default/src/mbgl/storage/online_file_source.cpp @@ -24,6 +24,7 @@ #include <cassert> #include <list> #include <map> +#include <utility> namespace mbgl { @@ -77,7 +78,7 @@ public: ~OnlineFileSourceThread() { NetworkStatus::Unsubscribe(&reachability); } - void request(AsyncRequest* req, Resource resource, ActorRef<FileSourceRequest> ref) { + void request(AsyncRequest* req, Resource resource, const ActorRef<FileSourceRequest>& ref) { auto callback = [ref](const Response& res) { ref.invoke(&FileSourceRequest::setResponse, res); }; tasks[req] = std::make_unique<OnlineFileRequest>(std::move(resource), std::move(callback), *this); } @@ -127,7 +128,7 @@ public: void queueRequest(OnlineFileRequest* req) { pendingRequests.insert(req); } void activateRequest(OnlineFileRequest* req) { - auto callback = [=](Response response) { + auto callback = [=](const Response& response) { activeRequests.erase(req); req->request.reset(); req->completed(response); @@ -439,7 +440,7 @@ void OnlineFileRequest::schedule(optional<Timestamp> expires) { // If we're not being asked for a forced refresh, calculate a timeout that depends on how many // consecutive errors we've encountered, and on the expiration time, if present. Duration timeout = std::min(http::errorRetryTimeout(failedRequestReason, failedRequests, retryAfter), - http::expirationTimeout(expires, expiredRequests)); + http::expirationTimeout(std::move(expires), expiredRequests)); if (timeout == Duration::max()) { return; diff --git a/platform/default/src/mbgl/text/bidi.cpp b/platform/default/src/mbgl/text/bidi.cpp index 6bb2d36446..af3ac80881 100644 --- a/platform/default/src/mbgl/text/bidi.cpp +++ b/platform/default/src/mbgl/text/bidi.cpp @@ -5,6 +5,7 @@ #include <unicode/ushape.h> #include <memory> +#include <utility> namespace mbgl { @@ -98,7 +99,7 @@ std::vector<std::u16string> BiDi::processText(const std::u16string& input, throw std::runtime_error(std::string("BiDi::processText: ") + u_errorName(errorCode)); } - return applyLineBreaking(lineBreakPoints); + return applyLineBreaking(std::move(lineBreakPoints)); } std::vector<StyledText> BiDi::processStyledText(const StyledText& input, std::set<std::size_t> lineBreakPoints) { diff --git a/platform/default/src/mbgl/text/local_glyph_rasterizer.cpp b/platform/default/src/mbgl/text/local_glyph_rasterizer.cpp index 7866f29420..6eea2f94d8 100644 --- a/platform/default/src/mbgl/text/local_glyph_rasterizer.cpp +++ b/platform/default/src/mbgl/text/local_glyph_rasterizer.cpp @@ -5,8 +5,7 @@ namespace mbgl { class LocalGlyphRasterizer::Impl { }; -LocalGlyphRasterizer::LocalGlyphRasterizer(const optional<std::string>) -{} +LocalGlyphRasterizer::LocalGlyphRasterizer(const optional<std::string>&) {} LocalGlyphRasterizer::~LocalGlyphRasterizer() {} |