core: Fix format string errors in trace macros

--

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2018-11-16 16:57:09 +01:00
parent 94d274a1a3
commit cf42386406
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
11 changed files with 30 additions and 29 deletions

View File

@ -48,8 +48,8 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname,
int res; int res;
TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_filepart", r_dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_filepart", r_dh,
"file_name=%s, stream=%p, offset=%lli, length=%u", "file_name=%s, stream=%p, offset=%lli, length=%zu",
fname, stream, offset, length); fname, stream, (long long int)offset, length);
if (stream && fname) if (stream && fname)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -173,13 +173,13 @@ old_user_read (gpgme_data_t dh, void *buffer, size_t size)
gpgme_error_t err; gpgme_error_t err;
size_t amt; size_t amt;
TRACE_BEG (DEBUG_DATA, "gpgme:old_user_read", dh, TRACE_BEG (DEBUG_DATA, "gpgme:old_user_read", dh,
"buffer=%p, size=%u", buffer, size); "buffer=%p, size=%zu", buffer, size);
err = (*dh->data.old_user.cb) (dh->data.old_user.handle, err = (*dh->data.old_user.cb) (dh->data.old_user.handle,
buffer, size, &amt); buffer, size, &amt);
if (err) if (err)
return TRACE_SYSRES (gpgme_error_to_errno (err)); return TRACE_SYSRES (gpgme_error_to_errno (err));
return TRACE_SYSRES ((gpgme_ssize_t)amt); return TRACE_SYSRES ((int)amt);
} }
@ -188,7 +188,7 @@ old_user_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG (DEBUG_DATA, "gpgme:old_user_seek", dh, TRACE_BEG (DEBUG_DATA, "gpgme:old_user_seek", dh,
"offset=%llu, whence=%i", offset, whence); "offset=%llu, whence=%i", (long long int)offset, whence);
if (whence != SEEK_SET || offset) if (whence != SEEK_SET || offset)
{ {

View File

@ -190,7 +190,7 @@ gpgme_data_new_from_mem (gpgme_data_t *r_dh, const char *buffer,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_mem", r_dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_mem", r_dh,
"buffer=%p, size=%u, copy=%i (%s)", buffer, size, "buffer=%p, size=%zu, copy=%i (%s)", buffer, size,
copy, copy ? "yes" : "no"); copy, copy ? "yes" : "no");
err = _gpgme_data_new (r_dh, &mem_cbs); err = _gpgme_data_new (r_dh, &mem_cbs);
@ -283,7 +283,7 @@ gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len)
if (r_len) if (r_len)
{ {
TRACE_SUC ("buffer=%p, len=%u", str, *r_len); TRACE_SUC ("buffer=%p, len=%zu", str, *r_len);
} }
else else
{ {

View File

@ -353,7 +353,7 @@ gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size)
gpgme_ssize_t res; gpgme_ssize_t res;
int blankout; int blankout;
TRACE_BEG (DEBUG_DATA, "gpgme_data_read", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_read", dh,
"buffer=%p, size=%u", buffer, size); "buffer=%p, size=%zu", buffer, size);
if (!dh) if (!dh)
{ {
@ -376,7 +376,7 @@ gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size)
while (res < 0 && errno == EINTR); while (res < 0 && errno == EINTR);
} }
return TRACE_SYSRES (res); return TRACE_SYSRES ((int)res);
} }
@ -388,7 +388,7 @@ gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size)
{ {
gpgme_ssize_t res; gpgme_ssize_t res;
TRACE_BEG (DEBUG_DATA, "gpgme_data_write", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_write", dh,
"buffer=%p, size=%u", buffer, size); "buffer=%p, size=%zu", buffer, size);
if (!dh) if (!dh)
{ {
@ -404,7 +404,7 @@ gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size)
res = (*dh->cbs->write) (dh, buffer, size); res = (*dh->cbs->write) (dh, buffer, size);
while (res < 0 && errno == EINTR); while (res < 0 && errno == EINTR);
return TRACE_SYSRES (res); return TRACE_SYSRES ((int)res);
} }
@ -415,7 +415,7 @@ gpgme_off_t
gpgme_data_seek (gpgme_data_t dh, gpgme_off_t offset, int whence) gpgme_data_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{ {
TRACE_BEG (DEBUG_DATA, "gpgme_data_seek", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_seek", dh,
"offset=%lli, whence=%i", offset, whence); "offset=%lli, whence=%i", (long long int)offset, whence);
if (!dh) if (!dh)
{ {
@ -437,7 +437,7 @@ gpgme_data_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
if (offset >= 0) if (offset >= 0)
dh->pending_len = 0; dh->pending_len = 0;
return TRACE_SYSRES (offset); return TRACE_SYSRES ((int)offset);
} }

View File

@ -379,7 +379,7 @@ _gpgme_debug_end (void **line)
/* The smallest possible level is 1, so force logging here by /* The smallest possible level is 1, so force logging here by
using that. */ using that. */
_gpgme_debug (1, -1, NULL, NULL, NULL, "%s", *line); _gpgme_debug (1, -1, NULL, NULL, NULL, "%s", (char*)*line);
gpgrt_free (*line); gpgrt_free (*line);
*line = NULL; *line = NULL;
} }

View File

@ -911,7 +911,7 @@ gpgme_io_read (int fd, void *buffer, size_t count)
{ {
int ret; int ret;
TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_read", fd, TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_read", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%zu", buffer, count);
ret = _gpgme_io_read (fd, buffer, count); ret = _gpgme_io_read (fd, buffer, count);
@ -927,7 +927,7 @@ gpgme_io_write (int fd, const void *buffer, size_t count)
{ {
int ret; int ret;
TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_write", fd, TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_write", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%zu", buffer, count);
ret = _gpgme_io_write (fd, buffer, count); ret = _gpgme_io_write (fd, buffer, count);
@ -946,7 +946,7 @@ gpgme_io_writen (int fd, const void *buffer_arg, size_t count)
const char *buffer = buffer_arg; const char *buffer = buffer_arg;
int ret = 0; int ret = 0;
TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_writen", fd, TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_writen", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%zu", buffer, count);
while (count) while (count)
{ {
ret = _gpgme_io_write (fd, buffer, count); ret = _gpgme_io_write (fd, buffer, count);

View File

@ -103,7 +103,8 @@ gpgme_op_import_result (gpgme_ctx_t ctx)
while (impstat) while (impstat)
{ {
TRACE_LOG ("import[%i] for %s = 0x%x (%s)", TRACE_LOG ("import[%i] for %s = 0x%x (%s)",
i, impstat->fpr, impstat->status, impstat->result); i, impstat->fpr, impstat->status,
gpgme_strerror (impstat->result));
impstat = impstat->next; impstat = impstat->next;
i++; i++;
} }

View File

@ -110,7 +110,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
{ {
int nread; int nread;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_read", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_read", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%zu", buffer, count);
do do
{ {
@ -128,7 +128,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
{ {
int nwritten; int nwritten;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_write", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_write", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%zu", buffer, count);
TRACE_LOGBUFX (buffer, count); TRACE_LOGBUFX (buffer, count);
do do
@ -427,7 +427,7 @@ get_max_fds (void)
} }
#endif #endif
TRACE (DEBUG_SYSIO, "gpgme:max_fds", 0, "max fds=%i (%s)", fds, source); TRACE (DEBUG_SYSIO, "gpgme:max_fds", 0, "max fds=%ld (%s)", fds, source);
return fds; return fds;
} }
@ -654,7 +654,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
struct timeval timeout = { 1, 0 }; struct timeval timeout = { 1, 0 };
void *dbg_help = NULL; void *dbg_help = NULL;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_select", fds, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_select", fds,
"nfds=%u, nonblock=%u", nfds, nonblock); "nfds=%zu, nonblock=%u", nfds, nonblock);
FD_ZERO (&readfds); FD_ZERO (&readfds);
FD_ZERO (&writefds); FD_ZERO (&writefds);

View File

@ -92,7 +92,7 @@ gpgme_op_query_swdb (gpgme_ctx_t ctx, const char *name, const char *iversion,
op_data_t opd; op_data_t opd;
TRACE_BEG (DEBUG_CTX, "gpgme_op_query_swdb", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_query_swdb", ctx,
"name=%s, iversion=%", name, iversion); "name=%s, iversion=%s", name, iversion);
if (!ctx || reserved) if (!ctx || reserved)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));

View File

@ -246,20 +246,20 @@ gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item)
if ((*r_item)->type == 1) if ((*r_item)->type == 1)
{ {
TRACE_SUC ("trust_item=%p: %s: owner trust %s with level %i " TRACE_SUC ("trust_item=%p: %s: owner trust %s with level %i "
"and validity 0x%x", *r_item, (*r_item)->keyid, "and validity %s", *r_item, (*r_item)->keyid,
(*r_item)->owner_trust, (*r_item)->level, (*r_item)->owner_trust, (*r_item)->level,
(*r_item)->validity); (*r_item)->validity);
} }
else if ((*r_item)->type == 2) else if ((*r_item)->type == 2)
{ {
TRACE_SUC ("trust_item=%p: %s: UID %s with level %i " TRACE_SUC ("trust_item=%p: %s: UID %s with level %i "
"and validity 0x%x", *r_item, (*r_item)->keyid, "and validity %s", *r_item, (*r_item)->keyid,
(*r_item)->name, (*r_item)->level, (*r_item)->validity); (*r_item)->name, (*r_item)->level, (*r_item)->validity);
} }
else else
{ {
TRACE_SUC ("trust_item=%p: %s: unknown type %i with level %i " TRACE_SUC ("trust_item=%p: %s: unknown type %i with level %i "
"and validity 0x%x", *r_item, (*r_item)->keyid, "and validity %s", *r_item, (*r_item)->keyid,
(*r_item)->type, (*r_item)->level, (*r_item)->validity); (*r_item)->type, (*r_item)->level, (*r_item)->validity);
} }
return 0; return 0;

View File

@ -135,7 +135,7 @@ gpgme_op_verify_result (gpgme_ctx_t ctx)
{ {
TRACE_LOG ("sig[%i] = fpr %s, summary 0x%x, status %s", TRACE_LOG ("sig[%i] = fpr %s, summary 0x%x, status %s",
i, sig->fpr, sig->summary, gpg_strerror (sig->status)); i, sig->fpr, sig->summary, gpg_strerror (sig->status));
TRACE_LOG ("sig[%i] = timestamps 0x%x/0x%x flags:%s%s%s", TRACE_LOG ("sig[%i] = timestamps 0x%lx/0x%lx flags:%s%s%s",
i, sig->timestamp, sig->exp_timestamp, i, sig->timestamp, sig->exp_timestamp,
sig->wrong_key_usage ? "wrong key usage" : "", sig->wrong_key_usage ? "wrong key usage" : "",
sig->pka_trust == 1 ? "pka bad" sig->pka_trust == 1 ? "pka bad"

View File

@ -230,14 +230,14 @@ gpgme_check_version_internal (const char *req_version,
/* Catch-22, see above. */ /* Catch-22, see above. */
TRACE (DEBUG_INIT, "gpgme_check_version_internal", 0, TRACE (DEBUG_INIT, "gpgme_check_version_internal", 0,
"req_version=%s, offset_sig_validity=%i", "req_version=%s, offset_sig_validity=%zu",
req_version ? req_version : "(null)", offset_sig_validity); req_version ? req_version : "(null)", offset_sig_validity);
if (offset_sig_validity != offsetof (struct _gpgme_signature, validity)) if (offset_sig_validity != offsetof (struct _gpgme_signature, validity))
{ {
TRACE (DEBUG_INIT, "gpgme_check_version_internal", 0, TRACE (DEBUG_INIT, "gpgme_check_version_internal", 0,
"offset_sig_validity mismatch: expected %i", "offset_sig_validity mismatch: expected %i",
offsetof (struct _gpgme_signature, validity)); (int)offsetof (struct _gpgme_signature, validity));
_gpgme_selftest = GPG_ERR_SELFTEST_FAILED; _gpgme_selftest = GPG_ERR_SELFTEST_FAILED;
} }