diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2012-08-09 20:14:48 -0500 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2012-08-09 20:14:48 -0500 |
commit | 432c174b64198c5d4d7dbc0b5b0048d113663dba (patch) | |
tree | 7312df7706547949cacf4555610a81fbef51db44 /example.c | |
parent | 5f5977e708f84647123efbdc153199d88b77b65c (diff) |
[libpng16] Eliminated use of png_sizeof(); use sizeof() instead, and use.
a consistent style for (sizeof type) and (sizeof (array))
Diffstat (limited to 'example.c')
-rw-r--r-- | example.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -48,7 +48,7 @@ int main(int argc, const char **argv) png_image image; /* The control structure used by libpng */ /* Initialize the 'png_image' structure. */ - memset(&image, 0, sizeof image); + memset(&image, 0, (sizeof image)); /* The first argument is the file to read: */ if (png_image_begin_read_from_file(&image, argv[1])) @@ -833,7 +833,7 @@ void write_png(char *file_name /* , ... other image information ... */) /* Set the palette if there is one. REQUIRED for indexed-color images */ palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH - * png_sizeof(png_color)); + * (sizeof (png_color))); /* ... Set palette colors ... */ png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH); /* You must not free palette here, because png_set_PLTE only makes a link to @@ -968,11 +968,13 @@ 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; + /* 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)) + if (height > PNG_UINT_32_MAX/(sizeof (png_bytep))) png_error (png_ptr, "Image is too tall to process in memory"); /* Set up pointers into your "image" byte array */ |