[libpng16] Only mark text chunks as written after successfully writing them.
diff --git a/pngread.c b/pngread.c
index 845ff7b..53b9c3b 100644
--- a/pngread.c
+++ b/pngread.c
@@ -396,6 +396,7 @@
    row_info.pixel_depth = png_ptr->pixel_depth;
    row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width);
 
+#ifdef PNG_WARNINGS_SUPPORTED
    if (png_ptr->row_number == 0 && png_ptr->pass == 0)
    {
    /* Check for transforms that have been set but were defined out */
@@ -435,6 +436,7 @@
       png_warning(png_ptr, "PNG_READ_SWAP_SUPPORTED is not defined");
 #endif
    }
+#endif /* PNG_WARNINGS_SUPPORTED */
 
 #ifdef PNG_READ_INTERLACING_SUPPORTED
    /* If interlaced and we do not need a new row, combine row and return.