Fix msvc warning

This commit is contained in:
Ahmed Essam 2020-10-01 17:59:46 +01:00
parent 945853fc34
commit 1fb65b6ea8
2 changed files with 12 additions and 7 deletions

View File

@ -238,7 +238,8 @@ private:
typedef std::vector<int> index_vector; typedef std::vector<int> index_vector;
//! map container element's type for maintaining a list of cache instances //! map container element's type for maintaining a list of cache instances
typedef std::pair<int, int> LRU_entry; typedef std::pair<int, std::size_t> LRU_entry;
//! LRU list used for cache switching //! LRU list used for cache switching
typedef std::vector< LRU_entry > Cache_list; typedef std::vector< LRU_entry > Cache_list;
@ -256,8 +257,9 @@ public:
//!@{ //!@{
//! default constructor: a curve segment is undefined //! default constructor: a curve segment is undefined
Curve_renderer_2() : cache_id(-1), IA_method(0), initialized(false), Curve_renderer_2() :
one(1) { cache_id(INVALID_CACHE_ID), IA_method(0), initialized(false), one(1)
{
arcno = -1; arcno = -1;
setup(Bbox_2(-1.0, -1.0, 1.0, 1.0), 640, 480); setup(Bbox_2(-1.0, -1.0, 1.0, 1.0), 640, 480);
} }
@ -381,9 +383,11 @@ private:
Clip_points btm_clip, top_clip; //! a set of bottom and top clip points Clip_points btm_clip, top_clip; //! a set of bottom and top clip points
Poly_dst_1 btm_poly, top_poly; //! bottom and top polynomials Poly_dst_1 btm_poly, top_poly; //! bottom and top polynomials
int cache_id; //! index of currently used cache instance std::size_t cache_id; //! index of currently used cache instance
Cache_list cache_list; //! list of indices of cache instances Cache_list cache_list; //! list of indices of cache instances
static constexpr std::size_t INVALID_CACHE_ID = CGAL_N_CACHES;
Seed_stack s_stack; //! a stack of seed points Seed_stack s_stack; //! a stack of seed points
Seed_point current_seed; //! current seed point Seed_point current_seed; //! current seed point
@ -1192,7 +1196,7 @@ Lexit:
std::reverse(rev_points.begin(), rev_points.end()); std::reverse(rev_points.begin(), rev_points.end());
// resize rev_points to accommodate the size of points vector // resize rev_points to accommodate the size of points vector
unsigned rsize = rev_points.size(); std::size_t rsize = rev_points.size();
rev_points.resize(rsize + points.size()); rev_points.resize(rsize + points.size());
std::copy(points.begin(), points.end(), rev_points.begin() + rsize); std::copy(points.begin(), points.end(), rev_points.begin() + rsize);
} }
@ -2312,7 +2316,8 @@ void select_cache_entry(const Arc_2& arc) {
it++; it++;
} }
int new_id, new_entry = (it == cache_list.end()); std::size_t new_id;
bool new_entry = (it == cache_list.end());
if(new_entry) { if(new_entry) {
new_id = cache_list.size(); new_id = cache_list.size();
if(new_id >= CGAL_N_CACHES) { if(new_id >= CGAL_N_CACHES) {

View File

@ -1028,7 +1028,7 @@ void precompute(const Polynomial_2& in) {
} }
//! \brief activates the cache entry \c cache_id //! \brief activates the cache entry \c cache_id
void select_cache_entry(int cache_id) void select_cache_entry(std::size_t cache_id)
{ {
coeffs_x = coeffs_x_ + cache_id; coeffs_x = coeffs_x_ + cache_id;
coeffs_y = coeffs_y_ + cache_id; coeffs_y = coeffs_y_ + cache_id;