Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for compatibility with exiv2-0.28.0 #12

Open
Flexximilian opened this issue Sep 5, 2023 · 3 comments
Open

Patch for compatibility with exiv2-0.28.0 #12

Flexximilian opened this issue Sep 5, 2023 · 3 comments

Comments

@Flexximilian
Copy link

Hi,

I just fixed my local Gentoo ebuild of ufraw-0.22 which broke against exiv2-0.28.0 (~amd64). I came across this repository, with seems to be somewhat maintained, and others might search for this, so maybe this is helpful:

diff -u ufraw-0.22-r4/ufraw_exiv2.cc ufraw-0.22-r5/ufraw_exiv2.cc
--- ufraw-0.22-r4/ufraw_exiv2.cc	2023-09-06 00:25:01.932565047 +0200
+++ ufraw-0.22-r5/ufraw_exiv2.cc	2023-09-06 00:21:03.537084037 +0200
@@ -50,7 +50,7 @@
         uf->inputExifBuf = NULL;
         uf->inputExifBufLen = 0;
 
-        Exiv2::Image::AutoPtr image;
+        Exiv2::Image::UniquePtr image;
         if (uf->unzippedBuf != NULL) {
             image = Exiv2::ImageFactory::open(
                         (const Exiv2::byte*)uf->unzippedBuf, uf->unzippedBufLen);
@@ -66,11 +66,7 @@
         if (exifData.empty()) {
             std::string error(uf->filename);
             error += ": No Exif data found in the file";
-#if EXIV2_TEST_VERSION(0,27,0)
-            throw Exiv2::Error(Exiv2::kerErrorMessage, error);
-#else
-            throw Exiv2::Error(1, error);
-#endif
+            throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage, error);
         }
 
         /* List of tag names taken from exiv2's printSummary() in actions.cpp */
@@ -135,7 +131,7 @@
         ufraw_message(UFRAW_SET_LOG, "%s\n", stderror.str().c_str());
 
         return UFRAW_SUCCESS;
-    } catch (Exiv2::AnyError& e) {
+    } catch (Exiv2::Error& e) {
         std::cerr.rdbuf(savecerr);
         std::string s(e.what());
         ufraw_message(UFRAW_SET_WARNING, "%s\n", s.c_str());
@@ -156,7 +152,7 @@
         if ((pos = exifData.findKey(Exiv2::ExifKey("Exif.Image.Orientation")))
                 != exifData.end()) {
             ufraw_message(UFRAW_SET_LOG, "Resetting %s from '%d' to '1'\n",
-                          pos->key().c_str(), pos->value().toLong());
+                          pos->key().c_str(), pos->value().toInt64());
             pos->setValue("1"); /* 1 = Normal orientation */
         }
     }
@@ -327,7 +323,7 @@
         ufraw_message(UFRAW_SET_LOG, "%s\n", stderror.str().c_str());
 
         return UFRAW_SUCCESS;
-    } catch (Exiv2::AnyError& e) {
+    } catch (Exiv2::Error& e) {
         std::cerr.rdbuf(savecerr);
         std::string s(e.what());
         ufraw_message(UFRAW_SET_WARNING, "%s\n", s.c_str());
@@ -347,7 +343,7 @@
 
         char *filename =
             uf_win32_locale_filename_from_utf8(uf->conf->outputFilename);
-        Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(filename);
+        Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(filename);
         uf_win32_locale_filename_free(filename);
         assert(image.get() != 0);
 
@@ -367,7 +363,7 @@
         ufraw_message(UFRAW_SET_LOG, "%s\n", stderror.str().c_str());
 
         return UFRAW_SUCCESS;
-    } catch (Exiv2::AnyError& e) {
+    } catch (Exiv2::Error& e) {
         std::cerr.rdbuf(savecerr);
         std::string s(e.what());
         ufraw_message(UFRAW_SET_WARNING, "%s\n", s.c_str());

Note that after this patch, the code will compile with exiv2 >= 0.28.0, but won't compile against earlier versions any longer.

Cheers!

PS: I can provide the full ebuild if anyone is interested.

@Flexximilian Flexximilian changed the title Path for compatibility with exiv2-0.28.0 Patch for compatibility with exiv2-0.28.0 Sep 5, 2023
@sergiomb2
Copy link
Owner

ufraw_exiv2.cc:53:23: error: 'UniquePtr' is not a member of 'Exiv2::Image'

thinrope added a commit to thinrope/pkalin that referenced this issue Jan 15, 2024
media-gfx/ufraw has been failing due to changes in exiv2 library. Based
on sergiomb2/ufraw#12 I added a new patch.
Thanks to @Flexximilian for that!

NOTE: media-gfx/ufraw is not in official portage for 2+ years and it
shows a lot of warnings, so I cannot vouch for its stability/suitability;
I only occasionally use it.
@thinrope
Copy link

I added it to my Gentoo overlay [pkalin, available in layman], should be good for now in Gentoo. If someone has the skillz to maintain the original, then I may try to include it upstream in Gentoo, but for now this should work.

@sergiomb2
Copy link
Owner

is similar to #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants