diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-03-02 19:10:51 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-03-08 13:31:54 (GMT) |
commit | 4658413ff3b9551fac67907f296a586e9f2c15ed (patch) | |
tree | 495ea78acb2a9d7463540f9e711530a0d42f3e72 /qtools | |
parent | 6c06e912338176303d1a1e041a39984ff6fd42be (diff) | |
download | Doxygen-4658413ff3b9551fac67907f296a586e9f2c15ed.zip Doxygen-4658413ff3b9551fac67907f296a586e9f2c15ed.tar.gz Doxygen-4658413ff3b9551fac67907f296a586e9f2c15ed.tar.bz2 |
Enabled stricter compiler warnings and fixed all new warnings
Diffstat (limited to 'qtools')
-rw-r--r-- | qtools/qasciidict.h | 2 | ||||
-rw-r--r-- | qtools/qcache.h | 2 | ||||
-rw-r--r-- | qtools/qcstring.h | 48 | ||||
-rw-r--r-- | qtools/qdatastream.cpp | 10 | ||||
-rw-r--r-- | qtools/qgstring.h | 2 | ||||
-rw-r--r-- | qtools/qintdict.h | 2 | ||||
-rw-r--r-- | qtools/qptrdict.h | 2 | ||||
-rw-r--r-- | qtools/qstring.h | 6 | ||||
-rw-r--r-- | qtools/qvaluelist.h | 4 |
9 files changed, 37 insertions, 41 deletions
diff --git a/qtools/qasciidict.h b/qtools/qasciidict.h index 29fcf2f..6a93a02 100644 --- a/qtools/qasciidict.h +++ b/qtools/qasciidict.h @@ -46,7 +46,7 @@ template<class type> class Q_EXPORT QAsciiDict : public QGDict { public: - QAsciiDict(int size=17, bool caseSensitive=TRUE, bool copyKeys=TRUE ) + QAsciiDict(uint size=17, bool caseSensitive=TRUE, bool copyKeys=TRUE ) : QGDict(size,AsciiKey,caseSensitive,copyKeys) {} QAsciiDict( const QAsciiDict<type> &d ) : QGDict(d) {} ~QAsciiDict() { clear(); } diff --git a/qtools/qcache.h b/qtools/qcache.h index 39d4f7a..87f9866 100644 --- a/qtools/qcache.h +++ b/qtools/qcache.h @@ -46,7 +46,7 @@ template<class type> class Q_EXPORT QCache : public QGCache { public: QCache( const QCache<type> &c ) : QGCache(c) {} - QCache( int maxCost=100, int size=17, bool caseSensitive=TRUE ) + QCache( int maxCost=100, uint size=17, bool caseSensitive=TRUE ) : QGCache( maxCost, size, AsciiKey, caseSensitive, TRUE ) {} ~QCache() { clear(); } QCache<type> &operator=( const QCache<type> &c ) diff --git a/qtools/qcstring.h b/qtools/qcstring.h index e1414b5..a527fec 100644 --- a/qtools/qcstring.h +++ b/qtools/qcstring.h @@ -149,7 +149,7 @@ public: /** creates a string with room for size characters * @param[in] size the number of character to allocate (including the 0-terminator) */ - explicit QCString( int size ) : m_rep(size) + explicit QCString( uint size ) : m_rep(size) { } @@ -269,7 +269,7 @@ public: bool stripPrefix(const char *prefix); QCString left( uint len ) const; QCString right( uint len ) const; - QCString mid( uint index, uint len=0xffffffff) const; + QCString mid( uint index, uint len=(uint)-1) const; QCString lower() const; QCString upper() const; QCString stripWhiteSpace() const; @@ -307,8 +307,8 @@ public: QCString &operator+=( const char *str ) { if (!str) return *this; - int len1 = length(); - int len2 = (int)strlen(str); + uint len1 = length(); + uint len2 = (uint)strlen(str); resize(len1+len2+1); memcpy(rawData()+len1,str,len2); return *this; @@ -317,7 +317,7 @@ public: /** Appends character \a c to this string and returns a reference to the result. */ QCString &operator+=( char c ) { - int len = length(); + uint len = length(); resize(len+2); rawData()[len]=c; return *this; @@ -361,7 +361,7 @@ public: // ref counting string header struct LSHeader { - int len; // length of string without 0 terminator + uint len; // length of string without 0 terminator int refCount; // -1=leaked, 0=one ref & non-cost, n>0, n+1 refs, const }; // ref counting string data and methods @@ -374,7 +374,7 @@ public: // creates a LSData item with room for size bytes (which includes the 0 terminator!) // if size is zero, an empty string will be created. - static LSData *create(int size) + static LSData *create(uint size) { LSData *data; data = (LSData*)malloc(sizeof(LSHeader)+size); @@ -403,7 +403,7 @@ public: else // need to make a copy { LSData *newData = LSData::create(size); - int len = d->len; + uint len = d->len; if (len>=size) len=size-1; memcpy(newData->toStr(),d->toStr(),len); newData->toStr()[len]=0; @@ -454,14 +454,14 @@ public: u = s.u; // avoid uninitialized warning from gcc } } - StringRep(int size) + StringRep(uint size) { u.s.isShort = size<=SHORT_STR_CAPACITY; if (size<=SHORT_STR_CAPACITY) // init short string { if (size>0) { - u.s.len = size-1; + u.s.len = (uchar)(size-1); u.s.str[size-1]='\0'; } else @@ -478,11 +478,11 @@ public: { if (str) { - int len = (int)strlen(str); + uint len = (uint)strlen(str); u.s.isShort = len<SHORT_STR_CAPACITY; if (len<SHORT_STR_CAPACITY) { - u.s.len = len; + u.s.len = (uchar)len; qstrncpy(u.s.str,str,SHORT_STR_CAPACITY); } else @@ -505,7 +505,7 @@ public: u.s.isShort = len<=SHORT_STR_MAX_LEN; if (u.s.isShort) { - u.s.len = len; + u.s.len = (uchar)len; memcpy(u.s.str,str,len); u.s.str[len]='\0'; } @@ -554,11 +554,11 @@ public: } if (str) { - int len = (int)strlen(str); + uint len = (uint)strlen(str); u.s.isShort = len<SHORT_STR_CAPACITY; if (len<SHORT_STR_CAPACITY) { - u.s.len = len; + u.s.len = (uchar)len; qstrncpy(u.s.str,str,SHORT_STR_CAPACITY); } else @@ -605,7 +605,7 @@ public: return u.l.d->len==0 ? 0 : u.l.d->toStr(); } } - char &at(int i) const + char &at(uint i) const { if (u.s.isShort) { @@ -622,7 +622,7 @@ public: { if (newlen>0) { - u.s.len = newlen-1; + u.s.len = (uchar)(newlen-1); u.s.str[newlen-1]='\0'; } else // string becomes empty @@ -668,21 +668,21 @@ public: } bool fill( char c, int len ) { - if (len<0) len=length(); + uint ulen = len<0 ? length() : (uint)len; if (!u.s.isShort) // detach from shared string { - resize(len+1); + resize(ulen+1); } - else if (len!=(int)length()) + else if (ulen!=length()) { - if (len>0) + if (ulen>0) { - resize(len+1); + resize(ulen+1); } } - if (len>0) + if (ulen>0) { - memset(rawData(),c,len); + memset(rawData(),c,ulen); } return TRUE; } diff --git a/qtools/qdatastream.cpp b/qtools/qdatastream.cpp index 5190b53..a2e5c3b 100644 --- a/qtools/qdatastream.cpp +++ b/qtools/qdatastream.cpp @@ -730,7 +730,7 @@ QDataStream &QDataStream::operator<<( Q_INT16 i ) if ( printable ) { // printable data char buf[16]; sprintf( buf, "%d\n", i ); - dev->writeBlock( buf, strlen(buf) ); + dev->writeBlock( buf, (int)strlen(buf) ); } else if ( noswap ) { // no conversion needed dev->writeBlock( (char *)&i, sizeof(Q_INT16) ); } else { // swap bytes @@ -761,7 +761,7 @@ QDataStream &QDataStream::operator<<( Q_INT32 i ) if ( printable ) { // printable data char buf[16]; sprintf( buf, "%d\n", i ); - dev->writeBlock( buf, strlen(buf) ); + dev->writeBlock( buf, (int)strlen(buf) ); } else if ( noswap ) { // no conversion needed dev->writeBlock( (char *)&i, sizeof(Q_INT32) ); } else { // swap bytes @@ -793,7 +793,7 @@ QDataStream &QDataStream::operator<<( Q_INT64 i ) if ( printable ) { // printable data char buf[20]; sprintf( buf, "%ld\n", i ); - dev->writeBlock( buf, strlen(buf) ); + dev->writeBlock( buf, (int)strlen(buf) ); } else if ( noswap ) { // no conversion needed dev->writeBlock( (char *)&i, sizeof(Q_INT64) ); } else { // swap bytes @@ -839,7 +839,7 @@ QDataStream &QDataStream::operator<<( float f ) if ( printable ) { // printable data char buf[32]; sprintf( buf, "%g\n", (double)f ); - dev->writeBlock( buf, strlen(buf) ); + dev->writeBlock( buf, (int)strlen(buf) ); } else { float g = f; // fixes float-on-stack problem if ( noswap ) { // no conversion needed @@ -869,7 +869,7 @@ QDataStream &QDataStream::operator<<( double f ) if ( printable ) { // printable data char buf[32]; sprintf( buf, "%g\n", f ); - dev->writeBlock( buf, strlen(buf) ); + dev->writeBlock( buf, (int)strlen(buf) ); } else if ( noswap ) { // no conversion needed dev->writeBlock( (char *)&f, sizeof(double) ); } else { // swap bytes diff --git a/qtools/qgstring.h b/qtools/qgstring.h index 6934c93..0af1045 100644 --- a/qtools/qgstring.h +++ b/qtools/qgstring.h @@ -43,7 +43,7 @@ class QGString bool truncate( uint pos ) { return resize(pos+1); } operator const char *() const { return (const char *)data(); } char &at( uint index ) const { return m_data[index]; } - char &operator[]( int i ) const { return at(i); } + char &operator[]( uint i ) const { return at(i); } private: char * m_data; diff --git a/qtools/qintdict.h b/qtools/qintdict.h index ddc5fdf..0606ec8 100644 --- a/qtools/qintdict.h +++ b/qtools/qintdict.h @@ -46,7 +46,7 @@ template<class type> class Q_EXPORT QIntDict : public QGDict { public: - QIntDict(int size=17) : QGDict(size,IntKey,0,0) {} + QIntDict(uint size=17) : QGDict(size,IntKey,0,0) {} QIntDict( const QIntDict<type> &d ) : QGDict(d) {} ~QIntDict() { clear(); } QIntDict<type> &operator=(const QIntDict<type> &d) diff --git a/qtools/qptrdict.h b/qtools/qptrdict.h index c075e30..df8bcb4 100644 --- a/qtools/qptrdict.h +++ b/qtools/qptrdict.h @@ -46,7 +46,7 @@ template<class type> class Q_EXPORT QPtrDict : public QGDict { public: - QPtrDict(int size=17) : QGDict(size,PtrKey,0,0) {} + QPtrDict(uint size=17) : QGDict(size,PtrKey,0,0) {} QPtrDict( const QPtrDict<type> &d ) : QGDict(d) {} ~QPtrDict() { clear(); } QPtrDict<type> &operator=(const QPtrDict<type> &d) diff --git a/qtools/qstring.h b/qtools/qstring.h index d459132..293768f 100644 --- a/qtools/qstring.h +++ b/qtools/qstring.h @@ -147,8 +147,8 @@ public: QString decomposition() const; Decomposition decompositionTag() const; - char latin1() const { return rw ? 0 : cl; } - ushort unicode() const { return (rw << 8) | cl; } + char latin1() const { return rw ? 0 : (char)cl; } + ushort unicode() const { return (ushort)((rw << 8) | cl); } #ifndef QT_NO_CAST_ASCII // like all ifdef'd code this is undocumented operator char() const { return latin1(); } @@ -333,7 +333,7 @@ struct Q_EXPORT QStringData : public QShared { QStringData() : unicode(0), ascii(0), len(0), maxl(0), dirtyascii(0) { ref(); } QStringData(QChar *u, uint l, uint m) : - unicode(u), ascii(0), len(l), maxl(m), dirtyascii(0) { } + unicode(u), ascii(0), len(l), maxl(m&0x3FFFFFFF), dirtyascii(0) { } ~QStringData() { if ( unicode ) delete[] ((char*)unicode); if ( ascii ) delete[] ascii; } diff --git a/qtools/qvaluelist.h b/qtools/qvaluelist.h index a1014ed..eb827fe 100644 --- a/qtools/qvaluelist.h +++ b/qtools/qvaluelist.h @@ -43,10 +43,6 @@ #include "qdatastream.h" #endif // QT_H -#if defined(_CC_MSVC_) -#pragma warning(disable:4284) // "return type for operator -> is not a UDT" -#endif - template <class T> class Q_EXPORT QValueListNode { |