Skip to content
Browse files

Removed a bunch of unused variables and fixed an attempt to print out a

structure pointer in error.c
  • Loading branch information...
1 parent 2ff8ed3 commit a743c0a625a41e31c47e8bf52b88fc8949b879dd Arnar Mar Hrafnkelsson committed May 14, 2001
Showing with 17 additions and 126 deletions.
  1. +0 −4 Imager.xs
  2. +1 −1 convert.c
  3. +1 −1 error.c
  4. +1 −4 filters.c
  5. +1 −1 font.c
  6. +3 −99 gif.c
  7. +3 −7 image.c
  8. +1 −0 image.h
  9. +5 −5 io.c
  10. +0 −1 quant.c
  11. +1 −3 tiff.c
View
4 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, ...)
View
2 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));
View
2 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
View
5 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;
View
2 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 ) {
View
102 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<xsize;x++) for(y=0;y<ysize;y++) {
- i_gpix(im,x,y,&val);
- colors+=octt_add(ct,val.rgb.r,val.rgb.g,val.rgb.b);
- /* if (colors > 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");
View
10 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<src> over the image I<im>.
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));
View
1 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);
View
10 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; i<MAXMAL; i++) malloc_pointers[i].point = NULL;
- malloc_need_init=0;
+ malloc_need_init = 0;
atexit(malloc_state);
}
@@ -157,7 +157,7 @@ myfree_file_line(void *p, char *file, int line) {
}
if (match != 1) {
- mm_log((1, "myfree_file_line: inconsistent refcount %d\n", match));
+ mm_log((1, "myfree_file_line: INCONSISTENT REFCOUNT %d\n", match));
}
mm_log((1, "myfree_file_line: freeing address %p\n", pp-UNDRRNVAL));
@@ -179,7 +179,7 @@ mymalloc(int size) {
void *buf;
mm_log((1, "mymalloc(size %d)\n", size));
- if ( (buf=malloc(size)) == NULL ) {
+ if ( (buf = malloc(size)) == NULL ) {
mm_log((1, "mymalloc: unable to malloc\n", size));
fprintf(stderr,"Unable to malloc.\n"); exit(3);
}
View
1 quant.c
@@ -27,7 +27,6 @@ setcol(i_color *cl,unsigned char r,unsigned char g,unsigned char b,unsigned char
void
quant_makemap(i_quantize *quant, i_img **imgs, int count) {
- i_color temp;
#ifdef HAVE_LIBGIF
/* giflib does it's own color table generation */
if (quant->translate == pt_giflib)
View
4 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;

0 comments on commit a743c0a

Please sign in to comment.
Something went wrong with that request. Please try again.