mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng15] Only mark text chunks as written after successfully writing them.
This commit is contained in:
26
pngwrite.c
26
pngwrite.c
@@ -223,11 +223,14 @@ png_write_info(png_structp png_ptr, png_infop 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");
|
||||
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;
|
||||
}
|
||||
|
||||
/* If we want a compressed text chunk */
|
||||
@@ -238,11 +241,11 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
|
||||
png_write_zTXt(png_ptr, info_ptr->text[i].key,
|
||||
info_ptr->text[i].text, 0,
|
||||
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)
|
||||
@@ -340,11 +343,11 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
|
||||
info_ptr->text[i].lang,
|
||||
info_ptr->text[i].lang_key,
|
||||
info_ptr->text[i].text);
|
||||
/* Mark this chunk as written */
|
||||
info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_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)
|
||||
@@ -354,11 +357,11 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
|
||||
png_write_zTXt(png_ptr, info_ptr->text[i].key,
|
||||
info_ptr->text[i].text, 0,
|
||||
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)
|
||||
@@ -367,12 +370,11 @@ png_write_end(png_structp png_ptr, png_infop 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
|
||||
|
||||
Reference in New Issue
Block a user