Commit 8a8dc535 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

use a better C++ exception wrapper to handle non Exiv2 exceptions (as pure C++ one)

BUGS: 331679
FIXED-IN: 4.1.0
parent e70f0784
......@@ -6,7 +6,7 @@
# @date 2006-09-15
# @brief Exiv2 library interface for KDE
#
# @author Copyright (C) 2006-2012 by Gilles Caulier
# @author Copyright (C) 2006-2014 by Gilles Caulier
# <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
#
# This program is free software; you can redistribute it
......@@ -111,21 +111,21 @@ IF (EXIV2_FOUND)
INCLUDE(CMakePackageConfigHelpers)
CONFIGURE_PACKAGE_CONFIG_FILE(libkexiv2-config.cmake.in libkexiv2-config.cmake
INSTALL_DESTINATION "${LIB_INSTALL_DIR}/cmake/libkexiv2-${KEXIV2_LIB_VERSION_STRING}"
PATH_VARS INCLUDE_INSTALL_DIR
PATH_VARS INCLUDE_INSTALL_DIR
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
WRITE_BASIC_PACKAGE_VERSION_FILE(libkexiv2-config-version.cmake
VERSION "${KEXIV2_LIB_MAJOR_VERSION}.${KEXIV2_LIB_MINOR_VERSION}.${KEXIV2_LIB_PATCH_VERSION}"
VERSION "${KEXIV2_LIB_MAJOR_VERSION}.${KEXIV2_LIB_MINOR_VERSION}.${KEXIV2_LIB_PATCH_VERSION}"
COMPATIBILITY SameMajorVersion)
INSTALL(EXPORT Libkexiv2
DESTINATION "${LIB_INSTALL_DIR}/cmake/libkexiv2-${KEXIV2_LIB_VERSION_STRING}"
NAMESPACE Libkexiv2::
FILE libkexiv2-export.cmake)
DESTINATION "${LIB_INSTALL_DIR}/cmake/libkexiv2-${KEXIV2_LIB_VERSION_STRING}"
NAMESPACE Libkexiv2::
FILE libkexiv2-export.cmake)
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/libkexiv2-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/libkexiv2-config-version.cmake
DESTINATION
"${LIB_INSTALL_DIR}/cmake/libkexiv2-${KEXIV2_LIB_VERSION_STRING}"
)
)
IF(NOT WIN32)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libkexiv2.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkexiv2.pc)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libkexiv2.lsm.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkexiv2.lsm)
......
......@@ -6,7 +6,7 @@
# @date 2006-09-15
# @brief Exiv2 library interface for KDE
#
# @author Copyright (C) 2006-2012 by Gilles Caulier
# @author Copyright (C) 2006-2014 by Gilles Caulier
# <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
#
# This program is free software; you can redistribute it
......
......@@ -7,7 +7,7 @@
* @date 2006-09-15
* @brief Exiv2 library interface for KDE
*
* @author Copyright (C) 2006-2013 by Gilles Caulier
* @author Copyright (C) 2006-2014 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2006-2013 by Marcel Wiesweg
* <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
......@@ -277,6 +277,10 @@ bool KExiv2::loadFromData(const QByteArray& imgData) const
{
d->printExiv2ExceptionError("Cannot load metadata using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -329,6 +333,10 @@ bool KExiv2::load(const QString& filePath) const
{
d->printExiv2ExceptionError("Cannot load metadata from file ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
#ifdef _XMP_SUPPORT_
try
......@@ -355,6 +363,11 @@ bool KExiv2::load(const QString& filePath) const
{
d->printExiv2ExceptionError("Cannot load XMP sidecar", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
#endif // _XMP_SUPPORT_
return hasLoaded;
......
......@@ -7,7 +7,7 @@
* @date 2007-09-03
* @brief Exiv2 library interface for KDE
*
* @author Copyright (C) 2006-2013 by Gilles Caulier
* @author Copyright (C) 2006-2014 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2006-2012 by Marcel Wiesweg
* <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
......@@ -83,6 +83,11 @@ bool KExiv2::Private::saveToXMPSidecar(const QFileInfo& finfo) const
printExiv2ExceptionError("Cannot save metadata to XMP sidecar using Exiv2 ", e);
return false;
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
return false;
}
}
bool KExiv2::Private::saveToFile(const QFileInfo& finfo) const
......@@ -154,6 +159,11 @@ bool KExiv2::Private::saveToFile(const QFileInfo& finfo) const
printExiv2ExceptionError("Cannot save metadata to image using Exiv2 ", e);
return false;
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
return false;
}
}
bool KExiv2::Private::saveOperations(const QFileInfo& finfo, Exiv2::Image::AutoPtr image) const
......@@ -299,6 +309,10 @@ bool KExiv2::Private::saveOperations(const QFileInfo& finfo, Exiv2::Image::AutoP
{
printExiv2ExceptionError("Cannot save metadata using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -372,6 +386,10 @@ QString KExiv2::Private::convertCommentValue(const Exiv2::Exifdatum& exifDatum)
{
printExiv2ExceptionError("Cannot convert Comment using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return QString();
}
......
......@@ -7,7 +7,7 @@
* @date 2007-09-03
* @brief Exiv2 library interface for KDE
*
* @author Copyright (C) 2006-2012 by Gilles Caulier
* @author Copyright (C) 2006-2014 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2006-2012 by Marcel Wiesweg
* <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
......
......@@ -7,7 +7,7 @@
* @date 2006-09-15
* @brief Comments manipulation methods
*
* @author Copyright (C) 2006-2012 by Gilles Caulier
* @author Copyright (C) 2006-2014 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2006-2012 by Marcel Wiesweg
* <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
......@@ -47,7 +47,11 @@ bool KExiv2::canWriteComment(const QString& filePath)
{
std::string s(e.what());
kDebug() << "Cannot check Comment access mode using Exiv2 (Error #"
<< e.code() << ": " << s.c_str() << ")";
<< e.code() << ": " << s.c_str() << ")";
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
......
......@@ -7,7 +7,7 @@
* @date 2009-11-15
* @brief Exiv2 library interface for KDE
*
* @author Copyright (C) 2009-2012 by Gilles Caulier
* @author Copyright (C) 2009-2014 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2009-2012 by Marcel Wiesweg
* <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
......
......@@ -7,7 +7,7 @@
* @date 2006-09-15
* @brief Exif manipulation methods
*
* @author Copyright (C) 2006-2013 by Gilles Caulier
* @author Copyright (C) 2006-2014 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2006-2012 by Marcel Wiesweg
* <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
......@@ -57,6 +57,10 @@ bool KExiv2::canWriteExif(const QString& filePath)
kDebug() << "Cannot check Exif access mode using Exiv2 (Error #"
<< e.code() << ": " << s.c_str() << ")";
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -77,6 +81,10 @@ bool KExiv2::clearExif() const
{
d->printExiv2ExceptionError("Cannot clear Exif data using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -113,6 +121,10 @@ QByteArray KExiv2::getExifEncoded(bool addExifHeader) const
d->printExiv2ExceptionError("Cannot get Exif data using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return QByteArray();
}
......@@ -134,6 +146,10 @@ bool KExiv2::setExif(const QByteArray& data) const
d->printExiv2ExceptionError("Cannot set Exif data using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -195,7 +211,7 @@ KExiv2::MetaDataMap KExiv2::getExifTagsDataList(const QStringList& exifKeysFilte
else // else no filter at all.
{
metaDataMap.insert(key, tagValue);
}
}
}
return metaDataMap;
......@@ -204,6 +220,10 @@ KExiv2::MetaDataMap KExiv2::getExifTagsDataList(const QStringList& exifKeysFilte
{
d->printExiv2ExceptionError("Cannot parse EXIF metadata using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return MetaDataMap();
}
......@@ -252,6 +272,10 @@ QString KExiv2::getExifComment() const
{
d->printExiv2ExceptionError("Cannot find Exif User Comment using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return QString();
}
......@@ -312,6 +336,10 @@ bool KExiv2::setExifComment(const QString& comment, bool setProgramName) const
{
d->printExiv2ExceptionError("Cannot set Exif Comment using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -329,6 +357,10 @@ QString KExiv2::getExifTagTitle(const char* exifTagName)
{
d->printExiv2ExceptionError("Cannot get metadata tag title using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return QString();
}
......@@ -346,6 +378,10 @@ QString KExiv2::getExifTagDescription(const char* exifTagName)
{
d->printExiv2ExceptionError("Cannot get metadata tag description using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return QString();
}
......@@ -370,6 +406,10 @@ bool KExiv2::removeExifTag(const char* exifTagName, bool setProgramName) const
{
d->printExiv2ExceptionError("Cannot remove Exif tag using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -395,6 +435,10 @@ bool KExiv2::getExifTagRational(const char* exifTagName, long int& num, long int
d->printExiv2ExceptionError(QString("Cannot find Exif Rational value from key '%1' "
"into image using Exiv2 ").arg(exifTagName), e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -413,6 +457,10 @@ bool KExiv2::setExifTagLong(const char* exifTagName, long val, bool setProgramNa
{
d->printExiv2ExceptionError("Cannot set Exif tag long value into image using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -431,6 +479,10 @@ bool KExiv2::setExifTagRational(const char* exifTagName, long int num, long int
{
d->printExiv2ExceptionError("Cannot set Exif tag rational value into image using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -453,6 +505,10 @@ bool KExiv2::setExifTagData(const char* exifTagName, const QByteArray& data, boo
{
d->printExiv2ExceptionError("Cannot set Exif tag data into image using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -514,6 +570,10 @@ bool KExiv2::setExifTagVariant(const char* exifTagName, const QVariant& val,
{
d->printExiv2ExceptionError("Cannot set Date & Time in image using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -607,6 +667,10 @@ QString KExiv2::createExifUserStringFromValue(const char* exifTagName, const QVa
{
d->printExiv2ExceptionError("Cannot set Iptc tag string into image using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return QString();
}
......@@ -635,6 +699,10 @@ bool KExiv2::getExifTagLong(const char* exifTagName, long& val, int component) c
d->printExiv2ExceptionError(QString("Cannot find Exif key '%1' into image using Exiv2 ")
.arg(exifTagName), e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -662,6 +730,10 @@ QByteArray KExiv2::getExifTagData(const char* exifTagName) const
d->printExiv2ExceptionError(QString("Cannot find Exif key '%1' into image using Exiv2 ")
.arg(exifTagName), e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return QByteArray();
}
......@@ -744,6 +816,10 @@ QVariant KExiv2::getExifTagVariant(const char* exifTagName, bool rationalAsListO
d->printExiv2ExceptionError(QString("Cannot find Exif key '%1' in the image using Exiv2 ")
.arg(exifTagName), e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return QVariant();
}
......@@ -773,6 +849,10 @@ QString KExiv2::getExifTagString(const char* exifTagName, bool escapeCR) const
d->printExiv2ExceptionError(QString("Cannot find Exif key '%1' into image using Exiv2 ")
.arg(exifTagName), e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return QString();
}
......@@ -791,6 +871,10 @@ bool KExiv2::setExifTagString(const char* exifTagName, const QString& value, boo
{
d->printExiv2ExceptionError("Cannot set Exif tag string into image using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -835,6 +919,10 @@ QImage KExiv2::getExifThumbnail(bool fixOrientation) const
{
d->printExiv2ExceptionError("Cannot get Exif Thumbnail using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return thumbnail;
}
......@@ -876,6 +964,10 @@ bool KExiv2::setExifThumbnail(const QImage& thumbImage, bool setProgramName) con
{
d->printExiv2ExceptionError("Cannot set Exif Thumbnail using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -931,6 +1023,10 @@ bool KExiv2::setTiffThumbnail(const QImage& thumbImage, bool setProgramName) con
{
d->printExiv2ExceptionError("Cannot set TIFF Thumbnail using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -948,6 +1044,10 @@ bool KExiv2::removeExifThumbnail() const
{
d->printExiv2ExceptionError("Cannot remove Exif Thumbnail using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -996,6 +1096,10 @@ KExiv2::TagsMap KExiv2::getStdExifTagsList() const
{
d->printExiv2ExceptionError("Cannot get Exif Tags list using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return TagsMap();
}
......@@ -1045,6 +1149,10 @@ KExiv2::TagsMap KExiv2::getMakernoteTagsList() const
{
d->printExiv2ExceptionError("Cannot get Makernote Tags list using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return TagsMap();
}
......
......@@ -7,7 +7,7 @@
* @date 2006-09-15
* @brief GPS manipulation methods
*
* @author Copyright (C) 2006-2013 by Gilles Caulier
* @author Copyright (C) 2006-2014 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2006-2012 by Marcel Wiesweg
* <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
......@@ -130,6 +130,10 @@ bool KExiv2::getGPSLatitudeNumber(double* const latitude) const
{
d->printExiv2ExceptionError("Cannot get GPS tag using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -222,6 +226,10 @@ bool KExiv2::getGPSLongitudeNumber(double* const longitude) const
{
d->printExiv2ExceptionError("Cannot get GPS tag using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -292,6 +300,10 @@ bool KExiv2::getGPSAltitude(double* const altitude) const
{
d->printExiv2ExceptionError("Cannot get GPS tag using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -346,6 +358,10 @@ bool KExiv2::initializeGPSInfo(const bool setProgramName)
{
d->printExiv2ExceptionError("Cannot initialize GPS data using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -474,6 +490,10 @@ bool KExiv2::setGPSInfo(const double* const altitude, const double latitude, con
{
d->printExiv2ExceptionError("Cannot set Exif GPS tag using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -559,6 +579,10 @@ bool KExiv2::removeGPSInfo(const bool setProgramName)
{
d->printExiv2ExceptionError("Cannot remove Exif GPS tag using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......
......@@ -7,7 +7,7 @@
* @date 2006-09-15
* @brief Common metadata image information manipulation methods
*
* @author Copyright (C) 2006-2012 by Gilles Caulier
* @author Copyright (C) 2006-2014 by Gilles Caulier
* <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
* @author Copyright (C) 2006-2012 by Marcel Wiesweg
* <a href="mailto:marcel dot wiesweg at gmx dot de">marcel dot wiesweg at gmx dot de</a>
......@@ -86,6 +86,10 @@ bool KExiv2::setImageProgramId(const QString& program, const QString& version) c
{
d->printExiv2ExceptionError("Cannot set Program identity into image using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -175,6 +179,10 @@ QSize KExiv2::getImageDimensions() const
{
d->printExiv2ExceptionError("Cannot parse image dimensions tag using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return QSize();
}
......@@ -211,6 +219,10 @@ bool KExiv2::setImageDimensions(const QSize& size, bool setProgramName) const
{
d->printExiv2ExceptionError("Cannot set image dimensions using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -302,6 +314,10 @@ KExiv2::ImageOrientation KExiv2::getImageOrientation() const
{
d->printExiv2ExceptionError("Cannot parse Exif Orientation tag using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return ORIENTATION_UNSPECIFIED;
}
......@@ -372,6 +388,10 @@ bool KExiv2::setImageOrientation(ImageOrientation orientation, bool setProgramNa
{
d->printExiv2ExceptionError("Cannot set Exif Orientation tag using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -478,6 +498,10 @@ bool KExiv2::setImageColorWorkSpace(ImageColorWorkSpace workspace, bool setProgr
{
d->printExiv2ExceptionError("Cannot set Exif color workspace tag using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -691,6 +715,10 @@ QDateTime KExiv2::getImageDateTime() const
{
d->printExiv2ExceptionError("Cannot parse Exif date & time tag using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return QDateTime();
}
......@@ -759,6 +787,10 @@ bool KExiv2::setImageDateTime(const QDateTime& dateTime, bool setDateTimeDigitiz
{
d->printExiv2ExceptionError("Cannot set Date & Time into image using Exiv2 ", e);
}
catch(...)
{
kDebug() << "Default exception from Exiv2";
}
return false;
}
......@@ -827,6 +859,10 @@ QDateTime KExiv2::getDigitizationDateTime(bool fallbackToCreationTime) const
{