Some minor cleanups in the png.c module.
This commit is contained in:
19
src/png.c
19
src/png.c
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Provide centralized access to the PNG image handler.
|
* Provide centralized access to the PNG image handler.
|
||||||
*
|
*
|
||||||
* Version: @(#)png.c 1.0.1 2018/09/01
|
* Version: @(#)png.c 1.0.2 2018/09/02
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -194,9 +194,8 @@ png_unload(void)
|
|||||||
/* Unload the DLL if possible. */
|
/* Unload the DLL if possible. */
|
||||||
if (png_handle != NULL)
|
if (png_handle != NULL)
|
||||||
dynld_close(png_handle);
|
dynld_close(png_handle);
|
||||||
#else
|
|
||||||
png_handle = NULL;
|
|
||||||
#endif
|
#endif
|
||||||
|
png_handle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -218,10 +217,10 @@ png_write_gray(const wchar_t *fn, int inv, uint8_t *pix, int16_t w, int16_t h)
|
|||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
/* Yes, this looks weird. */
|
/* Yes, this looks weird. */
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
pclog("[PNG] file %ls could not be opened for writing!\n", fn);
|
pclog("PNG: file %ls could not be opened for writing!\n", fn);
|
||||||
else
|
else
|
||||||
error:
|
error:
|
||||||
pclog("[PNG] fatal error, bailing out, error = %i\n", errno);
|
pclog("PNG: fatal error, bailing out, error = %i\n", errno);
|
||||||
if (png != NULL)
|
if (png != NULL)
|
||||||
PNGFUNC(destroy_write_struct)(&png, &info);
|
PNGFUNC(destroy_write_struct)(&png, &info);
|
||||||
if (fp != NULL)
|
if (fp != NULL)
|
||||||
@@ -233,13 +232,13 @@ error:
|
|||||||
png = PNGFUNC(create_write_struct)(PNG_LIBPNG_VER_STRING, NULL,
|
png = PNGFUNC(create_write_struct)(PNG_LIBPNG_VER_STRING, NULL,
|
||||||
error_handler, warning_handler);
|
error_handler, warning_handler);
|
||||||
if (png == NULL) {
|
if (png == NULL) {
|
||||||
pclog("[PNG] create_write_struct failed!\n");
|
pclog("PNG: create_write_struct failed!\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
info = PNGFUNC(create_info_struct)(png);
|
info = PNGFUNC(create_info_struct)(png);
|
||||||
if (info == NULL) {
|
if (info == NULL) {
|
||||||
pclog("[PNG] create_info_struct failed!\n");
|
pclog("PNG: create_info_struct failed!\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +318,7 @@ png_write_rgb(const wchar_t *fn, uint8_t *pix, int16_t w, int16_t h)
|
|||||||
/* Create the image file. */
|
/* Create the image file. */
|
||||||
fp = plat_fopen(fn, L"wb");
|
fp = plat_fopen(fn, L"wb");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
pclog("[PNG] File %ls could not be opened for writing!\n", fn);
|
pclog("PNG: File %ls could not be opened for writing!\n", fn);
|
||||||
error:
|
error:
|
||||||
if (png != NULL)
|
if (png != NULL)
|
||||||
PNGFUNC(destroy_write_struct)(&png, &info);
|
PNGFUNC(destroy_write_struct)(&png, &info);
|
||||||
@@ -332,13 +331,13 @@ error:
|
|||||||
png = PNGFUNC(create_write_struct)(PNG_LIBPNG_VER_STRING, NULL,
|
png = PNGFUNC(create_write_struct)(PNG_LIBPNG_VER_STRING, NULL,
|
||||||
error_handler, warning_handler);
|
error_handler, warning_handler);
|
||||||
if (png == NULL) {
|
if (png == NULL) {
|
||||||
pclog("[PNG] create_write_struct failed!\n");
|
pclog("PNG: create_write_struct failed!\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
info = PNGFUNC(create_info_struct)(png);
|
info = PNGFUNC(create_info_struct)(png);
|
||||||
if (info == NULL) {
|
if (info == NULL) {
|
||||||
pclog("[PNG] create_info_struct failed!\n");
|
pclog("PNG: create_info_struct failed!\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user