diff --git a/bmp.c b/bmp.c index f2a15cd8..0e8dc62c 100644 --- a/bmp.c +++ b/bmp.c @@ -246,7 +246,7 @@ int read_packed(io_glue *ig, char *format, ...) { break; default: - m_fatal(1, "Unknown read_packed format code 0x%02x", *format); + i_fatal(1, "Unknown read_packed format code 0x%02x", *format); } ++format; } @@ -299,7 +299,7 @@ write_packed(io_glue *ig, char *format, ...) { break; default: - m_fatal(1, "Unknown write_packed format code 0x%02x", *format); + i_fatal(1, "Unknown write_packed format code 0x%02x", *format); } ++format; } diff --git a/datatypes.c b/datatypes.c index e8ecab16..9c04b189 100644 --- a/datatypes.c +++ b/datatypes.c @@ -132,7 +132,7 @@ llist_push(struct llist *l,void *data) { } /* fprintf(stderr,"0x%08X\n",l->t); */ if (llist_llink_push(l,l->t,data)) { - m_fatal(3, "out of memory\n"); + i_fatal(3, "out of memory\n"); } } diff --git a/error.c b/error.c index 3dcab3cd..10c31195 100644 --- a/error.c +++ b/error.c @@ -321,7 +321,7 @@ int i_failed(int code, char const *msg) { ++sp; } /* we want to log the error too, build an error message to hand to - m_fatal() */ + i_fatal() */ total = 1; /* remember the NUL */ for (sp = error_sp; error_stack[sp].msg; ++sp) { total += strlen(error_stack[sp].msg) + 2; @@ -338,7 +338,7 @@ int i_failed(int code, char const *msg) { } /* lose the extra ": " */ full[strlen(full)-2] = '\0'; - m_fatal(EXIT_FAILURE, "%s", full); + i_fatal(EXIT_FAILURE, "%s", full); } return 0; diff --git a/filters.c b/filters.c index 85d55c3c..8611f47d 100644 --- a/filters.c +++ b/filters.c @@ -984,7 +984,7 @@ i_gradgen(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure) { fdist[p] = i_max(xd*xd, yd*yd); /* manhattan distance */ break; default: - m_fatal(3,"i_gradgen: Unknown distance measure\n"); + i_fatal(3,"i_gradgen: Unknown distance measure\n"); } cs += fdist[p]; } @@ -1037,7 +1037,7 @@ i_nearest_color_foo(i_img *im, int num, int *xo, int *yo, i_color *ival, int dme mindist = i_max(xd*xd, yd*yd); /* manhattan distance */ break; default: - m_fatal(3,"i_nearest_color: Unknown distance measure\n"); + i_fatal(3,"i_nearest_color: Unknown distance measure\n"); } for(p = 1; prows && bit->size / bit->rows != bit->cols) { - m_fatal(0, "Integer overflow calculating bitmap size (%d, %d)\n", + i_fatal(0, "Integer overflow calculating bitmap size (%d, %d)\n", bit->width, bit->rows); } mm_log((1,"i_tt_init_raster_map: bit->width %d, bit->cols %d, bit->rows %d, bit->size %d)\n", bit->width, bit->cols, bit->rows, bit->size )); bit->bitmap = (void *) mymalloc( bit->size ); /* checked 6Nov05 tonyc */ - if ( !bit->bitmap ) m_fatal(0,"Not enough memory to allocate bitmap (%d)!\n",bit->size ); + if ( !bit->bitmap ) i_fatal(0,"Not enough memory to allocate bitmap (%d)!\n",bit->size ); } diff --git a/gif.c b/gif.c index 191f24cf..84b51bf1 100644 --- a/gif.c +++ b/gif.c @@ -539,7 +539,7 @@ i_img **i_readgif_multi_low(GifFileType *GifFile, int *count, int page) { Size = GifFile->SWidth * sizeof(GifPixelType); if ((GifRow = (GifRowType) mymalloc(Size)) == NULL) - m_fatal(0,"Failed to allocate memory required, aborted."); /* First row. */ + i_fatal(0,"Failed to allocate memory required, aborted."); /* First row. */ /* Scan the content of the GIF file and load the image(s) in: */ do { diff --git a/hlines.c b/hlines.c index 685ed164..cd74f241 100644 --- a/hlines.c +++ b/hlines.c @@ -68,7 +68,7 @@ i_int_init_hlines( int bytes = count_y * sizeof(i_int_hline_entry *); if (bytes / count_y != sizeof(i_int_hline_entry *)) { - m_fatal(3, "integer overflow calculating memory allocation\n"); + i_fatal(3, "integer overflow calculating memory allocation\n"); } hlines->start_y = start_y; @@ -111,7 +111,7 @@ i_int_hlines_add(i_int_hlines *hlines, int y, int x, int width) { int x_limit = x + width; if (width < 0) { - m_fatal(3, "negative width %d passed to i_int_hlines_add\n", width); + i_fatal(3, "negative width %d passed to i_int_hlines_add\n", width); } /* just return if out of range */ diff --git a/image.c b/image.c index 3d8880ba..a96a383a 100644 --- a/image.c +++ b/image.c @@ -71,7 +71,7 @@ ICL_new_internal(unsigned char r,unsigned char g,unsigned char b,unsigned char a mm_log((1,"ICL_new_internal(r %d,g %d,b %d,a %d)\n", r, g, b, a)); - if ( (cl=mymalloc(sizeof(i_color))) == NULL) m_fatal(2,"malloc() error\n"); + if ( (cl=mymalloc(sizeof(i_color))) == NULL) i_fatal(2,"malloc() error\n"); cl->rgba.r = r; cl->rgba.g = g; cl->rgba.b = b; @@ -100,7 +100,7 @@ ICL_set_internal(i_color *cl,unsigned char r,unsigned char g,unsigned char b,uns mm_log((1,"ICL_set_internal(cl* %p,r %d,g %d,b %d,a %d)\n",cl,r,g,b,a)); if (cl == NULL) if ( (cl=mymalloc(sizeof(i_color))) == NULL) - m_fatal(2,"malloc() error\n"); + i_fatal(2,"malloc() error\n"); cl->rgba.r=r; cl->rgba.g=g; cl->rgba.b=b; @@ -173,7 +173,7 @@ i_fcolor *i_fcolor_new(double r, double g, double b, double a) { mm_log((1,"i_fcolor_new(r %g,g %g,b %g,a %g)\n", r, g, b, a)); - if ( (cl=mymalloc(sizeof(i_fcolor))) == NULL) m_fatal(2,"malloc() error\n"); + if ( (cl=mymalloc(sizeof(i_fcolor))) == NULL) i_fatal(2,"malloc() error\n"); cl->rgba.r = r; cl->rgba.g = g; cl->rgba.b = b; @@ -300,7 +300,7 @@ i_img_new() { mm_log((1,"i_img_struct()\n")); if ( (im=mymalloc(sizeof(i_img))) == NULL) - m_fatal(2,"malloc() error\n"); + i_fatal(2,"malloc() error\n"); *im = IIM_base_8bit_direct; im->xsize=0; @@ -372,7 +372,7 @@ i_img_empty_ch(i_img *im,int x,int y,int ch) { if (im == NULL) if ( (im=mymalloc(sizeof(i_img))) == NULL) - m_fatal(2,"malloc() error\n"); + i_fatal(2,"malloc() error\n"); memcpy(im, &IIM_base_8bit_direct, sizeof(i_img)); i_tags_new(&im->tags); @@ -382,7 +382,7 @@ i_img_empty_ch(i_img *im,int x,int y,int ch) { im->ch_mask = MAXINT; im->bytes=bytes; if ( (im->idata=mymalloc(im->bytes)) == NULL) - m_fatal(2,"malloc() error\n"); + i_fatal(2,"malloc() error\n"); memset(im->idata,0,(size_t)im->bytes); im->ext_data = NULL; diff --git a/imexif.c b/imexif.c index 186dbb3b..9741f7a7 100644 --- a/imexif.c +++ b/imexif.c @@ -1013,7 +1013,7 @@ tiff_get_tag_double_array(imtiff *tiff, int index, double *result, ifd_entry *entry; unsigned long offset; if (index < 0 || index >= tiff->ifd_size) { - m_fatal(3, "tiff_get_tag_double_array() tag index out of range"); + i_fatal(3, "tiff_get_tag_double_array() tag index out of range"); } entry = tiff->ifd + index; @@ -1077,7 +1077,7 @@ static int tiff_get_tag_double(imtiff *tiff, int index, double *result) { ifd_entry *entry; if (index < 0 || index >= tiff->ifd_size) { - m_fatal(3, "tiff_get_tag_double() index out of range"); + i_fatal(3, "tiff_get_tag_double() index out of range"); } entry = tiff->ifd + index; @@ -1108,12 +1108,12 @@ tiff_get_tag_int_array(imtiff *tiff, int index, int *result, int array_index) { ifd_entry *entry; unsigned long offset; if (index < 0 || index >= tiff->ifd_size) { - m_fatal(3, "tiff_get_tag_int_array() tag index out of range"); + i_fatal(3, "tiff_get_tag_int_array() tag index out of range"); } entry = tiff->ifd + index; if (array_index < 0 || array_index >= entry->count) { - m_fatal(3, "tiff_get_tag_int_array() array index out of range"); + i_fatal(3, "tiff_get_tag_int_array() array index out of range"); } offset = entry->offset + array_index * entry->item_size; @@ -1163,7 +1163,7 @@ static int tiff_get_tag_int(imtiff *tiff, int index, int *result) { ifd_entry *entry; if (index < 0 || index >= tiff->ifd_size) { - m_fatal(3, "tiff_get_tag_int() index out of range"); + i_fatal(3, "tiff_get_tag_int() index out of range"); } entry = tiff->ifd + index; @@ -1290,7 +1290,7 @@ copy_num_array_tags(i_img *im, imtiff *tiff, tag_map *map, int map_count) { *workstr = '\0'; for (j = 0; j < entry->count; ++j) { if (!tiff_get_tag_double_array(tiff, tag_index, &value, j)) { - m_fatal(3, "unexpected failure from tiff_get_tag_double_array(..., %d, ..., %d)\n", tag_index, j); + i_fatal(3, "unexpected failure from tiff_get_tag_double_array(..., %d, ..., %d)\n", tag_index, j); } if (j) strcat(workstr, " "); @@ -1306,7 +1306,7 @@ copy_num_array_tags(i_img *im, imtiff *tiff, tag_map *map, int map_count) { *workstr = '\0'; for (j = 0; j < entry->count; ++j) { if (!tiff_get_tag_int_array(tiff, tag_index, &value, j)) { - m_fatal(3, "unexpected failure from tiff_get_tag_int_array(..., %d, ..., %d)\n", tag_index, j); + i_fatal(3, "unexpected failure from tiff_get_tag_int_array(..., %d, ..., %d)\n", tag_index, j); } if (j) strcat(workstr, " "); @@ -1383,7 +1383,7 @@ Retrieve a 16 bit unsigned integer from offset. static unsigned tiff_get16(imtiff *tiff, unsigned long offset) { if (offset + 2 > tiff->size) - m_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size); + i_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size); if (tiff->type == tt_intel) return tiff->base[offset] + 0x100 * tiff->base[offset+1]; @@ -1402,7 +1402,7 @@ Retrieve a 32-bit unsigned integer from offset. static unsigned tiff_get32(imtiff *tiff, unsigned long offset) { if (offset + 4 > tiff->size) - m_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size); + i_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size); if (tiff->type == tt_intel) return tiff->base[offset] + 0x100 * tiff->base[offset+1] @@ -1447,7 +1447,7 @@ tiff_get16s(imtiff *tiff, unsigned long offset) { int result; if (offset + 2 > tiff->size) - m_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size); + i_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size); if (tiff->type == tt_intel) result = tiff->base[offset] + 0x100 * tiff->base[offset+1]; @@ -1473,7 +1473,7 @@ tiff_get32s(imtiff *tiff, unsigned long offset) { unsigned work; if (offset + 4 > tiff->size) - m_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size); + i_fatal(3, "attempt to get16 at %uld in %uld image", offset, tiff->size); if (tiff->type == tt_intel) work = tiff->base[offset] + 0x100 * tiff->base[offset+1] @@ -1501,7 +1501,7 @@ static double tiff_get_rat(imtiff *tiff, unsigned long offset) { unsigned long numer, denom; if (offset + 8 > tiff->size) - m_fatal(3, "attempt to get_rat at %lu in %lu image", offset, tiff->size); + i_fatal(3, "attempt to get_rat at %lu in %lu image", offset, tiff->size); numer = tiff_get32(tiff, offset); denom = tiff_get32(tiff, offset+4); @@ -1525,7 +1525,7 @@ static double tiff_get_rats(imtiff *tiff, unsigned long offset) { long numer, denom; if (offset + 8 > tiff->size) - m_fatal(3, "attempt to get_rat at %lu in %lu image", offset, tiff->size); + i_fatal(3, "attempt to get_rat at %lu in %lu image", offset, tiff->size); numer = tiff_get32s(tiff, offset); denom = tiff_get32s(tiff, offset+4); diff --git a/iolayer.c b/iolayer.c index 25f2ad6e..2ef6f501 100644 --- a/iolayer.c +++ b/iolayer.c @@ -761,7 +761,7 @@ bufchain_seek(io_glue *ig, off_t offset, int whence) { ssize_t rc, wl = i_min(wrlen, BBSIZ); mm_log((1, "bufchain_seek: wrlen = %d, wl = %d\n", wrlen, wl)); rc = bufchain_write( ig, TB, wl ); - if (rc != wl) m_fatal(0, "bufchain_seek: Unable to extend file\n"); + if (rc != wl) i_fatal(0, "bufchain_seek: Unable to extend file\n"); wrlen -= rc; } } @@ -1049,7 +1049,7 @@ io_slurp(io_glue *ig, unsigned char **c) { io_type inn = ig->source.type; if ( inn != BUFCHAIN ) { - m_fatal(0, "io_slurp: called on a source that is not from a bufchain\n"); + i_fatal(0, "io_slurp: called on a source that is not from a bufchain\n"); } ieb = ig->exdata; @@ -1062,7 +1062,7 @@ io_slurp(io_glue *ig, unsigned char **c) { rc = bufchain_read(ig, cc, ieb->length); if (rc != ieb->length) - m_fatal(1, "io_slurp: bufchain_read returned an incomplete read: rc = %d, request was %d\n", rc, ieb->length); + i_fatal(1, "io_slurp: bufchain_read returned an incomplete read: rc = %d, request was %d\n", rc, ieb->length); return rc; } diff --git a/log.c b/log.c index 52f39397..fb08ffd4 100644 --- a/log.c +++ b/log.c @@ -38,7 +38,7 @@ i_init_log(const char* name,int level) { } void -m_fatal(int exitcode,const char *fmt, ... ) { +i_fatal(int exitcode,const char *fmt, ... ) { va_list ap; time_t timi; struct tm *str_tm; @@ -62,7 +62,7 @@ m_fatal(int exitcode,const char *fmt, ... ) { */ void i_init_log(const char* name,int onoff) {} -void m_fatal(int exitcode,const char *fmt, ... ) { exit(exitcode); } +void i_fatal(int exitcode,const char *fmt, ... ) { exit(exitcode); } #endif