Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add printf format attribute to buf_append()
Fix the one (harmless) warning it generates in base64 encoding.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jun 19, 2014
1 parent aa6ac0d commit 617e561
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions http.c
Expand Up @@ -45,7 +45,8 @@ struct oc_text_buf *buf_alloc(void)
return calloc(1, sizeof(struct oc_text_buf));
}

void buf_append(struct oc_text_buf *buf, const char *fmt, ...)
void __attribute__ ((format (printf, 2, 3)))
buf_append(struct oc_text_buf *buf, const char *fmt, ...)
{
va_list ap;

Expand Down Expand Up @@ -1546,7 +1547,7 @@ static void b64_frag(struct oc_text_buf *buf, int len, unsigned char *in)
b64[3] = b64_table[in[2] & 0x3f];
out:
b64[4] = 0;
buf_append(buf, b64);
buf_append(buf, "%s", b64);
}

/* State in vpninfo->proxy_auth_state */
Expand Down
3 changes: 2 additions & 1 deletion openconnect-internal.h
Expand Up @@ -560,7 +560,8 @@ int prepare_stoken(struct openconnect_info *vpninfo);

/* http.c */
struct oc_text_buf *buf_alloc(void);
void buf_append(struct oc_text_buf *buf, const char *fmt, ...);
void __attribute__ ((format (printf, 2, 3)))
buf_append(struct oc_text_buf *buf, const char *fmt, ...);
int buf_error(struct oc_text_buf *buf);
int buf_free(struct oc_text_buf *buf);
char *openconnect_create_useragent(const char *base);
Expand Down

0 comments on commit 617e561

Please sign in to comment.