docs/examples: workaround broken -Wno-pedantic-ms-format

Avoid CURL_FORMAT_CURL_OFF_T by using unsigned long instead.
Improve size_t to long conversion in imap-append.c example.

Ref: https://github.com/curl/curl/issues/6079
Ref: https://github.com/curl/curl/pull/6082
Assisted-by: Jay Satiro
Reviewed-by: Daniel Stenberg

Preparation of #7922
This commit is contained in:
Marc Hoersken 2021-12-14 07:52:26 +01:00
parent 52202691d1
commit 77311f420a
No known key found for this signature in database
GPG key ID: 61E03CBED7BC859E
9 changed files with 45 additions and 45 deletions

View file

@ -81,17 +81,17 @@ static curlioerr my_ioctl(CURL *handle, curliocmd cmd, void *userp)
static size_t read_callback(char *ptr, size_t size, size_t nmemb, void *stream)
{
ssize_t retcode;
curl_off_t nread;
unsigned long nread;
int *fdp = (int *)stream;
int fd = *fdp;
retcode = read(fd, ptr, (READ_3RD_ARG)(size * nmemb));
nread = (curl_off_t)retcode;
fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T
" bytes from file\n", nread);
if(retcode > 0) {
nread = (unsigned long)retcode;
fprintf(stderr, "*** We read %lu bytes from file\n", nread);
}
return retcode;
}