This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* RawTherapee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* RawTherapee is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* RawTherapee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* RawTherapee is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <png.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <imageio.h>
|
||||
@@ -36,6 +36,8 @@ extern "C" {
|
||||
#include <iptcpairs.h>
|
||||
#include <libiptcdata/iptc-jpeg.h>
|
||||
|
||||
Glib::ustring safe_locale_to_utf8 (const std::string& src);
|
||||
|
||||
using namespace rtengine;
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
@@ -81,7 +83,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const std::vector<
|
||||
for (int j=0; j<iptcc[i].values.size(); j++) {
|
||||
IptcDataSet * ds = iptc_dataset_new ();
|
||||
iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, IPTC_TAG_KEYWORDS);
|
||||
std::string loc = Glib::locale_from_utf8(iptcc[i].values[j]);
|
||||
std::string loc = safe_locale_to_utf8(iptcc[i].values[j]);
|
||||
iptc_dataset_set_data (ds, (unsigned char*)loc.c_str(), MIN(64,loc.size()), IPTC_DONT_VALIDATE);
|
||||
iptc_data_add_dataset (iptc, ds);
|
||||
iptc_dataset_unref (ds);
|
||||
@@ -92,7 +94,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const std::vector<
|
||||
for (int j=0; j<iptcc[i].values.size(); j++) {
|
||||
IptcDataSet * ds = iptc_dataset_new ();
|
||||
iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, IPTC_TAG_SUPPL_CATEGORY);
|
||||
std::string loc = Glib::locale_from_utf8(iptcc[i].values[j]);
|
||||
std::string loc = safe_locale_to_utf8(iptcc[i].values[j]);
|
||||
iptc_dataset_set_data (ds, (unsigned char*)loc.c_str(), MIN(32,loc.size()), IPTC_DONT_VALIDATE);
|
||||
iptc_data_add_dataset (iptc, ds);
|
||||
iptc_dataset_unref (ds);
|
||||
@@ -103,7 +105,7 @@ void ImageIO::setMetadata (const rtexif::TagDirectory* eroot, const std::vector<
|
||||
if (iptcc[i].field == strTags[j].field && iptcc[i].values.size()>0) {
|
||||
IptcDataSet * ds = iptc_dataset_new ();
|
||||
iptc_dataset_set_tag (ds, IPTC_RECORD_APP_2, strTags[j].tag);
|
||||
std::string loc = Glib::locale_from_utf8(iptcc[i].values[0]);
|
||||
std::string loc = safe_locale_to_utf8(iptcc[i].values[0]);
|
||||
iptc_dataset_set_data (ds, (unsigned char*)loc.c_str(), MIN(strTags[j].size,loc.size()), IPTC_DONT_VALIDATE);
|
||||
iptc_data_add_dataset (iptc, ds);
|
||||
iptc_dataset_unref (ds);
|
||||
@@ -151,7 +153,7 @@ int ImageIO::loadPNG (Glib::ustring fname) {
|
||||
//reading PNG header
|
||||
unsigned char header[8];
|
||||
fread (header, 1, 8, file);
|
||||
if (!png_check_sig (header, 8)) {
|
||||
if (!png_sig_cmp (header, 0, 8)) {
|
||||
fclose(file);
|
||||
return IMIO_HEADERERROR;
|
||||
}
|
||||
@@ -184,7 +186,7 @@ int ImageIO::loadPNG (Glib::ustring fname) {
|
||||
embProfile = NULL;
|
||||
|
||||
//retrieving image information
|
||||
unsigned long width,height;
|
||||
png_uint_32 width,height;
|
||||
int bit_depth,color_type,interlace_type,compression_type,filter_method;
|
||||
png_get_IHDR(png,info,&width,&height,&bit_depth,&color_type,&interlace_type,
|
||||
&compression_type, &filter_method);
|
||||
|
Reference in New Issue
Block a user