fix a slew of -Wsign-conversion, -Wconversion, -Wunused-argument warnings

This commit is contained in:
Dane Springmeyer 2015-06-15 19:36:36 -07:00
parent 48d4bfb170
commit b2c85e0c65
87 changed files with 352 additions and 235 deletions

View file

@ -43,6 +43,8 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
@ -275,8 +277,8 @@ inline void group_attribute_collector::operator() (group_symbolizer const& sym)
} }
// get indexed column names // get indexed column names
int start = get<value_integer>(sym, keys::start_column); value_integer start = get<value_integer>(sym, keys::start_column);
int end = start + get<value_integer>(sym, keys::num_columns); value_integer end = start + get<value_integer>(sym, keys::num_columns);
for (auto const& col_name : group_columns) for (auto const& col_name : group_columns)
{ {
if (expand_index_columns_ && col_name.find('%') != std::string::npos) 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) if (col_name.size() > 1)
{ {
// Indexed column name. add column name for each index value. // 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; std::string col_idx_str;
if (mapnik::util::to_string(col_idx_str,col_idx)) if (mapnik::util::to_string(col_idx_str,col_idx))

View file

@ -124,12 +124,12 @@ class cairo_pattern : private util::noncopyable
public: public:
explicit cairo_pattern(image_rgba8 const& data, double opacity = 1.0) 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_ptr = data.data();
const unsigned int *in_end = in_ptr + pixels; const unsigned int *in_end = in_ptr + pixels;
unsigned int *out_ptr; 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<int>(data.width()), static_cast<int>(data.height()));
out_ptr = reinterpret_cast<unsigned int *>(cairo_image_surface_get_data(surface_)); out_ptr = reinterpret_cast<unsigned int *>(cairo_image_surface_get_data(surface_));

View file

@ -49,10 +49,10 @@
BOOST_FUSION_ADAPT_ADT( BOOST_FUSION_ADAPT_ADT(
mapnik::color, mapnik::color,
(unsigned, unsigned, obj.red(), obj.set_red(val)) (unsigned, unsigned, obj.red(), obj.set_red(mapnik::safe_cast<uint8_t>(val)))
(unsigned, unsigned, obj.green(), obj.set_green(val)) (unsigned, unsigned, obj.green(), obj.set_green(mapnik::safe_cast<uint8_t>(val)))
(unsigned, unsigned, obj.blue(), obj.set_blue(val)) (unsigned, unsigned, obj.blue(), obj.set_blue(mapnik::safe_cast<uint8_t>(val)))
(unsigned, unsigned, obj.alpha(), obj.set_alpha(val)) (unsigned, unsigned, obj.alpha(), obj.set_alpha(mapnik::safe_cast<uint8_t>(val)))
) )
namespace mapnik namespace mapnik

View file

@ -35,6 +35,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/support_locals.hpp> #include <boost/spirit/include/support_locals.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>

View file

@ -29,6 +29,9 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#undef B0 #undef B0
#include <boost/geometry/geometries/register/linestring.hpp> #include <boost/geometry/geometries/register/linestring.hpp>
#include <boost/geometry/geometries/register/point.hpp> #include <boost/geometry/geometries/register/point.hpp>

View file

@ -50,7 +50,7 @@ struct geometry_centroid
return false; return false;
} }
result_type operator() (geometry_collection<T> const& collection) const result_type operator() (geometry_collection<T> const&) const
{ {
return false; return false;
} }

View file

@ -32,6 +32,8 @@
#pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/geometry/algorithms/correct.hpp> #include <boost/geometry/algorithms/correct.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
@ -73,7 +75,7 @@ struct geometry_correct
} }
template <typename T> template <typename T>
result_type operator() (T & geom) const result_type operator() (T &) const
{ {
//no-op //no-op
} }

View file

@ -195,7 +195,7 @@ struct geom_reproj_copy_visitor {
geometry<T> operator() (line_string<T> const& ls) geometry<T> operator() (line_string<T> const& ls)
{ {
geometry<T> geom; // default empty geometry<T> geom; // default empty
int intial_err = n_err_; unsigned int intial_err = n_err_;
line_string<T> new_ls = reproject_internal(ls, proj_trans_, n_err_); line_string<T> new_ls = reproject_internal(ls, proj_trans_, n_err_);
if (n_err_ > intial_err || new_ls.empty()) return geom; if (n_err_ > intial_err || new_ls.empty()) return geom;
geom = std::move(new_ls); geom = std::move(new_ls);

View file

@ -33,6 +33,7 @@
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/feature_factory.hpp> #include <mapnik/feature_factory.hpp>
#include <mapnik/util/conversions.hpp> #include <mapnik/util/conversions.hpp>
#include <mapnik/safe_cast.hpp>
// stl // stl
#include <map> #include <map>
@ -191,12 +192,16 @@ public:
if (ext0.intersects(ext1)) if (ext0.intersects(ext1))
{ {
box2d<int> box = ext0.intersect(ext1); box2d<int> box = ext0.intersect(ext1);
for (std::size_t y = box.miny(); y < box.maxy(); ++y) std::size_t miny = safe_cast<std::size_t>(box.miny());
std::size_t maxy = safe_cast<std::size_t>(box.maxy());
std::size_t minx = safe_cast<std::size_t>(box.minx());
std::size_t maxx = safe_cast<std::size_t>(box.maxx());
for (std::size_t y = miny; y < maxy; ++y)
{ {
value_type* row_to = data_.get_row(y); value_type* row_to = data_.get_row(y);
image_rgba8::pixel_type const * row_from = data.get_row(y - y0); 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]; image_rgba8::pixel_type rgba = row_from[x - x0];
unsigned a = (rgba >> 24) & 0xff; unsigned a = (rgba >> 24) & 0xff;

View file

@ -24,9 +24,15 @@
#define MAPNIK_GRID_PIXFMT_HPP #define MAPNIK_GRID_PIXFMT_HPP
#include <string> #include <string>
#include <mapnik/grid/grid_rendering_buffer.hpp>
#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 "agg_basics.h"
#include <mapnik/grid/grid_pixel.hpp> #include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/grid/grid_rendering_buffer.hpp> #pragma GCC diagnostic pop
namespace mapnik namespace mapnik
{ {

View file

@ -23,9 +23,14 @@
#ifndef MAPNIK_GRID_RENDERER_BASE_HPP #ifndef MAPNIK_GRID_RENDERER_BASE_HPP
#define 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 "agg_renderer_base.h"
#include <mapnik/grid/grid_pixfmt.hpp>
#include <mapnik/grid/grid_pixel.hpp> #include <mapnik/grid/grid_pixel.hpp>
#pragma GCC diagnostic pop
#include <mapnik/grid/grid_pixfmt.hpp>
namespace mapnik { namespace mapnik {

View file

@ -34,6 +34,8 @@
#pragma GCC diagnostic ignored "-Wc++11-narrowing" #pragma GCC diagnostic ignored "-Wc++11-narrowing"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/gil/gil_all.hpp> #include <boost/gil/gil_all.hpp>
#pragma GCC diagnostic pop #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); typename Src::x_iterator dst_it = dst_view.row_begin(0);
// top row // top row
for (int x = 0 ; x < src_view.width(); ++x) for (std::size_t x = 0 ; x < static_cast<std::size_t>(src_view.width()); ++x)
{ {
(*dst_it)[3] = src_loc[loc11][3]; // Dst.a = Src.a (*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]; 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]; p[6] = src_loc[loc02][i];
} }
if ( x == src_view.width()-1) if ( x == static_cast<std::size_t>(src_view.width())-1)
{ {
p[5] = p[4]; p[5] = p[4];
p[8] = p[7]; p[8] = p[7];
@ -294,15 +296,15 @@ void apply_convolution_3x3(Src const& src_view, Dst & dst_view, Filter const& fi
++dst_it; ++dst_it;
} }
// carrige-return // carrige-return
src_loc += point2<std::ptrdiff_t>(-src_view.width(),1); src_loc += point2<std::ptrdiff_t>(-static_cast<std::size_t>(src_view.width()),1);
// 1... height-1 rows // 1... height-1 rows
for (int y = 1; y<src_view.height()-1; ++y) for (std::size_t y = 1; y<static_cast<std::size_t>(src_view.height())-1; ++y)
{ {
for (int x = 0; x < src_view.width(); ++x) for (std::size_t x = 0; x < static_cast<std::size_t>(src_view.width()); ++x)
{ {
(*dst_it)[3] = src_loc[loc11][3]; // Dst.a = Src.a (*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]; 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]; p[6] = src_loc[loc02][i];
} }
if ( x == src_view.width() - 1) if ( x == static_cast<std::size_t>(src_view.width()) - 1)
{ {
p[2] = p[1]; p[2] = p[1];
p[5] = p[4]; 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(); ++src_loc.x();
} }
// carrige-return // carrige-return
src_loc += point2<std::ptrdiff_t>(-src_view.width(),1); src_loc += point2<std::ptrdiff_t>(-static_cast<std::size_t>(src_view.width()),1);
} }
// bottom row // bottom row
//src_loc = src_view.xy_at(0,src_view.height()-1); //src_loc = src_view.xy_at(0,static_cast<std::size_t>(src_view.height())-1);
for (int x = 0 ; x < src_view.width(); ++x) for (std::size_t x = 0 ; x < static_cast<std::size_t>(src_view.width()); ++x)
{ {
(*dst_it)[3] = src_loc[loc11][3]; // Dst.a = Src.a (*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]; 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]; p[3] = src_loc[loc01][i];
} }
if ( x == src_view.width()-1) if ( x == static_cast<std::size_t>(src_view.width())-1)
{ {
p[2] = p[1]; p[2] = p[1];
p[5] = p[4]; p[5] = p[4];
@ -429,10 +431,10 @@ void apply_filter(Src & src, color_to_alpha const& op)
double cr = static_cast<double>(op.color.red())/255.0; double cr = static_cast<double>(op.color.red())/255.0;
double cg = static_cast<double>(op.color.green())/255.0; double cg = static_cast<double>(op.color.green())/255.0;
double cb = static_cast<double>(op.color.blue())/255.0; double cb = static_cast<double>(op.color.blue())/255.0;
for (int y=0; y<src_view.height(); ++y) for (std::size_t y=0; y<static_cast<std::size_t>(src_view.height()); ++y)
{ {
rgba8_view_t::x_iterator src_it = src_view.row_begin(y); rgba8_view_t::x_iterator src_it = src_view.row_begin(static_cast<long>(y));
for (int x=0; x<src_view.width(); ++x) for (std::size_t x=0; x<static_cast<std::size_t>(src_view.width()); ++x)
{ {
uint8_t & r = get_color(src_it[x], red_t()); uint8_t & r = get_color(src_it[x], red_t());
uint8_t & g = get_color(src_it[x], green_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::filter::color_stop const& stop = op[0];
mapnik::color const& c = stop.color; mapnik::color const& c = stop.color;
rgba8_view_t src_view = rgba8_view(src); rgba8_view_t src_view = rgba8_view(src);
for (int y=0; y<src_view.height(); ++y) for (std::size_t y=0; y<static_cast<std::size_t>(src_view.height()); ++y)
{ {
rgba8_view_t::x_iterator src_it = src_view.row_begin(y); rgba8_view_t::x_iterator src_it = src_view.row_begin(static_cast<long>(y));
for (int x=0; x<src_view.width(); ++x) for (std::size_t x=0; x<static_cast<std::size_t>(src_view.width()); ++x)
{ {
uint8_t & r = get_color(src_it[x], red_t()); uint8_t & r = get_color(src_it[x], red_t());
uint8_t & g = get_color(src_it[x], green_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()) if (grad_lut.build_lut())
{ {
rgba8_view_t src_view = rgba8_view(src); rgba8_view_t src_view = rgba8_view(src);
for (int y=0; y<src_view.height(); ++y) for (std::size_t y=0; y<static_cast<std::size_t>(src_view.height()); ++y)
{ {
rgba8_view_t::x_iterator src_it = src_view.row_begin(y); rgba8_view_t::x_iterator src_it = src_view.row_begin(static_cast<long>(y));
for (int x=0; x<src_view.width(); ++x) for (std::size_t x=0; x<static_cast<std::size_t>(src_view.width()); ++x)
{ {
uint8_t & r = get_color(src_it[x], red_t()); uint8_t & r = get_color(src_it[x], red_t());
uint8_t & g = get_color(src_it[x], green_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) if (tinting || set_alpha)
{ {
rgba8_view_t src_view = rgba8_view(src); rgba8_view_t src_view = rgba8_view(src);
for (int y=0; y<src_view.height(); ++y) for (std::size_t y=0; y<static_cast<std::size_t>(src_view.height()); ++y)
{ {
rgba8_view_t::x_iterator src_it = src_view.row_begin(y); rgba8_view_t::x_iterator src_it = src_view.row_begin(static_cast<long>(y));
for (int x=0; x<src_view.width(); ++x) for (std::size_t x=0; x<static_cast<std::size_t>(src_view.width()); ++x)
{ {
uint8_t & r = get_color(src_it[x], red_t()); uint8_t & r = get_color(src_it[x], red_t());
uint8_t & g = get_color(src_it[x], green_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); rgba8_view_t src_view = rgba8_view(src);
for (int y=0; y<src_view.height(); ++y) for (std::size_t y=0; y<static_cast<std::size_t>(src_view.height()); ++y)
{ {
rgba8_view_t::x_iterator src_it = src_view.row_begin(y); rgba8_view_t::x_iterator src_it = src_view.row_begin(static_cast<long>(y));
for (int x=0; x<src_view.width(); ++x) for (std::size_t x=0; x<static_cast<std::size_t>(src_view.width()); ++x)
{ {
// formula taken from boost/gil/color_convert.hpp:rgb_to_luminance // formula taken from boost/gil/color_convert.hpp:rgb_to_luminance
uint8_t & r = get_color(src_it[x], red_t()); uint8_t & r = get_color(src_it[x], red_t());
@ -697,22 +699,22 @@ void apply_filter(Src & src, gray const& /*op*/)
template <typename Src, typename Dst> template <typename Src, typename Dst>
void x_gradient_impl(Src const& src_view, Dst const& dst_view) void x_gradient_impl(Src const& src_view, Dst const& dst_view)
{ {
for (int y=0; y<src_view.height(); ++y) for (std::size_t y=0; y<static_cast<std::size_t>(src_view.height()); ++y)
{ {
typename Src::x_iterator src_it = src_view.row_begin(y); typename Src::x_iterator src_it = src_view.row_begin(static_cast<long>(y));
typename Dst::x_iterator dst_it = dst_view.row_begin(y); typename Dst::x_iterator dst_it = dst_view.row_begin(static_cast<long>(y));
dst_it[0][0] = 128 + (src_it[0][0] - src_it[1][0]) / 2; 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][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[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][0] = 128 + (src_it[static_cast<std::size_t>(src_view.width())-2][0] - src_it[static_cast<std::size_t>(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][1] = 128 + (src_it[static_cast<std::size_t>(src_view.width())-2][1] - src_it[static_cast<std::size_t>(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][2] = 128 + (src_it[static_cast<std::size_t>(src_view.width())-2][2] - src_it[static_cast<std::size_t>(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<std::size_t>(src_view.width())-1][3] = 255;
for (int x=1; x<src_view.width()-1; ++x) for (std::size_t x=1; x<static_cast<std::size_t>(src_view.width())-1; ++x)
{ {
dst_it[x][0] = 128 + (src_it[x-1][0] - src_it[x+1][0]) / 2; 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; 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); rgba8_view_t src_view = rgba8_view(src);
for (int y=0; y<src_view.height(); ++y) for (std::size_t y=0; y<static_cast<std::size_t>(src_view.height()); ++y)
{ {
rgba8_view_t::x_iterator src_it = src_view.row_begin(y); rgba8_view_t::x_iterator src_it = src_view.row_begin(static_cast<long>(y));
for (int x=0; x<src_view.width(); ++x) for (std::size_t x=0; x<static_cast<std::size_t>(src_view.width()); ++x)
{ {
// we only work with premultiplied source, // we only work with premultiplied source,
// thus all color values must be <= alpha // thus all color values must be <= alpha

View file

@ -28,6 +28,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/fusion/include/adapt_struct.hpp> #include <boost/fusion/include/adapt_struct.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -25,7 +25,10 @@
#include <mapnik/image_filter_grammar.hpp> #include <mapnik/image_filter_grammar.hpp>
// spirit // spirit
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#include <boost/spirit/include/phoenix.hpp> #include <boost/spirit/include/phoenix.hpp>
#pragma GCC diagnostic pop
namespace mapnik { namespace mapnik {

View file

@ -42,34 +42,34 @@ public:
private: private:
public: public:
image() {} image() {}
image(int width, image(int /*width*/,
int height, int /*height*/,
bool initialize = true, bool /*initialize*/ = true,
bool premultiplied = false, bool /*premultiplied*/ = false,
bool painted = false) {} bool /*painted*/ = false) {}
image(image<null_t> const& rhs) {} image(image<null_t> const&) {}
image(image<null_t> && rhs) noexcept {} image(image<null_t> &&) noexcept {}
image<null_t>& operator=(image<null_t> rhs) { return *this; } image<null_t>& operator=(image<null_t>) { return *this; }
image<null_t>const& operator=(image<null_t> const& rhs) const { return rhs; } image<null_t>const& operator=(image<null_t> const& rhs) const { return rhs; }
bool operator==(image<null_t> const& rhs) const { return true; } bool operator==(image<null_t> const&) const { return true; }
bool operator<(image<null_t> const& rhs) const { return false; } bool operator<(image<null_t> const&) const { return false; }
std::size_t width() const { return 0; } std::size_t width() const { return 0; }
std::size_t height() const { return 0; } std::size_t height() const { return 0; }
std::size_t size() const { return 0; } std::size_t size() const { return 0; }
std::size_t row_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"); } void set(pixel_type const&) { 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& 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 i, std::size_t j) const { 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 const char* bytes() const { return nullptr; }
unsigned char* bytes() {return nullptr; } unsigned char* bytes() {return nullptr; }
double get_offset() const { return 0.0; } double get_offset() const { return 0.0; }
void set_offset(double set) {} void set_offset(double) {}
double get_scaling() const { return 1.0; } double get_scaling() const { return 1.0; }
void set_scaling(double set) {} void set_scaling(double) {}
bool get_premultiplied() const { return false; } bool get_premultiplied() const { return false; }
void set_premultiplied(bool set) {} void set_premultiplied(bool) {}
void painted(bool painted) {} void painted(bool) {}
bool painted() const { return false; } bool painted() const { return false; }
image_dtype get_dtype() const { return dtype; } image_dtype get_dtype() const { return dtype; }
}; };

View file

@ -40,20 +40,20 @@ public:
image_view() {} image_view() {}
~image_view() {}; ~image_view() {};
image_view(image_view<image_null> const& rhs) {} image_view(image_view<image_null> const&) {}
image_view<image_null> & operator=(image_view<image_null> const& rhs) { return *this; } image_view<image_null> & operator=(image_view<image_null> const&) { return *this; }
bool operator==(image_view<image_null> const& rhs) const { return true; } bool operator==(image_view<image_null> const&) const { return true; }
bool operator<(image_view<image_null> const& rhs) const { return false; } bool operator<(image_view<image_null> const&) const { return false; }
std::size_t x() const { return 0; } std::size_t x() const { return 0; }
std::size_t y() const { return 0; } std::size_t y() const { return 0; }
std::size_t width() const { return 0; } std::size_t width() const { return 0; }
std::size_t height() 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 size() const { return 0; }
std::size_t row_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) 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, std::size_t) const { return nullptr; }
bool get_premultiplied() const { return false; } bool get_premultiplied() const { return false; }
double get_offset() const { return 0.0; } double get_offset() const { return 0.0; }
double get_scaling() const { return 1.0; } double get_scaling() const { return 1.0; }

View file

@ -25,7 +25,10 @@
#include <string> #include <string>
#include <sstream> #include <sstream>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#include <boost/spirit/home/support/info.hpp> #include <boost/spirit/home/support/info.hpp>
#pragma GCC diagnostic pop
namespace mapnik { namespace json { namespace mapnik { namespace json {

View file

@ -33,6 +33,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>
#include <boost/fusion/adapted/std_tuple.hpp> #include <boost/fusion/adapted/std_tuple.hpp>

View file

@ -84,8 +84,8 @@ template <typename T>
struct get_id struct get_id
{ {
using feature_type = T; using feature_type = T;
using result_type = int; using result_type = mapnik::value_integer;
int operator() (feature_type const& f) const result_type operator() (feature_type const& f) const
{ {
return f.id(); return f.id();
} }

View file

@ -31,10 +31,13 @@
#include <mapnik/value.hpp> #include <mapnik/value.hpp>
#include <mapnik/json/generic_json.hpp> #include <mapnik/json/generic_json.hpp>
#include <mapnik/json/value_converters.hpp> #include <mapnik/json/value_converters.hpp>
// spirit::qi
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp> #include <boost/spirit/include/phoenix.hpp>
#include <boost/spirit/include/support_line_pos_iterator.hpp> #include <boost/spirit/include/support_line_pos_iterator.hpp>
#pragma GCC diagnostic pop
namespace mapnik { namespace json { namespace mapnik { namespace json {

View file

@ -31,6 +31,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp> #include <boost/spirit/include/phoenix.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -33,6 +33,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/karma.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>
#include <boost/math/special_functions/trunc.hpp> // for vc++ and android whose c++11 libs lack std::trunc #include <boost/math/special_functions/trunc.hpp> // for vc++ and android whose c++11 libs lack std::trunc

View file

@ -34,6 +34,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>
#include <boost/fusion/adapted/std_tuple.hpp> #include <boost/fusion/adapted/std_tuple.hpp>

View file

@ -32,6 +32,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/karma.hpp>
#include <boost/spirit/include/phoenix.hpp> #include <boost/spirit/include/phoenix.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>

View file

@ -34,6 +34,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -70,19 +70,19 @@ public:
box2d<double> bounding_box() const box2d<double> bounding_box() const
{ {
double width = bitmap_data_.width(); std::size_t width = bitmap_data_.width();
double height = bitmap_data_.height(); std::size_t height = bitmap_data_.height();
return box2d<double>(0, 0, width, height); return box2d<double>(static_cast<double>(0), static_cast<double>(0), static_cast<double>(width), static_cast<double>(height));
} }
inline std::size_t width() const inline double width() const
{ {
return bitmap_data_.width(); return static_cast<double>(bitmap_data_.width());
} }
inline std::size_t height() const inline double height() const
{ {
return bitmap_data_.height(); return static_cast<double>(bitmap_data_.height());
} }
image_rgba8 const& get_data() const image_rgba8 const& get_data() const
@ -169,7 +169,7 @@ struct get_marker_width_visitor
template <typename T> template <typename T>
double operator()(T const& data) const double operator()(T const& data) const
{ {
return static_cast<double>(data.width()); return data.width();
} }
}; };
@ -178,7 +178,7 @@ struct get_marker_height_visitor
template <typename T> template <typename T>
double operator()(T const& data) const double operator()(T const& data) const
{ {
return static_cast<double>(data.height()); return data.height();
} }
}; };

View file

@ -30,6 +30,8 @@
#define USE_DENSE_HASH_MAP #define USE_DENSE_HASH_MAP
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#ifdef USE_DENSE_HASH_MAP #ifdef USE_DENSE_HASH_MAP
#include <mapnik/sparsehash/dense_hash_map> #include <mapnik/sparsehash/dense_hash_map>
using rgba_hash_table = google::dense_hash_map<unsigned int, unsigned char>; using rgba_hash_table = google::dense_hash_map<unsigned int, unsigned char>;
@ -37,6 +39,7 @@
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
using rgba_hash_table = boost::unordered_map<unsigned int, unsigned char>; using rgba_hash_table = boost::unordered_map<unsigned int, unsigned char>;
#endif #endif
#pragma GCC diagnostic pop
// stl // stl
#include <vector> #include <vector>

View file

@ -34,6 +34,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -124,7 +124,7 @@ struct vertex_adapter : private util::noncopyable
unsigned vertex(double* x, double* y) const unsigned vertex(double* x, double* y) const
{ {
return path_.cont_.get_vertex(itr_++,x,y); return path_.cont_.get_vertex(static_cast<unsigned>(itr_++),x,y);
} }
unsigned vertex(std::size_t index, double* x, double* y) const unsigned vertex(std::size_t index, double* x, double* y) const

View file

@ -31,6 +31,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -32,6 +32,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/geometry/core/coordinate_type.hpp> #include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/core/access.hpp> #include <boost/geometry/core/access.hpp>
#include <boost/numeric/conversion/cast.hpp> #include <boost/numeric/conversion/cast.hpp>

View file

@ -32,6 +32,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/ptr_container/ptr_vector.hpp> #include <boost/ptr_container/ptr_vector.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -51,7 +51,7 @@ struct apply_local_alignment
} }
template <typename Adapter> template <typename Adapter>
void operator() (Adapter & va) void operator() (Adapter &)
{ {
// no-op // no-op
} }

View file

@ -280,9 +280,9 @@ void render_group_symbolizer(group_symbolizer const& sym,
// run feature or sub feature through the group rules & symbolizers // run feature or sub feature through the group rules & symbolizers
// for each index value in the range // for each index value in the range
int start = get<value_integer>(sym, keys::start_column); value_integer start = get<value_integer>(sym, keys::start_column);
int end = start + get<value_integer>(sym, keys::num_columns); value_integer end = start + get<value_integer>(sym, keys::num_columns);
for (int col_idx = start; col_idx < end; ++col_idx) for (value_integer col_idx = start; col_idx < end; ++col_idx)
{ {
// create sub feature with indexed column values // create sub feature with indexed column values
feature_ptr sub_feature = feature_factory::create(sub_feature_ctx, col_idx); 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) if (col_name.size() == 1)
{ {
// column name is '%' by itself, so give the index as the value // 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 else
{ {

View file

@ -31,6 +31,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -38,6 +38,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/karma.hpp>
#include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp> #include <boost/spirit/include/phoenix_operator.hpp>

View file

@ -41,6 +41,8 @@ namespace mapnik { namespace svg {
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/karma_nonterminal.hpp> #include <boost/spirit/include/karma_nonterminal.hpp>
#include <boost/spirit/include/karma_rule.hpp> #include <boost/spirit/include/karma_rule.hpp>
#include <boost/fusion/adapted/struct.hpp> #include <boost/fusion/adapted/struct.hpp>

View file

@ -31,6 +31,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/karma.hpp>
#include <boost/fusion/include/std_pair.hpp> #include <boost/fusion/include/std_pair.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -27,6 +27,7 @@
#include <mapnik/svg/svg_path_attributes.hpp> #include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/svg/svg_path_adapter.hpp> #include <mapnik/svg/svg_path_adapter.hpp>
#include <mapnik/util/noncopyable.hpp> #include <mapnik/util/noncopyable.hpp>
#include <mapnik/safe_cast.hpp>
// agg // agg
#include "agg_path_storage.h" #include "agg_path_storage.h"
@ -57,8 +58,8 @@ public:
void begin_path() void begin_path()
{ {
unsigned idx = source_.start_new_path(); std::size_t idx = source_.start_new_path();
attributes_.add(path_attributes(cur_attr(), idx)); attributes_.add(path_attributes(cur_attr(), safe_cast<unsigned>(idx)));
} }
void end_path() void end_path()
@ -91,7 +92,7 @@ public:
double y2 = 0.0; double y2 = 0.0;
if(source_.total_vertices()) if(source_.total_vertices())
{ {
source_.vertex(source_.total_vertices() - 1, &x2, &y2); source_.vertex(safe_cast<unsigned>(source_.total_vertices() - 1), &x2, &y2);
if(rel) x += x2; if(rel) x += x2;
source_.line_to(x, y2); source_.line_to(x, y2);
} }
@ -103,7 +104,7 @@ public:
double y2 = 0.0; double y2 = 0.0;
if(source_.total_vertices()) if(source_.total_vertices())
{ {
source_.vertex(source_.total_vertices() - 1, &x2, &y2); source_.vertex(safe_cast<unsigned>(source_.total_vertices() - 1), &x2, &y2);
if(rel) y += y2; if(rel) y += y2;
source_.line_to(x2, y); source_.line_to(x2, y);
} }

View file

@ -26,6 +26,8 @@
// mapnik // mapnik
#include <mapnik/util/noncopyable.hpp> #include <mapnik/util/noncopyable.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/safe_cast.hpp>
// agg // agg
#include "agg_math.h" #include "agg_math.h"
#include "agg_array.h" #include "agg_array.h"
@ -53,7 +55,7 @@ public:
// Make path functions // Make path functions
//-------------------------------------------------------------------- //--------------------------------------------------------------------
unsigned start_new_path(); std::size_t start_new_path();
void move_to(double x, double y); void move_to(double x, double y);
void move_rel(double dx, double dy); void move_rel(double dx, double dy);
@ -112,7 +114,7 @@ public:
const container_type& vertices() const { return vertices_; } const container_type& vertices() const { return vertices_; }
container_type& vertices() { 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; void rel_to_abs(double* x, double* y) const;
@ -263,7 +265,7 @@ private:
//------------------------------------------------------------------------ //------------------------------------------------------------------------
template<class VC> template<class VC>
unsigned path_adapter<VC>::start_new_path() std::size_t path_adapter<VC>::start_new_path()
{ {
if(!is_stop(vertices_.last_command())) if(!is_stop(vertices_.last_command()))
{ {
@ -547,7 +549,7 @@ inline void path_adapter<VC>::close_polygon(unsigned flags)
//------------------------------------------------------------------------ //------------------------------------------------------------------------
template<class VC> template<class VC>
inline unsigned path_adapter<VC>::total_vertices() const inline std::size_t path_adapter<VC>::total_vertices() const
{ {
return vertices_.total_vertices(); return vertices_.total_vertices();
} }
@ -886,7 +888,7 @@ public:
{ {
return vertices_.size() ? return vertices_.size() ?
vertices_[vertices_.size() - 1].cmd : vertices_[vertices_.size() - 1].cmd :
(unsigned)path_cmd_stop; path_cmd_stop;
} }
unsigned last_vertex(double* x, double* y) const unsigned last_vertex(double* x, double* y) const
@ -896,7 +898,7 @@ public:
*x = *y = 0.0; *x = *y = 0.0;
return path_cmd_stop; return path_cmd_stop;
} }
return vertex(vertices_.size() - 1, x, y); return vertex(safe_cast<unsigned>(vertices_.size() - 1), x, y);
} }
unsigned prev_vertex(double* x, double* y) const unsigned prev_vertex(double* x, double* y) const
@ -906,7 +908,7 @@ public:
*x = *y = 0.0; *x = *y = 0.0;
return path_cmd_stop; return path_cmd_stop;
} }
return vertex(vertices_.size() - 2, x, y); return vertex(safe_cast<unsigned>(vertices_.size() - 2), x, y);
} }
double last_x() const double last_x() const

View file

@ -31,6 +31,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>
#include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_core.hpp>

View file

@ -27,10 +27,16 @@
#include <mapnik/svg/svg_path_attributes.hpp> #include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/gradient.hpp> #include <mapnik/gradient.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/value_types.hpp>
#include <mapnik/util/noncopyable.hpp> #include <mapnik/util/noncopyable.hpp>
#if defined(GRID_RENDERER) #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 <mapnik/grid/grid_pixel.hpp> #include <mapnik/grid/grid_pixel.hpp>
#pragma GCC diagnostic pop
#endif #endif
// agg // agg
@ -341,7 +347,7 @@ public:
void render_id(Rasterizer& ras, void render_id(Rasterizer& ras,
Scanline& sl, Scanline& sl,
Renderer& ren, Renderer& ren,
int feature_id, mapnik::value_integer feature_id,
agg::trans_affine const& mtx, agg::trans_affine const& mtx,
double /*opacity*/, double /*opacity*/,
box2d<double> const& /*symbol_bbox*/) box2d<double> const& /*symbol_bbox*/)

View file

@ -34,6 +34,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>
#include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_core.hpp>

View file

@ -87,7 +87,7 @@ public:
void set_character_sizes(double size); void set_character_sizes(double size);
void set_unscaled_character_sizes(); 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 begin() { return faces_.begin(); }
iterator end() { return faces_.end(); } iterator end() { return faces_.end(); }
private: private:

View file

@ -38,7 +38,7 @@ public:
virtual void add_expressions(expression_set & output) const; virtual void add_expressions(expression_set & output) const;
text_symbolizer_properties & add(); text_symbolizer_properties & add();
text_symbolizer_properties & get(unsigned i); 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); static text_placements_ptr from_xml(xml_node const& xml, fontset_map const& fontsets, bool is_shield);
private: private:
std::vector<text_symbolizer_properties> list_; std::vector<text_symbolizer_properties> list_;

View file

@ -90,7 +90,7 @@ protected:
view_transform const& t_; view_transform const& t_;
box2d<double> dims_; box2d<double> dims_;
box2d<double> const& query_extent_; box2d<double> const& query_extent_;
float scale_factor_; double scale_factor_;
//Processing //Processing
// Remaining geometries to be processed. // Remaining geometries to be processed.

View file

@ -32,6 +32,8 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/support_container.hpp> #include <boost/spirit/include/support_container.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -59,7 +59,7 @@ inline double hue_to_rgb(double m1, double m2, double h)
inline void hsl2rgb(double h, double s, double l, inline void hsl2rgb(double h, double s, double l,
double & r, double & g, double & b) { double & r, double & g, double & b) {
if (!s) { if (s == 0.0) {
r = g = b = l; r = g = b = l;
} }
else else

View file

@ -111,7 +111,7 @@ private:
void increment() 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<unsigned>(pos_++), &std::get<1>(v_), &std::get<2>(v_));
} }
bool equal( path_iterator const& other) const bool equal( path_iterator const& other) const

View file

@ -325,7 +325,7 @@ struct converters_helper<Dispatcher>
template <typename Converter> template <typename Converter>
static void set(Dispatcher &, std::size_t) {} static void set(Dispatcher &, std::size_t) {}
template <typename Geometry, typename Processor> template <typename Geometry, typename Processor>
static void forward(Dispatcher & disp, Geometry & geom, Processor & proc) static void forward(Dispatcher &, Geometry & geom, Processor & proc)
{ {
proc.add_path(geom); proc.add_path(geom);
} }

View file

@ -34,6 +34,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/karma.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>
#include <boost/math/special_functions/trunc.hpp> // for vc++ and android whose c++11 libs lack std::trunc #include <boost/math/special_functions/trunc.hpp> // for vc++ and android whose c++11 libs lack std::trunc

View file

@ -30,6 +30,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_function.hpp> #include <boost/spirit/include/phoenix_function.hpp>

View file

@ -37,7 +37,10 @@
#include <mapnik/text/font_feature_settings.hpp> #include <mapnik/text/font_feature_settings.hpp>
// boost // boost
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#include <boost/optional.hpp> #include <boost/optional.hpp>
#pragma GCC diagnostic pop
// stl // stl
#include <string> #include <string>
@ -166,7 +169,7 @@ struct do_xml_attribute_cast<mapnik::enumeration<T,MAX> >
template <> template <>
struct do_xml_attribute_cast<mapnik::color> struct do_xml_attribute_cast<mapnik::color>
{ {
static inline boost::optional<mapnik::color> xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) static inline boost::optional<mapnik::color> xml_attribute_cast_impl(xml_tree const&, std::string const& source)
{ {
return parse_color(source); return parse_color(source);
} }
@ -176,7 +179,7 @@ struct do_xml_attribute_cast<mapnik::color>
template <> template <>
struct do_xml_attribute_cast<std::string> struct do_xml_attribute_cast<std::string>
{ {
static inline boost::optional<std::string> xml_attribute_cast_impl(xml_tree const& /*tree*/, std::string const& source) static inline boost::optional<std::string> xml_attribute_cast_impl(xml_tree const&, std::string const& source)
{ {
return boost::optional<std::string>(source); return boost::optional<std::string>(source);
} }
@ -206,7 +209,7 @@ struct do_xml_attribute_cast<mapnik::expression_ptr>
template <> template <>
struct do_xml_attribute_cast<mapnik::font_feature_settings> struct do_xml_attribute_cast<mapnik::font_feature_settings>
{ {
static inline boost::optional<mapnik::font_feature_settings> xml_attribute_cast_impl(xml_tree const& tree, std::string const& source) static inline boost::optional<mapnik::font_feature_settings> xml_attribute_cast_impl(xml_tree const&, std::string const& source)
{ {
return mapnik::font_feature_settings(source); return mapnik::font_feature_settings(source);
} }

View file

@ -36,7 +36,7 @@ namespace mapnik
class MAPNIK_DECL xml_tree class MAPNIK_DECL xml_tree
{ {
public: public:
xml_tree(std::string const& encoding="utf8"); xml_tree();
void set_filename(std::string const& fn); void set_filename(std::string const& fn);
std::string const& filename() const; std::string const& filename() const;
xml_node &root(); xml_node &root();

View file

@ -26,6 +26,7 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -40,6 +40,8 @@
#pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/version.hpp> #include <boost/version.hpp>
#include <boost/geometry/index/rtree.hpp> #include <boost/geometry/index/rtree.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -32,6 +32,7 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#ifdef SHAPE_MEMORY_MAPPED_FILE #ifdef SHAPE_MEMORY_MAPPED_FILE
#include <boost/interprocess/mapped_region.hpp> #include <boost/interprocess/mapped_region.hpp>

View file

@ -29,11 +29,11 @@
#include <mapnik/unicode.hpp> #include <mapnik/unicode.hpp>
#ifdef SHAPE_MEMORY_MAPPED_FILE #ifdef SHAPE_MEMORY_MAPPED_FILE
#include <mapnik/mapped_memory_cache.hpp> #include <mapnik/mapped_memory_cache.hpp>
#endif #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
// boost
#include <boost/interprocess/streams/bufferstream.hpp> #include <boost/interprocess/streams/bufferstream.hpp>
#pragma GCC diagnostic pop
#endif
// stl // stl
#include <vector> #include <vector>

View file

@ -34,9 +34,12 @@
#include <mapnik/util/utf_conv_win.hpp> #include <mapnik/util/utf_conv_win.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#ifdef SHAPE_MEMORY_MAPPED_FILE #ifdef SHAPE_MEMORY_MAPPED_FILE
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#include <boost/interprocess/mapped_region.hpp> #include <boost/interprocess/mapped_region.hpp>
#include <mapnik/mapped_memory_cache.hpp>
#include <boost/interprocess/streams/bufferstream.hpp> #include <boost/interprocess/streams/bufferstream.hpp>
#pragma GCC diagnostic pop
#include <mapnik/mapped_memory_cache.hpp>
#endif #endif
#include <mapnik/util/noncopyable.hpp> #include <mapnik/util/noncopyable.hpp>

View file

@ -40,6 +40,8 @@
#pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/geometry/geometries/geometries.hpp> #include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry.hpp> #include <boost/geometry.hpp>
#include <boost/version.hpp> #include <boost/version.hpp>

View file

@ -132,7 +132,7 @@ struct feature_generator
{ {
index_type index = line.ring; index_type index = line.ring;
index_type arc_index = index < 0 ? std::abs(index) - 1 : index; index_type arc_index = index < 0 ? std::abs(index) - 1 : index;
if (arc_index < num_arcs_) if (arc_index >= 0 && arc_index < static_cast<int>(num_arcs_))
{ {
auto const& arcs = topo_.arcs[arc_index]; auto const& arcs = topo_.arcs[arc_index];
double px = 0, py = 0; double px = 0, py = 0;
@ -168,7 +168,7 @@ struct feature_generator
for (auto const& index : multi_line.rings) for (auto const& index : multi_line.rings)
{ {
index_type arc_index = index < 0 ? std::abs(index) - 1 : index; index_type arc_index = index < 0 ? std::abs(index) - 1 : index;
if (arc_index < num_arcs_) if (arc_index >= 0 && arc_index < static_cast<int>(num_arcs_))
{ {
hit = true; hit = true;
double px = 0, py = 0; double px = 0, py = 0;
@ -216,7 +216,7 @@ struct feature_generator
double px = 0, py = 0; double px = 0, py = 0;
bool reverse = index < 0; bool reverse = index < 0;
index_type arc_index = reverse ? std::abs(index) - 1 : index; index_type arc_index = reverse ? std::abs(index) - 1 : index;
if (arc_index < num_arcs_) if (arc_index >= 0 && arc_index < static_cast<int>(num_arcs_))
{ {
hit = true; hit = true;
auto const& arcs = topo_.arcs[arc_index]; auto const& arcs = topo_.arcs[arc_index];
@ -296,7 +296,7 @@ struct feature_generator
double px = 0, py = 0; double px = 0, py = 0;
bool reverse = index < 0; bool reverse = index < 0;
index_type arc_index = reverse ? std::abs(index) - 1 : index; index_type arc_index = reverse ? std::abs(index) - 1 : index;
if (arc_index < num_arcs_) if (arc_index >= 0 && arc_index < static_cast<int>(num_arcs_))
{ {
hit = true; hit = true;
auto const& arcs = topo_.arcs[arc_index]; auto const& arcs = topo_.arcs[arc_index];

View file

@ -128,16 +128,16 @@ struct setup_agg_bg_visitor
void operator() (marker_rgba8 const& marker) void operator() (marker_rgba8 const& marker)
{ {
mapnik::image_rgba8 const& bg_image = marker.get_data(); mapnik::image_rgba8 const& bg_image = marker.get_data();
int w = bg_image.width(); std::size_t w = bg_image.width();
int h = bg_image.height(); std::size_t h = bg_image.height();
if ( w > 0 && h > 0) if ( w > 0 && h > 0)
{ {
// repeat background-image both vertically and horizontally // repeat background-image both vertically and horizontally
unsigned x_steps = static_cast<unsigned>(std::ceil(common_.width_/double(w))); std::size_t x_steps = static_cast<std::size_t>(std::ceil(common_.width_/double(w)));
unsigned y_steps = static_cast<unsigned>(std::ceil(common_.height_/double(h))); std::size_t y_steps = static_cast<std::size_t>(std::ceil(common_.height_/double(h)));
for (unsigned x=0;x<x_steps;++x) for (std::size_t x=0;x<x_steps;++x)
{ {
for (unsigned y=0;y<y_steps;++y) for (std::size_t y=0;y<y_steps;++y)
{ {
composite(pixmap_, bg_image, mode_, opacity_, x*w, y*h); composite(pixmap_, bg_image, mode_, opacity_, x*w, y*h);
} }

View file

@ -486,9 +486,9 @@ void cairo_context::add_text(glyph_positions const& pos,
matrix.y0 = 0; matrix.y0 = 0;
set_font_matrix(matrix); set_font_matrix(matrix);
set_font_face(manager, glyph.face); set_font_face(manager, glyph.face);
pixel_position pos = glyph_pos.pos + glyph.offset.rotate(glyph_pos.rot); pixel_position new_pos = glyph_pos.pos + glyph.offset.rotate(glyph_pos.rot);
set_color(glyph.format->fill, glyph.format->text_opacity); set_color(glyph.format->fill, 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));
} }
} }

View file

@ -110,16 +110,16 @@ struct setup_marker_visitor
void operator() (marker_rgba8 const& marker) void operator() (marker_rgba8 const& marker)
{ {
mapnik::image_rgba8 const& bg_image = marker.get_data(); mapnik::image_rgba8 const& bg_image = marker.get_data();
int w = bg_image.width(); std::size_t w = bg_image.width();
int h = bg_image.height(); std::size_t h = bg_image.height();
if ( w > 0 && h > 0) if ( w > 0 && h > 0)
{ {
// repeat background-image both vertically and horizontally // repeat background-image both vertically and horizontally
unsigned x_steps = unsigned(std::ceil(common_.width_/double(w))); std::size_t x_steps = std::size_t(std::ceil(common_.width_/double(w)));
unsigned y_steps = unsigned(std::ceil(common_.height_/double(h))); std::size_t y_steps = std::size_t(std::ceil(common_.height_/double(h)));
for (unsigned x=0;x<x_steps;++x) for (std::size_t x=0;x<x_steps;++x)
{ {
for (unsigned y=0;y<y_steps;++y) for (std::size_t y=0;y<y_steps;++y)
{ {
agg::trans_affine matrix = agg::trans_affine_translation( agg::trans_affine matrix = agg::trans_affine_translation(
x*w, x*w,
@ -191,13 +191,13 @@ void cairo_renderer<T>::end_layer_processing(layer const&)
} }
template <typename T> template <typename T>
void cairo_renderer<T>::start_style_processing(feature_type_style const& st) void cairo_renderer<T>::start_style_processing(feature_type_style const&)
{ {
MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer:start style processing"; MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer:start style processing";
} }
template <typename T> template <typename T>
void cairo_renderer<T>::end_style_processing(feature_type_style const& st) void cairo_renderer<T>::end_style_processing(feature_type_style const&)
{ {
MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer:end style processing"; MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer:end style processing";
} }

View file

@ -43,8 +43,8 @@ struct cairo_renderer_process_visitor_l
cairo_renderer_process_visitor_l(renderer_common const& common, cairo_renderer_process_visitor_l(renderer_common const& common,
line_pattern_symbolizer const& sym, line_pattern_symbolizer const& sym,
mapnik::feature_impl & feature, mapnik::feature_impl & feature,
unsigned & width, std::size_t & width,
unsigned & height) std::size_t & height)
: common_(common), : common_(common),
sym_(sym), sym_(sym),
feature_(feature), feature_(feature),
@ -81,8 +81,8 @@ struct cairo_renderer_process_visitor_l
renderer_common const& common_; renderer_common const& common_;
line_pattern_symbolizer const& sym_; line_pattern_symbolizer const& sym_;
mapnik::feature_impl & feature_; mapnik::feature_impl & feature_;
unsigned & width_; std::size_t & width_;
unsigned & height_; std::size_t & height_;
}; };
template <typename T> template <typename T>
@ -106,8 +106,8 @@ void cairo_renderer<T>::process(line_pattern_symbolizer const& sym,
if (marker->is<mapnik::marker_null>()) return; if (marker->is<mapnik::marker_null>()) return;
unsigned width = marker->width(); std::size_t width = marker->width();
unsigned height = marker->height(); std::size_t height = marker->height();
cairo_save_restore guard(context_); cairo_save_restore guard(context_);
context_.set_operator(comp_op); context_.set_operator(comp_op);

View file

@ -59,7 +59,7 @@ struct vector_markers_dispatch_cairo : public vector_markers_dispatch<Detector>
double scale_factor, double scale_factor,
feature_impl & feature, feature_impl & feature,
mapnik::attributes const& vars, mapnik::attributes const& vars,
bool snap_to_pixels, bool /* snap_to_pixels */, // only used in agg renderer currently
RendererContext const& renderer_context) RendererContext const& renderer_context)
: vector_markers_dispatch<Detector>(src, marker_trans, sym, detector, scale_factor, feature, vars), : vector_markers_dispatch<Detector>(src, marker_trans, sym, detector, scale_factor, feature, vars),
path_(path), path_(path),

View file

@ -33,6 +33,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/karma.hpp>
#include <boost/spirit/include/phoenix_statement.hpp> #include <boost/spirit/include/phoenix_statement.hpp>
#include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_core.hpp>

View file

@ -34,6 +34,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#ifdef MAPNIK_KARMA_TO_STRING #ifdef MAPNIK_KARMA_TO_STRING
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/karma.hpp>

View file

@ -82,7 +82,7 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
ras_ptr->reset(); ras_ptr->reset();
int stroke_width = mark->width(); std::size_t stroke_width = mark->width();
agg::trans_affine tr; agg::trans_affine tr;
auto transform = get_optional<transform_type>(sym, keys::geometry_transform); auto transform = get_optional<transform_type>(sym, keys::geometry_transform);

View file

@ -23,6 +23,7 @@
// mapnik // mapnik
#include <mapnik/group/group_layout_manager.hpp> #include <mapnik/group/group_layout_manager.hpp>
#include <mapnik/util/variant.hpp> #include <mapnik/util/variant.hpp>
#include <mapnik/safe_cast.hpp>
// std // std
#include <cmath> #include <cmath>
@ -85,7 +86,7 @@ struct process_layout
} }
bound_box layout_box; bound_box layout_box;
size_t middle_ifirst = (member_boxes_.size() - 1) >> 1; int middle_ifirst = safe_cast<int>((member_boxes_.size() - 1) >> 1);
int top_i = 0; int top_i = 0;
int bottom_i = 0; int bottom_i = 0;
if (middle_ifirst % 2 == 0) if (middle_ifirst % 2 == 0)
@ -102,8 +103,8 @@ struct process_layout
while (bottom_i >= 0 && top_i >= 0 && top_i < static_cast<int>(member_offsets_.size())) while (bottom_i >= 0 && top_i >= 0 && top_i < static_cast<int>(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(static_cast<std::size_t>(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<std::size_t>(bottom_i), layout_box.maxy() + y_margin, 1, x_margin, layout.get_max_difference()));
top_i -= 2; top_i -= 2;
bottom_i += 2; bottom_i += 2;
} }

View file

@ -50,10 +50,10 @@ struct visitor_image_copy
template <typename T1> template <typename T1>
T0 operator() (T1 const& src) T0 operator() (T1 const& src)
{ {
T0 dst(src.width(), src.height(), false); T0 dst(safe_cast<int>(src.width()), safe_cast<int>(src.height()), false);
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)
{ {
dst(x,y) = safe_cast<dst_type>(src(x,y)); dst(x,y) = safe_cast<dst_type>(src(x,y));
} }
@ -95,12 +95,12 @@ struct visitor_image_copy_so
{ {
double src_offset = src.get_offset(); double src_offset = src.get_offset();
double src_scaling = src.get_scaling(); double src_scaling = src.get_scaling();
T0 dst(src.width(), src.height(), false); T0 dst(safe_cast<int>(src.width()), safe_cast<int>(src.height()), false);
dst.set_scaling(scaling_); dst.set_scaling(scaling_);
dst.set_offset(offset_); 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<double>(src(x,y)) * src_scaling) + src_offset; double scaled_src_val = (safe_cast<double>(src(x,y)) * src_scaling) + src_offset;
double dst_val = (scaled_src_val - offset_) / scaling_; double dst_val = (scaled_src_val - offset_) / scaling_;

View file

@ -30,6 +30,8 @@
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers" #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/karma.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -489,7 +489,7 @@ struct premultiply_visitor
{ {
if (!data.get_premultiplied()) 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<unsigned>(data.width()),safe_cast<unsigned>(data.height()),safe_cast<int>(data.row_size()));
agg::pixfmt_rgba32 pixf(buffer); agg::pixfmt_rgba32 pixf(buffer);
pixf.premultiply(); pixf.premultiply();
data.set_premultiplied(true); data.set_premultiplied(true);
@ -511,7 +511,7 @@ struct demultiply_visitor
{ {
if (data.get_premultiplied()) 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<unsigned>(data.width()),safe_cast<unsigned>(data.height()),safe_cast<int>(data.row_size()));
agg::pixfmt_rgba32_pre pixf(buffer); agg::pixfmt_rgba32_pre pixf(buffer);
pixf.demultiply(); pixf.demultiply();
data.set_premultiplied(false); data.set_premultiplied(false);
@ -641,12 +641,12 @@ struct visitor_apply_opacity
for (std::size_t x = 0; x < data.width(); ++x) for (std::size_t x = 0; x < data.width(); ++x)
{ {
pixel_type rgba = row_to[x]; pixel_type rgba = row_to[x];
pixel_type a = static_cast<pixel_type>(((rgba >> 24) & 0xff) * opacity_); pixel_type a = static_cast<pixel_type>(((rgba >> 24u) & 0xff) * opacity_);
pixel_type r = rgba & 0xff; pixel_type r = rgba & 0xff;
pixel_type g = (rgba >> 8 ) & 0xff; pixel_type g = (rgba >> 8u ) & 0xff;
pixel_type b = (rgba >> 16) & 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 rgba = row_from[x];
pixel_type r = rgba & 0xff; pixel_type r = rgba & 0xff;
pixel_type g = (rgba >> 8 ) & 0xff; pixel_type g = (rgba >> 8u) & 0xff;
pixel_type b = (rgba >> 16) & 0xff; pixel_type b = (rgba >> 16u) & 0xff;
// magic numbers for grayscale // magic numbers for grayscale
pixel_type a = static_cast<pixel_type>(std::ceil((r * .3) + (g * .59) + (b * .11))); pixel_type a = static_cast<pixel_type>(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 // magic numbers for grayscale
pixel_type a = static_cast<pixel_type>(std::ceil((r * .3) + (g * .59) + (b * .11))); pixel_type a = static_cast<pixel_type>(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<unsigned>(a << 24u) |
static_cast<unsigned>(c_.blue() << 16u) |
static_cast<unsigned>(c_.green() << 8u) |
static_cast<unsigned>(c_.red() );
} }
} }
} }
@ -1217,9 +1220,10 @@ struct visitor_composite_pixel
if (mapnik::check_bounds(data, x_, y_)) if (mapnik::check_bounds(data, x_, y_))
{ {
image_rgba8::pixel_type rgba = data(x_,y_); image_rgba8::pixel_type rgba = data(x_,y_);
value_type ca = static_cast<unsigned>(((c_ >> 24) & 0xff) * opacity_); // TODO use std::round for consistent rounding
value_type cb = (c_ >> 16 ) & 0xff; value_type ca = safe_cast<value_type>(((c_ >> 24u) & 0xff) * opacity_);
value_type cg = (c_ >> 8) & 0xff; value_type cb = (c_ >> 16u) & 0xff;
value_type cg = (c_ >> 8u) & 0xff;
value_type cr = (c_ & 0xff); value_type cr = (c_ & 0xff);
blender_type::blend_pix(comp_op_, reinterpret_cast<value_type*>(&rgba), cr, cg, cb, ca, cover_); blender_type::blend_pix(comp_op_, reinterpret_cast<value_type*>(&rgba), cr, cg, cb, ca, cover_);
data(x_,y_) = rgba; data(x_,y_) = rgba;
@ -1227,7 +1231,7 @@ struct visitor_composite_pixel
} }
template <typename T> template <typename T>
void operator() (T & data) const void operator() (T &) const
{ {
throw std::runtime_error("Composite pixel is not supported for this data type"); throw std::runtime_error("Composite pixel is not supported for this data type");
} }
@ -1237,7 +1241,7 @@ private:
composite_mode_e comp_op_; composite_mode_e comp_op_;
std::size_t const x_; std::size_t const x_;
std::size_t const y_; std::size_t const y_;
int const c_; unsigned const c_;
unsigned const cover_; unsigned const cover_;
}; };
@ -2082,7 +2086,7 @@ struct visitor_view_to_stream
for (std::size_t i=0;i<view.height();i++) for (std::size_t i=0;i<view.height();i++)
{ {
os_.write(reinterpret_cast<const char*>(view.get_row(i)), os_.write(reinterpret_cast<const char*>(view.get_row(i)),
view.row_size()); safe_cast<std::streamsize>(view.row_size()));
} }
} }
@ -2251,11 +2255,11 @@ MAPNIK_DECL std::size_t compare<image_rgba8>(image_rgba8 const& im1, image_rgba8
unsigned rgba = row_from[x]; unsigned rgba = row_from[x];
unsigned rgba2 = row_from2[x]; unsigned rgba2 = row_from2[x];
unsigned r = rgba & 0xff; unsigned r = rgba & 0xff;
unsigned g = (rgba >> 8 ) & 0xff; unsigned g = (rgba >> 8u) & 0xff;
unsigned b = (rgba >> 16) & 0xff; unsigned b = (rgba >> 16u) & 0xff;
unsigned r2 = rgba2 & 0xff; unsigned r2 = rgba2 & 0xff;
unsigned g2 = (rgba2 >> 8 ) & 0xff; unsigned g2 = (rgba2 >> 8u) & 0xff;
unsigned b2 = (rgba2 >> 16) & 0xff; unsigned b2 = (rgba2 >> 16u) & 0xff;
if (std::abs(static_cast<int>(r - r2)) > static_cast<int>(threshold) || if (std::abs(static_cast<int>(r - r2)) > static_cast<int>(threshold) ||
std::abs(static_cast<int>(g - g2)) > static_cast<int>(threshold) || std::abs(static_cast<int>(g - g2)) > static_cast<int>(threshold) ||
std::abs(static_cast<int>(b - b2)) > static_cast<int>(threshold)) { std::abs(static_cast<int>(b - b2)) > static_cast<int>(threshold)) {
@ -2263,8 +2267,8 @@ MAPNIK_DECL std::size_t compare<image_rgba8>(image_rgba8 const& im1, image_rgba8
continue; continue;
} }
if (alpha) { if (alpha) {
unsigned a = (rgba >> 24) & 0xff; unsigned a = (rgba >> 24u) & 0xff;
unsigned a2 = (rgba2 >> 24) & 0xff; unsigned a2 = (rgba2 >> 24u) & 0xff;
if (std::abs(static_cast<int>(a - a2)) > static_cast<int>(threshold)) { if (std::abs(static_cast<int>(a - a2)) > static_cast<int>(threshold)) {
++difference; ++difference;
continue; continue;
@ -2289,11 +2293,11 @@ MAPNIK_DECL std::size_t compare<image_rgba8>(image_rgba8 const& im1, image_rgba8
unsigned rgba = row_from[x]; unsigned rgba = row_from[x];
unsigned rgba2 = row_from2[x]; unsigned rgba2 = row_from2[x];
unsigned r = rgba & 0xff; unsigned r = rgba & 0xff;
unsigned g = (rgba >> 8 ) & 0xff; unsigned g = (rgba >> 8u) & 0xff;
unsigned b = (rgba >> 16) & 0xff; unsigned b = (rgba >> 16u) & 0xff;
unsigned r2 = rgba2 & 0xff; unsigned r2 = rgba2 & 0xff;
unsigned g2 = (rgba2 >> 8 ) & 0xff; unsigned g2 = (rgba2 >> 8u) & 0xff;
unsigned b2 = (rgba2 >> 16) & 0xff; unsigned b2 = (rgba2 >> 16u) & 0xff;
if (std::abs(static_cast<int>(r - r2)) > static_cast<int>(threshold) || if (std::abs(static_cast<int>(r - r2)) > static_cast<int>(threshold) ||
std::abs(static_cast<int>(g - g2)) > static_cast<int>(threshold) || std::abs(static_cast<int>(g - g2)) > static_cast<int>(threshold) ||
std::abs(static_cast<int>(b - b2)) > static_cast<int>(threshold)) { std::abs(static_cast<int>(b - b2)) > static_cast<int>(threshold)) {
@ -2301,8 +2305,8 @@ MAPNIK_DECL std::size_t compare<image_rgba8>(image_rgba8 const& im1, image_rgba8
continue; continue;
} }
if (alpha) { if (alpha) {
unsigned a = (rgba >> 24) & 0xff; unsigned a = (rgba >> 24u) & 0xff;
unsigned a2 = (rgba2 >> 24) & 0xff; unsigned a2 = (rgba2 >> 24u) & 0xff;
if (std::abs(static_cast<int>(a - a2)) > static_cast<int>(threshold)) { if (std::abs(static_cast<int>(a - a2)) > static_cast<int>(threshold)) {
++difference; ++difference;
continue; continue;

View file

@ -47,7 +47,7 @@ struct get_view_height_visitor
struct get_view_size_visitor struct get_view_size_visitor
{ {
template <typename T> template <typename T>
unsigned operator()(T const& data) const std::size_t operator()(T const& data) const
{ {
return data.size(); return data.size();
} }
@ -65,7 +65,7 @@ struct get_view_dtype_visitor
struct get_view_row_size_visitor struct get_view_row_size_visitor
{ {
template <typename T> template <typename T>
unsigned operator()(T const& data) const std::size_t operator()(T const& data) const
{ {
return data.row_size(); return data.row_size();
} }

View file

@ -80,7 +80,7 @@ using boost::optional;
constexpr unsigned name2int(const char *str, int off = 0) 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<unsigned>(str[off]);
} }
class map_parser : util::noncopyable 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) void load_map(Map & map, std::string const& filename, bool strict, std::string base_path)
{ {
// TODO - use xml encoding? xml_tree tree;
xml_tree tree("utf8");
tree.set_filename(filename); tree.set_filename(filename);
read_xml(filename, tree.root()); read_xml(filename, tree.root());
map_parser parser(map, strict, filename); 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) void load_map_string(Map & map, std::string const& str, bool strict, std::string base_path)
{ {
// TODO - use xml encoding? xml_tree tree;
xml_tree tree("utf8");
if (!base_path.empty()) if (!base_path.empty())
{ {
read_xml_string(str, tree.root(), base_path); // accept base_path passed into function 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); map.set_srs(srs);
optional<unsigned> buffer_size = map_node.get_opt_attr<unsigned>("buffer-size"); optional<int> buffer_size = map_node.get_opt_attr<int>("buffer-size");
if (buffer_size) if (buffer_size)
{ {
map.set_buffer_size(*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); lyr.set_group_by(* group_by);
} }
optional<unsigned> buffer_size = node.get_opt_attr<unsigned>("buffer-size"); optional<int> buffer_size = node.get_opt_attr<int>("buffer-size");
if (buffer_size) if (buffer_size)
{ {
lyr.set_buffer_size(*buffer_size); lyr.set_buffer_size(*buffer_size);

View file

@ -126,13 +126,13 @@ struct visitor_create_marker
return mapnik::marker(mapnik::marker_rgba8(data)); 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"); throw std::runtime_error("Can not make marker from null image data type");
} }
template <typename T> template <typename T>
marker operator() (T & data) marker operator() (T &)
{ {
throw std::runtime_error("Can not make marker from this data type"); throw std::runtime_error("Can not make marker from this data type");
} }

View file

@ -25,6 +25,7 @@
#include <mapnik/map.hpp> #include <mapnik/map.hpp>
#include <mapnik/request.hpp> #include <mapnik/request.hpp>
#include <mapnik/attribute.hpp> #include <mapnik/attribute.hpp>
#include <mapnik/safe_cast.hpp>
namespace mapnik { namespace mapnik {

View file

@ -465,13 +465,12 @@ void serialize_fontset( ptree & map_node, std::string const& name, font_set cons
set_attr(fontset_node, "name", name); 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 & font_node = fontset_node.push_back(
ptree::value_type("Font", ptree()))->second; 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) 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 & layer_node = map_node.push_back(
ptree::value_type("Layer", ptree()))->second; 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/*<bool>*/( layer_node, "status", layer.active() ); set_attr/*<bool>*/( layer_node, "status", lyr.active() );
} }
if ( layer.clear_label_cache() || explicit_defaults ) if ( lyr.clear_label_cache() || explicit_defaults )
{ {
set_attr/*<bool>*/( layer_node, "clear-label-cache", layer.clear_label_cache() ); set_attr/*<bool>*/( 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<double>::max() ) if ( lyr.maximum_scale_denominator() != std::numeric_limits<double>::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/*<bool>*/( layer_node, "cache-features", layer.cache_features() ); set_attr/*<bool>*/( 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<int> const& buffer_size = layer.buffer_size(); boost::optional<int> const& buffer_size = lyr.buffer_size();
if ( buffer_size || explicit_defaults) if ( buffer_size || explicit_defaults)
{ {
set_attr( layer_node, "buffer-size", *buffer_size ); set_attr( layer_node, "buffer-size", *buffer_size );
} }
optional<box2d<double> > const& maximum_extent = layer.maximum_extent(); optional<box2d<double> > const& maximum_extent = lyr.maximum_extent();
if ( maximum_extent) if ( maximum_extent)
{ {
std::ostringstream s; 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() ); 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 & style_node = layer_node.push_back(
boost::property_tree::ptree::value_type("StyleName", 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); style_node.put_value(name);
} }
datasource_ptr datasource = layer.datasource(); datasource_ptr datasource = lyr.datasource();
if ( datasource ) if ( datasource )
{ {
serialize_datasource( layer_node, datasource ); serialize_datasource( layer_node, datasource );

View file

@ -32,6 +32,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/karma.hpp>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View file

@ -25,6 +25,7 @@
#include <mapnik/svg/svg_parser.hpp> #include <mapnik/svg/svg_parser.hpp>
#include <mapnik/svg/svg_path_parser.hpp> #include <mapnik/svg/svg_path_parser.hpp>
#include <mapnik/config_error.hpp> #include <mapnik/config_error.hpp>
#include <mapnik/safe_cast.hpp>
#include "agg_ellipse.h" #include "agg_ellipse.h"
#include "agg_rounded_rect.h" #include "agg_rounded_rect.h"
@ -34,6 +35,7 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp> #include <boost/spirit/include/phoenix_operator.hpp>
@ -1075,7 +1077,7 @@ void svg_parser::parse(std::string const& filename)
void svg_parser::parse_from_string(std::string const& svg) 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<int>(svg.size()),nullptr,nullptr,
(XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | XML_PARSE_NOERROR | XML_PARSE_NOWARNING)); (XML_PARSE_NOBLANKS | XML_PARSE_NOCDATA | XML_PARSE_NOERROR | XML_PARSE_NOWARNING));
if (reader == nullptr) if (reader == nullptr)
{ {

View file

@ -46,7 +46,7 @@ void text_node::to_xml(ptree & xml) const
new_node.put_value(to_expression_string(*text_)); 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<text_node>(xml.get_value<expression_ptr>()); return std::make_shared<text_node>(xml.get_value<expression_ptr>());
} }

View file

@ -33,7 +33,7 @@ bool text_placement_info_dummy::next() const
} }
text_placement_info_ptr text_placements_dummy::get_placement_info( 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<text_placement_info_dummy>(this, scale_factor); return std::make_shared<text_placement_info_dummy>(this, scale_factor);
} }

View file

@ -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<text_placement_info_list>(this, scale_factor); return std::make_shared<text_placement_info_list>(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(); return list_.size();
} }

View file

@ -35,6 +35,8 @@
#pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers" #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp> #include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_stl.hpp> #include <boost/spirit/include/phoenix_stl.hpp>
@ -185,7 +187,7 @@ namespace detail {
} }
template <typename T> template <typename T>
std::string operator() (T const& val) const std::string operator() (T const&) const
{ {
return ""; return "";
} }

View file

@ -342,7 +342,7 @@ public:
} }
template <typename T> template <typename T>
bool operator()(T const & geo) const bool operator()(T const&) const
{ {
return false; return false;
} }

View file

@ -68,6 +68,7 @@ struct name_trait
DEFINE_NAME_TRAIT( double, "double") DEFINE_NAME_TRAIT( double, "double")
DEFINE_NAME_TRAIT( float, "float") DEFINE_NAME_TRAIT( float, "float")
DEFINE_NAME_TRAIT( unsigned, "unsigned") DEFINE_NAME_TRAIT( unsigned, "unsigned")
DEFINE_NAME_TRAIT( int, "int")
DEFINE_NAME_TRAIT( boolean_type, "boolean_type") DEFINE_NAME_TRAIT( boolean_type, "boolean_type")
#ifdef BIGINT #ifdef BIGINT
DEFINE_NAME_TRAIT( mapnik::value_integer, "long long" ) DEFINE_NAME_TRAIT( mapnik::value_integer, "long long" )
@ -98,7 +99,7 @@ struct name_trait< mapnik::enumeration<ENUM, MAX> >
} }
}; };
xml_tree::xml_tree(std::string const& encoding) xml_tree::xml_tree()
: node_(*this, "<root>"), : node_(*this, "<root>"),
file_() file_()
{ {
@ -413,6 +414,7 @@ std::string xml_node::line_to_string() const
compile_get_opt_attr(boolean_type); compile_get_opt_attr(boolean_type);
compile_get_opt_attr(std::string); compile_get_opt_attr(std::string);
compile_get_opt_attr(int);
compile_get_opt_attr(unsigned); compile_get_opt_attr(unsigned);
compile_get_opt_attr(mapnik::value_integer); compile_get_opt_attr(mapnik::value_integer);
compile_get_opt_attr(float); compile_get_opt_attr(float);

View file

@ -21,7 +21,7 @@ TEST_CASE("xml parser") {
" </Layer>" " </Layer>"
"</Map>"); "</Map>");
mapnik::xml_tree tree("utf8"); mapnik::xml_tree tree;
tree.set_filename("xml_datasource_parameter_trim.cpp"); tree.set_filename("xml_datasource_parameter_trim.cpp");
REQUIRE_NOTHROW(read_xml_string(xml, tree.root(), "")); REQUIRE_NOTHROW(read_xml_string(xml, tree.root(), ""));