[Libreoffice-commits] libcdr.git: src/lib
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jan 29 08:11:31 UTC 2019
src/lib/CDRParser.cpp | 6 +++---
src/lib/CDRPath.cpp | 4 ++--
src/lib/CommonParser.cpp | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
New commits:
commit d89355ea031e2ecaa66a0c397bd043ab43051bbc
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jan 29 09:09:52 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Jan 29 09:09:52 2019 +0100
Fix too small loop variables
These loop variables had narrower type than the iteration's upper bound.
Change-Id: I5a2b4b41d52c931ab2de476b41957b30b22b0344
diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index e58fbca..6bd5dc9 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -1678,7 +1678,7 @@ void libcdr::CDRParser::readTrfd(librevenge::RVNGInputStream *input, unsigned le
if (numOfArgs > (length - startOfArgs) / 4) // avoid extra big allocation in case of a broken file
numOfArgs = (length - startOfArgs) / 4;
std::vector<unsigned> argOffsets(numOfArgs, 0);
- unsigned i = 0;
+ size_t i = 0;
input->seek(startPosition+startOfArgs, librevenge::RVNG_SEEK_SET);
while (i<numOfArgs)
argOffsets[i++] = readUnsigned(input);
@@ -2106,7 +2106,7 @@ void libcdr::CDRParser::readLoda(librevenge::RVNGInputStream *input, unsigned le
m_collector->collectSpline();
std::vector<unsigned> argOffsets(numOfArgs, 0);
std::vector<unsigned> argTypes(numOfArgs, 0);
- unsigned i = 0;
+ size_t i = 0;
input->seek(startPosition+startOfArgs, librevenge::RVNG_SEEK_SET);
while (i<numOfArgs)
argOffsets[i++] = readUnsigned(input);
@@ -3301,7 +3301,7 @@ void libcdr::CDRParser::readStyd(librevenge::RVNGInputStream *input)
style.m_parentId = readUnsigned(input);
std::vector<unsigned> argOffsets(numOfArgs, 0);
std::vector<unsigned> argTypes(numOfArgs, 0);
- unsigned i = 0;
+ size_t i = 0;
input->seek(startPosition+startOfArgs, librevenge::RVNG_SEEK_SET);
while (i<numOfArgs)
argOffsets[i++] = readUnsigned(input);
diff --git a/src/lib/CDRPath.cpp b/src/lib/CDRPath.cpp
index 7cff9cf..86ee10c 100644
--- a/src/lib/CDRPath.cpp
+++ b/src/lib/CDRPath.cpp
@@ -735,7 +735,7 @@ void CDRPath::writeOut(librevenge::RVNGString &path, librevenge::RVNGString &vie
double lastX = 0.0;
double lastY = 0.0;
- for (unsigned k = 0; k < vec.count(); ++k)
+ for (unsigned long k = 0; k < vec.count(); ++k)
{
if (!vec[k]["svg:x"] || !vec[k]["svg:y"])
continue;
@@ -798,7 +798,7 @@ void CDRPath::writeOut(librevenge::RVNGString &path, librevenge::RVNGString &vie
width = qy - py;
viewBox.sprintf("%i %i %i %i", 0, 0, (unsigned)(2540*(qx - px)), (unsigned)(2540*(qy - py)));
- for (unsigned i = 0; i < vec.count(); ++i)
+ for (unsigned long i = 0; i < vec.count(); ++i)
{
librevenge::RVNGString sElement;
if (vec[i]["librevenge:path-action"]->getStr() == "M")
diff --git a/src/lib/CommonParser.cpp b/src/lib/CommonParser.cpp
index 242b777..d604a39 100644
--- a/src/lib/CommonParser.cpp
+++ b/src/lib/CommonParser.cpp
@@ -80,7 +80,7 @@ void libcdr::CommonParser::processPath(const std::vector<std::pair<double, doubl
{
bool isClosedPath = false;
std::vector<std::pair<double, double> >tmpPoints;
- for (unsigned k=0; k<points.size(); k++)
+ for (size_t k=0; k<points.size(); k++)
{
const unsigned char &type = types[k];
if (type & 0x08)
More information about the Libreoffice-commits
mailing list