diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2014-10-05 18:08:39 -0500 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2014-10-05 18:08:39 -0500 |
commit | 470d64c2dd035156ceac181470ffff6474f556d1 (patch) | |
tree | 6d89663a1778d3da05a9464173d9dd44fa871ab1 /pngwrite.c | |
parent | d7eff5d864ab0d39951c14f39204a9dac4059849 (diff) | |
download | libpng-470d64c2dd035156ceac181470ffff6474f556d1.tar.gz |
[libpng16] Also don't mark text as written in the end_ptr until written.
Diffstat (limited to 'pngwrite.c')
-rw-r--r-- | pngwrite.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/pngwrite.c b/pngwrite.c index b0948b3b2..c3dd4c3ab 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -389,11 +389,14 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) info_ptr->text[i].lang, info_ptr->text[i].lang_key, info_ptr->text[i].text); + /* Mark this chunk as written */ + if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; + else + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; #else png_warning(png_ptr, "Unable to write international text"); #endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; } else if (info_ptr->text[i].compression >= PNG_TEXT_COMPRESSION_zTXt) @@ -402,11 +405,11 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) /* Write compressed chunk */ png_write_zTXt(png_ptr, info_ptr->text[i].key, info_ptr->text[i].text, info_ptr->text[i].compression); + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; #else png_warning(png_ptr, "Unable to write compressed text"); #endif - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR; } else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE) @@ -415,12 +418,11 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) /* Write uncompressed chunk */ png_write_tEXt(png_ptr, info_ptr->text[i].key, info_ptr->text[i].text, 0); + /* Mark this chunk as written */ + info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; #else png_warning(png_ptr, "Unable to write uncompressed text"); #endif - - /* Mark this chunk as written */ - info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR; } } #endif |