From 8f614d75fe9b1fdcb91384a1296c76514a06d70b Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 10 Mar 2019 11:33:35 +0100 Subject: Fixed a few compiler warnings on win32 --- qtools/qcstring.cpp | 6 +++--- qtools/qfile_win32.cpp | 4 ++-- src/docbookgen.cpp | 4 ++-- src/docbookvisitor.cpp | 2 +- src/util.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/qtools/qcstring.cpp b/qtools/qcstring.cpp index 77461b2..6a14d66 100644 --- a/qtools/qcstring.cpp +++ b/qtools/qcstring.cpp @@ -343,7 +343,7 @@ QCString QCString::simplifyWhiteSpace() const if ( to > first && *(to-1) == 0x20 ) to--; *to = '\0'; - result.resize( (int)((long)to - (long)result.data()) + 1 ); + result.resize( (int)(to - result.data()) + 1 ); return result; } @@ -571,7 +571,7 @@ int qstricmp( const char *str1, const char *str2 ) int res; uchar c; if ( !s1 || !s2 ) - return s1 == s2 ? 0 : (int)((long)s2 - (long)s1); + return s1 == s2 ? 0 : (int)(s2 - s1); for ( ; !(res = (c=tolower(*s1)) - tolower(*s2)); s1++, s2++ ) if ( !c ) // strings are equal break; @@ -585,7 +585,7 @@ int qstrnicmp( const char *str1, const char *str2, uint len ) int res; uchar c; if ( !s1 || !s2 ) - return (int)((long)s2 - (long)s1); + return (int)(s2 - s1); for ( ; len--; s1++, s2++ ) { if ( (res = (c=tolower(*s1)) - tolower(*s2)) ) return res; diff --git a/qtools/qfile_win32.cpp b/qtools/qfile_win32.cpp index a4ab013..e0b1d88 100644 --- a/qtools/qfile_win32.cpp +++ b/qtools/qfile_win32.cpp @@ -515,7 +515,7 @@ int QFile::readBlock( char *p, uint len ) setStatus(IO_ReadError); } } else { // buffered file - nread = fread( p, 1, len, fh ); + nread = (int)fread( p, 1, len, fh ); if ( (uint)nread != len ) { if ( ferror( fh ) || nread==0 ) setStatus(IO_ReadError); @@ -562,7 +562,7 @@ int QFile::writeBlock( const char *p, uint len ) if ( isRaw() ) // raw file nwritten = WRITE( fd, p, len ); else // buffered file - nwritten = fwrite( p, 1, len, fh ); + nwritten = (int)fwrite( p, 1, len, fh ); if ( nwritten != (int)len ) { // write error if ( errno == ENOSPC ) // disk is full setStatus( IO_ResourceError ); diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 011ef12..adf36b0 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -153,7 +153,7 @@ void DocbookCodeGenerator::writeCodeLink(const char *ref,const char *file, { Docbook_DB(("(writeCodeLink)\n")); writeDocbookLink(m_t,ref,file,anchor,name,tooltip); - m_col+=strlen(name); + m_col+=(int)strlen(name); } void DocbookCodeGenerator::writeCodeLinkLine(const char *ref,const char *file, const char *anchor,const char *name, @@ -164,7 +164,7 @@ void DocbookCodeGenerator::writeCodeLinkLine(const char *ref,const char *file, m_t << "_1l"; writeDocbookString(m_t,name); m_t << "\"/>"; - m_col+=strlen(name); + m_col+=(int)strlen(name); } void DocbookCodeGenerator::writeTooltip(const char *, const DocLinkInfo &, const char *, const char *, const SourceLinkInfo &, const SourceLinkInfo & diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 28f6229..64425c6 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -967,7 +967,7 @@ DB_VIS_C if (m_hide) return; m_t << "" << endl; m_t << " numColumns() << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl; - for (int i = 0; i numColumns(); i++) + for (uint i = 0; i numColumns(); i++) { // do something with colwidth based of cell width specification (be aware of possible colspan in the header)? m_t << " \n"; diff --git a/src/util.cpp b/src/util.cpp index 1c05423..f92df68 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1707,7 +1707,7 @@ QCString removeRedundantWhiteSpace(const QCString &s) // improve the performance of this function static char *growBuf = 0; static int growBufLen = 0; - if (s.length()*3>growBufLen) // For input character we produce at most 3 output characters, + if ((int)s.length()*3>growBufLen) // For input character we produce at most 3 output characters, { growBufLen = s.length()*3; growBuf = (char *)realloc(growBuf,growBufLen+1); // add 1 for 0-terminator -- cgit v0.12