mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
examples/sftpuploadresmue: Fix Windows large file seek
- Use _fseeki64 instead of fseek (long) to seek curl_off_t in Windows. - Use CURL_FORMAT_CURL_OFF_T specifier instead of %ld to print curl_off_t. Caught by Marc's CI builds.
This commit is contained in:
parent
8020a0c62f
commit
817d1c0106
@ -65,7 +65,7 @@ static curl_off_t sftpGetRemoteFileSize(const char *i_remoteFile)
|
|||||||
result = curl_easy_getinfo(curlHandlePtr,
|
result = curl_easy_getinfo(curlHandlePtr,
|
||||||
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
|
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
|
||||||
&remoteFileSizeByte);
|
&remoteFileSizeByte);
|
||||||
printf("filesize: %ld \n", remoteFileSizeByte);
|
printf("filesize: %" CURL_FORMAT_CURL_OFF_T "\n", remoteFileSizeByte);
|
||||||
}
|
}
|
||||||
curl_easy_cleanup(curlHandlePtr);
|
curl_easy_cleanup(curlHandlePtr);
|
||||||
|
|
||||||
@ -96,7 +96,11 @@ static int sftpResumeUpload(CURL *curlhandle, const char *remotepath,
|
|||||||
curl_easy_setopt(curlhandle, CURLOPT_READFUNCTION, readfunc);
|
curl_easy_setopt(curlhandle, CURLOPT_READFUNCTION, readfunc);
|
||||||
curl_easy_setopt(curlhandle, CURLOPT_READDATA, f);
|
curl_easy_setopt(curlhandle, CURLOPT_READDATA, f);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
_fseeki64(f, remoteFileSizeByte, SEEK_SET);
|
||||||
|
#else
|
||||||
fseek(f, remoteFileSizeByte, SEEK_SET);
|
fseek(f, remoteFileSizeByte, SEEK_SET);
|
||||||
|
#endif
|
||||||
curl_easy_setopt(curlhandle, CURLOPT_APPEND, 1L);
|
curl_easy_setopt(curlhandle, CURLOPT_APPEND, 1L);
|
||||||
result = curl_easy_perform(curlhandle);
|
result = curl_easy_perform(curlhandle);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user