mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Use CURL_FORMAT_OFF_T for printf()inf curl_off_t variables.
This commit is contained in:
parent
71d81f1f75
commit
cb72a80fe0
@ -191,7 +191,7 @@ CURLcode Curl_file(struct connectdata *conn)
|
||||
date. */
|
||||
if(data->set.no_body && data->set.include_header && fstated) {
|
||||
CURLcode result;
|
||||
sprintf(buf, "Content-Length: %Od\r\n", expected_size);
|
||||
sprintf(buf, "Content-Length: " CURL_FORMAT_OFF_T "\r\n", expected_size);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
|
26
lib/ftp.c
26
lib/ftp.c
@ -732,7 +732,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn)
|
||||
if((-1 != data->set.infilesize) &&
|
||||
(data->set.infilesize != *ftp->bytecountp) &&
|
||||
!data->set.crlf) {
|
||||
failf(data, "Uploaded unaligned file size (%Od out of %Od bytes)",
|
||||
failf(data, "Uploaded unaligned file size (" CURL_FORMAT_OFF_T " out of " CURL_FORMAT_OFF_T " bytes)",
|
||||
*ftp->bytecountp, data->set.infilesize);
|
||||
conn->bits.close = TRUE; /* close this connection since we don't
|
||||
know what state this error leaves us in */
|
||||
@ -742,7 +742,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn)
|
||||
else {
|
||||
if((-1 != conn->size) && (conn->size != *ftp->bytecountp) &&
|
||||
(conn->maxdownload != *ftp->bytecountp)) {
|
||||
failf(data, "Received only partial file: %Od bytes",
|
||||
failf(data, "Received only partial file: " CURL_FORMAT_OFF_T " bytes",
|
||||
*ftp->bytecountp);
|
||||
conn->bits.close = TRUE; /* close this connection since we don't
|
||||
know what state this error leaves us in */
|
||||
@ -1751,7 +1751,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
|
||||
|
||||
passed += actuallyread;
|
||||
if(actuallyread != readthisamountnow) {
|
||||
failf(data, "Could only read %Od bytes from the input",
|
||||
failf(data, "Could only read " CURL_FORMAT_OFF_T " bytes from the input",
|
||||
passed);
|
||||
return CURLE_FTP_COULDNT_USE_REST;
|
||||
}
|
||||
@ -1849,24 +1849,24 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
|
||||
if((-1 == to) && (from>=0)) {
|
||||
/* X - */
|
||||
conn->resume_from = from;
|
||||
infof(data, "FTP RANGE %Od to end of file\n", from);
|
||||
infof(data, "FTP RANGE " CURL_FORMAT_OFF_T " to end of file\n", from);
|
||||
}
|
||||
else if(from < 0) {
|
||||
/* -Y */
|
||||
totalsize = -from;
|
||||
conn->maxdownload = -from;
|
||||
conn->resume_from = from;
|
||||
infof(data, "FTP RANGE the last %Od bytes\n", totalsize);
|
||||
infof(data, "FTP RANGE the last " CURL_FORMAT_OFF_T " bytes\n", totalsize);
|
||||
}
|
||||
else {
|
||||
/* X-Y */
|
||||
totalsize = to-from;
|
||||
conn->maxdownload = totalsize+1; /* include the last mentioned byte */
|
||||
conn->resume_from = from;
|
||||
infof(data, "FTP RANGE from %Od getting %Od bytes\n", from,
|
||||
infof(data, "FTP RANGE from " CURL_FORMAT_OFF_T " getting " CURL_FORMAT_OFF_T " bytes\n", from,
|
||||
conn->maxdownload);
|
||||
}
|
||||
infof(data, "range-download from %Od to %Od, totally %Od bytes\n",
|
||||
infof(data, "range-download from " CURL_FORMAT_OFF_T " to " CURL_FORMAT_OFF_T ", totally " CURL_FORMAT_OFF_T " bytes\n",
|
||||
from, to, conn->maxdownload);
|
||||
ftp->dont_check = TRUE; /* dont check for successful transfer */
|
||||
}
|
||||
@ -1941,7 +1941,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
|
||||
if(conn->resume_from< 0) {
|
||||
/* We're supposed to download the last abs(from) bytes */
|
||||
if(foundsize < -conn->resume_from) {
|
||||
failf(data, "Offset (%Od) was beyond file size (%Od)",
|
||||
failf(data, "Offset (" CURL_FORMAT_OFF_T ") was beyond file size (" CURL_FORMAT_OFF_T ")",
|
||||
conn->resume_from, foundsize);
|
||||
return CURLE_FTP_BAD_DOWNLOAD_RESUME;
|
||||
}
|
||||
@ -1952,7 +1952,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
|
||||
}
|
||||
else {
|
||||
if(foundsize < conn->resume_from) {
|
||||
failf(data, "Offset (%Od) was beyond file size (%Od)",
|
||||
failf(data, "Offset (" CURL_FORMAT_OFF_T ") was beyond file size (" CURL_FORMAT_OFF_T ")",
|
||||
conn->resume_from, foundsize);
|
||||
return CURLE_FTP_BAD_DOWNLOAD_RESUME;
|
||||
}
|
||||
@ -1973,10 +1973,10 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
|
||||
}
|
||||
|
||||
/* Set resume file transfer offset */
|
||||
infof(data, "Instructs server to resume from offset %Od\n",
|
||||
infof(data, "Instructs server to resume from offset " CURL_FORMAT_OFF_T "\n",
|
||||
conn->resume_from);
|
||||
|
||||
FTPSENDF(conn, "REST %Od", conn->resume_from);
|
||||
FTPSENDF(conn, "REST " CURL_FORMAT_OFF_T "", conn->resume_from);
|
||||
|
||||
result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
|
||||
if(result)
|
||||
@ -2082,7 +2082,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
|
||||
if(size > conn->maxdownload && conn->maxdownload > 0)
|
||||
size = conn->size = conn->maxdownload;
|
||||
|
||||
infof(data, "Getting file with size: %Od\n", size);
|
||||
infof(data, "Getting file with size: " CURL_FORMAT_OFF_T "\n", size);
|
||||
|
||||
/* FTP download: */
|
||||
result=Curl_Transfer(conn, SECONDARYSOCKET, size, FALSE,
|
||||
@ -2214,7 +2214,7 @@ CURLcode ftp_perform(struct connectdata *conn,
|
||||
result = ftp_getsize(conn, ftp->file, &filesize);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
sprintf(buf, "Content-Length: %Od\r\n", filesize);
|
||||
sprintf(buf, "Content-Length: " CURL_FORMAT_OFF_T "\r\n", filesize);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
|
10
lib/http.c
10
lib/http.c
@ -1272,7 +1272,8 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
|
||||
passed += actuallyread;
|
||||
if(actuallyread != readthisamountnow) {
|
||||
failf(data, "Could only read %Od bytes from the input",
|
||||
failf(data, "Could only read " CURL_FORMAT_OFF_T
|
||||
" bytes from the input",
|
||||
passed);
|
||||
return CURLE_READ_ERROR;
|
||||
}
|
||||
@ -1311,7 +1312,8 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
curl_off_t total_expected_size=
|
||||
conn->resume_from + data->set.infilesize;
|
||||
conn->allocptr.rangeline =
|
||||
aprintf("Content-Range: bytes %s%Od/%Od\r\n",
|
||||
aprintf("Content-Range: bytes %s" CURL_FORMAT_OFF_T "/"
|
||||
CURL_FORMAT_OFF_T "\r\n",
|
||||
conn->range, total_expected_size-1,
|
||||
total_expected_size);
|
||||
}
|
||||
@ -1319,7 +1321,7 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
/* Range was selected and then we just pass the incoming range and
|
||||
append total size */
|
||||
conn->allocptr.rangeline =
|
||||
aprintf("Content-Range: bytes %s/%Od\r\n",
|
||||
aprintf("Content-Range: bytes %s/" CURL_FORMAT_OFF_T "\r\n",
|
||||
conn->range, data->set.infilesize);
|
||||
}
|
||||
}
|
||||
@ -1549,7 +1551,7 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
if((data->set.infilesize>0) && !conn->bits.upload_chunky)
|
||||
/* only add Content-Length if not uploading chunked */
|
||||
add_bufferf(req_buffer,
|
||||
"Content-Length: %Od\r\n", /* file size */
|
||||
"Content-Length: " CURL_FORMAT_OFF_T "\r\n", /* size */
|
||||
data->set.infilesize );
|
||||
|
||||
add_bufferf(req_buffer, "\r\n");
|
||||
|
@ -240,7 +240,8 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
||||
if (!data->progress.callback) {
|
||||
if(conn->resume_from)
|
||||
fprintf(data->set.err,
|
||||
"** Resuming transfer from byte position %Od\n",
|
||||
"** Resuming transfer from byte position " CURL_FORMAT_OFF_T
|
||||
"\n",
|
||||
conn->resume_from);
|
||||
fprintf(data->set.err,
|
||||
" %% Total %% Received %% Xferd Average Speed Time Curr.\n"
|
||||
|
@ -2411,7 +2411,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
if(conn->resume_from) {
|
||||
if(!conn->bits.use_range) {
|
||||
/* if it already was in use, we just skip this */
|
||||
snprintf(resumerange, sizeof(resumerange), "%Od-",
|
||||
snprintf(resumerange, sizeof(resumerange), CURL_FORMAT_OFF_T "-",
|
||||
conn->resume_from);
|
||||
conn->range=strdup(resumerange); /* tell ourselves to fetch this range */
|
||||
conn->bits.rangestringalloc = TRUE; /* mark as allocated */
|
||||
@ -2941,7 +2941,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
*/
|
||||
conn->resume_from = data->set.set_resume_from;
|
||||
if (conn->resume_from) {
|
||||
snprintf(resumerange, sizeof(resumerange), "%Od-",
|
||||
snprintf(resumerange, sizeof(resumerange), CURL_FORMAT_OFF_T "-",
|
||||
conn->resume_from);
|
||||
if (conn->bits.rangestringalloc == TRUE)
|
||||
free(conn->range);
|
||||
|
Loading…
Reference in New Issue
Block a user