From bf9d5a126a85ab51b4884a8806553d16c67c121b Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sat, 21 Oct 2017 19:05:21 +0200 Subject: [PATCH] [DEV] update to the new ETK allocator wrapper --- esvg/Base.cpp | 2 +- esvg/Polygon.cpp | 2 +- esvg/Polyline.cpp | 2 +- esvg/render/PointList.cpp | 2 +- esvg/render/Scanline.cpp | 11 +++++------ esvg/render/SegmentList.cpp | 10 +++++----- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/esvg/Base.cpp b/esvg/Base.cpp index 1416ee7..cb9bc14 100644 --- a/esvg/Base.cpp +++ b/esvg/Base.cpp @@ -200,7 +200,7 @@ etk::Pair esvg::Base::parseLength2(const etk::String ESVG_VERBOSE(" lenght : '" << _dataInput << "'"); float n = _dataInput.to(); etk::String unit; - for (int32_t iii=0; iii<_dataInput.size(); ++iii) { + for (size_t iii=0; iii<_dataInput.size(); ++iii) { if( (_dataInput[iii]>='0' && _dataInput[iii]<='9') || _dataInput[iii]=='+' || _dataInput[iii]=='-' diff --git a/esvg/Polygon.cpp b/esvg/Polygon.cpp index 8f2f4ce..359e191 100644 --- a/esvg/Polygon.cpp +++ b/esvg/Polygon.cpp @@ -64,7 +64,7 @@ void esvg::Polygon::display(int32_t _spacing) { esvg::render::Path esvg::Polygon::createPath() { esvg::render::Path out; out.moveTo(false, m_listPoint[0]); - for( int32_t iii=1; iii< m_listPoint.size(); iii++) { + for(size_t iii=1; iii< m_listPoint.size(); iii++) { out.lineTo(false, m_listPoint[iii]); } out.close(); diff --git a/esvg/Polyline.cpp b/esvg/Polyline.cpp index 5d5ba93..b9cf7fa 100644 --- a/esvg/Polyline.cpp +++ b/esvg/Polyline.cpp @@ -61,7 +61,7 @@ esvg::render::Path esvg::Polyline::createPath() { esvg::render::Path out; out.clear(); out.moveTo(false, m_listPoint[0]); - for( int32_t iii=1; iii< m_listPoint.size(); iii++) { + for(size_t iii=1; iii< m_listPoint.size(); iii++) { out.lineTo(false, m_listPoint[iii]); } out.stop(); diff --git a/esvg/render/PointList.cpp b/esvg/render/PointList.cpp index d326ed8..bf7012f 100644 --- a/esvg/render/PointList.cpp +++ b/esvg/render/PointList.cpp @@ -39,7 +39,7 @@ void esvg::render::PointList::display() { ESVG_VERBOSE(" Display list of points : size=" << m_data.size()); for (auto &it : m_data) { ESVG_VERBOSE(" Find List " << it.size() << " members"); - for (int32_t iii=0; + for (size_t iii=0; iii < it.size(); ++iii) { switch (it[iii].m_type) { diff --git a/esvg/render/Scanline.cpp b/esvg/render/Scanline.cpp index 70ea34a..9b9bf55 100644 --- a/esvg/render/Scanline.cpp +++ b/esvg/render/Scanline.cpp @@ -8,8 +8,7 @@ #include esvg::render::Scanline::Scanline(size_t _size) { - float tmp(0); - m_data.resize(_size, tmp); + m_data.resize(_size, 0.0f); } size_t esvg::render::Scanline::size() const { @@ -23,16 +22,16 @@ void esvg::render::Scanline::clear(float _fill) { } float esvg::render::Scanline::get(int32_t _pos) const { - if( _pos>=0 - && _pos= 0 + && size_t(_pos) < m_data.size()) { return m_data[_pos]; } return 0; } void esvg::render::Scanline::set(int32_t _pos, float _newColor) { - if( _pos>=0 - && _pos= 0 + && size_t(_pos) < m_data.size()) { m_data[_pos] = _newColor; } } diff --git a/esvg/render/SegmentList.cpp b/esvg/render/SegmentList.cpp index 187c060..5232347 100644 --- a/esvg/render/SegmentList.cpp +++ b/esvg/render/SegmentList.cpp @@ -49,7 +49,7 @@ etk::Pair esvg::render::SegmentList::getViewPort() { void esvg::render::SegmentList::createSegmentList(const esvg::render::PointList& _listPoint) { for (auto &it : _listPoint.m_data) { // Build Segments - for (int32_t iii=0, jjj=it.size()-1; + for (size_t iii=0, jjj=it.size()-1; iii < it.size(); jjj = iii++) { addSegment(it[jjj], it[iii]); @@ -137,10 +137,10 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList& // . * * . * * * * * * * * * * * * * // * * // * * - for (int32_t idPevious=itListPoint.size()-1, idCurrent=0, idNext=1; - idCurrent < itListPoint.size(); + for (int64_t idPevious=itListPoint.size()-1, idCurrent=0, idNext=1; + idCurrent < int64_t(itListPoint.size()); idPevious = idCurrent++, idNext++) { - if (idNext == itListPoint.size()) { + if (idNext == int64_t(itListPoint.size())) { idNext = 0; } if ( itListPoint[idCurrent].m_type == esvg::render::Point::type::join @@ -149,7 +149,7 @@ void esvg::render::SegmentList::createSegmentListStroke(esvg::render::PointList& ESVG_ERROR("an error occure a previous ID is < 0.... "); continue; } - if (idNext >= itListPoint.size()) { + if (idNext >= int64_t(itListPoint.size())) { ESVG_ERROR("an error occure a next ID is >= nbPoint len .... "); continue; }