diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2012-09-30 13:51:29 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2012-09-30 13:51:29 (GMT) |
commit | ceb4115c7b941039411e1793e01239610ff112a2 (patch) | |
tree | d18c06222e0f84d6077b586e5633053a8bc09da8 /qtools | |
parent | f6d511e52eb55c5d5b980c4d226f2ea80b396095 (diff) | |
download | Doxygen-ceb4115c7b941039411e1793e01239610ff112a2.zip Doxygen-ceb4115c7b941039411e1793e01239610ff112a2.tar.gz Doxygen-ceb4115c7b941039411e1793e01239610ff112a2.tar.bz2 |
Release-1.8.2-20120930
Diffstat (limited to 'qtools')
-rw-r--r-- | qtools/qarray.h | 12 | ||||
-rw-r--r-- | qtools/qbuffer.cpp | 2 | ||||
-rw-r--r-- | qtools/qdatastream.cpp | 2 | ||||
-rw-r--r-- | qtools/qdir.cpp | 2 | ||||
-rw-r--r-- | qtools/qfile_unix.cpp | 12 | ||||
-rw-r--r-- | qtools/qfileinfo_unix.cpp | 6 | ||||
-rw-r--r-- | qtools/qregexp.cpp | 10 | ||||
-rw-r--r-- | qtools/qstring.cpp | 8 | ||||
-rw-r--r-- | qtools/qtextcodec.cpp | 8 | ||||
-rw-r--r-- | qtools/qtextstream.cpp | 8 | ||||
-rw-r--r-- | qtools/qthread_unix.cpp | 15 | ||||
-rw-r--r-- | qtools/qutfcodec.cpp | 6 |
12 files changed, 52 insertions, 39 deletions
diff --git a/qtools/qarray.h b/qtools/qarray.h index 90dcbb7..3d67fe9 100644 --- a/qtools/qarray.h +++ b/qtools/qarray.h @@ -55,19 +55,19 @@ protected: public: QArray() {} - QArray( int size ) : QGArray(size*sizeof(type)) {} + QArray( int size ) : QGArray(size*(int)sizeof(type)) {} QArray( const QArray<type> &a ) : QGArray(a) {} ~QArray() {} QArray<type> &operator=(const QArray<type> &a) { return (QArray<type>&)QGArray::assign(a); } type *data() const { return (type *)QGArray::data(); } uint nrefs() const { return QGArray::nrefs(); } - uint size() const { return QGArray::size()/sizeof(type); } + uint size() const { return QGArray::size()/(int)sizeof(type); } uint count() const { return size(); } bool isEmpty() const { return QGArray::size() == 0; } bool isNull() const { return QGArray::data() == 0; } - bool resize( uint size ) { return QGArray::resize(size*sizeof(type)); } - bool truncate( uint pos ) { return QGArray::resize(pos*sizeof(type)); } + bool resize( uint size ) { return QGArray::resize(size*(int)sizeof(type)); } + bool truncate( uint pos ) { return QGArray::resize(pos*(int)sizeof(type)); } bool fill( const type &d, int size = -1 ) { return QGArray::fill((char*)&d,size,sizeof(type) ); } void detach() { QGArray::detach(); } @@ -94,9 +94,9 @@ public: int bsearch( const type &d ) const { return QGArray::bsearch((const char*)&d,sizeof(type)); } type& operator[]( int i ) const - { return (type &)(*(type *)QGArray::at(i*sizeof(type))); } + { return (type &)(*(type *)QGArray::at(i*(int)sizeof(type))); } type& at( uint i ) const - { return (type &)(*(type *)QGArray::at(i*sizeof(type))); } + { return (type &)(*(type *)QGArray::at(i*(int)sizeof(type))); } operator const type*() const { return (const type *)QGArray::data(); } bool operator==( const QArray<type> &a ) const { return isEqual(a); } bool operator!=( const QArray<type> &a ) const { return !isEqual(a); } diff --git a/qtools/qbuffer.cpp b/qtools/qbuffer.cpp index beed0ba..f68ef54 100644 --- a/qtools/qbuffer.cpp +++ b/qtools/qbuffer.cpp @@ -375,7 +375,7 @@ int QBuffer::readLine( char *p, uint maxlen ) break; } *p = '\0'; - ioIndex = d - a.data(); + ioIndex = (int)(d - a.data()); return (uint)ioIndex - start; } diff --git a/qtools/qdatastream.cpp b/qtools/qdatastream.cpp index 7f63cbf..8505dd4 100644 --- a/qtools/qdatastream.cpp +++ b/qtools/qdatastream.cpp @@ -412,7 +412,7 @@ static Q_INT32 read_int_ascii( QDataStream *s ) n++; } buf[n] = '\0'; - return atol( buf ); + return (Q_INT32)atol( buf ); } diff --git a/qtools/qdir.cpp b/qtools/qdir.cpp index d0c1233..120abe7 100644 --- a/qtools/qdir.cpp +++ b/qtools/qdir.cpp @@ -1184,7 +1184,7 @@ int qt_cmp_si( const void *n1, const void *n2 ) if ( r == 0 ) { // Enforce an order - the order the items appear in the array - r = (char*)n1 - (char*)n2; + r = (int)((char*)n1 - (char*)n2); } if ( qt_cmp_si_sortSpec & QDir::Reversed ) diff --git a/qtools/qfile_unix.cpp b/qtools/qfile_unix.cpp index fa53d13..0422fb4 100644 --- a/qtools/qfile_unix.cpp +++ b/qtools/qfile_unix.cpp @@ -403,7 +403,7 @@ uint QFile::size() const } else { STAT( QFile::encodeName(fn), &st ); } - return st.st_size; + return (uint)st.st_size; } /*! @@ -500,13 +500,13 @@ int QFile::readBlock( char *p, uint len ) if ( nread < (int)len ) { if ( isRaw() ) { // raw file - nread += READ( fd, p, len-nread ); + nread += (int)READ( fd, p, len-nread ); if ( len && nread <= 0 ) { nread = 0; setStatus(IO_ReadError); } } else { // buffered file - nread += fread( p, 1, len-nread, fh ); + nread += (int)fread( p, 1, len-nread, fh ); if ( (uint)nread != len ) { if ( ferror( fh ) || nread==0 ) setStatus(IO_ReadError); @@ -552,9 +552,9 @@ int QFile::writeBlock( const char *p, uint len ) #endif int nwritten; // number of bytes written if ( isRaw() ) // raw file - nwritten = WRITE( fd, p, len ); + nwritten = (int)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 ); @@ -661,7 +661,7 @@ bool QFile::seek( int64 pos ) if (isOpen()) { // TODO: support 64 bit size - return fseek( fh, pos, SEEK_SET )!=-1; + return fseek( fh, (long)pos, SEEK_SET )!=-1; } return FALSE; } diff --git a/qtools/qfileinfo_unix.cpp b/qtools/qfileinfo_unix.cpp index 5a8fe04..f2b438c 100644 --- a/qtools/qfileinfo_unix.cpp +++ b/qtools/qfileinfo_unix.cpp @@ -124,7 +124,7 @@ QString QFileInfo::readLink() const char s[PATH_MAX+1]; if ( !isSymLink() ) return QString(); - int len = readlink( QFile::encodeName(fn).data(), s, PATH_MAX ); + int len = (int)readlink( QFile::encodeName(fn).data(), s, PATH_MAX ); if ( len >= 0 ) { s[len] = '\0'; r = QFile::decodeName(s); @@ -297,7 +297,7 @@ QDateTime QFileInfo::lastModified() const if ( !fic || !cache ) doStat(); if ( fic ) - dt.setTime_t( fic->st.st_mtime ); + dt.setTime_t( (uint)fic->st.st_mtime ); return dt; } @@ -316,7 +316,7 @@ QDateTime QFileInfo::lastRead() const if ( !fic || !cache ) doStat(); if ( fic ) - dt.setTime_t( fic->st.st_atime ); + dt.setTime_t( (uint)fic->st.st_atime ); return dt; } diff --git a/qtools/qregexp.cpp b/qtools/qregexp.cpp index 2b3770c..fcc8f11 100644 --- a/qtools/qregexp.cpp +++ b/qtools/qregexp.cpp @@ -525,7 +525,7 @@ static int matchstring( uint *rxd, const char *str, uint strlength, while ( p >= first_p ) { // go backwards int end = matchstring( d, p, pl, bol, cs ); if ( end >= 0 ) - return ( p - start ) + end; + return ( (int)(p - start) ) + end; if ( !p ) return -1; --p; @@ -587,7 +587,7 @@ static int matchstring( uint *rxd, const char *str, uint strlength, while ( p >= first_p ) { // go backwards int end = matchstring( d, p, pl, bol, cs ); if ( end >= 0 ) - return ( p - start ) + end; + return ( (int)(p - start) ) + end; if ( !p ) return -1; --p; @@ -600,7 +600,7 @@ static int matchstring( uint *rxd, const char *str, uint strlength, return -1; } } - return p - start; + return (int)(p - start); } @@ -1043,7 +1043,7 @@ void QRegExp::compile() error = PatSyntax; return; } - int ddiff = d - prev_d; + int ddiff = (int)(d - prev_d); if ( *p == '+' ) { // convert to Kleene closure if ( d + ddiff >= rxarray + maxlen ) { error = PatOverflow; // pattern too long @@ -1082,7 +1082,7 @@ void QRegExp::compile() } } GEN( END ); - int len = d - rxarray; + int len = (int)(d - rxarray); rxdata = new uint[ len ]; // copy from rxarray to rxdata CHECK_PTR( rxdata ); memcpy( rxdata, rxarray, len*sizeof(uint) ); diff --git a/qtools/qstring.cpp b/qtools/qstring.cpp index 889e936..11187f6 100644 --- a/qtools/qstring.cpp +++ b/qtools/qstring.cpp @@ -13535,7 +13535,7 @@ QString &QString::insert( uint index, const QChar* s, uint len ) uint olen = length(); int nlen = olen + len; - int df = s - d->unicode; // ### pointer subtraction, cast down to int + int df = (int)(s - d->unicode); // ### pointer subtraction, cast down to int if ( df >= 0 && (uint)df < d->maxl ) { // Part of me - take a copy. QChar *tmp = QT_ALLOC_QCHAR_VEC( len ); @@ -13679,7 +13679,7 @@ QString &QString::replace( uint index, uint len, const QChar* s, uint slen ) real_detach(); memcpy( d->unicode+index, s, len*sizeof(QChar) ); } else { - int df = s - d->unicode; // ### pointer subtraction, cast down to int + int df = (int)(s - d->unicode); // ### pointer subtraction, cast down to int if ( df >= 0 && (uint)df < d->maxl ) { // Part of me - take a copy. QChar *tmp = QT_ALLOC_QCHAR_VEC( slen ); @@ -15017,7 +15017,7 @@ QDataStream &operator<<( QDataStream &s, const QString &str ) if ( ub || s.version() < 3 ) { if ( QChar::networkOrdered() == (s.byteOrder()==QDataStream::BigEndian) ) { - s.writeBytes( ub, sizeof(QChar)*str.length() ); + s.writeBytes( ub, (int)sizeof(QChar)*str.length() ); } else { static const uint auto_size = 1024; char t[auto_size]; @@ -15034,7 +15034,7 @@ QDataStream &operator<<( QDataStream &s, const QString &str ) *c++ = ub[0]; ub+=sizeof(QChar); } - s.writeBytes( b, sizeof(QChar)*str.length() ); + s.writeBytes( b, (int)sizeof(QChar)*str.length() ); if ( str.length()*sizeof(QChar) > auto_size ) delete [] b; } diff --git a/qtools/qtextcodec.cpp b/qtools/qtextcodec.cpp index 4eb8ba5..bb8bff4 100644 --- a/qtools/qtextcodec.cpp +++ b/qtools/qtextcodec.cpp @@ -931,11 +931,11 @@ static int getByte(char* &cursor) int byte = 0; if ( *cursor ) { if ( cursor[1] == 'x' ) - byte = strtol(cursor+2,&cursor,16); + byte = (int)strtol(cursor+2,&cursor,16); else if ( cursor[1] == 'd' ) - byte = strtol(cursor+2,&cursor,10); + byte = (int)strtol(cursor+2,&cursor,10); else - byte = strtol(cursor+2,&cursor,8); + byte = (int)strtol(cursor+2,&cursor,8); } return byte&0xff; } @@ -1017,7 +1017,7 @@ public: cursor[2]>='0' && cursor[2]<='9' && cursor[3]>='0' && cursor[3]<='9') { - unicode = strtol(cursor+2,&cursor,16); + unicode = (int)strtol(cursor+2,&cursor,16); } else if (*cursor==esc) { diff --git a/qtools/qtextstream.cpp b/qtools/qtextstream.cpp index b12f86d..21b455e 100644 --- a/qtools/qtextstream.cpp +++ b/qtools/qtextstream.cpp @@ -308,7 +308,7 @@ bool QStringBuffer::open( int m ) s->truncate( 0 ); } if ( m & IO_Append ) { // append to end of buffer - ioIndex = s->length()*sizeof(QChar); + ioIndex = s->length()*(int)sizeof(QChar); } else { ioIndex = 0; } @@ -331,7 +331,7 @@ void QStringBuffer::flush() uint QStringBuffer::size() const { - return s ? s->length()*sizeof(QChar) : 0; + return s ? s->length()*(int)sizeof(QChar) : 0; } int QStringBuffer::at() const @@ -916,7 +916,7 @@ QTextStream &QTextStream::writeBlock( const char* p, uint len ) QChar *u = new QChar[len]; for (uint i=0; i<len; i++) u[i] = p[i]; - dev->writeBlock( (char*)u, len*sizeof(QChar) ); + dev->writeBlock( (char*)u, len*(int)sizeof(QChar) ); delete [] u; } else { for (uint i=0; i<len; i++) @@ -932,7 +932,7 @@ QTextStream &QTextStream::writeBlock( const QChar* p, uint len ) doUnicodeHeader = FALSE; ts_putc( QChar::byteOrderMark ); } - dev->writeBlock( (char*)p, sizeof(QChar)*len ); + dev->writeBlock( (char*)p, (int)sizeof(QChar)*len ); } else { for (uint i=0; i<len; i++) ts_putc( p[i] ); diff --git a/qtools/qthread_unix.cpp b/qtools/qthread_unix.cpp index 5a7b788..b536583 100644 --- a/qtools/qthread_unix.cpp +++ b/qtools/qthread_unix.cpp @@ -52,6 +52,7 @@ #include <sys/types.h> #include <sys/sysctl.h> #endif +#include <signal.h> #include <unistd.h> #include <stdio.h> @@ -118,6 +119,13 @@ void QThread::start() QMutexLocker locker(&d->mutex); if (d->running) return; + // Block the SIGINT signal. The threads will inherit the signal mask. + // This will avoid them catching SIGINT instead of this thread. + sigset_t sigset, oldset; + sigemptyset(&sigset); + sigaddset(&sigset, SIGINT); + pthread_sigmask(SIG_BLOCK, &sigset, &oldset); + d->running = TRUE; d->finished = FALSE; @@ -142,6 +150,11 @@ void QThread::start() d->finished = FALSE; d->thread_id = 0; } + else + { + // Restore the old signal mask only for this thread. + pthread_sigmask(SIG_SETMASK, &oldset, NULL); + } } void QThread::terminate() @@ -182,7 +195,7 @@ int QThread::idealThreadCount() int cores = -1; #if defined(_OS_MAC_) // Mac OS X - cores = MPProcessorsScheduled(); + cores = (int)MPProcessorsScheduled(); #elif defined(_OS_HPUX_) // HP-UX struct pst_dynamic psd; diff --git a/qtools/qutfcodec.cpp b/qtools/qutfcodec.cpp index b0caa76..c7094ad 100644 --- a/qtools/qutfcodec.cpp +++ b/qtools/qutfcodec.cpp @@ -65,7 +65,7 @@ QCString QUtf8Codec::fromUnicode(const QString& uc, int& len_in_out) const *cursor++ = 0x80 | (ch.cell()&0x3f); } } - len_in_out = cursor - (uchar*)rstr.data(); + len_in_out = (int)(cursor - (uchar*)rstr.data()); rstr.truncate(len_in_out); return rstr; } @@ -201,13 +201,13 @@ public: QCString fromUnicode(const QString& uc, int& len_in_out) { if ( headerdone ) { - len_in_out = uc.length()*sizeof(QChar); + len_in_out = uc.length()*(int)sizeof(QChar); QCString d(len_in_out); memcpy(d.data(),uc.unicode(),len_in_out); return d; } else { headerdone = TRUE; - len_in_out = (1+uc.length())*sizeof(QChar); + len_in_out = (1+uc.length())*(int)sizeof(QChar); QCString d(len_in_out); memcpy(d.data(),&QChar::byteOrderMark,sizeof(QChar)); memcpy(d.data()+sizeof(QChar),uc.unicode(),uc.length()*sizeof(QChar)); |