diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-05-10 18:51:04 +0300 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-05-12 18:07:36 +0300 |
commit | fa36110dfbdc05b511a3f85461eaca4a29e446a1 (patch) | |
tree | 284bd9a9eca229c026e531bbce1a9f0dd6ba089d /src/mbgl/style | |
parent | f709d7b0557d3e6d652d9b7d8380f1380962a327 (diff) | |
download | qtlocation-mapboxgl-fa36110dfbdc05b511a3f85461eaca4a29e446a1.tar.gz |
[tidy] modernize-use-auto
Diffstat (limited to 'src/mbgl/style')
-rw-r--r-- | src/mbgl/style/class_dictionary.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/function/identity_stops.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/style/style.cpp | 6 | ||||
-rw-r--r-- | src/mbgl/style/tile_source_impl.cpp | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/src/mbgl/style/class_dictionary.cpp b/src/mbgl/style/class_dictionary.cpp index ec06ee7d9d..6860044dbd 100644 --- a/src/mbgl/style/class_dictionary.cpp +++ b/src/mbgl/style/class_dictionary.cpp @@ -18,7 +18,7 @@ ClassDictionary &ClassDictionary::Get() { }); }); - ClassDictionary *ptr = reinterpret_cast<ClassDictionary *>(pthread_getspecific(store_key)); + auto *ptr = reinterpret_cast<ClassDictionary *>(pthread_getspecific(store_key)); if (ptr == nullptr) { ptr = new ClassDictionary(); pthread_setspecific(store_key, ptr); @@ -31,7 +31,7 @@ ClassID ClassDictionary::lookup(const std::string &class_name) { auto it = store.find(class_name); if (it == store.end()) { // Insert the class name into the store. - ClassID id = ClassID(uint32_t(ClassID::Named) + offset++); + auto id = ClassID(uint32_t(ClassID::Named) + offset++); store.emplace(class_name, id); return id; } else { diff --git a/src/mbgl/style/function/identity_stops.cpp b/src/mbgl/style/function/identity_stops.cpp index 4c9d01d086..0c6891eac5 100644 --- a/src/mbgl/style/function/identity_stops.cpp +++ b/src/mbgl/style/function/identity_stops.cpp @@ -46,7 +46,7 @@ optional<std::array<float, 2>> IdentityStops<std::array<float, 2>>::evaluate(con return {}; } - const std::vector<Value>& vector = value.get<std::vector<Value>>(); + const auto& vector = value.get<std::vector<Value>>(); if (vector.size() != 2 || !numericValue<float>(vector[0]) || !numericValue<float>(vector[1])) { return {}; } diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index f083ca47b8..97d30b2494 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -87,7 +87,7 @@ Style::~Style() { } for (const auto& layer : layers) { - if (CustomLayer* customLayer = layer->as<CustomLayer>()) { + if (auto* customLayer = layer->as<CustomLayer>()) { customLayer->impl->deinitialize(); } } @@ -258,7 +258,7 @@ Layer* Style::addLayer(std::unique_ptr<Layer> layer, optional<std::string> befor throw std::runtime_error(std::string{"Layer "} + layer->getID() + " already exists"); } - if (CustomLayer* customLayer = layer->as<CustomLayer>()) { + if (auto* customLayer = layer->as<CustomLayer>()) { customLayer->impl->initialize(); } @@ -280,7 +280,7 @@ std::unique_ptr<Layer> Style::removeLayer(const std::string& id) { auto layer = std::move(*it); - if (CustomLayer* customLayer = layer->as<CustomLayer>()) { + if (auto* customLayer = layer->as<CustomLayer>()) { customLayer->impl->deinitialize(); } diff --git a/src/mbgl/style/tile_source_impl.cpp b/src/mbgl/style/tile_source_impl.cpp index d2ce3def9f..4d47221da9 100644 --- a/src/mbgl/style/tile_source_impl.cpp +++ b/src/mbgl/style/tile_source_impl.cpp @@ -29,7 +29,7 @@ void TileSourceImpl::loadDescription(FileSource& fileSource) { return; } - const std::string& url = urlOrTileset.get<std::string>(); + const auto& url = urlOrTileset.get<std::string>(); req = fileSource.request(Resource::source(url), [this, url](Response res) { if (res.error) { observer->onSourceError(base, std::make_exception_ptr(std::runtime_error(res.error->message))); |