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" | ||
23 | 22 | | |||
24 | #include <kis_meta_data_store.h> | 23 | #include <kis_meta_data_store.h> | ||
25 | #include <kis_meta_data_entry.h> | 24 | #include <kis_meta_data_entry.h> | ||
26 | #include <kis_meta_data_parser.h> | 25 | #include <kis_meta_data_parser.h> | ||
27 | #include <kis_meta_data_value.h> | 26 | #include <kis_meta_data_value.h> | ||
pino: considering that kis_exiv2.h now includes exiv2/exiv2.hpp, and that exiv2/exiv2.hpp includes… | |||||
asturmlechner: hm, indeed | |||||
28 | #include <kis_meta_data_schema.h> | 27 | #include <kis_meta_data_schema.h> | ||
29 | #include <kis_meta_data_schema_registry.h> | 28 | #include <kis_meta_data_schema_registry.h> | ||
30 | #include <kis_meta_data_type_info.h> | 29 | #include <kis_meta_data_type_info.h> | ||
31 | 30 | | |||
32 | #include <kis_debug.h> | 31 | #include <kis_debug.h> | ||
33 | 32 | | |||
34 | KisXMPIO::KisXMPIO() | 33 | KisXMPIO::KisXMPIO() | ||
35 | { | 34 | { | ||
▲ Show 20 Lines • Show All 236 Lines • ▼ Show 20 Line(s) | 265 | if (value->typeId() == Exiv2::xmpBag | |||
272 | } | 271 | } | ||
273 | const KisMetaData::Parser* parser = 0; | 272 | const KisMetaData::Parser* parser = 0; | ||
274 | if (embeddedTypeInfo) { | 273 | if (embeddedTypeInfo) { | ||
275 | parser = embeddedTypeInfo->parser(); | 274 | parser = embeddedTypeInfo->parser(); | ||
276 | } | 275 | } | ||
277 | const Exiv2::XmpArrayValue* xav = dynamic_cast<const Exiv2::XmpArrayValue*>(value.get()); | 276 | const Exiv2::XmpArrayValue* xav = dynamic_cast<const Exiv2::XmpArrayValue*>(value.get()); | ||
278 | Q_ASSERT(xav); | 277 | Q_ASSERT(xav); | ||
279 | QList<KisMetaData::Value> array; | 278 | QList<KisMetaData::Value> array; | ||
280 | for (std::vector< std::string >::const_iterator it = xav->value_.begin(); | 279 | for (int i = 0; i < xav->size(); ++i) { | ||
281 | it != xav->value_.end(); ++it) { | 280 | QString value = QString::fromStdString(xav->toString(i)); | ||
pino: the == here seems wrong, as it will execute the code of the loop only once | |||||
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… | |||||
282 | QString value = it->c_str(); | | |||
283 | if (parser) { | 281 | if (parser) { | ||
284 | array.push_back(parser->parse(value)); | 282 | array.push_back(parser->parse(value)); | ||
285 | } else { | 283 | } else { | ||
286 | dbgImage << "No parser " << tagName; | 284 | dbgImage << "No parser " << tagName; | ||
287 | array.push_back(KisMetaData::Value(value)); | 285 | array.push_back(KisMetaData::Value(value)); | ||
288 | } | 286 | } | ||
289 | } | 287 | } | ||
290 | KisMetaData::Value::ValueType vt = KisMetaData::Value::Invalid; | 288 | 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?