Update of /cvsroot/ufraw/ufraw
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv813
Modified Files:
ufraw_exiv2.cc
Log Message:
Use the new easyaccess functions introduced in Exiv2-18.1 to get isoSpeed
and lensName.
Index: ufraw_exiv2.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_exiv2.cc,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- ufraw_exiv2.cc 30 Sep 2009 21:51:05 -0000 1.52
+++ ufraw_exiv2.cc 30 Nov 2009 05:58:57 -0000 1.53
@@ -23,6 +23,9 @@
#ifdef HAVE_EXIV2
#include <exiv2/image.hpp>
+#if EXIV2_TEST_VERSION(0,18,1)
+#include <exiv2/easyaccess.hpp>
+#endif
#include <exiv2/exif.hpp>
#include <sstream>
#include <cassert>
@@ -38,9 +41,9 @@
* current locale (in which exiv2 often returns strings) to UTF-8.
*/
static void uf_strlcpy_to_utf8(char *dest, size_t dest_max,
- Exiv2::ExifData::iterator pos, Exiv2::ExifData& exifData)
+ Exiv2::ExifData::const_iterator pos, Exiv2::ExifData& exifData)
{
-#if EXIV2_TEST_VERSION(0,17,91) /* Exiv2 0.18-pre1 */
+#if EXIV2_TEST_VERSION(0,18,0)
std::string str = pos->print(&exifData);
#else
(void)exifData;
@@ -90,7 +93,7 @@
}
/* List of tag names taken from exiv2's printSummary() in actions.cpp */
- Exiv2::ExifData::iterator pos;
+ Exiv2::ExifData::const_iterator pos;
/* Read shutter time */
if ( (pos=exifData.findKey(Exiv2::ExifKey("Exif.Photo.ExposureTime")))
!= exifData.end() ) {
@@ -114,6 +117,11 @@
uf->conf->aperture = pos->toFloat ();
}
/* Read ISO speed */
+#if EXIV2_TEST_VERSION(0,18,1)
+ if ( (pos=Exiv2::isoSpeed(exifData)) != exifData.end() ) {
+ uf_strlcpy_to_utf8(uf->conf->isoText, max_name, pos, exifData);
+ }
+#else
if ( (pos=exifData.findKey(Exiv2::ExifKey("Exif.Photo.ISOSpeedRatings")))
!= exifData.end() ) {
uf_strlcpy_to_utf8(uf->conf->isoText, max_name, pos, exifData);
@@ -146,6 +154,7 @@
!= exifData.end() ) {
uf_strlcpy_to_utf8(uf->conf->isoText, max_name, pos, exifData);
}
+#endif
/* Read focal length */
if ( (pos=exifData.findKey(Exiv2::ExifKey("Exif.Photo.FocalLength")))
!= exifData.end() ) {
@@ -165,6 +174,11 @@
uf_strlcpy_to_utf8(uf->conf->focalLen35Text, max_name, pos, exifData);
}
/* Read full lens name */
+#if EXIV2_TEST_VERSION(0,18,1)
+ if ( (pos=Exiv2::lensName(exifData)) != exifData.end() ) {
+ uf_strlcpy_to_utf8(uf->conf->lensText, max_name, pos, exifData);
+ }
+#else
if ( (pos=exifData.findKey(Exiv2::ExifKey("Exif.Nikon3.LensData")))
!= exifData.end() ) {
uf_strlcpy_to_utf8(uf->conf->lensText, max_name, pos, exifData);
@@ -178,7 +192,7 @@
uf_strlcpy_to_utf8(uf->conf->lensText, max_name, pos, exifData);
}
}
-#if EXIV2_TEST_VERSION(0,17,91) /* Exiv2 0.18-pre1 */
+#if EXIV2_TEST_VERSION(0,18,0)
} else if ( (pos=exifData.findKey(Exiv2::ExifKey("Exif.CanonCs.LensType")))
!= exifData.end() ) {
uf_strlcpy_to_utf8(uf->conf->lensText, max_name, pos, exifData);
@@ -195,6 +209,7 @@
uf_strlcpy_to_utf8(uf->conf->lensText, max_name, pos, exifData);
#endif
}
+#endif
/* Read flash mode */
if ( (pos=exifData.findKey(Exiv2::ExifKey("Exif.Photo.Flash")))
!= exifData.end() ) {
@@ -216,7 +231,7 @@
}
/* Store all EXIF data read in. */
-#if EXIV2_TEST_VERSION(0,17,91) /* Exiv2 0.18-pre1 */
+#if EXIV2_TEST_VERSION(0,18,0)
Exiv2::Blob blob;
Exiv2::ExifParser::encode(blob, Exiv2::bigEndian, exifData);
uf->inputExifBufLen = blob.size();
@@ -251,7 +266,7 @@
Exiv2::ExifData exifData = Exiv2::ExifData();
/* Start from the input EXIF data */
-#if EXIV2_TEST_VERSION(0,17,91) /* Exiv2 0.18-pre1 */
+#if EXIV2_TEST_VERSION(0,18,0)
Exiv2::ExifParser::decode(exifData, uf->inputExifBuf, uf->inputExifBufLen);
#else
exifData.load(uf->inputExifBuf, uf->inputExifBufLen);
@@ -319,7 +334,7 @@
!= exifData.end() )
exifData.erase(pos);
#endif
-#if EXIV2_TEST_VERSION(0,17,91) /* Exiv2 0.18-pre1 */
+#if EXIV2_TEST_VERSION(0,18,0)
if (
(pos=exifData.findKey(Exiv2::ExifKey("Exif.NikonPreview.JPEGInterchangeFormat")))
!= exifData.end() )
exifData.erase(pos);
@@ -391,7 +406,7 @@
Exiv2::ExifData exifData = ufraw_prepare_exifdata(uf);
int size;
-#if EXIV2_TEST_VERSION(0,17,91) /* Exiv2 0.18-pre1 */
+#if EXIV2_TEST_VERSION(0,18,0)
Exiv2::Blob blob;
Exiv2::ExifParser::encode(blob, Exiv2::bigEndian, exifData);
size = blob.size();
@@ -409,7 +424,7 @@
ufraw_message(UFRAW_SET_LOG,
"buflen %d too big, erasing Exif.Photo.MakerNote\n",
size+sizeof(ExifHeader));
-#if EXIV2_TEST_VERSION(0,17,91) /* Exiv2 0.18-pre1 */
+#if EXIV2_TEST_VERSION(0,18,0)
Exiv2::ExifParser::encode(blob, Exiv2::bigEndian, exifData);
size = blob.size();
#else
@@ -419,7 +434,7 @@
}
}
if ( size+sizeof(ExifHeader)>65533 ) {
-#if EXIV2_TEST_VERSION(0,17,91) /* Exiv2 0.18-pre1 */
+#if EXIV2_TEST_VERSION(0,18,0)
Exiv2::ExifThumb thumb(exifData);
thumb.erase();
#else
@@ -428,7 +443,7 @@
ufraw_message(UFRAW_SET_LOG,
"buflen %d too big, erasing Thumbnail\n",
size+sizeof(ExifHeader));
-#if EXIV2_TEST_VERSION(0,17,91) /* Exiv2 0.18-pre1 */
+#if EXIV2_TEST_VERSION(0,18,0)
Exiv2::ExifParser::encode(blob, Exiv2::bigEndian, exifData);
size = blob.size();
#else
@@ -439,7 +454,7 @@
uf->outputExifBufLen = size + sizeof(ExifHeader);
uf->outputExifBuf = g_new(unsigned char, uf->outputExifBufLen);
memcpy(uf->outputExifBuf, ExifHeader, sizeof(ExifHeader));
-#if EXIV2_TEST_VERSION(0,17,91) /* Exiv2 0.18-pre1 */
+#if EXIV2_TEST_VERSION(0,18,0)
memcpy(uf->outputExifBuf+sizeof(ExifHeader), &blob[0], blob.size());
#else
memcpy(uf->outputExifBuf+sizeof(ExifHeader), buf.pData_, buf.size_);
@@ -460,7 +475,7 @@
extern "C" int ufraw_exif_write(ufraw_data *uf)
{
-#if EXIV2_TEST_VERSION(0,17,91) /* Exiv2 0.18-pre1 */
+#if EXIV2_TEST_VERSION(0,18,0)
/* Redirect exiv2 errors to a string buffer */
std::ostringstream stderror;
std::streambuf *savecerr = std::cerr.rdbuf();
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs