fixed all the build errors

This commit is contained in:
Amy G. Bowersox 2019-12-06 20:36:51 -07:00
parent 667ac01f92
commit 2768155f4e
3 changed files with 13 additions and 8 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*~
*.o
src/upiwin
buildutils/mksplash

View File

@ -1,7 +1,7 @@
ALL: mksplash
mksplash: mksplash.c
gcc -o mksplash -O -Wall -I/usr/include/libpng mksplash.c -lpng12 -lz
gcc -o mksplash -O -Wall -I/usr/include/libpng mksplash.c -lpng16 -lz
clean:
rm -f *.o mksplash

View File

@ -7,6 +7,10 @@
#include <sys/stat.h>
#include <png.h>
typedef unsigned char uch;
typedef unsigned short ush;
typedef unsigned long ulg;
#ifndef png_jmpbuf
#define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
#endif
@ -152,7 +156,7 @@ uch *readpng_get_image(const char *fname, double display_exponent, int *pChannel
return NULL;
}
fprintf(stderr, "image %s: chans=%d rowbytes=%ld height=%ld\n", fname, *pChannels,
fprintf(stderr, "image %s: chans=%d rowbytes=%u height=%u\n", fname, *pChannels,
rowbytes, height);
for (i = 0; i < height; ++i)
@ -189,7 +193,7 @@ int do_convert(const char *infilename, const char *outfilename)
ulg image_width, image_height, image_rowbytes, row, i;
FILE *fpin;
uch *image_data, *src;
uint16_t bred, bgreen, bblue, buf;
uint16_t bred = 0, bgreen = 0, bblue = 0, buf = 0;
int image_channels, fdout;
uch bg_red=0, bg_green=0, bg_blue=0, br, bg, bb, ba;
double display_exponent = 2.2; /* a guesstimate */
@ -200,7 +204,7 @@ int do_convert(const char *infilename, const char *outfilename)
return -1;
}
if (readpng_init(fpin, &image_width, &image_height))
if (readpng_init(infilename, fpin, &image_width, &image_height))
{
readpng_cleanup(1);
fclose(fpin);
@ -222,7 +226,7 @@ int do_convert(const char *infilename, const char *outfilename)
return -1;
}
image_data = readpng_get_image(display_exponent, &image_channels, &image_rowbytes);
image_data = readpng_get_image(infilename, display_exponent, &image_channels, &image_rowbytes);
readpng_cleanup(0);
fclose(fpin);
if (!image_data)
@ -266,9 +270,9 @@ int do_convert(const char *infilename, const char *outfilename)
}
else
{
alpha_composite(bred, br, ba, bg_red);
alpha_composite(bgreen, bg, ba, bg_green);
alpha_composite(bblue, bb, ba, bg_blue);
png_composite(bred, br, ba, bg_red);
png_composite(bgreen, bg, ba, bg_green);
png_composite(bblue, bb, ba, bg_blue);
}
}
bred = (bred >> 3) & 0x1F;