#876: Reverted changes made with r2966, r2976 and r2973 and added a fix to only output characters up to the first \0 in ASCII values.
This commit is contained in:
parent
5bfddd927f
commit
8e325e1c32
@ -43,7 +43,7 @@ Changes from version 0.23 to 0.24
|
||||
(Jaroslav Stepanek)
|
||||
- 0000875: New lens "Tamron SP 24-70mm F/2.8 Di VC USD"
|
||||
(Reported by Jean-Pierre Verrue, patch by Niels Kristian Bech Jensen)
|
||||
!->#839 - 0000876: New lens: Canon EF 35mm f/2 IS USM
|
||||
- 0000876: New lens: Canon EF 35mm f/2 IS USM
|
||||
(markus kanet, Robin Mills)
|
||||
- 0000877: New camera: Canon EOS 6D
|
||||
(markus kanet)
|
||||
@ -69,7 +69,7 @@ Changes from version 0.23 to 0.24
|
||||
(Reported by Christian Roumano, patch by Aakash Goenka)
|
||||
- 0000896: User-readable output of Olympus' FocusDistance
|
||||
(Patch by Teemu Rytilahti)
|
||||
!-> - 0000897: New Compilation Warnings
|
||||
- 0000897: New Compilation Warnings
|
||||
- 0000899: New lens: Pentax smc DA 18-135mm f/3.5-5.6 ED AL [IF] DC WR
|
||||
(Reported by Matthieu Volat, patch by Pascal de Bruijn)
|
||||
- 0000903: New Lens: Canon EF-S 55-250mm f/4-5.6 IS II
|
||||
|
||||
@ -280,7 +280,6 @@ namespace Exiv2 {
|
||||
buf.pData_[0] = 0x4d;
|
||||
buf.pData_[1] = 0x4d;
|
||||
break;
|
||||
case asciiBytes:
|
||||
case invalidByteOrder:
|
||||
assert(false);
|
||||
break;
|
||||
|
||||
@ -277,7 +277,6 @@ namespace Exiv2 {
|
||||
buf.pData_[0] = 0x4d;
|
||||
buf.pData_[1] = 0x4d;
|
||||
break;
|
||||
case asciiBytes:
|
||||
case invalidByteOrder:
|
||||
assert(false);
|
||||
break;
|
||||
|
||||
@ -2030,7 +2030,6 @@ namespace Exiv2 {
|
||||
buf.pData_[0] = 0x4d;
|
||||
buf.pData_[1] = 0x4d;
|
||||
break;
|
||||
case asciiBytes:
|
||||
case invalidByteOrder:
|
||||
assert(false);
|
||||
break;
|
||||
@ -2050,7 +2049,6 @@ namespace Exiv2 {
|
||||
switch (byteOrder_) {
|
||||
case littleEndian: os << ", " << _("little endian encoded"); break;
|
||||
case bigEndian: os << ", " << _("big endian encoded"); break;
|
||||
case asciiBytes : break;
|
||||
case invalidByteOrder: break;
|
||||
}
|
||||
os << "\n";
|
||||
|
||||
@ -363,7 +363,6 @@ namespace Exiv2 {
|
||||
case bigEndian:
|
||||
exifData_["Exif.MakerNote.ByteOrder"] = "MM";
|
||||
break;
|
||||
case asciiBytes:
|
||||
case invalidByteOrder:
|
||||
assert(object->byteOrder() != invalidByteOrder);
|
||||
break;
|
||||
@ -1529,12 +1528,7 @@ namespace Exiv2 {
|
||||
}
|
||||
Value::AutoPtr v = Value::create(typeId);
|
||||
assert(v.get());
|
||||
// http://dev.exiv2.org/issues/876
|
||||
// Exif.Canon.LensModel allocates additional bytes in the file following the null terminator
|
||||
int group = object->group();
|
||||
int tag = object->tag();
|
||||
bool bCanonAscii = canonId == group && tag == 0x0095 && typeId == ttAsciiString ;
|
||||
v->read(pData, size, bCanonAscii ? asciiBytes : byteOrder());
|
||||
v->read(pData, size, byteOrder());
|
||||
|
||||
object->setValue(v);
|
||||
object->setData(pData, size);
|
||||
|
||||
@ -101,7 +101,7 @@ namespace Exiv2 {
|
||||
typedef std::pair<int32_t, int32_t> Rational;
|
||||
|
||||
//! Type to express the byte order (little or big endian)
|
||||
enum ByteOrder { invalidByteOrder, littleEndian, bigEndian,asciiBytes };
|
||||
enum ByteOrder { invalidByteOrder, littleEndian, bigEndian };
|
||||
|
||||
//! Type to indicate write method used by TIFF parsers
|
||||
enum WriteMethod { wmIntrusive, wmNonIntrusive };
|
||||
|
||||
@ -296,16 +296,10 @@ namespace Exiv2 {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int StringValueBase::read(const byte* buf, long len, ByteOrder byteOrder)
|
||||
int StringValueBase::read(const byte* buf, long len, ByteOrder /*byteOrder*/)
|
||||
{
|
||||
// byteOrder not needed
|
||||
if (buf) value_ = std::string(reinterpret_cast<const char*>(buf), len);
|
||||
|
||||
if ( byteOrder == asciiBytes ) {
|
||||
size_t nullByte = value_.find('\0');
|
||||
if ( nullByte != std::string::npos && nullByte > 0 && (nullByte+1) < (size_t)len ) {
|
||||
value_ = std::string(reinterpret_cast<const char*>(buf), nullByte);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -399,9 +393,10 @@ namespace Exiv2 {
|
||||
|
||||
std::ostream& AsciiValue::write(std::ostream& os) const
|
||||
{
|
||||
// Strip all trailing '\0's (if any)
|
||||
std::string::size_type pos = value_.find_last_not_of('\0');
|
||||
return os << value_.substr(0, pos + 1);
|
||||
// Write only up to the first '\0' (if any)
|
||||
std::string::size_type pos = value_.find_first_of('\0');
|
||||
if (pos == std::string::npos) pos = value_.size();
|
||||
return os << value_.substr(0, pos);
|
||||
}
|
||||
|
||||
CommentValue::CharsetTable::CharsetTable(CharsetId charsetId,
|
||||
|
||||
@ -493,9 +493,9 @@ namespace Exiv2 {
|
||||
//@{
|
||||
AutoPtr clone() const { return AutoPtr(clone_()); }
|
||||
/*!
|
||||
@brief Write the value to an output stream. Any trailing '\\0'
|
||||
characters of the ASCII value are stripped and not written to
|
||||
the output stream.
|
||||
@brief Write the ASCII value up to the the first '\\0' character to an
|
||||
output stream. Any further characters are ignored and not
|
||||
written to the output stream.
|
||||
*/
|
||||
virtual std::ostream& write(std::ostream& os) const;
|
||||
//@}
|
||||
|
||||
Binary file not shown.
@ -1723,7 +1723,7 @@ Error: Directory Canon: Next pointer is out of bounds; ignored.
|
||||
20060802_095200.jpg Exif.CanonSi.0x0021 Short 1 0
|
||||
20060802_095200.jpg Exif.Canon.ImageType Ascii 32 Canon EOS 20D
|
||||
20060802_095200.jpg Exif.Canon.FirmwareVersion Ascii 32 Firmware 2.0.3
|
||||
20060802_095200.jpg Exif.Canon.OwnerName Ascii 32 unknown | ||||