extragear/graphics/digikam

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

extragear/graphics/digikam

Bugzilla from andi.clemens@gmx.net
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:[hidden email]

 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)
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: extragear/graphics/digikam

Albert Astals Cid
A Diumenge, 7 de juny de 2009, Andi Clemens va escriure:
> 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?

As far as i can see: Yes you can, why do you think you could not?

Albert
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel