From: Arnar Mar Hrafnkelsson Date: Mon, 14 May 2001 05:52:53 +0000 (+0000) Subject: Removed a bunch of unused variables and fixed an attempt to print out a X-Git-Tag: Imager-0.48^2~647 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/a743c0a625a41e31c47e8bf52b88fc8949b879dd Removed a bunch of unused variables and fixed an attempt to print out a structure pointer in error.c --- diff --git a/Imager.xs b/Imager.xs index d39a2a72..e845d491 100644 --- a/Imager.xs +++ b/Imager.xs @@ -1163,10 +1163,6 @@ i_writegifmc(im,fd,colors) int fd int colors -undef_int -i_writegifex(im,fd) - Imager::ImgRaw im - int fd undef_int i_writegif_gen(fd, ...) diff --git a/convert.c b/convert.c index 07a88fb2..98c41241 100644 --- a/convert.c +++ b/convert.c @@ -44,7 +44,7 @@ i_convert(i_img *im, i_img *src, float *coeff, int outchan, int inchan) i_color *vals; int x, y; int i, j; - int ilimit, jlimit; + int ilimit; double work[MAXCHANNELS]; mm_log((1,"i_convert(im* 0x%x, src, 0x%x, coeff 0x%x,outchan %d, inchan %d)\n",im,src, coeff,outchan, inchan)); diff --git a/error.c b/error.c index 0edce898..e350d3c5 100644 --- a/error.c +++ b/error.c @@ -288,7 +288,7 @@ int i_failed(int code, char const *msg) { fputs("error:\n", stderr); sp = error_sp; while (error_stack[sp].msg) { - fprintf(stderr, " %s\n", error_stack[sp]); + fprintf(stderr, " %s\n", error_stack[sp].msg); ++sp; } /* we want to log the error too, build an error message to hand to diff --git a/filters.c b/filters.c index 14ffb0b7..3bcd6f74 100644 --- a/filters.c +++ b/filters.c @@ -792,9 +792,7 @@ i_gradgen(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure) { void i_nearest_color_foo(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure) { - i_color val; - int p, x, y, ch; - int channels = im->channels; + int p, x, y; int xsize = im->xsize; int ysize = im->ysize; @@ -869,7 +867,6 @@ i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *oval, int dmeasur float c1, c2; i_color val; int p, x, y, ch; - int channels = im->channels; int xsize = im->xsize; int ysize = im->ysize; int *cmatch; diff --git a/font.c b/font.c index 5f11121a..2119aac0 100644 --- a/font.c +++ b/font.c @@ -1109,7 +1109,7 @@ i_tt_bbox_inst( TT_Fonthandle *handle, int inst ,const char *txt, int len, int c width = 0; start = 0; - mm_log((1, "i_tt_box_inst: glyph='%c' ascent=%d descent=%d\n", j, ascent, descent)); + mm_log((1, "i_tt_box_inst: glyph='%c' gascent=%d gdescent=%d\n", j, gascent, gdescent)); first=1; for ( i = 0; i < len; ++i ) { diff --git a/gif.c b/gif.c index 7dbfc42c..236d9f44 100644 --- a/gif.c +++ b/gif.c @@ -216,7 +216,7 @@ i_readgif_low(GifFileType *GifFile, int **colour_table, int *colours) { } if ( cmapcnt == 0) { - if (ColorMap = (GifFile->Image.ColorMap ? GifFile->Image.ColorMap : GifFile->SColorMap) ) { + if (( ColorMap = (GifFile->Image.ColorMap ? GifFile->Image.ColorMap : GifFile->SColorMap) )) { mm_log((1, "Adding local colormap\n")); ColorMapSize = ColorMap->ColorCount; i_colortable_copy(colour_table, colours, ColorMap); @@ -439,104 +439,6 @@ i_writegifmc(i_img *im, int fd, int max_colors) { return i_writegif_gen(&quant, fd, &im, 1, &opts); } -#if 1 - -undef_int -i_writegifex(i_img *im, int fd) { - return 0; -} - -#else - -/* I don't think this works - note that RedBuffer is never allocated - TC -*/ - -undef_int -i_writegifex(i_img *im,int fd) { - int colors, xsize, ysize, channels; - int x,y,ColorMapSize; - unsigned long Size; - - struct octt *ct; - - GifByteType *RedBuffer = NULL, *GreenBuffer = NULL, *BlueBuffer = NULL,*OutputBuffer = NULL; - ColorMapObject *OutputColorMap = NULL; - GifFileType *GifFile; - GifByteType *Ptr; - - i_color val; - - mm_log((1,"i_writegif(0x%x,fd %d)\n",im,fd)); - - if (!(im->channels==1 || im->channels==3)) { fprintf(stderr,"Unable to write gif, improper colorspace.\n"); exit(3); } - - xsize=im->xsize; - ysize=im->ysize; - channels=im->channels; - - colors=0; - ct=octt_new(); - - colors=0; - for(x=0;x maxc) { octt_delete(ct); } - We'll just bite the bullet */ - } - - ColorMapSize = (colors > 256) ? 256 : colors; - - Size = ((long) im->xsize) * im->ysize * sizeof(GifByteType); - - if ((OutputColorMap = MakeMapObject(ColorMapSize, NULL)) == NULL) - m_fatal(0,"Failed to allocate memory for Output colormap."); - if ((OutputBuffer = (GifByteType *) mymalloc(im->xsize * im->ysize * sizeof(GifByteType))) == NULL) - m_fatal(0,"Failed to allocate memory for output buffer."); - - if (QuantizeBuffer(im->xsize, im->ysize, &ColorMapSize, RedBuffer, GreenBuffer, BlueBuffer, - OutputBuffer, OutputColorMap->Colors) == GIF_ERROR) { - mm_log((1,"Error in QuantizeBuffer, unable to write image.\n")); - return(0); - } - - - myfree(RedBuffer); - if (im->channels == 3) { myfree(GreenBuffer); myfree(BlueBuffer); } - - if ((GifFile = EGifOpenFileHandle(fd)) == NULL) { - mm_log((1,"Error in EGifOpenFileHandle, unable to write image.\n")); - return(0); - } - - if (EGifPutScreenDesc(GifFile,im->xsize, im->ysize, colors, 0,OutputColorMap) == GIF_ERROR || - EGifPutImageDesc(GifFile,0, 0, im->xsize, im->ysize, FALSE, NULL) == GIF_ERROR) { - mm_log((1,"Error in EGifOpenFileHandle, unable to write image.\n")); - if (GifFile != NULL) EGifCloseFile(GifFile); - return(0); - } - - Ptr = OutputBuffer; - - for (y = 0; y < im->ysize; y++) { - if (EGifPutLine(GifFile, Ptr, im->xsize) == GIF_ERROR) { - mm_log((1,"Error in EGifOpenFileHandle, unable to write image.\n")); - if (GifFile != NULL) EGifCloseFile(GifFile); - return(0); - } - - Ptr += im->xsize; - } - - if (EGifCloseFile(GifFile) == GIF_ERROR) { - mm_log((1,"Error in EGifCloseFile, unable to write image.\n")); - return(0); - } - return(1); -} - -#endif /* =item i_readgif_scalar(char *data, int length, int **colour_table, int *colours) @@ -802,7 +704,9 @@ static ColorMapObject *make_gif_map(i_quantize *quant, i_gif_opts *opts, /* giflib spews for 1 colour maps, reasonable, I suppose */ if (map_size == 1) map_size = 2; + map = MakeMapObject(map_size, colors); + mm_log((1, "XXX map is at %p and colors at %p\n", map, map->Colors)); if (!map) { gif_push_error(); i_push_error(0, "Could not create color map object"); diff --git a/image.c b/image.c index 767288f8..e8833ea4 100644 --- a/image.c +++ b/image.c @@ -491,9 +491,7 @@ Returns the number of pixels copied (eg. if r, l or y is out of range) =cut */ int i_glin_d(i_img *im, int l, int r, int y, i_color *vals) { - int x, ch; - int count; - int i; + int ch, count, i; unsigned char *data; if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) { if (r > im->xsize) @@ -527,9 +525,7 @@ Returns the number of pixels copied (eg. if r, l or y is out of range) =cut */ int i_plin_d(i_img *im, int l, int r, int y, i_color *vals) { - int x, ch; - int count; - int i; + int ch, count, i; unsigned char *data; if (y >=0 && y < im->ysize && l < im->xsize && l >= 0) { if (r > im->xsize) @@ -655,7 +651,7 @@ Copies the contents of the image I over the image I. void i_copy(i_img *im, i_img *src) { i_color *pv; - int x,y,y1,x1; + int y, y1, x1; mm_log((1,"i_copy(im* %p,src %p)\n", im, src)); diff --git a/image.h b/image.h index ac76ecd6..1a1d5522 100644 --- a/image.h +++ b/image.h @@ -461,6 +461,7 @@ typedef struct { char *msg; int code; } i_errmsg; + typedef void (*i_error_cb)(int code, char const *msg); typedef void (*i_failed_cb)(i_errmsg *msgs); extern i_error_cb i_set_error_cb(i_error_cb); diff --git a/io.c b/io.c index ca38fa9b..6bc0bbf1 100644 --- a/io.c +++ b/io.c @@ -13,8 +13,8 @@ #define MAXMAL 102400 #define MAXDESC 65 -#define UNDRRNVAL 100 -#define OVERRNVAL 100 +#define UNDRRNVAL 10 +#define OVERRNVAL 10 #define PADBYTE 0xaa @@ -55,7 +55,7 @@ mymalloc_file_line(int size, char* file, int line) { int i; if (malloc_need_init) { for(i=0; itranslate == pt_giflib) diff --git a/tiff.c b/tiff.c index 2587c13a..05a44edf 100644 --- a/tiff.c +++ b/tiff.c @@ -362,11 +362,9 @@ point. undef_int i_writetiff_wiol_faxable(i_img *im, io_glue *ig) { uint32 width, height; - i_color val; unsigned char *linebuf = NULL; uint32 y; - int linebufpos; - int ch, ci, rc; + int rc; uint32 x; TIFF* tif; int luma_channel;