diff --git a/include/mapnik/attribute_collector.hpp b/include/mapnik/attribute_collector.hpp index 6fa698214..637e2c558 100644 --- a/include/mapnik/attribute_collector.hpp +++ b/include/mapnik/attribute_collector.hpp @@ -43,6 +43,8 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #pragma GCC diagnostic pop @@ -275,8 +277,8 @@ inline void group_attribute_collector::operator() (group_symbolizer const& sym) } // get indexed column names - int start = get(sym, keys::start_column); - int end = start + get(sym, keys::num_columns); + value_integer start = get(sym, keys::start_column); + value_integer end = start + get(sym, keys::num_columns); for (auto const& col_name : group_columns) { if (expand_index_columns_ && col_name.find('%') != std::string::npos) @@ -287,7 +289,7 @@ inline void group_attribute_collector::operator() (group_symbolizer const& sym) if (col_name.size() > 1) { // Indexed column name. add column name for each index value. - for (int col_idx = start; col_idx < end; ++col_idx) + for (value_integer col_idx = start; col_idx < end; ++col_idx) { std::string col_idx_str; if (mapnik::util::to_string(col_idx_str,col_idx)) diff --git a/include/mapnik/cairo/cairo_context.hpp b/include/mapnik/cairo/cairo_context.hpp index f4ca72a0a..9c06d727f 100644 --- a/include/mapnik/cairo/cairo_context.hpp +++ b/include/mapnik/cairo/cairo_context.hpp @@ -124,12 +124,12 @@ class cairo_pattern : private util::noncopyable public: explicit cairo_pattern(image_rgba8 const& data, double opacity = 1.0) { - int pixels = data.width() * data.height(); + std::size_t pixels = data.width() * data.height(); const unsigned int *in_ptr = data.data(); const unsigned int *in_end = in_ptr + pixels; unsigned int *out_ptr; - surface_ = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, data.width(), data.height()); + surface_ = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, static_cast(data.width()), static_cast(data.height())); out_ptr = reinterpret_cast(cairo_image_surface_get_data(surface_)); diff --git a/include/mapnik/css_color_grammar.hpp b/include/mapnik/css_color_grammar.hpp index f94d9d1d2..80c5c0a44 100644 --- a/include/mapnik/css_color_grammar.hpp +++ b/include/mapnik/css_color_grammar.hpp @@ -49,10 +49,10 @@ BOOST_FUSION_ADAPT_ADT( mapnik::color, - (unsigned, unsigned, obj.red(), obj.set_red(val)) - (unsigned, unsigned, obj.green(), obj.set_green(val)) - (unsigned, unsigned, obj.blue(), obj.set_blue(val)) - (unsigned, unsigned, obj.alpha(), obj.set_alpha(val)) + (unsigned, unsigned, obj.red(), obj.set_red(mapnik::safe_cast(val))) + (unsigned, unsigned, obj.green(), obj.set_green(mapnik::safe_cast(val))) + (unsigned, unsigned, obj.blue(), obj.set_blue(mapnik::safe_cast(val))) + (unsigned, unsigned, obj.alpha(), obj.set_alpha(mapnik::safe_cast(val))) ) namespace mapnik diff --git a/include/mapnik/expression_grammar.hpp b/include/mapnik/expression_grammar.hpp index 6ce0b5cd6..f2b6b1b6e 100644 --- a/include/mapnik/expression_grammar.hpp +++ b/include/mapnik/expression_grammar.hpp @@ -35,6 +35,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/include/mapnik/geometry_adapters.hpp b/include/mapnik/geometry_adapters.hpp index c53960bc7..0c7a65713 100644 --- a/include/mapnik/geometry_adapters.hpp +++ b/include/mapnik/geometry_adapters.hpp @@ -29,6 +29,9 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wunused-parameter" #undef B0 #include #include diff --git a/include/mapnik/geometry_centroid.hpp b/include/mapnik/geometry_centroid.hpp index 2e7dec199..71d0c0754 100644 --- a/include/mapnik/geometry_centroid.hpp +++ b/include/mapnik/geometry_centroid.hpp @@ -50,7 +50,7 @@ struct geometry_centroid return false; } - result_type operator() (geometry_collection const& collection) const + result_type operator() (geometry_collection const&) const { return false; } diff --git a/include/mapnik/geometry_correct.hpp b/include/mapnik/geometry_correct.hpp index 328dc2ed0..dcbb2d7ab 100644 --- a/include/mapnik/geometry_correct.hpp +++ b/include/mapnik/geometry_correct.hpp @@ -32,6 +32,8 @@ #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #pragma GCC diagnostic pop @@ -73,7 +75,7 @@ struct geometry_correct } template - result_type operator() (T & geom) const + result_type operator() (T &) const { //no-op } diff --git a/include/mapnik/geometry_reprojection_impl.hpp b/include/mapnik/geometry_reprojection_impl.hpp index 1e8297ba5..e5ba23f84 100644 --- a/include/mapnik/geometry_reprojection_impl.hpp +++ b/include/mapnik/geometry_reprojection_impl.hpp @@ -195,7 +195,7 @@ struct geom_reproj_copy_visitor { geometry operator() (line_string const& ls) { geometry geom; // default empty - int intial_err = n_err_; + unsigned int intial_err = n_err_; line_string new_ls = reproject_internal(ls, proj_trans_, n_err_); if (n_err_ > intial_err || new_ls.empty()) return geom; geom = std::move(new_ls); diff --git a/include/mapnik/grid/grid.hpp b/include/mapnik/grid/grid.hpp index a00479e93..0a1eeb064 100644 --- a/include/mapnik/grid/grid.hpp +++ b/include/mapnik/grid/grid.hpp @@ -33,6 +33,7 @@ #include #include #include +#include // stl #include @@ -191,12 +192,16 @@ public: if (ext0.intersects(ext1)) { box2d box = ext0.intersect(ext1); - for (std::size_t y = box.miny(); y < box.maxy(); ++y) + std::size_t miny = safe_cast(box.miny()); + std::size_t maxy = safe_cast(box.maxy()); + std::size_t minx = safe_cast(box.minx()); + std::size_t maxx = safe_cast(box.maxx()); + for (std::size_t y = miny; y < maxy; ++y) { value_type* row_to = data_.get_row(y); image_rgba8::pixel_type const * row_from = data.get_row(y - y0); - for (std::size_t x = box.minx(); x < box.maxx(); ++x) + for (std::size_t x = minx; x < maxx; ++x) { image_rgba8::pixel_type rgba = row_from[x - x0]; unsigned a = (rgba >> 24) & 0xff; diff --git a/include/mapnik/grid/grid_pixfmt.hpp b/include/mapnik/grid/grid_pixfmt.hpp index 6f61b9933..d58399476 100644 --- a/include/mapnik/grid/grid_pixfmt.hpp +++ b/include/mapnik/grid/grid_pixfmt.hpp @@ -24,9 +24,15 @@ #define MAPNIK_GRID_PIXFMT_HPP #include +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include "agg_basics.h" #include -#include +#pragma GCC diagnostic pop namespace mapnik { diff --git a/include/mapnik/grid/grid_renderer_base.hpp b/include/mapnik/grid/grid_renderer_base.hpp index 9524b1661..08a73ad35 100644 --- a/include/mapnik/grid/grid_renderer_base.hpp +++ b/include/mapnik/grid/grid_renderer_base.hpp @@ -23,9 +23,14 @@ #ifndef MAPNIK_GRID_RENDERER_BASE_HPP #define MAPNIK_GRID_RENDERER_BASE_HPP +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include "agg_renderer_base.h" -#include #include +#pragma GCC diagnostic pop +#include namespace mapnik { diff --git a/include/mapnik/image_filter.hpp b/include/mapnik/image_filter.hpp index 861c7961d..fd94444c2 100644 --- a/include/mapnik/image_filter.hpp +++ b/include/mapnik/image_filter.hpp @@ -34,6 +34,8 @@ #pragma GCC diagnostic ignored "-Wc++11-narrowing" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #pragma GCC diagnostic pop @@ -252,10 +254,10 @@ void apply_convolution_3x3(Src const& src_view, Dst & dst_view, Filter const& fi typename Src::x_iterator dst_it = dst_view.row_begin(0); // top row - for (int x = 0 ; x < src_view.width(); ++x) + for (std::size_t x = 0 ; x < static_cast(src_view.width()); ++x) { (*dst_it)[3] = src_loc[loc11][3]; // Dst.a = Src.a - for (int i = 0; i < 3; ++i) + for (std::size_t i = 0; i < 3; ++i) { bits32f p[9]; @@ -273,7 +275,7 @@ void apply_convolution_3x3(Src const& src_view, Dst & dst_view, Filter const& fi p[6] = src_loc[loc02][i]; } - if ( x == src_view.width()-1) + if ( x == static_cast(src_view.width())-1) { p[5] = p[4]; p[8] = p[7]; @@ -294,15 +296,15 @@ void apply_convolution_3x3(Src const& src_view, Dst & dst_view, Filter const& fi ++dst_it; } // carrige-return - src_loc += point2(-src_view.width(),1); + src_loc += point2(-static_cast(src_view.width()),1); // 1... height-1 rows - for (int y = 1; y(src_view.height())-1; ++y) { - for (int x = 0; x < src_view.width(); ++x) + for (std::size_t x = 0; x < static_cast(src_view.width()); ++x) { (*dst_it)[3] = src_loc[loc11][3]; // Dst.a = Src.a - for (int i = 0; i < 3; ++i) + for (std::size_t i = 0; i < 3; ++i) { bits32f p[9]; @@ -323,7 +325,7 @@ void apply_convolution_3x3(Src const& src_view, Dst & dst_view, Filter const& fi p[6] = src_loc[loc02][i]; } - if ( x == src_view.width() - 1) + if ( x == static_cast(src_view.width()) - 1) { p[2] = p[1]; p[5] = p[4]; @@ -341,15 +343,15 @@ void apply_convolution_3x3(Src const& src_view, Dst & dst_view, Filter const& fi ++src_loc.x(); } // carrige-return - src_loc += point2(-src_view.width(),1); + src_loc += point2(-static_cast(src_view.width()),1); } // bottom row - //src_loc = src_view.xy_at(0,src_view.height()-1); - for (int x = 0 ; x < src_view.width(); ++x) + //src_loc = src_view.xy_at(0,static_cast(src_view.height())-1); + for (std::size_t x = 0 ; x < static_cast(src_view.width()); ++x) { (*dst_it)[3] = src_loc[loc11][3]; // Dst.a = Src.a - for (int i = 0; i < 3; ++i) + for (std::size_t i = 0; i < 3; ++i) { bits32f p[9]; @@ -367,7 +369,7 @@ void apply_convolution_3x3(Src const& src_view, Dst & dst_view, Filter const& fi p[3] = src_loc[loc01][i]; } - if ( x == src_view.width()-1) + if ( x == static_cast(src_view.width())-1) { p[2] = p[1]; p[5] = p[4]; @@ -429,10 +431,10 @@ void apply_filter(Src & src, color_to_alpha const& op) double cr = static_cast(op.color.red())/255.0; double cg = static_cast(op.color.green())/255.0; double cb = static_cast(op.color.blue())/255.0; - for (int y=0; y(src_view.height()); ++y) { - rgba8_view_t::x_iterator src_it = src_view.row_begin(y); - for (int x=0; x(y)); + for (std::size_t x=0; x(src_view.width()); ++x) { uint8_t & r = get_color(src_it[x], red_t()); uint8_t & g = get_color(src_it[x], green_t()); @@ -490,10 +492,10 @@ void apply_filter(Src & src, colorize_alpha const& op) mapnik::filter::color_stop const& stop = op[0]; mapnik::color const& c = stop.color; rgba8_view_t src_view = rgba8_view(src); - for (int y=0; y(src_view.height()); ++y) { - rgba8_view_t::x_iterator src_it = src_view.row_begin(y); - for (int x=0; x(y)); + for (std::size_t x=0; x(src_view.width()); ++x) { uint8_t & r = get_color(src_it[x], red_t()); uint8_t & g = get_color(src_it[x], green_t()); @@ -531,10 +533,10 @@ void apply_filter(Src & src, colorize_alpha const& op) if (grad_lut.build_lut()) { rgba8_view_t src_view = rgba8_view(src); - for (int y=0; y(src_view.height()); ++y) { - rgba8_view_t::x_iterator src_it = src_view.row_begin(y); - for (int x=0; x(y)); + for (std::size_t x=0; x(src_view.width()); ++x) { uint8_t & r = get_color(src_it[x], red_t()); uint8_t & g = get_color(src_it[x], green_t()); @@ -596,10 +598,10 @@ void apply_filter(Src & src, scale_hsla const& transform) if (tinting || set_alpha) { rgba8_view_t src_view = rgba8_view(src); - for (int y=0; y(src_view.height()); ++y) { - rgba8_view_t::x_iterator src_it = src_view.row_begin(y); - for (int x=0; x(y)); + for (std::size_t x=0; x(src_view.width()); ++x) { uint8_t & r = get_color(src_it[x], red_t()); uint8_t & g = get_color(src_it[x], green_t()); @@ -679,10 +681,10 @@ void apply_filter(Src & src, gray const& /*op*/) rgba8_view_t src_view = rgba8_view(src); - for (int y=0; y(src_view.height()); ++y) { - rgba8_view_t::x_iterator src_it = src_view.row_begin(y); - for (int x=0; x(y)); + for (std::size_t x=0; x(src_view.width()); ++x) { // formula taken from boost/gil/color_convert.hpp:rgb_to_luminance uint8_t & r = get_color(src_it[x], red_t()); @@ -697,22 +699,22 @@ void apply_filter(Src & src, gray const& /*op*/) template void x_gradient_impl(Src const& src_view, Dst const& dst_view) { - for (int y=0; y(src_view.height()); ++y) { - typename Src::x_iterator src_it = src_view.row_begin(y); - typename Dst::x_iterator dst_it = dst_view.row_begin(y); + typename Src::x_iterator src_it = src_view.row_begin(static_cast(y)); + typename Dst::x_iterator dst_it = dst_view.row_begin(static_cast(y)); dst_it[0][0] = 128 + (src_it[0][0] - src_it[1][0]) / 2; dst_it[0][1] = 128 + (src_it[0][1] - src_it[1][1]) / 2; dst_it[0][2] = 128 + (src_it[0][2] - src_it[1][2]) / 2; - dst_it[dst_view.width()-1][0] = 128 + (src_it[src_view.width()-2][0] - src_it[src_view.width()-1][0]) / 2; - dst_it[dst_view.width()-1][1] = 128 + (src_it[src_view.width()-2][1] - src_it[src_view.width()-1][1]) / 2; - dst_it[dst_view.width()-1][2] = 128 + (src_it[src_view.width()-2][2] - src_it[src_view.width()-1][2]) / 2; + dst_it[dst_view.width()-1][0] = 128 + (src_it[static_cast(src_view.width())-2][0] - src_it[static_cast(src_view.width())-1][0]) / 2; + dst_it[dst_view.width()-1][1] = 128 + (src_it[static_cast(src_view.width())-2][1] - src_it[static_cast(src_view.width())-1][1]) / 2; + dst_it[dst_view.width()-1][2] = 128 + (src_it[static_cast(src_view.width())-2][2] - src_it[static_cast(src_view.width())-1][2]) / 2; - dst_it[0][3] = dst_it[src_view.width()-1][3] = 255; + dst_it[0][3] = dst_it[static_cast(src_view.width())-1][3] = 255; - for (int x=1; x(src_view.width())-1; ++x) { dst_it[x][0] = 128 + (src_it[x-1][0] - src_it[x+1][0]) / 2; dst_it[x][1] = 128 + (src_it[x-1][1] - src_it[x+1][1]) / 2; @@ -744,10 +746,10 @@ void apply_filter(Src & src, invert const& /*op*/) rgba8_view_t src_view = rgba8_view(src); - for (int y=0; y(src_view.height()); ++y) { - rgba8_view_t::x_iterator src_it = src_view.row_begin(y); - for (int x=0; x(y)); + for (std::size_t x=0; x(src_view.width()); ++x) { // we only work with premultiplied source, // thus all color values must be <= alpha diff --git a/include/mapnik/image_filter_grammar.hpp b/include/mapnik/image_filter_grammar.hpp index ec00f1ee3..9e99cf103 100644 --- a/include/mapnik/image_filter_grammar.hpp +++ b/include/mapnik/image_filter_grammar.hpp @@ -28,6 +28,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #pragma GCC diagnostic pop diff --git a/include/mapnik/image_filter_grammar_impl.hpp b/include/mapnik/image_filter_grammar_impl.hpp index c88089f90..be43ef1e9 100644 --- a/include/mapnik/image_filter_grammar_impl.hpp +++ b/include/mapnik/image_filter_grammar_impl.hpp @@ -25,7 +25,10 @@ #include // spirit +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" #include +#pragma GCC diagnostic pop namespace mapnik { diff --git a/include/mapnik/image_null.hpp b/include/mapnik/image_null.hpp index 285a57910..df259a5bf 100644 --- a/include/mapnik/image_null.hpp +++ b/include/mapnik/image_null.hpp @@ -42,34 +42,34 @@ public: private: public: image() {} - image(int width, - int height, - bool initialize = true, - bool premultiplied = false, - bool painted = false) {} - image(image const& rhs) {} - image(image && rhs) noexcept {} - image& operator=(image rhs) { return *this; } + image(int /*width*/, + int /*height*/, + bool /*initialize*/ = true, + bool /*premultiplied*/ = false, + bool /*painted*/ = false) {} + image(image const&) {} + image(image &&) noexcept {} + image& operator=(image) { return *this; } imageconst& operator=(image const& rhs) const { return rhs; } - bool operator==(image const& rhs) const { return true; } - bool operator<(image const& rhs) const { return false; } + bool operator==(image const&) const { return true; } + bool operator<(image const&) const { return false; } std::size_t width() const { return 0; } std::size_t height() const { return 0; } std::size_t size() const { return 0; } std::size_t row_size() const { return 0; } - void set(pixel_type const& t) { throw std::runtime_error("Can not set values for null image"); } - pixel_type& operator() (std::size_t i, std::size_t j) { throw std::runtime_error("Can not get or set values for null image"); } - pixel_type const& operator() (std::size_t i, std::size_t j) const { throw std::runtime_error("Can not get or set values for null image"); } + void set(pixel_type const&) { throw std::runtime_error("Can not set values for null image"); } + pixel_type& operator() (std::size_t, std::size_t) { throw std::runtime_error("Can not get or set values for null image"); } + pixel_type const& operator() (std::size_t, std::size_t) const { throw std::runtime_error("Can not get or set values for null image"); } unsigned const char* bytes() const { return nullptr; } unsigned char* bytes() {return nullptr; } double get_offset() const { return 0.0; } - void set_offset(double set) {} + void set_offset(double) {} double get_scaling() const { return 1.0; } - void set_scaling(double set) {} + void set_scaling(double) {} bool get_premultiplied() const { return false; } - void set_premultiplied(bool set) {} - void painted(bool painted) {} + void set_premultiplied(bool) {} + void painted(bool) {} bool painted() const { return false; } image_dtype get_dtype() const { return dtype; } }; diff --git a/include/mapnik/image_view_null.hpp b/include/mapnik/image_view_null.hpp index 1ad6c3d04..aad3e9eb2 100644 --- a/include/mapnik/image_view_null.hpp +++ b/include/mapnik/image_view_null.hpp @@ -40,20 +40,20 @@ public: image_view() {} ~image_view() {}; - image_view(image_view const& rhs) {} - image_view & operator=(image_view const& rhs) { return *this; } - bool operator==(image_view const& rhs) const { return true; } - bool operator<(image_view const& rhs) const { return false; } + image_view(image_view const&) {} + image_view & operator=(image_view const&) { return *this; } + bool operator==(image_view const&) const { return true; } + bool operator<(image_view const&) const { return false; } std::size_t x() const { return 0; } std::size_t y() const { return 0; } std::size_t width() const { return 0; } std::size_t height() const { return 0; } - pixel_type operator() (std::size_t i, std::size_t j) const { throw std::runtime_error("Can not get from a null image view"); } + pixel_type operator() (std::size_t, std::size_t) const { throw std::runtime_error("Can not get from a null image view"); } std::size_t size() const { return 0; } std::size_t row_size() const { return 0; } - const pixel_type* get_row(std::size_t row) const { return nullptr; } - const pixel_type* get_row(std::size_t row, std::size_t x0) const { return nullptr; } + const pixel_type* get_row(std::size_t) const { return nullptr; } + const pixel_type* get_row(std::size_t, std::size_t) const { return nullptr; } bool get_premultiplied() const { return false; } double get_offset() const { return 0.0; } double get_scaling() const { return 1.0; } diff --git a/include/mapnik/json/error_handler.hpp b/include/mapnik/json/error_handler.hpp index 74b0aa48d..1925002a3 100644 --- a/include/mapnik/json/error_handler.hpp +++ b/include/mapnik/json/error_handler.hpp @@ -25,7 +25,10 @@ #include #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" #include +#pragma GCC diagnostic pop namespace mapnik { namespace json { diff --git a/include/mapnik/json/extract_bounding_box_grammar.hpp b/include/mapnik/json/extract_bounding_box_grammar.hpp index 1e061e706..2183fe501 100644 --- a/include/mapnik/json/extract_bounding_box_grammar.hpp +++ b/include/mapnik/json/extract_bounding_box_grammar.hpp @@ -33,6 +33,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/include/mapnik/json/feature_generator_grammar.hpp b/include/mapnik/json/feature_generator_grammar.hpp index 3852c7ba6..d543c206c 100644 --- a/include/mapnik/json/feature_generator_grammar.hpp +++ b/include/mapnik/json/feature_generator_grammar.hpp @@ -84,8 +84,8 @@ template struct get_id { using feature_type = T; - using result_type = int; - int operator() (feature_type const& f) const + using result_type = mapnik::value_integer; + result_type operator() (feature_type const& f) const { return f.id(); } diff --git a/include/mapnik/json/feature_grammar.hpp b/include/mapnik/json/feature_grammar.hpp index 08eb39df1..94915af02 100644 --- a/include/mapnik/json/feature_grammar.hpp +++ b/include/mapnik/json/feature_grammar.hpp @@ -31,10 +31,13 @@ #include #include #include -// spirit::qi + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" #include #include #include +#pragma GCC diagnostic pop namespace mapnik { namespace json { diff --git a/include/mapnik/json/generic_json.hpp b/include/mapnik/json/generic_json.hpp index edb1284f4..c9fbf822c 100644 --- a/include/mapnik/json/generic_json.hpp +++ b/include/mapnik/json/generic_json.hpp @@ -31,6 +31,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #pragma GCC diagnostic pop diff --git a/include/mapnik/json/geometry_generator_grammar.hpp b/include/mapnik/json/geometry_generator_grammar.hpp index 51990add4..f325f2f86 100644 --- a/include/mapnik/json/geometry_generator_grammar.hpp +++ b/include/mapnik/json/geometry_generator_grammar.hpp @@ -33,6 +33,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include // for vc++ and android whose c++11 libs lack std::trunc diff --git a/include/mapnik/json/positions_grammar.hpp b/include/mapnik/json/positions_grammar.hpp index 3440d820c..3e67c31c2 100644 --- a/include/mapnik/json/positions_grammar.hpp +++ b/include/mapnik/json/positions_grammar.hpp @@ -34,6 +34,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/include/mapnik/json/properties_generator_grammar.hpp b/include/mapnik/json/properties_generator_grammar.hpp index ea5da9332..08a397484 100644 --- a/include/mapnik/json/properties_generator_grammar.hpp +++ b/include/mapnik/json/properties_generator_grammar.hpp @@ -32,6 +32,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/include/mapnik/json/topojson_grammar.hpp b/include/mapnik/json/topojson_grammar.hpp index bf8d24101..b180bdc8f 100644 --- a/include/mapnik/json/topojson_grammar.hpp +++ b/include/mapnik/json/topojson_grammar.hpp @@ -34,6 +34,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #pragma GCC diagnostic pop diff --git a/include/mapnik/marker.hpp b/include/mapnik/marker.hpp index 3eaaebec8..7ef699338 100644 --- a/include/mapnik/marker.hpp +++ b/include/mapnik/marker.hpp @@ -70,19 +70,19 @@ public: box2d bounding_box() const { - double width = bitmap_data_.width(); - double height = bitmap_data_.height(); - return box2d(0, 0, width, height); + std::size_t width = bitmap_data_.width(); + std::size_t height = bitmap_data_.height(); + return box2d(static_cast(0), static_cast(0), static_cast(width), static_cast(height)); } - inline std::size_t width() const + inline double width() const { - return bitmap_data_.width(); + return static_cast(bitmap_data_.width()); } - inline std::size_t height() const + inline double height() const { - return bitmap_data_.height(); + return static_cast(bitmap_data_.height()); } image_rgba8 const& get_data() const @@ -169,7 +169,7 @@ struct get_marker_width_visitor template double operator()(T const& data) const { - return static_cast(data.width()); + return data.width(); } }; @@ -178,7 +178,7 @@ struct get_marker_height_visitor template double operator()(T const& data) const { - return static_cast(data.height()); + return data.height(); } }; diff --git a/include/mapnik/palette.hpp b/include/mapnik/palette.hpp index cf21338ac..ae88c146f 100644 --- a/include/mapnik/palette.hpp +++ b/include/mapnik/palette.hpp @@ -30,6 +30,8 @@ #define USE_DENSE_HASH_MAP +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" #ifdef USE_DENSE_HASH_MAP #include using rgba_hash_table = google::dense_hash_map; @@ -37,6 +39,7 @@ #include using rgba_hash_table = boost::unordered_map; #endif +#pragma GCC diagnostic pop // stl #include diff --git a/include/mapnik/params_impl.hpp b/include/mapnik/params_impl.hpp index 255521fec..16170bab0 100644 --- a/include/mapnik/params_impl.hpp +++ b/include/mapnik/params_impl.hpp @@ -34,6 +34,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #pragma GCC diagnostic pop diff --git a/include/mapnik/path.hpp b/include/mapnik/path.hpp index b57fe509f..8f43ae73b 100644 --- a/include/mapnik/path.hpp +++ b/include/mapnik/path.hpp @@ -124,7 +124,7 @@ struct vertex_adapter : private util::noncopyable unsigned vertex(double* x, double* y) const { - return path_.cont_.get_vertex(itr_++,x,y); + return path_.cont_.get_vertex(static_cast(itr_++),x,y); } unsigned vertex(std::size_t index, double* x, double* y) const diff --git a/include/mapnik/path_expression_grammar.hpp b/include/mapnik/path_expression_grammar.hpp index a69f535a2..4f5654fda 100644 --- a/include/mapnik/path_expression_grammar.hpp +++ b/include/mapnik/path_expression_grammar.hpp @@ -31,6 +31,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #pragma GCC diagnostic pop diff --git a/include/mapnik/proj_strategy.hpp b/include/mapnik/proj_strategy.hpp index 2afb17052..3d7100c0f 100644 --- a/include/mapnik/proj_strategy.hpp +++ b/include/mapnik/proj_strategy.hpp @@ -32,6 +32,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/include/mapnik/quad_tree.hpp b/include/mapnik/quad_tree.hpp index 474ee2e7c..84fd4382d 100644 --- a/include/mapnik/quad_tree.hpp +++ b/include/mapnik/quad_tree.hpp @@ -32,6 +32,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #pragma GCC diagnostic pop diff --git a/include/mapnik/renderer_common/pattern_alignment.hpp b/include/mapnik/renderer_common/pattern_alignment.hpp index 53084b824..12f746d32 100644 --- a/include/mapnik/renderer_common/pattern_alignment.hpp +++ b/include/mapnik/renderer_common/pattern_alignment.hpp @@ -51,7 +51,7 @@ struct apply_local_alignment } template - void operator() (Adapter & va) + void operator() (Adapter &) { // no-op } diff --git a/include/mapnik/renderer_common/process_group_symbolizer.hpp b/include/mapnik/renderer_common/process_group_symbolizer.hpp index 00017301a..40549cdf3 100644 --- a/include/mapnik/renderer_common/process_group_symbolizer.hpp +++ b/include/mapnik/renderer_common/process_group_symbolizer.hpp @@ -280,9 +280,9 @@ void render_group_symbolizer(group_symbolizer const& sym, // run feature or sub feature through the group rules & symbolizers // for each index value in the range - int start = get(sym, keys::start_column); - int end = start + get(sym, keys::num_columns); - for (int col_idx = start; col_idx < end; ++col_idx) + value_integer start = get(sym, keys::start_column); + value_integer end = start + get(sym, keys::num_columns); + for (value_integer col_idx = start; col_idx < end; ++col_idx) { // create sub feature with indexed column values feature_ptr sub_feature = feature_factory::create(sub_feature_ctx, col_idx); @@ -295,7 +295,7 @@ void render_group_symbolizer(group_symbolizer const& sym, if (col_name.size() == 1) { // column name is '%' by itself, so give the index as the value - sub_feature->put(col_name, (value_integer)col_idx); + sub_feature->put(col_name, col_idx); } else { diff --git a/include/mapnik/sql_utils.hpp b/include/mapnik/sql_utils.hpp index 543ea25ee..b53f06bf2 100644 --- a/include/mapnik/sql_utils.hpp +++ b/include/mapnik/sql_utils.hpp @@ -31,6 +31,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #pragma GCC diagnostic pop diff --git a/include/mapnik/svg/geometry_svg_generator.hpp b/include/mapnik/svg/geometry_svg_generator.hpp index 3f75d8444..d43022966 100644 --- a/include/mapnik/svg/geometry_svg_generator.hpp +++ b/include/mapnik/svg/geometry_svg_generator.hpp @@ -38,6 +38,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/include/mapnik/svg/output/svg_output_grammars.hpp b/include/mapnik/svg/output/svg_output_grammars.hpp index ce1afe760..6d9aff566 100644 --- a/include/mapnik/svg/output/svg_output_grammars.hpp +++ b/include/mapnik/svg/output/svg_output_grammars.hpp @@ -41,6 +41,8 @@ namespace mapnik { namespace svg { #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/include/mapnik/svg/output/svg_output_grammars_impl.hpp b/include/mapnik/svg/output/svg_output_grammars_impl.hpp index ab41aabae..f6647c3f6 100644 --- a/include/mapnik/svg/output/svg_output_grammars_impl.hpp +++ b/include/mapnik/svg/output/svg_output_grammars_impl.hpp @@ -31,6 +31,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #pragma GCC diagnostic pop diff --git a/include/mapnik/svg/svg_converter.hpp b/include/mapnik/svg/svg_converter.hpp index ddde41d82..a88b30b3d 100644 --- a/include/mapnik/svg/svg_converter.hpp +++ b/include/mapnik/svg/svg_converter.hpp @@ -27,6 +27,7 @@ #include #include #include +#include // agg #include "agg_path_storage.h" @@ -57,8 +58,8 @@ public: void begin_path() { - unsigned idx = source_.start_new_path(); - attributes_.add(path_attributes(cur_attr(), idx)); + std::size_t idx = source_.start_new_path(); + attributes_.add(path_attributes(cur_attr(), safe_cast(idx))); } void end_path() @@ -91,7 +92,7 @@ public: double y2 = 0.0; if(source_.total_vertices()) { - source_.vertex(source_.total_vertices() - 1, &x2, &y2); + source_.vertex(safe_cast(source_.total_vertices() - 1), &x2, &y2); if(rel) x += x2; source_.line_to(x, y2); } @@ -103,7 +104,7 @@ public: double y2 = 0.0; if(source_.total_vertices()) { - source_.vertex(source_.total_vertices() - 1, &x2, &y2); + source_.vertex(safe_cast(source_.total_vertices() - 1), &x2, &y2); if(rel) y += y2; source_.line_to(x2, y); } diff --git a/include/mapnik/svg/svg_path_adapter.hpp b/include/mapnik/svg/svg_path_adapter.hpp index 72fa29a65..26383fcd0 100644 --- a/include/mapnik/svg/svg_path_adapter.hpp +++ b/include/mapnik/svg/svg_path_adapter.hpp @@ -26,6 +26,8 @@ // mapnik #include #include +#include + // agg #include "agg_math.h" #include "agg_array.h" @@ -53,7 +55,7 @@ public: // Make path functions //-------------------------------------------------------------------- - unsigned start_new_path(); + std::size_t start_new_path(); void move_to(double x, double y); void move_rel(double dx, double dy); @@ -112,7 +114,7 @@ public: const container_type& vertices() const { return vertices_; } container_type& vertices() { return vertices_; } - unsigned total_vertices() const; + std::size_t total_vertices() const; void rel_to_abs(double* x, double* y) const; @@ -263,7 +265,7 @@ private: //------------------------------------------------------------------------ template -unsigned path_adapter::start_new_path() +std::size_t path_adapter::start_new_path() { if(!is_stop(vertices_.last_command())) { @@ -547,7 +549,7 @@ inline void path_adapter::close_polygon(unsigned flags) //------------------------------------------------------------------------ template -inline unsigned path_adapter::total_vertices() const +inline std::size_t path_adapter::total_vertices() const { return vertices_.total_vertices(); } @@ -886,7 +888,7 @@ public: { return vertices_.size() ? vertices_[vertices_.size() - 1].cmd : - (unsigned)path_cmd_stop; + path_cmd_stop; } unsigned last_vertex(double* x, double* y) const @@ -896,7 +898,7 @@ public: *x = *y = 0.0; return path_cmd_stop; } - return vertex(vertices_.size() - 1, x, y); + return vertex(safe_cast(vertices_.size() - 1), x, y); } unsigned prev_vertex(double* x, double* y) const @@ -906,7 +908,7 @@ public: *x = *y = 0.0; return path_cmd_stop; } - return vertex(vertices_.size() - 2, x, y); + return vertex(safe_cast(vertices_.size() - 2), x, y); } double last_x() const diff --git a/include/mapnik/svg/svg_path_commands.hpp b/include/mapnik/svg/svg_path_commands.hpp index ff398368b..9c5266c59 100644 --- a/include/mapnik/svg/svg_path_commands.hpp +++ b/include/mapnik/svg/svg_path_commands.hpp @@ -31,6 +31,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/include/mapnik/svg/svg_renderer_agg.hpp b/include/mapnik/svg/svg_renderer_agg.hpp index 569f3fa35..653f3c223 100644 --- a/include/mapnik/svg/svg_renderer_agg.hpp +++ b/include/mapnik/svg/svg_renderer_agg.hpp @@ -27,10 +27,16 @@ #include #include #include +#include #include #if defined(GRID_RENDERER) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include +#pragma GCC diagnostic pop #endif // agg @@ -341,7 +347,7 @@ public: void render_id(Rasterizer& ras, Scanline& sl, Renderer& ren, - int feature_id, + mapnik::value_integer feature_id, agg::trans_affine const& mtx, double /*opacity*/, box2d const& /*symbol_bbox*/) diff --git a/include/mapnik/svg/svg_transform_grammar.hpp b/include/mapnik/svg/svg_transform_grammar.hpp index 68ed02198..9e4f6f661 100644 --- a/include/mapnik/svg/svg_transform_grammar.hpp +++ b/include/mapnik/svg/svg_transform_grammar.hpp @@ -34,6 +34,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/include/mapnik/text/face.hpp b/include/mapnik/text/face.hpp index 31dd45aa2..5f636bb81 100644 --- a/include/mapnik/text/face.hpp +++ b/include/mapnik/text/face.hpp @@ -87,7 +87,7 @@ public: void set_character_sizes(double size); void set_unscaled_character_sizes(); - unsigned size() const { return faces_.size(); } + std::size_t size() const { return faces_.size(); } iterator begin() { return faces_.begin(); } iterator end() { return faces_.end(); } private: diff --git a/include/mapnik/text/placements/list.hpp b/include/mapnik/text/placements/list.hpp index 1fa4c8712..993012d5d 100644 --- a/include/mapnik/text/placements/list.hpp +++ b/include/mapnik/text/placements/list.hpp @@ -38,7 +38,7 @@ public: virtual void add_expressions(expression_set & output) const; text_symbolizer_properties & add(); text_symbolizer_properties & get(unsigned i); - unsigned size() const; + std::size_t size() const; static text_placements_ptr from_xml(xml_node const& xml, fontset_map const& fontsets, bool is_shield); private: std::vector list_; diff --git a/include/mapnik/text/symbolizer_helpers.hpp b/include/mapnik/text/symbolizer_helpers.hpp index ce31a04b7..fc5279fe6 100644 --- a/include/mapnik/text/symbolizer_helpers.hpp +++ b/include/mapnik/text/symbolizer_helpers.hpp @@ -90,7 +90,7 @@ protected: view_transform const& t_; box2d dims_; box2d const& query_extent_; - float scale_factor_; + double scale_factor_; //Processing // Remaining geometries to be processed. diff --git a/include/mapnik/util/container_adapter.hpp b/include/mapnik/util/container_adapter.hpp index da47b2ec5..d508190e9 100644 --- a/include/mapnik/util/container_adapter.hpp +++ b/include/mapnik/util/container_adapter.hpp @@ -32,6 +32,8 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #pragma GCC diagnostic pop diff --git a/include/mapnik/util/hsl.hpp b/include/mapnik/util/hsl.hpp index e0b2d598a..40c212355 100644 --- a/include/mapnik/util/hsl.hpp +++ b/include/mapnik/util/hsl.hpp @@ -59,7 +59,7 @@ inline double hue_to_rgb(double m1, double m2, double h) inline void hsl2rgb(double h, double s, double l, double & r, double & g, double & b) { - if (!s) { + if (s == 0.0) { r = g = b = l; } else diff --git a/include/mapnik/util/path_iterator.hpp b/include/mapnik/util/path_iterator.hpp index 840e63ac4..b2d70ca0e 100644 --- a/include/mapnik/util/path_iterator.hpp +++ b/include/mapnik/util/path_iterator.hpp @@ -111,7 +111,7 @@ private: void increment() { - std::get<0>(v_) = vertices_->cont_.get_vertex(pos_++, &std::get<1>(v_), &std::get<2>(v_)); + std::get<0>(v_) = vertices_->cont_.get_vertex(static_cast(pos_++), &std::get<1>(v_), &std::get<2>(v_)); } bool equal( path_iterator const& other) const diff --git a/include/mapnik/vertex_converters.hpp b/include/mapnik/vertex_converters.hpp index 1380bd55e..7b35e3a72 100644 --- a/include/mapnik/vertex_converters.hpp +++ b/include/mapnik/vertex_converters.hpp @@ -325,7 +325,7 @@ struct converters_helper template static void set(Dispatcher &, std::size_t) {} template - static void forward(Dispatcher & disp, Geometry & geom, Processor & proc) + static void forward(Dispatcher &, Geometry & geom, Processor & proc) { proc.add_path(geom); } diff --git a/include/mapnik/wkt/wkt_generator_grammar.hpp b/include/mapnik/wkt/wkt_generator_grammar.hpp index 0d4286ed4..e4a396959 100644 --- a/include/mapnik/wkt/wkt_generator_grammar.hpp +++ b/include/mapnik/wkt/wkt_generator_grammar.hpp @@ -34,6 +34,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include // for vc++ and android whose c++11 libs lack std::trunc diff --git a/include/mapnik/wkt/wkt_grammar.hpp b/include/mapnik/wkt/wkt_grammar.hpp index c2245631c..43c5334a1 100644 --- a/include/mapnik/wkt/wkt_grammar.hpp +++ b/include/mapnik/wkt/wkt_grammar.hpp @@ -30,6 +30,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/include/mapnik/xml_attribute_cast.hpp b/include/mapnik/xml_attribute_cast.hpp index 1a3cb98f2..bc515c525 100644 --- a/include/mapnik/xml_attribute_cast.hpp +++ b/include/mapnik/xml_attribute_cast.hpp @@ -37,7 +37,10 @@ #include // boost +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" #include +#pragma GCC diagnostic pop // stl #include @@ -166,7 +169,7 @@ struct do_xml_attribute_cast > template <> struct do_xml_attribute_cast { - static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + static inline boost::optional xml_attribute_cast_impl(xml_tree const&, std::string const& source) { return parse_color(source); } @@ -176,7 +179,7 @@ struct do_xml_attribute_cast template <> struct do_xml_attribute_cast { - static inline boost::optional xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source) + static inline boost::optional xml_attribute_cast_impl(xml_tree const&, std::string const& source) { return boost::optional(source); } @@ -206,7 +209,7 @@ struct do_xml_attribute_cast template <> struct do_xml_attribute_cast { - static inline boost::optional xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) + static inline boost::optional xml_attribute_cast_impl(xml_tree const&, std::string const& source) { return mapnik::font_feature_settings(source); } diff --git a/include/mapnik/xml_tree.hpp b/include/mapnik/xml_tree.hpp index f13cd4170..8f2d177de 100644 --- a/include/mapnik/xml_tree.hpp +++ b/include/mapnik/xml_tree.hpp @@ -36,7 +36,7 @@ namespace mapnik class MAPNIK_DECL xml_tree { public: - xml_tree(std::string const& encoding="utf8"); + xml_tree(); void set_filename(std::string const& fn); std::string const& filename() const; xml_node &root(); diff --git a/plugins/input/csv/csv_utils.hpp b/plugins/input/csv/csv_utils.hpp index 3ec8c9fcb..34583236c 100644 --- a/plugins/input/csv/csv_utils.hpp +++ b/plugins/input/csv/csv_utils.hpp @@ -26,6 +26,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" +#pragma GCC diagnostic ignored "-Wsign-conversion" #include #pragma GCC diagnostic pop diff --git a/plugins/input/geojson/geojson_datasource.hpp b/plugins/input/geojson/geojson_datasource.hpp index 66c54e907..fc060ba5e 100644 --- a/plugins/input/geojson/geojson_datasource.hpp +++ b/plugins/input/geojson/geojson_datasource.hpp @@ -40,6 +40,8 @@ #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #pragma GCC diagnostic pop diff --git a/plugins/input/shape/dbfile.cpp b/plugins/input/shape/dbfile.cpp index 2da4978a6..f042d7a4b 100644 --- a/plugins/input/shape/dbfile.cpp +++ b/plugins/input/shape/dbfile.cpp @@ -32,6 +32,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" +#pragma GCC diagnostic ignored "-Wshadow" #include #ifdef SHAPE_MEMORY_MAPPED_FILE #include diff --git a/plugins/input/shape/dbfile.hpp b/plugins/input/shape/dbfile.hpp index 75e77d323..ca8ec82d9 100644 --- a/plugins/input/shape/dbfile.hpp +++ b/plugins/input/shape/dbfile.hpp @@ -29,11 +29,11 @@ #include #ifdef SHAPE_MEMORY_MAPPED_FILE #include -#endif - - -// boost +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" #include +#pragma GCC diagnostic pop +#endif // stl #include diff --git a/plugins/input/shape/shapefile.hpp b/plugins/input/shape/shapefile.hpp index 78b2deb1b..b285b6790 100644 --- a/plugins/input/shape/shapefile.hpp +++ b/plugins/input/shape/shapefile.hpp @@ -34,9 +34,12 @@ #include #include #ifdef SHAPE_MEMORY_MAPPED_FILE +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" #include -#include #include +#pragma GCC diagnostic pop +#include #endif #include diff --git a/plugins/input/topojson/topojson_datasource.hpp b/plugins/input/topojson/topojson_datasource.hpp index 829045028..8f5eb504d 100644 --- a/plugins/input/topojson/topojson_datasource.hpp +++ b/plugins/input/topojson/topojson_datasource.hpp @@ -40,6 +40,8 @@ #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/plugins/input/topojson/topojson_featureset.cpp b/plugins/input/topojson/topojson_featureset.cpp index ed53932e8..0b319d2cb 100644 --- a/plugins/input/topojson/topojson_featureset.cpp +++ b/plugins/input/topojson/topojson_featureset.cpp @@ -132,7 +132,7 @@ struct feature_generator { index_type index = line.ring; index_type arc_index = index < 0 ? std::abs(index) - 1 : index; - if (arc_index < num_arcs_) + if (arc_index >= 0 && arc_index < static_cast(num_arcs_)) { auto const& arcs = topo_.arcs[arc_index]; double px = 0, py = 0; @@ -168,7 +168,7 @@ struct feature_generator for (auto const& index : multi_line.rings) { index_type arc_index = index < 0 ? std::abs(index) - 1 : index; - if (arc_index < num_arcs_) + if (arc_index >= 0 && arc_index < static_cast(num_arcs_)) { hit = true; double px = 0, py = 0; @@ -216,7 +216,7 @@ struct feature_generator double px = 0, py = 0; bool reverse = index < 0; index_type arc_index = reverse ? std::abs(index) - 1 : index; - if (arc_index < num_arcs_) + if (arc_index >= 0 && arc_index < static_cast(num_arcs_)) { hit = true; auto const& arcs = topo_.arcs[arc_index]; @@ -296,7 +296,7 @@ struct feature_generator double px = 0, py = 0; bool reverse = index < 0; index_type arc_index = reverse ? std::abs(index) - 1 : index; - if (arc_index < num_arcs_) + if (arc_index >= 0 && arc_index < static_cast(num_arcs_)) { hit = true; auto const& arcs = topo_.arcs[arc_index]; diff --git a/src/agg/agg_renderer.cpp b/src/agg/agg_renderer.cpp index 67723d064..6b0f8bbb9 100644 --- a/src/agg/agg_renderer.cpp +++ b/src/agg/agg_renderer.cpp @@ -128,16 +128,16 @@ struct setup_agg_bg_visitor void operator() (marker_rgba8 const& marker) { mapnik::image_rgba8 const& bg_image = marker.get_data(); - int w = bg_image.width(); - int h = bg_image.height(); + std::size_t w = bg_image.width(); + std::size_t h = bg_image.height(); if ( w > 0 && h > 0) { // repeat background-image both vertically and horizontally - unsigned x_steps = static_cast(std::ceil(common_.width_/double(w))); - unsigned y_steps = static_cast(std::ceil(common_.height_/double(h))); - for (unsigned x=0;x(std::ceil(common_.width_/double(w))); + std::size_t y_steps = static_cast(std::ceil(common_.height_/double(h))); + for (std::size_t x=0;xfill, glyph.format->text_opacity); - show_glyph(glyph.glyph_index, pixel_position(sx + pos.x, sy - pos.y)); + show_glyph(glyph.glyph_index, pixel_position(sx + new_pos.x, sy - new_pos.y)); } } diff --git a/src/cairo/cairo_renderer.cpp b/src/cairo/cairo_renderer.cpp index b4293afac..24f3b54b7 100644 --- a/src/cairo/cairo_renderer.cpp +++ b/src/cairo/cairo_renderer.cpp @@ -110,16 +110,16 @@ struct setup_marker_visitor void operator() (marker_rgba8 const& marker) { mapnik::image_rgba8 const& bg_image = marker.get_data(); - int w = bg_image.width(); - int h = bg_image.height(); + std::size_t w = bg_image.width(); + std::size_t h = bg_image.height(); if ( w > 0 && h > 0) { // repeat background-image both vertically and horizontally - unsigned x_steps = unsigned(std::ceil(common_.width_/double(w))); - unsigned y_steps = unsigned(std::ceil(common_.height_/double(h))); - for (unsigned x=0;x::end_layer_processing(layer const&) } template -void cairo_renderer::start_style_processing(feature_type_style const& st) +void cairo_renderer::start_style_processing(feature_type_style const&) { MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer:start style processing"; } template -void cairo_renderer::end_style_processing(feature_type_style const& st) +void cairo_renderer::end_style_processing(feature_type_style const&) { MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer:end style processing"; } diff --git a/src/cairo/process_line_pattern_symbolizer.cpp b/src/cairo/process_line_pattern_symbolizer.cpp index ff7dd018e..86f7c81c5 100644 --- a/src/cairo/process_line_pattern_symbolizer.cpp +++ b/src/cairo/process_line_pattern_symbolizer.cpp @@ -43,8 +43,8 @@ struct cairo_renderer_process_visitor_l cairo_renderer_process_visitor_l(renderer_common const& common, line_pattern_symbolizer const& sym, mapnik::feature_impl & feature, - unsigned & width, - unsigned & height) + std::size_t & width, + std::size_t & height) : common_(common), sym_(sym), feature_(feature), @@ -81,8 +81,8 @@ struct cairo_renderer_process_visitor_l renderer_common const& common_; line_pattern_symbolizer const& sym_; mapnik::feature_impl & feature_; - unsigned & width_; - unsigned & height_; + std::size_t & width_; + std::size_t & height_; }; template @@ -106,8 +106,8 @@ void cairo_renderer::process(line_pattern_symbolizer const& sym, if (marker->is()) return; - unsigned width = marker->width(); - unsigned height = marker->height(); + std::size_t width = marker->width(); + std::size_t height = marker->height(); cairo_save_restore guard(context_); context_.set_operator(comp_op); diff --git a/src/cairo/process_markers_symbolizer.cpp b/src/cairo/process_markers_symbolizer.cpp index 3cfb39496..a042a1ca1 100644 --- a/src/cairo/process_markers_symbolizer.cpp +++ b/src/cairo/process_markers_symbolizer.cpp @@ -59,7 +59,7 @@ struct vector_markers_dispatch_cairo : public vector_markers_dispatch double scale_factor, feature_impl & feature, mapnik::attributes const& vars, - bool snap_to_pixels, + bool /* snap_to_pixels */, // only used in agg renderer currently RendererContext const& renderer_context) : vector_markers_dispatch(src, marker_trans, sym, detector, scale_factor, feature, vars), path_(path), diff --git a/src/color.cpp b/src/color.cpp index 5d25f3146..2a796e546 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -33,6 +33,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include diff --git a/src/conversions.cpp b/src/conversions.cpp index 094ac0e1e..ec6c8d17d 100644 --- a/src/conversions.cpp +++ b/src/conversions.cpp @@ -34,6 +34,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #ifdef MAPNIK_KARMA_TO_STRING #include diff --git a/src/grid/process_line_pattern_symbolizer.cpp b/src/grid/process_line_pattern_symbolizer.cpp index 0b86c789b..56637fed2 100644 --- a/src/grid/process_line_pattern_symbolizer.cpp +++ b/src/grid/process_line_pattern_symbolizer.cpp @@ -82,7 +82,7 @@ void grid_renderer::process(line_pattern_symbolizer const& sym, ras_ptr->reset(); - int stroke_width = mark->width(); + std::size_t stroke_width = mark->width(); agg::trans_affine tr; auto transform = get_optional(sym, keys::geometry_transform); diff --git a/src/group/group_layout_manager.cpp b/src/group/group_layout_manager.cpp index 7c6f7b8c6..70d59524e 100644 --- a/src/group/group_layout_manager.cpp +++ b/src/group/group_layout_manager.cpp @@ -23,6 +23,7 @@ // mapnik #include #include +#include // std #include @@ -85,7 +86,7 @@ struct process_layout } bound_box layout_box; - size_t middle_ifirst = (member_boxes_.size() - 1) >> 1; + int middle_ifirst = safe_cast((member_boxes_.size() - 1) >> 1); int top_i = 0; int bottom_i = 0; if (middle_ifirst % 2 == 0) @@ -102,8 +103,8 @@ struct process_layout while (bottom_i >= 0 && top_i >= 0 && top_i < static_cast(member_offsets_.size())) { - layout_box.expand_to_include(make_horiz_pair(top_i, layout_box.miny() - y_margin, -1, x_margin, layout.get_max_difference())); - layout_box.expand_to_include(make_horiz_pair(bottom_i, layout_box.maxy() + y_margin, 1, x_margin, layout.get_max_difference())); + layout_box.expand_to_include(make_horiz_pair(static_cast(top_i), layout_box.miny() - y_margin, -1, x_margin, layout.get_max_difference())); + layout_box.expand_to_include(make_horiz_pair(static_cast(bottom_i), layout_box.maxy() + y_margin, 1, x_margin, layout.get_max_difference())); top_i -= 2; bottom_i += 2; } diff --git a/src/image_copy.cpp b/src/image_copy.cpp index ef220389e..55f501a74 100644 --- a/src/image_copy.cpp +++ b/src/image_copy.cpp @@ -50,10 +50,10 @@ struct visitor_image_copy template T0 operator() (T1 const& src) { - T0 dst(src.width(), src.height(), false); - for (unsigned y = 0; y < dst.height(); ++y) + T0 dst(safe_cast(src.width()), safe_cast(src.height()), false); + for (std::size_t y = 0; y < dst.height(); ++y) { - for (unsigned x = 0; x < dst.width(); ++x) + for (std::size_t x = 0; x < dst.width(); ++x) { dst(x,y) = safe_cast(src(x,y)); } @@ -95,12 +95,12 @@ struct visitor_image_copy_so { double src_offset = src.get_offset(); double src_scaling = src.get_scaling(); - T0 dst(src.width(), src.height(), false); + T0 dst(safe_cast(src.width()), safe_cast(src.height()), false); dst.set_scaling(scaling_); dst.set_offset(offset_); - for (unsigned y = 0; y < dst.height(); ++y) + for (std::size_t y = 0; y < dst.height(); ++y) { - for (unsigned x = 0; x < dst.width(); ++x) + for (std::size_t x = 0; x < dst.width(); ++x) { double scaled_src_val = (safe_cast(src(x,y)) * src_scaling) + src_offset; double dst_val = (scaled_src_val - offset_) / scaling_; diff --git a/src/image_filter_types.cpp b/src/image_filter_types.cpp index 22c474f86..cd5b7d3f1 100644 --- a/src/image_filter_types.cpp +++ b/src/image_filter_types.cpp @@ -30,6 +30,8 @@ #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #pragma GCC diagnostic pop diff --git a/src/image_util.cpp b/src/image_util.cpp index 20db1aeda..d9ab7071a 100644 --- a/src/image_util.cpp +++ b/src/image_util.cpp @@ -489,7 +489,7 @@ struct premultiply_visitor { if (!data.get_premultiplied()) { - agg::rendering_buffer buffer(data.bytes(),data.width(),data.height(),data.row_size()); + agg::rendering_buffer buffer(data.bytes(),safe_cast(data.width()),safe_cast(data.height()),safe_cast(data.row_size())); agg::pixfmt_rgba32 pixf(buffer); pixf.premultiply(); data.set_premultiplied(true); @@ -511,7 +511,7 @@ struct demultiply_visitor { if (data.get_premultiplied()) { - agg::rendering_buffer buffer(data.bytes(),data.width(),data.height(),data.row_size()); + agg::rendering_buffer buffer(data.bytes(),safe_cast(data.width()),safe_cast(data.height()),safe_cast(data.row_size())); agg::pixfmt_rgba32_pre pixf(buffer); pixf.demultiply(); data.set_premultiplied(false); @@ -641,12 +641,12 @@ struct visitor_apply_opacity for (std::size_t x = 0; x < data.width(); ++x) { pixel_type rgba = row_to[x]; - pixel_type a = static_cast(((rgba >> 24) & 0xff) * opacity_); + pixel_type a = static_cast(((rgba >> 24u) & 0xff) * opacity_); pixel_type r = rgba & 0xff; - pixel_type g = (rgba >> 8 ) & 0xff; - pixel_type b = (rgba >> 16) & 0xff; + pixel_type g = (rgba >> 8u ) & 0xff; + pixel_type b = (rgba >> 16u) & 0xff; - row_to[x] = (a << 24)| (b << 16) | (g << 8) | (r) ; + row_to[x] = (a << 24u) | (b << 16u) | (g << 8u) | (r) ; } } } @@ -713,13 +713,13 @@ struct visitor_set_grayscale_to_alpha { pixel_type rgba = row_from[x]; pixel_type r = rgba & 0xff; - pixel_type g = (rgba >> 8 ) & 0xff; - pixel_type b = (rgba >> 16) & 0xff; + pixel_type g = (rgba >> 8u) & 0xff; + pixel_type b = (rgba >> 16u) & 0xff; // magic numbers for grayscale pixel_type a = static_cast(std::ceil((r * .3) + (g * .59) + (b * .11))); - row_from[x] = (a << 24)| (255 << 16) | (255 << 8) | (255) ; + row_from[x] = (a << 24u) | (255 << 16u) | (255 << 8u) | (255u) ; } } } @@ -752,7 +752,10 @@ struct visitor_set_grayscale_to_alpha_c // magic numbers for grayscale pixel_type a = static_cast(std::ceil((r * .3) + (g * .59) + (b * .11))); - row_from[x] = (a << 24)| (c_.blue() << 16) | (c_.green() << 8) | (c_.red()) ; + row_from[x] = static_cast(a << 24u) | + static_cast(c_.blue() << 16u) | + static_cast(c_.green() << 8u) | + static_cast(c_.red() ); } } } @@ -1217,9 +1220,10 @@ struct visitor_composite_pixel if (mapnik::check_bounds(data, x_, y_)) { image_rgba8::pixel_type rgba = data(x_,y_); - value_type ca = static_cast(((c_ >> 24) & 0xff) * opacity_); - value_type cb = (c_ >> 16 ) & 0xff; - value_type cg = (c_ >> 8) & 0xff; + // TODO use std::round for consistent rounding + value_type ca = safe_cast(((c_ >> 24u) & 0xff) * opacity_); + value_type cb = (c_ >> 16u) & 0xff; + value_type cg = (c_ >> 8u) & 0xff; value_type cr = (c_ & 0xff); blender_type::blend_pix(comp_op_, reinterpret_cast(&rgba), cr, cg, cb, ca, cover_); data(x_,y_) = rgba; @@ -1227,7 +1231,7 @@ struct visitor_composite_pixel } template - void operator() (T & data) const + void operator() (T &) const { throw std::runtime_error("Composite pixel is not supported for this data type"); } @@ -1237,7 +1241,7 @@ private: composite_mode_e comp_op_; std::size_t const x_; std::size_t const y_; - int const c_; + unsigned const c_; unsigned const cover_; }; @@ -2082,7 +2086,7 @@ struct visitor_view_to_stream for (std::size_t i=0;i(view.get_row(i)), - view.row_size()); + safe_cast(view.row_size())); } } @@ -2251,11 +2255,11 @@ MAPNIK_DECL std::size_t compare(image_rgba8 const& im1, image_rgba8 unsigned rgba = row_from[x]; unsigned rgba2 = row_from2[x]; unsigned r = rgba & 0xff; - unsigned g = (rgba >> 8 ) & 0xff; - unsigned b = (rgba >> 16) & 0xff; + unsigned g = (rgba >> 8u) & 0xff; + unsigned b = (rgba >> 16u) & 0xff; unsigned r2 = rgba2 & 0xff; - unsigned g2 = (rgba2 >> 8 ) & 0xff; - unsigned b2 = (rgba2 >> 16) & 0xff; + unsigned g2 = (rgba2 >> 8u) & 0xff; + unsigned b2 = (rgba2 >> 16u) & 0xff; if (std::abs(static_cast(r - r2)) > static_cast(threshold) || std::abs(static_cast(g - g2)) > static_cast(threshold) || std::abs(static_cast(b - b2)) > static_cast(threshold)) { @@ -2263,8 +2267,8 @@ MAPNIK_DECL std::size_t compare(image_rgba8 const& im1, image_rgba8 continue; } if (alpha) { - unsigned a = (rgba >> 24) & 0xff; - unsigned a2 = (rgba2 >> 24) & 0xff; + unsigned a = (rgba >> 24u) & 0xff; + unsigned a2 = (rgba2 >> 24u) & 0xff; if (std::abs(static_cast(a - a2)) > static_cast(threshold)) { ++difference; continue; @@ -2289,11 +2293,11 @@ MAPNIK_DECL std::size_t compare(image_rgba8 const& im1, image_rgba8 unsigned rgba = row_from[x]; unsigned rgba2 = row_from2[x]; unsigned r = rgba & 0xff; - unsigned g = (rgba >> 8 ) & 0xff; - unsigned b = (rgba >> 16) & 0xff; + unsigned g = (rgba >> 8u) & 0xff; + unsigned b = (rgba >> 16u) & 0xff; unsigned r2 = rgba2 & 0xff; - unsigned g2 = (rgba2 >> 8 ) & 0xff; - unsigned b2 = (rgba2 >> 16) & 0xff; + unsigned g2 = (rgba2 >> 8u) & 0xff; + unsigned b2 = (rgba2 >> 16u) & 0xff; if (std::abs(static_cast(r - r2)) > static_cast(threshold) || std::abs(static_cast(g - g2)) > static_cast(threshold) || std::abs(static_cast(b - b2)) > static_cast(threshold)) { @@ -2301,8 +2305,8 @@ MAPNIK_DECL std::size_t compare(image_rgba8 const& im1, image_rgba8 continue; } if (alpha) { - unsigned a = (rgba >> 24) & 0xff; - unsigned a2 = (rgba2 >> 24) & 0xff; + unsigned a = (rgba >> 24u) & 0xff; + unsigned a2 = (rgba2 >> 24u) & 0xff; if (std::abs(static_cast(a - a2)) > static_cast(threshold)) { ++difference; continue; diff --git a/src/image_view_any.cpp b/src/image_view_any.cpp index 8bf89b45b..b05e539cb 100644 --- a/src/image_view_any.cpp +++ b/src/image_view_any.cpp @@ -47,7 +47,7 @@ struct get_view_height_visitor struct get_view_size_visitor { template - unsigned operator()(T const& data) const + std::size_t operator()(T const& data) const { return data.size(); } @@ -65,7 +65,7 @@ struct get_view_dtype_visitor struct get_view_row_size_visitor { template - unsigned operator()(T const& data) const + std::size_t operator()(T const& data) const { return data.row_size(); } diff --git a/src/load_map.cpp b/src/load_map.cpp index fc38407ab..419b8bc39 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -80,7 +80,7 @@ using boost::optional; constexpr unsigned name2int(const char *str, int off = 0) { - return !str[off] ? 5381 : (name2int(str, off+1)*33) ^ str[off]; + return !str[off] ? 5381 : (name2int(str, off+1)*33) ^ static_cast(str[off]); } class map_parser : util::noncopyable @@ -147,8 +147,7 @@ private: void load_map(Map & map, std::string const& filename, bool strict, std::string base_path) { - // TODO - use xml encoding? - xml_tree tree("utf8"); + xml_tree tree; tree.set_filename(filename); read_xml(filename, tree.root()); map_parser parser(map, strict, filename); @@ -157,8 +156,7 @@ void load_map(Map & map, std::string const& filename, bool strict, std::string b void load_map_string(Map & map, std::string const& str, bool strict, std::string base_path) { - // TODO - use xml encoding? - xml_tree tree("utf8"); + xml_tree tree; if (!base_path.empty()) { read_xml_string(str, tree.root(), base_path); // accept base_path passed into function @@ -237,7 +235,7 @@ void map_parser::parse_map(Map & map, xml_node const& node, std::string const& b } map.set_srs(srs); - optional buffer_size = map_node.get_opt_attr("buffer-size"); + optional buffer_size = map_node.get_opt_attr("buffer-size"); if (buffer_size) { map.set_buffer_size(*buffer_size); @@ -648,7 +646,7 @@ void map_parser::parse_layer(Map & map, xml_node const& node) lyr.set_group_by(* group_by); } - optional buffer_size = node.get_opt_attr("buffer-size"); + optional buffer_size = node.get_opt_attr("buffer-size"); if (buffer_size) { lyr.set_buffer_size(*buffer_size); diff --git a/src/marker_cache.cpp b/src/marker_cache.cpp index e7c46a259..4e15caf3e 100644 --- a/src/marker_cache.cpp +++ b/src/marker_cache.cpp @@ -126,13 +126,13 @@ struct visitor_create_marker return mapnik::marker(mapnik::marker_rgba8(data)); } - marker operator() (image_null & data) + marker operator() (image_null &) { throw std::runtime_error("Can not make marker from null image data type"); } template - marker operator() (T & data) + marker operator() (T &) { throw std::runtime_error("Can not make marker from this data type"); } diff --git a/src/renderer_common.cpp b/src/renderer_common.cpp index ecba13655..f6b2bb77d 100644 --- a/src/renderer_common.cpp +++ b/src/renderer_common.cpp @@ -25,6 +25,7 @@ #include #include #include +#include namespace mapnik { diff --git a/src/save_map.cpp b/src/save_map.cpp index eea8cda2a..c9f681130 100644 --- a/src/save_map.cpp +++ b/src/save_map.cpp @@ -465,13 +465,12 @@ void serialize_fontset( ptree & map_node, std::string const& name, font_set cons set_attr(fontset_node, "name", name); - for (auto const& name : fontset.get_face_names()) + for (auto const& face_name : fontset.get_face_names()) { ptree & font_node = fontset_node.push_back( ptree::value_type("Font", ptree()))->second; - set_attr(font_node, "face-name", name); + set_attr(font_node, "face-name", face_name); } - } void serialize_datasource( ptree & layer_node, datasource_ptr datasource) @@ -507,63 +506,63 @@ void serialize_parameters( ptree & map_node, mapnik::parameters const& params) } } -void serialize_layer( ptree & map_node, const layer & layer, bool explicit_defaults ) +void serialize_layer( ptree & map_node, layer const& lyr, bool explicit_defaults ) { ptree & layer_node = map_node.push_back( ptree::value_type("Layer", ptree()))->second; - if ( layer.name() != "" ) + if ( lyr.name() != "" ) { - set_attr( layer_node, "name", layer.name() ); + set_attr( layer_node, "name", lyr.name() ); } - if ( layer.srs() != "" ) + if ( lyr.srs() != "" ) { - set_attr( layer_node, "srs", layer.srs() ); + set_attr( layer_node, "srs", lyr.srs() ); } - if ( !layer.active() || explicit_defaults ) + if ( !lyr.active() || explicit_defaults ) { - set_attr/**/( layer_node, "status", layer.active() ); + set_attr/**/( layer_node, "status", lyr.active() ); } - if ( layer.clear_label_cache() || explicit_defaults ) + if ( lyr.clear_label_cache() || explicit_defaults ) { - set_attr/**/( layer_node, "clear-label-cache", layer.clear_label_cache() ); + set_attr/**/( layer_node, "clear-label-cache", lyr.clear_label_cache() ); } - if ( layer.minimum_scale_denominator() ) + if ( lyr.minimum_scale_denominator() != 0 || explicit_defaults ) { - set_attr( layer_node, "minimum_scale_denominator", layer.minimum_scale_denominator() ); + set_attr( layer_node, "minimum_scale_denominator", lyr.minimum_scale_denominator() ); } - if ( layer.maximum_scale_denominator() != std::numeric_limits::max() ) + if ( lyr.maximum_scale_denominator() != std::numeric_limits::max() || explicit_defaults ) { - set_attr( layer_node, "maximum_scale_denominator", layer.maximum_scale_denominator() ); + set_attr( layer_node, "maximum_scale_denominator", lyr.maximum_scale_denominator() ); } - if ( layer.queryable() || explicit_defaults ) + if ( lyr.queryable() || explicit_defaults ) { - set_attr( layer_node, "queryable", layer.queryable() ); + set_attr( layer_node, "queryable", lyr.queryable() ); } - if ( layer.cache_features() || explicit_defaults ) + if ( lyr.cache_features() || explicit_defaults ) { - set_attr/**/( layer_node, "cache-features", layer.cache_features() ); + set_attr/**/( layer_node, "cache-features", lyr.cache_features() ); } - if ( layer.group_by() != "" || explicit_defaults ) + if ( lyr.group_by() != "" || explicit_defaults ) { - set_attr( layer_node, "group-by", layer.group_by() ); + set_attr( layer_node, "group-by", lyr.group_by() ); } - boost::optional const& buffer_size = layer.buffer_size(); + boost::optional const& buffer_size = lyr.buffer_size(); if ( buffer_size || explicit_defaults) { set_attr( layer_node, "buffer-size", *buffer_size ); } - optional > const& maximum_extent = layer.maximum_extent(); + optional > const& maximum_extent = lyr.maximum_extent(); if ( maximum_extent) { std::ostringstream s; @@ -573,7 +572,7 @@ void serialize_layer( ptree & map_node, const layer & layer, bool explicit_defau set_attr( layer_node, "maximum-extent", s.str() ); } - for (auto const& name : layer.styles()) + for (auto const& name : lyr.styles()) { boost::property_tree::ptree & style_node = layer_node.push_back( boost::property_tree::ptree::value_type("StyleName", @@ -581,7 +580,7 @@ void serialize_layer( ptree & map_node, const layer & layer, bool explicit_defau style_node.put_value(name); } - datasource_ptr datasource = layer.datasource(); + datasource_ptr datasource = lyr.datasource(); if ( datasource ) { serialize_datasource( layer_node, datasource ); diff --git a/src/svg/output/svg_generator.cpp b/src/svg/output/svg_generator.cpp index 5c48702d4..9bc3e7285 100644 --- a/src/svg/output/svg_generator.cpp +++ b/src/svg/output/svg_generator.cpp @@ -32,6 +32,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wshadow" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #pragma GCC diagnostic pop diff --git a/src/svg/svg_parser.cpp b/src/svg/svg_parser.cpp index a6fa1ee5b..7794fa5d3 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "agg_ellipse.h" #include "agg_rounded_rect.h" @@ -34,6 +35,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" +#pragma GCC diagnostic ignored "-Wsign-conversion" #include #include #include @@ -1075,7 +1077,7 @@ void svg_parser::parse(std::string const& filename) void svg_parser::parse_from_string(std::string const& svg) { - xmlTextReaderPtr reader = xmlReaderForMemory(svg.c_str(),svg.size(),nullptr,nullptr, + xmlTextReaderPtr reader = xmlReaderForMemory(svg.c_str(),safe_cast(svg.size()),nullptr,nullptr, (XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | XML_PARSE_NOERROR | XML_PARSE_NOWARNING)); if (reader == nullptr) { diff --git a/src/text/formatting/text.cpp b/src/text/formatting/text.cpp index 8247bd26a..6446f2c31 100644 --- a/src/text/formatting/text.cpp +++ b/src/text/formatting/text.cpp @@ -46,7 +46,7 @@ void text_node::to_xml(ptree & xml) const new_node.put_value(to_expression_string(*text_)); } -node_ptr text_node::from_xml(xml_node const& xml, fontset_map const& fontsets) +node_ptr text_node::from_xml(xml_node const& xml, fontset_map const&) { return std::make_shared(xml.get_value()); } diff --git a/src/text/placements/dummy.cpp b/src/text/placements/dummy.cpp index 569b5df48..cb398a410 100644 --- a/src/text/placements/dummy.cpp +++ b/src/text/placements/dummy.cpp @@ -33,7 +33,7 @@ bool text_placement_info_dummy::next() const } text_placement_info_ptr text_placements_dummy::get_placement_info( - double scale_factor, feature_impl const& feature, attributes const& vars) const + double scale_factor, feature_impl const&, attributes const&) const { return std::make_shared(this, scale_factor); } diff --git a/src/text/placements/list.cpp b/src/text/placements/list.cpp index 1c40b68cf..ffbbac846 100644 --- a/src/text/placements/list.cpp +++ b/src/text/placements/list.cpp @@ -65,7 +65,7 @@ text_symbolizer_properties & text_placements_list::get(unsigned i) } -text_placement_info_ptr text_placements_list::get_placement_info(double scale_factor, feature_impl const& feature, attributes const& vars) const +text_placement_info_ptr text_placements_list::get_placement_info(double scale_factor, feature_impl const&, attributes const&) const { return std::make_shared(this, scale_factor); } @@ -83,7 +83,7 @@ void text_placements_list::add_expressions(expression_set & output) const } } -unsigned text_placements_list::size() const +std::size_t text_placements_list::size() const { return list_.size(); } diff --git a/src/text/placements/simple.cpp b/src/text/placements/simple.cpp index 693b0bacd..4918dac1d 100644 --- a/src/text/placements/simple.cpp +++ b/src/text/placements/simple.cpp @@ -35,6 +35,8 @@ #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" #include #include #include @@ -185,7 +187,7 @@ namespace detail { } template - std::string operator() (T const& val) const + std::string operator() (T const&) const { return ""; } diff --git a/src/text/symbolizer_helpers.cpp b/src/text/symbolizer_helpers.cpp index 9890189ff..4771b0eca 100644 --- a/src/text/symbolizer_helpers.cpp +++ b/src/text/symbolizer_helpers.cpp @@ -342,7 +342,7 @@ public: } template - bool operator()(T const & geo) const + bool operator()(T const&) const { return false; } diff --git a/src/xml_tree.cpp b/src/xml_tree.cpp index 410a2bcf0..7ec11ca6b 100644 --- a/src/xml_tree.cpp +++ b/src/xml_tree.cpp @@ -68,6 +68,7 @@ struct name_trait DEFINE_NAME_TRAIT( double, "double") DEFINE_NAME_TRAIT( float, "float") DEFINE_NAME_TRAIT( unsigned, "unsigned") +DEFINE_NAME_TRAIT( int, "int") DEFINE_NAME_TRAIT( boolean_type, "boolean_type") #ifdef BIGINT DEFINE_NAME_TRAIT( mapnik::value_integer, "long long" ) @@ -98,7 +99,7 @@ struct name_trait< mapnik::enumeration > } }; -xml_tree::xml_tree(std::string const& encoding) +xml_tree::xml_tree() : node_(*this, ""), file_() { @@ -413,6 +414,7 @@ std::string xml_node::line_to_string() const compile_get_opt_attr(boolean_type); compile_get_opt_attr(std::string); +compile_get_opt_attr(int); compile_get_opt_attr(unsigned); compile_get_opt_attr(mapnik::value_integer); compile_get_opt_attr(float); diff --git a/test/unit/serialization/xml_parser_trim.cpp b/test/unit/serialization/xml_parser_trim.cpp index ffc5ca8be..f79c75502 100644 --- a/test/unit/serialization/xml_parser_trim.cpp +++ b/test/unit/serialization/xml_parser_trim.cpp @@ -21,7 +21,7 @@ TEST_CASE("xml parser") { " " ""); - mapnik::xml_tree tree("utf8"); + mapnik::xml_tree tree; tree.set_filename("xml_datasource_parameter_trim.cpp"); REQUIRE_NOTHROW(read_xml_string(xml, tree.root(), ""));