From 214f99673f6f7480f9cc3bf9d6fa32ef8dd2ede5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 18:06:11 +0200 Subject: fix variable shadowing --- Makefile | 2 +- common/glfw_view.cpp | 2 +- include/csscolorparser/csscolorparser.hpp | 4 +-- include/mbgl/geometry/anchor.hpp | 8 ++--- include/mbgl/geometry/elements_buffer.hpp | 6 ++-- include/mbgl/geometry/geometry.hpp | 4 +-- include/mbgl/geometry/glyph_atlas.hpp | 4 +-- include/mbgl/map/tile.hpp | 4 +-- include/mbgl/map/view.hpp | 4 +-- include/mbgl/renderer/frame_history.hpp | 2 +- include/mbgl/renderer/painter.hpp | 8 ++--- include/mbgl/style/class_properties.hpp | 4 +-- include/mbgl/style/filter_comparison.hpp | 6 ++-- include/mbgl/style/filter_expression.hpp | 2 +- include/mbgl/style/function_properties.hpp | 6 ++-- include/mbgl/style/style_source.hpp | 4 +-- include/mbgl/text/collision.hpp | 1 + include/mbgl/text/glyph.hpp | 10 +++--- include/mbgl/text/types.hpp | 56 +++++++++++++++--------------- include/mbgl/util/enum.hpp | 8 ++--- include/mbgl/util/error.hpp | 2 +- include/mbgl/util/pbf.hpp | 6 ++-- include/mbgl/util/rect.hpp | 2 +- include/mbgl/util/transition.hpp | 20 +++++------ include/mbgl/util/uv_detail.hpp | 16 ++++----- include/mbgl/util/vec.hpp | 6 ++-- src/clipper/clipper.cpp | 2 +- src/geometry/debug_font.cpp | 8 ++--- src/geometry/glyph_atlas.cpp | 10 +++--- src/geometry/sprite_atlas.cpp | 12 +++---- src/map/map.cpp | 9 ++--- src/map/source.cpp | 10 +++--- src/map/sprite.cpp | 28 +++++++-------- src/map/tile.cpp | 4 +-- src/map/tile_data.cpp | 10 +++--- src/map/tile_parser.cpp | 4 +-- src/map/transform.cpp | 2 +- src/map/transform_state.cpp | 4 +-- src/map/vector_tile.cpp | 12 +++---- src/renderer/debug_bucket.cpp | 4 +-- src/renderer/fill_bucket.cpp | 28 +++++++-------- src/renderer/line_bucket.cpp | 24 ++++++------- src/renderer/painter.cpp | 4 +-- src/renderer/prerendered_texture.cpp | 4 +-- src/renderer/raster_bucket.cpp | 10 +++--- src/renderer/symbol_bucket.cpp | 14 ++++---- src/shader/shader.cpp | 4 +-- src/storage/http_request.cpp | 14 ++++---- src/storage/sqlite_store.cpp | 4 +-- src/style/applied_class_properties.cpp | 8 ++--- src/style/style_layer.cpp | 18 +++++----- src/style/style_parser.cpp | 14 ++++---- src/text/collision.cpp | 6 ++-- src/text/glyph_store.cpp | 2 +- src/text/placement.cpp | 8 ++--- src/util/image.cpp | 8 ++--- src/util/raster.cpp | 30 ++++++++-------- src/util/timer.cpp | 20 +++++------ test/comparisons.cpp | 2 +- test/fixtures/fixture_log.hpp | 16 ++++----- 60 files changed, 276 insertions(+), 278 deletions(-) diff --git a/Makefile b/Makefile index 06b38ec34b..95a7d90f34 100644 --- a/Makefile +++ b/Makefile @@ -98,5 +98,5 @@ clean: clear_xcode_cache distclean: clean -rm -rf ./mason_packages -.PHONY: mbgl test linux build/test/Makefile +.PHONY: mbgl test linux build/test/Makefile clean distclean # DO NOT DELETE diff --git a/common/glfw_view.cpp b/common/glfw_view.cpp index 120faf4df1..53cd068d09 100644 --- a/common/glfw_view.cpp +++ b/common/glfw_view.cpp @@ -2,7 +2,7 @@ #include -GLFWView::GLFWView(bool fullscreen) : fullscreen(fullscreen) { +GLFWView::GLFWView(bool fullscreen_) : fullscreen(fullscreen_) { #ifdef NVIDIA glDiscardFramebufferEXT = (PFNGLDISCARDFRAMEBUFFEREXTPROC)glfwGetProcAddress("glDiscardFramebufferEXT"); #endif diff --git a/include/csscolorparser/csscolorparser.hpp b/include/csscolorparser/csscolorparser.hpp index 1d074627f6..6caf796943 100644 --- a/include/csscolorparser/csscolorparser.hpp +++ b/include/csscolorparser/csscolorparser.hpp @@ -31,8 +31,8 @@ namespace CSSColorParser { struct Color { inline Color() {} - inline Color(unsigned char r, unsigned char g, unsigned char b, float a) - : r(r), g(g), b(b), a(a) {} + inline Color(unsigned char r_, unsigned char g_, unsigned char b_, float a_) + : r(r_), g(g_), b(b_), a(a_) {} unsigned char r = 0, g = 0, b = 0; float a = 1.0f; }; diff --git a/include/mbgl/geometry/anchor.hpp b/include/mbgl/geometry/anchor.hpp index ab006530ff..d30394f0b9 100644 --- a/include/mbgl/geometry/anchor.hpp +++ b/include/mbgl/geometry/anchor.hpp @@ -12,10 +12,10 @@ struct Anchor { float scale = 0.0f; int segment = -1; - explicit Anchor(float x, float y, float angle, float scale) - : x(x), y(y), angle(angle), scale(scale) {} - explicit Anchor(float x, float y, float angle, float scale, int segment) - : x(x), y(y), angle(angle), scale(scale), segment(segment) {} + explicit Anchor(float x_, float y_, float angle_, float scale_) + : x(x_), y(y_), angle(angle_), scale(scale_) {} + explicit Anchor(float x_, float y_, float angle_, float scale_, int segment_) + : x(x_), y(y_), angle(angle_), scale(scale_), segment(segment_) {} }; typedef std::vector Anchors; diff --git a/include/mbgl/geometry/elements_buffer.hpp b/include/mbgl/geometry/elements_buffer.hpp index 56080e29fe..045560f9aa 100644 --- a/include/mbgl/geometry/elements_buffer.hpp +++ b/include/mbgl/geometry/elements_buffer.hpp @@ -16,9 +16,9 @@ struct ElementGroup : public util::noncopyable { uint32_t elements_length; ElementGroup() : vertex_length(0), elements_length(0) {} - ElementGroup(uint32_t vertex_length, uint32_t elements_length) - : vertex_length(vertex_length), - elements_length(elements_length) { + ElementGroup(uint32_t vertex_length_, uint32_t elements_length_) + : vertex_length(vertex_length_), + elements_length(elements_length_) { } ElementGroup(ElementGroup &&rhs) noexcept diff --git a/include/mbgl/geometry/geometry.hpp b/include/mbgl/geometry/geometry.hpp index 961569204d..484d17b36d 100644 --- a/include/mbgl/geometry/geometry.hpp +++ b/include/mbgl/geometry/geometry.hpp @@ -30,8 +30,8 @@ private: int32_t ox, oy; }; -Geometry::Geometry(pbf& data) - : data(data), +Geometry::Geometry(pbf& data_) + : data(data_), cmd(1), length(0), x(0), y(0), diff --git a/include/mbgl/geometry/glyph_atlas.hpp b/include/mbgl/geometry/glyph_atlas.hpp index 336c4af284..5b09cbcd6d 100644 --- a/include/mbgl/geometry/glyph_atlas.hpp +++ b/include/mbgl/geometry/glyph_atlas.hpp @@ -18,8 +18,8 @@ public: private: struct GlyphValue { - GlyphValue(const Rect& rect, uint64_t id) - : rect(rect), ids({ id }) {} + GlyphValue(const Rect& rect_, uint64_t id) + : rect(rect_), ids({ id }) {} Rect rect; std::set ids; }; diff --git a/include/mbgl/map/tile.hpp b/include/mbgl/map/tile.hpp index b9f0556add..1ae13dd79d 100644 --- a/include/mbgl/map/tile.hpp +++ b/include/mbgl/map/tile.hpp @@ -37,8 +37,8 @@ public: const int8_t z = 0; const int32_t x = 0, y = 0; - inline explicit ID(int8_t z, int32_t x, int32_t y) - : w((x < 0 ? x - (1 << z) + 1 : x) / (1 << z)), z(z), x(x), y(y) {} + inline explicit ID(int8_t z_, int32_t x_, int32_t y_) + : w((x_ < 0 ? x_ - (1 << z_) + 1 : x_) / (1 << z_)), z(z_), x(x_), y(y_) {} inline uint64_t to_uint64() const { return ((std::pow(2, z) * y + x) * 32) + z; diff --git a/include/mbgl/map/view.hpp b/include/mbgl/map/view.hpp index b567cd424f..513c73b483 100644 --- a/include/mbgl/map/view.hpp +++ b/include/mbgl/map/view.hpp @@ -22,8 +22,8 @@ enum MapChange : uint8_t { class View { public: - virtual void initialize(Map *map) { - this->map = map; + virtual void initialize(Map *map_) { + map = map_; } // Called from the render (=GL) thread. Signals that the context should diff --git a/include/mbgl/renderer/frame_history.hpp b/include/mbgl/renderer/frame_history.hpp index b1f0bcb597..61bb59da33 100644 --- a/include/mbgl/renderer/frame_history.hpp +++ b/include/mbgl/renderer/frame_history.hpp @@ -11,7 +11,7 @@ namespace mbgl { struct FrameSnapshot { - explicit inline FrameSnapshot(timestamp t, float z) : t(t), z(z) {} + explicit inline FrameSnapshot(timestamp t_, float z_) : t(t_), z(z_) {} float t; float z; }; diff --git a/include/mbgl/renderer/painter.hpp b/include/mbgl/renderer/painter.hpp index 0f9bd79173..a8229a0978 100644 --- a/include/mbgl/renderer/painter.hpp +++ b/include/mbgl/renderer/painter.hpp @@ -154,10 +154,10 @@ public: // used to composite images and flips the geometry upside down const mat4 flipMatrix = []{ - mat4 flipMatrix; - matrix::ortho(flipMatrix, 0, 4096, -4096, 0, 0, 1); - matrix::translate(flipMatrix, flipMatrix, 0, -4096, 0); - return flipMatrix; + mat4 flip; + matrix::ortho(flip, 0, 4096, -4096, 0, 0, 1); + matrix::translate(flip, flip, 0, -4096, 0); + return flip; }(); const mat4 identityMatrix = []{ diff --git a/include/mbgl/style/class_properties.hpp b/include/mbgl/style/class_properties.hpp index 84b6f483bd..888a90c5d7 100644 --- a/include/mbgl/style/class_properties.hpp +++ b/include/mbgl/style/class_properties.hpp @@ -12,8 +12,8 @@ namespace mbgl { class ClassProperties { public: inline ClassProperties() {} - inline ClassProperties(ClassProperties &&properties) - : properties(std::move(properties.properties)) {} + inline ClassProperties(ClassProperties &&properties_) + : properties(std::move(properties_.properties)) {} inline void set(PropertyKey key, const PropertyValue &value) { properties.emplace(key, value); diff --git a/include/mbgl/style/filter_comparison.hpp b/include/mbgl/style/filter_comparison.hpp index bf48744f1e..1b0a9b5486 100644 --- a/include/mbgl/style/filter_comparison.hpp +++ b/include/mbgl/style/filter_comparison.hpp @@ -24,8 +24,8 @@ public: class Instance { public: - Instance(Operator op, std::vector &&values) - : op(op), values(values) {} + Instance(Operator op_, std::vector &&values_) + : op(op_), values(values_) {} bool compare(const std::vector &property_values) const; @@ -37,7 +37,7 @@ public: }; public: - FilterComparison(const std::string &field) : field(field) {}; + FilterComparison(const std::string &field_) : field(field_) {}; const std::string &getField() const; template inline bool compare(const Extractor &extractor) const; diff --git a/include/mbgl/style/filter_expression.hpp b/include/mbgl/style/filter_expression.hpp index 2a96578792..915d3931d1 100644 --- a/include/mbgl/style/filter_expression.hpp +++ b/include/mbgl/style/filter_expression.hpp @@ -28,7 +28,7 @@ public: public: FilterExpression() = default; - FilterExpression(Operator op) : op(op) {}; + FilterExpression(Operator op_) : op(op_) {}; bool empty() const; diff --git a/include/mbgl/style/function_properties.hpp b/include/mbgl/style/function_properties.hpp index 56092f9a63..924f192330 100644 --- a/include/mbgl/style/function_properties.hpp +++ b/include/mbgl/style/function_properties.hpp @@ -9,7 +9,7 @@ namespace mbgl { template struct ConstantFunction { - inline ConstantFunction(const T &value) : value(value) {} + inline ConstantFunction(const T &value_) : value(value_) {} inline T evaluate(float) const { return value; } private: @@ -18,7 +18,7 @@ private: template struct StopsFunction { - inline StopsFunction(const std::vector> &values, float base) : values(values), base(base) {} + inline StopsFunction(const std::vector> &values_, float base_) : values(values_), base(base_) {} T evaluate(float z) const; private: @@ -36,7 +36,7 @@ using Function = mapbox::util::variant< template struct FunctionEvaluator { typedef T result_type; - inline FunctionEvaluator(float z) : z(z) {} + inline FunctionEvaluator(float z_) : z(z_) {} inline result_type operator()(const std::false_type &) { return result_type(); diff --git a/include/mbgl/style/style_source.hpp b/include/mbgl/style/style_source.hpp index 00c48431a1..86473079cf 100644 --- a/include/mbgl/style/style_source.hpp +++ b/include/mbgl/style/style_source.hpp @@ -36,8 +36,8 @@ public: bool enabled = false; util::ptr source; - StyleSource(const util::ptr &info) - : info(info) + StyleSource(const util::ptr &info_) + : info(info_) {} }; diff --git a/include/mbgl/text/collision.hpp b/include/mbgl/text/collision.hpp index b7ee6b4520..dfefab689e 100644 --- a/include/mbgl/text/collision.hpp +++ b/include/mbgl/text/collision.hpp @@ -6,6 +6,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-variable" +#pragma GCC diagnostic ignored "-Wshadow" #ifdef __clang__ #pragma GCC diagnostic ignored "-Wdeprecated-register" #else diff --git a/include/mbgl/text/glyph.hpp b/include/mbgl/text/glyph.hpp index de7f55bdc6..4fbb75fc1e 100644 --- a/include/mbgl/text/glyph.hpp +++ b/include/mbgl/text/glyph.hpp @@ -30,9 +30,9 @@ struct GlyphMetrics { struct Glyph { inline explicit Glyph() : rect(0, 0, 0, 0), metrics() {} - inline explicit Glyph(const Rect &rect, - const GlyphMetrics &metrics) - : rect(rect), metrics(metrics) {} + inline explicit Glyph(const Rect &rect_, + const GlyphMetrics &metrics_) + : rect(rect_), metrics(metrics_) {} operator bool() const { return metrics || rect; @@ -46,8 +46,8 @@ typedef std::map GlyphPositions; class PositionedGlyph { public: - inline explicit PositionedGlyph(uint32_t glyph, float x, float y) - : glyph(glyph), x(x), y(y) {} + inline explicit PositionedGlyph(uint32_t glyph_, float x_, float y_) + : glyph(glyph_), x(x_), y(y_) {} uint32_t glyph = 0; float x = 0; diff --git a/include/mbgl/text/types.hpp b/include/mbgl/text/types.hpp index 1d21ded2a5..23f49aa748 100644 --- a/include/mbgl/text/types.hpp +++ b/include/mbgl/text/types.hpp @@ -28,24 +28,24 @@ struct CollisionRect { CollisionPoint::Type bx, CollisionPoint::Type by) : tl(ax, ay), br(bx, by) {} - inline explicit CollisionRect(const CollisionPoint &tl, - const CollisionPoint &br) - : tl(tl), br(br) {} + inline explicit CollisionRect(const CollisionPoint &tl_, + const CollisionPoint &br_) + : tl(tl_), br(br_) {} }; // These are the glyph boxes that we want to have placed. struct GlyphBox { explicit GlyphBox() {} - explicit GlyphBox(const CollisionRect &box, - const CollisionAnchor &anchor, - float minScale, - float maxScale, - float padding) - : box(box), anchor(anchor), minScale(minScale), maxScale(maxScale), padding(padding) {} - explicit GlyphBox(const CollisionRect &box, - float minScale, - float padding) - : box(box), minScale(minScale), padding(padding) {} + explicit GlyphBox(const CollisionRect &box_, + const CollisionAnchor &anchor_, + float minScale_, + float maxScale_, + float padding_) + : box(box_), anchor(anchor_), minScale(minScale_), maxScale(maxScale_), padding(padding_) {} + explicit GlyphBox(const CollisionRect &box_, + float minScale_, + float padding_) + : box(box_), minScale(minScale_), padding(padding_) {} CollisionRect box; CollisionAnchor anchor; @@ -60,19 +60,19 @@ typedef std::vector GlyphBoxes; // TODO: Transform the vec2s to vec2 to save bytes struct PlacedGlyph { - explicit PlacedGlyph(const vec2 &tl, const vec2 &tr, - const vec2 &bl, const vec2 &br, - const Rect &tex, float angle, const vec2 &anchor, - float minScale, float maxScale) - : tl(tl), - tr(tr), - bl(bl), - br(br), - tex(tex), - angle(angle), - anchor(anchor), - minScale(minScale), - maxScale(maxScale) {} + explicit PlacedGlyph(const vec2 &tl_, const vec2 &tr_, + const vec2 &bl_, const vec2 &br_, + const Rect &tex_, float angle_, const vec2 &anchor_, + float minScale_, float maxScale_) + : tl(tl_), + tr(tr_), + bl(bl_), + br(br_), + tex(tex_), + angle(angle_), + anchor(anchor_), + minScale(minScale_), + maxScale(maxScale_) {} vec2 tl, tr, bl, br; Rect tex; @@ -96,8 +96,8 @@ struct PlacementBox { struct PlacementProperty { explicit PlacementProperty() {} - explicit PlacementProperty(float zoom, const PlacementRange &rotationRange) - : zoom(zoom), rotationRange(rotationRange) {} + explicit PlacementProperty(float zoom_, const PlacementRange &rotationRange_) + : zoom(zoom_), rotationRange(rotationRange_) {} inline operator bool() const { return !std::isnan(zoom) && zoom != std::numeric_limits::infinity() && diff --git a/include/mbgl/util/enum.hpp b/include/mbgl/util/enum.hpp index 195aaab5a5..3c3e4a5c4e 100644 --- a/include/mbgl/util/enum.hpp +++ b/include/mbgl/util/enum.hpp @@ -21,11 +21,11 @@ private: static constexpr inline bool compare(const char *a, const char *b) { return *a == *b && (*a == '\0' || compare(a + 1, b + 1)); } - static constexpr inline const char *lookup_type(Type e, EnumValue const * const l, size_t r) { - return r == 0 ? "" : l->value == e ? l->name : lookup_type(e, l + 1, r - 1); + static constexpr inline const char *lookup_type(Type e, EnumValue const * const list, size_t r) { + return r == 0 ? "" : list->value == e ? list->name : lookup_type(e, list + 1, r - 1); } - static constexpr inline Type lookup_name(const char *n, EnumValue const * const l, size_t r) { - return r == 0 ? Type(-1) : compare(l->name, n) ? l->value : lookup_name(n, l + 1, r - 1); + static constexpr inline Type lookup_name(const char *n, EnumValue const * const list, size_t r) { + return r == 0 ? Type(-1) : compare(list->name, n) ? list->value : lookup_name(n, list + 1, r - 1); } public: inline constexpr Enum(const char *n) : value(lookup_name(n, names, length)) {} diff --git a/include/mbgl/util/error.hpp b/include/mbgl/util/error.hpp index 99e27f770c..09fa8d3e21 100644 --- a/include/mbgl/util/error.hpp +++ b/include/mbgl/util/error.hpp @@ -8,7 +8,7 @@ namespace mbgl { namespace error { struct style_parse : std::exception { - inline style_parse(size_t offset, const char *msg) : offset(offset), msg(msg) {} + inline style_parse(size_t offset_, const char *msg_) : offset(offset_), msg(msg_) {} inline const char* what() const noexcept { return msg.c_str(); } const size_t offset; const std::string msg; diff --git a/include/mbgl/util/pbf.hpp b/include/mbgl/util/pbf.hpp index 1f78a0072f..ab4d60cd37 100644 --- a/include/mbgl/util/pbf.hpp +++ b/include/mbgl/util/pbf.hpp @@ -49,9 +49,9 @@ struct pbf { uint32_t tag = 0; }; -pbf::pbf(const unsigned char *data, size_t length) - : data(data), - end(data + length), +pbf::pbf(const unsigned char *data_, size_t length) + : data(data_), + end(data_ + length), value(0), tag(0) { } diff --git a/include/mbgl/util/rect.hpp b/include/mbgl/util/rect.hpp index dedd4afc94..f5c77f93d1 100644 --- a/include/mbgl/util/rect.hpp +++ b/include/mbgl/util/rect.hpp @@ -6,7 +6,7 @@ namespace mbgl { template struct Rect { inline Rect() {} - inline Rect(T x, T y, T w, T h) : x(x), y(y), w(w), h(h) {} + inline Rect(T x_, T y_, T w_, T h_) : x(x_), y(y_), w(w_), h(h_) {} T x = 0, y = 0; T w = 0, h = 0; diff --git a/include/mbgl/util/transition.hpp b/include/mbgl/util/transition.hpp index 8a6836c885..16adc41ceb 100644 --- a/include/mbgl/util/transition.hpp +++ b/include/mbgl/util/transition.hpp @@ -15,9 +15,9 @@ public: complete }; - inline transition(timestamp start, timestamp duration) - : start(start), - duration(duration) {} + inline transition(timestamp start_, timestamp duration_) + : start(start_), + duration(duration_) {} inline float progress(timestamp now) const { if (duration == 0) return 1; @@ -36,11 +36,11 @@ protected: template class ease_transition : public transition { public: - ease_transition(T from, T to, T& value, timestamp start, timestamp duration) + ease_transition(T from_, T to_, T& value_, timestamp start, timestamp duration) : transition(start, duration), - from(from), - to(to), - value(value) {} + from(from_), + to(to_), + value(value_) {} state update(timestamp now) const; @@ -53,10 +53,10 @@ private: template class timeout : public transition { public: - timeout(T final_value, T& value, timestamp start, timestamp duration) + timeout(T final_value_, T& value_, timestamp start, timestamp duration) : transition(start, duration), - final_value(final_value), - value(value) {} + final_value(final_value_), + value(value_) {} state update(timestamp now) const { if (progress(now) >= 1) { diff --git a/include/mbgl/util/uv_detail.hpp b/include/mbgl/util/uv_detail.hpp index f80ca1bff5..b4b41f31af 100644 --- a/include/mbgl/util/uv_detail.hpp +++ b/include/mbgl/util/uv_detail.hpp @@ -68,7 +68,7 @@ private: class lock { public: - lock(mutex &mtx) : mtx(mtx) { mtx.lock(); } + lock(mutex &mtx_) : mtx(mtx_) { mtx.lock(); } ~lock() { mtx.unlock(); } private: @@ -94,8 +94,8 @@ private: class readlock { public: - inline readlock(rwlock &mtx) : mtx(mtx) { mtx.rdlock(); } - inline readlock(const std::unique_ptr &mtx) : mtx(*mtx) { mtx->rdlock(); } + inline readlock(rwlock &mtx_) : mtx(mtx_) { mtx.rdlock(); } + inline readlock(const std::unique_ptr &mtx_) : mtx(*mtx_) { mtx.rdlock(); } inline ~readlock() { mtx.rdunlock(); } private: @@ -104,8 +104,8 @@ private: class writelock { public: - inline writelock(rwlock &mtx) : mtx(mtx) { mtx.wrlock(); } - inline writelock(const std::unique_ptr &mtx) : mtx(*mtx) { mtx->wrlock(); } + inline writelock(rwlock &mtx_) : mtx(mtx_) { mtx.wrlock(); } + inline writelock(const std::unique_ptr &mtx_) : mtx(*mtx_) { mtx.wrlock(); } inline ~writelock() { mtx.wrunlock(); } private: @@ -148,10 +148,10 @@ public: typedef void (*after_work_callback)(T &object); template - work(worker &worker, work_callback work_cb, after_work_callback after_work_cb, Args&&... args) + work(worker &worker, work_callback work_cb_, after_work_callback after_work_cb_, Args&&... args) : data(std::forward(args)...), - work_cb(work_cb), - after_work_cb(after_work_cb) { + work_cb(work_cb_), + after_work_cb(after_work_cb_) { worker.add(this, do_work, after_work); } diff --git a/include/mbgl/util/vec.hpp b/include/mbgl/util/vec.hpp index a5fbee477b..0179254fda 100644 --- a/include/mbgl/util/vec.hpp +++ b/include/mbgl/util/vec.hpp @@ -29,7 +29,7 @@ struct vec2 { template inline vec2(const U& u) : x(u.x), y(u.y) {} - inline vec2(T x, T y) : x(x), y(y) {} + inline vec2(T x_, T y_) : x(x_), y(y_) {} inline bool operator==(const vec2& rhs) const { return x == rhs.x && y == rhs.y; @@ -86,7 +86,7 @@ struct vec3 { inline vec3() {} inline vec3(const vec3& o) : x(o.x), y(o.y), z(o.z) {} - inline vec3(T x, T y, T z) : x(x), y(y), z(z) {} + inline vec3(T x_, T y_, T z_) : x(x_), y(y_), z(z_) {} inline bool operator==(const vec3& rhs) const { return x == rhs.x && y == rhs.y && z == rhs.z; } @@ -98,7 +98,7 @@ struct vec4 { inline vec4() {} inline vec4(const vec4& o) : x(o.x), y(o.y), z(o.z), w(o.w) {} - inline vec4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) {} + inline vec4(T x_, T y_, T z_, T w_) : x(x_), y(y_), z(z_), w(w_) {} inline bool operator==(const vec4& rhs) const { return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w; } diff --git a/src/clipper/clipper.cpp b/src/clipper/clipper.cpp index 56ad58416d..7571ae1439 100755 --- a/src/clipper/clipper.cpp +++ b/src/clipper/clipper.cpp @@ -3242,7 +3242,7 @@ void Clipper::BuildResult(Paths &polys) int cnt = PointCount(p); if (cnt < 2) continue; pg.reserve(cnt); - for (int i = 0; i < cnt; ++i) + for (int j = 0; j < cnt; ++j) { pg.push_back(p->Pt); p = p->Prev; diff --git a/src/geometry/debug_font.cpp b/src/geometry/debug_font.cpp index 2da0c67841..8ee9f6811f 100644 --- a/src/geometry/debug_font.cpp +++ b/src/geometry/debug_font.cpp @@ -98,10 +98,10 @@ const int8_t simplex_94[] = { 3, 6, 3, 8, 4, 11, 6, 12, 8, 12, 10, 11, 14, 8, 16 struct glyph { glyph() : width(0), length(0), data(nullptr) { } - glyph(uint8_t width, uint8_t length, const int8_t *data) - : width(width), - length(length), - data(data) {} + glyph(uint8_t width_, uint8_t length_, const int8_t *data_) + : width(width_), + length(length_), + data(data_) {} uint8_t width; uint8_t length; const int8_t *data; diff --git a/src/geometry/glyph_atlas.cpp b/src/geometry/glyph_atlas.cpp index 76df941d90..6bee475da3 100644 --- a/src/geometry/glyph_atlas.cpp +++ b/src/geometry/glyph_atlas.cpp @@ -9,11 +9,11 @@ using namespace mbgl; -GlyphAtlas::GlyphAtlas(uint16_t width, uint16_t height) - : width(width), - height(height), - bin(width, height), - data(new char[width *height]), +GlyphAtlas::GlyphAtlas(uint16_t width_, uint16_t height_) + : width(width_), + height(height_), + bin(width_, height_), + data(new char[width_ *height_]), dirty(true) { } diff --git a/src/geometry/sprite_atlas.cpp b/src/geometry/sprite_atlas.cpp index 7ea9d4ce7d..10922790c0 100644 --- a/src/geometry/sprite_atlas.cpp +++ b/src/geometry/sprite_atlas.cpp @@ -14,10 +14,10 @@ using namespace mbgl; -SpriteAtlas::SpriteAtlas(dimension width, dimension height) - : width(width), - height(height), - bin(width, height), +SpriteAtlas::SpriteAtlas(dimension width_, dimension height_) + : width(width_), + height(height_), + bin(width_, height_), dirty(true) { } @@ -88,10 +88,10 @@ void copy_bitmap(const uint32_t *src, const int src_stride, const int src_x, con } } -Rect SpriteAtlas::allocateImage(size_t width, size_t height) { +Rect SpriteAtlas::allocateImage(size_t pixel_width, size_t pixel_height) { // We have to allocate a new area in the bin, and store an empty image in it. // Add a 1px border around every image. - Rect rect = bin.allocate(width + 2 * buffer, height + 2 * buffer); + Rect rect = bin.allocate(pixel_width + 2 * buffer, pixel_height + 2 * buffer); if (rect.w == 0) { return rect; } diff --git a/src/map/map.cpp b/src/map/map.cpp index 451385d3d5..a7520b2517 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -30,17 +30,17 @@ using namespace mbgl; -Map::Map(View& view) +Map::Map(View& view_) : loop(std::make_shared()), thread(std::make_unique()), async_terminate(new uv_async_t()), async_render(new uv_async_t()), async_cleanup(new uv_async_t()), - view(view), + view(view_), #ifndef NDEBUG main_thread(uv_thread_self()), #endif - transform(view), + transform(view_), glyphAtlas(std::make_shared(1024, 1024)), spriteAtlas(std::make_shared(512, 512)), texturepool(std::make_shared()), @@ -653,9 +653,6 @@ void Map::prepare() { void Map::render() { view.make_active(); -#if defined(DEBUG) - std::vector debug; -#endif painter.clear(); painter.resize(); diff --git a/src/map/source.cpp b/src/map/source.cpp index 36f1a71c84..ca1f3d5323 100644 --- a/src/map/source.cpp +++ b/src/map/source.cpp @@ -20,8 +20,8 @@ namespace mbgl { -Source::Source(const util::ptr& info) - : info(info) +Source::Source(const util::ptr& info_) + : info(info_) { } @@ -219,15 +219,15 @@ std::forward_list Source::coveringTiles(const TransformState& state) c box points = state.cornersToBox(z); const vec2& center = points.center; - std::forward_list tiles = Tile::cover(z, points); + std::forward_list covering_tiles = Tile::cover(z, points); - tiles.sort([¢er](const Tile::ID& a, const Tile::ID& b) { + covering_tiles.sort([¢er](const Tile::ID& a, const Tile::ID& b) { // Sorts by distance from the box center return std::fabs(a.x - center.x) + std::fabs(a.y - center.y) < std::fabs(b.x - center.x) + std::fabs(b.y - center.y); }); - return tiles; + return covering_tiles; } /** diff --git a/src/map/sprite.cpp b/src/map/sprite.cpp index c069ece45a..876586e4b0 100644 --- a/src/map/sprite.cpp +++ b/src/map/sprite.cpp @@ -13,13 +13,13 @@ using namespace mbgl; -SpritePosition::SpritePosition(uint16_t x, uint16_t y, uint16_t width, uint16_t height, float pixelRatio, bool sdf) - : x(x), - y(y), - width(width), - height(height), - pixelRatio(pixelRatio), - sdf(sdf) { +SpritePosition::SpritePosition(uint16_t x_, uint16_t y_, uint16_t width_, uint16_t height_, float pixelRatio_, bool sdf_) + : x(x_), + y(y_), + width(width_), + height(height_), + pixelRatio(pixelRatio_), + sdf(sdf_) { } util::ptr Sprite::Create(const std::string& base_url, float pixelRatio, const util::ptr &fileSource) { @@ -28,11 +28,11 @@ util::ptr Sprite::Create(const std::string& base_url, float pixelRatio, return sprite; } -Sprite::Sprite(const Key &, const std::string& base_url, float pixelRatio) +Sprite::Sprite(const Key &, const std::string& base_url, float pixelRatio_) : valid(base_url.length() > 0), - pixelRatio(pixelRatio), - spriteURL(base_url + (pixelRatio > 1 ? "@2x" : "") + ".png"), - jsonURL(base_url + (pixelRatio > 1 ? "@2x" : "") + ".json"), + pixelRatio(pixelRatio_), + spriteURL(base_url + (pixelRatio_ > 1 ? "@2x" : "") + ".png"), + jsonURL(base_url + (pixelRatio_ > 1 ? "@2x" : "") + ".json"), raster(), loadedImage(false), loadedJSON(false), @@ -123,16 +123,16 @@ void Sprite::parseJSON() { uint16_t y = 0; uint16_t width = 0; uint16_t height = 0; - float pixelRatio = 1.0f; + float spritePixelRatio = 1.0f; bool sdf = false; if (value.HasMember("x")) x = value["x"].GetInt(); if (value.HasMember("y")) y = value["y"].GetInt(); if (value.HasMember("width")) width = value["width"].GetInt(); if (value.HasMember("height")) height = value["height"].GetInt(); - if (value.HasMember("pixelRatio")) pixelRatio = value["pixelRatio"].GetInt(); + if (value.HasMember("pixelRatio")) spritePixelRatio = value["pixelRatio"].GetInt(); if (value.HasMember("sdf")) sdf = value["sdf"].GetBool(); - pos.emplace(name, SpritePosition { x, y, width, height, pixelRatio, sdf }); + pos.emplace(name, SpritePosition { x, y, width, height, spritePixelRatio, sdf }); } } } else { diff --git a/src/map/tile.cpp b/src/map/tile.cpp index 863fbfbece..1fe0faefde 100644 --- a/src/map/tile.cpp +++ b/src/map/tile.cpp @@ -7,8 +7,8 @@ using namespace mbgl; #include -Tile::Tile(const ID& id) - : id(id) { +Tile::Tile(const ID& id_) + : id(id_) { } Tile::ID Tile::ID::parent(int8_t parent_z) const { diff --git a/src/map/tile_data.cpp b/src/map/tile_data.cpp index 44e3826bf5..7e4d1a1de1 100644 --- a/src/map/tile_data.cpp +++ b/src/map/tile_data.cpp @@ -9,14 +9,14 @@ using namespace mbgl; -TileData::TileData(Tile::ID id, Map &map, const util::ptr &source) - : id(id), +TileData::TileData(Tile::ID id_, Map &map_, const util::ptr &source_) + : id(id_), state(State::initial), - map(map), - source(source), + map(map_), + source(source_), debugBucket(debugFontBuffer) { // Initialize tile debug coordinates - const std::string str = util::sprintf<32>("%d/%d/%d", id.z, id.x, id.y); + const std::string str = util::sprintf<32>("%d/%d/%d", id_.z, id_.x, id_.y); debugFontBuffer.addText(str.c_str(), 50, 200, 5); } diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp index 3dc5cb9cef..235151cd47 100644 --- a/src/map/tile_parser.cpp +++ b/src/map/tile_parser.cpp @@ -37,14 +37,14 @@ namespace mbgl { // its header file. TileParser::~TileParser() = default; -TileParser::TileParser(const std::string &data, VectorTileData &tile, +TileParser::TileParser(const std::string &data, VectorTileData &tile_, const util::ptr &style_, const util::ptr &glyphAtlas_, const util::ptr &glyphStore_, const util::ptr &spriteAtlas_, const util::ptr &sprite_) : vector_data(pbf((const uint8_t *)data.data(), data.size())), - tile(tile), + tile(tile_), style(style_), glyphAtlas(glyphAtlas_), glyphStore(glyphStore_), diff --git a/src/map/transform.cpp b/src/map/transform.cpp index baa615b94a..b42f24a83d 100644 --- a/src/map/transform.cpp +++ b/src/map/transform.cpp @@ -17,7 +17,7 @@ const double R2D = 180.0 / M_PI; const double M2PI = 2 * M_PI; const double MIN_ROTATE_SCALE = 8; -Transform::Transform(View &view) : view(view), mtx(std::make_unique()) { +Transform::Transform(View &view_) : view(view_), mtx(std::make_unique()) { setScale(current.scale); setAngle(current.angle); } diff --git a/src/map/transform_state.cpp b/src/map/transform_state.cpp index 4b1bc4161e..fa521400c3 100644 --- a/src/map/transform_state.cpp +++ b/src/map/transform_state.cpp @@ -96,8 +96,8 @@ float TransformState::lngX(float lon) const { } float TransformState::latY(float lat) const { - float y = 180 / M_PI * std::log(std::tan(M_PI / 4 + lat * M_PI / 360)); - return (180 - y) * worldSize() / 360; + float latY = 180 / M_PI * std::log(std::tan(M_PI / 4 + lat * M_PI / 360)); + return (180 - latY) * worldSize() / 360; } std::array TransformState::locationCoordinate(float lon, float lat) const { diff --git a/src/map/vector_tile.cpp b/src/map/vector_tile.cpp index 4ec25d6cf6..8f097c8292 100644 --- a/src/map/vector_tile.cpp +++ b/src/map/vector_tile.cpp @@ -103,9 +103,9 @@ VectorTileLayer::VectorTileLayer(pbf layer) : data(layer) { } } -FilteredVectorTileLayer::FilteredVectorTileLayer(const VectorTileLayer& layer, const FilterExpression &filterExpression) - : layer(layer), - filterExpression(filterExpression) { +FilteredVectorTileLayer::FilteredVectorTileLayer(const VectorTileLayer& layer_, const FilterExpression &filterExpression_) + : layer(layer_), + filterExpression(filterExpression_) { } FilteredVectorTileLayer::iterator FilteredVectorTileLayer::begin() const { @@ -116,10 +116,10 @@ FilteredVectorTileLayer::iterator FilteredVectorTileLayer::end() const { return iterator(*this, pbf(layer.data.end, 0)); } -FilteredVectorTileLayer::iterator::iterator(const FilteredVectorTileLayer& parent, const pbf& data) - : parent(parent), +FilteredVectorTileLayer::iterator::iterator(const FilteredVectorTileLayer& parent_, const pbf& data_) + : parent(parent_), feature(pbf()), - data(data) { + data(data_) { operator++(); } diff --git a/src/renderer/debug_bucket.cpp b/src/renderer/debug_bucket.cpp index 699c1c1db9..58fbf8a35b 100644 --- a/src/renderer/debug_bucket.cpp +++ b/src/renderer/debug_bucket.cpp @@ -10,8 +10,8 @@ struct geometry_too_long_exception : std::exception {}; using namespace mbgl; -DebugBucket::DebugBucket(DebugFontBuffer& fontBuffer) - : fontBuffer(fontBuffer) { +DebugBucket::DebugBucket(DebugFontBuffer& fontBuffer_) + : fontBuffer(fontBuffer_) { } void DebugBucket::render(Painter& painter, util::ptr /*layer_desc*/, const Tile::ID& /*id*/, const mat4 &matrix) { diff --git a/src/renderer/fill_bucket.cpp b/src/renderer/fill_bucket.cpp index 5358cae0b2..0a7d77935d 100644 --- a/src/renderer/fill_bucket.cpp +++ b/src/renderer/fill_bucket.cpp @@ -30,11 +30,11 @@ void FillBucket::free(void *, void *ptr) { ::free(ptr); } -FillBucket::FillBucket(FillVertexBuffer &vertexBuffer, - TriangleElementsBuffer &triangleElementsBuffer, - LineElementsBuffer &lineElementsBuffer, - const StyleBucketFill &properties) - : properties(properties), +FillBucket::FillBucket(FillVertexBuffer &vertexBuffer_, + TriangleElementsBuffer &triangleElementsBuffer_, + LineElementsBuffer &lineElementsBuffer_, + const StyleBucketFill &properties_) + : properties(properties_), allocator(new TESSalloc{&alloc, &realloc, &free, nullptr, // userData 64, // meshEdgeBucketSize 64, // meshVertexBucketSize @@ -44,11 +44,11 @@ FillBucket::FillBucket(FillVertexBuffer &vertexBuffer, 128, // extraVertices allocated for the priority queue. }), tesselator(tessNewTess(allocator)), - vertexBuffer(vertexBuffer), - triangleElementsBuffer(triangleElementsBuffer), - lineElementsBuffer(lineElementsBuffer), - vertex_start(vertexBuffer.index()), - triangle_elements_start(triangleElementsBuffer.index()), + vertexBuffer(vertexBuffer_), + triangleElementsBuffer(triangleElementsBuffer_), + lineElementsBuffer(lineElementsBuffer_), + vertex_start(vertexBuffer_.index()), + triangle_elements_start(triangleElementsBuffer_.index()), line_elements_start(lineElementsBuffer.index()) { assert(tesselator); } @@ -123,10 +123,10 @@ void FillBucket::tessellate() { const size_t group_count = polygon.size(); assert(group_count >= 3); - std::vector line; + std::vector clipped_line; for (const ClipperLib::IntPoint& pt : polygon) { - line.push_back(pt.X); - line.push_back(pt.Y); + clipped_line.push_back(pt.X); + clipped_line.push_back(pt.Y); vertexBuffer.add(pt.X, pt.Y); } @@ -137,7 +137,7 @@ void FillBucket::tessellate() { lineIndex += group_count; - tessAddContour(tesselator, vertexSize, line.data(), stride, (int)line.size() / vertexSize); + tessAddContour(tesselator, vertexSize, clipped_line.data(), stride, (int)clipped_line.size() / vertexSize); } lineGroup.elements_length += total_vertex_count; diff --git a/src/renderer/line_bucket.cpp b/src/renderer/line_bucket.cpp index 3ef7411be6..8267cbaba2 100644 --- a/src/renderer/line_bucket.cpp +++ b/src/renderer/line_bucket.cpp @@ -17,17 +17,17 @@ struct geometry_too_long_exception : std::exception {}; using namespace mbgl; -LineBucket::LineBucket(LineVertexBuffer& vertexBuffer, - TriangleElementsBuffer& triangleElementsBuffer, - PointElementsBuffer& pointElementsBuffer, - const StyleBucketLine& properties) - : properties(properties), - vertexBuffer(vertexBuffer), - triangleElementsBuffer(triangleElementsBuffer), - pointElementsBuffer(pointElementsBuffer), - vertex_start(vertexBuffer.index()), - triangle_elements_start(triangleElementsBuffer.index()), - point_elements_start(pointElementsBuffer.index()) +LineBucket::LineBucket(LineVertexBuffer& vertexBuffer_, + TriangleElementsBuffer& triangleElementsBuffer_, + PointElementsBuffer& pointElementsBuffer_, + const StyleBucketLine& properties_) + : properties(properties_), + vertexBuffer(vertexBuffer_), + triangleElementsBuffer(triangleElementsBuffer_), + pointElementsBuffer(pointElementsBuffer_), + vertex_start(vertexBuffer_.index()), + triangle_elements_start(triangleElementsBuffer_.index()), + point_elements_start(pointElementsBuffer_.index()) { } @@ -53,7 +53,7 @@ void LineBucket::addGeometry(pbf& geom) { } struct TriangleElement { - TriangleElement(uint16_t a, uint16_t b, uint16_t c) : a(a), b(b), c(c) {} + TriangleElement(uint16_t a_, uint16_t b_, uint16_t c_) : a(a_), b(b_), c(c_) {} uint16_t a, b, c; }; diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp index e82b1b5f63..aa522734c5 100644 --- a/src/renderer/painter.cpp +++ b/src/renderer/painter.cpp @@ -21,8 +21,8 @@ using namespace mbgl; #define BUFFER_OFFSET(i) ((char *)nullptr + (i)) -Painter::Painter(Map &map) - : map(map) { +Painter::Painter(Map &map_) + : map(map_) { } Painter::~Painter() { diff --git a/src/renderer/prerendered_texture.cpp b/src/renderer/prerendered_texture.cpp index 0a47816323..adb7a59105 100644 --- a/src/renderer/prerendered_texture.cpp +++ b/src/renderer/prerendered_texture.cpp @@ -5,8 +5,8 @@ using namespace mbgl; -PrerenderedTexture::PrerenderedTexture(const StyleBucketRaster &properties) - : properties(properties) { +PrerenderedTexture::PrerenderedTexture(const StyleBucketRaster &properties_) + : properties(properties_) { } PrerenderedTexture::~PrerenderedTexture() { diff --git a/src/renderer/raster_bucket.cpp b/src/renderer/raster_bucket.cpp index fc5e3dd3c8..7adb3f845e 100644 --- a/src/renderer/raster_bucket.cpp +++ b/src/renderer/raster_bucket.cpp @@ -3,9 +3,9 @@ using namespace mbgl; -RasterBucket::RasterBucket(const util::ptr &texturepool, const StyleBucketRaster& properties) -: properties(properties), - texture(properties), +RasterBucket::RasterBucket(const util::ptr &texturepool, const StyleBucketRaster& properties_) +: properties(properties_), + texture(properties_), raster(texturepool) { } @@ -24,8 +24,8 @@ void RasterBucket::drawRaster(RasterShader& shader, StaticVertexBuffer &vertices glDrawArrays(GL_TRIANGLES, 0, (GLsizei)vertices.index()); } -void RasterBucket::drawRaster(RasterShader& shader, StaticVertexBuffer &vertices, VertexArrayObject &array, GLuint texture) { - raster.bind(texture); +void RasterBucket::drawRaster(RasterShader& shader, StaticVertexBuffer &vertices, VertexArrayObject &array, GLuint texture_) { + raster.bind(texture_); shader.u_image = 0; array.bind(shader, vertices, BUFFER_OFFSET(0)); glDrawArrays(GL_TRIANGLES, 0, (GLsizei)vertices.index()); diff --git a/src/renderer/symbol_bucket.cpp b/src/renderer/symbol_bucket.cpp index 3a4b017ef3..47cc4db44c 100644 --- a/src/renderer/symbol_bucket.cpp +++ b/src/renderer/symbol_bucket.cpp @@ -19,8 +19,8 @@ namespace mbgl { -SymbolBucket::SymbolBucket(const StyleBucketSymbol &properties, Collision &collision) - : properties(properties), collision(collision) {} +SymbolBucket::SymbolBucket(const StyleBucketSymbol &properties_, Collision &collision_) + : properties(properties_), collision(collision_) {} void SymbolBucket::render(Painter &painter, util::ptr layer_desc, const Tile::ID &id, const mat4 &matrix) { @@ -52,12 +52,12 @@ std::vector SymbolBucket::processFeatures(const VectorTileLayer & const FilterExpression &filter, GlyphStore &glyphStore, const Sprite &sprite) { - const bool text = properties.text.field.size(); - const bool icon = properties.icon.image.size(); + const bool has_text = properties.text.field.size(); + const bool has_icon = properties.icon.image.size(); std::vector features; - if (!text && !icon) { + if (!has_text && !has_icon) { return features; } @@ -72,7 +72,7 @@ std::vector SymbolBucket::processFeatures(const VectorTileLayer & SymbolFeature ft; - if (text) { + if (has_text) { std::string u8string = util::replaceTokens(properties.text.field, feature.properties); if (properties.text.transform == TextTransformType::Uppercase) { @@ -91,7 +91,7 @@ std::vector SymbolBucket::processFeatures(const VectorTileLayer & } } - if (icon) { + if (has_icon) { ft.sprite = util::replaceTokens(properties.icon.image, feature.properties); } diff --git a/src/shader/shader.cpp b/src/shader/shader.cpp index 91c9b58c89..d9f63cae12 100644 --- a/src/shader/shader.cpp +++ b/src/shader/shader.cpp @@ -8,8 +8,8 @@ using namespace mbgl; -Shader::Shader(const char *name, const GLchar *vertSource, const GLchar *fragSource) - : name(name), +Shader::Shader(const char *name_, const GLchar *vertSource, const GLchar *fragSource) + : name(name_), valid(false), program(0) { util::timer timer("shader compilation", Event::Shader); diff --git a/src/storage/http_request.cpp b/src/storage/http_request.cpp index ca1412fd9e..3da4fc7c31 100644 --- a/src/storage/http_request.cpp +++ b/src/storage/http_request.cpp @@ -82,19 +82,19 @@ void HTTPRequest::startHTTPRequest(std::unique_ptr &&res) { #else uv_async_init(loop, http_baton->async, [](uv_async_t *async) { #endif - util::ptr &http_baton = *(util::ptr *)async->data; + util::ptr &baton = *(util::ptr *)async->data; - if (http_baton->request) { - HTTPRequest *request = http_baton->request; + if (baton->request) { + HTTPRequest *request = baton->request; request->http_baton.reset(); - http_baton->request = nullptr; - request->handleHTTPResponse(http_baton->type, std::move(http_baton->response)); + baton->request = nullptr; + request->handleHTTPResponse(baton->type, std::move(baton->response)); } delete (util::ptr *)async->data; uv_close((uv_handle_t *)async, [](uv_handle_t *handle) { - uv_async_t *async = (uv_async_t *)handle; - delete async; + uv_async_t *async_handle = (uv_async_t *)handle; + delete async_handle; }); }); attempts++; diff --git a/src/storage/sqlite_store.cpp b/src/storage/sqlite_store.cpp index 763100f411..e0757ecc36 100644 --- a/src/storage/sqlite_store.cpp +++ b/src/storage/sqlite_store.cpp @@ -68,8 +68,8 @@ SQLiteStore::~SQLiteStore() { // Nothing to do. This function needs to be here because we're forward-declaring // Database, so we need the actual definition here to be able to properly destruct it. if (worker) { - uv_worker_close(worker, [](uv_worker_t *worker) { - delete worker; + uv_worker_close(worker, [](uv_worker_t *worker_handle) { + delete worker_handle; }); } } diff --git a/src/style/applied_class_properties.cpp b/src/style/applied_class_properties.cpp index ca9c09436c..9037c6ad5d 100644 --- a/src/style/applied_class_properties.cpp +++ b/src/style/applied_class_properties.cpp @@ -2,11 +2,11 @@ namespace mbgl { -AppliedClassProperty::AppliedClassProperty(ClassID class_id, timestamp begin, timestamp end, const PropertyValue &value) +AppliedClassProperty::AppliedClassProperty(ClassID class_id, timestamp begin_, timestamp end_, const PropertyValue &value_) : name(class_id), - begin(begin), - end(end), - value(value) {} + begin(begin_), + end(end_), + value(value_) {} // Returns thie ID of the most recent ClassID AppliedClassProperties::mostRecent() const { diff --git a/src/style/style_layer.cpp b/src/style/style_layer.cpp index 8f79bc9047..4d64386be8 100644 --- a/src/style/style_layer.cpp +++ b/src/style/style_layer.cpp @@ -7,8 +7,8 @@ namespace mbgl { -StyleLayer::StyleLayer(const std::string &id, std::map &&styles) - : id(id), styles(std::move(styles)) {} +StyleLayer::StyleLayer(const std::string &id_, std::map &&styles_) + : id(id_), styles(std::move(styles_)) {} bool StyleLayer::isBackground() const { return type == StyleLayerType::Background; @@ -70,8 +70,8 @@ void StyleLayer::applyClassProperties(const ClassID class_id, // Loop through all the properties in this style, and add transitions to them, if they're // not already the most recent transition. - const ClassProperties &properties = style_it->second; - for (const std::pair &property_pair : properties) { + const ClassProperties &class_properties = style_it->second; + for (const std::pair &property_pair : class_properties) { PropertyKey key = property_pair.first; if (already_applied.find(key) != already_applied.end()) { // This property has already been set by a previous class. @@ -87,7 +87,7 @@ void StyleLayer::applyClassProperties(const ClassID class_id, AppliedClassProperties &appliedProperties = appliedStyle[key]; if (appliedProperties.mostRecent() != class_id) { const PropertyTransition &transition = - properties.getTransition(key, defaultTransition); + class_properties.getTransition(key, defaultTransition); const timestamp begin = now + transition.delay * 1_millisecond; const timestamp end = begin + transition.duration * 1_millisecond; const PropertyValue &value = property_pair.second; @@ -99,7 +99,7 @@ void StyleLayer::applyClassProperties(const ClassID class_id, template struct PropertyEvaluator { typedef T result_type; - PropertyEvaluator(float z) : z(z) {} + PropertyEvaluator(float z_) : z(z_) {} template ::value, int>::type = 0> T operator()(const P &value) const { @@ -269,11 +269,11 @@ void StyleLayer::cleanupAppliedStyleProperties(timestamp now) { auto it = appliedStyle.begin(); const auto end = appliedStyle.end(); while (it != end) { - AppliedClassProperties &properties = it->second; - properties.cleanup(now); + AppliedClassProperties &applied_properties = it->second; + applied_properties.cleanup(now); // If the current properties object is empty, remove it from the map entirely. - if (properties.empty()) { + if (applied_properties.empty()) { appliedStyle.erase(it++); } else { ++it; diff --git a/src/style/style_parser.cpp b/src/style/style_parser.cpp index a00fe61359..b2714f5da5 100644 --- a/src/style/style_parser.cpp +++ b/src/style/style_parser.cpp @@ -108,13 +108,13 @@ template<> bool StyleParser::parseRenderProperty(JSVal value, uint16_t &target, if (value.HasMember(name)) { JSVal property = replaceConstant(value[name]); if (property.IsUint()) { - unsigned int value = property.GetUint(); - if (value > std::numeric_limits::max()) { + unsigned int int_value = property.GetUint(); + if (int_value > std::numeric_limits::max()) { Log::Warning(Event::ParseStyle, "values for %s that are larger than %d are not supported", name, std::numeric_limits::max()); return false; } - target = value; + target = int_value; return true; } else { Log::Warning(Event::ParseStyle, "%s must be an unsigned integer", name); @@ -763,11 +763,11 @@ FilterExpression StyleParser::parseFilter(JSVal value, FilterExpression::Operato FilterComparison comparison(name); JSVal filterValue = replaceConstant(itr->value); if (filterValue.IsObject()) { - rapidjson::Value::ConstMemberIterator itr = filterValue.MemberBegin(); - for (; itr != filterValue.MemberEnd(); ++itr) { + rapidjson::Value::ConstMemberIterator filter_itr = filterValue.MemberBegin(); + for (; filter_itr != filterValue.MemberEnd(); ++filter_itr) { comparison.add( - parseFilterComparisonOperator({ itr->name.GetString(), itr->name.GetStringLength() }), - parseValues(replaceConstant(itr->value)) + parseFilterComparisonOperator({ filter_itr->name.GetString(), filter_itr->name.GetStringLength() }), + parseValues(replaceConstant(filter_itr->value)) ); } } else if (filterValue.IsArray()) { diff --git a/src/text/collision.cpp b/src/text/collision.cpp index 6326bea825..2e0ec6dce2 100644 --- a/src/text/collision.cpp +++ b/src/text/collision.cpp @@ -19,11 +19,11 @@ Box getBox(const CollisionAnchor &anchor, const CollisionRect &bbox, float minSc }; }; -Collision::Collision(float zoom, float tileExtent, float tileSize, float placementDepth) +Collision::Collision(float zoom_, float tileExtent, float tileSize, float placementDepth) // tile pixels per screen pixels at the tile's zoom level : tilePixelRatio(tileExtent / tileSize), - zoom(zoom), + zoom(zoom_), // Calculate the maximum scale we can go down in our fake-3d rtree so that // placement still makes sense. This is calculated so that the minimum @@ -33,7 +33,7 @@ Collision::Collision(float zoom, float tileExtent, float tileSize, float placeme // We don't want to place labels all the way to 25.5. This lets too many // glyphs be placed, slowing down collision checking. Only place labels if // they will show up within the intended zoom range of the tile. - maxPlacementScale(std::exp(std::log(2) * util::min(3.0f, placementDepth, 25.5f - zoom))) { + maxPlacementScale(std::exp(std::log(2) * util::min(3.0f, placementDepth, 25.5f - zoom_))) { const float m = 4096; const float edge = m * tilePixelRatio * 2; diff --git a/src/text/glyph_store.cpp b/src/text/glyph_store.cpp index 1723bd3d94..5619c4f93f 100644 --- a/src/text/glyph_store.cpp +++ b/src/text/glyph_store.cpp @@ -228,7 +228,7 @@ void GlyphPBF::parse(FontStack &stack) { data.clear(); } -GlyphStore::GlyphStore(const util::ptr &fileSource) : fileSource(fileSource) {} +GlyphStore::GlyphStore(const util::ptr &fileSource_) : fileSource(fileSource_) {} void GlyphStore::setURL(const std::string &url) { glyphURL = url; diff --git a/src/text/placement.cpp b/src/text/placement.cpp index 0c95e3a80d..84d4e20b2f 100644 --- a/src/text/placement.cpp +++ b/src/text/placement.cpp @@ -12,10 +12,10 @@ namespace mbgl { const float Placement::globalMinScale = 0.5; // underscale by 1 zoom level struct GlyphInstance { - explicit GlyphInstance(const vec2 &anchor) : anchor(anchor) {} - explicit GlyphInstance(const vec2 &anchor, float offset, float minScale, float maxScale, - float angle) - : anchor(anchor), offset(offset), minScale(minScale), maxScale(maxScale), angle(angle) {} + explicit GlyphInstance(const vec2 &anchor_) : anchor(anchor_) {} + explicit GlyphInstance(const vec2 &anchor_, float offset_, float minScale_, float maxScale_, + float angle_) + : anchor(anchor_), offset(offset_), minScale(minScale_), maxScale(maxScale_), angle(angle_) {} const vec2 anchor; const float offset = 0.0f; diff --git a/src/util/image.cpp b/src/util/image.cpp index 28906c4e91..ec218e0bed 100644 --- a/src/util/image.cpp +++ b/src/util/image.cpp @@ -30,8 +30,8 @@ std::string mbgl::util::compress_png(int width, int height, void *rgba, bool fli } std::string result; - png_set_write_fn(png_ptr, &result, [](png_structp png_ptr, png_bytep data, png_size_t length) { - std::string *out = static_cast(png_get_io_ptr(png_ptr)); + png_set_write_fn(png_ptr, &result, [](png_structp png_ptr_, png_bytep data, png_size_t length) { + std::string *out = static_cast(png_get_io_ptr(png_ptr_)); out->append(reinterpret_cast(data), length); }, NULL); @@ -57,8 +57,8 @@ using namespace mbgl::util; struct Buffer { - Buffer(const std::string& data) - : data(data.data()), length(data.size()) {} + Buffer(const std::string& data_) + : data(data_.data()), length(data_.size()) {} const char *const data = 0; const size_t length = 0; size_t pos = 0; diff --git a/src/util/raster.cpp b/src/util/raster.cpp index 7b52c51037..c4d7a15400 100644 --- a/src/util/raster.cpp +++ b/src/util/raster.cpp @@ -13,8 +13,8 @@ using namespace mbgl; -Raster::Raster(const util::ptr &texturepool) - : texturepool(texturepool) +Raster::Raster(const util::ptr &texturepool_) + : texturepool(texturepool_) {} Raster::~Raster() { @@ -59,32 +59,32 @@ void Raster::bind(bool linear) { glBindTexture(GL_TEXTURE_2D, texture); } - GLuint filter = linear ? GL_LINEAR : GL_NEAREST; - if (filter != this->filter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); - this->filter = filter; + GLuint new_filter = linear ? GL_LINEAR : GL_NEAREST; + if (new_filter != this->filter) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, new_filter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, new_filter); + filter = new_filter; } } // overload ::bind for prerendered raster textures -void Raster::bind(const GLuint texture) { +void Raster::bind(const GLuint custom_texture) { if (img && !textured) { - glBindTexture(GL_TEXTURE_2D, texture); + glBindTexture(GL_TEXTURE_2D, custom_texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, img->getData()); img.reset(); textured = true; } else if (textured) { - glBindTexture(GL_TEXTURE_2D, texture); + glBindTexture(GL_TEXTURE_2D, custom_texture); } - GLuint filter = GL_LINEAR; - if (filter != this->filter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); - this->filter = filter; + GLuint new_filter = GL_LINEAR; + if (new_filter != this->filter) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, new_filter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, new_filter); + filter = new_filter; } } diff --git a/src/util/timer.cpp b/src/util/timer.cpp index d56860d193..5c4af51da4 100644 --- a/src/util/timer.cpp +++ b/src/util/timer.cpp @@ -8,22 +8,22 @@ using namespace mbgl::util; -timer::timer(Event event) - : event(event), start(now()) {} +timer::timer(Event event_) + : event(event_), start(now()) {} -timer::timer(EventSeverity severity, Event event) - : severity(severity), event(event), start(now()) {} +timer::timer(EventSeverity severity_, Event event_) + : severity(severity_), event(event_), start(now()) {} -timer::timer(const std::string &name, Event event) - : name(name), event(event), start(now()) {} +timer::timer(const std::string &name_, Event event_) + : name(name_), event(event_), start(now()) {} -timer::timer(const std::string &name, EventSeverity severity, Event event) - : name(name), severity(severity), event(event), start(now()) {} +timer::timer(const std::string &name_, EventSeverity severity_, Event event_) + : name(name_), severity(severity_), event(event_), start(now()) {} -void timer::report(const std::string &name) { +void timer::report(const std::string &name_) { timestamp duration = now() - start; - Log::Record(severity, event, name + ": " + std::to_string((double)(duration) / 1_millisecond) + "ms"); + Log::Record(severity, event, name_ + ": " + std::to_string((double)(duration) / 1_millisecond) + "ms"); start += duration; } diff --git a/test/comparisons.cpp b/test/comparisons.cpp index e1e991d41c..4ffcf2e2ec 100644 --- a/test/comparisons.cpp +++ b/test/comparisons.cpp @@ -10,7 +10,7 @@ class MockExtractor { public: - inline MockExtractor(const std::multimap &values) : values(values) {} + inline MockExtractor(const std::multimap &values_) : values(values_) {} inline MockExtractor() {} inline std::vector getValues(const std::string &key) const { diff --git a/test/fixtures/fixture_log.hpp b/test/fixtures/fixture_log.hpp index dc92f93198..99097a2c47 100644 --- a/test/fixtures/fixture_log.hpp +++ b/test/fixtures/fixture_log.hpp @@ -13,14 +13,14 @@ namespace mbgl { class FixtureLogBackend : public LogBackend, private util::noncopyable { public: struct LogMessage { - inline LogMessage(EventSeverity severity, Event event, int64_t code, const std::string &msg) - : severity(severity), event(event), code(code), msg(msg) {} - inline LogMessage(EventSeverity severity, Event event, int64_t code) - : severity(severity), event(event), code(code), msg() {} - inline LogMessage(EventSeverity severity, Event event, const std::string &msg) - : severity(severity), event(event), code(), msg(msg) {} - inline LogMessage(EventSeverity severity, Event event) - : severity(severity), event(event), code(), msg() {} + inline LogMessage(EventSeverity severity_, Event event_, int64_t code_, const std::string &msg_) + : severity(severity_), event(event_), code(code_), msg(msg_) {} + inline LogMessage(EventSeverity severity_, Event event_, int64_t code_) + : severity(severity_), event(event_), code(code_), msg() {} + inline LogMessage(EventSeverity severity_, Event event_, const std::string &msg_) + : severity(severity_), event(event_), code(), msg(msg_) {} + inline LogMessage(EventSeverity severity_, Event event_) + : severity(severity_), event(event_), code(), msg() {} inline bool operator==(const LogMessage &rhs) const { return (!severity || !rhs.severity || severity.get() == rhs.severity.get()) && -- cgit v1.2.1