Skip to content

Commit

Permalink
C++ changes requested by @piponazo. Fix python png_test() recommended…
Browse files Browse the repository at this point in the history
… by @LeoHsiao1.  Update reference output.
  • Loading branch information
clanmills committed Oct 9, 2020
1 parent 834dca3 commit 9fa6d39
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 24 deletions.
3 changes: 1 addition & 2 deletions src/pngimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,7 @@ namespace Exiv2 {
// Write PNG Signature.
if (outIo.write(pngSignature, 8) != 8) throw Error(kerImageWriteFailed);

DataBuf cheaderBuf(9); // Chunk header : 4 bytes (data size) + 4 bytes (chunk type) + nul
cheaderBuf.pData_[8] = 0;
DataBuf cheaderBuf(8); // Chunk header : 4 bytes (data size) + 4 bytes (chunk type).

while(!io_->eof())
{
Expand Down
19 changes: 0 additions & 19 deletions test/data/png-test.out
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ STRUCTURE OF PNG FILE: 1343_empty.png
address | chunk | length | data | checksum
8 | IHDR | 13 | .......d.... | 0x4ce4e85c
33 | iTXt | 39 | Description.....x.K.H.KOMQH... | 0xe0a1c8ce
changed comment
84 | sRGB | 1 | | 0xaece1ce9
97 | gAMA | 4 | .... | 0x0bfc6105
113 | pHYs | 9 | ......... | 0xc76fa864
Expand All @@ -32,7 +31,6 @@ STRUCTURE OF PNG FILE: 1343_comment.png
address | chunk | length | data | checksum
8 | IHDR | 13 | .......d.... | 0x4ce4e85c
33 | iTXt | 39 | Description.....x.K.H.KOMQH... | 0xe0a1c8ce
changed comment
84 | sRGB | 1 | | 0xaece1ce9
97 | gAMA | 4 | .... | 0x0bfc6105
113 | pHYs | 9 | ......... | 0xc76fa864
Expand All @@ -48,14 +46,6 @@ STRUCTURE OF PNG FILE: 1343_exif.png
62 | pHYs | 9 | ......... | 0xc76fa864
83 | IDAT | 257 | x^..1..0......t.....h......z.. | 0x64465429
352 | eXIf | 108 | MM.*.................J........ | 0x764e86e1
STRUCTURE OF TIFF FILE (MM): MemIo
address | tag | type | count | offset | value
10 | 0x010e ImageDescription | ASCII | 17 | 74 | Can you read me?
22 | 0x011a XResolution | RATIONAL | 1 | 92 | 72/1
34 | 0x011b YResolution | RATIONAL | 1 | 100 | 72/1
46 | 0x0128 ResolutionUnit | SHORT | 1 | | 2
58 | 0x0213 YCbCrPositioning | SHORT | 1 | | 1
END MemIo
472 | IEND | 0 | | 0xae426082

Exif.Image.ImageDescription Ascii 17 Can you read me?
Expand All @@ -67,16 +57,7 @@ STRUCTURE OF PNG FILE: 1343_exif.png
address | chunk | length | data | checksum
8 | IHDR | 13 | .......d.... | 0x4ce4e85c
33 | iTXt | 39 | Description.....x.K.H.KOMQH... | 0xe0a1c8ce
changed comment
84 | zTXt | 145 | Raw profile type exif..x.U.... | 0x2f6d89e8
STRUCTURE OF TIFF FILE (II): MemIo
address | tag | type | count | offset | value
10 | 0x010e ImageDescription | ASCII | 17 | 74 | Can you read me?
22 | 0x011a XResolution | RATIONAL | 1 | 92 | 72/1
34 | 0x011b YResolution | RATIONAL | 1 | 100 | 72/1
46 | 0x0128 ResolutionUnit | SHORT | 1 | | 2
58 | 0x0213 YCbCrPositioning | SHORT | 1 | | 1
END MemIo
241 | sRGB | 1 | | 0xaece1ce9
254 | gAMA | 4 | .... | 0x0bfc6105
270 | pHYs | 9 | ......... | 0xc76fa864
Expand Down
2 changes: 1 addition & 1 deletion test/png-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source ./functions.source
copyTestFiles $files
for file in $files ; do
for i in 1 2 ; do
runTest exiv2 -pR $file
runTest exiv2 -pS $file
runTest exiv2 -pc $file
runTest exiv2 -pa $file
runTest exiv2 -c 'changed comment' $file
Expand Down
6 changes: 4 additions & 2 deletions tests/bash_tests/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ def png_test(self):
# runTest exiv2 -c 'comment in Reagan to hide non UTF-8 bytes'
# for file in $files ; do
# for i in 1 2 ; do
# runTest exiv2 -pR $file
# runTest exiv2 -pS $file
# runTest exiv2 -pc $file
# runTest exiv2 -pa $file
# runTest exiv2 -c 'changed comment' $file
Expand All @@ -890,8 +890,10 @@ def png_test(self):
for file in files:
BT.copyTestFile(file)
for i in [1,2]:
out += BT.Executer('exiv2 -pR {file}', vars())
out += BT.Executer('exiv2 -pS {file}', vars())
out += BT.Executer('exiv2 -pc {file}', vars())
if i ==1:
out+= ''
out += BT.Executer('exiv2 -pa {file}', vars())
out += BT.Executer('exiv2 -c "changed comment" {file}', vars())

Expand Down

0 comments on commit 9fa6d39

Please sign in to comment.