char1 = colorTable[a].string[0];
char1 = (unsigned char) colorTable[a].string[0];
ParseAndPutPixels(#ifdef FOR_MSW		  dc,#endif		  data, width, height, ncolors, cpp, colorTable, hashtable,		  image, image_pixels, shapeimage, shape_pixels)#ifdef FOR_MSW    Display *dc;#endif    xpmData *data;    unsigned int width;    unsigned int height;    unsigned int ncolors;    unsigned int cpp;    XpmColor *colorTable;    xpmHashTable *hashtable;    XImage *image;    Pixel *image_pixels;    XImage *shapeimage;    Pixel *shape_pixels;{    unsigned int a, x, y;    switch (cpp) {    case (1):				/* Optimize for single character					 * colors */	{	    unsigned short colidx[256];#ifdef FOR_MSW	    HDC shapedc;	    HBITMAP obm, sobm;	    if ( shapeimage ) {		shapedc = CreateCompatibleDC(*dc);		sobm = SelectObject(shapedc, shapeimage->bitmap);	    } else {	        shapedc = NULL;	    }	    obm = SelectObject(*dc, image->bitmap);#endif	    if (ncolors > 256)		return (XpmFileInvalid);	    bzero((char *)colidx, 256 * sizeof(short));	    for (a = 0; a < ncolors; a++)		colidx[(unsigned char)colorTable[a].string[0]] = a + 1;	    for (y = 0; y < height; y++) {		xpmNextString(data);		for (x = 0; x < width; x++) {		    int c = xpmGetC(data);		    if (c > 0 && c < 256 && colidx[c] != 0) {#ifndef FOR_MSW			XPutPixel(image, x, y, image_pixels[colidx[c] - 1]);			if (shapeimage)			    XPutPixel(shapeimage, x, y,				      shape_pixels[colidx[c] - 1]);#else			SetPixel(*dc, x, y, image_pixels[colidx[c] - 1]);			if (shapedc) {			    SetPixel(shapedc, x, y, shape_pixels[colidx[c] - 1]);			}#endif		    } else			return (XpmFileInvalid);		}	    }#ifdef FOR_MSW	    if ( shapedc ) {	        SelectObject(shapedc, sobm);		DeleteDC(shapedc);	    }	    SelectObject(*dc, obm);#endif	}	break;    case (2):				/* Optimize for double character					 * colors */	{/* free all allocated pointers at all exits */#define FREE_CIDX {int f; for (f = 0; f < 256; f++) \if (cidx[f]) XpmFree(cidx[f]);}	    /* array of pointers malloced by need */	    unsigned short *cidx[256];	    int char1;	    bzero((char *)cidx, 256 * sizeof(unsigned short *)); /* init */	    for (a = 0; a < ncolors; a++) {		char1 = colorTable[a].string[0];		if (cidx[char1] == NULL) { /* get new memory */		    cidx[char1] = (unsigned short *)			XpmCalloc(256, sizeof(unsigned short));		    if (cidx[char1] == NULL) { /* new block failed */			FREE_CIDX;			return (XpmNoMemory);		    }		}		cidx[char1][(unsigned char)colorTable[a].string[1]] = a + 1;	    }	    for (y = 0; y < height; y++) {		xpmNextString(data);		for (x = 0; x < width; x++) {		    int cc1 = xpmGetC(data);		    if (cc1 > 0 && cc1 < 256) {			int cc2 = xpmGetC(data);			if (cc2 > 0 && cc2 < 256 &&			    cidx[cc1] && cidx[cc1][cc2] != 0) {#ifndef FOR_MSW			    XPutPixel(image, x, y,				      image_pixels[cidx[cc1][cc2] - 1]);			    if (shapeimage)				XPutPixel(shapeimage, x, y,					  shape_pixels[cidx[cc1][cc2] - 1]);#else			SelectObject(*dc, image->bitmap);			SetPixel(*dc, x, y, image_pixels[cidx[cc1][cc2] - 1]);			if (shapeimage) {			    SelectObject(*dc, shapeimage->bitmap);			    SetPixel(*dc, x, y,				     shape_pixels[cidx[cc1][cc2] - 1]);			}#endif			} else {			    FREE_CIDX;			    return (XpmFileInvalid);			}		    } else {			FREE_CIDX;			return (XpmFileInvalid);		    }		}	    }	    FREE_CIDX;	}	break;    default:				/* Non-optimized case of long color					 * names */	{	    char *s;	    char buf[BUFSIZ];	    if (cpp >= sizeof(buf))		return (XpmFileInvalid);	    buf[cpp] = '\0';	    if (USE_HASHTABLE) {		xpmHashAtom *slot;		for (y = 0; y < height; y++) {		    xpmNextString(data);		    for (x = 0; x < width; x++) {			for (a = 0, s = buf; a < cpp; a++, s++)			    *s = xpmGetC(data);			slot = xpmHashSlot(hashtable, buf);			if (!*slot)	/* no color matches */			    return (XpmFileInvalid);#ifndef FOR_MSW			XPutPixel(image, x, y,				  image_pixels[HashColorIndex(slot)]);			if (shapeimage)			    XPutPixel(shapeimage, x, y,				      shape_pixels[HashColorIndex(slot)]);#else			SelectObject(*dc, image->bitmap);			SetPixel(*dc, x, y,				 image_pixels[HashColorIndex(slot)]);			if (shapeimage) {			    SelectObject(*dc, shapeimage->bitmap);			    SetPixel(*dc, x, y,				     shape_pixels[HashColorIndex(slot)]);			}#endif		    }		}	    } else {		for (y = 0; y < height; y++) {		    xpmNextString(data);		    for (x = 0; x < width; x++) {			for (a = 0, s = buf; a < cpp; a++, s++)			    *s = xpmGetC(data);			for (a = 0; a < ncolors; a++)			    if (!strcmp(colorTable[a].string, buf))				break;			if (a == ncolors)	/* no color matches */			    return (XpmFileInvalid);#ifndef FOR_MSW			XPutPixel(image, x, y, image_pixels[a]);			if (shapeimage)			    XPutPixel(shapeimage, x, y, shape_pixels[a]);#else			SelectObject(*dc, image->bitmap);			SetPixel(*dc, x, y, image_pixels[a]);			if (shapeimage) {			    SelectObject(*dc, shapeimage->bitmap);			    SetPixel(*dc, x, y, shape_pixels[a]);			}#endif		    }		}	    }	}	break;    }    return (XpmSuccess);}