Clean out silly typedef bloat, clean up whitespace.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2003-09-08 20:07:51 +00:00
parent f93cc0d5d5
commit 387f6a6f64

View file

@ -52,9 +52,6 @@ static __attribute__ ((unused)) const char rcsid[] =
#include "compat.h"
typedef unsigned char uch;
typedef unsigned short ush;
typedef unsigned long ulg;
/* Qread wrapper for libpng */
static void
@ -67,7 +64,7 @@ user_read_data (png_structp png_ptr, png_bytep data, png_size_t length)
static int
readpng_init (QFile *infile, png_structp *png_ptr, png_infop *info_ptr)
{
uch sig[8];
unsigned char sig[8];
/* Check the signiture */
Qread (infile, sig, 8);
@ -76,7 +73,8 @@ readpng_init (QFile *infile, png_structp *png_ptr, png_infop *info_ptr)
return (1);
}
*png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
*png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL,
NULL);
if (!*png_ptr)
return (2); /* Out of memory! */
@ -111,16 +109,16 @@ LoadPNG (QFile *infile)
double gamma;
png_structp png_ptr = NULL;
png_infop info_ptr = NULL;
png_uint_32 i, rowbytes;
png_uint_32 height, width, rowbytes, i;
png_bytepp row_pointers = NULL;
png_uint_32 width, height;
int bit_depth, color_type;
tex_t *tex;
if (readpng_init (infile, &png_ptr, &info_ptr) != 0)
return (NULL);
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, NULL, NULL, NULL);
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
NULL, NULL, NULL);
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_expand (png_ptr);
@ -134,7 +132,8 @@ LoadPNG (QFile *infile)
if (bit_depth == 16)
png_set_strip_16 (png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
if (color_type == PNG_COLOR_TYPE_GRAY
|| color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb (png_ptr);
/* NOTE: gamma support? */
@ -145,7 +144,8 @@ LoadPNG (QFile *infile)
if (!png_get_gAMA(png_ptr, info_ptr, &gamma))
png_set_gamma (png_ptr, 1.0, gamma);
/* All transformations have been registered, now update the info_ptr structure */
/* All transformations have been registered, now update the info_ptr
* structure */
png_read_update_info (png_ptr, info_ptr);
/* Allocate tex_t structure */
@ -160,7 +160,8 @@ LoadPNG (QFile *infile)
tex->format = tex_rgb;
tex->palette = NULL;
if ((row_pointers = (png_bytepp)malloc(height * sizeof(png_bytep))) == NULL) {
if ((row_pointers = (png_bytepp) malloc (height * sizeof (png_bytep)))
== NULL) {
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return (NULL); /* Out of memory */
}