From 292e3c830032a4634f04c3095d6bfa272b65d712 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 21 Jan 2012 13:17:48 -0600 Subject: [PATCH] Fix a number of build warnings --- .../src/mk4storage/metakit/include/mk4.inl | 4 +- .../src/mk4storage/metakit/src/column.cpp | 16 +++-- .../backends/qgpgme/qgpgmecryptoconfig.cpp | 12 ++-- .../backends/qgpgme/qgpgmerefreshkeysjob.cpp | 9 ++- .../backends/qgpgme/qgpgmesignencryptjob.cpp | 4 +- certmanager/lib/ui/keyselectiondialog.cpp | 3 +- indexlib/mmap_manager.cpp | 6 +- libkmime/boolflags.cpp | 2 +- libkmime/kmime_charfreq.cpp | 4 +- libkmime/kmime_codec_qp.cpp | 14 ++--- libkpgp/kpgpbase.cpp | 63 +++++++++++++++---- libkpgp/kpgpbase2.cpp | 4 +- libksieve/parser/parser.cpp | 6 +- libtdenetwork/gpgmepp/callbacks.cpp | 6 +- 14 files changed, 107 insertions(+), 46 deletions(-) diff --git a/akregator/src/mk4storage/metakit/include/mk4.inl b/akregator/src/mk4storage/metakit/include/mk4.inl index 1c717a36..51236ffe 100644 --- a/akregator/src/mk4storage/metakit/include/mk4.inl +++ b/akregator/src/mk4storage/metakit/include/mk4.inl @@ -283,8 +283,8 @@ d4_inline bool operator!= (c4_Cursor a_, c4_Cursor b_) d4_inline bool operator< (c4_Cursor a_, c4_Cursor b_) { - return a_._seq < b_._seq || - a_._seq == b_._seq && a_._index < b_._index; + return (a_._seq < b_._seq) || + ((a_._seq == b_._seq) && (a_._index < b_._index)); } d4_inline bool operator> (c4_Cursor a_, c4_Cursor b_) diff --git a/akregator/src/mk4storage/metakit/src/column.cpp b/akregator/src/mk4storage/metakit/src/column.cpp index 2d191c64..2e8f24d1 100644 --- a/akregator/src/mk4storage/metakit/src/column.cpp +++ b/akregator/src/mk4storage/metakit/src/column.cpp @@ -428,17 +428,21 @@ void c4_Column::MoveGapTo(t4_i32 pos_) { d4_assert(pos_ <= _size); - if (_slack == 0) // if there is no real gap, then just move it + if (_slack == 0) { // if there is no real gap, then just move it _gap = pos_; - else if (_gap < pos_) // move the gap up, ie. some bytes down + } + else if (_gap < pos_) { // move the gap up, ie. some bytes down MoveGapUp(pos_); - else if (_gap > pos_) // move the gap down, ie. some bytes up + } + else if (_gap > pos_) { // move the gap down, ie. some bytes up if (_gap - pos_ > _size - _gap + fSegRest(pos_)) { RemoveGap(); // it's faster to get rid of the gap instead _gap = pos_; } - else // normal case, move some bytes up + else { // normal case, move some bytes up MoveGapDown(pos_); + } + } d4_assert(_gap == pos_); @@ -1201,11 +1205,11 @@ void c4_ColOfInts::SetAccessWidth(int bits_) ++l2bp1; bits_ >>= 1; } - d4_assert(0 <= l2bp1 && l2bp1 < 8); + d4_assert((0 <= l2bp1) && (l2bp1 < 8)); _currWidth = (1 << l2bp1) >> 1; - if (l2bp1 > 4 && (_mustFlip || Persist() != 0 && Strategy()._bytesFlipped)) + if (l2bp1 > 4 && (_mustFlip || ((Persist() != 0) && Strategy()._bytesFlipped))) l2bp1 += 3; // switch to the trailing entries for byte flipping // Metrowerks Codewarrior 11 is dumb, it requires the "&c4_ColOfInts::" diff --git a/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp b/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp index d083947e..053a8b92 100644 --- a/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp +++ b/certmanager/lib/backends/qgpgme/qgpgmecryptoconfig.cpp @@ -661,13 +661,17 @@ void QGpgMECryptoConfigEntry::resetToDefault() { mSet = false; mDirty = true; - if ( mFlags & GPGCONF_FLAG_DEFAULT ) + if ( mFlags & GPGCONF_FLAG_DEFAULT ) { mValue = mDefaultValue; - else if ( mArgType == ArgType_None ) - if ( isList() ) + } + else if ( mArgType == ArgType_None ) { + if ( isList() ) { mValue = 0U; - else + } + else { mValue = false; + } + } } void QGpgMECryptoConfigEntry::setBoolValue( bool b ) diff --git a/certmanager/lib/backends/qgpgme/qgpgmerefreshkeysjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmerefreshkeysjob.cpp index a17aca9e..16846b59 100644 --- a/certmanager/lib/backends/qgpgme/qgpgmerefreshkeysjob.cpp +++ b/certmanager/lib/backends/qgpgme/qgpgmerefreshkeysjob.cpp @@ -190,11 +190,14 @@ void Kleo::QGpgMERefreshKeysJob::slotProcessExited( KProcess * proc ) { if ( proc != mProcess ) return; - if ( !mError && !mPatternsToDo.empty() ) - if ( const GpgME::Error err = startAProcess() ) + if ( !mError && !mPatternsToDo.empty() ) { + if ( const GpgME::Error err = startAProcess() ) { mError = err; - else + } + else { return; + } + } emit done(); if ( !mError && diff --git a/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp b/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp index d5fa009d..1392afd5 100644 --- a/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp +++ b/certmanager/lib/backends/qgpgme/qgpgmesignencryptjob.cpp @@ -115,8 +115,8 @@ void Kleo::QGpgMESignEncryptJob::doOperationDoneEvent( const GpgME::Error & ) { } void Kleo::QGpgMESignEncryptJob::showErrorDialog( TQWidget * parent, const TQString & caption ) const { - if ( mResult.first.error() && !mResult.first.error().isCanceled() || - mResult.second.error() && !mResult.second.error().isCanceled() ) + if ( (mResult.first.error() && !mResult.first.error().isCanceled()) || + (mResult.second.error() && !mResult.second.error().isCanceled()) ) Kleo::MessageBox::error( parent, mResult.first, mResult.second, this, caption ); } diff --git a/certmanager/lib/ui/keyselectiondialog.cpp b/certmanager/lib/ui/keyselectiondialog.cpp index d88d80b3..640f2e96 100644 --- a/certmanager/lib/ui/keyselectiondialog.cpp +++ b/certmanager/lib/ui/keyselectiondialog.cpp @@ -86,13 +86,14 @@ static bool checkKeyUsage( const GpgME::Key & key, unsigned int keyUsage ) { if ( keyUsage & Kleo::KeySelectionDialog::ValidKeys ) { - if ( key.isInvalid() ) + if ( key.isInvalid() ) { if ( key.keyListMode() & GpgME::Context::Validate ) { kdDebug() << "key is invalid" << endl; return false; } else { kdDebug() << "key is invalid - ignoring" << endl; } + } if ( key.isExpired() ) { kdDebug() << "key is expired" << endl; return false; diff --git a/indexlib/mmap_manager.cpp b/indexlib/mmap_manager.cpp index 7f6b1929..3a4f14fc 100644 --- a/indexlib/mmap_manager.cpp +++ b/indexlib/mmap_manager.cpp @@ -75,7 +75,11 @@ void mmap_manager::resize( unsigned ns ) { unsigned old_size = size(); unmap(); ns = ( ns / pagesize_ + bool( ns % pagesize_ ) ) * pagesize_; - ftruncate( fd_, ns ); + if (ftruncate( fd_, ns ) < 0) { + // An error occurred + // FIXME + printf("Something went wrong in indexlib/mmap_manager.cpp\n"); + } map( ns ); logfile() << format( "Going to bzero from %s to %s)\n" ) % old_size % size(); memset( rw_base( old_size ), 0, size() - old_size ); diff --git a/libkmime/boolflags.cpp b/libkmime/boolflags.cpp index 981e4ecc..ad3388e5 100644 --- a/libkmime/boolflags.cpp +++ b/libkmime/boolflags.cpp @@ -51,7 +51,7 @@ bool BoolFlags::get(unsigned int i) n=0; } else { //second byte - p=(1 << i-8); + p=(1 << (i-8)); n=1; } diff --git a/libkmime/kmime_charfreq.cpp b/libkmime/kmime_charfreq.cpp index a75d7685..93413b80 100644 --- a/libkmime/kmime_charfreq.cpp +++ b/libkmime/kmime_charfreq.cpp @@ -84,9 +84,9 @@ void CharFreq::count( const char * it, size_t len ) { default: { uchar c = *it; - if ( c == '\t' || c >= ' ' && c <= '~' ) + if ( (c == '\t') || ((c >= ' ') && (c <= '~')) ) ++printable; - else if ( c == 127 || c < ' ' ) + else if ( (c == 127) || (c < ' ') ) ++CTL; else ++eightBit; diff --git a/libkmime/kmime_codec_qp.cpp b/libkmime/kmime_codec_qp.cpp index 7c579b6a..149b01f2 100644 --- a/libkmime/kmime_codec_qp.cpp +++ b/libkmime/kmime_codec_qp.cpp @@ -60,7 +60,7 @@ static inline uchar lowNibble( uchar ch ) { static inline bool keep( uchar ch ) { // no CTLs, except HT and not '?' - return !( ch < ' ' && ch != '\t' || ch == '?' ); + return !( ((ch < ' ') && (ch != '\t')) || (ch == '?') ); } // @@ -90,7 +90,7 @@ protected: mFinished(false) {} bool needsEncoding( uchar ch ) { - return ( ch > '~' || ch < ' ' && ch != '\t' || ch == '=' ); + return ( (ch > '~') || ((ch < ' ') && (ch != '\t')) || (ch == '=') ); } bool needsEncodingAtEOL( uchar ch ) { return ( ch == ' ' || ch == '\t' ); @@ -273,8 +273,8 @@ bool QuotedPrintableDecoder::decode( const char* & scursor, const char * const s // output mBadChar assert( mAccu == 0 ); if ( mBadChar ) { - if ( mBadChar >= '>' && mBadChar <= '~' || - mBadChar >= '!' && mBadChar <= '<' ) + if ( ((mBadChar >= '>') && (mBadChar <= '~')) || + ((mBadChar >= '!') && (mBadChar <= '<')) ) *dcursor++ = mBadChar; mBadChar = 0; } @@ -355,7 +355,7 @@ bool QuotedPrintableDecoder::decode( const char* & scursor, const char * const s mAccu = value << 4; } } else { // not mInsideHexChar - if ( ch <= '~' && ch >= ' ' || ch == '\t' ) { + if ( ((ch <= '~') && (ch >= ' ')) || (ch == '\t') ) { if ( ch == mEscapeChar ) { mInsideHexChar = true; } else if ( mTQEncoding && ch == '_' ) { @@ -481,8 +481,8 @@ void QuotedPrintableEncoder::createOutputBuffer( char* & dcursor, mCurrentLineLength = 0; } - if ( Never == mAccuNeedsEncoding || - AtBOL == mAccuNeedsEncoding && mCurrentLineLength != 0 ) { + if ( (Never == mAccuNeedsEncoding) || + ((AtBOL == mAccuNeedsEncoding) && (mCurrentLineLength != 0)) ) { write( mAccu, dcursor, dend ); mCurrentLineLength++; } else { diff --git a/libkpgp/kpgpbase.cpp b/libkpgp/kpgpbase.cpp index 591a9943..c8efdfa4 100644 --- a/libkpgp/kpgpbase.cpp +++ b/libkpgp/kpgpbase.cpp @@ -76,7 +76,11 @@ Base::run( const char *cmd, const char *passphrase, bool onlyReadFromPGP ) if(passphrase) { - pipe(ppass); + if (pipe(ppass) < 0) { + // An error occurred + // FIXME + printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); + } pass = fdopen(ppass[1], "w"); fwrite(passphrase, sizeof(char), strlen(passphrase), pass); @@ -104,9 +108,21 @@ Base::run( const char *cmd, const char *passphrase, bool onlyReadFromPGP ) error = ""; output = ""; - pipe(pin); - pipe(pout); - pipe(perr); + if (pipe(pin) < 0) { + // An error occurred + // FIXME + printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); + } + if (pipe(pout) < 0) { + // An error occurred + // FIXME + printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); + } + if (pipe(perr) < 0) { + // An error occurred + // FIXME + printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); + } TQApplication::flushX(); if(!(child_pid = fork())) @@ -241,8 +257,13 @@ Base::run( const char *cmd, const char *passphrase, bool onlyReadFromPGP ) } } } - else // if input.isEmpty() - write(pin[1], "\n", 1); + else { // if input.isEmpty() + if (write(pin[1], "\n", 1) < 0) { + // An error occurred + // FIXME + printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); + } + } //kdDebug(5100) << "All input was written to pin[1]" << endl; } close(pin[1]); @@ -398,7 +419,11 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG ) if(passphrase) { - pipe(ppass); + if (pipe(ppass) < 0) { + // An error occurred + // FIXME + printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); + } pass = fdopen(ppass[1], "w"); fwrite(passphrase, sizeof(char), strlen(passphrase), pass); @@ -418,9 +443,21 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG ) error = ""; output = ""; - pipe(pin); - pipe(pout); - pipe(perr); + if (pipe(pin) < 0) { + // An error occurred + // FIXME + printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); + } + if (pipe(pout) < 0) { + // An error occurred + // FIXME + printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); + } + if (pipe(perr) < 0) { + // An error occurred + // FIXME + printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); + } if( passphrase ) { if( mVersion >= "1.0.7" ) { @@ -617,7 +654,11 @@ Base::runGpg( const char *cmd, const char *passphrase, bool onlyReadFromGnuPG ) } } else { // if input.isEmpty() - write(pin[1], "\n", 1); + if (write(pin[1], "\n", 1) < 0) { + // An error occurred + // FIXME + printf("Something went wrong in libkpgp/kpgpbase.cpp\n"); + } //kdDebug(5100) << "All input was written to pin[1]" << endl; close (pin[1]); pin[1] = -1; diff --git a/libkpgp/kpgpbase2.cpp b/libkpgp/kpgpbase2.cpp index fdafa130..9427edaf 100644 --- a/libkpgp/kpgpbase2.cpp +++ b/libkpgp/kpgpbase2.cpp @@ -1031,8 +1031,8 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys ) // Example: // Key fingerprint = 47 30 7C 76 05 BF 5E FB 72 41 00 F2 7D 0B D0 49 - int pos2; - pos2 = pos + 18; +// int pos2; +// pos2 = pos + 18; TQCString fingerprint = output.mid( pos, index2-pos ); // remove white space from the fingerprint for ( int idx = 0 ; (idx = fingerprint.find(' ', idx)) >= 0 ; ) diff --git a/libksieve/parser/parser.cpp b/libksieve/parser/parser.cpp index e823ac3f..c0459975 100644 --- a/libksieve/parser/parser.cpp +++ b/libksieve/parser/parser.cpp @@ -129,9 +129,9 @@ namespace KSieve { bool Parser::Impl::isArgumentToken() const { return isStringToken() || - token() == Lexer::Number || - token() == Lexer::Tag || - token() == Lexer::Special && mTokenValue == "[" ; + (token() == Lexer::Number) || + (token() == Lexer::Tag) || + ((token() == Lexer::Special) && (mTokenValue == "[")) ; } bool Parser::Impl::obtainToken() { diff --git a/libtdenetwork/gpgmepp/callbacks.cpp b/libtdenetwork/gpgmepp/callbacks.cpp index b352515d..ba9c30bf 100644 --- a/libtdenetwork/gpgmepp/callbacks.cpp +++ b/libtdenetwork/gpgmepp/callbacks.cpp @@ -83,7 +83,11 @@ gpgme_error_t passphrase_callback( void * opaque, const char * uid_hint, const c if ( passphrase && *passphrase ) wipe( passphrase, strlen( passphrase ) ); free( passphrase ); - write( fd, "\n", 1 ); + if (write( fd, "\n", 1 ) < 0) { + // An error occurred during write + // FIXME + printf("Something went wrong in libtdenetwork/gpgmepp/callbacks.cpp\n"); + } return err; }