core: Simplify the trace maros by using variadics.

* src/debug.h (TRACE_BEG, TRACE_LOG, TRACE_SUC): Use variadic macros
and remove the TRACE_BEG1 et al.  Change all users to always pass a
format string.
(TRACE): Ditto.
* src/debug.c (_gpgme_debugf): New.
* configure.ac <GCC>: Add -Wno-format-zero-length.
--

This makes it easier for use to enable format checks.  The zero-length
format is required to allow for an empty format due to the comman
problematic of __VA_ARGS__.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2018-11-16 16:25:49 +01:00
parent 8d91c0f4cd
commit 5857491a2a
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
46 changed files with 550 additions and 569 deletions

View File

@ -581,6 +581,7 @@ if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wdeclaration-after-statement" CFLAGS="$CFLAGS -Wdeclaration-after-statement"
CFLAGS="$CFLAGS -Wno-missing-field-initializers" CFLAGS="$CFLAGS -Wno-missing-field-initializers"
CFLAGS="$CFLAGS -Wno-sign-compare" CFLAGS="$CFLAGS -Wno-sign-compare"
CFLAGS="$CFLAGS -Wno-format-zero-length"
fi fi
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wno-shadow" CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wno-shadow"

View File

@ -47,7 +47,7 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname,
char *buf = NULL; char *buf = NULL;
int res; int res;
TRACE_BEG4 (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=%u",
fname, stream, offset, length); fname, stream, offset, length);
@ -110,7 +110,7 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname,
(*r_dh)->data.mem.size = length; (*r_dh)->data.mem.size = length;
(*r_dh)->data.mem.length = length; (*r_dh)->data.mem.length = length;
return TRACE_SUC1 ("r_dh=%p", *r_dh); return TRACE_SUC ("r_dh=%p", *r_dh);
} }
@ -121,7 +121,7 @@ gpgme_data_new_from_file (gpgme_data_t *r_dh, const char *fname, int copy)
{ {
gpgme_error_t err; gpgme_error_t err;
struct stat statbuf; struct stat statbuf;
TRACE_BEG3 (DEBUG_DATA, "gpgme_data_new_from_file", r_dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_file", r_dh,
"file_name=%s, copy=%i (%s)", fname, copy, copy ? "yes" : "no"); "file_name=%s, copy=%i (%s)", fname, copy, copy ? "yes" : "no");
if (!fname || !copy) if (!fname || !copy)
@ -159,7 +159,7 @@ gpgme_error_to_errno (gpgme_error_t err)
break; break;
} }
} }
TRACE3 (DEBUG_DATA, "gpgme:gpgme_error_to_errno", 0, TRACE (DEBUG_DATA, "gpgme:gpgme_error_to_errno", 0,
"mapping %s <%s> to: %s", gpgme_strerror (err), "mapping %s <%s> to: %s", gpgme_strerror (err),
gpgme_strsource (err), strerror (res)); gpgme_strsource (err), strerror (res));
gpg_err_set_errno (res); gpg_err_set_errno (res);
@ -172,7 +172,7 @@ 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_BEG2 (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=%u", buffer, size);
err = (*dh->data.old_user.cb) (dh->data.old_user.handle, err = (*dh->data.old_user.cb) (dh->data.old_user.handle,
@ -187,7 +187,7 @@ static gpgme_off_t
old_user_seek (gpgme_data_t dh, gpgme_off_t offset, int whence) old_user_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (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", offset, whence);
if (whence != SEEK_SET || offset) if (whence != SEEK_SET || offset)
@ -219,7 +219,7 @@ gpgme_data_new_with_read_cb (gpgme_data_t *r_dh,
void *read_cb_value) void *read_cb_value)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_DATA, "gpgme_data_new_with_read_cb", r_dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_new_with_read_cb", r_dh,
"read_cb=%p/%p", read_cb, read_cb_value); "read_cb=%p/%p", read_cb, read_cb_value);
err = _gpgme_data_new (r_dh, &old_user_cbs); err = _gpgme_data_new (r_dh, &old_user_cbs);

View File

@ -87,7 +87,7 @@ gpgme_error_t
gpgme_data_new_from_estream (gpgme_data_t *r_dh, gpgrt_stream_t stream) gpgme_data_new_from_estream (gpgme_data_t *r_dh, gpgrt_stream_t stream)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG1 (DEBUG_DATA, "gpgme_data_new_from_estream", r_dh, "estream=%p", TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_estream", r_dh, "estream=%p",
stream); stream);
err = _gpgme_data_new (r_dh, &stream_es_cbs); err = _gpgme_data_new (r_dh, &stream_es_cbs);
@ -95,5 +95,5 @@ gpgme_data_new_from_estream (gpgme_data_t *r_dh, gpgrt_stream_t stream)
return TRACE_ERR (err); return TRACE_ERR (err);
(*r_dh)->data.e_stream = stream; (*r_dh)->data.e_stream = stream;
return TRACE_SUC1 ("dh=%p", *r_dh); return TRACE_SUC ("dh=%p", *r_dh);
} }

View File

@ -75,12 +75,12 @@ gpgme_error_t
gpgme_data_new_from_fd (gpgme_data_t *r_dh, int fd) gpgme_data_new_from_fd (gpgme_data_t *r_dh, int fd)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG1 (DEBUG_DATA, "gpgme_data_new_from_fd", r_dh, "fd=0x%x", fd); TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_fd", r_dh, "fd=0x%x", fd);
err = _gpgme_data_new (r_dh, &fd_cbs); err = _gpgme_data_new (r_dh, &fd_cbs);
if (err) if (err)
return TRACE_ERR (err); return TRACE_ERR (err);
(*r_dh)->data.fd = fd; (*r_dh)->data.fd = fd;
return TRACE_SUC1 ("dh=%p", *r_dh); return TRACE_SUC ("dh=%p", *r_dh);
} }

View File

@ -170,14 +170,14 @@ gpgme_error_t
gpgme_data_new (gpgme_data_t *r_dh) gpgme_data_new (gpgme_data_t *r_dh)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG (DEBUG_DATA, "gpgme_data_new", r_dh); TRACE_BEG (DEBUG_DATA, "gpgme_data_new", r_dh, "");
err = _gpgme_data_new (r_dh, &mem_cbs); err = _gpgme_data_new (r_dh, &mem_cbs);
if (err) if (err)
return TRACE_ERR (err); return TRACE_ERR (err);
return TRACE_SUC1 ("dh=%p", *r_dh); return TRACE_SUC ("dh=%p", *r_dh);
} }
@ -189,7 +189,7 @@ gpgme_data_new_from_mem (gpgme_data_t *r_dh, const char *buffer,
size_t size, int copy) size_t size, int copy)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG4 (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=%u, copy=%i (%s)", buffer, size,
copy, copy ? "yes" : "no"); copy, copy ? "yes" : "no");
@ -214,7 +214,7 @@ gpgme_data_new_from_mem (gpgme_data_t *r_dh, const char *buffer,
(*r_dh)->data.mem.size = size; (*r_dh)->data.mem.size = size;
(*r_dh)->data.mem.length = size; (*r_dh)->data.mem.length = size;
return TRACE_SUC1 ("dh=%p", *r_dh); return TRACE_SUC ("dh=%p", *r_dh);
} }
@ -229,7 +229,7 @@ gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len)
size_t len; size_t len;
int blankout; int blankout;
TRACE_BEG1 (DEBUG_DATA, "gpgme_data_release_and_get_mem", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_release_and_get_mem", dh,
"r_len=%p", r_len); "r_len=%p", r_len);
if (!dh || dh->cbs != &mem_cbs) if (!dh || dh->cbs != &mem_cbs)
@ -283,11 +283,11 @@ gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len)
if (r_len) if (r_len)
{ {
TRACE_SUC2 ("buffer=%p, len=%u", str, *r_len); TRACE_SUC ("buffer=%p, len=%u", str, *r_len);
} }
else else
{ {
TRACE_SUC1 ("buffer=%p", str); TRACE_SUC ("buffer=%p", str);
} }
return str; return str;
} }
@ -298,7 +298,7 @@ gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len)
void void
gpgme_free (void *buffer) gpgme_free (void *buffer)
{ {
TRACE (DEBUG_DATA, "gpgme_free", buffer); TRACE (DEBUG_DATA, "gpgme_free", buffer, "");
if (buffer) if (buffer)
free (buffer); free (buffer);

View File

@ -96,7 +96,7 @@ gpgme_error_t
gpgme_data_new_from_stream (gpgme_data_t *r_dh, FILE *stream) gpgme_data_new_from_stream (gpgme_data_t *r_dh, FILE *stream)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG1 (DEBUG_DATA, "gpgme_data_new_from_stream", r_dh, "stream=%p", TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_stream", r_dh, "stream=%p",
stream); stream);
err = _gpgme_data_new (r_dh, &stream_cbs); err = _gpgme_data_new (r_dh, &stream_cbs);
@ -104,5 +104,5 @@ gpgme_data_new_from_stream (gpgme_data_t *r_dh, FILE *stream)
return TRACE_ERR (err); return TRACE_ERR (err);
(*r_dh)->data.stream = stream; (*r_dh)->data.stream = stream;
return TRACE_SUC1 ("dh=%p", *r_dh); return TRACE_SUC ("dh=%p", *r_dh);
} }

View File

@ -92,7 +92,7 @@ gpgme_error_t
gpgme_data_new_from_cbs (gpgme_data_t *r_dh, gpgme_data_cbs_t cbs, void *handle) gpgme_data_new_from_cbs (gpgme_data_t *r_dh, gpgme_data_cbs_t cbs, void *handle)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG1 (DEBUG_DATA, "gpgme_data_new_from_cbs", r_dh, "handle=%p", handle); TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_cbs", r_dh, "handle=%p", handle);
err = _gpgme_data_new (r_dh, &user_cbs); err = _gpgme_data_new (r_dh, &user_cbs);
if (err) if (err)
@ -100,5 +100,5 @@ gpgme_data_new_from_cbs (gpgme_data_t *r_dh, gpgme_data_cbs_t cbs, void *handle)
(*r_dh)->data.user.cbs = cbs; (*r_dh)->data.user.cbs = cbs;
(*r_dh)->data.user.handle = handle; (*r_dh)->data.user.handle = handle;
return TRACE_SUC1 ("dh=%p", *r_dh); return TRACE_SUC ("dh=%p", *r_dh);
} }

View File

@ -178,7 +178,7 @@ _gpgme_data_set_prop (gpgme_data_t dh, uint64_t dserial,
{ {
gpg_error_t err = 0; gpg_error_t err = 0;
int idx; int idx;
TRACE_BEG3 (DEBUG_DATA, "gpgme_data_set_prop", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_set_prop", dh,
"dserial=%llu %lu=%d", "dserial=%llu %lu=%d",
(unsigned long long)dserial, (unsigned long long)dserial,
(unsigned long)name, value); (unsigned long)name, value);
@ -241,7 +241,7 @@ _gpgme_data_get_prop (gpgme_data_t dh, uint64_t dserial,
{ {
gpg_error_t err = 0; gpg_error_t err = 0;
int idx; int idx;
TRACE_BEG2 (DEBUG_DATA, "gpgme_data_get_prop", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_get_prop", dh,
"dserial=%llu %lu", "dserial=%llu %lu",
(unsigned long long)dserial, (unsigned long long)dserial,
(unsigned long)name); (unsigned long)name);
@ -352,7 +352,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_BEG2 (DEBUG_DATA, "gpgme_data_read", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_read", dh,
"buffer=%p, size=%u", buffer, size); "buffer=%p, size=%u", buffer, size);
if (!dh) if (!dh)
@ -387,7 +387,7 @@ gpgme_ssize_t
gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size) gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size)
{ {
gpgme_ssize_t res; gpgme_ssize_t res;
TRACE_BEG2 (DEBUG_DATA, "gpgme_data_write", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_write", dh,
"buffer=%p, size=%u", buffer, size); "buffer=%p, size=%u", buffer, size);
if (!dh) if (!dh)
@ -414,7 +414,7 @@ gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size)
gpgme_off_t 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_BEG2 (DEBUG_DATA, "gpgme_data_seek", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_seek", dh,
"offset=%lli, whence=%i", offset, whence); "offset=%lli, whence=%i", offset, whence);
if (!dh) if (!dh)
@ -446,7 +446,7 @@ gpgme_error_t
gpgme_data_rewind (gpgme_data_t dh) gpgme_data_rewind (gpgme_data_t dh)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG (DEBUG_DATA, "gpgme_data_rewind", dh); TRACE_BEG (DEBUG_DATA, "gpgme_data_rewind", dh, "");
err = ((gpgme_data_seek (dh, 0, SEEK_SET) == -1) err = ((gpgme_data_seek (dh, 0, SEEK_SET) == -1)
? gpg_error_from_syserror () : 0); ? gpg_error_from_syserror () : 0);
@ -459,7 +459,7 @@ gpgme_data_rewind (gpgme_data_t dh)
void void
gpgme_data_release (gpgme_data_t dh) gpgme_data_release (gpgme_data_t dh)
{ {
TRACE (DEBUG_DATA, "gpgme_data_release", dh); TRACE (DEBUG_DATA, "gpgme_data_release", dh, "");
if (!dh) if (!dh)
return; return;
@ -475,7 +475,7 @@ gpgme_data_release (gpgme_data_t dh)
gpgme_data_encoding_t gpgme_data_encoding_t
gpgme_data_get_encoding (gpgme_data_t dh) gpgme_data_get_encoding (gpgme_data_t dh)
{ {
TRACE1 (DEBUG_DATA, "gpgme_data_get_encoding", dh, TRACE (DEBUG_DATA, "gpgme_data_get_encoding", dh,
"dh->encoding=%i", dh ? dh->encoding : GPGME_DATA_ENCODING_NONE); "dh->encoding=%i", dh ? dh->encoding : GPGME_DATA_ENCODING_NONE);
return dh ? dh->encoding : GPGME_DATA_ENCODING_NONE; return dh ? dh->encoding : GPGME_DATA_ENCODING_NONE;
} }
@ -486,7 +486,7 @@ gpgme_data_get_encoding (gpgme_data_t dh)
gpgme_error_t gpgme_error_t
gpgme_data_set_encoding (gpgme_data_t dh, gpgme_data_encoding_t enc) gpgme_data_set_encoding (gpgme_data_t dh, gpgme_data_encoding_t enc)
{ {
TRACE_BEG1 (DEBUG_DATA, "gpgme_data_set_encoding", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_set_encoding", dh,
"encoding=%i", enc); "encoding=%i", enc);
if (!dh) if (!dh)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -502,7 +502,7 @@ gpgme_data_set_encoding (gpgme_data_t dh, gpgme_data_encoding_t enc)
gpgme_error_t gpgme_error_t
gpgme_data_set_file_name (gpgme_data_t dh, const char *file_name) gpgme_data_set_file_name (gpgme_data_t dh, const char *file_name)
{ {
TRACE_BEG1 (DEBUG_DATA, "gpgme_data_set_file_name", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_set_file_name", dh,
"file_name=%s", file_name); "file_name=%s", file_name);
if (!dh) if (!dh)
@ -531,11 +531,11 @@ gpgme_data_get_file_name (gpgme_data_t dh)
{ {
if (!dh) if (!dh)
{ {
TRACE (DEBUG_DATA, "gpgme_data_get_file_name", dh); TRACE (DEBUG_DATA, "gpgme_data_get_file_name", dh, "");
return NULL; return NULL;
} }
TRACE1 (DEBUG_DATA, "gpgme_data_get_file_name", dh, TRACE (DEBUG_DATA, "gpgme_data_get_file_name", dh,
"dh->file_name=%s", dh->file_name); "dh->file_name=%s", dh->file_name);
return dh->file_name; return dh->file_name;
} }
@ -545,7 +545,7 @@ gpgme_data_get_file_name (gpgme_data_t dh)
gpg_error_t gpg_error_t
gpgme_data_set_flag (gpgme_data_t dh, const char *name, const char *value) gpgme_data_set_flag (gpgme_data_t dh, const char *name, const char *value)
{ {
TRACE_BEG2 (DEBUG_DATA, "gpgme_data_set_flag", dh, TRACE_BEG (DEBUG_DATA, "gpgme_data_set_flag", dh,
"%s=%s", name, value); "%s=%s", name, value);
if (!dh) if (!dh)
@ -573,7 +573,7 @@ _gpgme_data_inbound_handler (void *opaque, int fd)
char buffer[BUFFER_SIZE]; char buffer[BUFFER_SIZE];
char *bufp = buffer; char *bufp = buffer;
gpgme_ssize_t buflen; gpgme_ssize_t buflen;
TRACE_BEG1 (DEBUG_CTX, "_gpgme_data_inbound_handler", dh, TRACE_BEG (DEBUG_CTX, "_gpgme_data_inbound_handler", dh,
"fd=0x%x", fd); "fd=0x%x", fd);
buflen = _gpgme_io_read (fd, buffer, BUFFER_SIZE); buflen = _gpgme_io_read (fd, buffer, BUFFER_SIZE);
@ -604,7 +604,7 @@ _gpgme_data_outbound_handler (void *opaque, int fd)
struct io_cb_data *data = (struct io_cb_data *) opaque; struct io_cb_data *data = (struct io_cb_data *) opaque;
gpgme_data_t dh = (gpgme_data_t) data->handler_value; gpgme_data_t dh = (gpgme_data_t) data->handler_value;
gpgme_ssize_t nwritten; gpgme_ssize_t nwritten;
TRACE_BEG1 (DEBUG_CTX, "_gpgme_data_outbound_handler", dh, TRACE_BEG (DEBUG_CTX, "_gpgme_data_outbound_handler", dh,
"fd=0x%x", fd); "fd=0x%x", fd);
if (!dh->pending_len) if (!dh->pending_len)

View File

@ -282,6 +282,91 @@ _gpgme_debug (int level, const char *format, ...)
return 0; return 0;
} }
/* Log the formatted string FORMAT prefixed with additional info
* depending on MODE:
*
* -1 = Do not print any additional args.
* 0 = standalone (used by macro TRACE)
* 1 = enter a function (used by macro TRACE_BEG)
* 2 = debug a function (used by macro TRACE_LOG)
* 3 = leave a function (used by macro TRACE_SUC)
*
* Returns: 0
*
* Note that we always return 0 because the old TRACE macro evaluated
* to 0 which issues a warning with newer gcc version about an unused
* values. By using a return value of this function this can be
* avoided. Fixme: It might be useful to check whether the return
* value from the TRACE macros are actually used somewhere.
*/
int
_gpgme_debugf (int level, int mode, const char *func, const char *tagname,
const char *tagvalue, const char *format, ...)
{
va_list arg_ptr;
int saved_errno;
saved_errno = errno;
if (debug_level < level)
return 0;
va_start (arg_ptr, format);
LOCK (debug_lock);
{
struct tm *tp;
time_t atime = time (NULL);
tp = localtime (&atime);
fprintf (errfp, "GPGME %04d-%02d-%02d %02d:%02d:%02d <0x%04llx> ",
1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
tp->tm_hour, tp->tm_min, tp->tm_sec,
(unsigned long long) ath_self ());
}
#ifdef FRAME_NR
{
int indent;
indent = frame_nr > 0? (2 * (frame_nr - 1)):0;
fprintf (errfp, "%*s", indent < 40? indent : 40, "");
}
#endif
switch (mode)
{
case -1: /* Do nothing. */
break;
case 0:
fprintf (errfp, "%s: call: %s=%p ", func, tagname, tagvalue);
break;
case 1:
fprintf (errfp, "%s: enter: %s=%p ", func, tagname, tagvalue);
break;
case 2:
fprintf (errfp, "%s: check: %s=%p ", func, tagname, tagvalue);
break;
case 3:
if (tagname)
fprintf (errfp, "%s: leave: %s=%p ", func, tagname, tagvalue);
else
fprintf (errfp, "%s: leave: ", func);
break;
default:
fprintf (errfp, "%s: m=%d: %s=%p ", func, mode, tagname, tagvalue);
break;
}
vfprintf (errfp, format, arg_ptr);
va_end (arg_ptr);
if(format && *format && format[strlen (format) - 1] != '\n')
putc ('\n', errfp);
UNLOCK (debug_lock);
fflush (errfp);
gpg_err_set_errno (saved_errno);
return 0;
}
/* Start a new debug line in *LINE, logged at level LEVEL or higher, /* Start a new debug line in *LINE, logged at level LEVEL or higher,
and starting with the formatted string FORMAT. */ and starting with the formatted string FORMAT. */

View File

@ -69,6 +69,10 @@ void _gpgme_debug_subsystem_init (void);
/* Log the formatted string FORMAT at debug level LEVEL or higher. */ /* Log the formatted string FORMAT at debug level LEVEL or higher. */
int _gpgme_debug (int level, const char *format, ...); int _gpgme_debug (int level, const char *format, ...);
int _gpgme_debugf (int level, int mode,
const char *func, const char *tagname, const char *tagvalue,
const char *format, ...) GPGRT_ATTR_PRINTF(6,7);
/* Start a new debug line in *LINE, logged at level LEVEL or higher, /* Start a new debug line in *LINE, logged at level LEVEL or higher,
and starting with the formatted string FORMAT. */ and starting with the formatted string FORMAT. */
@ -109,160 +113,51 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line)
void *_gpgme_trace_tag = (void *) (uintptr_t) tag; \ void *_gpgme_trace_tag = (void *) (uintptr_t) tag; \
_gpgme_debug_frame_begin () _gpgme_debug_frame_begin ()
#define TRACE_BEG(lvl, name, tag) \ #define TRACE_BEG(lvl, name, tag, ...) \
_TRACE (lvl, name, tag); \ _TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p\n", \ _gpgme_debugf (_gpgme_trace_level, 1, \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag)
#define TRACE_BEG0(lvl, name, tag, fmt) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag)
#define TRACE_BEG1(lvl, name, tag, fmt, arg1) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1) __VA_ARGS__)
#define TRACE_BEG2(lvl, name, tag, fmt, arg1, arg2) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2)
#define TRACE_BEG3(lvl, name, tag, fmt, arg1, arg2, arg3) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3)
#define TRACE_BEG4(lvl, name, tag, fmt, arg1, arg2, arg3, arg4) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4)
#define TRACE_BEG5(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4, arg5)
#define TRACE_BEG7(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \
arg5, arg6, arg7) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4, arg5, arg6, arg7)
#define TRACE_BEG8(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \
arg5, arg6, arg7, arg8) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
#define TRACE(lvl, name, tag) \ #define TRACE(lvl, name, tag, ...) \
_gpgme_debug_frame_begin (), \ _gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p\n", \ _gpgme_debugf (lvl, 0, \
name, STRINGIFY (tag), (void *) (uintptr_t) tag), \ name, STRINGIFY (tag), (void *) (uintptr_t) tag, \
_gpgme_debug_frame_end () __VA_ARGS__), \
#define TRACE0(lvl, name, tag, fmt) \
_gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag), \
_gpgme_debug_frame_end ()
#define TRACE1(lvl, name, tag, fmt, arg1) \
_gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1), \
_gpgme_debug_frame_end ()
#define TRACE2(lvl, name, tag, fmt, arg1, arg2) \
_gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
arg2), _gpgme_debug_frame_end ()
#define TRACE3(lvl, name, tag, fmt, arg1, arg2, arg3) \
_gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
arg2, arg3), _gpgme_debug_frame_end ()
#define TRACE6(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
_gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
arg2, arg3, arg4, arg5, arg6), \
_gpgme_debug_frame_end () _gpgme_debug_frame_end ()
#define TRACE_ERR(err) \ #define TRACE_ERR(err) \
err == 0 ? (TRACE_SUC ()) : \ err == 0 ? (TRACE_SUC ("")) : \
(_gpgme_debug (_gpgme_trace_level, "%s:%d: error: %s <%s>\n", \ (_gpgme_debug (_gpgme_trace_level, "%s:%d: error: %s <%s>\n", \
_gpgme_trace_func, __LINE__, gpgme_strerror (err), \ _gpgme_trace_func, __LINE__, gpgme_strerror (err), \
gpgme_strsource (err)), _gpgme_debug_frame_end (), (err)) gpgme_strsource (err)), _gpgme_debug_frame_end (), (err))
/* The cast to void suppresses GCC warnings. */ /* The cast to void suppresses GCC warnings. */
#define TRACE_SYSRES(res) \ #define TRACE_SYSRES(res) \
res >= 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \ res >= 0 ? ((void) (TRACE_SUC ("result=%i", res)), (res)) : \
(_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \ (_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \
_gpgme_trace_func, strerror (errno)), _gpgme_debug_frame_end (), (res)) _gpgme_trace_func, strerror (errno)), \
_gpgme_debug_frame_end (), (res))
#define TRACE_SYSERR(res) \ #define TRACE_SYSERR(res) \
res == 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \ res == 0 ? ((void) (TRACE_SUC ("result=%i", res)), (res)) : \
(_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \ (_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \
_gpgme_trace_func, strerror (res)), \ _gpgme_trace_func, strerror (res)), \
_gpgme_debug_frame_end (), (res)) _gpgme_debug_frame_end (), (res))
#define TRACE_SYSERR_NR(res) \ #define TRACE_SYSERR_NR(res) \
do { res == 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \ do { res == 0 ? ((void) (TRACE_SUC ("result=%i", res)), (res)) : \
(_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \ (_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \
_gpgme_trace_func, strerror (res)), \ _gpgme_trace_func, strerror (res)), \
_gpgme_debug_frame_end ()); } while (0) _gpgme_debug_frame_end ()); } while (0)
#define TRACE_SUC() \ #define TRACE_SUC(...) \
_gpgme_debug (_gpgme_trace_level, "%s: leave\n", \ _gpgme_debugf (_gpgme_trace_level, 3, _gpgme_trace_func, NULL, NULL, \
_gpgme_trace_func), _gpgme_debug_frame_end () __VA_ARGS__), _gpgme_debug_frame_end ()
#define TRACE_SUC0(fmt) \
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func), _gpgme_debug_frame_end ()
#define TRACE_SUC1(fmt, arg1) \
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func, arg1), _gpgme_debug_frame_end ()
#define TRACE_SUC2(fmt, arg1, arg2) \
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end ()
#define TRACE_SUC3(fmt, arg1, arg2, arg3) \
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func, arg1, arg2, arg3), _gpgme_debug_frame_end ()
#define TRACE_SUC4(fmt, arg1, arg2, arg3, arg4) \
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func, arg1, arg2, arg3, arg4), \
_gpgme_debug_frame_end ()
#define TRACE_SUC5(fmt, arg1, arg2, arg3, arg4, arg5) \
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), \
_gpgme_debug_frame_end ()
#define TRACE_SUC6(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, arg6), \
_gpgme_debug_frame_end ()
#define TRACE_LOG(fmt) \ #define TRACE_LOG(...) \
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \ _gpgme_debugf (_gpgme_trace_level, 2, \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag)
#define TRACE_LOG1(fmt, arg1) \
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1) __VA_ARGS__)
#define TRACE_LOG2(fmt, arg1, arg2) \
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2)
#define TRACE_LOG3(fmt, arg1, arg2, arg3) \
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3)
#define TRACE_LOG4(fmt, arg1, arg2, arg3, arg4) \
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4)
#define TRACE_LOG5(fmt, arg1, arg2, arg3, arg4, arg5) \
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4, arg5)
#define TRACE_LOG6(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4, arg5, arg6)
#define TRACE_LOGBUF(buf, len) \ #define TRACE_LOGBUF(buf, len) \
_gpgme_debug_buffer (_gpgme_trace_level, "%s: check: %s", \ _gpgme_debug_buffer (_gpgme_trace_level, "%s: check: %s", \

View File

@ -99,7 +99,7 @@ gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, gpgme_data_t cipher,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_verify_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_verify_start", ctx,
"cipher=%p, plain=%p", cipher, plain); "cipher=%p, plain=%p", cipher, plain);
if (!ctx) if (!ctx)
@ -118,7 +118,7 @@ gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_verify", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_verify", ctx,
"cipher=%p, plain=%p", cipher, plain); "cipher=%p, plain=%p", cipher, plain);
if (!ctx) if (!ctx)
@ -142,7 +142,7 @@ gpgme_op_decrypt_ext_start (gpgme_ctx_t ctx,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_ext_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_ext_start", ctx,
"cipher=%p, plain=%p", cipher, plain); "cipher=%p, plain=%p", cipher, plain);
if (!ctx) if (!ctx)
@ -166,7 +166,7 @@ gpgme_op_decrypt_ext (gpgme_ctx_t ctx,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_ext", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_ext", ctx,
"cipher=%p, plain=%p", cipher, plain); "cipher=%p, plain=%p", cipher, plain);
if (!ctx) if (!ctx)

View File

@ -102,7 +102,7 @@ gpgme_op_decrypt_result (gpgme_ctx_t ctx)
op_data_t opd; op_data_t opd;
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_result", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_result", ctx, "");
ctx->ignore_mdc_error = 0; /* Always reset this flag. */ ctx->ignore_mdc_error = 0; /* Always reset this flag. */
@ -110,7 +110,7 @@ gpgme_op_decrypt_result (gpgme_ctx_t ctx)
opd = hook; opd = hook;
if (err || !opd) if (err || !opd)
{ {
TRACE_SUC0 ("result=(null)"); TRACE_SUC ("result=(null)");
return NULL; return NULL;
} }
@ -120,7 +120,7 @@ gpgme_op_decrypt_result (gpgme_ctx_t ctx)
opd->result.symkey_algo = strdup ("?.?"); opd->result.symkey_algo = strdup ("?.?");
if (!opd->result.symkey_algo) if (!opd->result.symkey_algo)
{ {
TRACE_SUC0 ("result=(null)"); TRACE_SUC ("result=(null)");
return NULL; return NULL;
} }
} }
@ -131,7 +131,7 @@ gpgme_op_decrypt_result (gpgme_ctx_t ctx)
if (opd->result.unsupported_algorithm) if (opd->result.unsupported_algorithm)
{ {
TRACE_LOG1 ("result: unsupported_algorithm: %s", TRACE_LOG ("result: unsupported_algorithm: %s",
opd->result.unsupported_algorithm); opd->result.unsupported_algorithm);
} }
if (opd->result.wrong_key_usage) if (opd->result.wrong_key_usage)
@ -141,18 +141,18 @@ gpgme_op_decrypt_result (gpgme_ctx_t ctx)
rcp = opd->result.recipients; rcp = opd->result.recipients;
while (rcp) while (rcp)
{ {
TRACE_LOG3 ("result: recipient: keyid=%s, pubkey_algo=%i, " TRACE_LOG ("result: recipient: keyid=%s, pubkey_algo=%i, "
"status=%s", rcp->keyid, rcp->pubkey_algo, "status=%s", rcp->keyid, rcp->pubkey_algo,
gpg_strerror (rcp->status)); gpg_strerror (rcp->status));
rcp = rcp->next; rcp = rcp->next;
} }
if (opd->result.file_name) if (opd->result.file_name)
{ {
TRACE_LOG1 ("result: original file name: %s", opd->result.file_name); TRACE_LOG ("result: original file name: %s", opd->result.file_name);
} }
} }
TRACE_SUC1 ("result=%p", &opd->result); TRACE_SUC ("result=%p", &opd->result);
return &opd->result; return &opd->result;
} }
@ -587,7 +587,7 @@ gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_start", ctx,
"cipher=%p, plain=%p", cipher, plain); "cipher=%p, plain=%p", cipher, plain);
if (!ctx) if (!ctx)
@ -605,7 +605,7 @@ gpgme_op_decrypt (gpgme_ctx_t ctx, gpgme_data_t cipher, gpgme_data_t plain)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt", ctx,
"cipher=%p, plain=%p", cipher, plain); "cipher=%p, plain=%p", cipher, plain);
if (!ctx) if (!ctx)

View File

@ -130,7 +130,7 @@ gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_delete_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_delete_start", ctx,
"key=%p (%s), allow_secret=%i", key, "key=%p (%s), allow_secret=%i", key,
(key->subkeys && key->subkeys->fpr) ? (key->subkeys && key->subkeys->fpr) ?
key->subkeys->fpr : "invalid", allow_secret); key->subkeys->fpr : "invalid", allow_secret);
@ -151,7 +151,7 @@ gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key, int allow_secret)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_delete", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_delete", ctx,
"key=%p (%s), allow_secret=%i", key, "key=%p (%s), allow_secret=%i", key,
(key->subkeys && key->subkeys->fpr) ? (key->subkeys && key->subkeys->fpr) ?
key->subkeys->fpr : "invalid", allow_secret); key->subkeys->fpr : "invalid", allow_secret);
@ -174,7 +174,7 @@ gpgme_op_delete_ext_start (gpgme_ctx_t ctx, const gpgme_key_t key,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_delete_ext_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_delete_ext_start", ctx,
"key=%p (%s), flags=0x%x", key, "key=%p (%s), flags=0x%x", key,
(key->subkeys && key->subkeys->fpr) ? (key->subkeys && key->subkeys->fpr) ?
key->subkeys->fpr : "invalid", flags); key->subkeys->fpr : "invalid", flags);
@ -194,7 +194,7 @@ gpgme_op_delete_ext (gpgme_ctx_t ctx, const gpgme_key_t key,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_delete_ext", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_delete_ext", ctx,
"key=%p (%s), flags=0x%x", key, "key=%p (%s), flags=0x%x", key,
(key->subkeys && key->subkeys->fpr) ? (key->subkeys && key->subkeys->fpr) ?
key->subkeys->fpr : "invalid", flags); key->subkeys->fpr : "invalid", flags);

View File

@ -158,7 +158,7 @@ gpgme_op_interact_start (gpgme_ctx_t ctx, gpgme_key_t key, unsigned int flags,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG5 (DEBUG_CTX, "gpgme_op_interact_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_interact_start", ctx,
"key=%p flags=0x%x fnc=%p fnc_value=%p, out=%p", "key=%p flags=0x%x fnc=%p fnc_value=%p, out=%p",
key, flags,fnc, fnc_value, out); key, flags,fnc, fnc_value, out);
@ -177,7 +177,7 @@ gpgme_op_interact (gpgme_ctx_t ctx, gpgme_key_t key, unsigned int flags,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG5 (DEBUG_CTX, "gpgme_op_interact", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_interact", ctx,
"key=%p flags=0x%x fnc=%p fnc_value=%p, out=%p", "key=%p flags=0x%x fnc=%p fnc_value=%p, out=%p",
key, flags,fnc, fnc_value, out); key, flags,fnc, fnc_value, out);
@ -234,7 +234,7 @@ gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG5 (DEBUG_CTX, "gpgme_op_edit_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_edit_start", ctx,
"key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key,
(key && key->subkeys && key->subkeys->fpr) ? (key && key->subkeys && key->subkeys->fpr) ?
key->subkeys->fpr : "invalid", fnc, fnc_value, out); key->subkeys->fpr : "invalid", fnc, fnc_value, out);
@ -255,7 +255,7 @@ gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG5 (DEBUG_CTX, "gpgme_op_edit", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_edit", ctx,
"key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key,
(key && key->subkeys && key->subkeys->fpr) ? (key && key->subkeys && key->subkeys->fpr) ?
key->subkeys->fpr : "invalid", fnc, fnc_value, out); key->subkeys->fpr : "invalid", fnc, fnc_value, out);
@ -278,7 +278,7 @@ gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG5 (DEBUG_CTX, "gpgme_op_card_edit_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_card_edit_start", ctx,
"key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key,
(key && key->subkeys && key->subkeys->fpr) ? (key && key->subkeys && key->subkeys->fpr) ?
key->subkeys->fpr : "invalid", fnc, fnc_value, out); key->subkeys->fpr : "invalid", fnc, fnc_value, out);
@ -299,7 +299,7 @@ gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG5 (DEBUG_CTX, "gpgme_op_card_edit", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_card_edit", ctx,
"key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key,
(key && key->subkeys && key->subkeys->fpr) ? (key && key->subkeys && key->subkeys->fpr) ?
key->subkeys->fpr : "invalid", fnc, fnc_value, out); key->subkeys->fpr : "invalid", fnc, fnc_value, out);

View File

@ -143,7 +143,7 @@ gpgme_op_encrypt_sign_ext (gpgme_ctx_t ctx, gpgme_key_t recp[],
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_encrypt_sign", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt_sign", ctx,
"flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher); "flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher);
if (!ctx) if (!ctx)
@ -157,7 +157,7 @@ gpgme_op_encrypt_sign_ext (gpgme_ctx_t ctx, gpgme_key_t recp[],
while (recp[i]) while (recp[i])
{ {
TRACE_LOG3 ("recipient[%i] = %p (%s)", i, recp[i], TRACE_LOG ("recipient[%i] = %p (%s)", i, recp[i],
(recp[i]->subkeys && recp[i]->subkeys->fpr) ? (recp[i]->subkeys && recp[i]->subkeys->fpr) ?
recp[i]->subkeys->fpr : "invalid"); recp[i]->subkeys->fpr : "invalid");
i++; i++;
@ -165,7 +165,7 @@ gpgme_op_encrypt_sign_ext (gpgme_ctx_t ctx, gpgme_key_t recp[],
} }
else else
{ {
TRACE_LOG1 ("recipients = '%s'", recpstring); TRACE_LOG ("recipients = '%s'", recpstring);
} }
} }
@ -187,7 +187,7 @@ gpgme_op_encrypt_sign_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_encrypt_sign_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt_sign_start", ctx,
"flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher); "flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher);
if (!ctx) if (!ctx)
@ -201,7 +201,7 @@ gpgme_op_encrypt_sign_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
while (recp[i]) while (recp[i])
{ {
TRACE_LOG3 ("recipient[%i] = %p (%s)", i, recp[i], TRACE_LOG ("recipient[%i] = %p (%s)", i, recp[i],
(recp[i]->subkeys && recp[i]->subkeys->fpr) ? (recp[i]->subkeys && recp[i]->subkeys->fpr) ?
recp[i]->subkeys->fpr : "invalid"); recp[i]->subkeys->fpr : "invalid");
i++; i++;
@ -209,7 +209,7 @@ gpgme_op_encrypt_sign_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
} }
else else
{ {
TRACE_LOG1 ("recipients = '%s'", recpstring); TRACE_LOG ("recipients = '%s'", recpstring);
} }
} }

View File

@ -78,14 +78,14 @@ gpgme_op_encrypt_result (gpgme_ctx_t ctx)
op_data_t opd; op_data_t opd;
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt_result", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt_result", ctx, "");
err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, &hook, -1, NULL); err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, &hook, -1, NULL);
opd = hook; opd = hook;
if (err || !opd) if (err || !opd)
{ {
TRACE_SUC0 ("result=(null)"); TRACE_SUC ("result=(null)");
return NULL; return NULL;
} }
@ -96,7 +96,7 @@ gpgme_op_encrypt_result (gpgme_ctx_t ctx)
while (invkeys) while (invkeys)
{ {
TRACE_LOG3 ("invalid_recipients[%i] = %s (%s)", TRACE_LOG ("invalid_recipients[%i] = %s (%s)",
i, invkeys->fpr ? invkeys->fpr : "(null)", i, invkeys->fpr ? invkeys->fpr : "(null)",
gpg_strerror (invkeys->reason)); gpg_strerror (invkeys->reason));
invkeys = invkeys->next; invkeys = invkeys->next;
@ -104,7 +104,7 @@ gpgme_op_encrypt_result (gpgme_ctx_t ctx)
} }
} }
TRACE_SUC1 ("result=%p", &opd->result); TRACE_SUC ("result=%p", &opd->result);
return &opd->result; return &opd->result;
} }
@ -291,7 +291,7 @@ gpgme_op_encrypt_ext (gpgme_ctx_t ctx, gpgme_key_t recp[],
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_encrypt", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt", ctx,
"flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher); "flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher);
if (!ctx) if (!ctx)
@ -305,7 +305,7 @@ gpgme_op_encrypt_ext (gpgme_ctx_t ctx, gpgme_key_t recp[],
while (recp[i]) while (recp[i])
{ {
TRACE_LOG3 ("recipient[%i] = %p (%s)", i, recp[i], TRACE_LOG ("recipient[%i] = %p (%s)", i, recp[i],
(recp[i]->subkeys && recp[i]->subkeys->fpr) ? (recp[i]->subkeys && recp[i]->subkeys->fpr) ?
recp[i]->subkeys->fpr : "invalid"); recp[i]->subkeys->fpr : "invalid");
i++; i++;
@ -313,7 +313,7 @@ gpgme_op_encrypt_ext (gpgme_ctx_t ctx, gpgme_key_t recp[],
} }
else else
{ {
TRACE_LOG1 ("recipients = '%s'", recpstring); TRACE_LOG ("recipients = '%s'", recpstring);
} }
} }
@ -332,7 +332,7 @@ gpgme_op_encrypt_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_encrypt_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt_start", ctx,
"flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher); "flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher);
if (!ctx) if (!ctx)
@ -346,7 +346,7 @@ gpgme_op_encrypt_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
while (recp[i]) while (recp[i])
{ {
TRACE_LOG3 ("recipient[%i] = %p (%s)", i, recp[i], TRACE_LOG ("recipient[%i] = %p (%s)", i, recp[i],
(recp[i]->subkeys && recp[i]->subkeys->fpr) ? (recp[i]->subkeys && recp[i]->subkeys->fpr) ?
recp[i]->subkeys->fpr : "invalid"); recp[i]->subkeys->fpr : "invalid");
i++; i++;
@ -354,7 +354,7 @@ gpgme_op_encrypt_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[],
} }
else else
{ {
TRACE_LOG1 ("recipients = '%s'", recpstring); TRACE_LOG ("recipients = '%s'", recpstring);
} }
} }

View File

@ -493,13 +493,13 @@ llass_status_handler (void *opaque, int fd)
case, we are done for now. */ case, we are done for now. */
if (gpg_err_code (err) == GPG_ERR_EAGAIN) if (gpg_err_code (err) == GPG_ERR_EAGAIN)
{ {
TRACE1 (DEBUG_CTX, "gpgme:llass_status_handler", llass, TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass,
"fd 0x%x: EAGAIN reading assuan line (ignored)", fd); "fd 0x%x: EAGAIN reading assuan line (ignored)", fd);
err = 0; err = 0;
continue; continue;
} }
TRACE2 (DEBUG_CTX, "gpgme:llass_status_handler", llass, TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass,
"fd 0x%x: error reading assuan line: %s", "fd 0x%x: error reading assuan line: %s",
fd, gpg_strerror (err)); fd, gpg_strerror (err));
} }
@ -530,7 +530,7 @@ llass_status_handler (void *opaque, int fd)
err = llass->user.data_cb (llass->user.data_cb_value, err = llass->user.data_cb (llass->user.data_cb_value,
src, linelen); src, linelen);
TRACE2 (DEBUG_CTX, "gpgme:llass_status_handler", llass, TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass,
"fd 0x%x: D inlinedata; status from cb: %s", "fd 0x%x: D inlinedata; status from cb: %s",
fd, (llass->user.data_cb ? fd, (llass->user.data_cb ?
(err? gpg_strerror (err):"ok"):"no callback")); (err? gpg_strerror (err):"ok"):"no callback"));
@ -543,7 +543,7 @@ llass_status_handler (void *opaque, int fd)
if (llass->user.data_cb) if (llass->user.data_cb)
err = llass->user.data_cb (llass->user.data_cb_value, NULL, 0); err = llass->user.data_cb (llass->user.data_cb_value, NULL, 0);
TRACE2 (DEBUG_CTX, "gpgme:llass_status_handler", llass, TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass,
"fd 0x%x: END line; status from cb: %s", "fd 0x%x: END line; status from cb: %s",
fd, (llass->user.data_cb ? fd, (llass->user.data_cb ?
(err? gpg_strerror (err):"ok"):"no callback")); (err? gpg_strerror (err):"ok"):"no callback"));
@ -569,7 +569,7 @@ llass_status_handler (void *opaque, int fd)
err = llass->user.status_cb (llass->user.status_cb_value, err = llass->user.status_cb (llass->user.status_cb_value,
src, args); src, args);
TRACE3 (DEBUG_CTX, "gpgme:llass_status_handler", llass, TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass,
"fd 0x%x: S line (%s) - status from cb: %s", "fd 0x%x: S line (%s) - status from cb: %s",
fd, line+2, (llass->user.status_cb ? fd, line+2, (llass->user.status_cb ?
(err? gpg_strerror (err):"ok"):"no callback")); (err? gpg_strerror (err):"ok"):"no callback"));
@ -615,7 +615,7 @@ llass_status_handler (void *opaque, int fd)
err = atoi (line+4); err = atoi (line+4);
else else
err = gpg_error (GPG_ERR_GENERAL); err = gpg_error (GPG_ERR_GENERAL);
TRACE2 (DEBUG_CTX, "gpgme:llass_status_handler", llass, TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass,
"fd 0x%x: ERR line: %s", "fd 0x%x: ERR line: %s",
fd, err ? gpg_strerror (err) : "ok"); fd, err ? gpg_strerror (err) : "ok");
@ -632,7 +632,7 @@ llass_status_handler (void *opaque, int fd)
&& line[0] == 'O' && line[1] == 'K' && line[0] == 'O' && line[1] == 'K'
&& (line[2] == '\0' || line[2] == ' ')) && (line[2] == '\0' || line[2] == ' '))
{ {
TRACE1 (DEBUG_CTX, "gpgme:llass_status_handler", llass, TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass,
"fd 0x%x: OK line", fd); "fd 0x%x: OK line", fd);
llass->last_op_err = 0; llass->last_op_err = 0;
@ -657,7 +657,7 @@ add_io_cb (engine_llass_t llass, iocb_data_t *iocbd, gpgme_io_cb_t handler)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_ENGINE, "engine-assuan:add_io_cb", llass, TRACE_BEG (DEBUG_ENGINE, "engine-assuan:add_io_cb", llass,
"fd %d, dir %d", iocbd->fd, iocbd->dir); "fd %d, dir %d", iocbd->fd, iocbd->dir);
err = (*llass->io_cbs.add) (llass->io_cbs.add_priv, err = (*llass->io_cbs.add) (llass->io_cbs.add_priv,
iocbd->fd, iocbd->dir, iocbd->fd, iocbd->dir,
@ -784,7 +784,7 @@ llass_io_event (void *engine, gpgme_event_io_t type, void *type_data)
{ {
engine_llass_t llass = engine; engine_llass_t llass = engine;
TRACE3 (DEBUG_ENGINE, "gpgme:llass_io_event", llass, TRACE (DEBUG_ENGINE, "gpgme:llass_io_event", llass,
"event %p, type %d, type_data %p", "event %p, type %d, type_data %p",
llass->io_cbs.event, type, type_data); llass->io_cbs.event, type, type_data);
if (llass->io_cbs.event) if (llass->io_cbs.event)

View File

@ -486,7 +486,7 @@ status_handler (void *opaque, int fd)
{ {
/* Try our best to terminate the connection friendly. */ /* Try our best to terminate the connection friendly. */
/* assuan_write_line (g13->assuan_ctx, "BYE"); */ /* assuan_write_line (g13->assuan_ctx, "BYE"); */
TRACE2 (DEBUG_CTX, "gpgme:status_handler", g13, TRACE (DEBUG_CTX, "gpgme:status_handler", g13,
"fd 0x%x: error reading assuan line: %s", "fd 0x%x: error reading assuan line: %s",
fd, gpg_strerror (err)); fd, gpg_strerror (err));
} }
@ -498,7 +498,7 @@ status_handler (void *opaque, int fd)
err = atoi (&line[4]); err = atoi (&line[4]);
if (! err) if (! err)
err = gpg_error (GPG_ERR_GENERAL); err = gpg_error (GPG_ERR_GENERAL);
TRACE2 (DEBUG_CTX, "gpgme:status_handler", g13, TRACE (DEBUG_CTX, "gpgme:status_handler", g13,
"fd 0x%x: ERR line: %s", "fd 0x%x: ERR line: %s",
fd, err ? gpg_strerror (err) : "ok"); fd, err ? gpg_strerror (err) : "ok");
@ -514,7 +514,7 @@ status_handler (void *opaque, int fd)
&& line[0] == 'O' && line[1] == 'K' && line[0] == 'O' && line[1] == 'K'
&& (line[2] == '\0' || line[2] == ' ')) && (line[2] == '\0' || line[2] == ' '))
{ {
TRACE1 (DEBUG_CTX, "gpgme:status_handler", g13, TRACE (DEBUG_CTX, "gpgme:status_handler", g13,
"fd 0x%x: OK line", fd); "fd 0x%x: OK line", fd);
_gpgme_io_close (g13->status_cb.fd); _gpgme_io_close (g13->status_cb.fd);
@ -556,7 +556,7 @@ status_handler (void *opaque, int fd)
else else
err = 0; err = 0;
TRACE2 (DEBUG_CTX, "gpgme:g13_status_handler", g13, TRACE (DEBUG_CTX, "gpgme:g13_status_handler", g13,
"fd 0x%x: D inlinedata; status from cb: %s", "fd 0x%x: D inlinedata; status from cb: %s",
fd, (g13->user.data_cb ? fd, (g13->user.data_cb ?
(err? gpg_strerror (err):"ok"):"no callback")); (err? gpg_strerror (err):"ok"):"no callback"));
@ -587,7 +587,7 @@ status_handler (void *opaque, int fd)
else else
err = 0; err = 0;
TRACE3 (DEBUG_CTX, "gpgme:g13_status_handler", g13, TRACE (DEBUG_CTX, "gpgme:g13_status_handler", g13,
"fd 0x%x: S line (%s) - status from cb: %s", "fd 0x%x: S line (%s) - status from cb: %s",
fd, line+2, (g13->user.status_cb ? fd, line+2, (g13->user.status_cb ?
(err? gpg_strerror (err):"ok"):"no callback")); (err? gpg_strerror (err):"ok"):"no callback"));
@ -638,7 +638,7 @@ add_io_cb (engine_g13_t g13, iocb_data_t *iocbd, gpgme_io_cb_t handler)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_ENGINE, "engine-g13:add_io_cb", g13, TRACE_BEG (DEBUG_ENGINE, "engine-g13:add_io_cb", g13,
"fd %d, dir %d", iocbd->fd, iocbd->dir); "fd %d, dir %d", iocbd->fd, iocbd->dir);
err = (*g13->io_cbs.add) (g13->io_cbs.add_priv, err = (*g13->io_cbs.add) (g13->io_cbs.add_priv,
iocbd->fd, iocbd->dir, iocbd->fd, iocbd->dir,
@ -760,7 +760,7 @@ g13_io_event (void *engine, gpgme_event_io_t type, void *type_data)
{ {
engine_g13_t g13 = engine; engine_g13_t g13 = engine;
TRACE3 (DEBUG_ENGINE, "gpgme:g13_io_event", g13, TRACE (DEBUG_ENGINE, "gpgme:g13_io_event", g13,
"event %p, type %d, type_data %p", "event %p, type %d, type_data %p",
g13->io_cbs.event, type, type_data); g13->io_cbs.event, type, type_data);
if (g13->io_cbs.event) if (g13->io_cbs.event)

View File

@ -165,7 +165,7 @@ gpg_io_event (void *engine, gpgme_event_io_t type, void *type_data)
{ {
engine_gpg_t gpg = engine; engine_gpg_t gpg = engine;
TRACE3 (DEBUG_ENGINE, "gpgme:gpg_io_event", gpg, TRACE (DEBUG_ENGINE, "gpgme:gpg_io_event", gpg,
"event %p, type %d, type_data %p", "event %p, type %d, type_data %p",
gpg->io_cbs.event, type, type_data); gpg->io_cbs.event, type, type_data);
if (gpg->io_cbs.event) if (gpg->io_cbs.event)
@ -1313,7 +1313,7 @@ read_status (engine_gpg_t gpg)
received and the next thing will be that received and the next thing will be that
the command handler does its action. */ the command handler does its action. */
if (nread > 1) if (nread > 1)
TRACE0 (DEBUG_CTX, "gpgme:read_status", 0, TRACE (DEBUG_CTX, "gpgme:read_status", 0,
"error: unexpected data"); "error: unexpected data");
add_io_cb (gpg, gpg->cmd.fd, 0, add_io_cb (gpg, gpg->cmd.fd, 0,
@ -1686,7 +1686,7 @@ gpg_decrypt (void *engine,
if (have_gpg_version (gpg, "2.1.16")) if (have_gpg_version (gpg, "2.1.16"))
{ {
gpgme_data_release (gpg->override_session_key); gpgme_data_release (gpg->override_session_key);
TRACE2 (DEBUG_ENGINE, "override", gpg, "seskey='%s' len=%zu\n", TRACE (DEBUG_ENGINE, "override", gpg, "seskey='%s' len=%zu\n",
override_session_key, override_session_key,
strlen (override_session_key)); strlen (override_session_key));

View File

@ -836,7 +836,7 @@ status_handler (void *opaque, int fd)
{ {
/* Try our best to terminate the connection friendly. */ /* Try our best to terminate the connection friendly. */
/* assuan_write_line (gpgsm->assuan_ctx, "BYE"); */ /* assuan_write_line (gpgsm->assuan_ctx, "BYE"); */
TRACE3 (DEBUG_CTX, "gpgme:status_handler", gpgsm, TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: error from assuan (%d) getting status line : %s", "fd 0x%x: error from assuan (%d) getting status line : %s",
fd, err, gpg_strerror (err)); fd, err, gpg_strerror (err));
} }
@ -848,7 +848,7 @@ status_handler (void *opaque, int fd)
err = atoi (&line[4]); err = atoi (&line[4]);
if (! err) if (! err)
err = gpg_error (GPG_ERR_GENERAL); err = gpg_error (GPG_ERR_GENERAL);
TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm, TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: ERR line - mapped to: %s", "fd 0x%x: ERR line - mapped to: %s",
fd, err ? gpg_strerror (err) : "ok"); fd, err ? gpg_strerror (err) : "ok");
/* Try our best to terminate the connection friendly. */ /* Try our best to terminate the connection friendly. */
@ -877,7 +877,7 @@ status_handler (void *opaque, int fd)
gpgsm->colon.any = 0; gpgsm->colon.any = 0;
err = gpgsm->colon.fnc (gpgsm->colon.fnc_value, NULL); err = gpgsm->colon.fnc (gpgsm->colon.fnc_value, NULL);
} }
TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm, TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: OK line - final status: %s", "fd 0x%x: OK line - final status: %s",
fd, err ? gpg_strerror (err) : "ok"); fd, err ? gpg_strerror (err) : "ok");
_gpgme_io_close (gpgsm->status_cb.fd); _gpgme_io_close (gpgsm->status_cb.fd);
@ -952,7 +952,7 @@ status_handler (void *opaque, int fd)
dst++; dst++;
} }
} }
TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm, TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: D line; final status: %s", "fd 0x%x: D line; final status: %s",
fd, err? gpg_strerror (err):"ok"); fd, err? gpg_strerror (err):"ok");
} }
@ -994,7 +994,7 @@ status_handler (void *opaque, int fd)
linelen -= nwritten; linelen -= nwritten;
} }
TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm, TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: D inlinedata; final status: %s", "fd 0x%x: D inlinedata; final status: %s",
fd, err? gpg_strerror (err):"ok"); fd, err? gpg_strerror (err):"ok");
} }
@ -1032,7 +1032,7 @@ status_handler (void *opaque, int fd)
} }
else else
fprintf (stderr, "[UNKNOWN STATUS]%s %s", line + 2, rest); fprintf (stderr, "[UNKNOWN STATUS]%s %s", line + 2, rest);
TRACE3 (DEBUG_CTX, "gpgme:status_handler", gpgsm, TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm,
"fd 0x%x: S line (%s) - final status: %s", "fd 0x%x: S line (%s) - final status: %s",
fd, line+2, err? gpg_strerror (err):"ok"); fd, line+2, err? gpg_strerror (err):"ok");
} }
@ -1062,7 +1062,7 @@ add_io_cb (engine_gpgsm_t gpgsm, iocb_data_t *iocbd, gpgme_io_cb_t handler)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_ENGINE, "engine-gpgsm:add_io_cb", gpgsm, TRACE_BEG (DEBUG_ENGINE, "engine-gpgsm:add_io_cb", gpgsm,
"fd %d, dir %d", iocbd->fd, iocbd->dir); "fd %d, dir %d", iocbd->fd, iocbd->dir);
err = (*gpgsm->io_cbs.add) (gpgsm->io_cbs.add_priv, err = (*gpgsm->io_cbs.add) (gpgsm->io_cbs.add_priv,
iocbd->fd, iocbd->dir, iocbd->fd, iocbd->dir,
@ -2148,7 +2148,7 @@ gpgsm_io_event (void *engine, gpgme_event_io_t type, void *type_data)
{ {
engine_gpgsm_t gpgsm = engine; engine_gpgsm_t gpgsm = engine;
TRACE3 (DEBUG_ENGINE, "gpgme:gpgsm_io_event", gpgsm, TRACE (DEBUG_ENGINE, "gpgme:gpgsm_io_event", gpgsm,
"event %p, type %d, type_data %p", "event %p, type %d, type_data %p",
gpgsm->io_cbs.event, type, type_data); gpgsm->io_cbs.event, type, type_data);
if (gpgsm->io_cbs.event) if (gpgsm->io_cbs.event)

View File

@ -381,7 +381,7 @@ engspawn_io_event (void *engine, gpgme_event_io_t type, void *type_data)
{ {
engine_spawn_t esp = engine; engine_spawn_t esp = engine;
TRACE3 (DEBUG_ENGINE, "gpgme:engspawn_io_event", esp, TRACE (DEBUG_ENGINE, "gpgme:engspawn_io_event", esp,
"event %p, type %d, type_data %p", "event %p, type %d, type_data %p",
esp->io_cbs.event, type, type_data); esp->io_cbs.event, type, type_data);
if (esp->io_cbs.event) if (esp->io_cbs.event)

View File

@ -659,7 +659,7 @@ status_handler (void *opaque, int fd)
{ {
/* Try our best to terminate the connection friendly. */ /* Try our best to terminate the connection friendly. */
/* assuan_write_line (uiserver->assuan_ctx, "BYE"); */ /* assuan_write_line (uiserver->assuan_ctx, "BYE"); */
TRACE3 (DEBUG_CTX, "gpgme:status_handler", uiserver, TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver,
"fd 0x%x: error from assuan (%d) getting status line : %s", "fd 0x%x: error from assuan (%d) getting status line : %s",
fd, err, gpg_strerror (err)); fd, err, gpg_strerror (err));
} }
@ -671,7 +671,7 @@ status_handler (void *opaque, int fd)
err = atoi (&line[4]); err = atoi (&line[4]);
if (! err) if (! err)
err = gpg_error (GPG_ERR_GENERAL); err = gpg_error (GPG_ERR_GENERAL);
TRACE2 (DEBUG_CTX, "gpgme:status_handler", uiserver, TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver,
"fd 0x%x: ERR line - mapped to: %s", "fd 0x%x: ERR line - mapped to: %s",
fd, err ? gpg_strerror (err) : "ok"); fd, err ? gpg_strerror (err) : "ok");
/* Try our best to terminate the connection friendly. */ /* Try our best to terminate the connection friendly. */
@ -700,7 +700,7 @@ status_handler (void *opaque, int fd)
uiserver->colon.any = 0; uiserver->colon.any = 0;
err = uiserver->colon.fnc (uiserver->colon.fnc_value, NULL); err = uiserver->colon.fnc (uiserver->colon.fnc_value, NULL);
} }
TRACE2 (DEBUG_CTX, "gpgme:status_handler", uiserver, TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver,
"fd 0x%x: OK line - final status: %s", "fd 0x%x: OK line - final status: %s",
fd, err ? gpg_strerror (err) : "ok"); fd, err ? gpg_strerror (err) : "ok");
_gpgme_io_close (uiserver->status_cb.fd); _gpgme_io_close (uiserver->status_cb.fd);
@ -775,7 +775,7 @@ status_handler (void *opaque, int fd)
dst++; dst++;
} }
} }
TRACE2 (DEBUG_CTX, "gpgme:status_handler", uiserver, TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver,
"fd 0x%x: D line; final status: %s", "fd 0x%x: D line; final status: %s",
fd, err? gpg_strerror (err):"ok"); fd, err? gpg_strerror (err):"ok");
} }
@ -818,7 +818,7 @@ status_handler (void *opaque, int fd)
linelen -= nwritten; linelen -= nwritten;
} }
TRACE2 (DEBUG_CTX, "gpgme:status_handler", uiserver, TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver,
"fd 0x%x: D inlinedata; final status: %s", "fd 0x%x: D inlinedata; final status: %s",
fd, err? gpg_strerror (err):"ok"); fd, err? gpg_strerror (err):"ok");
} }
@ -848,7 +848,7 @@ status_handler (void *opaque, int fd)
} }
else else
fprintf (stderr, "[UNKNOWN STATUS]%s %s", line + 2, rest); fprintf (stderr, "[UNKNOWN STATUS]%s %s", line + 2, rest);
TRACE3 (DEBUG_CTX, "gpgme:status_handler", uiserver, TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver,
"fd 0x%x: S line (%s) - final status: %s", "fd 0x%x: S line (%s) - final status: %s",
fd, line+2, err? gpg_strerror (err):"ok"); fd, line+2, err? gpg_strerror (err):"ok");
} }
@ -878,7 +878,7 @@ add_io_cb (engine_uiserver_t uiserver, iocb_data_t *iocbd, gpgme_io_cb_t handler
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_ENGINE, "engine-uiserver:add_io_cb", uiserver, TRACE_BEG (DEBUG_ENGINE, "engine-uiserver:add_io_cb", uiserver,
"fd %d, dir %d", iocbd->fd, iocbd->dir); "fd %d, dir %d", iocbd->fd, iocbd->dir);
err = (*uiserver->io_cbs.add) (uiserver->io_cbs.add_priv, err = (*uiserver->io_cbs.add) (uiserver->io_cbs.add_priv,
iocbd->fd, iocbd->dir, iocbd->fd, iocbd->dir,
@ -1395,7 +1395,7 @@ uiserver_io_event (void *engine, gpgme_event_io_t type, void *type_data)
{ {
engine_uiserver_t uiserver = engine; engine_uiserver_t uiserver = engine;
TRACE3 (DEBUG_ENGINE, "gpgme:uiserver_io_event", uiserver, TRACE (DEBUG_ENGINE, "gpgme:uiserver_io_event", uiserver,
"event %p, type %d, type_data %p", "event %p, type %d, type_data %p",
uiserver->io_cbs.event, type, type_data); uiserver->io_cbs.event, type, type_data);
if (uiserver->io_cbs.event) if (uiserver->io_cbs.event)

View File

@ -176,7 +176,7 @@ gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_export_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_export_start", ctx,
"pattern=%s, mode=0x%x, keydata=%p", pattern, mode, keydata); "pattern=%s, mode=0x%x, keydata=%p", pattern, mode, keydata);
if (!ctx) if (!ctx)
@ -194,7 +194,7 @@ gpgme_op_export (gpgme_ctx_t ctx, const char *pattern,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_export", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_export", ctx,
"pattern=%s, mode=0x%x, keydata=%p", pattern, mode, keydata); "pattern=%s, mode=0x%x, keydata=%p", pattern, mode, keydata);
if (!ctx) if (!ctx)
@ -270,7 +270,7 @@ gpgme_op_export_ext_start (gpgme_ctx_t ctx, const char *pattern[],
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_export_ext_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_export_ext_start", ctx,
"mode=0x%x, keydata=%p", mode, keydata); "mode=0x%x, keydata=%p", mode, keydata);
if (!ctx) if (!ctx)
@ -282,7 +282,7 @@ gpgme_op_export_ext_start (gpgme_ctx_t ctx, const char *pattern[],
while (pattern[i]) while (pattern[i])
{ {
TRACE_LOG2 ("pattern[%i] = %s", i, pattern[i]); TRACE_LOG ("pattern[%i] = %s", i, pattern[i]);
i++; i++;
} }
} }
@ -299,7 +299,7 @@ gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[],
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_export_ext_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_export_ext_start", ctx,
"mode=0x%x, keydata=%p", mode, keydata); "mode=0x%x, keydata=%p", mode, keydata);
if (!ctx) if (!ctx)
@ -311,7 +311,7 @@ gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[],
while (pattern[i]) while (pattern[i])
{ {
TRACE_LOG2 ("pattern[%i] = %s", i, pattern[i]); TRACE_LOG ("pattern[%i] = %s", i, pattern[i]);
i++; i++;
} }
} }
@ -406,7 +406,7 @@ gpgme_op_export_keys_start (gpgme_ctx_t ctx,
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_export_keys_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_export_keys_start", ctx,
"mode=0x%x, keydata=%p", mode, keydata); "mode=0x%x, keydata=%p", mode, keydata);
if (!ctx) if (!ctx)
@ -418,7 +418,7 @@ gpgme_op_export_keys_start (gpgme_ctx_t ctx,
while (keys[i]) while (keys[i])
{ {
TRACE_LOG3 ("keys[%i] = %p (%s)", i, keys[i], TRACE_LOG ("keys[%i] = %p (%s)", i, keys[i],
(keys[i]->subkeys && keys[i]->subkeys->fpr) ? (keys[i]->subkeys && keys[i]->subkeys->fpr) ?
keys[i]->subkeys->fpr : "invalid"); keys[i]->subkeys->fpr : "invalid");
i++; i++;
@ -437,7 +437,7 @@ gpgme_op_export_keys (gpgme_ctx_t ctx,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_export_keys", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_export_keys", ctx,
"mode=0x%x, keydata=%p", mode, keydata); "mode=0x%x, keydata=%p", mode, keydata);
if (!ctx) if (!ctx)
@ -449,7 +449,7 @@ gpgme_op_export_keys (gpgme_ctx_t ctx,
while (keys[i]) while (keys[i])
{ {
TRACE_LOG3 ("keys[%i] = %p (%s)", i, keys[i], TRACE_LOG ("keys[%i] = %p (%s)", i, keys[i],
(keys[i]->subkeys && keys[i]->subkeys->fpr) ? (keys[i]->subkeys && keys[i]->subkeys->fpr) ?
keys[i]->subkeys->fpr : "invalid"); keys[i]->subkeys->fpr : "invalid");
i++; i++;

View File

@ -70,21 +70,21 @@ gpgme_op_genkey_result (gpgme_ctx_t ctx)
op_data_t opd; op_data_t opd;
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG (DEBUG_CTX, "gpgme_op_genkey_result", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_genkey_result", ctx, "");
err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, &hook, -1, NULL); err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, &hook, -1, NULL);
opd = hook; opd = hook;
if (err || !opd) if (err || !opd)
{ {
TRACE_SUC0 ("result=(null)"); TRACE_SUC ("result=(null)");
return NULL; return NULL;
} }
TRACE_LOG3 ("fpr = %s, %s, %s", opd->result.fpr, TRACE_LOG ("fpr = %s, %s, %s", opd->result.fpr,
opd->result.primary ? "primary" : "no primary", opd->result.primary ? "primary" : "no primary",
opd->result.sub ? "sub" : "no sub"); opd->result.sub ? "sub" : "no sub");
TRACE_SUC1 ("result=%p", &opd->result); TRACE_SUC ("result=%p", &opd->result);
return &opd->result; return &opd->result;
} }
@ -286,7 +286,7 @@ gpgme_op_genkey_start (gpgme_ctx_t ctx, const char *parms,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_genkey_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_genkey_start", ctx,
"pubkey=%p, seckey=%p", pubkey, seckey); "pubkey=%p, seckey=%p", pubkey, seckey);
TRACE_LOGBUF (parms, parms? strlen (parms):0); TRACE_LOGBUF (parms, parms? strlen (parms):0);
@ -307,7 +307,7 @@ gpgme_op_genkey (gpgme_ctx_t ctx, const char *parms, gpgme_data_t pubkey,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_genkey", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_genkey", ctx,
"pubkey=%p, seckey=%p", pubkey, seckey); "pubkey=%p, seckey=%p", pubkey, seckey);
TRACE_LOGBUF (parms, parms? strlen (parms):0); TRACE_LOGBUF (parms, parms? strlen (parms):0);
@ -372,7 +372,7 @@ gpgme_op_createkey_start (gpgme_ctx_t ctx, const char *userid, const char *algo,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_createkey_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_createkey_start", ctx,
"userid='%s', algo='%s' flags=0x%x", userid, algo, flags); "userid='%s', algo='%s' flags=0x%x", userid, algo, flags);
if (!ctx) if (!ctx)
@ -391,7 +391,7 @@ gpgme_op_createkey (gpgme_ctx_t ctx, const char *userid, const char *algo,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_createkey", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_createkey", ctx,
"userid='%s', algo='%s' flags=0x%x", userid, algo, flags); "userid='%s', algo='%s' flags=0x%x", userid, algo, flags);
if (!ctx) if (!ctx)
@ -461,7 +461,7 @@ gpgme_op_createsubkey_start (gpgme_ctx_t ctx, gpgme_key_t key, const char *algo,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_createsubkey_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_createsubkey_start", ctx,
"key=%p, algo='%s' flags=0x%x", key, algo, flags); "key=%p, algo='%s' flags=0x%x", key, algo, flags);
if (!ctx) if (!ctx)
@ -479,7 +479,7 @@ gpgme_op_createsubkey (gpgme_ctx_t ctx, gpgme_key_t key, const char *algo,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_createsubkey", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_createsubkey", ctx,
"key=%p, algo='%s' flags=0x%x", key, algo, flags); "key=%p, algo='%s' flags=0x%x", key, algo, flags);
if (!ctx) if (!ctx)
@ -546,7 +546,7 @@ gpgme_op_adduid_start (gpgme_ctx_t ctx,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_adduid_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_adduid_start", ctx,
"uid='%s' flags=0x%x", userid, flags); "uid='%s' flags=0x%x", userid, flags);
if (!ctx) if (!ctx)
@ -563,7 +563,7 @@ gpgme_op_adduid (gpgme_ctx_t ctx,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_adduid", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_adduid", ctx,
"uid='%s' flags=0x%x", userid, flags); "uid='%s' flags=0x%x", userid, flags);
if (!ctx) if (!ctx)
@ -583,7 +583,7 @@ gpgme_op_revuid_start (gpgme_ctx_t ctx,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_revuid_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_revuid_start", ctx,
"uid='%s' flags=0x%x", userid, flags); "uid='%s' flags=0x%x", userid, flags);
if (!ctx) if (!ctx)
@ -600,7 +600,7 @@ gpgme_op_revuid (gpgme_ctx_t ctx,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_revuid", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_revuid", ctx,
"uid='%s' flags=0x%x", userid, flags); "uid='%s' flags=0x%x", userid, flags);
if (!ctx) if (!ctx)
@ -622,7 +622,7 @@ set_uid_flag (gpgme_ctx_t ctx, int synchronous,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG4 (DEBUG_CTX, "gpgme_op_set_uid_flag", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_set_uid_flag", ctx,
"%d uid='%s' '%s'='%s'", synchronous, userid, name, value); "%d uid='%s' '%s'='%s'", synchronous, userid, name, value);
if (!ctx || !name || !key || !userid) if (!ctx || !name || !key || !userid)

View File

@ -71,7 +71,7 @@ gpgme_op_getauditlog_start (gpgme_ctx_t ctx,
gpgme_data_t output, unsigned int flags) gpgme_data_t output, unsigned int flags)
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_getauditlog_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_getauditlog_start", ctx,
"output=%p, flags=0x%x", output, flags); "output=%p, flags=0x%x", output, flags);
if (!ctx) if (!ctx)
@ -91,7 +91,7 @@ gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, unsigned int flags)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_getauditlog", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_getauditlog", ctx,
"output=%p, flags=0x%x", output, flags); "output=%p, flags=0x%x", output, flags);
if (!ctx) if (!ctx)

View File

@ -94,7 +94,7 @@ gpgme_new (gpgme_ctx_t *r_ctx)
{ {
gpgme_error_t err; gpgme_error_t err;
gpgme_ctx_t ctx; gpgme_ctx_t ctx;
TRACE_BEG (DEBUG_CTX, "gpgme_new", r_ctx); TRACE_BEG (DEBUG_CTX, "gpgme_new", r_ctx, "");
if (_gpgme_selftest) if (_gpgme_selftest)
return TRACE_ERR (_gpgme_selftest); return TRACE_ERR (_gpgme_selftest);
@ -159,7 +159,7 @@ gpgme_new (gpgme_ctx_t *r_ctx)
*r_ctx = ctx; *r_ctx = ctx;
return TRACE_SUC1 ("ctx=%p", ctx); return TRACE_SUC ("ctx=%p", ctx);
} }
@ -170,7 +170,7 @@ _gpgme_cancel_with_err (gpgme_ctx_t ctx, gpg_error_t ctx_err,
gpgme_error_t err; gpgme_error_t err;
struct gpgme_io_event_done_data data; struct gpgme_io_event_done_data data;
TRACE_BEG2 (DEBUG_CTX, "_gpgme_cancel_with_err", ctx, "ctx_err=%i, op_err=%i", TRACE_BEG (DEBUG_CTX, "_gpgme_cancel_with_err", ctx, "ctx_err=%i, op_err=%i",
ctx_err, op_err); ctx_err, op_err);
if (ctx_err) if (ctx_err)
@ -201,7 +201,7 @@ gpgme_cancel (gpgme_ctx_t ctx)
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG (DEBUG_CTX, "gpgme_cancel", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_cancel", ctx, "");
if (!ctx) if (!ctx)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -216,7 +216,7 @@ gpgme_cancel (gpgme_ctx_t ctx)
gpgme_error_t gpgme_error_t
gpgme_cancel_async (gpgme_ctx_t ctx) gpgme_cancel_async (gpgme_ctx_t ctx)
{ {
TRACE_BEG (DEBUG_CTX, "gpgme_cancel_async", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_cancel_async", ctx, "");
if (!ctx) if (!ctx)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -233,7 +233,7 @@ gpgme_cancel_async (gpgme_ctx_t ctx)
void void
gpgme_release (gpgme_ctx_t ctx) gpgme_release (gpgme_ctx_t ctx)
{ {
TRACE (DEBUG_CTX, "gpgme_release", ctx); TRACE (DEBUG_CTX, "gpgme_release", ctx, "");
if (!ctx) if (!ctx)
return; return;
@ -322,7 +322,7 @@ _gpgme_release_result (gpgme_ctx_t ctx)
gpgme_error_t gpgme_error_t
gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol) gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
{ {
TRACE_BEG2 (DEBUG_CTX, "gpgme_set_protocol", ctx, "protocol=%i (%s)", TRACE_BEG (DEBUG_CTX, "gpgme_set_protocol", ctx, "protocol=%i (%s)",
protocol, gpgme_get_protocol_name (protocol) protocol, gpgme_get_protocol_name (protocol)
? gpgme_get_protocol_name (protocol) : "invalid"); ? gpgme_get_protocol_name (protocol) : "invalid");
@ -343,7 +343,7 @@ gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
/* Shut down the engine when switching protocols. */ /* Shut down the engine when switching protocols. */
if (ctx->engine) if (ctx->engine)
{ {
TRACE_LOG1 ("releasing ctx->engine=%p", ctx->engine); TRACE_LOG ("releasing ctx->engine=%p", ctx->engine);
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }
@ -357,7 +357,7 @@ gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
gpgme_protocol_t gpgme_protocol_t
gpgme_get_protocol (gpgme_ctx_t ctx) gpgme_get_protocol (gpgme_ctx_t ctx)
{ {
TRACE2 (DEBUG_CTX, "gpgme_get_protocol", ctx, TRACE (DEBUG_CTX, "gpgme_get_protocol", ctx,
"ctx->protocol=%i (%s)", ctx->protocol, "ctx->protocol=%i (%s)", ctx->protocol,
gpgme_get_protocol_name (ctx->protocol) gpgme_get_protocol_name (ctx->protocol)
? gpgme_get_protocol_name (ctx->protocol) : "invalid"); ? gpgme_get_protocol_name (ctx->protocol) : "invalid");
@ -369,7 +369,7 @@ gpgme_get_protocol (gpgme_ctx_t ctx)
gpgme_error_t gpgme_error_t
gpgme_set_sub_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol) gpgme_set_sub_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
{ {
TRACE2 (DEBUG_CTX, "gpgme_set_sub_protocol", ctx, "protocol=%i (%s)", TRACE (DEBUG_CTX, "gpgme_set_sub_protocol", ctx, "protocol=%i (%s)",
protocol, gpgme_get_protocol_name (protocol) protocol, gpgme_get_protocol_name (protocol)
? gpgme_get_protocol_name (protocol) : "invalid"); ? gpgme_get_protocol_name (protocol) : "invalid");
@ -384,7 +384,7 @@ gpgme_set_sub_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
gpgme_protocol_t gpgme_protocol_t
gpgme_get_sub_protocol (gpgme_ctx_t ctx) gpgme_get_sub_protocol (gpgme_ctx_t ctx)
{ {
TRACE2 (DEBUG_CTX, "gpgme_get_sub_protocol", ctx, TRACE (DEBUG_CTX, "gpgme_get_sub_protocol", ctx,
"ctx->sub_protocol=%i (%s)", ctx->sub_protocol, "ctx->sub_protocol=%i (%s)", ctx->sub_protocol,
gpgme_get_protocol_name (ctx->sub_protocol) gpgme_get_protocol_name (ctx->sub_protocol)
? gpgme_get_protocol_name (ctx->sub_protocol) : "invalid"); ? gpgme_get_protocol_name (ctx->sub_protocol) : "invalid");
@ -441,7 +441,7 @@ gpgme_set_sender (gpgme_ctx_t ctx, const char *address)
{ {
char *p = NULL; char *p = NULL;
TRACE_BEG1 (DEBUG_CTX, "gpgme_set_sender", ctx, "sender='%s'", TRACE_BEG (DEBUG_CTX, "gpgme_set_sender", ctx, "sender='%s'",
address?address:"(null)"); address?address:"(null)");
if (!ctx || (address && !(p = _gpgme_mailbox_from_userid (address)))) if (!ctx || (address && !(p = _gpgme_mailbox_from_userid (address))))
@ -459,7 +459,7 @@ gpgme_set_sender (gpgme_ctx_t ctx, const char *address)
const char * const char *
gpgme_get_sender (gpgme_ctx_t ctx) gpgme_get_sender (gpgme_ctx_t ctx)
{ {
TRACE1 (DEBUG_CTX, "gpgme_get_sender", ctx, "sender='%s'", TRACE (DEBUG_CTX, "gpgme_get_sender", ctx, "sender='%s'",
ctx?ctx->sender:""); ctx?ctx->sender:"");
return ctx->sender; return ctx->sender;
@ -470,7 +470,7 @@ gpgme_get_sender (gpgme_ctx_t ctx)
void void
gpgme_set_armor (gpgme_ctx_t ctx, int use_armor) gpgme_set_armor (gpgme_ctx_t ctx, int use_armor)
{ {
TRACE2 (DEBUG_CTX, "gpgme_set_armor", ctx, "use_armor=%i (%s)", TRACE (DEBUG_CTX, "gpgme_set_armor", ctx, "use_armor=%i (%s)",
use_armor, use_armor ? "yes" : "no"); use_armor, use_armor ? "yes" : "no");
if (!ctx) if (!ctx)
@ -484,7 +484,7 @@ gpgme_set_armor (gpgme_ctx_t ctx, int use_armor)
int int
gpgme_get_armor (gpgme_ctx_t ctx) gpgme_get_armor (gpgme_ctx_t ctx)
{ {
TRACE2 (DEBUG_CTX, "gpgme_get_armor", ctx, "ctx->use_armor=%i (%s)", TRACE (DEBUG_CTX, "gpgme_get_armor", ctx, "ctx->use_armor=%i (%s)",
ctx->use_armor, ctx->use_armor ? "yes" : "no"); ctx->use_armor, ctx->use_armor ? "yes" : "no");
return ctx->use_armor; return ctx->use_armor;
} }
@ -499,7 +499,7 @@ gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value)
gpgme_error_t err = 0; gpgme_error_t err = 0;
int abool; int abool;
TRACE2 (DEBUG_CTX, "gpgme_set_ctx_flag", ctx, TRACE (DEBUG_CTX, "gpgme_set_ctx_flag", ctx,
"name='%s' value='%s'", "name='%s' value='%s'",
name? name:"(null)", value?value:"(null)"); name? name:"(null)", value?value:"(null)");
@ -632,7 +632,7 @@ gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name)
void void
gpgme_set_textmode (gpgme_ctx_t ctx, int use_textmode) gpgme_set_textmode (gpgme_ctx_t ctx, int use_textmode)
{ {
TRACE2 (DEBUG_CTX, "gpgme_set_textmode", ctx, "use_textmode=%i (%s)", TRACE (DEBUG_CTX, "gpgme_set_textmode", ctx, "use_textmode=%i (%s)",
use_textmode, use_textmode ? "yes" : "no"); use_textmode, use_textmode ? "yes" : "no");
if (!ctx) if (!ctx)
@ -645,7 +645,7 @@ gpgme_set_textmode (gpgme_ctx_t ctx, int use_textmode)
int int
gpgme_get_textmode (gpgme_ctx_t ctx) gpgme_get_textmode (gpgme_ctx_t ctx)
{ {
TRACE2 (DEBUG_CTX, "gpgme_get_textmode", ctx, "ctx->use_textmode=%i (%s)", TRACE (DEBUG_CTX, "gpgme_get_textmode", ctx, "ctx->use_textmode=%i (%s)",
ctx->use_textmode, ctx->use_textmode ? "yes" : "no"); ctx->use_textmode, ctx->use_textmode ? "yes" : "no");
return ctx->use_textmode; return ctx->use_textmode;
} }
@ -656,7 +656,7 @@ gpgme_get_textmode (gpgme_ctx_t ctx)
void void
gpgme_set_offline (gpgme_ctx_t ctx, int offline) gpgme_set_offline (gpgme_ctx_t ctx, int offline)
{ {
TRACE2 (DEBUG_CTX, "gpgme_set_offline", ctx, "offline=%i (%s)", TRACE (DEBUG_CTX, "gpgme_set_offline", ctx, "offline=%i (%s)",
offline, offline ? "yes" : "no"); offline, offline ? "yes" : "no");
if (!ctx) if (!ctx)
@ -669,7 +669,7 @@ gpgme_set_offline (gpgme_ctx_t ctx, int offline)
int int
gpgme_get_offline (gpgme_ctx_t ctx) gpgme_get_offline (gpgme_ctx_t ctx)
{ {
TRACE2 (DEBUG_CTX, "gpgme_get_offline", ctx, "ctx->offline=%i (%s)", TRACE (DEBUG_CTX, "gpgme_get_offline", ctx, "ctx->offline=%i (%s)",
ctx->offline, ctx->offline ? "yes" : "no"); ctx->offline, ctx->offline ? "yes" : "no");
return ctx->offline; return ctx->offline;
} }
@ -691,7 +691,7 @@ gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs)
else else
ctx->include_certs = nr_of_certs; ctx->include_certs = nr_of_certs;
TRACE2 (DEBUG_CTX, "gpgme_set_include_certs", ctx, "nr_of_certs=%i%s", TRACE (DEBUG_CTX, "gpgme_set_include_certs", ctx, "nr_of_certs=%i%s",
nr_of_certs, nr_of_certs == ctx->include_certs ? "" : " (-2)"); nr_of_certs, nr_of_certs == ctx->include_certs ? "" : " (-2)");
} }
@ -701,7 +701,7 @@ gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs)
int int
gpgme_get_include_certs (gpgme_ctx_t ctx) gpgme_get_include_certs (gpgme_ctx_t ctx)
{ {
TRACE1 (DEBUG_CTX, "gpgme_get_include_certs", ctx, "ctx->include_certs=%i", TRACE (DEBUG_CTX, "gpgme_get_include_certs", ctx, "ctx->include_certs=%i",
ctx->include_certs); ctx->include_certs);
return ctx->include_certs; return ctx->include_certs;
} }
@ -713,7 +713,7 @@ gpgme_get_include_certs (gpgme_ctx_t ctx)
gpgme_error_t gpgme_error_t
gpgme_set_keylist_mode (gpgme_ctx_t ctx, gpgme_keylist_mode_t mode) gpgme_set_keylist_mode (gpgme_ctx_t ctx, gpgme_keylist_mode_t mode)
{ {
TRACE1 (DEBUG_CTX, "gpgme_set_keylist_mode", ctx, "keylist_mode=0x%x", TRACE (DEBUG_CTX, "gpgme_set_keylist_mode", ctx, "keylist_mode=0x%x",
mode); mode);
if (!ctx) if (!ctx)
@ -728,7 +728,7 @@ gpgme_set_keylist_mode (gpgme_ctx_t ctx, gpgme_keylist_mode_t mode)
gpgme_keylist_mode_t gpgme_keylist_mode_t
gpgme_get_keylist_mode (gpgme_ctx_t ctx) gpgme_get_keylist_mode (gpgme_ctx_t ctx)
{ {
TRACE1 (DEBUG_CTX, "gpgme_get_keylist_mode", ctx, TRACE (DEBUG_CTX, "gpgme_get_keylist_mode", ctx,
"ctx->keylist_mode=0x%x", ctx->keylist_mode); "ctx->keylist_mode=0x%x", ctx->keylist_mode);
return ctx->keylist_mode; return ctx->keylist_mode;
} }
@ -738,7 +738,7 @@ gpgme_get_keylist_mode (gpgme_ctx_t ctx)
gpgme_error_t gpgme_error_t
gpgme_set_pinentry_mode (gpgme_ctx_t ctx, gpgme_pinentry_mode_t mode) gpgme_set_pinentry_mode (gpgme_ctx_t ctx, gpgme_pinentry_mode_t mode)
{ {
TRACE1 (DEBUG_CTX, "gpgme_set_pinentry_mode", ctx, "pinentry_mode=%u", TRACE (DEBUG_CTX, "gpgme_set_pinentry_mode", ctx, "pinentry_mode=%u",
(unsigned int)mode); (unsigned int)mode);
if (!ctx) if (!ctx)
@ -765,7 +765,7 @@ gpgme_set_pinentry_mode (gpgme_ctx_t ctx, gpgme_pinentry_mode_t mode)
gpgme_pinentry_mode_t gpgme_pinentry_mode_t
gpgme_get_pinentry_mode (gpgme_ctx_t ctx) gpgme_get_pinentry_mode (gpgme_ctx_t ctx)
{ {
TRACE1 (DEBUG_CTX, "gpgme_get_pinentry_mode", ctx, TRACE (DEBUG_CTX, "gpgme_get_pinentry_mode", ctx,
"ctx->pinentry_mode=%u", (unsigned int)ctx->pinentry_mode); "ctx->pinentry_mode=%u", (unsigned int)ctx->pinentry_mode);
return ctx->pinentry_mode; return ctx->pinentry_mode;
} }
@ -777,7 +777,7 @@ void
gpgme_set_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t cb, gpgme_set_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t cb,
void *cb_value) void *cb_value)
{ {
TRACE2 (DEBUG_CTX, "gpgme_set_passphrase_cb", ctx, TRACE (DEBUG_CTX, "gpgme_set_passphrase_cb", ctx,
"passphrase_cb=%p/%p", cb, cb_value); "passphrase_cb=%p/%p", cb, cb_value);
if (!ctx) if (!ctx)
@ -794,7 +794,7 @@ void
gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *r_cb, gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *r_cb,
void **r_cb_value) void **r_cb_value)
{ {
TRACE2 (DEBUG_CTX, "gpgme_get_passphrase_cb", ctx, TRACE (DEBUG_CTX, "gpgme_get_passphrase_cb", ctx,
"ctx->passphrase_cb=%p/%p", "ctx->passphrase_cb=%p/%p",
ctx->passphrase_cb, ctx->passphrase_cb_value); ctx->passphrase_cb, ctx->passphrase_cb_value);
if (r_cb) if (r_cb)
@ -809,7 +809,7 @@ gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *r_cb,
void void
gpgme_set_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t cb, void *cb_value) gpgme_set_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t cb, void *cb_value)
{ {
TRACE2 (DEBUG_CTX, "gpgme_set_progress_cb", ctx, "progress_cb=%p/%p", TRACE (DEBUG_CTX, "gpgme_set_progress_cb", ctx, "progress_cb=%p/%p",
cb, cb_value); cb, cb_value);
if (!ctx) if (!ctx)
@ -826,7 +826,7 @@ void
gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *r_cb, gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *r_cb,
void **r_cb_value) void **r_cb_value)
{ {
TRACE2 (DEBUG_CTX, "gpgme_get_progress_cb", ctx, "ctx->progress_cb=%p/%p", TRACE (DEBUG_CTX, "gpgme_get_progress_cb", ctx, "ctx->progress_cb=%p/%p",
ctx->progress_cb, ctx->progress_cb_value); ctx->progress_cb, ctx->progress_cb_value);
if (r_cb) if (r_cb)
*r_cb = ctx->progress_cb; *r_cb = ctx->progress_cb;
@ -840,7 +840,7 @@ gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *r_cb,
void void
gpgme_set_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t cb, void *cb_value) gpgme_set_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t cb, void *cb_value)
{ {
TRACE2 (DEBUG_CTX, "gpgme_set_status_cb", ctx, "status_cb=%p/%p", TRACE (DEBUG_CTX, "gpgme_set_status_cb", ctx, "status_cb=%p/%p",
cb, cb_value); cb, cb_value);
if (!ctx) if (!ctx)
@ -857,7 +857,7 @@ void
gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *r_cb, gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *r_cb,
void **r_cb_value) void **r_cb_value)
{ {
TRACE2 (DEBUG_CTX, "gpgme_get_status_cb", ctx, "ctx->status_cb=%p/%p", TRACE (DEBUG_CTX, "gpgme_get_status_cb", ctx, "ctx->status_cb=%p/%p",
ctx ? ctx->status_cb : NULL, ctx ? ctx->status_cb_value : NULL); ctx ? ctx->status_cb : NULL, ctx ? ctx->status_cb_value : NULL);
if (r_cb) if (r_cb)
@ -885,7 +885,7 @@ gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
if (io_cbs) if (io_cbs)
{ {
TRACE6 (DEBUG_CTX, "gpgme_set_io_cbs", ctx, TRACE (DEBUG_CTX, "gpgme_set_io_cbs", ctx,
"io_cbs=%p (add=%p/%p, remove=%p, event=%p/%p", "io_cbs=%p (add=%p/%p, remove=%p, event=%p/%p",
io_cbs, io_cbs->add, io_cbs->add_priv, io_cbs->remove, io_cbs, io_cbs->add, io_cbs->add_priv, io_cbs->remove,
io_cbs->event, io_cbs->event_priv); io_cbs->event, io_cbs->event_priv);
@ -893,7 +893,7 @@ gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
} }
else else
{ {
TRACE1 (DEBUG_CTX, "gpgme_set_io_cbs", ctx, TRACE (DEBUG_CTX, "gpgme_set_io_cbs", ctx,
"io_cbs=%p (default)", io_cbs); "io_cbs=%p (default)", io_cbs);
ctx->io_cbs.add = NULL; ctx->io_cbs.add = NULL;
ctx->io_cbs.add_priv = NULL; ctx->io_cbs.add_priv = NULL;
@ -910,7 +910,7 @@ gpgme_ssize_t
gpgme_io_read (int fd, void *buffer, size_t count) gpgme_io_read (int fd, void *buffer, size_t count)
{ {
int ret; int ret;
TRACE_BEG2 (DEBUG_GLOBAL, "gpgme_io_read", fd, TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_read", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%u", buffer, count);
ret = _gpgme_io_read (fd, buffer, count); ret = _gpgme_io_read (fd, buffer, count);
@ -926,7 +926,7 @@ gpgme_ssize_t
gpgme_io_write (int fd, const void *buffer, size_t count) gpgme_io_write (int fd, const void *buffer, size_t count)
{ {
int ret; int ret;
TRACE_BEG2 (DEBUG_GLOBAL, "gpgme_io_write", fd, TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_write", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%u", buffer, count);
ret = _gpgme_io_write (fd, buffer, count); ret = _gpgme_io_write (fd, buffer, count);
@ -945,7 +945,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_BEG2 (DEBUG_GLOBAL, "gpgme_io_writen", fd, TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_writen", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%u", buffer, count);
while (count) while (count)
{ {
@ -964,7 +964,7 @@ gpgme_io_writen (int fd, const void *buffer_arg, size_t count)
void void
gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs) gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
{ {
TRACE6 (DEBUG_CTX, "gpgme_get_io_cbs", ctx, TRACE (DEBUG_CTX, "gpgme_get_io_cbs", ctx,
"io_cbs=%p, ctx->io_cbs.add=%p/%p, .remove=%p, .event=%p/%p", "io_cbs=%p, ctx->io_cbs.add=%p/%p, .remove=%p, .event=%p/%p",
io_cbs, io_cbs->add, io_cbs->add_priv, io_cbs->remove, io_cbs, io_cbs->add, io_cbs->add_priv, io_cbs->remove,
io_cbs->event, io_cbs->event_priv); io_cbs->event, io_cbs->event_priv);
@ -982,7 +982,7 @@ gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value)
char *new_lc_ctype = NULL; char *new_lc_ctype = NULL;
char *new_lc_messages = NULL; char *new_lc_messages = NULL;
TRACE_BEG2 (DEBUG_CTX, "gpgme_set_locale", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_set_locale", ctx,
"category=%i, value=%s", category, value ? value : "(null)"); "category=%i, value=%s", category, value ? value : "(null)");
#define PREPARE_ONE_LOCALE(lcat, ucat) \ #define PREPARE_ONE_LOCALE(lcat, ucat) \
@ -1051,7 +1051,7 @@ gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value)
gpgme_engine_info_t gpgme_engine_info_t
gpgme_ctx_get_engine_info (gpgme_ctx_t ctx) gpgme_ctx_get_engine_info (gpgme_ctx_t ctx)
{ {
TRACE1 (DEBUG_CTX, "gpgme_ctx_get_engine_info", ctx, TRACE (DEBUG_CTX, "gpgme_ctx_get_engine_info", ctx,
"ctx->engine_info=%p", ctx->engine_info); "ctx->engine_info=%p", ctx->engine_info);
return ctx->engine_info; return ctx->engine_info;
} }
@ -1064,7 +1064,7 @@ gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, gpgme_protocol_t proto,
const char *file_name, const char *home_dir) const char *file_name, const char *home_dir)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG4 (DEBUG_CTX, "gpgme_ctx_set_engine_info", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_ctx_set_engine_info", ctx,
"protocol=%i (%s), file_name=%s, home_dir=%s", "protocol=%i (%s), file_name=%s, home_dir=%s",
proto, gpgme_get_protocol_name (proto) proto, gpgme_get_protocol_name (proto)
? gpgme_get_protocol_name (proto) : "unknown", ? gpgme_get_protocol_name (proto) : "unknown",
@ -1077,7 +1077,7 @@ gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, gpgme_protocol_t proto,
/* Shut down the engine when changing engine info. */ /* Shut down the engine when changing engine info. */
if (ctx->engine) if (ctx->engine)
{ {
TRACE_LOG1 ("releasing ctx->engine=%p", ctx->engine); TRACE_LOG ("releasing ctx->engine=%p", ctx->engine);
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }
@ -1109,7 +1109,7 @@ _gpgme_sig_notation_clear (gpgme_ctx_t ctx)
void void
gpgme_sig_notation_clear (gpgme_ctx_t ctx) gpgme_sig_notation_clear (gpgme_ctx_t ctx)
{ {
TRACE (DEBUG_CTX, "gpgme_sig_notation_clear", ctx); TRACE (DEBUG_CTX, "gpgme_sig_notation_clear", ctx, "");
if (!ctx) if (!ctx)
return; return;
@ -1131,7 +1131,7 @@ gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name,
gpgme_sig_notation_t notation; gpgme_sig_notation_t notation;
gpgme_sig_notation_t *lastp; gpgme_sig_notation_t *lastp;
TRACE_BEG3 (DEBUG_CTX, "gpgme_sig_notation_add", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_sig_notation_add", ctx,
"name=%s, value=%s, flags=0x%x", "name=%s, value=%s, flags=0x%x",
name ? name : "(null)", value ? value : "(null)", name ? name : "(null)", value ? value : "(null)",
flags); flags);
@ -1164,10 +1164,10 @@ gpgme_sig_notation_get (gpgme_ctx_t ctx)
{ {
if (!ctx) if (!ctx)
{ {
TRACE (DEBUG_CTX, "gpgme_sig_notation_get", ctx); TRACE (DEBUG_CTX, "gpgme_sig_notation_get", ctx, "");
return NULL; return NULL;
} }
TRACE1 (DEBUG_CTX, "gpgme_sig_notation_get", ctx, TRACE (DEBUG_CTX, "gpgme_sig_notation_get", ctx,
"ctx->sig_notations=%p", ctx->sig_notations); "ctx->sig_notations=%p", ctx->sig_notations);
return ctx->sig_notations; return ctx->sig_notations;

View File

@ -67,13 +67,13 @@ gpgme_op_import_result (gpgme_ctx_t ctx)
op_data_t opd; op_data_t opd;
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG (DEBUG_CTX, "gpgme_op_import_result", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_import_result", ctx, "");
err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, &hook, -1, NULL); err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, &hook, -1, NULL);
opd = hook; opd = hook;
if (err || !opd) if (err || !opd)
{ {
TRACE_SUC0 ("result=(null)"); TRACE_SUC ("result=(null)");
return NULL; return NULL;
} }
@ -83,18 +83,18 @@ gpgme_op_import_result (gpgme_ctx_t ctx)
gpgme_import_status_t impstat; gpgme_import_status_t impstat;
int i; int i;
TRACE_LOG5 ("%i considered, %i no UID, %i imported, %i imported RSA, " TRACE_LOG ("%i considered, %i no UID, %i imported, %i imported RSA, "
"%i unchanged", opd->result.considered, "%i unchanged", opd->result.considered,
opd->result.no_user_id, opd->result.imported, opd->result.no_user_id, opd->result.imported,
opd->result.imported_rsa, opd->result.unchanged); opd->result.imported_rsa, opd->result.unchanged);
TRACE_LOG4 ("%i new UIDs, %i new sub keys, %i new signatures, " TRACE_LOG ("%i new UIDs, %i new sub keys, %i new signatures, "
"%i new revocations", opd->result.new_user_ids, "%i new revocations", opd->result.new_user_ids,
opd->result.new_sub_keys, opd->result.new_signatures, opd->result.new_sub_keys, opd->result.new_signatures,
opd->result.new_revocations); opd->result.new_revocations);
TRACE_LOG3 ("%i secret keys, %i imported, %i unchanged", TRACE_LOG ("%i secret keys, %i imported, %i unchanged",
opd->result.secret_read, opd->result.secret_imported, opd->result.secret_read, opd->result.secret_imported,
opd->result.secret_unchanged); opd->result.secret_unchanged);
TRACE_LOG3 ("%i skipped new keys, %i not imported, %i v3 skipped", TRACE_LOG ("%i skipped new keys, %i not imported, %i v3 skipped",
opd->result.skipped_new_keys, opd->result.not_imported, opd->result.skipped_new_keys, opd->result.not_imported,
opd->result.skipped_v3_keys); opd->result.skipped_v3_keys);
@ -102,14 +102,14 @@ gpgme_op_import_result (gpgme_ctx_t ctx)
i = 0; i = 0;
while (impstat) while (impstat)
{ {
TRACE_LOG4 ("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, impstat->result);
impstat = impstat->next; impstat = impstat->next;
i++; i++;
} }
} }
TRACE_SUC1 ("result=%p", &opd->result); TRACE_SUC ("result=%p", &opd->result);
return &opd->result; return &opd->result;
} }
@ -290,7 +290,7 @@ gpgme_op_import_start (gpgme_ctx_t ctx, gpgme_data_t keydata)
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG1 (DEBUG_CTX, "gpgme_op_import_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_import_start", ctx,
"keydata=%p", keydata); "keydata=%p", keydata);
if (!ctx) if (!ctx)
@ -307,7 +307,7 @@ gpgme_op_import (gpgme_ctx_t ctx, gpgme_data_t keydata)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG1 (DEBUG_CTX, "gpgme_op_import", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_import", ctx,
"keydata=%p", keydata); "keydata=%p", keydata);
if (!ctx) if (!ctx)
@ -374,7 +374,7 @@ gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t *keys)
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG (DEBUG_CTX, "gpgme_op_import_keys_start", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_import_keys_start", ctx, "");
if (!ctx) if (!ctx)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -385,7 +385,7 @@ gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t *keys)
while (keys[i]) while (keys[i])
{ {
TRACE_LOG3 ("keys[%i] = %p (%s)", i, keys[i], TRACE_LOG ("keys[%i] = %p (%s)", i, keys[i],
(keys[i]->subkeys && keys[i]->subkeys->fpr) ? (keys[i]->subkeys && keys[i]->subkeys->fpr) ?
keys[i]->subkeys->fpr : "invalid"); keys[i]->subkeys->fpr : "invalid");
i++; i++;
@ -412,7 +412,7 @@ gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t *keys)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG (DEBUG_CTX, "gpgme_op_import_keys", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_import_keys", ctx, "");
if (!ctx) if (!ctx)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -423,7 +423,7 @@ gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t *keys)
while (keys[i]) while (keys[i])
{ {
TRACE_LOG3 ("keys[%i] = %p (%s)", i, keys[i], TRACE_LOG ("keys[%i] = %p (%s)", i, keys[i],
(keys[i]->subkeys && keys[i]->subkeys->fpr) ? (keys[i]->subkeys && keys[i]->subkeys->fpr) ?
keys[i]->subkeys->fpr : "invalid"); keys[i]->subkeys->fpr : "invalid");
i++; i++;

View File

@ -101,19 +101,19 @@ gpgme_op_keylist_result (gpgme_ctx_t ctx)
op_data_t opd; op_data_t opd;
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_result", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_result", ctx, "");
err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, -1, NULL); err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, -1, NULL);
opd = hook; opd = hook;
if (err || !opd) if (err || !opd)
{ {
TRACE_SUC0 ("result=(null)"); TRACE_SUC ("result=(null)");
return NULL; return NULL;
} }
TRACE_LOG1 ("truncated = %i", opd->result.truncated); TRACE_LOG ("truncated = %i", opd->result.truncated);
TRACE_SUC1 ("result=%p", &opd->result); TRACE_SUC ("result=%p", &opd->result);
return &opd->result; return &opd->result;
} }
@ -572,7 +572,7 @@ keylist_colon_handler (void *priv, char *line)
key = opd->tmp_key; key = opd->tmp_key;
TRACE2 (DEBUG_CTX, "gpgme:keylist_colon_handler", ctx, TRACE (DEBUG_CTX, "gpgme:keylist_colon_handler", ctx,
"key = %p, line = %s", key, line ? line : "(null)"); "key = %p, line = %s", key, line ? line : "(null)");
if (!line) if (!line)
@ -1078,7 +1078,7 @@ gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern, int secret_only)
op_data_t opd; op_data_t opd;
int flags = 0; int flags = 0;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_keylist_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_start", ctx,
"pattern=%s, secret_only=%i", pattern, secret_only); "pattern=%s, secret_only=%i", pattern, secret_only);
if (!ctx) if (!ctx)
@ -1122,7 +1122,7 @@ gpgme_op_keylist_ext_start (gpgme_ctx_t ctx, const char *pattern[],
op_data_t opd; op_data_t opd;
int flags = 0; int flags = 0;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_keylist_ext_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_ext_start", ctx,
"secret_only=%i, reserved=0x%x", secret_only, reserved); "secret_only=%i, reserved=0x%x", secret_only, reserved);
if (!ctx) if (!ctx)
@ -1164,7 +1164,7 @@ gpgme_op_keylist_from_data_start (gpgme_ctx_t ctx, gpgme_data_t data,
void *hook; void *hook;
op_data_t opd; op_data_t opd;
TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_from_data_start", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_from_data_start", ctx, "");
if (!ctx || !data || reserved) if (!ctx || !data || reserved)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -1199,7 +1199,7 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key)
void *hook; void *hook;
op_data_t opd; op_data_t opd;
TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_next", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_next", ctx, "");
if (!ctx || !r_key) if (!ctx || !r_key)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -1235,7 +1235,7 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key)
*r_key = queue_item->key; *r_key = queue_item->key;
free (queue_item); free (queue_item);
return TRACE_SUC2 ("key=%p (%s)", *r_key, return TRACE_SUC ("key=%p (%s)", *r_key,
((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ?
(*r_key)->subkeys->fpr : "invalid"); (*r_key)->subkeys->fpr : "invalid");
} }
@ -1245,7 +1245,7 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key)
gpgme_error_t gpgme_error_t
gpgme_op_keylist_end (gpgme_ctx_t ctx) gpgme_op_keylist_end (gpgme_ctx_t ctx)
{ {
TRACE (DEBUG_CTX, "gpgme_op_keylist_end", ctx); TRACE (DEBUG_CTX, "gpgme_op_keylist_end", ctx, "");
if (!ctx) if (!ctx)
return gpg_error (GPG_ERR_INV_VALUE); return gpg_error (GPG_ERR_INV_VALUE);
@ -1264,7 +1264,7 @@ gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, gpgme_key_t *r_key,
gpgme_error_t err; gpgme_error_t err;
gpgme_key_t result, key; gpgme_key_t result, key;
TRACE_BEG2 (DEBUG_CTX, "gpgme_get_key", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_get_key", ctx,
"fpr=%s, secret=%i", fpr, secret); "fpr=%s, secret=%i", fpr, secret);
if (r_key) if (r_key)
@ -1335,7 +1335,7 @@ gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, gpgme_key_t *r_key,
if (! err) if (! err)
{ {
*r_key = result; *r_key = result;
TRACE_LOG2 ("key=%p (%s)", *r_key, TRACE_LOG ("key=%p (%s)", *r_key,
((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ?
(*r_key)->subkeys->fpr : "invalid"); (*r_key)->subkeys->fpr : "invalid");
} }

View File

@ -189,7 +189,7 @@ gpgme_op_keysign_start (gpgme_ctx_t ctx, gpgme_key_t key, const char *userid,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_keysign_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_keysign_start", ctx,
"key=%p, uid='%s' flags=0x%x", key, userid, flags); "key=%p, uid='%s' flags=0x%x", key, userid, flags);
if (!ctx) if (!ctx)
@ -206,7 +206,7 @@ gpgme_op_keysign (gpgme_ctx_t ctx, gpgme_key_t key, const char *userid,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_keysign", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_keysign", ctx,
"key=%p, uid='%s' flags=0x%x", key, userid, flags); "key=%p, uid='%s' flags=0x%x", key, userid, flags);
if (!ctx) if (!ctx)

View File

@ -91,7 +91,7 @@ gpgme_op_assuan_transact_start (gpgme_ctx_t ctx,
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG7 (DEBUG_CTX, "gpgme_op_assuan_transact_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_assuan_transact_start", ctx,
"command=%s, data_cb=%p/%p, inq_cb=%p/%p, status_cb=%p/%p", "command=%s, data_cb=%p/%p, inq_cb=%p/%p, status_cb=%p/%p",
command, data_cb, data_cb_value, inq_cb, inq_cb_value, command, data_cb, data_cb_value, inq_cb, inq_cb_value,
status_cb, status_cb_value); status_cb, status_cb_value);
@ -120,7 +120,7 @@ gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx,
gpgme_error_t err; gpgme_error_t err;
gpgme_error_t op_err; gpgme_error_t op_err;
TRACE_BEG8 (DEBUG_CTX, "gpgme_op_assuan_transact", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_assuan_transact", ctx,
"command=%s, data_cb=%p/%p, inq_cb=%p/%p, status_cb=%p/%p, " "command=%s, data_cb=%p/%p, inq_cb=%p/%p, status_cb=%p/%p, "
"op_err=%p", "op_err=%p",
command, data_cb, data_cb_value, inq_cb, inq_cb_value, command, data_cb, data_cb_value, inq_cb, inq_cb_value,
@ -139,7 +139,7 @@ gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx,
err = _gpgme_wait_one_ext (ctx, &op_err); err = _gpgme_wait_one_ext (ctx, &op_err);
if (op_err) if (op_err)
{ {
TRACE_LOG2 ("op_err = %s <%s>", gpgme_strerror (op_err), TRACE_LOG ("op_err = %s <%s>", gpgme_strerror (op_err),
gpgme_strsource (op_err)); gpgme_strsource (op_err));
if (! op_err_p) if (! op_err_p)
{ {
@ -175,7 +175,7 @@ gpgme_op_assuan_result (gpgme_ctx_t ctx)
void *hook; void *hook;
op_data_t opd; op_data_t opd;
TRACE_BEG (DEBUG_CTX, "gpgme_op_assuan_result", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_assuan_result", ctx, "");
err = _gpgme_op_data_lookup (ctx, OPDATA_ASSUAN, &hook, -1, NULL); err = _gpgme_op_data_lookup (ctx, OPDATA_ASSUAN, &hook, -1, NULL);
opd = hook; opd = hook;
@ -183,7 +183,7 @@ gpgme_op_assuan_result (gpgme_ctx_t ctx)
before. */ before. */
if (err || !opd) if (err || !opd)
{ {
TRACE_SUC0 ("result=(null)"); TRACE_SUC ("result=(null)");
return NULL; return NULL;
} }
@ -192,15 +192,15 @@ gpgme_op_assuan_result (gpgme_ctx_t ctx)
opd->result.err = _gpgme_engine_assuan_last_op_err (ctx->engine->engine); opd->result.err = _gpgme_engine_assuan_last_op_err (ctx->engine->engine);
if (opd->result.err) if (opd->result.err)
{ {
TRACE_LOG1 ("err = %s", gpg_strerror (0)); TRACE_LOG ("err = %s", gpg_strerror (0));
} }
else else
{ {
TRACE_LOG2 ("err = %s <%s>", gpg_strerror (opd->result.err), TRACE_LOG ("err = %s <%s>", gpg_strerror (opd->result.err),
gpg_strsource (opd->result.err)); gpg_strsource (opd->result.err));
} }
TRACE_SUC1 ("result=%p", &opd->result); TRACE_SUC ("result=%p", &opd->result);
return &opd->result; return &opd->result;
} }
@ -217,7 +217,7 @@ gpgme_op_assuan_transact (gpgme_ctx_t ctx,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE (DEBUG_CTX, "gpgme_op_assuan_transact", ctx); TRACE (DEBUG_CTX, "gpgme_op_assuan_transact", ctx, "");
if (!ctx) if (!ctx)
return gpg_error (GPG_ERR_INV_VALUE); return gpg_error (GPG_ERR_INV_VALUE);

View File

@ -173,7 +173,7 @@ gpgme_error_t
gpgme_op_passwd_start (gpgme_ctx_t ctx, gpgme_key_t key, unsigned int flags) gpgme_op_passwd_start (gpgme_ctx_t ctx, gpgme_key_t key, unsigned int flags)
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_passwd_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_passwd_start", ctx,
"key=%p, flags=0x%x", key, flags); "key=%p, flags=0x%x", key, flags);
if (!ctx) if (!ctx)
@ -191,7 +191,7 @@ gpgme_op_passwd (gpgme_ctx_t ctx, gpgme_key_t key, unsigned int flags)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_passwd", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_passwd", ctx,
"key=%p, flags=0x%x", key, flags); "key=%p, flags=0x%x", key, flags);
if (!ctx) if (!ctx)

View File

@ -109,7 +109,7 @@ int
_gpgme_io_read (int fd, void *buffer, size_t count) _gpgme_io_read (int fd, void *buffer, size_t count)
{ {
int nread; int nread;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_read", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_read", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%u", buffer, count);
do do
@ -127,7 +127,7 @@ int
_gpgme_io_write (int fd, const void *buffer, size_t count) _gpgme_io_write (int fd, const void *buffer, size_t count)
{ {
int nwritten; int nwritten;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_write", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%u", buffer, count);
TRACE_LOGBUFX (buffer, count); TRACE_LOGBUFX (buffer, count);
@ -146,7 +146,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
{ {
int saved_errno; int saved_errno;
int err; int err;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_pipe", filedes, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_pipe", filedes,
"inherit_idx=%i (GPGME uses it for %s)", "inherit_idx=%i (GPGME uses it for %s)",
inherit_idx, inherit_idx ? "reading" : "writing"); inherit_idx, inherit_idx ? "reading" : "writing");
@ -166,7 +166,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
if (err) if (err)
return TRACE_SYSRES (err); return TRACE_SYSRES (err);
return TRACE_SUC2 ("read=0x%x, write=0x%x", filedes[0], filedes[1]); return TRACE_SUC ("read=0x%x, write=0x%x", filedes[0], filedes[1]);
} }
@ -178,7 +178,7 @@ _gpgme_io_close (int fd)
void *handler_value; void *handler_value;
int idx; int idx;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd); TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd, "");
if (fd == -1) if (fd == -1)
{ {
@ -203,7 +203,7 @@ _gpgme_io_close (int fd)
UNLOCK (notify_table_lock); UNLOCK (notify_table_lock);
if (handler) if (handler)
{ {
TRACE_LOG2 ("invoking close handler %p/%p", handler, handler_value); TRACE_LOG ("invoking close handler %p/%p", handler, handler_value);
handler (fd, handler_value); handler (fd, handler_value);
} }
@ -220,7 +220,7 @@ _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler,
int res = 0; int res = 0;
int idx; int idx;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd,
"close_handler=%p/%p", handler, value); "close_handler=%p/%p", handler, value);
assert (fd != -1); assert (fd != -1);
@ -271,7 +271,7 @@ _gpgme_io_set_nonblocking (int fd)
{ {
int flags; int flags;
int res; int res;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd); TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd, "");
flags = fcntl (fd, F_GETFL, 0); flags = fcntl (fd, F_GETFL, 0);
if (flags == -1) if (flags == -1)
@ -427,7 +427,7 @@ get_max_fds (void)
} }
#endif #endif
TRACE2 (DEBUG_SYSIO, "gpgme:max_fds", 0, "max fds=%i (%s)", fds, source); TRACE (DEBUG_SYSIO, "gpgme:max_fds", 0, "max fds=%i (%s)", fds, source);
return fds; return fds;
} }
@ -473,19 +473,19 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
int status; int status;
int signo; int signo;
TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_spawn", path,
"path=%s", path); "path=%s", path);
i = 0; i = 0;
while (argv[i]) while (argv[i])
{ {
TRACE_LOG2 ("argv[%2i] = %s", i, argv[i]); TRACE_LOG ("argv[%2i] = %s", i, argv[i]);
i++; i++;
} }
for (i = 0; fd_list[i].fd != -1; i++) for (i = 0; fd_list[i].fd != -1; i++)
if (fd_list[i].dup_to == -1) if (fd_list[i].dup_to == -1)
TRACE_LOG2 ("fd[%i] = 0x%x", i, fd_list[i].fd); TRACE_LOG ("fd[%i] = 0x%x", i, fd_list[i].fd);
else else
TRACE_LOG3 ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd, fd_list[i].dup_to); TRACE_LOG ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd, fd_list[i].dup_to);
pid = fork (); pid = fork ();
if (pid == -1) if (pid == -1)
@ -568,7 +568,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
#if 0 #if 0
/* FIXME: The debug file descriptor is not /* FIXME: The debug file descriptor is not
dup'ed anyway, so we can't see this. */ dup'ed anyway, so we can't see this. */
TRACE_LOG1 ("dup2 failed in child: %s\n", TRACE_LOG ("dup2 failed in child: %s\n",
strerror (errno)); strerror (errno));
#endif #endif
_exit (8); _exit (8);
@ -618,7 +618,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
_exit (0); _exit (0);
} }
TRACE_LOG1 ("waiting for child process pid=%i", pid); TRACE_LOG ("waiting for child process pid=%i", pid);
_gpgme_io_waitpid (pid, 1, &status, &signo); _gpgme_io_waitpid (pid, 1, &status, &signo);
if (status) if (status)
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
@ -653,7 +653,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
/* Use a 1s timeout. */ /* Use a 1s timeout. */
struct timeval timeout = { 1, 0 }; struct timeval timeout = { 1, 0 };
void *dbg_help = NULL; void *dbg_help = NULL;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_select", fds, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_select", fds,
"nfds=%u, nonblock=%u", nfds, nonblock); "nfds=%u, nonblock=%u", nfds, nonblock);
FD_ZERO (&readfds); FD_ZERO (&readfds);
@ -759,7 +759,7 @@ _gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags)
int nread; int nread;
int saved_errno; int saved_errno;
struct iovec *iov; struct iovec *iov;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_recvmsg", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_recvmsg", fd,
"msg=%p, flags=%i", msg, flags); "msg=%p, flags=%i", msg, flags);
nread = 0; nread = 0;
@ -770,7 +770,7 @@ _gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags)
iov++; iov++;
} }
TRACE_LOG1 ("about to receive %d bytes", nread); TRACE_LOG ("about to receive %d bytes", nread);
do do
{ {
@ -801,7 +801,7 @@ _gpgme_io_sendmsg (int fd, const struct msghdr *msg, int flags)
{ {
int nwritten; int nwritten;
struct iovec *iov; struct iovec *iov;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_sendmsg", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_sendmsg", fd,
"msg=%p, flags=%i", msg, flags); "msg=%p, flags=%i", msg, flags);
nwritten = 0; nwritten = 0;
@ -812,7 +812,7 @@ _gpgme_io_sendmsg (int fd, const struct msghdr *msg, int flags)
iov++; iov++;
} }
TRACE_LOG1 ("about to receive %d bytes", nwritten); TRACE_LOG ("about to receive %d bytes", nwritten);
iov = msg->msg_iov; iov = msg->msg_iov;
while (nwritten > 0) while (nwritten > 0)
{ {
@ -840,7 +840,7 @@ _gpgme_io_dup (int fd)
new_fd = dup (fd); new_fd = dup (fd);
while (new_fd == -1 && errno == EINTR); while (new_fd == -1 && errno == EINTR);
TRACE1 (DEBUG_SYSIO, "_gpgme_io_dup", fd, "new fd==%i", new_fd); TRACE (DEBUG_SYSIO, "_gpgme_io_dup", fd, "new fd==%i", new_fd);
return new_fd; return new_fd;
} }
@ -851,7 +851,7 @@ _gpgme_io_socket (int domain, int type, int proto)
{ {
int res; int res;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_socket", domain, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_socket", domain,
"type=%i, proto=%i", type, proto); "type=%i, proto=%i", type, proto);
res = socket (domain, type, proto); res = socket (domain, type, proto);
@ -865,7 +865,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen)
{ {
int res; int res;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_connect", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_connect", fd,
"addr=%p, addrlen=%i", addr, addrlen); "addr=%p, addrlen=%i", addr, addrlen);
do do

View File

@ -58,18 +58,18 @@ gpgme_op_query_swdb_result (gpgme_ctx_t ctx)
op_data_t opd; op_data_t opd;
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG (DEBUG_CTX, "gpgme_op_query_swdb_result", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_query_swdb_result", ctx, "");
err = _gpgme_op_data_lookup (ctx, OPDATA_QUERY_SWDB, &hook, -1, NULL); err = _gpgme_op_data_lookup (ctx, OPDATA_QUERY_SWDB, &hook, -1, NULL);
opd = hook; opd = hook;
if (err || !opd) if (err || !opd)
{ {
TRACE_SUC0 ("result=(null)"); TRACE_SUC ("result=(null)");
return NULL; return NULL;
} }
TRACE_SUC1 ("result=%p", &opd->result); TRACE_SUC ("result=%p", &opd->result);
return &opd->result; return &opd->result;
} }
@ -91,8 +91,8 @@ gpgme_op_query_swdb (gpgme_ctx_t ctx, const char *name, const char *iversion,
void *hook; void *hook;
op_data_t opd; op_data_t opd;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_query_swdb", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_query_swdb", ctx,
"name=%s, iversion=%a", name, iversion); "name=%s, iversion=%", 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

@ -107,13 +107,13 @@ gpgme_op_sign_result (gpgme_ctx_t ctx)
unsigned int inv_signers = 0; unsigned int inv_signers = 0;
unsigned int signatures = 0; unsigned int signatures = 0;
TRACE_BEG (DEBUG_CTX, "gpgme_op_sign_result", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_sign_result", ctx, "");
err = _gpgme_op_data_lookup (ctx, OPDATA_SIGN, &hook, -1, NULL); err = _gpgme_op_data_lookup (ctx, OPDATA_SIGN, &hook, -1, NULL);
opd = hook; opd = hook;
if (err || !opd) if (err || !opd)
{ {
TRACE_SUC0 ("result=(null)"); TRACE_SUC ("result=(null)");
return NULL; return NULL;
} }
@ -130,7 +130,7 @@ gpgme_op_sign_result (gpgme_ctx_t ctx)
broken and should not be used. We add the already created broken and should not be used. We add the already created
signatures to the invalid signers list and thus this case can signatures to the invalid signers list and thus this case can
be detected. */ be detected. */
TRACE_LOG3 ("result: invalid signers: %u, signatures: %u, count: %u", TRACE_LOG ("result: invalid signers: %u, signatures: %u, count: %u",
inv_signers, signatures, gpgme_signers_count (ctx)); inv_signers, signatures, gpgme_signers_count (ctx));
for (sig = opd->result.signatures; sig; sig = sig->next) for (sig = opd->result.signatures; sig; sig = sig->next)
@ -138,7 +138,7 @@ gpgme_op_sign_result (gpgme_ctx_t ctx)
key = calloc (1, sizeof *key); key = calloc (1, sizeof *key);
if (!key) if (!key)
{ {
TRACE_SUC0 ("out of core; result=(null)"); TRACE_SUC ("out of core; result=(null)");
return NULL; return NULL;
} }
if (sig->fpr) if (sig->fpr)
@ -147,7 +147,7 @@ gpgme_op_sign_result (gpgme_ctx_t ctx)
if (!key->fpr) if (!key->fpr)
{ {
free (key); free (key);
TRACE_SUC0 ("out of core; result=(null)"); TRACE_SUC ("out of core; result=(null)");
return NULL; return NULL;
} }
} }
@ -170,24 +170,24 @@ gpgme_op_sign_result (gpgme_ctx_t ctx)
if (_gpgme_debug_trace()) if (_gpgme_debug_trace())
{ {
TRACE_LOG2 ("result: invalid signers: %i, signatures: %i", TRACE_LOG ("result: invalid signers: %i, signatures: %i",
inv_signers, signatures); inv_signers, signatures);
for (inv_key=opd->result.invalid_signers; inv_key; inv_key=inv_key->next) for (inv_key=opd->result.invalid_signers; inv_key; inv_key=inv_key->next)
{ {
TRACE_LOG3 ("result: invalid signer: fpr=%s, reason=%s <%s>", TRACE_LOG ("result: invalid signer: fpr=%s, reason=%s <%s>",
inv_key->fpr, gpgme_strerror (inv_key->reason), inv_key->fpr, gpgme_strerror (inv_key->reason),
gpgme_strsource (inv_key->reason)); gpgme_strsource (inv_key->reason));
} }
for (sig = opd->result.signatures; sig; sig = sig->next) for (sig = opd->result.signatures; sig; sig = sig->next)
{ {
TRACE_LOG6 ("result: signature: type=%i, pubkey_algo=%i, " TRACE_LOG ("result: signature: type=%i, pubkey_algo=%i, "
"hash_algo=%i, timestamp=%li, fpr=%s, sig_class=%i", "hash_algo=%i, timestamp=%li, fpr=%s, sig_class=%i",
sig->type, sig->pubkey_algo, sig->hash_algo, sig->type, sig->pubkey_algo, sig->hash_algo,
sig->timestamp, sig->fpr, sig->sig_class); sig->timestamp, sig->fpr, sig->sig_class);
} }
} }
TRACE_SUC1 ("result=%p", &opd->result); TRACE_SUC ("result=%p", &opd->result);
return &opd->result; return &opd->result;
} }
@ -469,7 +469,7 @@ gpgme_op_sign_start (gpgme_ctx_t ctx, gpgme_data_t plain, gpgme_data_t sig,
gpgme_sig_mode_t mode) gpgme_sig_mode_t mode)
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_sign_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_sign_start", ctx,
"plain=%p, sig=%p, mode=%i", plain, sig, mode); "plain=%p, sig=%p, mode=%i", plain, sig, mode);
if (!ctx) if (!ctx)
@ -487,7 +487,7 @@ gpgme_op_sign (gpgme_ctx_t ctx, gpgme_data_t plain, gpgme_data_t sig,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_sign", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_sign", ctx,
"plain=%p, sig=%p, mode=%i", plain, sig, mode); "plain=%p, sig=%p, mode=%i", plain, sig, mode);
if (!ctx) if (!ctx)

View File

@ -56,7 +56,7 @@ _gpgme_signers_clear (gpgme_ctx_t ctx)
void void
gpgme_signers_clear (gpgme_ctx_t ctx) gpgme_signers_clear (gpgme_ctx_t ctx)
{ {
TRACE (DEBUG_CTX, "gpgme_signers_clear", ctx); TRACE (DEBUG_CTX, "gpgme_signers_clear", ctx, "");
_gpgme_signers_clear (ctx); _gpgme_signers_clear (ctx);
} }
@ -65,7 +65,7 @@ gpgme_signers_clear (gpgme_ctx_t ctx)
gpgme_error_t gpgme_error_t
gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key) gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key)
{ {
TRACE_BEG2 (DEBUG_CTX, "gpgme_signers_add", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_signers_add", ctx,
"key=%p (%s)", key, (key && key->subkeys && key->subkeys->fpr) ? "key=%p (%s)", key, (key && key->subkeys && key->subkeys->fpr) ?
key->subkeys->fpr : "invalid"); key->subkeys->fpr : "invalid");
@ -89,7 +89,7 @@ gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key)
gpgme_key_ref (key); gpgme_key_ref (key);
ctx->signers[ctx->signers_len++] = key; ctx->signers[ctx->signers_len++] = key;
return TRACE_SUC (); return TRACE_SUC ("");
} }

View File

@ -70,7 +70,7 @@ gpgme_op_spawn_start (gpgme_ctx_t ctx, const char *file, const char *argv[],
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_spawn_start", ctx, "file=(%s) flaggs=%x", TRACE_BEG (DEBUG_CTX, "gpgme_op_spawn_start", ctx, "file=(%s) flaggs=%x",
file, flags); file, flags);
if (!ctx) if (!ctx)
@ -93,7 +93,7 @@ gpgme_op_spawn (gpgme_ctx_t ctx, const char *file, const char *argv[],
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_spawn", ctx, "file=(%s) flags=%x", TRACE_BEG (DEBUG_CTX, "gpgme_op_spawn", ctx, "file=(%s) flags=%x",
file, flags); file, flags);
if (!ctx) if (!ctx)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));

View File

@ -155,7 +155,7 @@ gpgme_op_tofu_policy_start (gpgme_ctx_t ctx,
gpgme_key_t key, gpgme_tofu_policy_t policy) gpgme_key_t key, gpgme_tofu_policy_t policy)
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_tofu_policy_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_tofu_policy_start", ctx,
"key=%p, policy=%u", key, (unsigned int)policy); "key=%p, policy=%u", key, (unsigned int)policy);
if (!ctx) if (!ctx)
@ -172,7 +172,7 @@ gpgme_op_tofu_policy (gpgme_ctx_t ctx,
gpgme_key_t key, gpgme_tofu_policy_t policy) gpgme_key_t key, gpgme_tofu_policy_t policy)
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_tofu_policy", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_tofu_policy", ctx,
"key=%p, policy=%u", key, (unsigned int)policy); "key=%p, policy=%u", key, (unsigned int)policy);
if (!ctx) if (!ctx)

View File

@ -177,7 +177,7 @@ gpgme_op_trustlist_start (gpgme_ctx_t ctx, const char *pattern, int max_level)
void *hook; void *hook;
op_data_t opd; op_data_t opd;
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_trustlist_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_trustlist_start", ctx,
"pattern=%s, max_level=%i", pattern, max_level); "pattern=%s, max_level=%i", pattern, max_level);
if (!ctx || !pattern || !*pattern) if (!ctx || !pattern || !*pattern)
@ -213,7 +213,7 @@ gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item)
op_data_t opd; op_data_t opd;
struct trust_queue_item_s *q; struct trust_queue_item_s *q;
TRACE_BEG (DEBUG_CTX, "gpgme_op_trustlist_next", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_trustlist_next", ctx, "");
if (!ctx || !r_item) if (!ctx || !r_item)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -245,20 +245,20 @@ gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item)
free (q); free (q);
if ((*r_item)->type == 1) if ((*r_item)->type == 1)
{ {
TRACE_SUC5 ("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 0x%x", *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_SUC5 ("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 0x%x", *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_SUC5 ("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 0x%x", *r_item, (*r_item)->keyid,
(*r_item)->type, (*r_item)->level, (*r_item)->validity); (*r_item)->type, (*r_item)->level, (*r_item)->validity);
} }
@ -270,7 +270,7 @@ gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item)
gpgme_error_t gpgme_error_t
gpgme_op_trustlist_end (gpgme_ctx_t ctx) gpgme_op_trustlist_end (gpgme_ctx_t ctx)
{ {
TRACE (DEBUG_CTX, "gpgme_op_trustlist_end", ctx); TRACE (DEBUG_CTX, "gpgme_op_trustlist_end", ctx, "");
if (!ctx) if (!ctx)
return gpg_error (GPG_ERR_INV_VALUE); return gpg_error (GPG_ERR_INV_VALUE);

View File

@ -92,12 +92,12 @@ gpgme_op_verify_result (gpgme_ctx_t ctx)
gpgme_error_t err; gpgme_error_t err;
gpgme_signature_t sig; gpgme_signature_t sig;
TRACE_BEG (DEBUG_CTX, "gpgme_op_verify_result", ctx); TRACE_BEG (DEBUG_CTX, "gpgme_op_verify_result", ctx, "");
err = _gpgme_op_data_lookup (ctx, OPDATA_VERIFY, &hook, -1, NULL); err = _gpgme_op_data_lookup (ctx, OPDATA_VERIFY, &hook, -1, NULL);
opd = hook; opd = hook;
if (err || !opd) if (err || !opd)
{ {
TRACE_SUC0 ("result=(null)"); TRACE_SUC ("result=(null)");
return NULL; return NULL;
} }
@ -133,30 +133,30 @@ gpgme_op_verify_result (gpgme_ctx_t ctx)
for (sig = opd->result.signatures, i = 0; sig; sig = sig->next, i++) for (sig = opd->result.signatures, i = 0; sig; sig = sig->next, i++)
{ {
TRACE_LOG4 ("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_LOG6 ("sig[%i] = timestamps 0x%x/0x%x flags:%s%s%s", TRACE_LOG ("sig[%i] = timestamps 0x%x/0x%x 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"
: (sig->pka_trust == 2 ? "pka_okay" : "pka RFU"), : (sig->pka_trust == 2 ? "pka_okay" : "pka RFU"),
sig->chain_model ? "chain model" : ""); sig->chain_model ? "chain model" : "");
TRACE_LOG5 ("sig[%i] = validity 0x%x (%s), algos %s/%s", TRACE_LOG ("sig[%i] = validity 0x%x (%s), algos %s/%s",
i, sig->validity, gpg_strerror (sig->validity_reason), i, sig->validity, gpg_strerror (sig->validity_reason),
gpgme_pubkey_algo_name (sig->pubkey_algo), gpgme_pubkey_algo_name (sig->pubkey_algo),
gpgme_hash_algo_name (sig->hash_algo)); gpgme_hash_algo_name (sig->hash_algo));
if (sig->pka_address) if (sig->pka_address)
{ {
TRACE_LOG2 ("sig[%i] = PKA address %s", i, sig->pka_address); TRACE_LOG ("sig[%i] = PKA address %s", i, sig->pka_address);
} }
if (sig->notations) if (sig->notations)
{ {
TRACE_LOG1 ("sig[%i] = has notations (not shown)", i); TRACE_LOG ("sig[%i] = has notations (not shown)", i);
} }
} }
} }
TRACE_SUC1 ("result=%p", &opd->result); TRACE_SUC ("result=%p", &opd->result);
return &opd->result; return &opd->result;
} }
@ -1165,7 +1165,7 @@ gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig,
gpgme_data_t signed_text, gpgme_data_t plaintext) gpgme_data_t signed_text, gpgme_data_t plaintext)
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_verify_start", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_verify_start", ctx,
"sig=%p, signed_text=%p, plaintext=%p", "sig=%p, signed_text=%p, plaintext=%p",
sig, signed_text, plaintext); sig, signed_text, plaintext);
@ -1185,7 +1185,7 @@ gpgme_op_verify (gpgme_ctx_t ctx, gpgme_data_t sig, gpgme_data_t signed_text,
{ {
gpgme_error_t err; gpgme_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_verify", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_verify", ctx,
"sig=%p, signed_text=%p, plaintext=%p", "sig=%p, signed_text=%p, plaintext=%p",
sig, signed_text, plaintext); sig, signed_text, plaintext);

View File

@ -202,7 +202,7 @@ gpgme_check_version (const char *req_version)
before using the trace facility. If we won't the trace would before using the trace facility. If we won't the trace would
automagically initialize the debug system with out the locks automagically initialize the debug system with out the locks
being initialized and missing the assuan log level setting. */ being initialized and missing the assuan log level setting. */
TRACE2 (DEBUG_INIT, "gpgme_check_version", 0, TRACE (DEBUG_INIT, "gpgme_check_version", 0,
"req_version=%s, VERSION=%s", "req_version=%s, VERSION=%s",
req_version? req_version:"(null)", VERSION); req_version? req_version:"(null)", VERSION);
@ -229,13 +229,13 @@ gpgme_check_version_internal (const char *req_version,
return result; return result;
/* Catch-22, see above. */ /* Catch-22, see above. */
TRACE2 (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=%i",
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))
{ {
TRACE1 (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)); offsetof (struct _gpgme_signature, validity));
_gpgme_selftest = GPG_ERR_SELFTEST_FAILED; _gpgme_selftest = GPG_ERR_SELFTEST_FAILED;

View File

@ -179,7 +179,7 @@ gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[],
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG3 (DEBUG_CTX, "gpgme_op_vfs_create", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_vfs_create", ctx,
"container_file=%s, flags=0x%x, op_err=%p", "container_file=%s, flags=0x%x, op_err=%p",
container_file, flags, op_err); container_file, flags, op_err);
@ -192,7 +192,7 @@ gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[],
while (recp[i]) while (recp[i])
{ {
TRACE_LOG3 ("recipient[%i] = %p (%s)", i, recp[i], TRACE_LOG ("recipient[%i] = %p (%s)", i, recp[i],
(recp[i]->subkeys && recp[i]->subkeys->fpr) ? (recp[i]->subkeys && recp[i]->subkeys->fpr) ?
recp[i]->subkeys->fpr : "invalid"); recp[i]->subkeys->fpr : "invalid");
i++; i++;

View File

@ -234,7 +234,7 @@ gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file,
{ {
gpg_error_t err; gpg_error_t err;
TRACE_BEG4 (DEBUG_CTX, "gpgme_op_vfs_mount", ctx, TRACE_BEG (DEBUG_CTX, "gpgme_op_vfs_mount", ctx,
"container=%s, mount_dir=%s, flags=0x%x, op_err=%p", "container=%s, mount_dir=%s, flags=0x%x, op_err=%p",
container_file, mount_dir, flags, op_err); container_file, mount_dir, flags, op_err);

View File

@ -231,13 +231,13 @@ _gpgme_io_fd2str (char *buf, int buflen, int fd)
{ {
HANDLE hndl; HANDLE hndl;
TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_fd2str", fd, "fd=%d", fd); TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_fd2str", fd, "fd=%d", fd);
if (giochannel_table[fd].fd != -1) if (giochannel_table[fd].fd != -1)
hndl = (HANDLE) _get_osfhandle (giochannel_table[fd].fd); hndl = (HANDLE) _get_osfhandle (giochannel_table[fd].fd);
else else
hndl = (HANDLE) giochannel_table[fd].socket; hndl = (HANDLE) giochannel_table[fd].socket;
TRACE_SUC1 ("syshd=%p", hndl); TRACE_SUC ("syshd=%p", hndl);
return snprintf (buf, buflen, "%d", (int) hndl); return snprintf (buf, buflen, "%d", (int) hndl);
} }
@ -263,7 +263,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
gsize nread; gsize nread;
GIOChannel *chan; GIOChannel *chan;
GIOStatus status; GIOStatus status;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_read", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_read", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%u", buffer, count);
chan = find_channel (fd); chan = find_channel (fd);
@ -273,7 +273,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
errno = EINVAL; errno = EINVAL;
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
} }
TRACE_LOG1 ("channel %p", chan); TRACE_LOG ("channel %p", chan);
{ {
GError *err = NULL; GError *err = NULL;
@ -281,7 +281,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
count, &nread, &err); count, &nread, &err);
if (err) if (err)
{ {
TRACE_LOG2 ("status %i, err %s", status, err->message); TRACE_LOG ("status %i, err %s", status, err->message);
g_error_free (err); g_error_free (err);
} }
} }
@ -295,7 +295,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
} }
else if (status != G_IO_STATUS_NORMAL) else if (status != G_IO_STATUS_NORMAL)
{ {
TRACE_LOG1 ("status %d", status); TRACE_LOG ("status %d", status);
nread = -1; nread = -1;
saved_errno = EIO; saved_errno = EIO;
} }
@ -317,7 +317,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
GIOStatus status; GIOStatus status;
GError *err = NULL; GError *err = NULL;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_write", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%u", buffer, count);
TRACE_LOGBUFX (buffer, count); TRACE_LOGBUFX (buffer, count);
@ -333,7 +333,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
&nwritten, &err); &nwritten, &err);
if (err) if (err)
{ {
TRACE_LOG1 ("write error: %s", err->message); TRACE_LOG ("write error: %s", err->message);
g_error_free (err); g_error_free (err);
} }
@ -358,7 +358,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
{ {
int fds[2]; int fds[2];
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_pipe", filedes, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_pipe", filedes,
"inherit_idx=%i (GPGME uses it for %s)", "inherit_idx=%i (GPGME uses it for %s)",
inherit_idx, inherit_idx ? "reading" : "writing"); inherit_idx, inherit_idx ? "reading" : "writing");
@ -421,7 +421,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
} }
return TRACE_SUC5 ("read=0x%x/%p, write=0x%x/%p, channel=%p", return TRACE_SUC ("read=0x%x/%p, write=0x%x/%p, channel=%p",
filedes[0], filedes[0],
(HANDLE) _get_osfhandle (giochannel_table[filedes[0]].fd), (HANDLE) _get_osfhandle (giochannel_table[filedes[0]].fd),
filedes[1], filedes[1],
@ -433,7 +433,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
int int
_gpgme_io_close (int fd) _gpgme_io_close (int fd)
{ {
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd); TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd, "");
if (fd < 0 || fd >= MAX_SLAFD) if (fd < 0 || fd >= MAX_SLAFD)
{ {
@ -472,7 +472,7 @@ _gpgme_io_close (int fd)
giochannel_table[fd].chan = NULL; giochannel_table[fd].chan = NULL;
giochannel_table[fd].primary = 0; giochannel_table[fd].primary = 0;
TRACE_SUC (); TRACE_SUC ("");
return 0; return 0;
} }
@ -481,7 +481,7 @@ int
_gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler, _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler,
void *value) void *value)
{ {
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd,
"close_handler=%p/%p", handler, value); "close_handler=%p/%p", handler, value);
assert (fd != -1); assert (fd != -1);
@ -503,7 +503,7 @@ _gpgme_io_set_nonblocking (int fd)
GIOChannel *chan; GIOChannel *chan;
GIOStatus status; GIOStatus status;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd); TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd, "");
chan = find_channel (fd); chan = find_channel (fd);
if (!chan) if (!chan)
@ -524,7 +524,7 @@ _gpgme_io_set_nonblocking (int fd)
errno = EIO; errno = EIO;
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
#else #else
TRACE_LOG1 ("g_io_channel_set_flags failed: status=%d (ignored)", TRACE_LOG ("g_io_channel_set_flags failed: status=%d (ignored)",
status); status);
#endif #endif
} }
@ -613,12 +613,12 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags,
int tmp_fd; int tmp_fd;
char *tmp_name; char *tmp_name;
TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_spawn", path,
"path=%s", path); "path=%s", path);
i = 0; i = 0;
while (argv[i]) while (argv[i])
{ {
TRACE_LOG2 ("argv[%2i] = %s", i, argv[i]); TRACE_LOG ("argv[%2i] = %s", i, argv[i]);
i++; i++;
} }
@ -629,10 +629,10 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags,
which gets the information from a temporary file. */ which gets the information from a temporary file. */
if (_gpgme_mkstemp (&tmp_fd, &tmp_name) < 0) if (_gpgme_mkstemp (&tmp_fd, &tmp_name) < 0)
{ {
TRACE_LOG1 ("_gpgme_mkstemp failed: %s", strerror (errno)); TRACE_LOG ("_gpgme_mkstemp failed: %s", strerror (errno));
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
} }
TRACE_LOG1 ("tmp_name = %s", tmp_name); TRACE_LOG ("tmp_name = %s", tmp_name);
args = calloc (2 + i + 1, sizeof (*args)); args = calloc (2 + i + 1, sizeof (*args));
args[0] = (char *) _gpgme_get_w32spawn_path (); args[0] = (char *) _gpgme_get_w32spawn_path ();
@ -675,7 +675,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags,
&si, /* startup information */ &si, /* startup information */
&pi)) /* returns process information */ &pi)) /* returns process information */
{ {
TRACE_LOG1 ("CreateProcess failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("CreateProcess failed: ec=%d", (int) GetLastError ());
free (arg_string); free (arg_string);
close (tmp_fd); close (tmp_fd);
DeleteFile (tmp_name); DeleteFile (tmp_name);
@ -700,7 +700,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags,
_get_osfhandle (giochannel_table[fd_list[i].fd].fd), _get_osfhandle (giochannel_table[fd_list[i].fd].fd),
pi.hProcess, &hd, 0, TRUE, DUPLICATE_SAME_ACCESS)) pi.hProcess, &hd, 0, TRUE, DUPLICATE_SAME_ACCESS))
{ {
TRACE_LOG1 ("DuplicateHandle failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("DuplicateHandle failed: ec=%d", (int) GetLastError ());
TerminateProcess (pi.hProcess, 0); TerminateProcess (pi.hProcess, 0);
/* Just in case TerminateProcess didn't work, let the /* Just in case TerminateProcess didn't work, let the
process fail on its own. */ process fail on its own. */
@ -763,7 +763,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags,
/* The temporary file is deleted by the gpgme-w32spawn process /* The temporary file is deleted by the gpgme-w32spawn process
(hopefully). */ (hopefully). */
TRACE_LOG4 ("CreateProcess ready: hProcess=%p, hThread=%p, " TRACE_LOG ("CreateProcess ready: hProcess=%p, hThread=%p, "
"dwProcessID=%d, dwThreadId=%d", "dwProcessID=%d, dwThreadId=%d",
pi.hProcess, pi.hThread, pi.hProcess, pi.hThread,
(int) pi.dwProcessId, (int) pi.dwThreadId); (int) pi.dwProcessId, (int) pi.dwThreadId);
@ -772,17 +772,17 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags,
*r_pid = (pid_t)pi.dwProcessId; *r_pid = (pid_t)pi.dwProcessId;
if (ResumeThread (pi.hThread) < 0) if (ResumeThread (pi.hThread) < 0)
TRACE_LOG1 ("ResumeThread failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("ResumeThread failed: ec=%d", (int) GetLastError ());
if (!CloseHandle (pi.hThread)) if (!CloseHandle (pi.hThread))
TRACE_LOG1 ("CloseHandle of thread failed: ec=%d", TRACE_LOG ("CloseHandle of thread failed: ec=%d",
(int) GetLastError ()); (int) GetLastError ());
TRACE_LOG1 ("process=%p", pi.hProcess); TRACE_LOG ("process=%p", pi.hProcess);
/* We don't need to wait for the process. */ /* We don't need to wait for the process. */
if (!CloseHandle (pi.hProcess)) if (!CloseHandle (pi.hProcess))
TRACE_LOG1 ("CloseHandle of process failed: ec=%d", TRACE_LOG ("CloseHandle of process failed: ec=%d",
(int) GetLastError ()); (int) GetLastError ());
if (! (flags & IOSPAWN_FLAG_NOCLOSE)) if (! (flags & IOSPAWN_FLAG_NOCLOSE))
@ -793,10 +793,10 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags,
for (i = 0; fd_list[i].fd != -1; i++) for (i = 0; fd_list[i].fd != -1; i++)
if (fd_list[i].dup_to == -1) if (fd_list[i].dup_to == -1)
TRACE_LOG3 ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd, TRACE_LOG ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd,
fd_list[i].peer_name); fd_list[i].peer_name);
else else
TRACE_LOG4 ("fd[%i] = 0x%x -> 0x%x (std%s)", i, fd_list[i].fd, TRACE_LOG ("fd[%i] = 0x%x -> 0x%x (std%s)", i, fd_list[i].fd,
fd_list[i].peer_name, (fd_list[i].dup_to == 0) ? "in" : fd_list[i].peer_name, (fd_list[i].dup_to == 0) ? "in" :
((fd_list[i].dup_to == 1) ? "out" : "err")); ((fd_list[i].dup_to == 1) ? "out" : "err"));
@ -820,7 +820,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
/* Use a 1s timeout. */ /* Use a 1s timeout. */
int timeout = 1000; int timeout = 1000;
void *dbg_help = NULL; void *dbg_help = NULL;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_select", fds, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_select", fds,
"nfds=%u, nonblock=%u", nfds, nonblock); "nfds=%u, nonblock=%u", nfds, nonblock);
if (nonblock) if (nonblock)
@ -940,7 +940,7 @@ _gpgme_io_dup (int fd)
int newfd; int newfd;
GIOChannel *chan; GIOChannel *chan;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_dup", fd); TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_dup", fd, "");
if (fd < 0 || fd >= MAX_SLAFD || !giochannel_table[fd].used) if (fd < 0 || fd >= MAX_SLAFD || !giochannel_table[fd].used)
{ {
@ -997,7 +997,7 @@ _gpgme_io_socket (int domain, int type, int proto)
int res; int res;
int fd; int fd;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_socket", domain, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_socket", domain,
"type=%i, protp=%i", type, proto); "type=%i, protp=%i", type, proto);
res = socket (domain, type, proto); res = socket (domain, type, proto);
@ -1016,7 +1016,7 @@ _gpgme_io_socket (int domain, int type, int proto)
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
} }
TRACE_SUC2 ("fd=%i, socket=0x%x", fd, res); TRACE_SUC ("fd=%i, socket=0x%x", fd, res);
return fd; return fd;
} }
@ -1032,7 +1032,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen)
GIOStatus status; GIOStatus status;
GError *err = NULL; GError *err = NULL;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_connect", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_connect", fd,
"addr=%p, addrlen=%i", addr, addrlen); "addr=%p, addrlen=%i", addr, addrlen);
chan = find_channel (fd); chan = find_channel (fd);
@ -1048,7 +1048,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen)
status = g_io_channel_set_flags (chan, flags & ~G_IO_FLAG_NONBLOCK, &err); status = g_io_channel_set_flags (chan, flags & ~G_IO_FLAG_NONBLOCK, &err);
if (err) if (err)
{ {
TRACE_LOG1 ("setting flags error: %s", err->message); TRACE_LOG ("setting flags error: %s", err->message);
g_error_free (err); g_error_free (err);
err = NULL; err = NULL;
} }
@ -1066,7 +1066,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen)
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
} }
TRACE_LOG1 ("connect sockfd=0x%x", sockfd); TRACE_LOG ("connect sockfd=0x%x", sockfd);
res = connect (sockfd, addr, addrlen); res = connect (sockfd, addr, addrlen);
/* FIXME: Error ignored here. */ /* FIXME: Error ignored here. */
@ -1075,11 +1075,11 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen)
if (res) if (res)
{ {
TRACE_LOG2 ("connect failed: %i %i", res, WSAGetLastError ()); TRACE_LOG ("connect failed: %i %i", res, WSAGetLastError ());
errno = wsa2errno (WSAGetLastError ()); errno = wsa2errno (WSAGetLastError ());
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
} }
return TRACE_SUC (); return TRACE_SUC ("");
} }

View File

@ -168,7 +168,7 @@ _close_handle (HANDLE hd, int line)
{ {
if (!CloseHandle (hd)) if (!CloseHandle (hd))
{ {
TRACE2 (DEBUG_INIT, "w32-io", hd, "CloseHandle failed at line %d: ec=%d", TRACE (DEBUG_INIT, "w32-io", hd, "CloseHandle failed at line %d: ec=%d",
line, (int) GetLastError ()); line, (int) GetLastError ());
} }
} }
@ -184,7 +184,7 @@ _wait_for_single_object (HANDLE hd, DWORD msec, int line)
res = WaitForSingleObject (hd, msec); res = WaitForSingleObject (hd, msec);
if (res == WAIT_FAILED) if (res == WAIT_FAILED)
{ {
TRACE2 (DEBUG_INIT, "w32-io", hd, TRACE (DEBUG_INIT, "w32-io", hd,
"WFSO failed at line %d: ec=%d", line, (int) GetLastError ()); "WFSO failed at line %d: ec=%d", line, (int) GetLastError ());
} }
return res; return res;
@ -232,7 +232,7 @@ release_hddesc (hddesc_t hdd)
{ {
/* Holds a valid handle or was never initialized (in which case /* Holds a valid handle or was never initialized (in which case
* REFCOUNT would be -1 here). */ * REFCOUNT would be -1 here). */
TRACE_BEG3 (DEBUG_SYSIO, "gpgme:release_hddesc", hdd, TRACE_BEG (DEBUG_SYSIO, "gpgme:release_hddesc", hdd,
"hd=%p, sock=%d, refcount=%d", "hd=%p, sock=%d, refcount=%d",
hdd->hd, hdd->sock, hdd->refcount); hdd->hd, hdd->sock, hdd->refcount);
@ -241,15 +241,15 @@ release_hddesc (hddesc_t hdd)
if (hdd->sock != INVALID_SOCKET) if (hdd->sock != INVALID_SOCKET)
{ {
TRACE_LOG1 ("closing socket %d", hdd->sock); TRACE_LOG ("closing socket %d", hdd->sock);
if (closesocket (hdd->sock)) if (closesocket (hdd->sock))
{ {
TRACE_LOG1 ("closesocket failed: ec=%d", (int)WSAGetLastError ()); TRACE_LOG ("closesocket failed: ec=%d", (int)WSAGetLastError ());
} }
} }
free (hdd); free (hdd);
TRACE_SUC (); TRACE_SUC ("");
} }
UNLOCK (hddesc_lock); UNLOCK (hddesc_lock);
} }
@ -331,12 +331,12 @@ get_desired_thread_priority (void)
if (!_gpgme_get_conf_int ("IOThreadPriority", &value)) if (!_gpgme_get_conf_int ("IOThreadPriority", &value))
{ {
value = THREAD_PRIORITY_HIGHEST; value = THREAD_PRIORITY_HIGHEST;
TRACE1 (DEBUG_SYSIO, "gpgme:get_desired_thread_priority", 0, TRACE (DEBUG_SYSIO, "gpgme:get_desired_thread_priority", 0,
"%d (default)", value); "%d (default)", value);
} }
else else
{ {
TRACE1 (DEBUG_SYSIO, "gpgme:get_desired_thread_priority", 0, TRACE (DEBUG_SYSIO, "gpgme:get_desired_thread_priority", 0,
"%d (configured)", value); "%d (configured)", value);
} }
return value; return value;
@ -354,7 +354,7 @@ reader (void *arg)
DWORD nread; DWORD nread;
int sock; int sock;
TRACE_BEG4 (DEBUG_SYSIO, "gpgme:reader", ctx->hdd, TRACE_BEG (DEBUG_SYSIO, "gpgme:reader", ctx->hdd,
"hd=%p, sock=%d, thread=%p, refcount=%d", "hd=%p, sock=%d, thread=%p, refcount=%d",
ctx->hdd->hd, ctx->hdd->sock, ctx->thread_hd, ctx->refcount); ctx->hdd->hd, ctx->hdd->sock, ctx->thread_hd, ctx->refcount);
@ -373,10 +373,10 @@ reader (void *arg)
/* Wait for space. */ /* Wait for space. */
if (!ResetEvent (ctx->have_space_ev)) if (!ResetEvent (ctx->have_space_ev))
{ {
TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("ResetEvent failed: ec=%d", (int) GetLastError ());
} }
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
TRACE_LOG1 ("waiting for space (refcnt=%d)", ctx->refcount); TRACE_LOG ("waiting for space (refcnt=%d)", ctx->refcount);
wait_for_single_object (ctx->have_space_ev, INFINITE); wait_for_single_object (ctx->have_space_ev, INFINITE);
TRACE_LOG ("got space"); TRACE_LOG ("got space");
LOCK (ctx->mutex); LOCK (ctx->mutex);
@ -392,7 +392,7 @@ reader (void *arg)
nbytes = READBUF_SIZE - ctx->writepos; nbytes = READBUF_SIZE - ctx->writepos;
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
TRACE_LOG2 ("%s %d bytes", sock? "receiving":"reading", nbytes); TRACE_LOG ("%s %d bytes", sock? "receiving":"reading", nbytes);
if (sock) if (sock)
{ {
@ -425,7 +425,7 @@ reader (void *arg)
} }
ctx->error = 1; ctx->error = 1;
TRACE_LOG1 ("recv error: ec=%d", ctx->error_code); TRACE_LOG ("recv error: ec=%d", ctx->error_code);
} }
break; break;
} }
@ -450,7 +450,7 @@ reader (void *arg)
else else
{ {
ctx->error = 1; ctx->error = 1;
TRACE_LOG1 ("read error: ec=%d", ctx->error_code); TRACE_LOG ("read error: ec=%d", ctx->error_code);
} }
break; break;
} }
@ -469,12 +469,12 @@ reader (void *arg)
break; break;
} }
TRACE_LOG2 ("got %u bytes (refcnt=%d)", nread, ctx->refcount); TRACE_LOG ("got %u bytes (refcnt=%d)", nread, ctx->refcount);
ctx->writepos = (ctx->writepos + nread) % READBUF_SIZE; ctx->writepos = (ctx->writepos + nread) % READBUF_SIZE;
if (!SetEvent (ctx->have_data_ev)) if (!SetEvent (ctx->have_data_ev))
{ {
TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, TRACE_LOG ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev,
(int) GetLastError ()); (int) GetLastError ());
} }
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
@ -482,7 +482,7 @@ reader (void *arg)
/* Indicate that we have an error or EOF. */ /* Indicate that we have an error or EOF. */
if (!SetEvent (ctx->have_data_ev)) if (!SetEvent (ctx->have_data_ev))
{ {
TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, TRACE_LOG ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev,
(int) GetLastError ()); (int) GetLastError ());
} }
@ -497,7 +497,7 @@ reader (void *arg)
DESTROY_LOCK (ctx->mutex); DESTROY_LOCK (ctx->mutex);
free (ctx); free (ctx);
return TRACE_SUC (); return TRACE_SUC ("");
} }
@ -512,7 +512,7 @@ create_reader (hddesc_t hdd)
SECURITY_ATTRIBUTES sec_attr; SECURITY_ATTRIBUTES sec_attr;
DWORD tid; DWORD tid;
TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_reader", hdd, TRACE_BEG (DEBUG_SYSIO, "gpgme:create_reader", hdd,
"handle=%p sock=%d refhdd=%d", "handle=%p sock=%d refhdd=%d",
hdd->hd, hdd->sock, hdd->refcount); hdd->hd, hdd->sock, hdd->refcount);
@ -537,7 +537,7 @@ create_reader (hddesc_t hdd)
ctx->close_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL); ctx->close_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL);
if (!ctx->have_data_ev || !ctx->have_space_ev || !ctx->close_ev) if (!ctx->have_data_ev || !ctx->have_space_ev || !ctx->close_ev)
{ {
TRACE_LOG1 ("CreateEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("CreateEvent failed: ec=%d", (int) GetLastError ());
if (ctx->have_data_ev) if (ctx->have_data_ev)
close_handle (ctx->have_data_ev); close_handle (ctx->have_data_ev);
if (ctx->have_space_ev) if (ctx->have_space_ev)
@ -556,7 +556,7 @@ create_reader (hddesc_t hdd)
if (!ctx->thread_hd) if (!ctx->thread_hd)
{ {
TRACE_LOG1 ("CreateThread failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("CreateThread failed: ec=%d", (int) GetLastError ());
DESTROY_LOCK (ctx->mutex); DESTROY_LOCK (ctx->mutex);
if (ctx->have_data_ev) if (ctx->have_data_ev)
close_handle (ctx->have_data_ev); close_handle (ctx->have_data_ev);
@ -577,7 +577,7 @@ create_reader (hddesc_t hdd)
SetThreadPriority (ctx->thread_hd, get_desired_thread_priority ()); SetThreadPriority (ctx->thread_hd, get_desired_thread_priority ());
} }
TRACE_SUC (); TRACE_SUC ("");
return ctx; return ctx;
} }
@ -592,7 +592,7 @@ destroy_reader (struct reader_context_s *ctx)
ctx->refcount--; ctx->refcount--;
if (ctx->refcount != 0) if (ctx->refcount != 0)
{ {
TRACE2 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, TRACE (DEBUG_SYSIO, "gpgme:destroy_reader", ctx,
"hdd=%p refcount now %d", ctx->hdd, ctx->refcount); "hdd=%p refcount now %d", ctx->hdd, ctx->refcount);
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
return; return;
@ -600,7 +600,7 @@ destroy_reader (struct reader_context_s *ctx)
ctx->stop_me = 1; ctx->stop_me = 1;
if (ctx->have_space_ev) if (ctx->have_space_ev)
SetEvent (ctx->have_space_ev); SetEvent (ctx->have_space_ev);
TRACE1 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, TRACE (DEBUG_SYSIO, "gpgme:destroy_reader", ctx,
"hdd=%p close triggered", ctx->hdd); "hdd=%p close triggered", ctx->hdd);
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
@ -620,7 +620,7 @@ destroy_reader (struct reader_context_s *ctx)
else if (ctx->hdd && ctx->hdd->sock != INVALID_SOCKET) else if (ctx->hdd && ctx->hdd->sock != INVALID_SOCKET)
{ {
if (shutdown (ctx->hdd->sock, 2)) if (shutdown (ctx->hdd->sock, 2))
TRACE2 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, TRACE (DEBUG_SYSIO, "gpgme:destroy_reader", ctx,
"shutdown socket %d failed: %s", "shutdown socket %d failed: %s",
ctx->hdd->sock, (int) WSAGetLastError ()); ctx->hdd->sock, (int) WSAGetLastError ());
} }
@ -646,7 +646,7 @@ find_reader (int fd)
{ {
UNLOCK (fd_table_lock); UNLOCK (fd_table_lock);
gpg_err_set_errno (EBADF); gpg_err_set_errno (EBADF);
TRACE_SUC0 ("EBADF"); TRACE_SUC ("EBADF");
return NULL; return NULL;
} }
@ -654,12 +654,12 @@ find_reader (int fd)
if (rd) if (rd)
{ {
UNLOCK (fd_table_lock); UNLOCK (fd_table_lock);
TRACE_SUC1 ("rd=%p", rd); TRACE_SUC ("rd=%p", rd);
return rd; /* Return already initialized reader thread object. */ return rd; /* Return already initialized reader thread object. */
} }
/* Create a new reader thread. */ /* Create a new reader thread. */
TRACE_LOG3 ("fd=%d -> hdd=%p dupfrom=%d creating reader", TRACE_LOG ("fd=%d -> hdd=%p dupfrom=%d creating reader",
fd, fd_table[fd].hdd, fd_table[fd].dup_from); fd, fd_table[fd].hdd, fd_table[fd].dup_from);
rd = create_reader (fd_table[fd].hdd); rd = create_reader (fd_table[fd].hdd);
if (!rd) if (!rd)
@ -668,7 +668,7 @@ find_reader (int fd)
fd_table[fd].reader = rd; fd_table[fd].reader = rd;
UNLOCK (fd_table_lock); UNLOCK (fd_table_lock);
TRACE_SUC1 ("rd=%p (new)", rd); TRACE_SUC ("rd=%p (new)", rd);
return rd; return rd;
} }
@ -678,7 +678,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
{ {
int nread; int nread;
struct reader_context_s *ctx; struct reader_context_s *ctx;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_read", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_read", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%u", buffer, count);
ctx = find_reader (fd); ctx = find_reader (fd);
@ -692,9 +692,9 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
{ {
/* No data available. */ /* No data available. */
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
TRACE_LOG1 ("waiting for data from thread %p", ctx->thread_hd); TRACE_LOG ("waiting for data from thread %p", ctx->thread_hd);
wait_for_single_object (ctx->have_data_ev, INFINITE); wait_for_single_object (ctx->have_data_ev, INFINITE);
TRACE_LOG1 ("data from thread %p available", ctx->thread_hd); TRACE_LOG ("data from thread %p available", ctx->thread_hd);
LOCK (ctx->mutex); LOCK (ctx->mutex);
} }
@ -724,7 +724,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
{ {
if (!ResetEvent (ctx->have_data_ev)) if (!ResetEvent (ctx->have_data_ev))
{ {
TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("ResetEvent failed: ec=%d", (int) GetLastError ());
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
/* FIXME: Should translate the error code. */ /* FIXME: Should translate the error code. */
gpg_err_set_errno (EIO); gpg_err_set_errno (EIO);
@ -733,7 +733,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count)
} }
if (!SetEvent (ctx->have_space_ev)) if (!SetEvent (ctx->have_space_ev))
{ {
TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", TRACE_LOG ("SetEvent (0x%x) failed: ec=%d",
ctx->have_space_ev, (int) GetLastError ()); ctx->have_space_ev, (int) GetLastError ());
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
/* FIXME: Should translate the error code. */ /* FIXME: Should translate the error code. */
@ -756,7 +756,7 @@ writer (void *arg)
struct writer_context_s *ctx = arg; struct writer_context_s *ctx = arg;
DWORD nwritten; DWORD nwritten;
int sock; int sock;
TRACE_BEG4 (DEBUG_SYSIO, "gpgme:writer", ctx->hdd, TRACE_BEG (DEBUG_SYSIO, "gpgme:writer", ctx->hdd,
"hd=%p, sock=%d, thread=%p, refcount=%d", "hd=%p, sock=%d, thread=%p, refcount=%d",
ctx->hdd->hd, ctx->hdd->sock, ctx->thread_hd, ctx->refcount); ctx->hdd->hd, ctx->hdd->sock, ctx->thread_hd, ctx->refcount);
@ -776,9 +776,9 @@ writer (void *arg)
if (!ctx->nbytes) if (!ctx->nbytes)
{ {
if (!SetEvent (ctx->is_empty)) if (!SetEvent (ctx->is_empty))
TRACE_LOG1 ("SetEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("SetEvent failed: ec=%d", (int) GetLastError ());
if (!ResetEvent (ctx->have_data)) if (!ResetEvent (ctx->have_data))
TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("ResetEvent failed: ec=%d", (int) GetLastError ());
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
TRACE_LOG ("idle"); TRACE_LOG ("idle");
wait_for_single_object (ctx->have_data, INFINITE); wait_for_single_object (ctx->have_data, INFINITE);
@ -792,7 +792,7 @@ writer (void *arg)
} }
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
TRACE_LOG2 ("%s %d bytes", sock?"sending":"writing", ctx->nbytes); TRACE_LOG ("%s %d bytes", sock?"sending":"writing", ctx->nbytes);
/* Note that CTX->nbytes is not zero at this point, because /* Note that CTX->nbytes is not zero at this point, because
_gpgme_io_write always writes at least 1 byte before waking _gpgme_io_write always writes at least 1 byte before waking
@ -808,7 +808,7 @@ writer (void *arg)
{ {
ctx->error_code = (int) WSAGetLastError (); ctx->error_code = (int) WSAGetLastError ();
ctx->error = 1; ctx->error = 1;
TRACE_LOG1 ("send error: ec=%d", ctx->error_code); TRACE_LOG ("send error: ec=%d", ctx->error_code);
break; break;
} }
nwritten = n; nwritten = n;
@ -827,11 +827,11 @@ writer (void *arg)
ctx->error_code = (int) GetLastError (); ctx->error_code = (int) GetLastError ();
ctx->error = 1; ctx->error = 1;
TRACE_LOG1 ("write error: ec=%d", ctx->error_code); TRACE_LOG ("write error: ec=%d", ctx->error_code);
break; break;
} }
} }
TRACE_LOG1 ("wrote %d bytes", (int) nwritten); TRACE_LOG ("wrote %d bytes", (int) nwritten);
LOCK (ctx->mutex); LOCK (ctx->mutex);
ctx->nbytes -= nwritten; ctx->nbytes -= nwritten;
@ -839,13 +839,13 @@ writer (void *arg)
} }
/* Indicate that we have an error. */ /* Indicate that we have an error. */
if (!SetEvent (ctx->is_empty)) if (!SetEvent (ctx->is_empty))
TRACE_LOG1 ("SetEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("SetEvent failed: ec=%d", (int) GetLastError ());
TRACE_LOG ("waiting for close"); TRACE_LOG ("waiting for close");
wait_for_single_object (ctx->close_ev, INFINITE); wait_for_single_object (ctx->close_ev, INFINITE);
if (ctx->nbytes) if (ctx->nbytes)
TRACE_LOG1 ("still %d bytes in buffer at close time", ctx->nbytes); TRACE_LOG ("still %d bytes in buffer at close time", ctx->nbytes);
release_hddesc (ctx->hdd); release_hddesc (ctx->hdd);
close_handle (ctx->close_ev); close_handle (ctx->close_ev);
@ -855,7 +855,7 @@ writer (void *arg)
DESTROY_LOCK (ctx->mutex); DESTROY_LOCK (ctx->mutex);
free (ctx); free (ctx);
return TRACE_SUC (); return TRACE_SUC ("");
} }
@ -867,7 +867,7 @@ create_writer (hddesc_t hdd)
DWORD tid; DWORD tid;
TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd, TRACE_BEG (DEBUG_SYSIO, "gpgme:create_writer", hdd,
"handle=%p sock=%d refhdd=%d", "handle=%p sock=%d refhdd=%d",
hdd->hd, hdd->sock, hdd->refcount); hdd->hd, hdd->sock, hdd->refcount);
@ -892,7 +892,7 @@ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd,
ctx->close_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL); ctx->close_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL);
if (!ctx->have_data || !ctx->is_empty || !ctx->close_ev) if (!ctx->have_data || !ctx->is_empty || !ctx->close_ev)
{ {
TRACE_LOG1 ("CreateEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("CreateEvent failed: ec=%d", (int) GetLastError ());
if (ctx->have_data) if (ctx->have_data)
close_handle (ctx->have_data); close_handle (ctx->have_data);
if (ctx->is_empty) if (ctx->is_empty)
@ -910,7 +910,7 @@ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd,
ctx->thread_hd = CreateThread (&sec_attr, 0, writer, ctx, 0, &tid ); ctx->thread_hd = CreateThread (&sec_attr, 0, writer, ctx, 0, &tid );
if (!ctx->thread_hd) if (!ctx->thread_hd)
{ {
TRACE_LOG1 ("CreateThread failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("CreateThread failed: ec=%d", (int) GetLastError ());
DESTROY_LOCK (ctx->mutex); DESTROY_LOCK (ctx->mutex);
if (ctx->have_data) if (ctx->have_data)
close_handle (ctx->have_data); close_handle (ctx->have_data);
@ -931,7 +931,7 @@ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd,
SetThreadPriority (ctx->thread_hd, get_desired_thread_priority ()); SetThreadPriority (ctx->thread_hd, get_desired_thread_priority ());
} }
TRACE_SUC (); TRACE_SUC ("");
return ctx; return ctx;
} }
@ -943,7 +943,7 @@ destroy_writer (struct writer_context_s *ctx)
ctx->refcount--; ctx->refcount--;
if (ctx->refcount != 0) if (ctx->refcount != 0)
{ {
TRACE2 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx, TRACE (DEBUG_SYSIO, "gpgme:destroy_writer", ctx,
"hdd=%p refcount now %d", ctx->hdd, ctx->refcount); "hdd=%p refcount now %d", ctx->hdd, ctx->refcount);
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
return; return;
@ -951,7 +951,7 @@ destroy_writer (struct writer_context_s *ctx)
ctx->stop_me = 1; ctx->stop_me = 1;
if (ctx->have_data) if (ctx->have_data)
SetEvent (ctx->have_data); SetEvent (ctx->have_data);
TRACE1 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx, TRACE (DEBUG_SYSIO, "gpgme:destroy_writer", ctx,
"hdd=%p close triggered", ctx->hdd); "hdd=%p close triggered", ctx->hdd);
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
@ -978,7 +978,7 @@ find_writer (int fd)
{ {
UNLOCK (fd_table_lock); UNLOCK (fd_table_lock);
gpg_err_set_errno (EBADF); gpg_err_set_errno (EBADF);
TRACE_SUC0 ("EBADF"); TRACE_SUC ("EBADF");
return NULL; return NULL;
} }
@ -986,12 +986,12 @@ find_writer (int fd)
if (wt) if (wt)
{ {
UNLOCK (fd_table_lock); UNLOCK (fd_table_lock);
TRACE_SUC1 ("wt=%p", wt); TRACE_SUC ("wt=%p", wt);
return wt; /* Return already initialized writer thread object. */ return wt; /* Return already initialized writer thread object. */
} }
/* Create a new writer thread. */ /* Create a new writer thread. */
TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d creating writer", TRACE_LOG ("fd=%d -> handle=%p socket=%d dupfrom=%d creating writer",
fd, fd_table[fd].hdd->hd, fd_table[fd].hdd->sock, fd, fd_table[fd].hdd->hd, fd_table[fd].hdd->sock,
fd_table[fd].dup_from); fd_table[fd].dup_from);
wt = create_writer (fd_table[fd].hdd); wt = create_writer (fd_table[fd].hdd);
@ -1001,7 +1001,7 @@ find_writer (int fd)
fd_table[fd].writer = wt; fd_table[fd].writer = wt;
UNLOCK (fd_table_lock); UNLOCK (fd_table_lock);
TRACE_SUC1 ("wt=%p (new)", wt); TRACE_SUC ("wt=%p (new)", wt);
return wt; return wt;
} }
@ -1010,7 +1010,7 @@ int
_gpgme_io_write (int fd, const void *buffer, size_t count) _gpgme_io_write (int fd, const void *buffer, size_t count)
{ {
struct writer_context_s *ctx; struct writer_context_s *ctx;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_write", fd,
"buffer=%p, count=%u", buffer, count); "buffer=%p, count=%u", buffer, count);
TRACE_LOGBUFX (buffer, count); TRACE_LOGBUFX (buffer, count);
@ -1029,16 +1029,16 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
/* Reset the is_empty event. Better safe than sorry. */ /* Reset the is_empty event. Better safe than sorry. */
if (!ResetEvent (ctx->is_empty)) if (!ResetEvent (ctx->is_empty))
{ {
TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("ResetEvent failed: ec=%d", (int) GetLastError ());
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
/* FIXME: Should translate the error code. */ /* FIXME: Should translate the error code. */
gpg_err_set_errno (EIO); gpg_err_set_errno (EIO);
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
} }
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
TRACE_LOG1 ("waiting for empty buffer in thread %p", ctx->thread_hd); TRACE_LOG ("waiting for empty buffer in thread %p", ctx->thread_hd);
wait_for_single_object (ctx->is_empty, INFINITE); wait_for_single_object (ctx->is_empty, INFINITE);
TRACE_LOG1 ("thread %p buffer is empty", ctx->thread_hd); TRACE_LOG ("thread %p buffer is empty", ctx->thread_hd);
LOCK (ctx->mutex); LOCK (ctx->mutex);
} }
@ -1065,7 +1065,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
* used by the select() implementation to probe the channel. */ * used by the select() implementation to probe the channel. */
if (!ResetEvent (ctx->is_empty)) if (!ResetEvent (ctx->is_empty))
{ {
TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("ResetEvent failed: ec=%d", (int) GetLastError ());
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
/* FIXME: Should translate the error code. */ /* FIXME: Should translate the error code. */
gpg_err_set_errno (EIO); gpg_err_set_errno (EIO);
@ -1073,7 +1073,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count)
} }
if (!SetEvent (ctx->have_data)) if (!SetEvent (ctx->have_data))
{ {
TRACE_LOG1 ("SetEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("SetEvent failed: ec=%d", (int) GetLastError ());
UNLOCK (ctx->mutex); UNLOCK (ctx->mutex);
/* FIXME: Should translate the error code. */ /* FIXME: Should translate the error code. */
gpg_err_set_errno (EIO); gpg_err_set_errno (EIO);
@ -1096,7 +1096,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
hddesc_t whdesc; hddesc_t whdesc;
SECURITY_ATTRIBUTES sec_attr; SECURITY_ATTRIBUTES sec_attr;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_pipe", filedes, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_pipe", filedes,
"inherit_idx=%i (GPGME uses it for %s)", "inherit_idx=%i (GPGME uses it for %s)",
inherit_idx, inherit_idx ? "reading" : "writing"); inherit_idx, inherit_idx ? "reading" : "writing");
@ -1133,7 +1133,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
if (!CreatePipe (&rh, &wh, &sec_attr, PIPEBUF_SIZE)) if (!CreatePipe (&rh, &wh, &sec_attr, PIPEBUF_SIZE))
{ {
TRACE_LOG1 ("CreatePipe failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("CreatePipe failed: ec=%d", (int) GetLastError ());
release_fd (rfd); release_fd (rfd);
release_fd (wfd); release_fd (wfd);
release_hddesc (rhdesc); release_hddesc (rhdesc);
@ -1150,7 +1150,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
GetCurrentProcess(), &hd, 0, GetCurrentProcess(), &hd, 0,
TRUE, DUPLICATE_SAME_ACCESS)) TRUE, DUPLICATE_SAME_ACCESS))
{ {
TRACE_LOG1 ("DuplicateHandle failed: ec=%d", TRACE_LOG ("DuplicateHandle failed: ec=%d",
(int) GetLastError ()); (int) GetLastError ());
release_fd (rfd); release_fd (rfd);
release_fd (wfd); release_fd (wfd);
@ -1171,7 +1171,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
GetCurrentProcess(), &hd, 0, GetCurrentProcess(), &hd, 0,
TRUE, DUPLICATE_SAME_ACCESS)) TRUE, DUPLICATE_SAME_ACCESS))
{ {
TRACE_LOG1 ("DuplicateHandle failed: ec=%d", TRACE_LOG ("DuplicateHandle failed: ec=%d",
(int) GetLastError ()); (int) GetLastError ());
release_fd (rfd); release_fd (rfd);
release_fd (wfd); release_fd (wfd);
@ -1200,7 +1200,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
filedes[0] = rfd; filedes[0] = rfd;
filedes[1] = wfd; filedes[1] = wfd;
return TRACE_SUC6 ("read=0x%x (hdd=%p,hd=%p), write=0x%x (hdd=%p,hd=%p)", return TRACE_SUC ("read=0x%x (hdd=%p,hd=%p), write=0x%x (hdd=%p,hd=%p)",
rfd, fd_table[rfd].hdd, fd_table[rfd].hdd->hd, rfd, fd_table[rfd].hdd, fd_table[rfd].hdd->hd,
wfd, fd_table[wfd].hdd, fd_table[wfd].hdd->hd); wfd, fd_table[wfd].hdd, fd_table[wfd].hdd->hd);
} }
@ -1213,7 +1213,7 @@ _gpgme_io_close (int fd)
_gpgme_close_notify_handler_t handler = NULL; _gpgme_close_notify_handler_t handler = NULL;
void *value = NULL; void *value = NULL;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd); TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd, "");
if (fd < 0) if (fd < 0)
{ {
@ -1231,18 +1231,18 @@ _gpgme_io_close (int fd)
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
} }
TRACE_LOG2 ("hdd=%p dupfrom=%d", fd_table[fd].hdd, fd_table[fd].dup_from); TRACE_LOG ("hdd=%p dupfrom=%d", fd_table[fd].hdd, fd_table[fd].dup_from);
if (fd_table[fd].reader) if (fd_table[fd].reader)
{ {
TRACE_LOG1 ("destroying reader %p", fd_table[fd].reader); TRACE_LOG ("destroying reader %p", fd_table[fd].reader);
destroy_reader (fd_table[fd].reader); destroy_reader (fd_table[fd].reader);
fd_table[fd].reader = NULL; fd_table[fd].reader = NULL;
} }
if (fd_table[fd].writer) if (fd_table[fd].writer)
{ {
TRACE_LOG1 ("destroying writer %p", fd_table[fd].writer); TRACE_LOG ("destroying writer %p", fd_table[fd].writer);
destroy_writer (fd_table[fd].writer); destroy_writer (fd_table[fd].writer);
fd_table[fd].writer = NULL; fd_table[fd].writer = NULL;
} }
@ -1280,7 +1280,7 @@ int
_gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler, _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler,
void *value) void *value)
{ {
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd,
"close_handler=%p/%p", handler, value); "close_handler=%p/%p", handler, value);
LOCK (fd_table_lock); LOCK (fd_table_lock);
@ -1301,7 +1301,7 @@ _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler,
int int
_gpgme_io_set_nonblocking (int fd) _gpgme_io_set_nonblocking (int fd)
{ {
TRACE (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd); TRACE (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd, "");
return 0; return 0;
} }
@ -1387,7 +1387,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
char *tmp_name; char *tmp_name;
const char *spawnhelper; const char *spawnhelper;
TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_spawn", path,
"path=%s", path); "path=%s", path);
(void)atfork; (void)atfork;
@ -1396,7 +1396,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
i = 0; i = 0;
while (argv[i]) while (argv[i])
{ {
TRACE_LOG2 ("argv[%2i] = %s", i, argv[i]); TRACE_LOG ("argv[%2i] = %s", i, argv[i]);
i++; i++;
} }
@ -1407,10 +1407,10 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
which gets the information from a temporary file. */ which gets the information from a temporary file. */
if (_gpgme_mkstemp (&tmp_fd, &tmp_name) < 0) if (_gpgme_mkstemp (&tmp_fd, &tmp_name) < 0)
{ {
TRACE_LOG1 ("_gpgme_mkstemp failed: %s", strerror (errno)); TRACE_LOG ("_gpgme_mkstemp failed: %s", strerror (errno));
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
} }
TRACE_LOG1 ("tmp_name = %s", tmp_name); TRACE_LOG ("tmp_name = %s", tmp_name);
args = calloc (2 + i + 1, sizeof (*args)); args = calloc (2 + i + 1, sizeof (*args));
args[0] = (char *) _gpgme_get_w32spawn_path (); args[0] = (char *) _gpgme_get_w32spawn_path ();
@ -1485,7 +1485,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
&pi)) /* returns process information */ &pi)) /* returns process information */
{ {
int lasterr = (int)GetLastError (); int lasterr = (int)GetLastError ();
TRACE_LOG1 ("CreateProcess failed: ec=%d", lasterr); TRACE_LOG ("CreateProcess failed: ec=%d", lasterr);
free (arg_string); free (arg_string);
close (tmp_fd); close (tmp_fd);
DeleteFileA (tmp_name); DeleteFileA (tmp_name);
@ -1515,7 +1515,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
if (!DuplicateHandle (GetCurrentProcess(), ohd, if (!DuplicateHandle (GetCurrentProcess(), ohd,
pi.hProcess, &hd, 0, TRUE, DUPLICATE_SAME_ACCESS)) pi.hProcess, &hd, 0, TRUE, DUPLICATE_SAME_ACCESS))
{ {
TRACE_LOG1 ("DuplicateHandle failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("DuplicateHandle failed: ec=%d", (int) GetLastError ());
TerminateProcess (pi.hProcess, 0); TerminateProcess (pi.hProcess, 0);
/* Just in case TerminateProcess didn't work, let the /* Just in case TerminateProcess didn't work, let the
process fail on its own. */ process fail on its own. */
@ -1585,7 +1585,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
UNLOCK (fd_table_lock); UNLOCK (fd_table_lock);
TRACE_LOG4 ("CreateProcess ready: hProcess=%p, hThread=%p, " TRACE_LOG ("CreateProcess ready: hProcess=%p, hThread=%p, "
"dwProcessID=%d, dwThreadId=%d", "dwProcessID=%d, dwThreadId=%d",
pi.hProcess, pi.hThread, pi.hProcess, pi.hThread,
(int) pi.dwProcessId, (int) pi.dwThreadId); (int) pi.dwProcessId, (int) pi.dwThreadId);
@ -1595,11 +1595,11 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
if (ResumeThread (pi.hThread) == (DWORD)(-1)) if (ResumeThread (pi.hThread) == (DWORD)(-1))
TRACE_LOG1 ("ResumeThread failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("ResumeThread failed: ec=%d", (int) GetLastError ());
close_handle (pi.hThread); close_handle (pi.hThread);
TRACE_LOG1 ("process=%p", pi.hProcess); TRACE_LOG ("process=%p", pi.hProcess);
/* We don't need to wait for the process. */ /* We don't need to wait for the process. */
close_handle (pi.hProcess); close_handle (pi.hProcess);
@ -1612,10 +1612,10 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
for (i = 0; fd_list[i].fd != -1; i++) for (i = 0; fd_list[i].fd != -1; i++)
if (fd_list[i].dup_to == -1) if (fd_list[i].dup_to == -1)
TRACE_LOG3 ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd, TRACE_LOG ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd,
fd_list[i].peer_name); fd_list[i].peer_name);
else else
TRACE_LOG4 ("fd[%i] = 0x%x -> 0x%x (std%s)", i, fd_list[i].fd, TRACE_LOG ("fd[%i] = 0x%x -> 0x%x (std%s)", i, fd_list[i].fd,
fd_list[i].peer_name, (fd_list[i].dup_to == 0) ? "in" : fd_list[i].peer_name, (fd_list[i].dup_to == 0) ? "in" :
((fd_list[i].dup_to == 1) ? "out" : "err")); ((fd_list[i].dup_to == 1) ? "out" : "err"));
@ -1636,7 +1636,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
int any; int any;
int count; int count;
void *dbg_help; void *dbg_help;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_select", fds, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_select", fds,
"nfds=%u, nonblock=%u", nfds, nonblock); "nfds=%u, nonblock=%u", nfds, nonblock);
#if 0 #if 0
@ -1660,7 +1660,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
struct reader_context_s *ctx = find_reader (fds[i].fd); struct reader_context_s *ctx = find_reader (fds[i].fd);
if (!ctx) if (!ctx)
TRACE_LOG1 ("error: no reader for FD 0x%x (ignored)", TRACE_LOG ("error: no reader for FD 0x%x (ignored)",
fds[i].fd); fds[i].fd);
else else
{ {
@ -1683,7 +1683,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
struct writer_context_s *ctx = find_writer (fds[i].fd); struct writer_context_s *ctx = find_writer (fds[i].fd);
if (!ctx) if (!ctx)
TRACE_LOG1 ("error: no writer for FD 0x%x (ignored)", TRACE_LOG ("error: no writer for FD 0x%x (ignored)",
fds[i].fd); fds[i].fd);
else else
{ {
@ -1745,7 +1745,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
int k; int k;
int j = handle_to_fd (waitbuf[i]); int j = handle_to_fd (waitbuf[i]);
TRACE_LOG1 ("WFMO invalid handle %d removed", j); TRACE_LOG ("WFMO invalid handle %d removed", j);
for (k = 0 ; k < nfds; k++) for (k = 0 ; k < nfds; k++)
{ {
if (fds[k].fd == j) if (fds[k].fd == j)
@ -1757,12 +1757,12 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock)
TRACE_LOG (" oops, or not???"); TRACE_LOG (" oops, or not???");
} }
#endif #endif
TRACE_LOG1 ("WFMO failed: %d", le); TRACE_LOG ("WFMO failed: %d", le);
count = -1; count = -1;
} }
else else
{ {
TRACE_LOG1 ("WFMO returned %d", code); TRACE_LOG ("WFMO returned %d", code);
count = -1; count = -1;
} }
@ -1817,7 +1817,7 @@ _gpgme_io_dup (int fd)
struct writer_context_s *wt_ctx; struct writer_context_s *wt_ctx;
int want_reader, want_writer; int want_reader, want_writer;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_dup", fd); TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_dup", fd, "");
LOCK (fd_table_lock); LOCK (fd_table_lock);
if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used) if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used)
@ -1912,7 +1912,7 @@ _gpgme_io_socket (int domain, int type, int proto)
int fd; int fd;
hddesc_t hdd; hddesc_t hdd;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_socket", domain, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_socket", domain,
"type=%i, protp=%i", type, proto); "type=%i, protp=%i", type, proto);
fd = new_fd(); fd = new_fd();
@ -1939,7 +1939,7 @@ _gpgme_io_socket (int domain, int type, int proto)
fd_table[fd].want_reader = 1; fd_table[fd].want_reader = 1;
fd_table[fd].want_writer = 1; fd_table[fd].want_writer = 1;
TRACE_SUC3 ("hdd=%p, socket=0x%x (0x%x)", hdd, fd, hdd->sock); TRACE_SUC ("hdd=%p, socket=0x%x (0x%x)", hdd, fd, hdd->sock);
return fd; return fd;
} }
@ -1951,7 +1951,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen)
int res; int res;
int sock; int sock;
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_connect", fd, TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_connect", fd,
"addr=%p, addrlen=%i", addr, addrlen); "addr=%p, addrlen=%i", addr, addrlen);
LOCK (fd_table_lock); LOCK (fd_table_lock);
@ -1971,5 +1971,5 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen)
return TRACE_SYSRES (-1); return TRACE_SYSRES (-1);
} }
return TRACE_SUC (); return TRACE_SUC ("");
} }

View File

@ -220,19 +220,19 @@ _gpgme_allow_set_foreground_window (pid_t pid)
if (!pid || pid == (pid_t)(-1)) if (!pid || pid == (pid_t)(-1))
{ {
TRACE1 (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, TRACE (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0,
"no action for pid %d", (int)pid); "no action for pid %d", (int)pid);
} }
else if (func) else if (func)
{ {
int rc = func (pid); int rc = func (pid);
TRACE2 (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, TRACE (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0,
"called for pid %d; result=%d", (int)pid, rc); "called for pid %d; result=%d", (int)pid, rc);
} }
else else
{ {
TRACE0 (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, TRACE (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0,
"function not available"); "function not available");
} }
#endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */ #endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */
@ -268,13 +268,13 @@ _gpgme_w32_cancel_synchronous_io (HANDLE thread)
{ {
if (!func (thread) && GetLastError() != ERROR_NOT_FOUND) if (!func (thread) && GetLastError() != ERROR_NOT_FOUND)
{ {
TRACE2 (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0, TRACE (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0,
"called for thread %p: ec=%d", thread, GetLastError ()); "called for thread %p: ec=%d", thread, GetLastError ());
} }
} }
else else
{ {
TRACE0 (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0, TRACE (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0,
"function not available"); "function not available");
} }
} }

View File

@ -136,7 +136,7 @@ _gpgme_add_io_cb (void *data, int fd, int dir, gpgme_io_cb_t fnc,
return err; return err;
} }
TRACE3 (DEBUG_CTX, "_gpgme_add_io_cb", ctx, TRACE (DEBUG_CTX, "_gpgme_add_io_cb", ctx,
"fd %d, dir=%d -> tag=%p", fd, dir, tag); "fd %d, dir=%d -> tag=%p", fd, dir, tag);
*r_tag = tag; *r_tag = tag;
@ -159,7 +159,7 @@ _gpgme_remove_io_cb (void *data)
assert (fdt); assert (fdt);
idx = tag->idx; idx = tag->idx;
TRACE2 (DEBUG_CTX, "_gpgme_remove_io_cb", data, TRACE (DEBUG_CTX, "_gpgme_remove_io_cb", data,
"setting fd 0x%x (item=%p) done", fdt->fds[idx].fd, "setting fd 0x%x (item=%p) done", fdt->fds[idx].fd,
fdt->fds[idx].opaque); fdt->fds[idx].opaque);
@ -196,7 +196,7 @@ _gpgme_run_io_cb (struct io_select_fd_s *an_fds, int checked,
int nr; int nr;
struct io_select_fd_s fds; struct io_select_fd_s fds;
TRACE0 (DEBUG_CTX, "_gpgme_run_io_cb", item, "need to check"); TRACE (DEBUG_CTX, "_gpgme_run_io_cb", item, "need to check");
fds = *an_fds; fds = *an_fds;
fds.signaled = 0; fds.signaled = 0;
/* Just give it a quick poll. */ /* Just give it a quick poll. */
@ -210,7 +210,7 @@ _gpgme_run_io_cb (struct io_select_fd_s *an_fds, int checked,
return 0; return 0;
} }
TRACE2 (DEBUG_CTX, "_gpgme_run_io_cb", item, "handler (%p, %d)", TRACE (DEBUG_CTX, "_gpgme_run_io_cb", item, "handler (%p, %d)",
item->handler_value, an_fds->fd); item->handler_value, an_fds->fd);
iocb_data.handler_value = item->handler_value; iocb_data.handler_value = item->handler_value;