Changed class Entry to transform comment type on the fly. Fixes bug #445.
This commit is contained in:
parent
fd2b211222
commit
0398735e80
@ -119,6 +119,15 @@ namespace Exiv2 {
|
||||
return *this;
|
||||
} // Entry::operator=
|
||||
|
||||
uint16_t Entry::type() const
|
||||
{
|
||||
// Hack: On the fly type conversion for Exif.Photo.UserComment
|
||||
if (tag_ == 0x9286 && ifdId_ == exifIfdId && type_ == undefined) {
|
||||
return comment;
|
||||
}
|
||||
return type_;
|
||||
}
|
||||
|
||||
void Entry::setValue(uint32_t data, ByteOrder byteOrder)
|
||||
{
|
||||
if (pData_ == 0 || size_ < 4) {
|
||||
|
||||
@ -182,7 +182,7 @@ namespace Exiv2 {
|
||||
//! Return the tag
|
||||
uint16_t tag() const { return tag_; }
|
||||
//! Return the type id.
|
||||
uint16_t type() const { return type_; }
|
||||
uint16_t type() const;
|
||||
//! Return the name of the type
|
||||
const char* typeName() const
|
||||
{ return TypeInfo::typeName(TypeId(type_)); }
|
||||
|
||||
@ -204,10 +204,15 @@ void exifPrint(const ExifData& exifData)
|
||||
{
|
||||
ExifData::const_iterator i = exifData.begin();
|
||||
for (; i != exifData.end(); ++i) {
|
||||
std::cout << std::setw(53) << std::setfill(' ') << std::left
|
||||
std::cout << std::setw(44) << std::setfill(' ') << std::left
|
||||
<< i->key() << " "
|
||||
<< "0x" << std::setw(4) << std::setfill('0') << std::right
|
||||
<< std::hex << i->tag() << " "
|
||||
<< std::hex << i->tag() << " "
|
||||
<< std::setw(9) << std::setfill(' ') << std::left
|
||||
<< i->typeName() << " "
|
||||
<< std::dec << std::setw(3)
|
||||
<< std::setfill(' ') << std::right
|
||||
<< i->count() << " "
|
||||
<< std::dec << i->value()
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
@ -41,6 +41,11 @@ num=444
|
||||
filename=`prep_file $num`
|
||||
$binpath/exiv2 -pi $filename
|
||||
|
||||
num=445
|
||||
filename=`prep_file $num`
|
||||
$binpath/exiv2 -v -M'set Exif.Photo.UserComment A comment' $filename
|
||||
$binpath/exiv2 -pt $filename
|
||||
|
||||
) > $results 2>&1
|
||||
|
||||
diff -q $diffargs $results $good
|
||||
|
||||
@ -76,3 +76,128 @@ Iptc.Application2.SuppCategory String 8 portrait
|
||||
Iptc.Application2.Caption String 18 Witty caption here
|
||||
Iptc.Application2.Keywords String 3 ize
|
||||
Iptc.Application2.0x007b String 4 n123
|
||||
------> Bug 445 <-------
|
||||
File 1/1: exiv2-bug445.jpg
|
||||
Set Exif.Photo.UserComment "A comment" (Comment)
|
||||
Exif.Image.Make Ascii 6 Canon
|
||||
Exif.Image.Model Ascii 20 Canon PowerShot S40
|
||||
Exif.Image.Orientation Short 1 top, left
|
||||
Exif.Image.XResolution Rational 1 180
|
||||
Exif.Image.YResolution Rational 1 180
|
||||
Exif.Image.ResolutionUnit Short 1 inch
|
||||
Exif.Image.DateTime Ascii 20 2003:12:14 12:01:44
|
||||
Exif.Image.YCbCrPositioning Short 1 Centered
|
||||
Exif.Image.ExifTag Long 1 196
|
||||
Exif.Photo.ExposureTime Rational 1 1/500 s
|
||||
Exif.Photo.FNumber Rational 1 F4.9
|
||||
Exif.Photo.ExifVersion Undefined 4 48 50 50 48
|
||||
Exif.Photo.DateTimeOriginal Ascii 20 2003:12:14 12:01:44
|
||||
Exif.Photo.DateTimeDigitized Ascii 20 2003:12:14 12:01:44
|
||||
Exif.Photo.ComponentsConfiguration Undefined 4 YCbCr
|
||||
Exif.Photo.CompressedBitsPerPixel Rational 1 5
|
||||
Exif.Photo.ShutterSpeedValue SRational 1 1/501 s
|
||||
Exif.Photo.ApertureValue Rational 1 F5
|
||||
Exif.Photo.ExposureBiasValue SRational 1 0
|
||||
Exif.Photo.MaxApertureValue Rational 1 F2.8
|
||||
Exif.Photo.MeteringMode Short 1 Center weighted
|
||||
Exif.Photo.Flash Short 1 No, auto
|
||||
Exif.Photo.FocalLength Rational 1 21.3 mm
|
||||
Exif.Photo.UserComment Undefined 264 A comment
|
||||
Exif.Photo.FlashpixVersion Undefined 4 48 49 48 48
|
||||
Exif.Photo.ColorSpace Short 1 sRGB
|
||||
Exif.Photo.PixelXDimension Short 1 2272
|
||||
Exif.Photo.PixelYDimension Short 1 1704
|
||||
Exif.Photo.InteroperabilityTag Long 1 1416
|
||||
Exif.Photo.FocalPlaneXResolution Rational 1 8114.29
|
||||
Exif.Photo.FocalPlaneYResolution Rational 1 8114.29
|
||||
Exif.Photo.FocalPlaneResolutionUnit Short 1 inch
|
||||
Exif.Photo.SensingMethod Short 1 One-chip color area
|
||||
Exif.Photo.FileSource Undefined 1 Digital still camera
|
||||
Exif.Photo.CustomRendered Short 1 0
|
||||
Exif.Photo.ExposureMode Short 1 Auto
|
||||
Exif.Photo.WhiteBalance Short 1 Auto
|
||||
Exif.Photo.DigitalZoomRatio Rational 1 1.0
|
||||
Exif.Photo.SceneCaptureType Short 1 Standard
|
||||
Exif.Canon.0x0002 Short 4 2 682 286 215
|
||||
Exif.Canon.0x0003 Short 4 0 0 0 0
|
||||
Exif.Canon.0x0000 Short 6 0 0 0 0 0 0
|
||||
Exif.Canon.0x0000 Short 4 0 0 0 0
|
||||
Exif.Canon.ImageType Ascii 32 IMG:PowerShot S40 JPEG
|
||||
Exif.Canon.FirmwareVersion Ascii 24 Firmware Version 1.10
|
||||
Exif.Canon.ImageNumber Long 1 117-1771
|
||||
Exif.Canon.OwnerName Ascii 32 Andreas Huggel
|
||||
Exif.Canon.0x0010 Long 1 17891328
|
||||
Exif.Canon.0x000d Short 21 42 3 32769 378 32769 0 0 0 259 2 0 10 0 0 0 57 198 5 0 0 0
|
||||
Exif.CanonCs1.Macro Short 1 Off
|
||||
Exif.CanonCs1.Selftimer Short 1 Off
|
||||
Exif.CanonCs1.Quality Short 1 Superfine
|
||||
Exif.CanonCs1.FlashMode Short 1 Auto
|
||||
Exif.CanonCs1.DriveMode Short 1 Single / timer
|
||||
Exif.CanonCs1.0x0006 Short 1 0
|
||||
Exif.CanonCs1.FocusMode Short 1 Single
|
||||
Exif.CanonCs1.0x0008 Short 1 0
|
||||
Exif.CanonCs1.0x0009 Short 1 1
|
||||
Exif.CanonCs1.ImageSize Short 1 Large
|
||||
Exif.CanonCs1.EasyMode Short 1 Manual
|
||||
Exif.CanonCs1.DigitalZoom Short 1 None
|
||||
Exif.CanonCs1.Contrast Short 1 Normal
|
||||
Exif.CanonCs1.Saturation Short 1 Normal
|
||||
Exif.CanonCs1.Sharpness Short 1 Normal
|
||||
Exif.CanonCs1.ISOSpeed Short 1 100
|
||||
Exif.CanonCs1.MeteringMode Short 1 Center weighted
|
||||
Exif.CanonCs1.FocusType Short 1 Auto
|
||||
Exif.CanonCs1.AFPoint Short 1 Center
|
||||
Exif.CanonCs1.ExposureProgram Short 1 Program
|
||||
Exif.CanonCs1.0x0015 Short 1 65535
|
||||
Exif.CanonCs1.0x0016 Short 1 65535
|
||||
Exif.CanonCs1.Lens Short 3 7.1 - 21.3 mm
|
||||
Exif.CanonCs1.0x001a Short 1 149
|
||||
Exif.CanonCs1.0x001b Short 1 192
|
||||
Exif.CanonCs1.FlashActivity Short 1 Did not fire
|
||||
Exif.CanonCs1.FlashDetails Short 1
|
||||
Exif.CanonCs1.0x001e Short 1 0
|
||||
Exif.CanonCs1.0x001f Short 1 0
|
||||
Exif.CanonCs1.FocusMode Short 1 Single
|
||||
Exif.CanonCs1.0x0021 Short 1 0
|
||||
Exif.CanonCs1.0x0022 Short 1 65535
|
||||
Exif.CanonCs1.0x0023 Short 1 49
|
||||
Exif.CanonCs1.0x0024 Short 1 2272
|
||||
Exif.CanonCs1.0x0025 Short 1 2272
|
||||
Exif.CanonCs1.0x0026 Short 1 0
|
||||
Exif.CanonCs1.0x0027 Short 1 1
|
||||
Exif.CanonCs2.0x0001 Short 1 0
|
||||
Exif.CanonCs2.ISOSpeed Short 1 100
|
||||
Exif.CanonCs2.0x0003 Short 1 276
|
||||
Exif.CanonCs2.TargetAperture Short 1 F5
|
||||
Exif.CanonCs2.TargetShutterSpeed Short 1 1/501 s
|
||||
Exif.CanonCs2.0x0006 Short 1 0
|
||||
Exif.CanonCs2.WhiteBalance Short 1 Auto
|
||||
Exif.CanonCs2.0x0008 Short 1 0
|
||||
Exif.CanonCs2.Sequence Short 1 0
|
||||
Exif.CanonCs2.0x000a Short 1 6
|
||||
Exif.CanonCs2.0x000b Short 1 0
|
||||
Exif.CanonCs2.0x000c Short 1 0
|
||||
Exif.CanonCs2.0x000d Short 1 0
|
||||
Exif.CanonCs2.AFPointUsed Short 1 3 focus points; center used
|
||||
Exif.CanonCs2.FlashBias Short 1 0 EV
|
||||
Exif.CanonCs2.0x0010 Short 1 0
|
||||
Exif.CanonCs2.0x0011 Short 1 0
|
||||
Exif.CanonCs2.0x0012 Short 1 1
|
||||
Exif.CanonCs2.SubjectDistance Short 1 782
|
||||
Exif.CanonCs2.0x0014 Short 1 0
|
||||
Exif.CanonCs2.ApertureValue Short 1 F5
|
||||
Exif.CanonCs2.ShutterSpeedValue Short 1 1/523 s
|
||||
Exif.CanonCs2.0x0017 Short 1 0
|
||||
Exif.CanonCs2.0x0018 Short 1 0
|
||||
Exif.CanonCs2.0x0019 Short 1 0
|
||||
Exif.CanonCs2.0x001a Short 1 250
|
||||
Exif.Iop.InteroperabilityIndex Ascii 4 R98
|
||||
Exif.Iop.InteroperabilityVersion Undefined 4 48 49 48 48
|
||||
Exif.Iop.RelatedImageWidth Short 1 2272
|
||||
Exif.Iop.RelatedImageLength Short 1 1704
|
||||
Exif.Thumbnail.Compression Short 1 JPEG
|
||||
Exif.Thumbnail.XResolution Rational 1 180
|
||||
Exif.Thumbnail.YResolution Rational 1 180
|
||||
Exif.Thumbnail.ResolutionUnit Short 1 inch
|
||||
Exif.Thumbnail.JPEGInterchangeFormat Long 1 0
|
||||
Exif.Thumbnail.JPEGInterchangeFormatLength Long 1 5448
|
||||
|
||||
@ -189,7 +189,7 @@ Exif.Photo.MaxApertureValue 0x9205 Exif Rational 1
|
||||
Exif.Photo.MeteringMode 0x9207 Exif Short 1 1
|
||||
Exif.Photo.Flash 0x9209 Exif Short 1 24
|
||||
Exif.Photo.FocalLength 0x920a Exif Rational 1 682/32
|
||||
Exif.Photo.UserComment 0x9286 Exif Undefined 264 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
Exif.Photo.UserComment 0x9286 Exif Undefined 264 | ||||