diff --git a/src/pngimage.cpp b/src/pngimage.cpp index cea96e1c27..599fd61df0 100644 --- a/src/pngimage.cpp +++ b/src/pngimage.cpp @@ -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()) { diff --git a/test/data/png-test.out b/test/data/png-test.out index cc8e23435b..ced4cd3f22 100644 --- a/test/data/png-test.out +++ b/test/data/png-test.out @@ -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 @@ -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 @@ -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? @@ -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 diff --git a/test/png-test.sh b/test/png-test.sh index 9acb1df3e9..8044c00e38 100755 --- a/test/png-test.sh +++ b/test/png-test.sh @@ -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 diff --git a/tests/bash_tests/testcases.py b/tests/bash_tests/testcases.py index bd05705dc0..3ad0df2b7f 100644 --- a/tests/bash_tests/testcases.py +++ b/tests/bash_tests/testcases.py @@ -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 @@ -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())