From: Rose <83477269+AtariDreams@users.noreply.github.com> Date: Thu, 2 Mar 2023 14:29:24 +0000 (-0500) Subject: Prefer atof over strtod X-Git-Tag: v2.4.3~41^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6369cd353b2f2c40ae944f75dafa00cc88f760c4;p=thirdparty%2Fcups.git Prefer atof over strtod This is much simpler to call over strtod and is supported on more older platforms. --- diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index 53ff616cbc..863e885568 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -3510,8 +3510,8 @@ get_option_value( uval = cgiGetVariable("PageSize.Units"); if (!val || !lval || !uval || - (width = strtod(val, NULL)) == 0.0 || - (length = strtod(lval, NULL)) == 0.0 || + (width = atof(val)) == 0.0 || + (length = atof(lval)) == 0.0 || (strcmp(uval, "pt") && strcmp(uval, "in") && strcmp(uval, "ft") && strcmp(uval, "cm") && strcmp(uval, "mm") && strcmp(uval, "m"))) return (NULL); @@ -3543,7 +3543,7 @@ get_option_value( case PPD_CUSTOM_CURVE : case PPD_CUSTOM_INVCURVE : case PPD_CUSTOM_REAL : - if ((number = strtod(val, NULL)) == 0.0 || + if ((number = atof(val)) == 0.0 || number < cparam->minimum.custom_real || number > cparam->maximum.custom_real) return (NULL); @@ -3564,7 +3564,7 @@ get_option_value( case PPD_CUSTOM_POINTS : snprintf(keyword, sizeof(keyword), "%s.Units", coption->keyword); - if ((number = strtod(val, NULL)) == 0.0 || + if ((number = atof(val)) == 0.0 || (uval = cgiGetVariable(keyword)) == NULL || (strcmp(uval, "pt") && strcmp(uval, "in") && strcmp(uval, "ft") && strcmp(uval, "cm") && strcmp(uval, "mm") && strcmp(uval, "m"))) @@ -3624,7 +3624,7 @@ get_option_value( case PPD_CUSTOM_CURVE : case PPD_CUSTOM_INVCURVE : case PPD_CUSTOM_REAL : - if ((number = strtod(val, NULL)) == 0.0 || + if ((number = atof(val)) == 0.0 || number < cparam->minimum.custom_real || number > cparam->maximum.custom_real) return (NULL); @@ -3645,7 +3645,7 @@ get_option_value( case PPD_CUSTOM_POINTS : snprintf(keyword, sizeof(keyword), "%s.Units", coption->keyword); - if ((number = strtod(val, NULL)) == 0.0 || + if ((number = atof(val)) == 0.0 || (uval = cgiGetVariable(keyword)) == NULL || (strcmp(uval, "pt") && strcmp(uval, "in") && strcmp(uval, "ft") && strcmp(uval, "cm") && diff --git a/cups/string.c b/cups/string.c index 93cdad19d5..00454203c3 100644 --- a/cups/string.c +++ b/cups/string.c @@ -517,7 +517,7 @@ _cupsStrScand(const char *buf, /* I - Pointer to number */ *tempptr = '\0'; - return (strtod(temp, NULL)); + return (atof(temp)); } diff --git a/man/mantohtml.c b/man/mantohtml.c index 0c9c8837c9..c0c3ca44c1 100644 --- a/man/mantohtml.c +++ b/man/mantohtml.c @@ -506,7 +506,7 @@ main(int argc, /* I - Number of command-line args */ * Indent... */ - float amount = 3.0; /* Indentation */ + float amount = 3.0f; /* Indentation */ if (line[3]) amount = (float)atof(line + 4); @@ -552,7 +552,7 @@ main(int argc, /* I - Number of command-line args */ * .HP i */ - float amount = 3.0; /* Indentation */ + float amount = 3.0f; /* Indentation */ if (line[3]) amount = (float)atof(line + 4); @@ -585,10 +585,10 @@ main(int argc, /* I - Number of command-line args */ * .TP i */ - float amount = 3.0; /* Indentation */ + float amount = 3.0f; /* Indentation */ if (line[3]) - amount = (float)atof(line + 4); + amount = (float)atof(line + 4, NULL); fputs(end_fonts[font], outfile); font = 0; @@ -624,7 +624,7 @@ main(int argc, /* I - Number of command-line args */ * .IP x i */ - float amount = 3.0; /* Indentation */ + float amount = 3.0f; /* Indentation */ const char *newlist = NULL; /* New list style */ const char *newtype = NULL; /* New list numbering type */