From 71496d36e7d35bdd249b04f2b0bb51857e875be1 Mon Sep 17 00:00:00 2001 From: Thomas McGuire Date: Wed, 7 Oct 2009 13:42:43 +0000 Subject: [PATCH] warnings-- svn path=/branches/kdepim/enterprise/kdepim/; revision=1032288 --- distributionlistdialog.cpp | 9 +++-- encodingdetector.cpp | 81 -------------------------------------- headerstyle.cpp | 3 ++ keyresolver.cpp | 6 ++- khtmlparthtmlwriter.cpp | 2 +- kmcomposewin.cpp | 2 +- kmfolderdia.cpp | 4 +- kmfoldermaildir.cpp | 3 +- kmfoldermbox.cpp | 2 + kmfoldersearch.cpp | 1 + kmgroupware.cpp | 4 +- kmheaders.cpp | 13 +++--- kmmessage.cpp | 32 ++++++++------- kmsearchpattern.cpp | 2 +- 14 files changed, 50 insertions(+), 114 deletions(-) diff --git a/distributionlistdialog.cpp b/distributionlistdialog.cpp index 9c8d6fd2b..0ab3c0f80 100644 --- a/distributionlistdialog.cpp +++ b/distributionlistdialog.cpp @@ -244,11 +244,14 @@ void DistributionListDialog::slotUser1() // FIXME: Ask the user which resource to save to instead of the default bool saveError = true; KABC::Ticket *ticket = ab->requestSaveTicket( 0 /*default resource */ ); - if ( ticket ) - if ( ab->save( ticket ) ) + if ( ticket ) { + if ( ab->save( ticket ) ) { saveError = false; - else + } + else { ab->releaseSaveTicket( ticket ); + } + } if ( saveError ) kdWarning(5006) << k_funcinfo << " Couldn't save new addresses in the distribution list just created to the address book" << endl; diff --git a/encodingdetector.cpp b/encodingdetector.cpp index e5881d6f7..3ffc63d49 100644 --- a/encodingdetector.cpp +++ b/encodingdetector.cpp @@ -729,87 +729,6 @@ static QCString automaticDetectionForWesternEuropean( const unsigned char* ptr, return ""; } -// Other browsers allow comments in the head section, so we need to also. -// It's important not to look for tags inside the comments. -static void skipComment(const char *&ptr, const char *pEnd) -{ - const char *p = ptr; - // Allow ; other browsers do. - if (*p=='>') - { - p++; - } - else - { - while (p!=pEnd) - { - if (*p=='-') - { - // This is the real end of comment, "-->". - if (p[1]=='-' && p[2]=='>') - { - p += 3; - break; - } - // This is the incorrect end of comment that other browsers allow, "--!>". - if (p[1] == '-' && p[2] == '!' && p[3] == '>') - { - p += 4; - break; - } - } - p++; - } - } - ptr=p; -} - -// Returns the position of the encoding string. -static int findXMLEncoding(const QCString &str, int &encodingLength) -{ - int len = str.length(); - int pos = str.find("encoding"); - if (pos == -1) - return -1; - pos += 8; - - // Skip spaces and stray control characters. - while (pos=len || str[pos] != '=') - return -1; - ++pos; - - // Skip spaces and stray control characters. - while (pos= len) - return -1; - - // Skip quotation mark. - char quoteMark = str[pos]; - if (quoteMark != '"' && quoteMark != '\'') - return -1; - ++pos; - - // Find the trailing quotation mark. - int end=pos; - while (end=len) - return -1; - - encodingLength = end-pos; - return pos; -} - - bool EncodingDetector::errorsIfUtf8 (const char* data, int length) { if (d->m_codec->mibEnum()!=MibUtf8) diff --git a/headerstyle.cpp b/headerstyle.cpp index 212439604..1ed8b240c 100644 --- a/headerstyle.cpp +++ b/headerstyle.cpp @@ -118,6 +118,7 @@ namespace KMail { QString BriefHeaderStyle::format( const KMMessage * message, const HeaderStrategy * strategy, const QString & vCardName, bool printing, bool topLevel ) const { + Q_UNUSED( topLevel ); if ( !message ) return QString::null; if ( !strategy ) strategy = HeaderStrategy::brief(); @@ -216,6 +217,7 @@ namespace KMail { QString PlainHeaderStyle::format( const KMMessage * message, const HeaderStrategy * strategy, const QString & vCardName, bool printing, bool topLevel ) const { + Q_UNUSED( topLevel ); if ( !message ) return QString::null; if ( !strategy ) strategy = HeaderStrategy::rich(); @@ -416,6 +418,7 @@ namespace KMail { QString FancyHeaderStyle::format( const KMMessage * message, const HeaderStrategy * strategy, const QString & vCardName, bool printing, bool topLevel ) const { + Q_UNUSED( topLevel ); if ( !message ) return QString::null; if ( !strategy ) strategy = HeaderStrategy::rich(); diff --git a/keyresolver.cpp b/keyresolver.cpp index ba5fbf324..45b2f62e2 100644 --- a/keyresolver.cpp +++ b/keyresolver.cpp @@ -1056,9 +1056,10 @@ Kpgp::Result Kleo::KeyResolver::resolveAllKeys( bool& signingRequested, bool& en result = resolveEncryptionKeys( signingRequested ); if ( result != Kpgp::Ok ) return result; - if ( signingRequested ) - if ( encryptionRequested ) + if ( signingRequested ) { + if ( encryptionRequested ) { result = resolveSigningKeysForEncryption(); + } else { result = resolveSigningKeysForSigningOnly(); if ( result == Kpgp::Failure ) { @@ -1066,6 +1067,7 @@ Kpgp::Result Kleo::KeyResolver::resolveAllKeys( bool& signingRequested, bool& en return Kpgp::Ok; } } + } return result; } diff --git a/khtmlparthtmlwriter.cpp b/khtmlparthtmlwriter.cpp index 643d743c2..8f4b3b142 100644 --- a/khtmlparthtmlwriter.cpp +++ b/khtmlparthtmlwriter.cpp @@ -49,7 +49,7 @@ namespace KMail { KHtmlPartHtmlWriter::KHtmlPartHtmlWriter( KHTMLPart * part, QObject * parent, const char * name ) : QObject( parent, name ), HtmlWriter(), - mHtmlPart( part ), mState( Ended ), mHtmlTimer( 0, "mHtmlTimer" ) + mHtmlPart( part ), mHtmlTimer( 0, "mHtmlTimer" ), mState( Ended ) { assert( part ); connect( &mHtmlTimer, SIGNAL(timeout()), SLOT(slotWriteNextHtmlChunk()) ); diff --git a/kmcomposewin.cpp b/kmcomposewin.cpp index d252e60d2..a635d786d 100644 --- a/kmcomposewin.cpp +++ b/kmcomposewin.cpp @@ -4384,7 +4384,7 @@ void KMComposeWin::slotSendNow() { //---------------------------------------------------------------------------- bool KMComposeWin::checkRecipientNumber() const { - int thresHold = GlobalSettings::self()->recipientThreshold(); + uint thresHold = GlobalSettings::self()->recipientThreshold(); if ( mCheckForRecipients && GlobalSettings::self()->tooManyRecipients() && mRecipientsEditor->recipients().count() > thresHold ) { diff --git a/kmfolderdia.cpp b/kmfolderdia.cpp index 1ddc60941..26d51f712 100644 --- a/kmfolderdia.cpp +++ b/kmfolderdia.cpp @@ -663,11 +663,11 @@ bool FolderDiaGeneralTab::save() folder->setIconPaths( "", "" ); } } - if ( folder->useCustomIcons() && + if ( folder->useCustomIcons() && ( (( mNormalIconButton->icon() != folder->normalIconPath() ) && ( !mNormalIconButton->icon().isEmpty())) || (( mUnreadIconButton->icon() != folder->unreadIconPath() ) && - ( !mUnreadIconButton->icon().isEmpty())) ) { + ( !mUnreadIconButton->icon().isEmpty())) ) ) { folder->setIconPaths( mNormalIconButton->icon(), mUnreadIconButton->icon() ); } diff --git a/kmfoldermaildir.cpp b/kmfoldermaildir.cpp index f13bb6761..bb551c3e5 100644 --- a/kmfoldermaildir.cpp +++ b/kmfoldermaildir.cpp @@ -224,6 +224,7 @@ int KMFolderMaildir::create() //----------------------------------------------------------------------------- void KMFolderMaildir::reallyDoClose(const char* owner) { + Q_UNUSED( owner ); if (mAutoCreateIndex) { updateIndex(); @@ -743,7 +744,7 @@ void KMFolderMaildir::readFileHeaderIntern(const QString& dir, const QString& fi } // Is this a long header line? - if (inHeader && line[0] == '\t' || line[0] == ' ') + if (inHeader && ( line[0] == '\t' || line[0] == ' ' ) ) { int i = 0; while (line[i] == '\t' || line[i] == ' ') diff --git a/kmfoldermbox.cpp b/kmfoldermbox.cpp index 92f466a7c..518f219e2 100644 --- a/kmfoldermbox.cpp +++ b/kmfoldermbox.cpp @@ -94,6 +94,7 @@ KMFolderMbox::~KMFolderMbox() //----------------------------------------------------------------------------- int KMFolderMbox::open(const char *owner) { + Q_UNUSED( owner ); int rc = 0; mOpenCount++; @@ -258,6 +259,7 @@ int KMFolderMbox::create() //----------------------------------------------------------------------------- void KMFolderMbox::reallyDoClose(const char* owner) { + Q_UNUSED( owner ); if (mAutoCreateIndex) { if (KMFolderIndex::IndexOk != indexStatus()) { diff --git a/kmfoldersearch.cpp b/kmfoldersearch.cpp index 896383b42..4828bfcd0 100644 --- a/kmfoldersearch.cpp +++ b/kmfoldersearch.cpp @@ -547,6 +547,7 @@ void KMFolderSearch::sync() void KMFolderSearch::reallyDoClose(const char* owner) { + Q_UNUSED( owner ); if (mAutoCreateIndex) { if (mSearch) mSearch->write(location()); diff --git a/kmgroupware.cpp b/kmgroupware.cpp index ecc960eef..41ffdc525 100644 --- a/kmgroupware.cpp +++ b/kmgroupware.cpp @@ -55,8 +55,8 @@ bool vPartFoundAndDecoded( KMMessage* msg, QString& s ) s = QString::fromUtf8( msg->bodyDecoded() ); return true; } else if( DwMime::kTypeMultipart == msg->type() && - (DwMime::kSubtypeMixed == msg->subtype() ) || - (DwMime::kSubtypeAlternative == msg->subtype() )) + ( (DwMime::kSubtypeMixed == msg->subtype() ) || + (DwMime::kSubtypeAlternative == msg->subtype() ) )) { // kdDebug(5006) << "KMGroupware looking for TNEF data" << endl; DwBodyPart* dwPart = msg->findDwBodyPart( DwMime::kTypeApplication, diff --git a/kmheaders.cpp b/kmheaders.cpp index 19ea6f917..4ecc11ec6 100644 --- a/kmheaders.cpp +++ b/kmheaders.cpp @@ -1920,8 +1920,8 @@ void KMHeaders::findUnreadAux( HeaderItem*& item, if (!msgBase) continue; if (msgBase->isUnread() || msgBase->isNew()) foundUnreadMessage = true; - if (!onlyNew && (msgBase->isUnread() || msgBase->isNew()) - || onlyNew && msgBase->isNew()) + if ( ( !onlyNew && (msgBase->isUnread() || msgBase->isNew()) ) + || ( onlyNew && msgBase->isNew() ) ) lastUnread = newItem; if (newItem == item) break; newItem = static_cast(newItem->itemBelow()); @@ -1952,11 +1952,14 @@ int KMHeaders::findUnread(bool aDirNext, int aStartAt, bool onlyNew, bool accept if (!item) return -1; - if ( !acceptCurrent ) - if (aDirNext) + if ( !acceptCurrent ) { + if (aDirNext) { item = static_cast(item->itemBelow()); - else + } + else { item = static_cast(item->itemAbove()); + } + } } pitem = item; diff --git a/kmmessage.cpp b/kmmessage.cpp index 082c48517..80c9d9284 100644 --- a/kmmessage.cpp +++ b/kmmessage.cpp @@ -1364,25 +1364,27 @@ static const int numMdnMessageBoxes static int requestAdviceOnMDN( const char * what ) { - for ( int i = 0 ; i < numMdnMessageBoxes ; ++i ) - if ( !qstrcmp( what, mdnMessageBoxes[i].dontAskAgainID ) ) + for ( int i = 0 ; i < numMdnMessageBoxes ; ++i ) { + if ( !qstrcmp( what, mdnMessageBoxes[i].dontAskAgainID ) ) { if ( mdnMessageBoxes[i].canDeny ) { - const KCursorSaver saver( QCursor::ArrowCursor ); - int answer = QMessageBox::information( 0, - i18n("Message Disposition Notification Request"), - i18n( mdnMessageBoxes[i].text ), - i18n("&Ignore"), i18n("Send \"&denied\""), i18n("&Send") ); - return answer ? answer + 1 : 0 ; // map to "mode" in createMDN + const KCursorSaver saver( QCursor::ArrowCursor ); + int answer = QMessageBox::information( 0, + i18n("Message Disposition Notification Request"), + i18n( mdnMessageBoxes[i].text ), + i18n("&Ignore"), i18n("Send \"&denied\""), i18n("&Send") ); + return answer ? answer + 1 : 0 ; // map to "mode" in createMDN } else { - const KCursorSaver saver( QCursor::ArrowCursor ); - int answer = QMessageBox::information( 0, - i18n("Message Disposition Notification Request"), - i18n( mdnMessageBoxes[i].text ), - i18n("&Ignore"), i18n("&Send") ); - return answer ? answer + 2 : 0 ; // map to "mode" in createMDN + const KCursorSaver saver( QCursor::ArrowCursor ); + int answer = QMessageBox::information( 0, + i18n("Message Disposition Notification Request"), + i18n( mdnMessageBoxes[i].text ), + i18n("&Ignore"), i18n("&Send") ); + return answer ? answer + 2 : 0 ; // map to "mode" in createMDN } + } + } kdWarning(5006) << "didn't find data for message box \"" - << what << "\"" << endl; + << what << "\"" << endl; return 0; } diff --git a/kmsearchpattern.cpp b/kmsearchpattern.cpp index 1b9e36530..da1365e84 100644 --- a/kmsearchpattern.cpp +++ b/kmsearchpattern.cpp @@ -280,7 +280,7 @@ bool KMSearchRuleString::matches( const DwString & aStr, KMMessage & msg, start += headerLen; size_t stop = aStr.find( '\n', start ); char ch = '\0'; - while ( stop != DwString::npos && ( ch = aStr.at( stop + 1 ) ) == ' ' || ch == '\t' ) + while ( stop != DwString::npos && ( ( ch = aStr.at( stop + 1 ) ) == ' ' || ch == '\t' ) ) stop = aStr.find( '\n', stop + 1 ); const int len = stop == DwString::npos ? aStr.length() - start : stop - start ; const QCString codedValue( aStr.data() + start, len + 1 );