From 0279962aa28ece6f20ed04d59f3cfa50dc557758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Komar=C4=8Devi=C4=87?= Date: Tue, 8 Aug 2023 13:23:40 +0200 Subject: [PATCH] Add basic UTF-8 type --- include/exiv2/types.hpp | 1 + src/image.cpp | 5 ++++- src/types.cpp | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/exiv2/types.hpp b/include/exiv2/types.hpp index 75904ce35b..edbf72352e 100644 --- a/include/exiv2/types.hpp +++ b/include/exiv2/types.hpp @@ -84,6 +84,7 @@ enum TypeId { unsignedLongLong = 16, //!< Exif LONG LONG type, 64-bit (8-byte) unsigned integer. signedLongLong = 17, //!< Exif LONG LONG type, 64-bit (8-byte) signed integer. tiffIfd8 = 18, //!< TIFF IFD type, 64-bit (8-byte) unsigned integer. + utf8String = 129, //!< Exif UTF-8 type, 8-bit byte. string = 0x10000, //!< IPTC string type. date = 0x10001, //!< IPTC date type. time = 0x10002, //!< IPTC time type. diff --git a/src/image.cpp b/src/image.cpp index f3c8e03bd2..a7e84f1f1c 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -141,7 +141,7 @@ void Image::printStructure(std::ostream&, PrintStructureOption, size_t /*depth*/ bool Image::isStringType(uint16_t type) { return type == Exiv2::asciiString || type == Exiv2::unsignedByte || type == Exiv2::signedByte || - type == Exiv2::undefined; + type == Exiv2::undefined || type == Exiv2::utf8String; } bool Image::isShortType(uint16_t type) { return type == Exiv2::unsignedShort || type == Exiv2::signedShort; @@ -314,6 +314,9 @@ const char* Image::typeName(uint16_t tag) { case Exiv2::tiffIfd: result = "IFD"; break; + case Exiv2::utf8String: + result = "UTF-8"; + break; default: result = "unknown"; break; diff --git a/src/types.cpp b/src/types.cpp index 1c6963cda4..e60a7c7a81 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -51,6 +51,7 @@ constexpr struct TypeInfoTable { {Exiv2::tiffFloat, "Float", 4}, {Exiv2::tiffDouble, "Double", 8}, {Exiv2::tiffIfd, "Ifd", 4}, + {Exiv2::utf8String, "Utf-8", 1}, {Exiv2::string, "String", 1}, {Exiv2::date, "Date", 8}, {Exiv2::time, "Time", 11},