mirror of
https://github.com/curl/curl.git
synced 2026-08-25 23:03:39 +03:00
docs: enable more compiler warnings for C snippets, fix 3 finds
Also: - sync gcc option order. - unfold lines in C snippet. Closes #21006
This commit is contained in:
parent
673e14cd33
commit
31add10322
5 changed files with 10 additions and 11 deletions
|
|
@ -121,7 +121,7 @@ struct ctl {
|
|||
size_t read_callback(char *buffer, size_t size, size_t nitems, void *arg)
|
||||
{
|
||||
struct ctl *p = (struct ctl *)arg;
|
||||
curl_off_t sz = p->size - p->position;
|
||||
size_t sz = (size_t)(p->size - p->position);
|
||||
|
||||
nitems *= size;
|
||||
if(sz > nitems)
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ int main(void)
|
|||
if(result == CURLE_OK) {
|
||||
if(meta->bytesleft == 0)
|
||||
break; /* finished receiving */
|
||||
if(meta->bytesleft > sizeof(buffer) - offset)
|
||||
if(meta->bytesleft > (curl_off_t)(sizeof(buffer) - offset))
|
||||
result = CURLE_TOO_LARGE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,9 +111,8 @@ NULL
|
|||
# EXAMPLE
|
||||
|
||||
~~~c
|
||||
static
|
||||
void dump(const char *text,
|
||||
FILE *stream, unsigned char *ptr, size_t size)
|
||||
static void dump(const char *text,
|
||||
FILE *stream, unsigned char *ptr, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
size_t c;
|
||||
|
|
@ -143,10 +142,9 @@ void dump(const char *text,
|
|||
}
|
||||
}
|
||||
|
||||
static
|
||||
int my_trace(CURL *handle, curl_infotype type,
|
||||
char *data, size_t size,
|
||||
void *clientp)
|
||||
static int my_trace(CURL *handle, curl_infotype type,
|
||||
char *data, size_t size,
|
||||
void *clientp)
|
||||
{
|
||||
const char *text;
|
||||
(void)handle;
|
||||
|
|
@ -156,6 +154,7 @@ int my_trace(CURL *handle, curl_infotype type,
|
|||
case CURLINFO_TEXT:
|
||||
fputs("== Info: ", stderr);
|
||||
fwrite(data, size, 1, stderr);
|
||||
return 0;
|
||||
default: /* in case a new one is introduced to shock us */
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue