[Libreoffice-commits] libvisio.git: src/lib

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 31 09:17:15 UTC 2019


 src/lib/VSDCharacterList.cpp    |    2 +-
 src/lib/VSDContentCollector.cpp |   10 +++++-----
 src/lib/VSDParagraphList.cpp    |    2 +-
 src/lib/VSDParser.cpp           |   14 +++++++-------
 4 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit c5a43cf0bb3d002cc4ff396ffbf85ebe9dd0da29
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jan 31 10:16:48 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Jan 31 10:16:49 2019 +0100

    Fix too small loop variables
    
    These loop variables had narrower type than the iteration's upper bound.
    
    Change-Id: Ie289e2fd5b11e3b654fc2e214e8f03dadee6fc65

diff --git a/src/lib/VSDCharacterList.cpp b/src/lib/VSDCharacterList.cpp
index 17935fc..b739f24 100644
--- a/src/lib/VSDCharacterList.cpp
+++ b/src/lib/VSDCharacterList.cpp
@@ -171,7 +171,7 @@ void libvisio::VSDCharacterList::handle(VSDCollector *collector) const
     return;
   if (!m_elementsOrder.empty())
   {
-    for (unsigned i = 0; i < m_elementsOrder.size(); i++)
+    for (size_t i = 0; i < m_elementsOrder.size(); i++)
     {
       auto iter = m_elements.find(m_elementsOrder[i]);
       if (iter != m_elements.end() && (0 == i || iter->second->getCharCount()))
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 8b297da..27b7195 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -495,7 +495,7 @@ void libvisio::VSDContentCollector::_convertToPath(const std::vector<librevenge:
     double prevY = segmentVector[0]["svg:y"] ? segmentVector[0]["svg:y"]->getDouble() : 0.0;
     unsigned moveIndex = 0;
     std::vector<librevenge::RVNGPropertyList> tmpSegment;
-    for (unsigned i = 0; i < segmentVector.size(); ++i)
+    for (size_t i = 0; i < segmentVector.size(); ++i)
     {
       if (segmentVector[i]["librevenge:path-action"] && segmentVector[i]["librevenge:path-action"]->getStr() == "M")
       {
@@ -2071,7 +2071,7 @@ void libvisio::VSDContentCollector::_generatePolylineFromNURBS(unsigned degree,
   if (!m_noLine)
     m_currentLineGeometry.reserve(VSD_NUM_POLYLINES_PER_KNOT * knotVector.size());
 
-  for (unsigned i = 0; i < VSD_NUM_POLYLINES_PER_KNOT * knotVector.size(); i++)
+  for (size_t i = 0; i < VSD_NUM_POLYLINES_PER_KNOT * knotVector.size(); i++)
   {
     librevenge::RVNGPropertyList node;
 
@@ -2246,7 +2246,7 @@ void libvisio::VSDContentCollector::collectPolylineTo(unsigned /* id */, unsigne
 
   librevenge::RVNGPropertyList polyline;
   std::vector<std::pair<double, double> > tmpPoints(points);
-  for (unsigned i = 0; i< points.size(); i++)
+  for (size_t i = 0; i< points.size(); i++)
   {
     polyline.clear();
     if (xType == 0)
@@ -2597,7 +2597,7 @@ void libvisio::VSDContentCollector::collectShape(unsigned id, unsigned level, un
       m_txtxform.reset(new XForm(*(m_stencilShape->m_txtxform)));
 
     m_stencilFields = m_stencilShape->m_fields;
-    for (unsigned i = 0; i < m_stencilFields.size(); i++)
+    for (size_t i = 0; i < m_stencilFields.size(); i++)
     {
       VSDFieldListElement *elem = m_stencilFields.getElement(i);
       if (elem)
@@ -2681,7 +2681,7 @@ void libvisio::VSDContentCollector::collectSplineEnd()
   }
   m_splineKnotVector.push_back(m_splineLastKnot);
   std::vector<double> weights(m_splineControlPoints.size()+2);
-  for (unsigned i=0; i < m_splineControlPoints.size()+2; i++)
+  for (size_t i=0; i < m_splineControlPoints.size()+2; i++)
     weights[i] = 1.0;
   collectNURBSTo(0, m_splineLevel, m_splineX, m_splineY, 1, 1, m_splineDegree, m_splineControlPoints, m_splineKnotVector, weights);
   m_splineKnotVector.clear();
diff --git a/src/lib/VSDParagraphList.cpp b/src/lib/VSDParagraphList.cpp
index 33f75fa..bfa8dd5 100644
--- a/src/lib/VSDParagraphList.cpp
+++ b/src/lib/VSDParagraphList.cpp
@@ -173,7 +173,7 @@ void libvisio::VSDParagraphList::handle(VSDCollector *collector) const
     return;
   if (!m_elementsOrder.empty())
   {
-    for (unsigned i = 0; i < m_elementsOrder.size(); i++)
+    for (size_t i = 0; i < m_elementsOrder.size(); i++)
     {
       auto iter = m_elements.find(m_elementsOrder[i]);
       if (iter != m_elements.end() && (0 == i || iter->second->getCharCount()))
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index c967165..71b56ce 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -939,7 +939,7 @@ void libvisio::VSDParser::readGeomList(librevenge::RVNGInputStream *input)
     if (childrenListLength > getRemainingLength(input))
       childrenListLength = getRemainingLength(input);
     geometryOrder.reserve(childrenListLength / sizeof(uint32_t));
-    for (unsigned i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
+    for (size_t i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
       geometryOrder.push_back(readU32(input));
 
     if (m_currentGeometryList)
@@ -966,7 +966,7 @@ void libvisio::VSDParser::readCharList(librevenge::RVNGInputStream *input)
       childrenListLength = getRemainingLength(input);
     std::vector<unsigned> characterOrder;
     characterOrder.reserve(childrenListLength / sizeof(uint32_t));
-    for (unsigned i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
+    for (size_t i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
       characterOrder.push_back(readU32(input));
 
     m_shape.m_charList.setElementsOrder(characterOrder);
@@ -988,7 +988,7 @@ void libvisio::VSDParser::readParaList(librevenge::RVNGInputStream *input)
       childrenListLength = getRemainingLength(input);
     std::vector<unsigned> paragraphOrder;
     paragraphOrder.reserve(childrenListLength / sizeof(uint32_t));
-    for (unsigned i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
+    for (size_t i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
       paragraphOrder.push_back(readU32(input));
 
     m_shape.m_paraList.setElementsOrder(paragraphOrder);
@@ -1014,7 +1014,7 @@ void libvisio::VSDParser::readTabsDataList(librevenge::RVNGInputStream *input)
       childrenListLength = getRemainingLength(input);
     std::vector<unsigned> tabsOrder;
     tabsOrder.reserve(childrenListLength / sizeof(uint32_t));
-    for (unsigned i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
+    for (size_t i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
       tabsOrder.push_back(readU32(input));
   }
 }
@@ -1034,7 +1034,7 @@ void libvisio::VSDParser::readLayerList(librevenge::RVNGInputStream *input)
       childrenListLength = getRemainingLength(input);
     std::vector<unsigned> layerOrder;
     layerOrder.reserve(childrenListLength / sizeof(uint32_t));
-    for (unsigned i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
+    for (size_t i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
       layerOrder.push_back(readU32(input));
   }
 }
@@ -1207,7 +1207,7 @@ void libvisio::VSDParser::readShapeList(librevenge::RVNGInputStream *input)
       childrenListLength = getRemainingLength(input);
     std::vector<unsigned> shapeOrder;
     shapeOrder.reserve(childrenListLength / sizeof(uint32_t));
-    for (unsigned i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
+    for (size_t i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
       shapeOrder.push_back(readU32(input));
 
     if (!m_isShapeStarted)
@@ -1722,7 +1722,7 @@ void libvisio::VSDParser::readFieldList(librevenge::RVNGInputStream *input)
       childrenListLength = getRemainingLength(input);
     std::vector<unsigned> fieldOrder;
     fieldOrder.reserve(childrenListLength / sizeof(uint32_t));
-    for (unsigned i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
+    for (size_t i = 0; i < (childrenListLength / sizeof(uint32_t)); i++)
       fieldOrder.push_back(readU32(input));
 
     m_shape.m_fields.setElementsOrder(fieldOrder);


More information about the Libreoffice-commits mailing list