From 9136e8c664bc4b0706a9cf419c76b2277b87f4a1 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 6 Mar 2021 13:23:15 +0100 Subject: Correction compilation warnings (#8398) Correction warnings (64-bit windows) like: warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data - context.cpp also making test a bit better readable Co-authored-by: Dimitri van Heesch --- src/context.cpp | 6 +++--- src/docsets.cpp | 2 +- src/pre.l | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/context.cpp b/src/context.cpp index 46249f5..f4614dd 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -136,11 +136,11 @@ class GenericConstIterator : public TemplateListIntf::ConstIterator } void toLast() { - m_index=(int)m_list.size()-1; + m_index=static_cast(m_list.size())-1; } void toNext() { - if (m_index(m_list.size())) ++m_index; + if (m_index < static_cast(m_list.size())) ++m_index; } void toPrev() { @@ -148,7 +148,7 @@ class GenericConstIterator : public TemplateListIntf::ConstIterator } bool current(TemplateVariant &v) const { - if (m_index>=0 && m_index(m_list.size())) + if (m_index>=0 && m_index < static_cast(m_list.size())) { v = m_list[m_index]; return true; diff --git a/src/docsets.cpp b/src/docsets.cpp index 7cb5d31..f7c8c18 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -201,7 +201,7 @@ void DocSets::finalize() QCString DocSets::Private::indent() { QCString result; - result.fill(' ',((int)indentStack.size()+2)*2); + result.fill(' ',static_cast(indentStack.size()+2)*2); return result; } diff --git a/src/pre.l b/src/pre.l index b14c479..b153942 100644 --- a/src/pre.l +++ b/src/pre.l @@ -1996,7 +1996,7 @@ static void processConcatOperators(QCString &expr) size_t n = match.position(); size_t l = match.length(); //printf("Match: '%s'\n",expr.data()+i); - if (n+l+1(n+l)]=='@' && expr[static_cast(n+l+1)]=='-') { // remove no-rescan marker after ID l+=2; @@ -2004,7 +2004,7 @@ static void processConcatOperators(QCString &expr) //printf("found '%s'\n",expr.mid(n,l).data()); // remove the ## operator and the surrounding whitespace e=e.substr(0,n)+e.substr(n+l); - int k=n-1; + int k=static_cast(n)-1; while (k>=0 && isId(e[k])) k--; if (k>0 && e[k]=='-' && e[k-1]=='@') { @@ -3322,7 +3322,7 @@ static void initPredefined(yyscan_t yyscanner,const char *fileName) } else // simple define with argument { - int ine=i_equals - (nonRecursive ? 1 : 0); + int ine=static_cast(i_equals) - (nonRecursive ? 1 : 0); def.name = ds.substr(0,ine); def.definition = ds.substr(i_equals+1); } -- cgit v0.12