diff options
author | AlexSm <alex@ydb.tech> | 2023-12-22 17:10:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-22 17:10:22 +0100 |
commit | 148f920350c60c0ca2d89b637a5aea9093eee450 (patch) | |
tree | 6314b1433dac833398c333731e83f0ad77e81a0b /contrib/libs/curl/src/tool_paramhlp.c | |
parent | 7116d46ae7c0259b5f9d489de263f8701e432b1c (diff) | |
download | ydb-148f920350c60c0ca2d89b637a5aea9093eee450.tar.gz |
Library import 2 (#639)
Diffstat (limited to 'contrib/libs/curl/src/tool_paramhlp.c')
-rw-r--r-- | contrib/libs/curl/src/tool_paramhlp.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/contrib/libs/curl/src/tool_paramhlp.c b/contrib/libs/curl/src/tool_paramhlp.c index d2248442b1..05afb8d3a4 100644 --- a/contrib/libs/curl/src/tool_paramhlp.c +++ b/contrib/libs/curl/src/tool_paramhlp.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -240,9 +240,8 @@ static ParameterError str2double(double *val, const char *str, double max) } /* - * Parse the string as seconds with decimals, and write the number of - * milliseconds that corresponds in the given address. Return PARAM_OK on - * success, otherwise a parameter error enum. ONLY ACCEPTS POSITIVE NUMBERS! + * Parse the string and write the double in the given address. Return PARAM_OK + * on success, otherwise a parameter error enum. ONLY ACCEPTS POSITIVE NUMBERS! * * The 'max' argument is the maximum value allowed, as the numbers are often * multiplied when later used. @@ -252,16 +251,16 @@ static ParameterError str2double(double *val, const char *str, double max) * data. */ -ParameterError secs2ms(long *valp, const char *str) +ParameterError str2udouble(double *valp, const char *str, double max) { double value; - ParameterError result = str2double(&value, str, (double)LONG_MAX/1000); + ParameterError result = str2double(&value, str, max); if(result != PARAM_OK) return result; if(value < 0) return PARAM_NEGATIVE_NUMERIC; - *valp = (long)(value*1000); + *valp = value; return PARAM_OK; } @@ -369,7 +368,7 @@ ParameterError proto2num(struct OperationConfig *config, /* Process token modifiers */ while(!ISALNUM(*token)) { /* may be NULL if token is all modifiers */ - switch(*token++) { + switch (*token++) { case '=': action = set; break; @@ -418,7 +417,7 @@ ParameterError proto2num(struct OperationConfig *config, if no protocols are allowed */ if(action == set) protoset[0] = NULL; - warnf(config->global, "unrecognized protocol '%s'", token); + warnf(config->global, "unrecognized protocol '%s'\n", token); } } } @@ -433,7 +432,6 @@ ParameterError proto2num(struct OperationConfig *config, result = curlx_dyn_addf(&obuf, "%s,", protoset[proto]); free((char *) protoset); curlx_dyn_setlen(&obuf, curlx_dyn_len(&obuf) - 1); - free(*ostr); *ostr = curlx_dyn_ptr(&obuf); return *ostr ? PARAM_OK : PARAM_NO_MEM; @@ -474,7 +472,7 @@ ParameterError str2offset(curl_off_t *val, const char *str) #if(SIZEOF_CURL_OFF_T > SIZEOF_LONG) { - CURLofft offt = curlx_strtoofft(str, &endptr, 10, val); + CURLofft offt = curlx_strtoofft(str, &endptr, 0, val); if(CURL_OFFT_FLOW == offt) return PARAM_NUMBER_TOO_LARGE; else if(CURL_OFFT_INVAL == offt) @@ -566,7 +564,7 @@ int ftpfilemethod(struct OperationConfig *config, const char *str) if(curl_strequal("multicwd", str)) return CURLFTPMETHOD_MULTICWD; - warnf(config->global, "unrecognized ftp file method '%s', using default", + warnf(config->global, "unrecognized ftp file method '%s', using default\n", str); return CURLFTPMETHOD_MULTICWD; @@ -579,7 +577,7 @@ int ftpcccmethod(struct OperationConfig *config, const char *str) if(curl_strequal("active", str)) return CURLFTPSSL_CCC_ACTIVE; - warnf(config->global, "unrecognized ftp CCC method '%s', using default", + warnf(config->global, "unrecognized ftp CCC method '%s', using default\n", str); return CURLFTPSSL_CCC_PASSIVE; @@ -594,7 +592,7 @@ long delegation(struct OperationConfig *config, const char *str) if(curl_strequal("always", str)) return CURLGSSAPI_DELEGATION_FLAG; - warnf(config->global, "unrecognized delegation method '%s', using none", + warnf(config->global, "unrecognized delegation method '%s', using none\n", str); return CURLGSSAPI_DELEGATION_NONE; @@ -665,7 +663,7 @@ CURLcode get_args(struct OperationConfig *config, const size_t i) if(!config->useragent) { config->useragent = my_useragent(); if(!config->useragent) { - errorf(config->global, "out of memory"); + errorf(config->global, "out of memory\n"); result = CURLE_OUT_OF_MEMORY; } } |