[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/libs/libkexiv2
From:       Gilles Caulier <caulier.gilles () gmail ! com>
Date:       2007-05-02 6:42:28
Message-ID: 1178088148.781166.21982.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 660276 by cgilles:

libkexiv2 from trunk : test if file is readable before to load it in Exiv2.
CCBUGS: 144895


 M  +12 -8     kexiv2.cpp  
 M  +2 -2      kexiv2.h  


--- trunk/extragear/libs/libkexiv2/kexiv2.cpp #660275:660276
@@ -1,6 +1,6 @@
 /* ============================================================
- * Authors: Gilles Caulier <caulier dot gilles at gmail dot com>
- *          Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
+ * Authors: Gilles Caulier 
+ *          Marcel Wiesweg 
  * Date   : 2006-09-15
  * Description : Exiv2 library interface for KDE
  *
@@ -344,13 +344,15 @@
 
 bool KExiv2::load(const QString& filePath)
 {
+    QFileInfo finfo(filePath);
+    if (filePath.isEmpty() || !finfo.isReadable())
+    {
+        qDebug("File '%s' is not readable.", finfo.fileName().ascii());
+        return false;
+    }
+
     try
-    {   
-        d->filePath = filePath;
- 
-        if (filePath.isEmpty())
-            return false;
-
+    {
         Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open((const char*)
                                       (QFile::encodeName(filePath)));
         image->readMetadata();
@@ -367,6 +369,8 @@
         
         d->iptcMetadata = image->iptcData();
 
+        d->filePath = filePath;
+
         return true;
     }
     catch( Exiv2::Error &e )
--- trunk/extragear/libs/libkexiv2/kexiv2.h #660275:660276
@@ -1,6 +1,6 @@
 /* ============================================================
- * Authors: Gilles Caulier <caulier dot gilles at gmail dot com>
- *          Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
+ * Authors: Gilles Caulier 
+ *          Marcel Wiesweg 
  * Date   : 2006-09-15
  * Description : Exiv2 library interface for KDE
  *
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic