summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/ftplistparser.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-10-11 12:13:44 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-10-11 12:14:44 (GMT)
commit48a58e91a6c50539260fb9744b98fb8857a8803c (patch)
tree92349f6ad61e76ce97867a273ec2cf6bc1eb563a /Utilities/cmcurl/lib/ftplistparser.c
parent6ada7f2e9baab9a75084d162a8ea2114487b3291 (diff)
parentbb7591487d95ff9b638c7c1702a8dca2a9e39b45 (diff)
downloadCMake-48a58e91a6c50539260fb9744b98fb8857a8803c.zip
CMake-48a58e91a6c50539260fb9744b98fb8857a8803c.tar.gz
CMake-48a58e91a6c50539260fb9744b98fb8857a8803c.tar.bz2
Merge topic 'update-curl'
bb759148 curl: Update build within CMake to account for 7.56 changes 9e3ef40e Merge branch 'upstream-curl' into update-curl de7c21d6 curl 2017-10-04 (3ea76790) 2fad0e20 curl: Update script to get curl 7.56.0 Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1372
Diffstat (limited to 'Utilities/cmcurl/lib/ftplistparser.c')
-rw-r--r--Utilities/cmcurl/lib/ftplistparser.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/Utilities/cmcurl/lib/ftplistparser.c b/Utilities/cmcurl/lib/ftplistparser.c
index 2acce31..b2a8c0f 100644
--- a/Utilities/cmcurl/lib/ftplistparser.c
+++ b/Utilities/cmcurl/lib/ftplistparser.c
@@ -421,7 +421,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
else if(c == '\n') {
finfo->b_data[parser->item_length - 1] = 0;
if(strncmp("total ", finfo->b_data, 6) == 0) {
- char *endptr = finfo->b_data+6;
+ char *endptr = finfo->b_data + 6;
/* here we can deal with directory size, pass the leading white
spaces and then the digits */
while(ISSPACE(*endptr))
@@ -609,16 +609,18 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
char *p;
curl_off_t fsize;
finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;
- fsize = curlx_strtoofft(finfo->b_data+parser->item_offset, &p, 10);
- if(p[0] == '\0' && fsize != CURL_OFF_T_MAX &&
- fsize != CURL_OFF_T_MIN) {
- parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_SIZE;
- parser->file_data->info.size = fsize;
+ if(!curlx_strtoofft(finfo->b_data + parser->item_offset,
+ &p, 10, &fsize)) {
+ if(p[0] == '\0' && fsize != CURL_OFF_T_MAX &&
+ fsize != CURL_OFF_T_MIN) {
+ parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_SIZE;
+ parser->file_data->info.size = fsize;
+ }
+ parser->item_length = 0;
+ parser->item_offset = 0;
+ parser->state.UNIX.main = PL_UNIX_TIME;
+ parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART1;
}
- parser->item_length = 0;
- parser->item_offset = 0;
- parser->state.UNIX.main = PL_UNIX_TIME;
- parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART1;
}
else if(!ISDIGIT(c)) {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
@@ -935,19 +937,9 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
}
else {
char *endptr;
- finfo->size = curlx_strtoofft(finfo->b_data +
- parser->item_offset,
- &endptr, 10);
- if(!*endptr) {
- if(finfo->size == CURL_OFF_T_MAX ||
- finfo->size == CURL_OFF_T_MIN) {
- if(errno == ERANGE) {
- PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
- return bufflen;
- }
- }
- }
- else {
+ if(curlx_strtoofft(finfo->b_data +
+ parser->item_offset,
+ &endptr, 10, &finfo->size)) {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
return bufflen;
}