From: Rickard Hallerbäck Date: Thu, 13 Oct 2022 16:50:57 +0000 (+0200) Subject: tool_paramhlp: make the max argument a 'double' X-Git-Tag: curl-7_86_0~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=703efb3379354282aa4196d2add98afa39b69f6d;p=thirdparty%2Fcurl.git tool_paramhlp: make the max argument a 'double' To fix compiler warnings "Implicit conversion from 'long' to 'double' may lose precision" Closes #9700 --- diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 62b2de035d..af4b3a6984 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -808,7 +808,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ break; case 'c': /* connect-timeout */ err = str2udouble(&config->connecttimeout, nextarg, - LONG_MAX/1000); + (double)LONG_MAX/1000); if(err) return err; break; @@ -1374,7 +1374,8 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ return err; break; case 'R': /* --expect100-timeout */ - err = str2udouble(&config->expect100timeout, nextarg, LONG_MAX/1000); + err = str2udouble(&config->expect100timeout, nextarg, + (double)LONG_MAX/1000); if(err) return err; break; @@ -2067,7 +2068,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ break; case 'm': /* specified max time */ - err = str2udouble(&config->timeout, nextarg, LONG_MAX/1000); + err = str2udouble(&config->timeout, nextarg, (double)LONG_MAX/1000); if(err) return err; break; diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c index 955c61da16..05afb8d3a4 100644 --- a/src/tool_paramhlp.c +++ b/src/tool_paramhlp.c @@ -218,7 +218,7 @@ ParameterError str2unummax(long *val, const char *str, long max) * data. */ -static ParameterError str2double(double *val, const char *str, long max) +static ParameterError str2double(double *val, const char *str, double max) { if(str) { char *endptr; @@ -251,7 +251,7 @@ static ParameterError str2double(double *val, const char *str, long max) * data. */ -ParameterError str2udouble(double *valp, const char *str, long max) +ParameterError str2udouble(double *valp, const char *str, double max) { double value; ParameterError result = str2double(&value, str, max); diff --git a/src/tool_paramhlp.h b/src/tool_paramhlp.h index bd7253dbda..7d68583e67 100644 --- a/src/tool_paramhlp.h +++ b/src/tool_paramhlp.h @@ -36,7 +36,7 @@ ParameterError str2num(long *val, const char *str); ParameterError str2unum(long *val, const char *str); ParameterError oct2nummax(long *val, const char *str, long max); ParameterError str2unummax(long *val, const char *str, long max); -ParameterError str2udouble(double *val, const char *str, long max); +ParameterError str2udouble(double *val, const char *str, double max); ParameterError proto2num(struct OperationConfig *config, const char * const *val, char **obuf,