Skip to content

Commit

Permalink
long delayed renaming of m_fatal() to i_fatal() to match Imager's
Browse files Browse the repository at this point in the history
functions in general
  • Loading branch information
Tony Cook committed Jun 29, 2006
1 parent 1c988ba commit b1e9695
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions bmp.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion datatypes.c
Expand Up @@ -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");
}
}

Expand Down
4 changes: 2 additions & 2 deletions error.c
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions filters.c
Expand Up @@ -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];
}
Expand Down Expand Up @@ -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; p<num; p++) {
Expand All @@ -1054,7 +1054,7 @@ i_nearest_color_foo(i_img *im, int num, int *xo, int *yo, i_color *ival, int dme
curdist = 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");
}
if (curdist < mindist) {
mindist = curdist;
Expand Down Expand Up @@ -1197,7 +1197,7 @@ i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *oval, int dmeasur
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; p<num; p++) {
Expand All @@ -1214,7 +1214,7 @@ i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *oval, int dmeasur
curdist = 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");
}
if (curdist < mindist) {
mindist = curdist;
Expand Down
4 changes: 2 additions & 2 deletions font.c
Expand Up @@ -1087,14 +1087,14 @@ i_tt_init_raster_map( TT_Raster_Map* bit, int width, int height, int smooth ) {

/* rows can be 0 for some glyphs, for example ' ' */
if (bit->rows && 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 );
}


Expand Down
2 changes: 1 addition & 1 deletion gif.c
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions hlines.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
12 changes: 6 additions & 6 deletions image.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down
26 changes: 13 additions & 13 deletions imexif.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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, " ");
Expand All @@ -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, " ");
Expand Down Expand Up @@ -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];
Expand All @@ -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]
Expand Down Expand Up @@ -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];
Expand All @@ -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]
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions iolayer.c
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions log.c
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit b1e9695

Please sign in to comment.