[comp.windows.x] lack of return value from Xtconvert

rusty@VIOLET.BERKELEY.EDU (07/15/88)

Someone posted a program "colordemo" that uses the X toolkit which
makes a bunch of label widgets, one for each color in the rgb.txt
file.  I fixed it up to work with the rgb.txt file distributed with
x11.

On an 8 plane color display it works with the distributed rgb.txt
file.  On a 4 plane color display (uvax 2000) it runs out of color map
entries.  The problem is that the program uses XtConvert to convert
from a color name to a pixel value:

static Pixel
stringToPixel(w, colorname)
	Widget w;
	String colorname;
{
	XrmValue	in, out;

	in.addr = colorname;
	in.size = strlen(colorname) + 1;
	XtConvert(w, XtRString, &in, XtRPixel, &out);

	return(*((Pixel *) out.addr));
}

but XtConvert doesn't return anything, so the program has no way of
knowing that the color map has been exhausted.  Are there any plans to
have XtConvert return something or am I just screwed?

swick@ATHENA.MIT.EDU (Ralph R. Swick) (07/15/88)

     Date:  15 Jul 88 05:41:32 GMT
     From:  VIOLET.BERKELEY.EDU!rusty@ucbvax.berkeley.edu

     The problem is that the program uses XtConvert to convert
     from a color name to a pixel value:
     ...
     but XtConvert doesn't return anything, so the program has no way of
     knowing that the color map has been exhausted.

If the conversion was not successful, the return value address will be NULL.