Skip to content

Commit

Permalink
Revert "Revert "fix_1431_binary_comment.""
Browse files Browse the repository at this point in the history
This reverts commit 2866415.
  • Loading branch information
clanmills committed Dec 14, 2020
1 parent c616725 commit 9b51085
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
17 changes: 0 additions & 17 deletions src/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,18 +555,6 @@ namespace Exiv2 {
return os << comment();
}

// test string for printable ascii-7 (' ' .. '~')
static bool isBinary(const std::string& s)
{
bool result = false ;
size_t i = 0;
while ( !result && i < s.length() ) {
unsigned char c = (unsigned char) s[i++];
result = c < 32 || c > 127 ;
}
return result;
}

std::string CommentValue::comment(const char* encoding) const
{
std::string c;
Expand All @@ -583,11 +571,6 @@ namespace Exiv2 {
if ( bAscii && c.find('\0') != c.std::string::npos) {
c = c.substr(0,c.find('\0'));
}
// return "binary comment" if results contains non-printable bytes
// this ensures no binary bytes in the output stream.
if ( bAscii && isBinary(c) ) {
c = "binary comment" ;
}
return c;
}

Expand Down
Binary file modified test/data/exiv2-bug528.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions tests/bugfixes/redmine/test_issue_528.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TypeSizeForExifOnly(metaclass=system_tests.CaseMeta):
Exif.Image.YCbCrPositioning Short 1 Centered
Exif.Image.Rating SLong 1 3
Exif.Image.RatingPercent SLong 1 50
Exif.Image.ExifTag Long 1 318
Exif.Image.ExifTag Long 1 320
Exif.Photo.ExposureTime Rational 1 1/250 s
Exif.Photo.FNumber Rational 1 F11
Exif.Photo.ExposureProgram Short 1 Auto
Expand All @@ -46,10 +46,10 @@ class TypeSizeForExifOnly(metaclass=system_tests.CaseMeta):
Exif.Photo.Flash Short 1 No, compulsory
Exif.Photo.FocalLength Rational 1 10.0 mm
Exif.Photo.MakerNote Undefined 18 0 1 2 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0
Exif.MakerNote.Offset Long 1 796
Exif.MakerNote.Offset Long 1 798
Exif.MakerNote.ByteOrder Ascii 3 MM
Exif.Canon.0x0200 0x0300 0
Exif.Photo.UserComment Undefined 37 charset=Ascii binary comment
Exif.Photo.UserComment Undefined 38 Chateaux de la Loire, Chambord
Exif.Photo.SubSecTime Ascii 3 81
Exif.Photo.SubSecTimeOriginal Ascii 3 81
Exif.Photo.SubSecTimeDigitized Ascii 3 81
Expand All @@ -66,7 +66,7 @@ class TypeSizeForExifOnly(metaclass=system_tests.CaseMeta):
Exif.Photo.SceneCaptureType Short 1 Standard
Exif.Photo.Contrast Short 1 Normal
Exif.Photo.Saturation Short 1 Normal
Exif.Image.GPSTag Long 1 867
Exif.Image.GPSTag Long 1 870
Exif.GPSInfo.GPSVersionID Byte 4 2.0.0.0
Exif.GPSInfo.GPSLatitudeRef Ascii 2 North
Exif.GPSInfo.GPSLatitude Rational 3 47deg 36' 58"
Expand All @@ -75,7 +75,7 @@ class TypeSizeForExifOnly(metaclass=system_tests.CaseMeta):
Exif.GPSInfo.GPSAltitudeRef Byte 1 Above sea level
Exif.GPSInfo.GPSAltitude Rational 1 86 m
Exif.Thumbnail.Compression Short 1 JPEG (old-style)
Exif.Thumbnail.JPEGInterchangeFormat Long 1 1055
Exif.Thumbnail.JPEGInterchangeFormat Long 1 1058
Exif.Thumbnail.JPEGInterchangeFormatLength Long 1 4492
""",
"""File 1/1: $filename
Expand Down

0 comments on commit 9b51085

Please sign in to comment.