mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-22 08:52:12 +02:00
Revert "Miscellaneous cppcheck fixes"
This commit is contained in:
parent
c1d99b4868
commit
92811215a5
src/libtomahawk
@ -263,14 +263,9 @@ bool
|
||||
DropJob::validateLocalFiles(const QString &paths, const QString &suffix)
|
||||
{
|
||||
QStringList filePaths = paths.split( QRegExp( "\\s+" ), QString::SkipEmptyParts );
|
||||
QStringList::iterator it = filePaths.begin();
|
||||
while (it != filePaths.end())
|
||||
{
|
||||
for ( QStringList::iterator it = filePaths.begin(); it != filePaths.end(); ++it )
|
||||
if ( !validateLocalFile( *it, suffix ) )
|
||||
it = filePaths.erase( it );
|
||||
else
|
||||
++it;
|
||||
}
|
||||
filePaths.erase( it );
|
||||
return !filePaths.isEmpty();
|
||||
}
|
||||
|
||||
@ -982,7 +977,7 @@ DropJob::removeRemoteSources()
|
||||
foreach ( const Tomahawk::result_ptr& result, item->results() )
|
||||
{
|
||||
if ( !result->collection().isNull() && !result->collection()->source().isNull() &&
|
||||
result->collection()->source()->isLocal() )
|
||||
!result->collection()->source().isNull() && result->collection()->source()->isLocal() )
|
||||
hasLocalSource = true;
|
||||
}
|
||||
if ( hasLocalSource )
|
||||
|
@ -235,6 +235,9 @@ Source::friendlyNamesLessThan( const QString& first, const QString& second )
|
||||
favored.append( QRegExp( "\\b([A-Z][a-z']* ?){2,10}" ) ); //properly capitalized person's name
|
||||
favored.append( QRegExp( "[a-zA-Z ']+" ) ); //kind of person's name
|
||||
|
||||
bool matchFirst = false;
|
||||
bool matchSecond = false;
|
||||
|
||||
//We check if the strings match the regexps. The regexps represent friendly name patterns we do
|
||||
//*not* want (penalties) or want (favored), prioritized. If none of the strings match a regexp,
|
||||
//we go to the next regexp. If one of the strings matches, and we're matching penalties, we say
|
||||
@ -258,8 +261,8 @@ Source::friendlyNamesLessThan( const QString& first, const QString& second )
|
||||
isPenalty = false;
|
||||
}
|
||||
|
||||
bool matchFirst = rx.exactMatch( first );
|
||||
bool matchSecond = rx.exactMatch( second );
|
||||
matchFirst = rx.exactMatch( first );
|
||||
matchSecond = rx.exactMatch( second );
|
||||
|
||||
if ( matchFirst == false && matchSecond == false )
|
||||
continue;
|
||||
|
@ -184,7 +184,7 @@ LastFmConfig::onHistoryLoaded()
|
||||
else
|
||||
finished = true;
|
||||
}
|
||||
catch( lastfm::ws::ParseError& e )
|
||||
catch( lastfm::ws::ParseError e )
|
||||
{
|
||||
tDebug() << "XmlQuery error:" << e.message();
|
||||
finished = true;
|
||||
@ -326,7 +326,7 @@ LastFmConfig::onLovedFinished( QNetworkReply* reply )
|
||||
emit sizeHintChanged();
|
||||
}
|
||||
}
|
||||
catch( lastfm::ws::ParseError& e )
|
||||
catch( lastfm::ws::ParseError e )
|
||||
{
|
||||
m_ui->syncLovedTracks->setText( "Failed" );
|
||||
m_ui->progressBar->hide();
|
||||
|
@ -119,6 +119,7 @@ DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
|
||||
if ( !query_entries_old.next() )
|
||||
{
|
||||
return;
|
||||
Q_ASSERT( false );
|
||||
}
|
||||
|
||||
if ( !query_entries_old.value( 0 ).isNull() )
|
||||
|
@ -274,7 +274,7 @@ Servent::isValidExternalIP( const QHostAddress& addr )
|
||||
if ( addr.isInSubnet(QHostAddress::parseSubnet( "224.0.0.0/4" ) ) )
|
||||
return false;
|
||||
}
|
||||
else if (addr.protocol() == QAbstractSocket::IPv6Protocol)
|
||||
else if (addr.protocol() == QAbstractSocket::IPv4Protocol)
|
||||
{
|
||||
// "unspecified address"
|
||||
if ( addr.isInSubnet(QHostAddress::parseSubnet( "::/128" ) ) )
|
||||
|
@ -144,9 +144,10 @@ AlbumModel::addAlbums( const QList<Tomahawk::album_ptr>& albums )
|
||||
|
||||
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
||||
|
||||
PlayableItem* albumitem;
|
||||
foreach( const album_ptr& album, trimmedAlbums )
|
||||
{
|
||||
PlayableItem* albumitem = new PlayableItem( album, rootItem() );
|
||||
albumitem = new PlayableItem( album, rootItem() );
|
||||
albumitem->index = createIndex( rootItem()->children.count() - 1, 0, albumitem );
|
||||
|
||||
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||
@ -189,9 +190,10 @@ AlbumModel::addArtists( const QList<Tomahawk::artist_ptr>& artists )
|
||||
|
||||
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
||||
|
||||
PlayableItem* albumitem;
|
||||
foreach ( const artist_ptr& artist, trimmedArtists )
|
||||
{
|
||||
PlayableItem* albumitem = new PlayableItem( artist, rootItem() );
|
||||
albumitem = new PlayableItem( artist, rootItem() );
|
||||
albumitem->index = createIndex( rootItem()->children.count() - 1, 0, albumitem );
|
||||
|
||||
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||
@ -217,9 +219,10 @@ AlbumModel::addQueries( const QList<Tomahawk::query_ptr>& queries )
|
||||
|
||||
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
||||
|
||||
PlayableItem* albumitem;
|
||||
foreach ( const query_ptr& query, queries )
|
||||
{
|
||||
PlayableItem* albumitem = new PlayableItem( query, rootItem() );
|
||||
albumitem = new PlayableItem( query, rootItem() );
|
||||
albumitem->index = createIndex( rootItem()->children.count() - 1, 0, albumitem );
|
||||
|
||||
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||
|
@ -269,6 +269,7 @@ PlayableModel::queryData( const query_ptr& query, int column, int role ) const
|
||||
|
||||
case Age:
|
||||
return TomahawkUtils::ageToString( QDateTime::fromTime_t( query->results().first()->modificationTime() ) );
|
||||
break;
|
||||
|
||||
case Year:
|
||||
if ( query->results().first()->track()->year() != 0 )
|
||||
@ -277,9 +278,11 @@ PlayableModel::queryData( const query_ptr& query, int column, int role ) const
|
||||
|
||||
case Filesize:
|
||||
return TomahawkUtils::filesizeToString( query->results().first()->size() );
|
||||
break;
|
||||
|
||||
case Origin:
|
||||
return query->results().first()->friendlySource();
|
||||
break;
|
||||
|
||||
case Score:
|
||||
{
|
||||
@ -290,6 +293,7 @@ PlayableModel::queryData( const query_ptr& query, int column, int role ) const
|
||||
score = 0.0;
|
||||
|
||||
return scoreText( score );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
@ -675,10 +679,11 @@ PlayableModel::insertInternal( const QList< T >& items, int row, const QList< To
|
||||
emit beginInsertRows( parent, crows.first, crows.second );
|
||||
|
||||
int i = 0;
|
||||
PlayableItem* plitem;
|
||||
foreach ( const T& item, items )
|
||||
{
|
||||
PlayableItem* pItem = itemFromIndex( parent );
|
||||
PlayableItem* plitem = new PlayableItem( item, pItem, row + i );
|
||||
plitem = new PlayableItem( item, pItem, row + i );
|
||||
plitem->index = createIndex( row + i, 0, plitem );
|
||||
|
||||
if ( plitem->query() )
|
||||
|
@ -290,10 +290,11 @@ PlaylistModel::insertEntries( const QList< Tomahawk::plentry_ptr >& entries, int
|
||||
|
||||
QList< Tomahawk::query_ptr > queries;
|
||||
int i = 0;
|
||||
PlayableItem* plitem;
|
||||
foreach( const plentry_ptr& entry, entries )
|
||||
{
|
||||
PlayableItem* pItem = itemFromIndex( parent );
|
||||
PlayableItem* plitem = new PlayableItem( entry, pItem, row + i );
|
||||
plitem = new PlayableItem( entry, pItem, row + i );
|
||||
plitem->index = createIndex( row + i, 0, plitem );
|
||||
|
||||
if ( logs.count() > i )
|
||||
|
@ -193,9 +193,10 @@ TreeModel::addAlbums( const QModelIndex& parent, const QList<Tomahawk::album_ptr
|
||||
|
||||
emit beginInsertRows( parent, crows.first, crows.second );
|
||||
|
||||
PlayableItem* albumitem = 0;
|
||||
foreach( const album_ptr& album, albums )
|
||||
{
|
||||
PlayableItem* albumitem = new PlayableItem( album, parentItem );
|
||||
albumitem = new PlayableItem( album, parentItem );
|
||||
albumitem->index = createIndex( parentItem->children.count() - 1, 0, albumitem );
|
||||
connect( albumitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||
|
||||
@ -282,9 +283,10 @@ TreeModel::onArtistsAdded( const QList<Tomahawk::artist_ptr>& artists )
|
||||
|
||||
emit beginInsertRows( QModelIndex(), crows.first, crows.second );
|
||||
|
||||
PlayableItem* artistitem;
|
||||
foreach( const artist_ptr& artist, artists )
|
||||
{
|
||||
PlayableItem* artistitem = new PlayableItem( artist, rootItem() );
|
||||
artistitem = new PlayableItem( artist, rootItem() );
|
||||
artistitem->index = createIndex( rootItem()->children.count() - 1, 0, artistitem );
|
||||
connect( artistitem, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||
}
|
||||
@ -310,9 +312,10 @@ TreeModel::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks, const QModel
|
||||
|
||||
emit beginInsertRows( parent, crows.first, crows.second );
|
||||
|
||||
PlayableItem* item = 0;
|
||||
foreach( const query_ptr& query, tracks )
|
||||
{
|
||||
PlayableItem* item = new PlayableItem( query, parentItem );
|
||||
item = new PlayableItem( query, parentItem );
|
||||
item->index = createIndex( parentItem->children.count() - 1, 0, item );
|
||||
|
||||
connect( item, SIGNAL( dataChanged() ), SLOT( onDataChanged() ) );
|
||||
|
@ -557,7 +557,7 @@ JSResolver::parseResultVariantList( const QVariantList& reslist )
|
||||
continue;
|
||||
|
||||
unsigned int duration = m.value( "duration", 0 ).toUInt();
|
||||
if ( duration == 0 && m.contains( "durationString" ) )
|
||||
if ( duration <= 0 && m.contains( "durationString" ) )
|
||||
{
|
||||
QTime time = QTime::fromString( m.value( "durationString" ).toString(), "hh:mm:ss" );
|
||||
duration = time.secsTo( QTime( 0, 0 ) ) * -1;
|
||||
@ -846,11 +846,12 @@ JSResolver::loadCollections()
|
||||
|
||||
if ( collectionInfo.contains( "iconfile" ) )
|
||||
{
|
||||
bool ok = false;
|
||||
QString iconPath = QFileInfo( filePath() ).path() + "/"
|
||||
+ collectionInfo.value( "iconfile" ).toString();
|
||||
|
||||
QPixmap iconPixmap;
|
||||
bool ok = iconPixmap.load( iconPath );
|
||||
ok = iconPixmap.load( iconPath );
|
||||
if ( ok && !iconPixmap.isNull() )
|
||||
sc->setIcon( QIcon( iconPixmap ) );
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ ScriptEngine::sslErrorHandler( QNetworkReply* qnr, const QList<QSslError>& errli
|
||||
tDebug() << Q_FUNC_INFO;
|
||||
|
||||
QByteArray digest = errlist.first().certificate().digest();
|
||||
int result = -1;
|
||||
|
||||
if ( !TomahawkSettings::instance()->isSslCertKnown( digest ) )
|
||||
{
|
||||
@ -91,7 +92,7 @@ ScriptEngine::sslErrorHandler( QNetworkReply* qnr, const QList<QSslError>& errli
|
||||
question.setStandardButtons( QMessageBox::No );
|
||||
question.addButton( tr( "Trust certificate" ), QMessageBox::AcceptRole );
|
||||
|
||||
int result = question.exec();
|
||||
result = question.exec();
|
||||
|
||||
//FIXME: discuss whether we want to store rejects, too (needs settings management to remove the decision?)
|
||||
if ( result == QMessageBox::AcceptRole )
|
||||
|
Loading…
x
Reference in New Issue
Block a user