1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

Fix all the warnings! Almost.. in our own code...

This commit is contained in:
Dominik Schmidt
2012-11-15 17:00:01 +01:00
parent 82113c516f
commit 1e6e3a2cdd
31 changed files with 49 additions and 51 deletions

View File

@@ -40,7 +40,7 @@ ENDIF()
IF( WITH_BREAKPAD ) IF( WITH_BREAKPAD )
message(STATUS "Build with support for breakpad.") message(STATUS "Build with support for breakpad.")
IF( CMAKE_COMPILER_IS_GNUCXX ) IF( CMAKE_COMPILER_IS_GNUCXX )
ADD_DEFINITIONS( -DSTDC_HEADERS -std=gnu++98 ) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTDC_HEADERS -std=gnu++98" )
ENDIF() ENDIF()
ENDIF() ENDIF()

View File

@@ -105,18 +105,11 @@ INCLUDE_DIRECTORIES(
. .
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
audio
database
playlist
network
sourcetree sourcetree
topbar
libtomahawk libtomahawk
mac mac
${THIRDPARTY_DIR}/qxt/qxtweb-standalone/qxtweb ${THIRDPARTY_DIR}/qxt/qxtweb-standalone/qxtweb
${THIRDPARTY_DIR}/qtweetlib/qtweetlib/src
${THIRDPARTY_DIR}/qtweetlib/tomahawk-custom
${THIRDPARTY_DIR}/breakpad ${THIRDPARTY_DIR}/breakpad
${TAGLIB_INCLUDES} ${TAGLIB_INCLUDES}

View File

@@ -741,7 +741,9 @@ TomahawkApp::notify( QObject *receiver, QEvent *e )
catch ( const std::exception& e ) catch ( const std::exception& e )
{ {
qWarning( "TomahawkApp::notify caught a std exception in a Qt event handler: " ); qWarning( "TomahawkApp::notify caught a std exception in a Qt event handler: " );
qFatal( e.what() );
// the second parameter surpresses a format-security warning
qFatal( e.what(), "" );
} }
catch ( ... ) catch ( ... )
{ {

View File

@@ -456,12 +456,6 @@ XmppSipPlugin::sendMsg( const QString& to, const SipInfo& info )
} }
void
XmppSipPlugin::broadcastMsg( const QString& msg )
{
}
void void
XmppSipPlugin::addContact( const QString& jid, const QString& msg ) XmppSipPlugin::addContact( const QString& jid, const QString& msg )
{ {

View File

@@ -91,7 +91,6 @@ public slots:
virtual void sendMsg( const QString& peerId, const SipInfo& info ); virtual void sendMsg( const QString& peerId, const SipInfo& info );
virtual void addContact( const QString& peerId, const QString& msg = QString() ); virtual void addContact( const QString& peerId, const QString& msg = QString() );
void broadcastMsg( const QString& msg );
void showAddFriendDialog(); void showAddFriendDialog();
void publishTune( const QUrl& url, const Tomahawk::InfoSystem::InfoStringHash& trackInfo ); void publishTune( const QUrl& url, const Tomahawk::InfoSystem::InfoStringHash& trackInfo );

View File

@@ -64,7 +64,7 @@ public slots:
void advertise(); void advertise();
void sendMsg( const QString& peerId , const SipInfo& ) {} void sendMsg( const QString&, const SipInfo& ) {}
void broadcastMsg( const QString & ) {} void broadcastMsg( const QString & ) {}
void addContact( const QString &, const QString& ) {} void addContact( const QString &, const QString& ) {}

View File

@@ -13,7 +13,7 @@ QT4_WRAP_UI( crashreporter_UI_HEADERS ${crashreporter_UI} )
QT4_ADD_RESOURCES( crashreporter_RC_RCC ${crashreporter_RC} ) QT4_ADD_RESOURCES( crashreporter_RC_RCC ${crashreporter_RC} )
INCLUDE( ${QT_USE_FILE} ) INCLUDE( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src ../../libtomahawk ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ../../libtomahawk )
ADD_DEFINITIONS( ${QT_DEFINITIONS} ) ADD_DEFINITIONS( ${QT_DEFINITIONS} )
ADD_EXECUTABLE( tomahawk_crash_reporter WIN32 ${crashreporter_SOURCES} ${crashreporter_HEADERS_MOC} ${crashreporter_UI_HEADERS} ${crashreporter_RC_RCC} ) ADD_EXECUTABLE( tomahawk_crash_reporter WIN32 ${crashreporter_SOURCES} ${crashreporter_HEADERS_MOC} ${crashreporter_UI_HEADERS} ${crashreporter_RC_RCC} )

View File

@@ -108,7 +108,7 @@ bool
AlbumPlaylistInterface::setCurrentTrack( unsigned int albumpos ) AlbumPlaylistInterface::setCurrentTrack( unsigned int albumpos )
{ {
albumpos--; albumpos--;
if ( albumpos >= m_queries.count() ) if ( ( int ) albumpos >= m_queries.count() )
return false; return false;
m_currentTrack = albumpos; m_currentTrack = albumpos;

View File

@@ -303,6 +303,8 @@ AtticaManager::resolverData(const QString &atticaId) const
void void
AtticaManager::providerError( QNetworkReply::NetworkError err ) AtticaManager::providerError( QNetworkReply::NetworkError err )
{ {
Q_UNUSED( err );
// So those who care know // So those who care know
emit resolversLoaded( Content::List() ); emit resolversLoaded( Content::List() );
} }

View File

@@ -172,6 +172,7 @@ set( libSources
Album.cpp Album.cpp
AlbumPlaylistInterface.cpp AlbumPlaylistInterface.cpp
Collection.cpp Collection.cpp
CountryUtils.cpp
FuncTimeout.cpp FuncTimeout.cpp
Playlist.cpp Playlist.cpp
PlaylistPlaylistInterface.cpp PlaylistPlaylistInterface.cpp

View File

@@ -19,6 +19,8 @@
#ifndef CHARTSPLUGIN_DATA_P_H #ifndef CHARTSPLUGIN_DATA_P_H
#define CHARTSPLUGIN_DATA_P_H #define CHARTSPLUGIN_DATA_P_H
#include "DllMacro.h"
#include <QtCore/qchar.h> #include <QtCore/qchar.h>
#include <QLocale> #include <QLocale>
@@ -777,27 +779,7 @@ static const quint16 country_name_index[] = {
}; };
// Assumes that code is a 2 letter code // Assumes that code is a 2 letter code
static QString fullCountryFromCode(const QString& countryCode) DLLEXPORT QString fullCountryFromCode(const QString& countryCode);
{
ushort uc1 = countryCode[0].toUpper().unicode();
ushort uc2 = countryCode[1].toUpper().unicode();
ushort uc3 = QChar('\0').unicode(); // No, not dealign with LatinAmericaAndTheCaribbean for convenience
const unsigned char *c = country_code_list;
for (; *c != 0; c += 3) {
if (uc1 == c[0] && uc2 == c[1] && uc3 == c[2])
{
uint country = (uint)((c - country_code_list)/3);
if (country > uint(QLocale::LastCountry))
return QLatin1String("Unknown");
return QString(country_name_list + country_name_index[country]);
}
}
return QString("Unknown");
}
} }
} }

View File

@@ -850,6 +850,7 @@ DropJob::removeRemoteSources()
QList< query_ptr > QList< query_ptr >
DropJob::getArtist( const QString &artist, Tomahawk::ModelMode mode ) DropJob::getArtist( const QString &artist, Tomahawk::ModelMode mode )
{ {
Q_UNUSED( mode );
artist_ptr artistPtr = Artist::get( artist ); artist_ptr artistPtr = Artist::get( artist );
if ( artistPtr->playlistInterface( Mixed )->tracks().isEmpty() ) if ( artistPtr->playlistInterface( Mixed )->tracks().isEmpty() )
{ {

View File

@@ -51,7 +51,7 @@ SourceList::SourceList( QObject* parent )
const source_ptr& const source_ptr&
SourceList::getLocal() SourceList::getLocal() const
{ {
return m_local; return m_local;
} }

View File

@@ -39,7 +39,7 @@ public:
bool isReady() const { return m_isReady; } bool isReady() const { return m_isReady; }
const Tomahawk::source_ptr& getLocal(); const Tomahawk::source_ptr& getLocal() const;
void setLocal( const Tomahawk::source_ptr& localSrc ); void setLocal( const Tomahawk::source_ptr& localSrc );
void setWebSource( const Tomahawk::source_ptr& websrc ); void setWebSource( const Tomahawk::source_ptr& websrc );

View File

@@ -122,6 +122,7 @@ SpotifyInfoPlugin::notInCacheSlot( InfoStringHash criteria, InfoRequestData requ
void void
SpotifyInfoPlugin::albumListingResult( const QString& msgType, const QVariantMap& msg, const QVariant& extraData ) SpotifyInfoPlugin::albumListingResult( const QString& msgType, const QVariantMap& msg, const QVariant& extraData )
{ {
Q_UNUSED( msgType );
Q_ASSERT( msg.contains( "qid" ) ); Q_ASSERT( msg.contains( "qid" ) );
Q_ASSERT( extraData.canConvert< InfoRequestData >() ); Q_ASSERT( extraData.canConvert< InfoRequestData >() );

View File

@@ -83,8 +83,8 @@ SpotifyPlaylistUpdater::SpotifyPlaylistUpdater( SpotifyAccount* acct, const QStr
, m_spotifyId( spotifyId ) , m_spotifyId( spotifyId )
, m_blockUpdatesForNextRevision( false ) , m_blockUpdatesForNextRevision( false )
, m_sync( false ) , m_sync( false )
, m_canSubscribe( false )
, m_subscribed( false ) , m_subscribed( false )
, m_canSubscribe( false )
, m_isOwner( false ) , m_isOwner( false )
, m_collaborative( false ) , m_collaborative( false )
, m_subscribers( 0 ) , m_subscribers( 0 )

View File

@@ -770,7 +770,7 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
tDebug( LOGVERBOSE ) << "Phonon state now:" << newState; tDebug( LOGVERBOSE ) << "Phonon state now:" << newState;
if ( m_stateQueue.count() ) if ( m_stateQueue.count() )
{ {
AudioState qState = m_stateQueue.dequeue(); /*/ AudioState qState = */ m_stateQueue.dequeue();
checkStateQueue(); checkStateQueue();
} }
} }

View File

@@ -62,7 +62,8 @@ TomahawkSqlQuery::prepare( const QString& query )
bool bool
TomahawkSqlQuery::exec( const QString& query ) TomahawkSqlQuery::exec( const QString& query )
{ {
bool prepareResult = prepare( query ); // bool prepareResult =
prepare( query );
// tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Query preparation successful?" << ( prepareResult ? "true" : "false" ); // tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Query preparation successful?" << ( prepareResult ? "true" : "false" );
return exec(); return exec();
} }

View File

@@ -112,6 +112,7 @@ JobStatusView::customDelegateJobInserted( int row, JobStatusItem* item )
void void
JobStatusView::customDelegateJobRemoved( int row ) JobStatusView::customDelegateJobRemoved( int row )
{ {
Q_UNUSED( row );
checkCount(); checkCount();
} }

View File

@@ -329,6 +329,7 @@ FlexibleView::onModelChanged()
void void
FlexibleView::onWidgetDestroyed( QWidget* widget ) FlexibleView::onWidgetDestroyed( QWidget* widget )
{ {
Q_UNUSED( widget );
emit destroyed( this ); emit destroyed( this );
} }

View File

@@ -157,6 +157,7 @@ void
PlaylistModel::insertAlbums( const QList< Tomahawk::album_ptr >& albums, int row ) PlaylistModel::insertAlbums( const QList< Tomahawk::album_ptr >& albums, int row )
{ {
// FIXME: This currently appends, not inserts! // FIXME: This currently appends, not inserts!
Q_UNUSED( row );
foreach ( const album_ptr& album, albums ) foreach ( const album_ptr& album, albums )
{ {
@@ -182,6 +183,7 @@ void
PlaylistModel::insertArtists( const QList< Tomahawk::artist_ptr >& artists, int row ) PlaylistModel::insertArtists( const QList< Tomahawk::artist_ptr >& artists, int row )
{ {
// FIXME: This currently appends, not inserts! // FIXME: This currently appends, not inserts!
Q_UNUSED( row );
foreach ( const artist_ptr& artist, artists ) foreach ( const artist_ptr& artist, artists )
{ {

View File

@@ -46,7 +46,7 @@ public:
virtual void setRepeatMode( PlaylistModes::RepeatMode ) {} virtual void setRepeatMode( PlaylistModes::RepeatMode ) {}
virtual void setShuffled( bool ) {} virtual void setShuffled( bool ) {}
virtual bool shuffled() const { return false; } virtual bool shuffled() const { return false; }
virtual result_ptr siblingItem( int itemsAway ) { return result_ptr(); } virtual result_ptr siblingItem( int ) { return result_ptr(); }
virtual int trackCount() const { return 1; } virtual int trackCount() const { return 1; }
virtual QList< query_ptr > tracks() { return QList< query_ptr >(); } virtual QList< query_ptr > tracks() { return QList< query_ptr >(); }

View File

@@ -42,6 +42,9 @@ public:
virtual ~TreeProxyModel() {} virtual ~TreeProxyModel() {}
virtual void setSourcePlayableModel( TreeModel* model ); virtual void setSourcePlayableModel( TreeModel* model );
// workaround overloaded-virtual warning
virtual void setSourcePlayableModel( PlayableModel* ) { Q_ASSERT( false ); }
virtual Tomahawk::playlistinterface_ptr playlistInterface(); virtual Tomahawk::playlistinterface_ptr playlistInterface();
virtual void setFilter( const QString& pattern ); virtual void setFilter( const QString& pattern );
@@ -50,7 +53,10 @@ signals:
protected: protected:
bool filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const; bool filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const;
bool lessThan( const QModelIndex& left, const QModelIndex& right ) const; bool lessThan( const QModelIndex& left, const QModelIndex& right ) const;
// workaround overloaded-virtual warning: using this would lead to serious weirdness in release mode, sometimes an assert is simply not enough
bool lessThan(int, const Tomahawk::query_ptr&, const Tomahawk::query_ptr&) const { Q_ASSERT(false); TomahawkUtils::crash(); return false; }
private slots: private slots:
void onRowsInserted( const QModelIndex& parent, int start, int end ); void onRowsInserted( const QModelIndex& parent, int start, int end );

View File

@@ -31,7 +31,7 @@ namespace TomahawkUtils
class ScopedDeleter class ScopedDeleter
{ {
public: public:
ScopedDeleter( QObject* o ) : m_o( 0 ) {} ScopedDeleter( QObject* o ) : m_o( o ) {}
~ScopedDeleter() { m_o->deleteLater(); } ~ScopedDeleter() { m_o->deleteLater(); }
private: private:

View File

@@ -111,6 +111,8 @@ JSPFLoader::networkLoadFinished()
void void
JSPFLoader::networkError( QNetworkReply::NetworkError e ) JSPFLoader::networkError( QNetworkReply::NetworkError e )
{ {
Q_UNUSED( e );
reportError(); reportError();
NetworkReply* r = qobject_cast<NetworkReply*>( sender() ); NetworkReply* r = qobject_cast<NetworkReply*>( sender() );

View File

@@ -323,6 +323,8 @@ SpotifyParser::spotifyTrackLookupFinished()
void void
SpotifyParser::playlistListingResult( const QString& msgType, const QVariantMap& msg, const QVariant& extraData ) SpotifyParser::playlistListingResult( const QString& msgType, const QVariantMap& msg, const QVariant& extraData )
{ {
Q_UNUSED( extraData );
Q_ASSERT( msgType == "playlistListing" ); Q_ASSERT( msgType == "playlistListing" );
m_title = msg.value( "name" ).toString(); m_title = msg.value( "name" ).toString();

View File

@@ -82,17 +82,19 @@ private:
void lookupSpotifyBrowse( const QString& playlist ); void lookupSpotifyBrowse( const QString& playlist );
void checkTrackFinished(); void checkTrackFinished();
void checkBrowseFinished(); void checkBrowseFinished();
int m_limit; int m_limit;
bool m_single; bool m_single;
bool m_trackMode; bool m_trackMode;
bool m_createNewPlaylist;
bool m_collaborative; bool m_collaborative;
bool m_createNewPlaylist;
DropJobNotifier* m_browseJob;
int m_subscribers; int m_subscribers;
QList< query_ptr > m_tracks; QList< query_ptr > m_tracks;
QSet< NetworkReply* > m_queries; QSet< NetworkReply* > m_queries;
QString m_title, m_info, m_creator; QString m_title, m_info, m_creator;
Tomahawk::playlist_ptr m_playlist; Tomahawk::playlist_ptr m_playlist;
DropJobNotifier* m_browseJob;
QString m_browseUri; QString m_browseUri;
static QPixmap* s_pixmap; static QPixmap* s_pixmap;
}; };

View File

@@ -173,6 +173,8 @@ SourceTreePopupDialog::setExtraQuestions( const Tomahawk::PlaylistDeleteQuestion
void void
SourceTreePopupDialog::paintEvent( QPaintEvent* event ) SourceTreePopupDialog::paintEvent( QPaintEvent* event )
{ {
Q_UNUSED( event );
// Constants for painting // Constants for painting
const int leftTriangleWidth = 12; const int leftTriangleWidth = 12;
const int cornerRounding = TomahawkUtils::POPUP_ROUNDING_RADIUS; const int cornerRounding = TomahawkUtils::POPUP_ROUNDING_RADIUS;

View File

@@ -163,6 +163,8 @@ AccountsToolButton::paintEvent( QPaintEvent* event )
void void
AccountsToolButton::moveEvent( QMoveEvent* event ) AccountsToolButton::moveEvent( QMoveEvent* event )
{ {
Q_UNUSED( event );
if ( m_popup ) if ( m_popup )
{ {
if ( isDown() ) if ( isDown() )

View File

@@ -167,6 +167,8 @@ SlideSwitchButton::mouseMoveEvent( QMouseEvent* e )
void void
SlideSwitchButton::paintEvent( QPaintEvent* event ) SlideSwitchButton::paintEvent( QPaintEvent* event )
{ {
Q_UNUSED( event );
QPainter painter( this ); QPainter painter( this );
painter.setRenderHint( QPainter::Antialiasing ); painter.setRenderHint( QPainter::Antialiasing );

View File

@@ -7,7 +7,7 @@ set( CMAKE_MODULE_PATH
) )
if( CMAKE_COMPILER_IS_GNUCXX ) if( CMAKE_COMPILER_IS_GNUCXX )
add_definitions(-DSTDC_HEADERS -std=gnu++98) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98")
endif() endif()
if(${CMAKE_BUILD_TYPE} MATCHES "Release") if(${CMAKE_BUILD_TYPE} MATCHES "Release")