Fix building against exiv2-0.27
ClosedPublic

Authored by asturmlechner on Dec 26 2018, 3:23 PM.

Details

Summary

Copied FindLibExiv2.cmake from ECM 5.53.0 until we raise min version.

Thanks-to: Boudewijn Rempt <boud@valdyas.org>
for final fix to kis_xmp_io.cpp.

CCBUG: 402566

Test Plan

Built fine against exiv2-0.26 and exiv2-0.27.

Diff Detail

Repository
R37 Krita
Branch
arcpatch-D17810
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 6396
Build 6414: arc lint + arc unit
asturmlechner created this revision.Dec 26 2018, 3:23 PM
Restricted Application added a project: Krita. · View Herald TranscriptDec 26 2018, 3:23 PM
asturmlechner requested review of this revision.Dec 26 2018, 3:23 PM

PS: Backportable to 4.1 branch replacing a single hunk:

diff --git a/libs/ui/kisexiv2/kis_exiv2.h b/libs/ui/kisexiv2/kis_exiv2.h
index 9343265f1e..6b66aa7852 100644
--- a/libs/ui/kisexiv2/kis_exiv2.h
+++ b/libs/ui/kisexiv2/kis_exiv2.h
@@ -21,7 +21,7 @@
 
 
 #include <metadata/kis_meta_data_value.h>
-#include <exiv2/value.hpp>
+#include <exiv2/exiv2.hpp>
 #include "kritaui_export.h"
 
 /// Convert an exiv value to a KisMetaData value
pino added a subscriber: pino.Dec 26 2018, 4:07 PM

TBH inverting all the EXIV2_TEST_VERSION(...) conditions will avoid swapping all the code branches for old and new exiv2, reducing the diff of this patch.

libs/ui/kisexiv2/kis_xmp_io.cpp
279–280

the == here seems wrong, as it will execute the code of the loop only once

Ah, yes, that's my fault...

Invert conditionals to reduce diff.

pino added inline comments.Dec 28 2018, 12:22 AM
CMakeLists.txt
614

the PURPOSE here is not added in the new code (OK, the text is not exactly useful, but still)

libs/ui/kisexiv2/kis_exif_io.cpp
445

extra line change

532

extra line change

533

extra line change

libs/ui/kisexiv2/kis_xmp_io.cpp
22–26

considering that kis_exiv2.h now includes exiv2/exiv2.hpp, and that exiv2/exiv2.hpp includes all the exiv2 headers, isn't this snippet redundant now?

279–280

should it be just < now?

asturmlechner added inline comments.Dec 28 2018, 1:15 AM
CMakeLists.txt
614

I think this was last useful when it was part of calligra, but not anymore

libs/ui/kisexiv2/kis_xmp_io.cpp
22–26

hm, indeed

asturmlechner added inline comments.Dec 28 2018, 1:18 AM
libs/ui/kisexiv2/kis_exif_io.cpp
532

I thought it was probably not intended to have this empty line inside the #else part in the first place

Drop another excess line change

rempt accepted this revision.Dec 28 2018, 3:44 PM
This revision is now accepted and ready to land.Dec 28 2018, 3:44 PM
This revision was automatically updated to reflect the committed changes.
wbauer added a subscriber: wbauer.Jan 2 2019, 11:07 PM
wbauer added inline comments.
libs/ui/kisexiv2/kis_xmp_io.cpp
279–280

This causes krita to crash here when opening certain jpg files (with XMP tags).

I think it should be xav->count() instead of xav->size()... (that does fix the crashes for me)

According to the docs (http://www.exiv2.org/doc/classExiv2_1_1XmpArrayValue.html),
count() returns the number of components of the value whereas size() returns the size of the value in *bytes*.

rempt added a comment.Jan 3 2019, 10:19 AM

Outch, thanks for the hint. I'll fix that.

Outch, thanks for the hint. I'll fix that.

You apparently "fixed" the wrong line though:
https://phabricator.kde.org/R37:47c1a78a0f02e7d6a970616c20801ddb6ba0c58e

This is rather in loadFrom(), line 279...

The one in saveFrom() that you changed should have been fine, as it is a QList, where size() and count() are effectively the same.

rempt added a comment.Jan 3 2019, 10:44 AM

Argh... Maybe I just shouldn't touch code today. I hope I did it right this time...

Yes, looks fine now.
Thank you! ;-)