if (sscanf(str, "%lf", &f) != 1) { rfbLog("bad -scale arg: %s\n", str);
if (sscanf(tstr, "%lf", &f) != 1) { rfbLog("bad -scale arg: %s\n", tstr);
void parse_scale_string(char *str) {	int m, n;	char *p;	double f;	scale_fac = 1.0;	scaling = 0;	scaling_noblend = 0;	scaling_nomult4 = 0;	scaling_pad = 0;	scaling_interpolate = 0;	scaled_x = 0, scaled_y = 0;	scale_numer = 0, scale_denom = 0;	if (str == NULL || str[0] == '\0') {		return;	}		if ( (p = strchr(str, ':')) != NULL) {		/* options */		if (strstr(p+1, "nb") != NULL) {			scaling_noblend = 1;		}		if (strstr(p+1, "n4") != NULL) {			scaling_nomult4 = 1;		}		if (strstr(p+1, "in") != NULL) {			scaling_interpolate = 1;		}		if (strstr(p+1, "pad") != NULL) {			scaling_pad = 1;		}		*p = '\0';	}	if (strchr(str, '.') != NULL) {		double test, diff, eps = 1.0e-7;		if (sscanf(str, "%lf", &f) != 1) {			rfbLog("bad -scale arg: %s\n", str);			clean_up_exit(1);		}		scale_fac = (double) f;		/* look for common fractions from small ints: */		for (n=2; n<=10; n++) {			for (m=1; m<n; m++) {				test = ((double) m)/ n;				diff = scale_fac - test;				if (-eps < diff && diff < eps) {					scale_numer = m;					scale_denom = n;					break;								}			}			if (scale_denom) {				break;			}		}		if (scale_fac < 0.01) {			rfbLog("-scale factor too small: %f\n", scale_fac);			clean_up_exit(1);		}	} else {		if (sscanf(str, "%d/%d", &m, &n) != 2) {			if (sscanf(str, "%d", &m) != 1) {				rfbLog("bad -scale arg: %s\n", str);				clean_up_exit(1);			} else {				/* e.g. -scale 1 or -scale 2 */				n = 1;			}		}		if (n <= 0 || m <=0) {			rfbLog("bad -scale arg: %s\n", str);			clean_up_exit(1);		}		scale_fac = ((double) m)/ n;		if (scale_fac < 0.01) {			rfbLog("-scale factor too small: %f\n", scale_fac);			clean_up_exit(1);		}		scale_numer = m;		scale_denom = n;	}	if (scale_fac == 1.0) {		if (! quiet) {			rfbLog("scaling disabled for factor %f\n", scale_fac);		}	} else {		scaling = 1;	}}