From 92fa23fd6d9c6819fe699de3d007c0848fccda0f Mon Sep 17 00:00:00 2001 From: Sjoerd Mullender Date: Fri, 24 Dec 1993 10:05:51 +0000 Subject: ANSIfied somewhat. --- Modules/rgbimgmodule.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/Modules/rgbimgmodule.c b/Modules/rgbimgmodule.c index 663a460..4a983ef 100644 --- a/Modules/rgbimgmodule.c +++ b/Modules/rgbimgmodule.c @@ -17,6 +17,7 @@ #include "allobjects.h" #include "modsupport.h" #include +#include /* * from image.h @@ -80,12 +81,12 @@ typedef struct { #define CHANOFFSET(z) (3-(z)) /* this is byte order dependent */ -static expandrow(); -static setalpha(); -static copybw(); -static interleaverow(); -static int compressrow(); -static lumrow(); +static expandrow PROTO((unsigned char *, unsigned char *, int)); +static setalpha PROTO((unsigned char *, int)); +static copybw PROTO((long *, int)); +static interleaverow PROTO((unsigned char *, unsigned char *, int, int)); +static int compressrow PROTO((unsigned char *, unsigned char *, int, int)); +static lumrow PROTO((unsigned char *, unsigned char *, int)); #ifdef ADD_TAGS #define TAGLEN (5) @@ -164,7 +165,7 @@ static readheader(inf,image) FILE *inf; IMAGE *image; { - bzero(image,sizeof(IMAGE)); + memset(image,0,sizeof(IMAGE)); image->imagic = getshort(inf); image->type = getshort(inf); image->dim = getshort(inf); @@ -179,7 +180,7 @@ IMAGE *image; { IMAGE t; - bzero(&t,sizeof(IMAGE)); + memset(&t,0,sizeof(IMAGE)); fwrite(&t,sizeof(IMAGE),1,outf); fseek(outf,0,SEEK_SET); putshort(outf,image->imagic); @@ -260,7 +261,7 @@ longimagedata(self, args) object *self, *args; { char *name; - unsigned long *base, *lptr; + unsigned char *base, *lptr; unsigned char *rledat, *verdat; long *starttab, *lengthtab; FILE *inf; @@ -331,7 +332,7 @@ longimagedata(self, args) free(rledat); return NULL; } - base = (unsigned long *) getstringvalue(rv); + base = (unsigned char *) getstringvalue(rv); #ifdef ADD_TAGS addlongimgtag(base,xsize,ysize); #endif @@ -355,7 +356,7 @@ longimagedata(self, args) fread(rledat,lengthtab[y+z*ysize],1,inf); cur += lengthtab[y+z*ysize]; expandrow(lptr,rledat,3-z); - lptr += xsize; + lptr += xsize * sizeof(unsigned long); } } } else { @@ -370,13 +371,13 @@ longimagedata(self, args) cur += lengthtab[y+z*ysize]; expandrow(lptr,rledat,3-z); } - lptr += xsize; + lptr += xsize * sizeof(unsigned long); } } if(zsize == 3) setalpha(base,xsize*ysize); else if(zsize<3) - copybw(base,xsize*ysize); + copybw((long *) base,xsize*ysize); fclose(inf); free(starttab); free(lengthtab); @@ -389,7 +390,7 @@ longimagedata(self, args) fclose(inf); return NULL; } - base = (unsigned long *) getstringvalue(rv); + base = (unsigned char *) getstringvalue(rv); #ifdef ADD_TAGS addlongimgtag(base,xsize,ysize); #endif @@ -400,13 +401,13 @@ longimagedata(self, args) for(y=0; y1) @@ -600,7 +601,7 @@ longstoimage(self, args) lengthtab[y+z*ysize] = len; pos += len; } - lptr += xsize; + lptr += xsize * sizeof(unsigned long); } fseek(outf,512,SEEK_SET); -- cgit v0.12