From 8cc5341ba25a4d7f2701999c1e3cbb4bff5efe06 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Wed, 8 Aug 2012 22:14:51 -0500 Subject: [PATCH] [libpng15] Corrected handling of the image array and the row_pointers array in example.c --- example.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/example.c b/example.c index c20d86b15..86068ea1e 100644 --- a/example.c +++ b/example.c @@ -799,12 +799,16 @@ void write_png(char *file_name /* , ... other image information ... */) * use the first method if you aren't handling interlacing yourself. */ png_uint_32 k, height, width; - png_byte image[height][width*bytes_per_pixel]; + + /* In this example, "image" is a one-dimensional array of bytes */ + png_byte image[height*width*bytes_per_pixel]; + png_bytep row_pointers[height]; if (height > PNG_UINT_32_MAX/png_sizeof(png_bytep)) png_error (png_ptr, "Image is too tall to process in memory"); + /* Set up pointers into your "image" byte array */ for (k = 0; k < height; k++) row_pointers[k] = image + k*width*bytes_per_pixel;