if (!clr_used)
clr_used = 2;
if (clr_used < 0 || clr_used > 2) {
- i_push_errorf(0, "out of range colors used (%d)", clr_used);
+ im_push_errorf(aIMCTX, 0, "out of range colors used (%d)", clr_used);
return NULL;
}
base_offset = FILEHEAD_SIZE + INFOHEAD_SIZE + clr_used * 4;
if (offbits < base_offset) {
- i_push_errorf(0, "image data offset too small (%ld)", offbits);
+ im_push_errorf(aIMCTX, 0, "image data offset too small (%ld)", offbits);
return NULL;
}
clr_used = 16;
if (clr_used > 16 || clr_used < 0) {
- i_push_errorf(0, "out of range colors used (%d)", clr_used);
+ im_push_errorf(aIMCTX, 0, "out of range colors used (%d)", clr_used);
return NULL;
}
base_offset = FILEHEAD_SIZE + INFOHEAD_SIZE + clr_used * 4;
if (offbits < base_offset) {
- i_push_errorf(0, "image data offset too small (%ld)", offbits);
+ im_push_errorf(aIMCTX, 0, "image data offset too small (%ld)", offbits);
return NULL;
}
else { /*if (compression == BI_RLE4) {*/
myfree(packed);
myfree(line);
- i_push_errorf(0, "unknown 4-bit BMP compression (%d)", compression);
+ im_push_errorf(aIMCTX, 0, "unknown 4-bit BMP compression (%d)", compression);
i_img_destroy(im);
return NULL;
}
if (!clr_used)
clr_used = 256;
if (clr_used > 256 || clr_used < 0) {
- i_push_errorf(0, "out of range colors used (%d)", clr_used);
+ im_push_errorf(aIMCTX, 0, "out of range colors used (%d)", clr_used);
return NULL;
}
base_offset = FILEHEAD_SIZE + INFOHEAD_SIZE + clr_used * 4;
if (offbits < base_offset) {
- i_push_errorf(0, "image data offset too small (%ld)", offbits);
+ im_push_errorf(aIMCTX, 0, "image data offset too small (%ld)", offbits);
return NULL;
}
}
else {
myfree(line);
- i_push_errorf(0, "unknown 8-bit BMP compression (%d)", compression);
+ im_push_errorf(aIMCTX, 0, "unknown 8-bit BMP compression (%d)", compression);
i_img_destroy(im);
return NULL;
}
return 0;
}
if (rmask == 0) {
- i_push_errorf(0, "Zero mask for channel %d", i);
+ im_push_errorf(aIMCTX, 0, "Zero mask for channel %d", i);
return NULL;
}
masks.masks[i] = rmask;
base_offset += 3 * 4;
}
else {
- i_push_errorf(0, "unknown 24-bit BMP compression (%d)", compression);
+ im_push_errorf(aIMCTX, 0, "unknown 24-bit BMP compression (%d)", compression);
return NULL;
}
if (offbits < base_offset) {
- i_push_errorf(0, "image data offset too small (%ld)", offbits);
+ im_push_errorf(aIMCTX, 0, "image data offset too small (%ld)", offbits);
return NULL;
}
}
}
/* fprintf(stderr,"0x%08X\n",l->t); */
- if (llist_llink_push(l,l->t,data)) {
- i_fatal(3, "out of memory\n");
+ if (llist_llink_push(l,l->t,data)) {
+ dIMCTX;
+ im_fatal(aIMCTX, 3, "out of memory\n");
}
}
fdist[p] = i_max(xd*xd, yd*yd); /* manhattan distance */
break;
default:
- i_fatal(3,"i_gradgen: Unknown distance measure\n");
+ im_fatal(aIMCTX, 3,"i_gradgen: Unknown distance measure\n");
}
cs += fdist[p];
}
mindist = i_max(xd*xd, yd*yd); /* manhattan distance */
break;
default:
- i_fatal(3,"i_nearest_color: Unknown distance measure\n");
+ im_fatal(aIMCTX, 3,"i_nearest_color: Unknown distance measure\n");
}
for(p = 1; p<num; p++) {
curdist = i_max(xd*xd, yd*yd); /* manhattan distance */
break;
default:
- i_fatal(3,"i_nearest_color: Unknown distance measure\n");
+ im_fatal(aIMCTX, 3,"i_nearest_color: Unknown distance measure\n");
}
if (curdist < mindist) {
mindist = curdist;
mindist = i_max(xd*xd, yd*yd); /* manhattan distance */
break;
default:
- i_fatal(3,"i_nearest_color: Unknown distance measure\n");
+ im_fatal(aIMCTX, 3,"i_nearest_color: Unknown distance measure\n");
}
for(p = 1; p<num; p++) {
curdist = i_max(xd*xd, yd*yd); /* manhattan distance */
break;
default:
- i_fatal(3,"i_nearest_color: Unknown distance measure\n");
+ im_fatal(aIMCTX, 3,"i_nearest_color: Unknown distance measure\n");
}
if (curdist < mindist) {
mindist = curdist;
size_t bytes = count_y * sizeof(i_int_hline_entry *);
if (bytes / count_y != sizeof(i_int_hline_entry *)) {
- i_fatal(3, "integer overflow calculating memory allocation\n");
+ dIMCTX;
+ im_fatal(aIMCTX, 3, "integer overflow calculating memory allocation\n");
}
hlines->start_y = start_y;
i_img_dim x_limit = x + width;
if (width < 0) {
- i_fatal(3, "negative width %d passed to i_int_hlines_add\n", width);
+ dIMCTX;
+ im_fatal(aIMCTX, 3, "negative width %d passed to i_int_hlines_add\n", width);
}
/* just return if out of range */
im_log((aIMCTX,1,"ICL_new_internal(r %d,g %d,b %d,a %d)\n", r, g, b, a));
- if ( (cl=mymalloc(sizeof(i_color))) == NULL) i_fatal(2,"malloc() error\n");
+ if ( (cl=mymalloc(sizeof(i_color))) == NULL) im_fatal(aIMCTX, 2,"malloc() error\n");
cl->rgba.r = r;
cl->rgba.g = g;
cl->rgba.b = b;
im_log((aIMCTX,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)
- i_fatal(2,"malloc() error\n");
+ im_fatal(aIMCTX, 2,"malloc() error\n");
cl->rgba.r=r;
cl->rgba.g=g;
cl->rgba.b=b;
im_log((aIMCTX, 1,"i_fcolor_new(r %g,g %g,b %g,a %g)\n", r, g, b, a));
- if ( (cl=mymalloc(sizeof(i_fcolor))) == NULL) i_fatal(2,"malloc() error\n");
+ if ( (cl=mymalloc(sizeof(i_fcolor))) == NULL) im_fatal(aIMCTX, 2,"malloc() error\n");
cl->rgba.r = r;
cl->rgba.g = g;
cl->rgba.b = b;
im->ch_mask = MAXINT;
im->bytes=bytes;
if ( (im->idata=mymalloc(im->bytes)) == NULL)
- i_fatal(2,"malloc() error\n");
+ im_fatal(aIMCTX, 2,"malloc() error\n");
memset(im->idata,0,(size_t)im->bytes);
im->ext_data = NULL;