rem: } r++; g++; b++;
add: } } if (a) { r += 4; g += 4; b += 4; a += 4; } else { r += 3; g += 3; b += 3; }
context: RSaveXPM(RImage *image, char *filename){    FILE *file;    int x, y;    int colorCount=0;    int charsPerPixel;    XPMColor *colormap = NULL;    XPMColor *tmpc;    int i;    int ok = 0;    unsigned char *r, *g, *b, *a;    char transp[16];    char buf[128];    file = fopen(filename, "w+");    if (!file) {	RErrorCode = RERR_OPEN;	return False;    }    fprintf(file, "/* XPM */\n");    fprintf(file, "static char *image[] = {\n");    r = image->data;    g = image->data+1;    b = image->data+2;    if (image->format == RRGBAFormat)	a = image->data+3;    else	a = NULL;    /* first pass: make colormap for the image */    if (a)	colorCount = 1;    for (y = 0; y < image->height; y++) {	for (x = 0; x < image->width; x++) {	    if (!a || *a++>127)		if (!addcolor(&colormap, *r, *g, *b, &colorCount)) {		    goto uhoh;		}	    r++; g++; b++;	}    }    charsPerPixel = 1;    while ((1 << charsPerPixel*6) < colorCount)        charsPerPixel++;    /* write header info */    fprintf(file, "\"%i %i %i %i\",\n", image->width, image->height, 	    colorCount, charsPerPixel);    /* write colormap data */    if (image->data[3]) {	for (i=0; i<charsPerPixel; i++)	    transp[i] = ' ';	transp[i] = 0;	fprintf(file, "\"%s c None\",\n", transp);    }        i = 0;    outputcolormap(file, colormap, charsPerPixel);    r = image->data;    g = image->data+1;    b = image->data+2;    if (image->format == RRGBAFormat)	a = image->data+3;    else	a = NULL;    /* write data */    for (y = 0; y < image->height; y++) {	fprintf(file, "\"");	for (x = 0; x < image->width; x++) {	    if (!a || *a++>127) {		tmpc = lookfor(colormap, (unsigned)*r<<16|(unsigned)*g<<8|(unsigned)*b);		fprintf(file, index2str(buf, tmpc->index, charsPerPixel));	    } else {		fprintf(file, transp);	    }	    r++; g++; b++;	}	if (y < image->height-1)	    fprintf(file, "\",\n");	else	    fprintf(file, "\"};\n");    }    ok = 1;uhoh:    errno = 0;    fclose(file);    if (ok && errno==ENOSPC) {	RErrorCode = RERR_WRITE;    }    freecolormap(colormap);    return ok ? True : False;}