Skip to content

Commit

Permalink
graphics/rawstudio: make compatible with exiv2 0.28
Browse files Browse the repository at this point in the history
PR:		272311
  • Loading branch information
mandree committed Jul 9, 2023
1 parent 919c0e9 commit 164a774
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 1 deletion.
2 changes: 1 addition & 1 deletion graphics/rawstudio/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PORTNAME= rawstudio
PORTVERSION= 2.0
PORTREVISION= 23
PORTREVISION= 24
CATEGORIES= graphics
MASTER_SITES= http://rawstudio.org/files/release/

Expand Down
65 changes: 65 additions & 0 deletions graphics/rawstudio/files/patch-librawstudio_rs-exif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,68 @@
#include "rs-exif.h"
#include <assert.h>
#include "rs-library.h"
@@ -128,7 +130,7 @@ rs_exif_load_from_file(const gchar *filename)
RS_EXIF_DATA *exif_data;
try
{
- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(filename);
+ Exiv2::Image::UniquePtr image { Exiv2::ImageFactory::open(filename) };
assert(image.get() != 0);
image->readMetadata();

@@ -136,7 +138,7 @@ rs_exif_load_from_file(const gchar *filename)

exif_data_init(exif_data);
}
- catch (Exiv2::AnyError& e)
+ catch (Exiv2::Error& e)
{
g_warning("Could not load EXIF data from file %s", filename);
return NULL;
@@ -151,8 +153,8 @@ rs_exif_load_from_rawfile(RAWFILE *rawfile)
RS_EXIF_DATA *rs_exif_data;
try
{
- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(
- (const Exiv2::byte*) raw_get_map(rawfile), raw_get_filesize(rawfile));
+ Exiv2::Image::UniquePtr image { Exiv2::ImageFactory::open(
+ (const Exiv2::byte*) raw_get_map(rawfile), raw_get_filesize(rawfile)) };

assert(image.get() != 0);
image->readMetadata();
@@ -161,7 +163,7 @@ rs_exif_load_from_rawfile(RAWFILE *rawfile)

exif_data_init(rs_exif_data);
}
- catch (Exiv2::AnyError& e)
+ catch (Exiv2::Error& e)
{
g_warning("Could not load EXIF data");
return NULL;
@@ -179,7 +181,7 @@ rs_exif_add_to_file(RS_EXIF_DATA *d, Exiv2::IptcData &
try
{
Exiv2::ExifData *data = (Exiv2::ExifData *) d;
- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(filename);
+ Exiv2::Image::UniquePtr image { Exiv2::ImageFactory::open(filename) };

/* Copy EXIF to XMP */
#if EXIV2_TEST_VERSION(0,17,0)
@@ -194,7 +196,7 @@ rs_exif_add_to_file(RS_EXIF_DATA *d, Exiv2::IptcData &
image->setIptcData(iptc_data);
image->writeMetadata();
}
- catch (Exiv2::AnyError& e)
+ catch (Exiv2::Error& e)
{
g_warning("Couldn't add EXIF data to %s", filename);
}
@@ -263,7 +265,7 @@ rs_add_tags_exif(RS_EXIF_DATA *d, const gchar *input_f

glong items_written;
gunichar2 *w = g_utf8_to_utf16(xpkeyw->str, -1, NULL, &items_written, NULL);
- Exiv2::Value::AutoPtr v = Exiv2::Value::create(Exiv2::unsignedByte);
+ Exiv2::Value::UniquePtr v { Exiv2::Value::create(Exiv2::unsignedByte) };
v->read((const Exiv2::byte*)w, items_written * sizeof(gunichar2), Exiv2::invalidByteOrder);
Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.XPKeywords");
data->add(key, v.get());
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,42 @@
if (retval != 0)
{
RSIccProfile *icc = rs_icc_profile_new_from_memory((gchar*)icc_profile, icc_profile_size, TRUE);
@@ -151,7 +153,7 @@ jpeg_fail:
#endif

try {
- Image::AutoPtr img = ImageFactory::open(filename);
+ Image::UniquePtr img { ImageFactory::open(filename) };
img->readMetadata();
ExifData &exifData = img->exifData();
*linear_guess = FALSE;
@@ -169,13 +171,13 @@ jpeg_fail:
ExifData::const_iterator i;
i = exifData.findKey(ExifKey("Exif.Image.BitsPerSample"));
if (i != exifData.end())
- if (i->toLong() == 16)
+ if (i->toInt64() == 16)
*linear_guess = TRUE;

i = exifData.findKey(ExifKey("Exif.Photo.ColorSpace"));
if (i != exifData.end())
{
- if (i->toLong() == 1)
+ if (i->toInt64() == 1)
return rs_color_space_new_singleton("RSSrgb");
}

@@ -184,10 +186,10 @@ jpeg_fail:
if (i != exifData.end())
{
DataBuf buf(i->size());
- i->copy(buf.pData_, Exiv2::invalidByteOrder);
- if (buf.pData_ && buf.size_)
+ i->copy(buf.data(), Exiv2::invalidByteOrder);
+ if (buf.c_data() && buf.size())
{
- RSIccProfile *icc = rs_icc_profile_new_from_memory((gchar*)buf.pData_, buf.size_, TRUE);
+ RSIccProfile *icc = rs_icc_profile_new_from_memory((gchar*)buf.c_data(), buf.size(), TRUE);
return rs_color_space_icc_new_from_icc(icc);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,75 @@
#include <assert.h>
#include "exiv2-metadata.h"
#include <math.h>
@@ -94,7 +96,7 @@ gboolean
exiv2_load_meta_interface(const gchar *service, RAWFILE *rawfile, guint offset, RSMetadata *meta)
{
try {
- Image::AutoPtr img = ImageFactory::open((byte*)raw_get_map(rawfile), raw_get_filesize(rawfile));
+ Image::UniquePtr img { ImageFactory::open((byte*)raw_get_map(rawfile), raw_get_filesize(rawfile)) };
img->readMetadata();
ExifData &exifData = img->exifData();

@@ -121,7 +123,7 @@ exiv2_load_meta_interface(const gchar *service, RAWFIL
i = orientation(exifData);
if (i != exifData.end())
{
- switch (i->getValue()->toLong())
+ switch (i->getValue()->toInt64())
{
case 6: meta->orientation = 90;
break;
@@ -173,7 +175,7 @@ exiv2_load_meta_interface(const gchar *service, RAWFIL
#if EXIV2_TEST_VERSION(0,19,0)
i = isoSpeed(exifData);
if (i != exifData.end())
- meta->iso = i->toLong();
+ meta->iso = i->toInt64();

/* Text based Lens Identifier */
i = lensName(exifData);
@@ -181,7 +183,7 @@ exiv2_load_meta_interface(const gchar *service, RAWFIL
{
TypeId type = i->typeId();
if (type == unsignedShort || type == unsignedLong || type == signedShort || type == signedLong || type == unsignedByte || type == signedByte)
- meta->lens_id = i->toLong();
+ meta->lens_id = i->toInt64();
else if (type == asciiString || type == string)
meta->fixed_lens_identifier = g_strdup(i->toString().c_str());
}
@@ -223,7 +225,7 @@ exiv2_load_meta_interface(const gchar *service, RAWFIL
if (i == exifData.end())
i = exifData.findKey(ExifKey("Exif.NikonLd3.MinFocalLength"));
if (i != exifData.end())
- meta->lens_min_focal = 5.0 * pow(2.0, i->toLong()/24.0);
+ meta->lens_min_focal = 5.0 * pow(2.0, i->toInt64()/24.0);

i = exifData.findKey(ExifKey("Exif.NikonLd1.MaxFocalLength"));
if (i == exifData.end())
@@ -231,7 +233,7 @@ exiv2_load_meta_interface(const gchar *service, RAWFIL
if (i == exifData.end())
i = exifData.findKey(ExifKey("Exif.NikonLd3.MaxFocalLength"));
if (i != exifData.end())
- meta->lens_max_focal = 5.0 * pow(2.0, i->toLong()/24.0);
+ meta->lens_max_focal = 5.0 * pow(2.0, i->toInt64()/24.0);

i = exifData.findKey(ExifKey("Exif.NikonLd1.MaxApertureAtMinFocal"));
if (i == exifData.end())
@@ -239,7 +241,7 @@ exiv2_load_meta_interface(const gchar *service, RAWFIL
if (i == exifData.end())
i = exifData.findKey(ExifKey("Exif.NikonLd3.MaxApertureAtMinFocal"));
if (i != exifData.end())
- meta->lens_min_aperture = i->toLong()/12.0;
+ meta->lens_min_aperture = i->toInt64()/12.0;

i = exifData.findKey(ExifKey("Exif.NikonLd1.MaxApertureAtMaxFocal"));
if (i == exifData.end())
@@ -247,7 +249,7 @@ exiv2_load_meta_interface(const gchar *service, RAWFIL
if (i == exifData.end())
i = exifData.findKey(ExifKey("Exif.NikonLd3.MaxApertureAtMaxFocal"));
if (i != exifData.end())
- meta->lens_max_aperture = i->toLong()/12.0;
+ meta->lens_max_aperture = i->toInt64()/12.0;

/* Fuji */
i = exifData.findKey(ExifKey("Exif.Fujifilm.MinFocalLength"));

0 comments on commit 164a774

Please sign in to comment.