Added second attempt to parse an IPTC field into a string value, if parsing the actual type fails. Fixes bug #501.
This commit is contained in:
@@ -183,6 +183,15 @@ namespace Exiv2 {
|
||||
IptcKey key(dataSet, record);
|
||||
add(key, value.get());
|
||||
}
|
||||
else if (1 == rc) {
|
||||
// If the first attempt failed, try with a string value
|
||||
value = Value::create(string);
|
||||
int rc = value->read(data, sizeData, bigEndian);
|
||||
if (0 == rc) {
|
||||
IptcKey key(dataSet, record);
|
||||
add(key, value.get());
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
+13
-11
@@ -327,7 +327,7 @@ namespace Exiv2 {
|
||||
charsetId = CharsetInfo::charsetIdByName(name);
|
||||
if (charsetId == invalidCharsetId) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
std::cerr << Error(28, name) << "\n";
|
||||
std::cerr << "Warning: " << Error(28, name) << "\n";
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@@ -391,7 +391,7 @@ namespace Exiv2 {
|
||||
// Hard coded to read Iptc style dates
|
||||
if (len != 8) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
std::cerr << Error(29) << "\n";
|
||||
std::cerr << "Warning: " << Error(29) << "\n";
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@@ -402,7 +402,7 @@ namespace Exiv2 {
|
||||
&date_.year, &date_.month, &date_.day);
|
||||
if (scanned != 3) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
std::cerr << Error(29) << "\n";
|
||||
std::cerr << "Warning: " << Error(29) << "\n";
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@@ -414,7 +414,7 @@ namespace Exiv2 {
|
||||
// Hard coded to read Iptc style dates
|
||||
if (buf.length() < 8) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
std::cerr << Error(29) << "\n";
|
||||
std::cerr << "Warning: " << Error(29) << "\n";
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@@ -422,7 +422,7 @@ namespace Exiv2 {
|
||||
&date_.year, &date_.month, &date_.day);
|
||||
if (scanned != 3) {
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
std::cerr << Error(29) << "\n";
|
||||
std::cerr << "Warning: " << Error(29) << "\n";
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
@@ -511,11 +511,12 @@ namespace Exiv2 {
|
||||
if (len == 11) {
|
||||
rc = scanTime6(b, "%2d%2d%2d%1c%2d%2d");
|
||||
}
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
if (rc) {
|
||||
std::cerr << Error(30) << "\n";
|
||||
}
|
||||
rc = 1;
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
std::cerr << "Warning: " << Error(30) << "\n";
|
||||
#endif
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -530,11 +531,12 @@ namespace Exiv2 {
|
||||
else {
|
||||
rc = scanTime6(buf.c_str(), "%d:%d:%d%1c%d:%d");
|
||||
}
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
if (rc) {
|
||||
std::cerr << Error(30) << "\n";
|
||||
}
|
||||
rc = 1;
|
||||
#ifndef SUPPRESS_WARNINGS
|
||||
std::cerr << "Warning: " << Error(30) << "\n";
|
||||
#endif
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,10 @@ $binpath/exiv2 -v -pv $filename
|
||||
$binpath/exiv2 -v -M"del Exif.GPSInfo.GPSLatitude" $filename
|
||||
$binpath/exiv2 -v -pv $filename
|
||||
|
||||
num=501
|
||||
filename=`prep_file $num`
|
||||
$binpath/exiv2 -pi $filename
|
||||
|
||||
) > $results 2>&1
|
||||
|
||||
if [ x"`which unix2dos.exe`" != x ]; then
|
||||
|
||||
@@ -266,3 +266,29 @@ File 1/1: exiv2-bug498.jpg
|
||||
Del Exif.GPSInfo.GPSLatitude
|
||||
File 1/1: exiv2-bug498.jpg
|
||||
exiv2-bug498.jpg: No Exif data found in the file
|
||||
------> Bug 501 <-------
|
||||
Warning: Unsupported time format
|
||||
Iptc.Application2.RecordVersion Short 1 2
|
||||
Iptc.Application2.Caption String 15 Porträtt på Eva
|
||||
Iptc.Application2.Writer String 10 Elsa Nordh
|
||||
Iptc.Application2.Byline String 10 Elsa Nordh
|
||||
Iptc.Application2.ObjectName String 7 Hundbus
|
||||
Iptc.Application2.DateCreated Date 8 2006-10-31
|
||||
Iptc.Application2.City String 8 Göteborg
|
||||
Iptc.Application2.ProvinceState String 15 Västra Götaland
|
||||
Iptc.Application2.CountryName String 6 Sweden
|
||||
Iptc.Application2.Keywords String 3 Eva
|
||||
Iptc.Application2.Keywords String 7 Gallery
|
||||
Iptc.Application2.Keywords String 21 Framkalla jul06 mamma
|
||||
Iptc.Application2.Copyright String 19 http://nordharna.se
|
||||
Iptc.Application2.ExpirationTime String 2 SE
|
||||
Iptc.Application2.SubLocation String 9 KÃ¥lltorp
|
||||
Iptc.Application2.0x00d1 String 9 Göteborg
|
||||
Iptc.Application2.0x00d2 String 17 Västra Götaland
|
||||
Iptc.Application2.0x00d3 String 6 416 81
|
||||
Iptc.Application2.0x00d4 String 6 Sweden
|
||||
Iptc.Application2.0x00d5 String 19 +46-(0)736-21 50 74
|
||||
Iptc.Application2.0x00d6 String 17 foto@nordharna.se
|
||||
Iptc.Application2.0x00d7 String 27 http://gallery.nordharna.se
|
||||
Iptc.Application2.0x00e3 String 27 http://gallery.nordharna.se
|
||||
Iptc.Application2.0x00f2 String 1 4
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user