diff options
25 files changed, 49 insertions, 50 deletions
diff --git a/include/mbgl/style/conversion/property_setter.hpp b/include/mbgl/style/conversion/property_setter.hpp index 1f537f3c4d..8658fd60b0 100644 --- a/include/mbgl/style/conversion/property_setter.hpp +++ b/include/mbgl/style/conversion/property_setter.hpp @@ -21,7 +21,7 @@ using PaintPropertySetter = optional<Error> (*) (Layer&, const V&, const optiona template <class V, class L, class PropertyValue, void (L::*setter)(PropertyValue)> optional<Error> setLayoutProperty(Layer& layer, const V& value) { - L* typedLayer = layer.as<L>(); + auto* typedLayer = layer.as<L>(); if (!typedLayer) { return Error { "layer doesn't support this property" }; } @@ -38,7 +38,7 @@ optional<Error> setLayoutProperty(Layer& layer, const V& value) { template <class V, class L, class PropertyValue, void (L::*setter)(PropertyValue, const optional<std::string>&)> optional<Error> setPaintProperty(Layer& layer, const V& value, const optional<std::string>& klass) { - L* typedLayer = layer.as<L>(); + auto* typedLayer = layer.as<L>(); if (!typedLayer) { return Error { "layer doesn't support this property" }; } @@ -55,7 +55,7 @@ optional<Error> setPaintProperty(Layer& layer, const V& value, const optional<st template <class V, class L, void (L::*setter)(const TransitionOptions&, const optional<std::string>&)> optional<Error> setTransition(Layer& layer, const V& value, const optional<std::string>& klass) { - L* typedLayer = layer.as<L>(); + auto* typedLayer = layer.as<L>(); if (!typedLayer) { return Error { "layer doesn't support this property" }; } diff --git a/platform/default/async_task.cpp b/platform/default/async_task.cpp index 5fa9db8d33..50891056d8 100644 --- a/platform/default/async_task.cpp +++ b/platform/default/async_task.cpp @@ -16,7 +16,7 @@ public: : async(new uv_async_t), task(std::move(fn)) { - uv_loop_t* loop = reinterpret_cast<uv_loop_t*>(RunLoop::getLoopHandle()); + auto* loop = reinterpret_cast<uv_loop_t*>(RunLoop::getLoopHandle()); if (uv_async_init(loop, async, asyncCallback) != 0) { throw std::runtime_error("Failed to initialize async."); } diff --git a/platform/default/image.cpp b/platform/default/image.cpp index ad9d83a08d..447c6bcd66 100644 --- a/platform/default/image.cpp +++ b/platform/default/image.cpp @@ -12,7 +12,7 @@ PremultipliedImage decodePNG(const uint8_t*, size_t); PremultipliedImage decodeJPEG(const uint8_t*, size_t); PremultipliedImage decodeImage(const std::string& string) { - const uint8_t* data = reinterpret_cast<const uint8_t*>(string.data()); + const auto* data = reinterpret_cast<const uint8_t*>(string.data()); const size_t size = string.size(); #if !defined(__ANDROID__) && !defined(__APPLE__) diff --git a/platform/default/jpeg_reader.cpp b/platform/default/jpeg_reader.cpp index c5e9d880c0..5f613f9423 100644 --- a/platform/default/jpeg_reader.cpp +++ b/platform/default/jpeg_reader.cpp @@ -21,12 +21,12 @@ struct jpeg_stream_wrapper { }; static void init_source(j_decompress_ptr cinfo) { - jpeg_stream_wrapper* wrap = reinterpret_cast<jpeg_stream_wrapper*>(cinfo->src); + auto* wrap = reinterpret_cast<jpeg_stream_wrapper*>(cinfo->src); wrap->stream->seekg(0, std::ios_base::beg); } static boolean fill_input_buffer(j_decompress_ptr cinfo) { - jpeg_stream_wrapper* wrap = reinterpret_cast<jpeg_stream_wrapper*>(cinfo->src); + auto* wrap = reinterpret_cast<jpeg_stream_wrapper*>(cinfo->src); wrap->stream->read(reinterpret_cast<char*>(&wrap->buffer[0]), BUF_SIZE); std::streamsize size = wrap->stream->gcount(); wrap->manager.next_input_byte = wrap->buffer.data(); @@ -36,7 +36,7 @@ static boolean fill_input_buffer(j_decompress_ptr cinfo) { static void skip(j_decompress_ptr cinfo, long count) { if (count <= 0) return; // A zero or negative skip count should be treated as a no-op. - jpeg_stream_wrapper* wrap = reinterpret_cast<jpeg_stream_wrapper*>(cinfo->src); + auto* wrap = reinterpret_cast<jpeg_stream_wrapper*>(cinfo->src); if (wrap->manager.bytes_in_buffer > 0 && count < static_cast<long>(wrap->manager.bytes_in_buffer)) { @@ -59,7 +59,7 @@ static void attach_stream(j_decompress_ptr cinfo, std::istream* in) { cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(jpeg_stream_wrapper)); } - jpeg_stream_wrapper * src = reinterpret_cast<jpeg_stream_wrapper*> (cinfo->src); + auto * src = reinterpret_cast<jpeg_stream_wrapper*> (cinfo->src); src->manager.init_source = init_source; src->manager.fill_input_buffer = fill_input_buffer; src->manager.skip_input_data = skip; diff --git a/platform/default/mbgl/storage/offline_download.cpp b/platform/default/mbgl/storage/offline_download.cpp index 901f996a4f..5a487b3534 100644 --- a/platform/default/mbgl/storage/offline_download.cpp +++ b/platform/default/mbgl/storage/offline_download.cpp @@ -76,8 +76,7 @@ OfflineRegionStatus OfflineDownload::getStatus() const { switch (type) { case SourceType::Vector: case SourceType::Raster: { - style::TileSourceImpl* tileSource = - static_cast<style::TileSourceImpl*>(source->baseImpl.get()); + auto* tileSource = static_cast<style::TileSourceImpl*>(source->baseImpl.get()); const variant<std::string, Tileset>& urlOrTileset = tileSource->getURLOrTileset(); const uint16_t tileSize = tileSource->getTileSize(); @@ -86,7 +85,7 @@ OfflineRegionStatus OfflineDownload::getStatus() const { definition.tileCover(type, tileSize, urlOrTileset.get<Tileset>().zoomRange).size(); } else { result.requiredResourceCount += 1; - const std::string& url = urlOrTileset.get<std::string>(); + const auto& url = urlOrTileset.get<std::string>(); optional<Response> sourceResponse = offlineDatabase.get(Resource::source(url)); if (sourceResponse) { style::conversion::Error error; @@ -103,7 +102,7 @@ OfflineRegionStatus OfflineDownload::getStatus() const { } case SourceType::GeoJSON: { - style::GeoJSONSource* geojsonSource = source->as<style::GeoJSONSource>(); + auto* geojsonSource = source->as<style::GeoJSONSource>(); if (geojsonSource->getURL()) { result.requiredResourceCount += 1; } @@ -151,7 +150,7 @@ void OfflineDownload::activateDownload() { if (urlOrTileset.is<Tileset>()) { queueTiles(type, tileSize, urlOrTileset.get<Tileset>()); } else { - const std::string& url = urlOrTileset.get<std::string>(); + const auto& url = urlOrTileset.get<std::string>(); status.requiredResourceCountIsPrecise = false; status.requiredResourceCount++; requiredSourceURLs.insert(url); @@ -174,7 +173,7 @@ void OfflineDownload::activateDownload() { } case SourceType::GeoJSON: { - style::GeoJSONSource::Impl* geojsonSource = + auto* geojsonSource = static_cast<style::GeoJSONSource::Impl*>(source->baseImpl.get()); if (geojsonSource->getURL()) { diff --git a/platform/default/png_reader.cpp b/platform/default/png_reader.cpp index 29ef3058e1..4d4ee29d1f 100644 --- a/platform/default/png_reader.cpp +++ b/platform/default/png_reader.cpp @@ -40,7 +40,7 @@ static void user_warning_fn(png_structp, png_const_charp warning_msg) { } static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { - std::istream* fin = reinterpret_cast<std::istream*>(png_get_io_ptr(png_ptr)); + auto* fin = reinterpret_cast<std::istream*>(png_get_io_ptr(png_ptr)); fin->read(reinterpret_cast<char*>(data), length); std::streamsize read_count = fin->gcount(); if (read_count < 0 || static_cast<png_size_t>(read_count) != length) diff --git a/platform/default/sqlite3.cpp b/platform/default/sqlite3.cpp index 304d5e9aba..4cbe1df775 100644 --- a/platform/default/sqlite3.cpp +++ b/platform/default/sqlite3.cpp @@ -314,7 +314,7 @@ template <> std::string Statement::get(int offset) { template <> std::vector<uint8_t> Statement::get(int offset) { assert(impl); - const uint8_t* begin = reinterpret_cast<const uint8_t*>(sqlite3_column_blob(impl->stmt, offset)); + const auto* begin = reinterpret_cast<const uint8_t*>(sqlite3_column_blob(impl->stmt, offset)); const uint8_t* end = begin + sqlite3_column_bytes(impl->stmt, offset); return { begin, end }; } diff --git a/platform/default/timer.cpp b/platform/default/timer.cpp index cd0e6da6aa..90a85bfc1f 100644 --- a/platform/default/timer.cpp +++ b/platform/default/timer.cpp @@ -10,7 +10,7 @@ namespace util { class Timer::Impl { public: Impl() : timer(new uv_timer_t) { - uv_loop_t* loop = reinterpret_cast<uv_loop_t*>(RunLoop::getLoopHandle()); + auto* loop = reinterpret_cast<uv_loop_t*>(RunLoop::getLoopHandle()); if (uv_timer_init(loop, timer) != 0) { throw std::runtime_error("Failed to initialize timer."); } diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index 31b0b92c58..1be38e5e4a 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -145,7 +145,7 @@ void GLFWView::bind() { } void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, int mods) { - GLFWView *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); + auto *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); if (action == GLFW_RELEASE) { switch (key) { @@ -356,7 +356,7 @@ void GLFWView::popAnnotation() { } void GLFWView::onScroll(GLFWwindow *window, double /*xOffset*/, double yOffset) { - GLFWView *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); + auto *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); double delta = yOffset * 40; bool isWheel = delta != 0 && std::fmod(delta, 4.000244140625) == 0; @@ -378,14 +378,14 @@ void GLFWView::onScroll(GLFWwindow *window, double /*xOffset*/, double yOffset) } void GLFWView::onWindowResize(GLFWwindow *window, int width, int height) { - GLFWView *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); + auto *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); view->width = width; view->height = height; view->map->setSize({ static_cast<uint32_t>(view->width), static_cast<uint32_t>(view->height) }); } void GLFWView::onFramebufferResize(GLFWwindow *window, int width, int height) { - GLFWView *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); + auto *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); view->fbWidth = width; view->fbHeight = height; view->bind(); @@ -398,7 +398,7 @@ void GLFWView::onFramebufferResize(GLFWwindow *window, int width, int height) { } void GLFWView::onMouseClick(GLFWwindow *window, int button, int action, int modifiers) { - GLFWView *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); + auto *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); if (button == GLFW_MOUSE_BUTTON_RIGHT || (button == GLFW_MOUSE_BUTTON_LEFT && modifiers & GLFW_MOD_CONTROL)) { @@ -426,7 +426,7 @@ void GLFWView::onMouseClick(GLFWwindow *window, int button, int action, int modi } void GLFWView::onMouseMove(GLFWwindow *window, double x, double y) { - GLFWView *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); + auto *view = reinterpret_cast<GLFWView *>(glfwGetWindowUserPointer(window)); if (view->tracking) { double dx = x - view->lastX; double dy = y - view->lastY; diff --git a/platform/linux/src/headless_backend_glx.cpp b/platform/linux/src/headless_backend_glx.cpp index 36a60ec06b..1c1592ac75 100644 --- a/platform/linux/src/headless_backend_glx.cpp +++ b/platform/linux/src/headless_backend_glx.cpp @@ -58,8 +58,8 @@ bool HeadlessBackend::hasDisplay() { void HeadlessBackend::createContext() { assert(!hasContext()); - Display* xDisplay = display->attribute<Display*>(); - GLXFBConfig* fbConfigs = display->attribute<GLXFBConfig*>(); + auto* xDisplay = display->attribute<Display*>(); + auto* fbConfigs = display->attribute<GLXFBConfig*>(); // Try to create a legacy context. GLXContext glContext = glXCreateNewContext(xDisplay, fbConfigs[0], GLX_RGBA_TYPE, None, True); diff --git a/platform/linux/src/headless_display_glx.cpp b/platform/linux/src/headless_display_glx.cpp index 4275ebb646..963a5234cb 100644 --- a/platform/linux/src/headless_display_glx.cpp +++ b/platform/linux/src/headless_display_glx.cpp @@ -27,7 +27,7 @@ HeadlessDisplay::Impl::Impl() { throw std::runtime_error("Failed to open X display."); } - const char *extensions = reinterpret_cast<const char *>(glXQueryServerString(xDisplay, DefaultScreen(xDisplay), GLX_EXTENSIONS)); + const auto *extensions = reinterpret_cast<const char *>(glXQueryServerString(xDisplay, DefaultScreen(xDisplay), GLX_EXTENSIONS)); if (!extensions) { throw std::runtime_error("Cannot read GLX extensions."); } diff --git a/src/mbgl/annotation/fill_annotation_impl.cpp b/src/mbgl/annotation/fill_annotation_impl.cpp index 3e91524e86..484870c45c 100644 --- a/src/mbgl/annotation/fill_annotation_impl.cpp +++ b/src/mbgl/annotation/fill_annotation_impl.cpp @@ -21,7 +21,7 @@ void FillAnnotationImpl::updateStyle(Style& style) const { layer = style.addLayer(std::move(newLayer), AnnotationManager::PointLayerID); } - FillLayer* fillLayer = layer->as<FillLayer>(); + auto* fillLayer = layer->as<FillLayer>(); fillLayer->setFillOpacity(annotation.opacity); fillLayer->setFillColor(annotation.color); fillLayer->setFillOutlineColor(annotation.outlineColor); diff --git a/src/mbgl/annotation/line_annotation_impl.cpp b/src/mbgl/annotation/line_annotation_impl.cpp index 15fa2c67f3..65379c42a8 100644 --- a/src/mbgl/annotation/line_annotation_impl.cpp +++ b/src/mbgl/annotation/line_annotation_impl.cpp @@ -22,7 +22,7 @@ void LineAnnotationImpl::updateStyle(Style& style) const { layer = style.addLayer(std::move(newLayer), AnnotationManager::PointLayerID); } - LineLayer* lineLayer = layer->as<LineLayer>(); + auto* lineLayer = layer->as<LineLayer>(); lineLayer->setLineOpacity(annotation.opacity); lineLayer->setLineWidth(annotation.width); lineLayer->setLineColor(annotation.color); diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 3ab1260d27..6a68c3ff69 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -45,7 +45,7 @@ Context::~Context() { } void Context::initializeExtensions(const std::function<gl::ProcAddress(const char*)>& getProcAddress) { - if (const char* extensions = + if (const auto* extensions = reinterpret_cast<const char*>(MBGL_CHECK_ERROR(glGetString(GL_EXTENSIONS)))) { auto fn = [&]( @@ -94,7 +94,7 @@ UniqueShader Context::createShader(ShaderType type, const std::string& source) { UniqueShader result { MBGL_CHECK_ERROR(glCreateShader(static_cast<GLenum>(type))), { this } }; const GLchar* sources = source.data(); - const GLsizei lengths = static_cast<GLsizei>(source.length()); + const auto lengths = static_cast<GLsizei>(source.length()); MBGL_CHECK_ERROR(glShaderSource(result, 1, &sources, &lengths)); MBGL_CHECK_ERROR(glCompileShader(result)); diff --git a/src/mbgl/renderer/line_bucket.cpp b/src/mbgl/renderer/line_bucket.cpp index 7bb4e2f202..f322ba4614 100644 --- a/src/mbgl/renderer/line_bucket.cpp +++ b/src/mbgl/renderer/line_bucket.cpp @@ -183,7 +183,7 @@ void LineBucket::addGeometry(const GeometryCoordinates& coordinates, FeatureType const bool isSharpCorner = cosHalfAngle < COS_HALF_SHARP_CORNER && prevCoordinate && nextCoordinate; if (isSharpCorner && i > first) { - const double prevSegmentLength = util::dist<double>(*currentCoordinate, *prevCoordinate); + const auto prevSegmentLength = util::dist<double>(*currentCoordinate, *prevCoordinate); if (prevSegmentLength > 2.0 * sharpCornerOffset) { GeometryCoordinate newPrevVertex = *currentCoordinate - convertPoint<int16_t>(util::round(convertPoint<double>(*currentCoordinate - *prevCoordinate) * (sharpCornerOffset / prevSegmentLength))); distance += util::dist<double>(newPrevVertex, *prevCoordinate); @@ -356,7 +356,7 @@ void LineBucket::addGeometry(const GeometryCoordinates& coordinates, FeatureType } if (isSharpCorner && i < len - 1) { - const double nextSegmentLength = util::dist<double>(*currentCoordinate, *nextCoordinate); + const auto nextSegmentLength = util::dist<double>(*currentCoordinate, *nextCoordinate); if (nextSegmentLength > 2 * sharpCornerOffset) { GeometryCoordinate newCurrentVertex = *currentCoordinate + convertPoint<int16_t>(util::round(convertPoint<double>(*nextCoordinate - *currentCoordinate) * (sharpCornerOffset / nextSegmentLength))); distance += util::dist<double>(newCurrentVertex, *currentCoordinate); 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))); diff --git a/src/mbgl/text/collision_feature.cpp b/src/mbgl/text/collision_feature.cpp index 885ba5c426..71d7cc74e0 100644 --- a/src/mbgl/text/collision_feature.cpp +++ b/src/mbgl/text/collision_feature.cpp @@ -71,7 +71,7 @@ void CollisionFeature::bboxifyLabel(const GeometryCoordinates& line, GeometryCoo p = line[index]; } while (anchorDistance > -labelLength / 2); - float segmentLength = util::dist<float>(line[index], line[index + 1]); + auto segmentLength = util::dist<float>(line[index], line[index + 1]); for (unsigned int i = 0; i < nBoxes; i++) { // the distance the box will be from the anchor diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp index 82702b20f0..d41faf2a71 100644 --- a/src/mbgl/text/get_anchors.cpp +++ b/src/mbgl/text/get_anchors.cpp @@ -34,7 +34,7 @@ static Anchors resample(const GeometryCoordinates& line, const GeometryCoordinate& a = *(it); const GeometryCoordinate& b = *(it + 1); - const float segmentDist = util::dist<float>(a, b); + const auto segmentDist = util::dist<float>(a, b); const float angle = util::angle_to(b, a); while (markedDistance + spacing < distance + segmentDist) { diff --git a/src/mbgl/text/quads.cpp b/src/mbgl/text/quads.cpp index e1a9699835..02236b1b89 100644 --- a/src/mbgl/text/quads.cpp +++ b/src/mbgl/text/quads.cpp @@ -177,7 +177,7 @@ inline Point<float> getVirtualSegmentAnchor(const Point<float>& segmentBegin, co inline float getMinScaleForSegment(const float glyphDistanceFromAnchor, const Point<float>& segmentAnchor, const Point<float>& segmentEnd) { - const float distanceFromAnchorToEnd = util::dist<float>(segmentAnchor, segmentEnd); + const auto distanceFromAnchorToEnd = util::dist<float>(segmentAnchor, segmentEnd); return glyphDistanceFromAnchor / distanceFromAnchorToEnd; } diff --git a/src/mbgl/tile/vector_tile.cpp b/src/mbgl/tile/vector_tile.cpp index 46914e5f5a..d22617dd07 100644 --- a/src/mbgl/tile/vector_tile.cpp +++ b/src/mbgl/tile/vector_tile.cpp @@ -162,7 +162,7 @@ optional<Value> VectorTileFeature::getValue(const std::string& key) const { auto start_itr = tags_iter.begin(); const auto & end_itr = tags_iter.end(); while (start_itr != end_itr) { - uint32_t tag_key = static_cast<uint32_t>(*start_itr++); + auto tag_key = static_cast<uint32_t>(*start_itr++); if (layerData->keysMap.size() <= tag_key) { throw std::runtime_error("feature referenced out of range key"); @@ -172,7 +172,7 @@ optional<Value> VectorTileFeature::getValue(const std::string& key) const { throw std::runtime_error("uneven number of feature tag ids"); } - uint32_t tag_val = static_cast<uint32_t>(*start_itr++);; + auto tag_val = static_cast<uint32_t>(*start_itr++);; if (layerData->values.size() <= tag_val) { throw std::runtime_error("feature referenced out of range value"); } @@ -190,11 +190,11 @@ std::unordered_map<std::string,Value> VectorTileFeature::getProperties() const { auto start_itr = tags_iter.begin(); const auto & end_itr = tags_iter.end(); while (start_itr != end_itr) { - uint32_t tag_key = static_cast<uint32_t>(*start_itr++); + auto tag_key = static_cast<uint32_t>(*start_itr++); if (start_itr == end_itr) { throw std::runtime_error("uneven number of feature tag ids"); } - uint32_t tag_val = static_cast<uint32_t>(*start_itr++); + auto tag_val = static_cast<uint32_t>(*start_itr++); properties[layerData->keys.at(tag_key)] = layerData->values.at(tag_val); } return properties; @@ -219,7 +219,7 @@ GeometryCollection VectorTileFeature::getGeometries() const { auto g_itr = geometry_iter.begin(); while (g_itr != geometry_iter.end()) { if (length == 0) { - uint32_t cmd_length = static_cast<uint32_t>(*g_itr++); + auto cmd_length = static_cast<uint32_t>(*g_itr++); cmd = cmd_length & 0x7; length = cmd_length >> 3; } diff --git a/src/mbgl/util/intersection_tests.cpp b/src/mbgl/util/intersection_tests.cpp index c580357298..e6ce245c0e 100644 --- a/src/mbgl/util/intersection_tests.cpp +++ b/src/mbgl/util/intersection_tests.cpp @@ -19,7 +19,7 @@ bool polygonContainsPoint(const GeometryCoordinates& ring, const GeometryCoordin // Code from http://stackoverflow.com/a/1501725/331379. float distToSegmentSquared(const GeometryCoordinate& p, const GeometryCoordinate& v, const GeometryCoordinate& w) { if (v == w) return util::distSqr<float>(p, v); - const float l2 = util::distSqr<float>(v, w); + const auto l2 = util::distSqr<float>(v, w); const float t = float((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2; if (t < 0) return util::distSqr<float>(p, v); if (t > 1) return util::distSqr<float>(p, w); diff --git a/src/mbgl/util/thread_local.hpp b/src/mbgl/util/thread_local.hpp index 9fddbd5bbc..15d4d56524 100644 --- a/src/mbgl/util/thread_local.hpp +++ b/src/mbgl/util/thread_local.hpp @@ -32,7 +32,7 @@ public: } T* get() { - T* ret = reinterpret_cast<T*>(pthread_getspecific(key)); + auto* ret = reinterpret_cast<T*>(pthread_getspecific(key)); if (!ret) { return nullptr; } |