From 8c7fffdc7d8874200c47c8c2c3c19465883b142c Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Sat, 3 Apr 2010 03:21:02 +0000 Subject: [PATCH] Fixed compilation error on MSVC when SUPPRESS_WARNINGS is defined. (Thomas Beutlich) --- src/convert.cpp | 8 ++++++-- src/xmp.cpp | 23 +++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/convert.cpp b/src/convert.cpp index 217632ee..f0c33804 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -826,12 +826,16 @@ namespace Exiv2 { try { SXMPUtils::ConvertToDate(value, &datetime); } - catch (const XMP_Error& e) { #ifndef SUPPRESS_WARNINGS + catch (const XMP_Error& e) { std::cerr << "Warning: Failed to convert " << from << " to " << to << " (" << e.GetErrMsg() << ")\n"; -#endif return; } +#else + catch (const XMP_Error&) { + return; + } +#endif // SUPPRESS_WARNINGS char buf[30]; if (std::string(to) != "Exif.GPSInfo.GPSTimeStamp") { diff --git a/src/xmp.cpp b/src/xmp.cpp index 4594f7c1..936c9895 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -566,13 +566,19 @@ namespace Exiv2 { return 0; } - catch (const XMP_Error& e) { #ifndef SUPPRESS_WARNINGS + catch (const XMP_Error& e) { std::cerr << Error(40, e.GetID(), e.GetErrMsg()) << "\n"; -#endif xmpData.clear(); return 3; - }} // XmpParser::decode + } +#else + catch (const XMP_Error&) { + xmpData.clear(); + return 3; + } +#endif // SUPPRESS_WARNINGS + } // XmpParser::decode #else int XmpParser::decode( XmpData& xmpData, const std::string& xmpPacket) @@ -681,12 +687,17 @@ namespace Exiv2 { return 0; } - catch (const XMP_Error& e) { #ifndef SUPPRESS_WARNINGS + catch (const XMP_Error& e) { std::cerr << Error(40, e.GetID(), e.GetErrMsg()) << "\n"; -#endif return 3; - }} // XmpParser::decode + } +#else + catch (const XMP_Error& e) { + return 3; + } +#endif // SUPPRESS_WARNINGS + } // XmpParser::decode #else int XmpParser::encode( std::string& /*xmpPacket*/, const XmpData& xmpData,