#662: Fixes by Leo Sutic. Added carriage return to the special characters.

v0.27.3
Andreas Huggel 16 years ago
parent d3068c8c69
commit 942d217e89

@ -625,7 +625,7 @@ namespace Action {
&& ( md.typeId() == Exiv2::undefined && ( md.typeId() == Exiv2::undefined
|| md.typeId() == Exiv2::unsignedByte || md.typeId() == Exiv2::unsignedByte
|| md.typeId() == Exiv2::signedByte) || md.typeId() == Exiv2::signedByte)
&& md.size() > 100) { && md.size() > 128) {
std::cout << _("(Binary value suppressed)") << std::endl; std::cout << _("(Binary value suppressed)") << std::endl;
return; return;
} }
@ -638,7 +638,7 @@ namespace Action {
&& ( md.typeId() == Exiv2::undefined && ( md.typeId() == Exiv2::undefined
|| md.typeId() == Exiv2::unsignedByte || md.typeId() == Exiv2::unsignedByte
|| md.typeId() == Exiv2::signedByte) || md.typeId() == Exiv2::signedByte)
&& md.size() > 100) { && md.size() > 128) {
std::cout << _("(Binary value suppressed)") << std::endl; std::cout << _("(Binary value suppressed)") << std::endl;
return; return;
} }
@ -651,7 +651,7 @@ namespace Action {
&& ( md.typeId() == Exiv2::undefined && ( md.typeId() == Exiv2::undefined
|| md.typeId() == Exiv2::unsignedByte || md.typeId() == Exiv2::unsignedByte
|| md.typeId() == Exiv2::signedByte) || md.typeId() == Exiv2::signedByte)
&& md.size() > 100) { && md.size() > 128) {
std::cout << _("(Binary value suppressed)") << std::endl; std::cout << _("(Binary value suppressed)") << std::endl;
return; return;
} }

@ -1325,7 +1325,6 @@ namespace Exiv2 {
std::string outstr; std::string outstr;
EXV_ICONV_CONST char *inptr = const_cast<char *>(str.c_str()); EXV_ICONV_CONST char *inptr = const_cast<char *>(str.c_str());
size_t inbytesleft = str.length(); size_t inbytesleft = str.length();
int outbytesProduced = 0;
while (inbytesleft) { while (inbytesleft) {
char outbuf[100]; char outbuf[100];
char *outptr = outbuf; char *outptr = outbuf;
@ -1335,7 +1334,7 @@ namespace Exiv2 {
&inbytesleft, &inbytesleft,
&outptr, &outptr,
&outbytesleft); &outbytesleft);
outbytesProduced += sizeof(outbuf) - 1 - outbytesleft; int outbytesProduced = sizeof(outbuf) - 1 - outbytesleft;
if (rc == size_t(-1) && errno != E2BIG) { if (rc == size_t(-1) && errno != E2BIG) {
#ifndef SUPPRESS_WARNINGS #ifndef SUPPRESS_WARNINGS
std::cerr << "Warning: iconv: " std::cerr << "Warning: iconv: "

@ -1131,23 +1131,19 @@ namespace {
++i; ++i;
ch = input[i]; ch = input[i];
switch (ch) { switch (ch) {
// Escaping of backslash case '\\': // Escaping of backslash
case '\\':
result.push_back('\\'); result.push_back('\\');
break; break;
case 'r': // Escaping of carriage return
// Escaping of newline result.push_back('\r');
case 'n': break;
case 'n': // Escaping of newline
result.push_back('\n'); result.push_back('\n');
break; break;
case 't': // Escaping of tab
// Escaping of tab
case 't':
result.push_back('\t'); result.push_back('\t');
break; break;
case 'u': // Escaping of unicode
// Escaping of unicode
case 'u':
if (input.length() - 4 > i) { if (input.length() - 4 > i) {
int acc = 0; int acc = 0;
for (int j = 0; j < 4; ++j) { for (int j = 0; j < 4; ++j) {
@ -1186,7 +1182,6 @@ namespace {
result.push_back(ch); result.push_back(ch);
} }
break; break;
default: default:
result.push_back('\\'); result.push_back('\\');
result.push_back(ch); result.push_back(ch);

@ -2515,17 +2515,14 @@ namespace Exiv2 {
return os; return os;
} }
// Todo: Implement this properly
std::ostream& print0x9286(std::ostream& os, const Value& value, const ExifData*) std::ostream& print0x9286(std::ostream& os, const Value& value, const ExifData*)
{ {
if (value.size() > 8) { const CommentValue* pcv = dynamic_cast<const CommentValue*>(&value);
DataBuf buf(value.size()); if (pcv) {
value.copy(buf.pData_, bigEndian); os << pcv->value_;
// Hack: Skip the leading 8-Byte character code, truncate }
// trailing '\0's and let the stream take care of the remainder else {
std::string userComment(reinterpret_cast<char*>(buf.pData_) + 8, buf.size_ - 8); os << value;
std::string::size_type pos = userComment.find_last_not_of('\0');
os << userComment.substr(0, pos + 1);
} }
return os; return os;
} }

@ -217,7 +217,7 @@ $exiv2 -pi v.jpg
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Evaluate results # Evaluate results
cat $results | sed 's/\x0d$//' > $results-stripped cat $results | sed 's/\x0d$//' | tr '\033' '$' > $results-stripped
diff -q $results-stripped $good diff -q $results-stripped $good
rc=$? rc=$?
if [ $rc -eq 0 ] ; then if [ $rc -eq 0 ] ; then

Binary file not shown.

@ -3,21 +3,21 @@ Testcase 1
Xmp.dc.description LangAlt 1 lang="x-default" The Exif image description Xmp.dc.description LangAlt 1 lang="x-default" The Exif image description
Exif.Image.ImageDescription Ascii 27 The Exif image description Exif.Image.ImageDescription Ascii 27 The Exif image description
Iptc.Application2.Caption String 26 The Exif image description Iptc.Application2.Caption String 26 The Exif image description
Iptc.Envelope.CharacterSet String 3 %G Iptc.Envelope.CharacterSet String 3 $%G
Testcase 2 Testcase 2
========== ==========
Xmp.dc.description LangAlt 1 lang="x-default" The Exif image description Xmp.dc.description LangAlt 1 lang="x-default" The Exif image description
Exif.Image.ImageDescription Ascii 27 The Exif image description Exif.Image.ImageDescription Ascii 27 The Exif image description
Iptc.Application2.Caption String 26 The Exif image description Iptc.Application2.Caption String 26 The Exif image description
Iptc.Envelope.CharacterSet String 3 %G Iptc.Envelope.CharacterSet String 3 $%G
Testcase 3 Testcase 3
========== ==========
Xmp.dc.description LangAlt 1 lang="de-DE" The Exif image description Xmp.dc.description LangAlt 1 lang="de-DE" The Exif image description
Exif.Image.ImageDescription Ascii 27 The Exif image description Exif.Image.ImageDescription Ascii 27 The Exif image description
Iptc.Application2.Caption String 26 The Exif image description Iptc.Application2.Caption String 26 The Exif image description
Iptc.Envelope.CharacterSet String 3 %G Iptc.Envelope.CharacterSet String 3 $%G
Testcase 4 Testcase 4
========== ==========
@ -37,14 +37,14 @@ Warning: Failed to convert Xmp.dc.description to Exif.Image.ImageDescription
Xmp.dc.description LangAlt 3 lang="x-default" How to fix this mess, lang="de-DE" The Exif image description, lang="it-IT" Ciao bella Xmp.dc.description LangAlt 3 lang="x-default" How to fix this mess, lang="de-DE" The Exif image description, lang="it-IT" Ciao bella
Exif.Image.ImageDescription Ascii 21 How to fix this mess Exif.Image.ImageDescription Ascii 21 How to fix this mess
Iptc.Application2.Caption String 20 How to fix this mess Iptc.Application2.Caption String 20 How to fix this mess
Iptc.Envelope.CharacterSet String 3 %G Iptc.Envelope.CharacterSet String 3 $%G
Testcase 6 Testcase 6
========== ==========
Exif.Image.ExifTag Long 1 26 Exif.Image.ExifTag Long 1 26
Exif.Photo.UserComment Undefined 59 charset="Jis" This is a JIS encoded Exif user comment. Or was it? Exif.Photo.UserComment Undefined 59 charset="Jis" This is a JIS encoded Exif user comment. Or was it?
Xmp.exif.UserComment LangAlt 1 lang="x-default" This is a JIS encoded Exif user comment. Or was it? Xmp.exif.UserComment LangAlt 1 lang="x-default" This is a JIS encoded Exif user comment. Or was it?
Exif.Photo.UserComment Undefined 59 charset="Unicode" This is a JIS encoded Exif user comment. Or was it? Exif.Photo.UserComment Undefined 110 charset="Unicode" This is a JIS encoded Exif user comment. Or was it?
File 1/1: m.xmp File 1/1: m.xmp
m.xmp: No IPTC data found in the file m.xmp: No IPTC data found in the file
@ -52,7 +52,7 @@ Testcase 7
========== ==========
Xmp.exif.UserComment LangAlt 1 lang="x-default" This is a JIS encoded Exif user comment. Or was it? Xmp.exif.UserComment LangAlt 1 lang="x-default" This is a JIS encoded Exif user comment. Or was it?
Exif.Image.ExifTag Long 1 26 Exif.Image.ExifTag Long 1 26
Exif.Photo.UserComment Undefined 59 charset="Unicode" This is a JIS encoded Exif user comment. Or was it? Exif.Photo.UserComment Undefined 110 charset="Unicode" This is a JIS encoded Exif user comment. Or was it?
File 1/1: n.jpg File 1/1: n.jpg
n.jpg: No IPTC data found in the file n.jpg: No IPTC data found in the file
@ -67,7 +67,7 @@ o.xmp: No Exif data found in the file
Iptc.Application2.Keywords String 3 Sex Iptc.Application2.Keywords String 3 Sex
Iptc.Application2.Keywords String 5 Drugs Iptc.Application2.Keywords String 5 Drugs
Iptc.Application2.Keywords String 11 Rock'n'roll Iptc.Application2.Keywords String 11 Rock'n'roll
Iptc.Envelope.CharacterSet String 3 %G Iptc.Envelope.CharacterSet String 3 $%G
Testcase 9 Testcase 9
========== ==========
@ -77,7 +77,7 @@ p.jpg: No Exif data found in the file
Iptc.Application2.Keywords String 3 Sex Iptc.Application2.Keywords String 3 Sex
Iptc.Application2.Keywords String 5 Drugs Iptc.Application2.Keywords String 5 Drugs
Iptc.Application2.Keywords String 11 Rock'n'roll Iptc.Application2.Keywords String 11 Rock'n'roll
Iptc.Envelope.CharacterSet String 3 %G Iptc.Envelope.CharacterSet String 3 $%G
Testcase 10 Testcase 10
=========== ===========
@ -101,7 +101,7 @@ Xmp.iptc.Location XmpText 12 Kuala Lumpur
File 1/1: s.xmp File 1/1: s.xmp
s.xmp: No Exif data found in the file s.xmp: No Exif data found in the file
Iptc.Application2.SubLocation String 12 Kuala Lumpur Iptc.Application2.SubLocation String 12 Kuala Lumpur
Iptc.Envelope.CharacterSet String 3 %G Iptc.Envelope.CharacterSet String 3 $%G
Testcase 13 Testcase 13
=========== ===========
@ -109,7 +109,7 @@ Xmp.iptc.Location XmpText 12 Kuala Lumpur
File 1/1: t.jpg File 1/1: t.jpg
t.jpg: No Exif data found in the file t.jpg: No Exif data found in the file
Iptc.Application2.SubLocation String 12 Kuala Lumpur Iptc.Application2.SubLocation String 12 Kuala Lumpur
Iptc.Envelope.CharacterSet String 3 %G Iptc.Envelope.CharacterSet String 3 $%G
Testcase 14 Testcase 14
=========== ===========
@ -149,7 +149,7 @@ Exif.GPSInfo.GPSLatitudeRef Ascii 2 N
Exif.GPSInfo.GPSTimeStamp Rational 3 1/1 2/1 999999999/1000000000 Exif.GPSInfo.GPSTimeStamp Rational 3 1/1 2/1 999999999/1000000000
Exif.GPSInfo.GPSDateStamp Ascii 11 2003:12:14 Exif.GPSInfo.GPSDateStamp Ascii 11 2003:12:14
Iptc.Application2.DateCreated Date 8 2007-05-09 Iptc.Application2.DateCreated Date 8 2007-05-09
Iptc.Envelope.CharacterSet String 3 %G Iptc.Envelope.CharacterSet String 3 $%G
Testcase 15 Testcase 15
=========== ===========
@ -181,4 +181,4 @@ Exif.GPSInfo.GPSLatitude Rational 3 3/1 8/1 1858407/6250
Exif.GPSInfo.GPSTimeStamp Rational 3 1/1 2/1 999999999/1000000000 Exif.GPSInfo.GPSTimeStamp Rational 3 1/1 2/1 999999999/1000000000
Exif.GPSInfo.GPSDateStamp Ascii 11 2003:12:14 Exif.GPSInfo.GPSDateStamp Ascii 11 2003:12:14
Iptc.Application2.DateCreated Date 8 2007-05-09 Iptc.Application2.DateCreated Date 8 2007-05-09
Iptc.Envelope.CharacterSet String 3 %G Iptc.Envelope.CharacterSet String 3 $%G

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save