Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/kisexiv2/kis_xmp_io.cpp
Show All 11 Lines | |||||
12 | * | 12 | * | ||
13 | * You should have received a copy of the GNU Lesser General Public License | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
14 | * along with this program; if not, write to the Free Software | 14 | * along with this program; if not, write to the Free Software | ||
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
16 | */ | 16 | */ | ||
17 | #include "kis_xmp_io.h" | 17 | #include "kis_xmp_io.h" | ||
18 | 18 | | |||
19 | #include <string> | 19 | #include <string> | ||
20 | #include <exiv2/xmp.hpp> | | |||
21 | 20 | | |||
22 | #include "kis_exiv2.h" | 21 | #include "kis_exiv2.h" | ||
22 | #if EXIV2_TEST_VERSION(0,27,0) | ||||
23 | #include <exiv2/xmp_exiv2.hpp> | ||||
24 | #else | ||||
25 | #include <exiv2/xmp.hpp> | ||||
26 | #endif | ||||
pino: considering that kis_exiv2.h now includes exiv2/exiv2.hpp, and that exiv2/exiv2.hpp includes… | |||||
asturmlechner: hm, indeed | |||||
23 | 27 | | |||
24 | #include <kis_meta_data_store.h> | 28 | #include <kis_meta_data_store.h> | ||
25 | #include <kis_meta_data_entry.h> | 29 | #include <kis_meta_data_entry.h> | ||
26 | #include <kis_meta_data_parser.h> | 30 | #include <kis_meta_data_parser.h> | ||
27 | #include <kis_meta_data_value.h> | 31 | #include <kis_meta_data_value.h> | ||
28 | #include <kis_meta_data_schema.h> | 32 | #include <kis_meta_data_schema.h> | ||
29 | #include <kis_meta_data_schema_registry.h> | 33 | #include <kis_meta_data_schema_registry.h> | ||
30 | #include <kis_meta_data_type_info.h> | 34 | #include <kis_meta_data_type_info.h> | ||
▲ Show 20 Lines • Show All 241 Lines • ▼ Show 20 Line(s) | 270 | if (value->typeId() == Exiv2::xmpBag | |||
272 | } | 276 | } | ||
273 | const KisMetaData::Parser* parser = 0; | 277 | const KisMetaData::Parser* parser = 0; | ||
274 | if (embeddedTypeInfo) { | 278 | if (embeddedTypeInfo) { | ||
275 | parser = embeddedTypeInfo->parser(); | 279 | parser = embeddedTypeInfo->parser(); | ||
276 | } | 280 | } | ||
277 | const Exiv2::XmpArrayValue* xav = dynamic_cast<const Exiv2::XmpArrayValue*>(value.get()); | 281 | const Exiv2::XmpArrayValue* xav = dynamic_cast<const Exiv2::XmpArrayValue*>(value.get()); | ||
278 | Q_ASSERT(xav); | 282 | Q_ASSERT(xav); | ||
279 | QList<KisMetaData::Value> array; | 283 | QList<KisMetaData::Value> array; | ||
280 | for (std::vector< std::string >::const_iterator it = xav->value_.begin(); | 284 | for (int i = 0; i <= xav->size(); ++i) { | ||
pino: should it be just < now? | |||||
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), wbauer: This causes krita to crash here when opening certain jpg files (with XMP tags).
I think it… | |||||
281 | it != xav->value_.end(); ++it) { | 285 | QString value = QString::fromStdString(xav->toString(i)); | ||
pino: the == here seems wrong, as it will execute the code of the loop only once | |||||
282 | QString value = it->c_str(); | | |||
283 | if (parser) { | 286 | if (parser) { | ||
284 | array.push_back(parser->parse(value)); | 287 | array.push_back(parser->parse(value)); | ||
285 | } else { | 288 | } else { | ||
286 | dbgImage << "No parser " << tagName; | 289 | dbgImage << "No parser " << tagName; | ||
287 | array.push_back(KisMetaData::Value(value)); | 290 | array.push_back(KisMetaData::Value(value)); | ||
288 | } | 291 | } | ||
289 | } | 292 | } | ||
290 | KisMetaData::Value::ValueType vt = KisMetaData::Value::Invalid; | 293 | KisMetaData::Value::ValueType vt = KisMetaData::Value::Invalid; | ||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |
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?