diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-10-22 18:06:11 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-10-22 18:19:01 +0200 |
commit | 214f99673f6f7480f9cc3bf9d6fa32ef8dd2ede5 (patch) | |
tree | f06145cf70bf7860abd2c6edf88e2294d4ecb830 /include | |
parent | 74387c54e35e0f8f6bf1dcc7b7b171a3ec6db212 (diff) | |
download | qtlocation-mapboxgl-214f99673f6f7480f9cc3bf9d6fa32ef8dd2ede5.tar.gz |
fix variable shadowing
Diffstat (limited to 'include')
24 files changed, 97 insertions, 96 deletions
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<Anchor> 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<uint16_t>& rect, uint64_t id) - : rect(rect), ids({ id }) {} + GlyphValue(const Rect<uint16_t>& rect_, uint64_t id) + : rect(rect_), ids({ id }) {} Rect<uint16_t> rect; std::set<uint64_t> 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<Value> &&values) - : op(op), values(values) {} + Instance(Operator op_, std::vector<Value> &&values_) + : op(op_), values(values_) {} bool compare(const std::vector<Value> &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 <typename Extractor> 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 <typename T> 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 <typename T> struct StopsFunction { - inline StopsFunction(const std::vector<std::pair<float, T>> &values, float base) : values(values), base(base) {} + inline StopsFunction(const std::vector<std::pair<float, T>> &values_, float base_) : values(values_), base(base_) {} T evaluate(float z) const; private: @@ -36,7 +36,7 @@ using Function = mapbox::util::variant< template <typename T> 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> source; - StyleSource(const util::ptr<SourceInfo> &info) - : info(info) + StyleSource(const util::ptr<SourceInfo> &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<uint16_t> &rect, - const GlyphMetrics &metrics) - : rect(rect), metrics(metrics) {} + inline explicit Glyph(const Rect<uint16_t> &rect_, + const GlyphMetrics &metrics_) + : rect(rect_), metrics(metrics_) {} operator bool() const { return metrics || rect; @@ -46,8 +46,8 @@ typedef std::map<uint32_t, Glyph> 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<GlyphBox> GlyphBoxes; // TODO: Transform the vec2<float>s to vec2<int16_t> to save bytes struct PlacedGlyph { - explicit PlacedGlyph(const vec2<float> &tl, const vec2<float> &tr, - const vec2<float> &bl, const vec2<float> &br, - const Rect<uint16_t> &tex, float angle, const vec2<float> &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<float> &tl_, const vec2<float> &tr_, + const vec2<float> &bl_, const vec2<float> &br_, + const Rect<uint16_t> &tex_, float angle_, const vec2<float> &anchor_, + float minScale_, float maxScale_) + : tl(tl_), + tr(tr_), + bl(bl_), + br(br_), + tex(tex_), + angle(angle_), + anchor(anchor_), + minScale(minScale_), + maxScale(maxScale_) {} vec2<float> tl, tr, bl, br; Rect<uint16_t> 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<float>::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<Type> 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<Type> 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<Type> 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<Type> 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 <typename T> 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 <typename T> 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 <typename T> 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<rwlock> &mtx) : mtx(*mtx) { mtx->rdlock(); } + inline readlock(rwlock &mtx_) : mtx(mtx_) { mtx.rdlock(); } + inline readlock(const std::unique_ptr<rwlock> &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<rwlock> &mtx) : mtx(*mtx) { mtx->wrlock(); } + inline writelock(rwlock &mtx_) : mtx(mtx_) { mtx.wrlock(); } + inline writelock(const std::unique_ptr<rwlock> &mtx_) : mtx(*mtx_) { mtx.wrlock(); } inline ~writelock() { mtx.wrunlock(); } private: @@ -148,10 +148,10 @@ public: typedef void (*after_work_callback)(T &object); template<typename... Args> - 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>(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<typename U> 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; } |