fix a variety of msvc compiler warnings about signed/unsigned implicit conversion

This commit is contained in:
Dane Springmeyer 2013-03-15 13:37:48 -07:00
parent e30ef619c6
commit 7d868558d7
3 changed files with 10 additions and 10 deletions

View file

@ -118,9 +118,9 @@ public:
private:
inline bool checkBounds(unsigned x, unsigned y) const
inline bool checkBounds(int x, int y) const
{
return (x < width_ && y < height_);
return (x >= 0 && x < width_ && y >= 0 && y < height_);
}
public:

View file

@ -531,12 +531,12 @@ struct mod: public boost::static_visitor<V>
value_type operator() (value_double lhs, value_integer rhs) const
{
return std::fmod(lhs, rhs);
return std::fmod(lhs, static_cast<value_double>(rhs));
}
value_type operator() (value_integer lhs, value_double rhs) const
{
return std::fmod(lhs, rhs);
return std::fmod(static_cast<value_double>(lhs), rhs);
}
value_type operator() (value_double lhs, value_double rhs) const

View file

@ -30,17 +30,17 @@ namespace mapnik {
void draw_rect(image_32 &pixmap, box2d<double> const& box)
{
double x0 = box.minx();
double x1 = box.maxx();
double y0 = box.miny();
double y1 = box.maxy();
int x0 = static_cast<int>(box.minx());
int x1 = static_cast<int>(box.maxx());
int y0 = static_cast<int>(box.miny());
int y1 = static_cast<int>(box.maxy());
unsigned color1 = 0xff0000ff;
for (double x=x0; x<x1; x++)
for (int x=x0; x<x1; x++)
{
pixmap.setPixel(x, y0, color1);
pixmap.setPixel(x, y1, color1);
}
for (double y=y0; y<y1; y++)
for (int y=y0; y<y1; y++)
{
pixmap.setPixel(x0, y, color1);
pixmap.setPixel(x1, y, color1);