From ebc26eae0723b89bd1dc0591d488704816bd6296 Mon Sep 17 00:00:00 2001 From: kawi Date: Fri, 9 Jan 2015 13:00:58 +0100 Subject: [PATCH] warnings --- base/ReStringList.cpp | 2 +- base/ReTestUnit.cpp | 4 ++-- os/ReDirTools.cpp | 11 ++++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/base/ReStringList.cpp b/base/ReStringList.cpp index 2f7ed6e..7c28aa0 100644 --- a/base/ReStringList.cpp +++ b/base/ReStringList.cpp @@ -362,7 +362,7 @@ int ReStringList::firstDiff(const ReStringList& toCompare) const{ int count1 = count(); int count2 = toCompare.count(); int maxIx = count1 > count2 ? count2 : count1; - for (size_t ix = 0; rc == -1 && ix < maxIx; ix++){ + for (size_t ix = 0; rc == -1 && (int) ix < maxIx; ix++){ if (sizeOf(ix) != toCompare.sizeOf(ix) || strcmp(strOf(ix), toCompare.strOf(ix)) != 0) rc = (int) ix; diff --git a/base/ReTestUnit.cpp b/base/ReTestUnit.cpp index 5076c6d..0c4180d 100644 --- a/base/ReTestUnit.cpp +++ b/base/ReTestUnit.cpp @@ -155,8 +155,8 @@ void ReTestUnit::assertEqualFiles(const char* name1, const char* name2, int line int ixLine = line1.firstDifference(list2.strOf(ix), list2.strLengthOf(ix)); logF(true, i18n("%s-%d: Files differ in line %d-%d\n%s\n%s\n%s"), m_sourceFile.str(), lineNo, ix, ixLine, - list1.count() > ix ? list1.strOf(ix) : "", - list2.count() > ix ? list2.strOf(ix) : "", + (int) list1.count() > ix ? list1.strOf(ix) : "", + (int) list2.count() > ix ? list2.strOf(ix) : "", colMarker(ixLine)); } diff --git a/os/ReDirTools.cpp b/os/ReDirTools.cpp index 6ac14d4..f364a31 100644 --- a/os/ReDirTools.cpp +++ b/os/ReDirTools.cpp @@ -133,10 +133,15 @@ void ReDirOptions::initCompoundUsage(size_t size){ */ void ReDirOptions::addCompoundUsage(const char** usage){ int start = 0; - while(m_compoundUsage[start] != NULL) - assert(++start < m_countCompoundUsage); + while(m_compoundUsage[start] != NULL){ + if (++start >= m_countCompoundUsage) + assert(false); + } for (int ix = 0; usage[ix] != NULL; ix++){ - assert(start + ix < m_countCompoundUsage); + if (start + ix > m_countCompoundUsage){ + assert(false); + break; + } m_compoundUsage[start + ix] = usage[ix]; } } -- 2.39.5