[Digikam-devel] extragear/graphics/digikam

Andi Clemens andi.clemens at gmx.net
Sun Jun 7 22:16:01 BST 2009


SVN commit 978688 by aclemens:

Use const refs in foreach loops if possible, to avoid copying of data

I marked one line with a FIXME, not sure if we can use a const ref here,
too.
What do you think?

CCMAIL:digikam-devel at kde.org

 M  +1 -1      digikam/albummanager.cpp  
 M  +1 -1      digikam/digikamimageview.cpp  
 M  +3 -2      libs/threadimageio/thumbnailloadthread.cpp  


--- trunk/extragear/graphics/digikam/digikam/albummanager.cpp #978687:978688
@@ -722,7 +722,7 @@
 
     // create albums for album roots
     QList<CollectionLocation> locations = CollectionManager::instance()->allAvailableLocations();
-    foreach(const CollectionLocation location, locations)
+    foreach(const CollectionLocation& location, locations)
         addAlbumRoot(location);
 
     // listen to location status changes
--- trunk/extragear/graphics/digikam/digikam/digikamimageview.cpp #978687:978688
@@ -163,7 +163,7 @@
 {
     QList<ImageInfo> selectedInfos = selectedImageInfosCurrentFirst();
     QList<qlonglong> selectedImageIDs;
-    foreach (ImageInfo info, selectedInfos)
+    foreach (const ImageInfo& info, selectedInfos)
     {
         selectedImageIDs << info.id();
     }
--- trunk/extragear/graphics/digikam/libs/threadimageio/thumbnailloadthread.cpp #978687:978688
@@ -248,7 +248,7 @@
     {
         LoadingCache *cache = LoadingCache::cache();
         LoadingCache::CacheLock lock(cache);
-        foreach(const QString filePath, filePaths)
+        foreach(const QString& filePath, filePaths)
         {
             LoadingDescription description(filePath, size, d->exifRotate, LoadingDescription::PreviewParameters::Thumbnail);
             if (!cache->retrieveThumbnailPixmap(description.cacheKey()))
@@ -389,6 +389,7 @@
         return;
 
     KUrl::List list;
+    // FIXME: const ref?
     foreach (const LoadingDescription description, d->kdeTodo)
     {
         KUrl url = KUrl::fromPath(description.filePath);
@@ -435,7 +436,7 @@
 void ThumbnailLoadThread::kdePreviewFinished(KJob *)
 {
     d->kdeJob = 0;
-    startKdePreviewJob();    
+    startKdePreviewJob();
 }
 
 QPixmap ThumbnailLoadThread::surrogatePixmap(const LoadingDescription& description)



More information about the Digikam-devel mailing list