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

@ -89,7 +89,8 @@ int main(void)
curl = curl_easy_init();
if(curl) {
long infilesize;
size_t filesize;
long infilesize = LONG_MAX;
struct upload_status upload_ctx = { 0 };
/* Set username and password */
@ -108,7 +109,9 @@ int main(void)
curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
infilesize = strlen(payload_text);
filesize = strlen(payload_text);
if(filesize <= LONG_MAX)
infilesize = (long)filesize;
curl_easy_setopt(curl, CURLOPT_INFILESIZE, infilesize);
/* Perform the append */