[solang] Correctly detect failure in extracting thumbnails using Exiv2
- From: Debarshi Ray <debarshir src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [solang] Correctly detect failure in extracting thumbnails using Exiv2
- Date: Fri, 25 Dec 2009 10:36:06 +0000 (UTC)
commit 020bfa8735e0e83a4da9fb13581b8b3ef8f92db8
Author: Debarshi Ray <rishi gnu org>
Date: Sat Dec 5 20:27:14 2009 +0200
Correctly detect failure in extracting thumbnails using Exiv2
+ Since Exiv2::ExifThumbC::writeFile returns the number of bytes
written a return value of zero is also an error.
+ Do not overwrite thumbnail_generated with true even when the
generation has failed.
Fixes: https://savannah.nongnu.org/bugs/?27538
src/attribute/thumbnail.cpp | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/attribute/thumbnail.cpp b/src/attribute/thumbnail.cpp
index c88f362..2835ff1 100644
--- a/src/attribute/thumbnail.cpp
+++ b/src/attribute/thumbnail.cpp
@@ -166,12 +166,14 @@ Thumbnail::generate(Exiv2::ExifData & exifData,
{
// Extract from exif if present.
Exiv2::ExifThumb thumbnail( exifData );
- if (-1 == thumbnail.writeFile(get_path().c_str()))
+ if (0 <= thumbnail.writeFile(get_path().c_str()))
{
thumbnail_generated = false;
}
-
- thumbnail_generated = true;
+ else
+ {
+ thumbnail_generated = true;
+ }
//Update resoulution info
Thumbnail::Resolution res;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]