if (sscanf(vstring, "%d", &v_in) == 1) {
if (sscanf(vstring, "%u", &v_in) == 1) {
void set_visual(char *str) {	int vis, vdepth, defdepth = DefaultDepth(dpy, scr);	XVisualInfo vinfo;	char *p, *vstring = strdup(str);	visual_id = (VisualID) 0;	visual_depth = 0;	if (!strcmp(vstring, "ignore") || !strcmp(vstring, "default")	    || !strcmp(vstring, "")) {		free(vstring);		return;	}	/* set visual depth */	if ((p = strchr(vstring, ':')) != NULL) {		visual_depth = atoi(p+1);		*p = '\0';		vdepth = visual_depth;	} else {		vdepth = defdepth; 	}	if (! quiet) {		fprintf(stderr, "\nVisual Info:\n");		fprintf(stderr, " set_visual(\"%s\")\n", str);		fprintf(stderr, " visual_depth: %d\n", vdepth);	}	/* set visual id number */	if (strcmp(vstring, "StaticGray") == 0) {		vis = StaticGray;	} else if (strcmp(vstring, "GrayScale") == 0) {		vis = GrayScale;	} else if (strcmp(vstring, "StaticColor") == 0) {		vis = StaticColor;	} else if (strcmp(vstring, "PseudoColor") == 0) {		vis = PseudoColor;	} else if (strcmp(vstring, "TrueColor") == 0) {		vis = TrueColor;	} else if (strcmp(vstring, "DirectColor") == 0) {		vis = DirectColor;	} else {		int v_in;		if (sscanf(vstring, "0x%x", &v_in) != 1) {			if (sscanf(vstring, "%d", &v_in) == 1) {				visual_id = (VisualID) v_in;				return;			}			rfbLog("bad -visual arg: %s\n", vstring);			X_UNLOCK;			clean_up_exit(1);		}		visual_id = (VisualID) v_in;		free(vstring);		return;	}	if (! quiet) fprintf(stderr, " visual: %d\n", vis);	if (XMatchVisualInfo(dpy, scr, visual_depth, vis, &vinfo)) {		;	} else if (XMatchVisualInfo(dpy, scr, defdepth, vis, &vinfo)) {		;	} else {		rfbLog("could not find visual: %s\n", vstring);		X_UNLOCK;		clean_up_exit(1);	}	free(vstring);	/* set numerical visual id. */	visual_id = vinfo.visualid;}