+ fix many warnings in libarea using MSVC

This commit is contained in:
wmayer 2016-06-14 11:04:19 +02:00
parent 26be0067cd
commit 6be9ee87ea
6 changed files with 22 additions and 17 deletions

View File

@ -60,7 +60,7 @@ public:
void Offset(double inwards_value);
void Thicken(double value);
void FitArcs();
unsigned int num_curves(){return m_curves.size();}
unsigned int num_curves(){return static_cast<int>(m_curves.size());}
Point NearestPoint(const Point& p)const;
void GetBox(CBox2D &box);
void Reorder();

View File

@ -169,7 +169,7 @@ static void OffsetWithLoops(const TPolyPolygon &pp, TPolyPolygon &pp_new, double
{
if(reverse)
{
for(unsigned int j = p.size()-1; j > 1; j--)MakeLoop(p[j], p[j-1], p[j-2], radius);
for(std::size_t j = p.size()-1; j > 1; j--)MakeLoop(p[j], p[j-1], p[j-2], radius);
MakeLoop(p[1], p[0], p[p.size()-1], radius);
MakeLoop(p[0], p[p.size()-1], p[p.size()-2], radius);
}
@ -177,7 +177,7 @@ static void OffsetWithLoops(const TPolyPolygon &pp, TPolyPolygon &pp_new, double
{
MakeLoop(p[p.size()-2], p[p.size()-1], p[0], radius);
MakeLoop(p[p.size()-1], p[0], p[1], radius);
for(unsigned int j = 2; j < p.size(); j++)MakeLoop(p[j-2], p[j-1], p[j], radius);
for(std::size_t j = 2; j < p.size(); j++)MakeLoop(p[j-2], p[j-1], p[j], radius);
}
TPolygon loopy_polygon;
@ -213,8 +213,8 @@ static void OffsetWithLoops(const TPolyPolygon &pp, TPolyPolygon &pp_new, double
const TPolygon& p = copy[i];
TPolygon p_new;
p_new.resize(p.size());
int size_minus_one = p.size() - 1;
for(unsigned int j = 0; j < p.size(); j++)p_new[j] = p[size_minus_one - j];
std::size_t size_minus_one = p.size() - 1;
for(std::size_t j = 0; j < p.size(); j++)p_new[j] = p[size_minus_one - j];
pp_new[i] = p_new;
}
}
@ -290,8 +290,8 @@ static void OffsetSpansWithObrounds(const CArea& area, TPolyPolygon &pp_new, dou
const TPolygon& p = copy[i];
TPolygon p_new;
p_new.resize(p.size());
int size_minus_one = p.size() - 1;
for(unsigned int j = 0; j < p.size(); j++)p_new[j] = p[size_minus_one - j];
std::size_t size_minus_one = p.size() - 1;
for(std::size_t j = 0; j < p.size(); j++)p_new[j] = p[size_minus_one - j];
pp_new[i] = p_new;
}
}
@ -315,7 +315,7 @@ static void MakePolyPoly( const CArea& area, TPolyPolygon &pp, bool reverse = tr
p.resize(pts_for_AddVertex.size());
if(reverse)
{
unsigned int i = pts_for_AddVertex.size() - 1;// clipper wants them the opposite way to CArea
std::size_t i = pts_for_AddVertex.size() - 1;// clipper wants them the opposite way to CArea
for(std::list<DoubleAreaPoint>::iterator It = pts_for_AddVertex.begin(); It != pts_for_AddVertex.end(); It++, i--)
{
p[i] = It->int_point();
@ -498,4 +498,4 @@ void UnFitArcs(CCurve &curve)
CVertex vertex(0, Point(pt.X / CArea::m_units, pt.Y / CArea::m_units), Point(0.0, 0.0));
curve.m_vertices.push_back(vertex);
}
}
}

View File

@ -4,6 +4,10 @@ if (CMAKE_BUILD_TOOL MATCHES "make")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif (CMAKE_BUILD_TOOL MATCHES "make")
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif(MSVC)
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -62,10 +62,10 @@ bool CCurve::CheckForArc(const CVertex& prev_vt, std::list<const CVertex*>& migh
if(might_be_an_arc.size() < 2)return false;
// find middle point
int num = might_be_an_arc.size();
int i = 0;
std::size_t num = might_be_an_arc.size();
std::size_t i = 0;
const CVertex* mid_vt = NULL;
int mid_i = (num-1)/2;
std::size_t mid_i = (num-1)/2;
for(std::list<const CVertex*>::iterator It = might_be_an_arc.begin(); It != might_be_an_arc.end(); It++, i++)
{
if(i == mid_i)

View File

@ -62,7 +62,7 @@ boost::python::tuple transformed_point(const geoff_geometry::Matrix &matrix, dou
static void print_curve(const CCurve& c)
{
unsigned int nvertices = c.m_vertices.size();
std::size_t nvertices = c.m_vertices.size();
printf("number of vertices = %d\n", nvertices);
int i = 0;
for(std::list<CVertex>::const_iterator It = c.m_vertices.begin(); It != c.m_vertices.end(); It++, i++)
@ -85,7 +85,7 @@ static void print_area(const CArea &a)
static unsigned int num_vertices(const CCurve& curve)
{
return curve.m_vertices.size();
return static_cast<unsigned int>(curve.m_vertices.size());
}
static CVertex FirstVertex(const CCurve& curve)

View File

@ -1,4 +1,5 @@
// dxf.cpp
// dxf.cpp
// Copyright 2011, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.
@ -1359,10 +1360,10 @@ void CDxfRead::get_line()
m_ifs->getline(m_str, 1024);
char str[1024];
int len = strlen(m_str);
int j = 0;
std::size_t len = strlen(m_str);
std::size_t j = 0;
bool non_white_found = false;
for(int i = 0; i<len; i++){
for(std::size_t i = 0; i<len; i++){
if(non_white_found || (m_str[i] != ' ' && m_str[i] != '\t')){
#if wxUSE_UNICODE
if(m_str[i] != '\r')