From 139e798c8782b09460052a453142addf1174d878 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 25 Sep 2012 15:29:49 +0200 Subject: [PATCH] Remove all trailing whitespace from source files -- Command used: sed -i 's,[ \t]*$,,' FILE --- lang/Makefile.am | 8 +-- src/assuan-support.c | 2 +- src/ath-pthread.c | 8 +-- src/ath.c | 8 +-- src/ath.h | 6 +- src/context.h | 6 +- src/data-compat.c | 8 +-- src/data-fd.c | 8 +-- src/data-mem.c | 14 ++-- src/data-stream.c | 8 +-- src/data-user.c | 8 +-- src/data.c | 6 +- src/data.h | 8 +-- src/debug.c | 14 ++-- src/debug.h | 8 +-- src/decrypt-verify.c | 12 ++-- src/decrypt.c | 4 +- src/delete.c | 14 ++-- src/dirinfo.c | 16 ++--- src/edit.c | 22 +++--- src/encrypt-sign.c | 18 ++--- src/encrypt.c | 14 ++-- src/engine-assuan.c | 10 +-- src/engine-backend.h | 10 +-- src/engine-g13.c | 24 +++---- src/engine-gpg.c | 80 +++++++++++----------- src/engine-gpgsm.c | 58 ++++++++-------- src/engine.c | 14 ++-- src/engine.h | 14 ++-- src/error.c | 10 +-- src/export.c | 18 ++--- src/funopen.c | 4 +- src/genkey.c | 10 +-- src/get-env.c | 6 +- src/getauditlog.c | 10 +-- src/gpgconf.c | 6 +- src/gpgme-tool.c | 152 +++++++++++++++++++++--------------------- src/gpgme-w32spawn.c | 32 ++++----- src/gpgme.c | 14 ++-- src/import.c | 14 ++-- src/key.c | 40 +++++------ src/keylist.c | 38 +++++------ src/op-support.c | 8 +-- src/opassuan.c | 12 ++-- src/ops.h | 8 +-- src/passphrase.c | 10 +-- src/passwd.c | 12 ++-- src/posix-io.c | 26 ++++---- src/posix-sema.c | 8 +-- src/posix-util.c | 8 +-- src/priv-io.h | 6 +- src/progress.c | 10 +-- src/putc_unlocked.c | 4 +- src/sema.h | 8 +-- src/sig-notation.c | 8 +-- src/sign.c | 8 +-- src/signers.c | 10 +-- src/trust-item.c | 14 ++-- src/trustlist.c | 10 +-- src/vasprintf.c | 6 +- src/version.c | 16 ++--- src/vfs-create.c | 18 ++--- src/vfs-mount.c | 12 ++-- src/w32-ce.c | 22 +++--- src/w32-ce.h | 10 +-- src/w32-glib-io.c | 60 ++++++++--------- src/w32-io.c | 122 ++++++++++++++++----------------- src/w32-sema.c | 10 +-- src/w32-util.c | 28 ++++---- src/wait-global.c | 16 ++--- src/wait-private.c | 16 ++--- src/wait-user.c | 10 +-- src/wait.c | 12 ++-- src/wait.h | 10 +-- tests/run-export.c | 18 ++--- tests/run-import.c | 18 ++--- tests/run-keylist.c | 20 +++--- tests/run-sign.c | 22 +++--- tests/run-support.h | 10 +-- tests/run-verify.c | 22 +++--- tests/t-data.c | 6 +- tests/t-engine-info.c | 8 +-- tests/t-version.c | 6 +- 83 files changed, 726 insertions(+), 726 deletions(-) diff --git a/lang/Makefile.am b/lang/Makefile.am index 3b079920..854d9348 100644 --- a/lang/Makefile.am +++ b/lang/Makefile.am @@ -1,18 +1,18 @@ # Makefile.am for gpgme/lang. # Copyright (C) 2003, 2006 g10 Code GmbH -# +# # This file is part of GPGME. -# +# # GPGME is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. -# +# # GPGME is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General # Public License for more details. -# +# # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA diff --git a/src/assuan-support.c b/src/assuan-support.c index 52643467..6ff0679d 100644 --- a/src/assuan-support.c +++ b/src/assuan-support.c @@ -200,7 +200,7 @@ my_waitpid (assuan_context_t ctx, pid_t pid, NOWAIT in POSIX systems just means the caller already did the waitpid for this child. */ if (! nowait) - return _gpgme_ath_waitpid (pid, status, options); + return _gpgme_ath_waitpid (pid, status, options); #endif return 0; } diff --git a/src/ath-pthread.c b/src/ath-pthread.c index 9684afb2..dfbdac2a 100644 --- a/src/ath-pthread.c +++ b/src/ath-pthread.c @@ -2,17 +2,17 @@ Copyright (C) 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -151,7 +151,7 @@ ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, return select (nfd, rset, wset, eset, timeout); } - + ssize_t ath_waitpid (pid_t pid, int *status, int options) { diff --git a/src/ath.c b/src/ath.c index ab65f7eb..52cee458 100644 --- a/src/ath.c +++ b/src/ath.c @@ -2,17 +2,17 @@ Copyright (C) 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -158,7 +158,7 @@ ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, #endif } - + ssize_t ath_waitpid (pid_t pid, int *status, int options) { diff --git a/src/ath.h b/src/ath.h index 9ada5502..eecf8d10 100644 --- a/src/ath.h +++ b/src/ath.h @@ -2,17 +2,17 @@ Copyright (C) 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/context.h b/src/context.h index 69d8d9bd..d984324b 100644 --- a/src/context.h +++ b/src/context.h @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2010 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ diff --git a/src/data-compat.c b/src/data-compat.c index 39c743ef..b3b88672 100644 --- a/src/data-compat.c +++ b/src/data-compat.c @@ -1,18 +1,18 @@ /* data-compat.c - Compatibility interfaces for data objects. Copyright (C) 2002, 2003, 2004, 2007 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/data-fd.c b/src/data-fd.c index 388b45cc..4b75e942 100644 --- a/src/data-fd.c +++ b/src/data-fd.c @@ -1,18 +1,18 @@ /* data-fd.c - A file descripor based data object. Copyright (C) 2002, 2004 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/data-mem.c b/src/data-mem.c index 512c295e..634f8a53 100644 --- a/src/data-mem.c +++ b/src/data-mem.c @@ -1,18 +1,18 @@ /* data-mem.c - A memory based data object. Copyright (C) 2002, 2003, 2004, 2007 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -72,7 +72,7 @@ mem_write (gpgme_data_t dh, const void *buffer, size_t size) return -1; memcpy (new_buffer, dh->data.mem.orig_buffer, dh->data.mem.length); - dh->data.mem.buffer = new_buffer; + dh->data.mem.buffer = new_buffer; dh->data.mem.size = new_size; } @@ -124,7 +124,7 @@ mem_seek (gpgme_data_t dh, off_t offset, int whence) break; case SEEK_CUR: if ((offset > 0 && dh->data.mem.length - dh->data.mem.offset < offset) - || (offset < 0 && dh->data.mem.offset < -offset)) + || (offset < 0 && dh->data.mem.offset < -offset)) { gpg_err_set_errno (EINVAL); return -1; @@ -211,7 +211,7 @@ gpgme_data_new_from_mem (gpgme_data_t *r_dh, const char *buffer, } else (*r_dh)->data.mem.orig_buffer = buffer; - + (*r_dh)->data.mem.size = size; (*r_dh)->data.mem.length = size; return TRACE_SUC1 ("dh=%p", *r_dh); diff --git a/src/data-stream.c b/src/data-stream.c index 0e840655..a9bb815b 100644 --- a/src/data-stream.c +++ b/src/data-stream.c @@ -1,18 +1,18 @@ /* data-stream.c - A stream based data object. Copyright (C) 2002, 2004 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/data-user.c b/src/data-user.c index 65065e7a..52046148 100644 --- a/src/data-user.c +++ b/src/data-user.c @@ -1,18 +1,18 @@ /* data-user.c - A user callback based data object. Copyright (C) 2002, 2004 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/data.c b/src/data.c index 0a629106..0657081c 100644 --- a/src/data.c +++ b/src/data.c @@ -2,17 +2,17 @@ Copyright (C) 2002, 2003, 2004, 2005, 2007 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/data.h b/src/data.h index 1257a8d8..5076619b 100644 --- a/src/data.h +++ b/src/data.h @@ -1,18 +1,18 @@ /* data.h - Internal data object abstraction interface. Copyright (C) 2002, 2004, 2005 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/debug.c b/src/debug.c index 34c5d18f..8e293b4e 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1,22 +1,22 @@ /* debug.c - helpful output in desperate situations Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2009 g10 Code GmbH - + This file is part of GPGME. GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H @@ -205,7 +205,7 @@ _gpgme_debug (int level, const char *format, ...) saved_errno = errno; if (debug_level < level) return; - + va_start (arg_ptr, format); LOCK (debug_lock); { @@ -220,7 +220,7 @@ _gpgme_debug (int level, const char *format, ...) #else 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, @@ -342,7 +342,7 @@ _gpgme_debug_buffer (int lvl, const char *const fmt, char str[51]; char *strp = str; char *strp2 = &str[34]; - + for (j = 0; j < 16; j++) { unsigned char val; diff --git a/src/debug.h b/src/debug.h index cbfccca0..7bd9ed78 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1,18 +1,18 @@ /* debug.h - interface to debugging functions Copyright (C) 2002, 2004, 2005, 2007 g10 Code GmbH - + This file is part of GPGME. GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -245,7 +245,7 @@ void _gpgme_debug_frame_end (void); #define TRACE_SEQ(hlp,fmt) \ _gpgme_debug_begin (&(hlp), _gpgme_trace_level, \ "%s: check: %s=%p, " fmt, _gpgme_trace_func, \ - _gpgme_trace_tagname, _gpgme_trace_tag) + _gpgme_trace_tagname, _gpgme_trace_tag) #define TRACE_ADD0(hlp,fmt) \ _gpgme_debug_add (&(hlp), fmt) #define TRACE_ADD1(hlp,fmt,a) \ diff --git a/src/decrypt-verify.c b/src/decrypt-verify.c index a5a751b3..a334f86f 100644 --- a/src/decrypt-verify.c +++ b/src/decrypt-verify.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -76,7 +76,7 @@ decrypt_verify_start (gpgme_ctx_t ctx, int synchronous, _gpgme_engine_set_status_handler (ctx->engine, decrypt_verify_status_handler, ctx); - + return _gpgme_engine_op_decrypt_verify (ctx->engine, cipher, plain); } @@ -94,7 +94,7 @@ gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, gpgme_data_t cipher, if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + err = decrypt_verify_start (ctx, 0, cipher, plain); return TRACE_ERR (err); } @@ -113,7 +113,7 @@ gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher, if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + err = decrypt_verify_start (ctx, 1, cipher, plain); if (!err) err = _gpgme_wait_one (ctx); diff --git a/src/decrypt.c b/src/decrypt.c index 43945ec3..f4f95dc9 100644 --- a/src/decrypt.c +++ b/src/decrypt.c @@ -377,7 +377,7 @@ gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher, if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + err = decrypt_start (ctx, 0, cipher, plain); return TRACE_ERR (err); } @@ -395,7 +395,7 @@ gpgme_op_decrypt (gpgme_ctx_t ctx, gpgme_data_t cipher, gpgme_data_t plain) if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + err = decrypt_start (ctx, 1, cipher, plain); if (!err) err = _gpgme_wait_one (ctx); diff --git a/src/delete.c b/src/delete.c index 1a501d8e..283b3e60 100644 --- a/src/delete.c +++ b/src/delete.c @@ -2,17 +2,17 @@ Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -98,12 +98,12 @@ gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key, TRACE_BEG3 (DEBUG_CTX, "gpgme_op_delete", ctx, "key=%p (%s), allow_secret=%i", key, - (key->subkeys && key->subkeys->fpr) ? + (key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", allow_secret); if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + err = delete_start (ctx, 0, key, allow_secret); return TRACE_ERR (err); } @@ -118,12 +118,12 @@ gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key, int allow_secret) TRACE_BEG3 (DEBUG_CTX, "gpgme_op_delete", ctx, "key=%p (%s), allow_secret=%i", key, - (key->subkeys && key->subkeys->fpr) ? + (key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", allow_secret); if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + err = delete_start (ctx, 1, key, allow_secret); if (!err) err = _gpgme_wait_one (ctx); diff --git a/src/dirinfo.c b/src/dirinfo.c index b1e438e2..267e9888 100644 --- a/src/dirinfo.c +++ b/src/dirinfo.c @@ -7,12 +7,12 @@ * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. - * + * * GPGME is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, see . */ @@ -33,7 +33,7 @@ DEFINE_STATIC_LOCK (dirinfo_lock); /* Constants used internally to select the data. */ -enum +enum { WANT_HOMEDIR, WANT_AGENT_SOCKET @@ -65,7 +65,7 @@ parse_output (char *line) return; if (!*value) return; - + if (!strcmp (line, "homedir") && !dirinfo.homedir) dirinfo.homedir = strdup (value); else if (!strcmp (line, "agent-socket") && !dirinfo.agent_socket) @@ -76,7 +76,7 @@ parse_output (char *line) /* Read the directory information from gpgconf. This function expects that DIRINFO_LOCK is held by the caller. */ static void -read_gpgconf_dirs (void) +read_gpgconf_dirs (void) { const char *pgmname; char linebuf[1024] = {0}; @@ -112,8 +112,8 @@ read_gpgconf_dirs (void) do { - nread = _gpgme_io_read (rp[0], - linebuf + linelen, + nread = _gpgme_io_read (rp[0], + linebuf + linelen, sizeof linebuf - linelen - 1); if (nread > 0) { @@ -141,7 +141,7 @@ read_gpgconf_dirs (void) } } while (nread > 0 && linelen < sizeof linebuf - 1); - + _gpgme_io_close (rp[0]); } diff --git a/src/edit.c b/src/edit.c index 4abf24fa..1f73078d 100644 --- a/src/edit.c +++ b/src/edit.c @@ -2,17 +2,17 @@ Copyright (C) 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -143,12 +143,12 @@ gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, TRACE_BEG5 (DEBUG_CTX, "gpgme_op_edit_start", ctx, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, - (key->subkeys && key->subkeys->fpr) ? + (key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", fnc, fnc_value, out); if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + err = edit_start (ctx, 0, 0, key, fnc, fnc_value, out); return err; } @@ -164,12 +164,12 @@ gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key, TRACE_BEG5 (DEBUG_CTX, "gpgme_op_edit", ctx, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, - (key->subkeys && key->subkeys->fpr) ? + (key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", fnc, fnc_value, out); if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + err = edit_start (ctx, 1, 0, key, fnc, fnc_value, out); if (!err) @@ -187,12 +187,12 @@ gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, TRACE_BEG5 (DEBUG_CTX, "gpgme_op_card_edit_start", ctx, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, - (key->subkeys && key->subkeys->fpr) ? + (key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", fnc, fnc_value, out); if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + err = edit_start (ctx, 0, 1, key, fnc, fnc_value, out); return err; } @@ -208,12 +208,12 @@ gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key, TRACE_BEG5 (DEBUG_CTX, "gpgme_op_card_edit", ctx, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, - (key->subkeys && key->subkeys->fpr) ? + (key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", fnc, fnc_value, out); if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + err = edit_start (ctx, 1, 1, key, fnc, fnc_value, out); if (!err) err = _gpgme_wait_one (ctx); diff --git a/src/encrypt-sign.c b/src/encrypt-sign.c index 78286004..cb0ea619 100644 --- a/src/encrypt-sign.c +++ b/src/encrypt-sign.c @@ -1,19 +1,19 @@ /* encrypt-sign.c - encrypt and verify functions Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -80,7 +80,7 @@ encrypt_sign_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t recp[], _gpgme_engine_set_status_handler (ctx->engine, encrypt_sign_status_handler, ctx); - + return _gpgme_engine_op_encrypt_sign (ctx->engine, recp, flags, plain, cipher, ctx->use_armor, ctx /* FIXME */); @@ -102,7 +102,7 @@ gpgme_op_encrypt_sign_start (gpgme_ctx_t ctx, gpgme_key_t recp[], if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + if (_gpgme_debug_trace () && recp) { int i = 0; @@ -110,7 +110,7 @@ gpgme_op_encrypt_sign_start (gpgme_ctx_t ctx, gpgme_key_t recp[], while (recp[i]) { TRACE_LOG3 ("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"); i++; } @@ -136,7 +136,7 @@ gpgme_op_encrypt_sign (gpgme_ctx_t ctx, gpgme_key_t recp[], if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + if (_gpgme_debug_trace () && recp) { int i = 0; @@ -144,7 +144,7 @@ gpgme_op_encrypt_sign (gpgme_ctx_t ctx, gpgme_key_t recp[], while (recp[i]) { TRACE_LOG3 ("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"); i++; } diff --git a/src/encrypt.c b/src/encrypt.c index 641e9004..792c25c5 100644 --- a/src/encrypt.c +++ b/src/encrypt.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -92,7 +92,7 @@ gpgme_op_encrypt_result (gpgme_ctx_t ctx) i++; } } - + TRACE_SUC1 ("result=%p", &opd->result); return &opd->result; } @@ -234,7 +234,7 @@ gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[], if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + if (_gpgme_debug_trace () && recp) { int i = 0; @@ -242,7 +242,7 @@ gpgme_op_encrypt_start (gpgme_ctx_t ctx, gpgme_key_t recp[], while (recp[i]) { TRACE_LOG3 ("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"); i++; } @@ -275,7 +275,7 @@ gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[], while (recp[i]) { TRACE_LOG3 ("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"); i++; } diff --git a/src/engine-assuan.c b/src/engine-assuan.c index dedb8a12..0963f4af 100644 --- a/src/engine-assuan.c +++ b/src/engine-assuan.c @@ -210,7 +210,7 @@ llass_release (void *engine) /* Create a new instance. If HOME_DIR is NULL standard options for use - with gpg-agent are issued. */ + with gpg-agent are issued. */ static gpgme_error_t llass_new (void **engine, const char *file_name, const char *home_dir) { @@ -234,7 +234,7 @@ llass_new (void **engine, const char *file_name, const char *home_dir) /* Very simple parser only working for the one option we support. */ /* Note that wk promised to write a regression test if this parser will be extended. */ - if (!strncmp (home_dir, "GPG_AGENT", 9) + if (!strncmp (home_dir, "GPG_AGENT", 9) && (!home_dir[9] || home_dir[9] == ' ')) llass->opt.gpg_agent = 1; } @@ -312,7 +312,7 @@ llass_new (void **engine, const char *file_name, const char *home_dir) goto leave; } free (dft_ttytype); - + err = assuan_transact (llass->assuan_ctx, optstr, NULL, NULL, NULL, NULL, NULL, NULL); free (optstr); @@ -463,7 +463,7 @@ llass_status_handler (void *opaque, int fd) err = 0; continue; } - + TRACE2 (DEBUG_CTX, "gpgme:llass_status_handler", llass, "fd 0x%x: error reading assuan line: %s", fd, gpg_strerror (err)); @@ -561,7 +561,7 @@ llass_status_handler (void *opaque, int fd) args++; err = inquire_cb (llass, src, args); - if (!err) + if (!err) { /* Flush and send END. */ err = assuan_send_data (llass->assuan_ctx, NULL, 0); diff --git a/src/engine-backend.h b/src/engine-backend.h index e540acb9..1adac92b 100644 --- a/src/engine-backend.h +++ b/src/engine-backend.h @@ -1,18 +1,18 @@ /* engine-backend.h - A crypto backend for the engine interface. Copyright (C) 2002, 2003, 2004, 2009 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -98,7 +98,7 @@ struct engine_ops gpgme_data_t signed_text, gpgme_data_t plaintext); gpgme_error_t (*getauditlog) (void *engine, gpgme_data_t output, unsigned int flags); - gpgme_error_t (*opassuan_transact) (void *engine, + gpgme_error_t (*opassuan_transact) (void *engine, const char *command, gpgme_assuan_data_cb_t data_cb, void *data_cb_value, diff --git a/src/engine-g13.c b/src/engine-g13.c index 6ba49c42..9850d6b4 100644 --- a/src/engine-g13.c +++ b/src/engine-g13.c @@ -1,19 +1,19 @@ /* engine-g13.c - G13 engine. Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2009 g10 Code GmbH - + This file is part of GPGME. GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -91,7 +91,7 @@ struct engine_g13 typedef struct engine_g13 *engine_g13_t; -static void g13_io_event (void *engine, +static void g13_io_event (void *engine, gpgme_event_io_t type, void *type_data); @@ -386,7 +386,7 @@ g13_set_locale (void *engine, int category, const char *value) return gpg_error (GPG_ERR_INV_VALUE); /* FIXME: Reset value to default. */ - if (!value) + if (!value) return 0; if (asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0) @@ -487,7 +487,7 @@ status_handler (void *opaque, int fd) TRACE2 (DEBUG_CTX, "gpgme:status_handler", g13, "fd 0x%x: ERR line: %s", fd, err ? gpg_strerror (err) : "ok"); - + /* Command execution errors are not fatal, as we use a session based protocol. */ data->op_err = err; @@ -557,7 +557,7 @@ status_handler (void *opaque, int fd) src = line + 2; while (*src == ' ') src++; - + args = strchr (line + 2, ' '); if (!args) args = line + linelen; /* set to an empty string */ @@ -581,12 +581,12 @@ status_handler (void *opaque, int fd) else if (linelen >= 7 && line[0] == 'I' && line[1] == 'N' && line[2] == 'Q' && line[3] == 'U' && line[4] == 'I' && line[5] == 'R' - && line[6] == 'E' + && line[6] == 'E' && (line[7] == '\0' || line[7] == ' ')) { char *src; char *args; - + for (src=line+7; *src == ' '; src++) ; @@ -600,7 +600,7 @@ status_handler (void *opaque, int fd) args++; err = default_inq_cb (g13, src, args); - if (!err) + if (!err) { /* Flush and send END. */ err = assuan_send_data (g13->assuan_ctx, NULL, 0); @@ -614,10 +614,10 @@ status_handler (void *opaque, int fd) } } while (!err && assuan_pending_line (g13->assuan_ctx)); - + return err; } - + static gpgme_error_t add_io_cb (engine_g13_t g13, iocb_data_t *iocbd, gpgme_io_cb_t handler) diff --git a/src/engine-gpg.c b/src/engine-gpg.c index cbb456ec..7cf8894a 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -2,19 +2,19 @@ Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2012 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -87,7 +87,7 @@ struct engine_gpg struct { - int fd[2]; + int fd[2]; int arg_loc; size_t bufsize; char *buffer; @@ -101,7 +101,7 @@ struct engine_gpg /* This is a kludge - see the comment at colon_line_handler. */ struct { - int fd[2]; + int fd[2]; int arg_loc; size_t bufsize; char *buffer; @@ -113,7 +113,7 @@ struct engine_gpg colon_preprocessor_t preprocess_fnc; } colon; - char **argv; + char **argv; struct fd_data_map_s *fd_data_map; /* stuff needed for interactive (command) mode */ @@ -125,7 +125,7 @@ struct engine_gpg int idx; /* Index in fd_data_map */ gpgme_status_code_t code; /* last code */ char *keyword; /* what has been requested (malloced) */ - engine_command_handler_t fnc; + engine_command_handler_t fnc; void *fnc_value; /* The kludges never end. This is used to couple command handlers with output data in edit key mode. */ @@ -537,7 +537,7 @@ gpg_new (void **engine, const char *file_name, const char *home_dir) rc = _gpgme_getenv ("TERM", &dft_ttytype); if (rc) goto leave; - + if (dft_ttytype) { rc = add_arg (gpg, "--ttytype"); @@ -632,7 +632,7 @@ gpg_set_colon_line_handler (void *engine, engine_colon_line_handler_t fnc, if (!gpg->colon.buffer) return gpg_error_from_errno (errno); - if (_gpgme_io_pipe (gpg->colon.fd, 1) == -1) + if (_gpgme_io_pipe (gpg->colon.fd, 1) == -1) { int saved_errno = errno; free (gpg->colon.buffer); @@ -722,7 +722,7 @@ build_argv (engine_gpg_t gpg) gpgme_error_t err; struct arg_and_data_s *a; struct fd_data_map_s *fd_data_map; - size_t datac=0, argc=0; + size_t datac=0, argc=0; char **argv; int need_special = 0; int use_agent = 0; @@ -850,9 +850,9 @@ build_argv (engine_gpg_t gpg) fd_data_map[datac].inbound = a->inbound; /* Create a pipe. */ - { + { int fds[2]; - + if (_gpgme_io_pipe (fds, fd_data_map[datac].inbound ? 1 : 0) == -1) { @@ -976,13 +976,13 @@ read_status (engine_gpg_t gpg) { char *p; int nread; - size_t bufsize = gpg->status.bufsize; + size_t bufsize = gpg->status.bufsize; char *buffer = gpg->status.buffer; - size_t readpos = gpg->status.readpos; + size_t readpos = gpg->status.readpos; assert (buffer); if (bufsize - readpos < 256) - { + { /* Need more room for the read. */ bufsize += 1024; buffer = realloc (buffer, bufsize); @@ -1029,7 +1029,7 @@ read_status (engine_gpg_t gpg) rest = p; /* Set to an empty string. */ else *rest++ = 0; - + r = _gpgme_parse_status (buffer + 9); if (r >= 0) { @@ -1060,12 +1060,12 @@ read_status (engine_gpg_t gpg) else if (gpg->status.fnc) { gpgme_error_t err; - err = gpg->status.fnc (gpg->status.fnc_value, + err = gpg->status.fnc (gpg->status.fnc_value, r, rest); if (err) return err; } - + if (r == GPGME_STATUS_END_STREAM) { if (gpg->cmd.used) @@ -1120,7 +1120,7 @@ read_status (engine_gpg_t gpg) else readpos++; } - } + } /* Update the gpg object. */ gpg->status.bufsize = bufsize; @@ -1152,17 +1152,17 @@ read_colon_line (engine_gpg_t gpg) { char *p; int nread; - size_t bufsize = gpg->colon.bufsize; + size_t bufsize = gpg->colon.bufsize; char *buffer = gpg->colon.buffer; - size_t readpos = gpg->colon.readpos; + size_t readpos = gpg->colon.readpos; assert (buffer); if (bufsize - readpos < 256) - { + { /* Need more room for the read. */ bufsize += 1024; buffer = realloc (buffer, bufsize); - if (!buffer) + if (!buffer) return gpg_error_from_errno (errno); } @@ -1208,7 +1208,7 @@ read_colon_line (engine_gpg_t gpg) if (line) free (line); } - + /* To reuse the buffer for the next line we have to shift the remaining data to the buffer start and restart the loop Hmmm: We can optimize this function @@ -1224,7 +1224,7 @@ read_colon_line (engine_gpg_t gpg) else readpos++; } - } + } /* Update the gpg object. */ gpg->colon.bufsize = bufsize; @@ -1295,7 +1295,7 @@ start (engine_gpg_t gpg) /* status_fd, colon_fd and end of list. */ n = 3; - for (i = 0; gpg->fd_data_map[i].data; i++) + for (i = 0; gpg->fd_data_map[i].data; i++) n++; fd_list = calloc (n, sizeof *fd_list); if (! fd_list) @@ -1309,7 +1309,7 @@ start (engine_gpg_t gpg) n++; if (gpg->colon.fnc) { - fd_list[n].fd = gpg->colon.fd[1]; + fd_list[n].fd = gpg->colon.fd[1]; fd_list[n].dup_to = 1; n++; } @@ -1367,7 +1367,7 @@ start (engine_gpg_t gpg) ? _gpgme_data_inbound_handler : _gpgme_data_outbound_handler, gpg->fd_data_map[i].data, &gpg->fd_data_map[i].tag); - + if (rc) /* FIXME: kill the child */ return rc; @@ -1375,7 +1375,7 @@ start (engine_gpg_t gpg) } gpg_io_event (gpg, GPGME_EVENT_START, NULL); - + /* fixme: check what data we can release here */ return 0; } @@ -1605,7 +1605,7 @@ append_args_from_recipients (engine_gpg_t gpg, gpgme_key_t recp[]) if (err) break; i++; - } + } return err; } @@ -1832,7 +1832,7 @@ gpg_genkey (void *engine, gpgme_data_t help_data, int use_armor, Note that we use a delimiter and thus a trailing delimiter is not required. DELIM may not be changed after the first call. */ static const char * -string_from_data (gpgme_data_t data, int delim, +string_from_data (gpgme_data_t data, int delim, void **helpptr, gpgme_error_t *r_err) { #define MYBUFLEN 2000 /* Fixme: We don't support URLs longer than that. */ @@ -1900,7 +1900,7 @@ string_from_data (gpgme_data_t data, int delim, return NULL; } - nread = gpgme_data_read (data, self->buf + self->buflen, + nread = gpgme_data_read (data, self->buf + self->buflen, MYBUFLEN - self->buflen); if (nread < 0) { @@ -2034,7 +2034,7 @@ gpg_keylist_preprocess (char *line, char **r_line) rectype = RT_PUB; else if (!strcmp (field[0], "uid")) rectype = RT_UID; - else + else rectype = RT_NONE; switch (rectype) @@ -2052,7 +2052,7 @@ gpg_keylist_preprocess (char *line, char **r_line) pub:::::: as defined in 5.2. Machine Readable Indexes of the OpenPGP - HTTP Keyserver Protocol (draft). + HTTP Keyserver Protocol (draft). We want: pub:o::::::::::::: @@ -2070,7 +2070,7 @@ gpg_keylist_preprocess (char *line, char **r_line) uid:::: as defined in 5.2. Machine Readable Indexes of the OpenPGP - HTTP Keyserver Protocol (draft). + HTTP Keyserver Protocol (draft). We want: uid:o::::::::: @@ -2181,10 +2181,10 @@ gpg_keylist_build_options (engine_gpg_t gpg, int secret_only, } if (!err) err = add_arg (gpg, "--"); - + return err; } - + static gpgme_error_t gpg_keylist (void *engine, const char *pattern, int secret_only, @@ -2287,7 +2287,7 @@ gpg_trustlist (void *engine, const char *pattern) err = add_arg (gpg, "--with-colons"); if (!err) err = add_arg (gpg, "--list-trust-path"); - + /* Tell the gpg object about the data. */ if (!err) err = add_arg (gpg, "--"); @@ -2353,7 +2353,7 @@ struct engine_ops _gpgme_engine_ops_gpg = { /* Static functions. */ _gpgme_get_gpg_path, - NULL, + NULL, gpg_get_version, gpg_get_req_version, gpg_new, diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index 0620458a..42bf8798 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -2,19 +2,19 @@ Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010 g10 Code GmbH - + This file is part of GPGME. GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -101,7 +101,7 @@ struct engine_gpgsm int linelen; } attic; int any; /* any data line seen */ - } colon; + } colon; gpgme_data_t inline_data; /* Used to collect D lines. */ @@ -111,7 +111,7 @@ struct engine_gpgsm typedef struct engine_gpgsm *engine_gpgsm_t; -static void gpgsm_io_event (void *engine, +static void gpgsm_io_event (void *engine, gpgme_event_io_t type, void *type_data); @@ -542,7 +542,7 @@ gpgsm_set_locale (void *engine, int category, const char *value) return gpg_error (GPG_ERR_INV_VALUE); /* FIXME: Reset value to default. */ - if (!value) + if (!value) return 0; if (asprintf (&optstr, "OPTION %s=%s", catstr, value) < 0) @@ -705,10 +705,10 @@ gpgsm_set_fd (engine_gpgsm_t gpgsm, fd_type_t fd_type, const char *opt) snprintf (line, COMMANDLINELEN, "%s FD", which); #else if (opt) - snprintf (line, COMMANDLINELEN, "%s FD=%s %s", + snprintf (line, COMMANDLINELEN, "%s FD=%s %s", which, iocb_data->server_fd_str, opt); else - snprintf (line, COMMANDLINELEN, "%s FD=%s", + snprintf (line, COMMANDLINELEN, "%s FD=%s", which, iocb_data->server_fd_str); #endif @@ -793,7 +793,7 @@ status_handler (void *opaque, int fd) if (gpgsm->status.fnc) err = gpgsm->status.fnc (gpgsm->status.fnc_value, GPGME_STATUS_EOF, ""); - + if (!err && gpgsm->colon.fnc && gpgsm->colon.any) { /* We must tell a colon function about the EOF. We do @@ -856,12 +856,12 @@ status_handler (void *opaque, int fd) *dst = *src++; (*alinelen)++; } - + if (*dst == '\n') { /* Terminate the pending line, pass it to the colon handler and reset it. */ - + gpgsm->colon.any = 1; if (*alinelen > 1 && *(dst - 1) == '\r') dst--; @@ -904,10 +904,10 @@ status_handler (void *opaque, int fd) } else *dst++ = *src++; - + linelen++; } - + src = line + 2; while (linelen > 0) { @@ -931,7 +931,7 @@ status_handler (void *opaque, int fd) { char *rest; gpgme_status_code_t r; - + rest = strchr (line + 2, ' '); if (!rest) rest = line + linelen; /* set to an empty string */ @@ -954,7 +954,7 @@ status_handler (void *opaque, int fd) else if (linelen >= 7 && line[0] == 'I' && line[1] == 'N' && line[2] == 'Q' && line[3] == 'U' && line[4] == 'I' && line[5] == 'R' - && line[6] == 'E' + && line[6] == 'E' && (line[7] == '\0' || line[7] == ' ')) { char *keyword = line+7; @@ -967,7 +967,7 @@ status_handler (void *opaque, int fd) } while (!err && assuan_pending_line (gpgsm->assuan_ctx)); - + return err; } @@ -1272,7 +1272,7 @@ gpgsm_export (void *engine, const char *pattern, gpgme_export_mode_t mode, if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); - + if (mode) return gpg_error (GPG_ERR_NOT_SUPPORTED); @@ -1446,8 +1446,8 @@ gpgsm_import (void *engine, gpgme_data_t keydata, gpgme_key_t *keyarray) /* Fist check whether the engine already features the --re-import option. */ - err = gpgsm_assuan_simple_command - (gpgsm->assuan_ctx, + err = gpgsm_assuan_simple_command + (gpgsm->assuan_ctx, "GETINFO cmd_has_option IMPORT re-import", NULL, NULL); if (err) return gpg_error (GPG_ERR_NOT_SUPPORTED); @@ -1460,7 +1460,7 @@ gpgsm_import (void *engine, gpgme_data_t keydata, gpgme_key_t *keyarray) { if (keyarray[idx]->protocol == GPGME_PROTOCOL_CMS && keyarray[idx]->subkeys - && keyarray[idx]->subkeys->fpr + && keyarray[idx]->subkeys->fpr && *keyarray[idx]->subkeys->fpr) buflen += strlen (keyarray[idx]->subkeys->fpr) + 1; } @@ -1473,11 +1473,11 @@ gpgsm_import (void *engine, gpgme_data_t keydata, gpgme_key_t *keyarray) { if (keyarray[idx]->protocol == GPGME_PROTOCOL_CMS && keyarray[idx]->subkeys - && keyarray[idx]->subkeys->fpr + && keyarray[idx]->subkeys->fpr && *keyarray[idx]->subkeys->fpr) p = stpcpy (stpcpy (p, keyarray[idx]->subkeys->fpr), "\n"); } - + err = gpgme_data_new_from_mem (&gpgsm->input_helper_data, buffer, buflen, 0); if (err) @@ -1566,14 +1566,14 @@ gpgsm_keylist (void *engine, const char *pattern, int secret_only, /* Use the validation mode if requested. We don't check for an error yet because this is a pretty fresh gpgsm features. */ - gpgsm_assuan_simple_command (gpgsm->assuan_ctx, + gpgsm_assuan_simple_command (gpgsm->assuan_ctx, (mode & GPGME_KEYLIST_MODE_VALIDATE)? "OPTION with-validation=1": "OPTION with-validation=0" , NULL, NULL); /* Include the ephemeral keys if requested. We don't check for an error yet because this is a pretty fresh gpgsm features. */ - gpgsm_assuan_simple_command (gpgsm->assuan_ctx, + gpgsm_assuan_simple_command (gpgsm->assuan_ctx, (mode & GPGME_KEYLIST_MODE_EPHEMERAL)? "OPTION with-ephemeral-keys=1": "OPTION with-ephemeral-keys=0" , @@ -1638,7 +1638,7 @@ gpgsm_keylist_ext (void *engine, const char *pattern[], int secret_only, /* Always send key validation because RESET does not reset it. */ /* Use the validation mode if required. We don't check for an error yet because this is a pretty fresh gpgsm features. */ - gpgsm_assuan_simple_command (gpgsm->assuan_ctx, + gpgsm_assuan_simple_command (gpgsm->assuan_ctx, (mode & GPGME_KEYLIST_MODE_VALIDATE)? "OPTION with-validation=1": "OPTION with-validation=0" , @@ -1775,7 +1775,7 @@ gpgsm_sign (void *engine, gpgme_data_t in, gpgme_data_t out, else err = gpg_error (GPG_ERR_INV_VALUE); gpgme_key_unref (key); - if (err) + if (err) return err; } @@ -1872,7 +1872,7 @@ gpgsm_getauditlog (void *engine, gpgme_data_t output, unsigned int flags) static void gpgsm_set_status_handler (void *engine, engine_status_handler_t fnc, - void *fnc_value) + void *fnc_value) { engine_gpgsm_t gpgsm = engine; @@ -1883,7 +1883,7 @@ gpgsm_set_status_handler (void *engine, engine_status_handler_t fnc, static gpgme_error_t gpgsm_set_colon_line_handler (void *engine, engine_colon_line_handler_t fnc, - void *fnc_value) + void *fnc_value) { engine_gpgsm_t gpgsm = engine; @@ -1927,7 +1927,7 @@ gpgsm_passwd (void *engine, gpgme_key_t key, unsigned int flags) if (asprintf (&line, "PASSWD -- %s", key->subkeys->fpr) < 0) return gpg_error_from_syserror (); - + gpgsm_clear_fd (gpgsm, OUTPUT_FD); gpgsm_clear_fd (gpgsm, INPUT_FD); gpgsm_clear_fd (gpgsm, MESSAGE_FD); diff --git a/src/engine.c b/src/engine.c index 1244dd3a..17d8d870 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1,19 +1,19 @@ /* engine.c - GPGME engine support. Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2006, 2009, 2010 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -568,7 +568,7 @@ _gpgme_engine_set_protocol (engine_t engine, gpgme_protocol_t protocol) return (*engine->ops->set_protocol) (engine->engine, protocol); } - + gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph, @@ -810,7 +810,7 @@ _gpgme_engine_op_getauditlog (engine_t engine, gpgme_data_t output, gpgme_error_t -_gpgme_engine_op_assuan_transact (engine_t engine, +_gpgme_engine_op_assuan_transact (engine_t engine, const char *command, gpgme_assuan_data_cb_t data_cb, void *data_cb_value, @@ -825,7 +825,7 @@ _gpgme_engine_op_assuan_transact (engine_t engine, if (!engine->ops->opassuan_transact) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); - return (*engine->ops->opassuan_transact) (engine->engine, + return (*engine->ops->opassuan_transact) (engine->engine, command, data_cb, data_cb_value, inq_cb, inq_cb_value, diff --git a/src/engine.h b/src/engine.h index dfc73acc..e8683076 100644 --- a/src/engine.h +++ b/src/engine.h @@ -1,19 +1,19 @@ /* engine.h - GPGME engine interface. Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2010 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -23,7 +23,7 @@ #define ENGINE_H #include "gpgme.h" - + struct engine; typedef struct engine *engine_t; @@ -133,8 +133,8 @@ gpgme_error_t _gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig, gpgme_error_t _gpgme_engine_op_getauditlog (engine_t engine, gpgme_data_t output, unsigned int flags); -gpgme_error_t _gpgme_engine_op_assuan_transact - (engine_t engine, +gpgme_error_t _gpgme_engine_op_assuan_transact + (engine_t engine, const char *command, gpgme_assuan_data_cb_t data_cb, void *data_cb_value, diff --git a/src/error.c b/src/error.c index 5f82efd1..a84b8673 100644 --- a/src/error.c +++ b/src/error.c @@ -2,17 +2,17 @@ Copyright (C) 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -55,7 +55,7 @@ gpgme_strsource (gpgme_error_t err) return gpg_strsource (err); } - + /* Retrieve the error code for the system error ERR. This returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report this). */ @@ -93,7 +93,7 @@ gpgme_err_set_errno (int err) gpg_err_set_errno (err); } - + /* Return an error value with the error source SOURCE and the system error ERR. */ gpgme_error_t diff --git a/src/export.c b/src/export.c index 9c1c79c0..81a23b04 100644 --- a/src/export.c +++ b/src/export.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004, 2010 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -48,7 +48,7 @@ export_start (gpgme_ctx_t ctx, int synchronous, const char *pattern, |GPGME_EXPORT_MODE_MINIMAL))) return gpg_error (GPG_ERR_INV_VALUE); /* Invalid flags in MODE. */ - + if ((mode & GPGME_EXPORT_MODE_EXTERN)) { if (keydata) @@ -221,7 +221,7 @@ export_keys_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t keys[], nkeys++; if (!nkeys) return gpg_error (GPG_ERR_NO_DATA); - + pattern = calloc (nkeys+1, sizeof *pattern); if (!pattern) return gpg_error_from_syserror (); @@ -272,7 +272,7 @@ gpgme_op_export_keys_start (gpgme_ctx_t ctx, if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + if (_gpgme_debug_trace () && keys) { int i = 0; @@ -280,7 +280,7 @@ gpgme_op_export_keys_start (gpgme_ctx_t ctx, while (keys[i]) { TRACE_LOG3 ("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"); i++; } @@ -303,7 +303,7 @@ gpgme_op_export_keys (gpgme_ctx_t ctx, if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + if (_gpgme_debug_trace () && keys) { int i = 0; @@ -311,7 +311,7 @@ gpgme_op_export_keys (gpgme_ctx_t ctx, while (keys[i]) { TRACE_LOG3 ("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"); i++; } diff --git a/src/funopen.c b/src/funopen.c index a20dd8a1..b71d3aed 100644 --- a/src/funopen.c +++ b/src/funopen.c @@ -7,12 +7,12 @@ under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/genkey.c b/src/genkey.c index bfc7c2af..13765d44 100644 --- a/src/genkey.c +++ b/src/genkey.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -46,7 +46,7 @@ static void release_op_data (void *hook) { op_data_t opd = (op_data_t) hook; - + if (opd->result.fpr) free (opd->result.fpr); if (opd->key_parameter) @@ -173,7 +173,7 @@ genkey_start (gpgme_ctx_t ctx, int synchronous, const char *parms, err = _gpgme_op_reset (ctx, synchronous); if (err) return err; - + err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, &hook, sizeof (*opd), release_op_data); opd = hook; diff --git a/src/get-env.c b/src/get-env.c index bea8949c..bcd45942 100644 --- a/src/get-env.c +++ b/src/get-env.c @@ -2,17 +2,17 @@ Copyright (C) 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/getauditlog.c b/src/getauditlog.c index d8435ac5..3bb41387 100644 --- a/src/getauditlog.c +++ b/src/getauditlog.c @@ -3,17 +3,17 @@ Copyright (C) 2007 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -48,7 +48,7 @@ getauditlog_start (gpgme_ctx_t ctx, int synchronous, if (err) return err; - _gpgme_engine_set_status_handler (ctx->engine, + _gpgme_engine_set_status_handler (ctx->engine, getauditlog_status_handler, ctx); return _gpgme_engine_op_getauditlog (ctx->engine, output, flags); @@ -61,7 +61,7 @@ getauditlog_start (gpgme_ctx_t ctx, int synchronous, available GPG_ERR_NO_DATA is returned. This is the asynchronous variant. */ gpgme_error_t -gpgme_op_getauditlog_start (gpgme_ctx_t ctx, +gpgme_op_getauditlog_start (gpgme_ctx_t ctx, gpgme_data_t output, unsigned int flags) { gpg_error_t err; diff --git a/src/gpgconf.c b/src/gpgconf.c index f3411d51..cbfd3dd4 100644 --- a/src/gpgconf.c +++ b/src/gpgconf.c @@ -2,17 +2,17 @@ Copyright (C) 2007 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index 9591d155..75b7c9e1 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -2,17 +2,17 @@ Copyright (C) 2009, 2010 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -40,10 +40,10 @@ #include "gpgme.h" /* GCC attributes. */ -#if __GNUC__ >= 4 +#if __GNUC__ >= 4 # define GT_GCC_A_SENTINEL(a) __attribute__ ((sentinel(a))) #else -# define GT_GCC_A_SENTINEL(a) +# define GT_GCC_A_SENTINEL(a) #endif #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 ) @@ -158,9 +158,9 @@ struct argp | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR) -void argp_error (const struct argp_state *state, +void argp_error (const struct argp_state *state, const char *fmt, ...) GT_GCC_A_PRINTF(2, 3); - + char * @@ -374,10 +374,10 @@ argp_parse (const struct argp *argp, int argc, *arg = '\0'; arg++; } - + if (state.argv[idx][1] != '-') key = state.argv[idx][1]; - + while (! found && opt->key) { if (key == opt->key @@ -453,7 +453,7 @@ argp_parse (const struct argp *argp, int argc, rc = argp->parser (ARGP_KEY_FINI, NULL, &state); if (rc && rc != ARGP_ERR_UNKNOWN) goto argperror; - + rc = 0; argp->parser (ARGP_KEY_SUCCESS, NULL, &state); @@ -481,7 +481,7 @@ char *program_name = "gpgme-tool"; #define spacep(p) (*(p) == ' ' || *(p) == '\t') -void log_error (int status, gpg_error_t errnum, +void log_error (int status, gpg_error_t errnum, const char *fmt, ...) GT_GCC_A_PRINTF(3,4); @@ -518,7 +518,7 @@ strcpy_escaped_plus (char *d, const char *s) while (*s) { if (*s == '%' && s[1] && s[2]) - { + { s++; *d++ = xtoi_2 (s); s += 2; @@ -528,7 +528,7 @@ strcpy_escaped_plus (char *d, const char *s) else *d++ = *s++; } - *d = 0; + *d = 0; } @@ -630,7 +630,7 @@ result_xml_tag_start (struct result_xml_state *state, char *name, ...) state->had_data[state->next_tag] = 0; state->indent += 2; state->next_tag++; - + while (1) { attr = va_arg (ap, char *); @@ -704,7 +704,7 @@ result_xml_tag_end (struct result_xml_state *state) gpg_error_t result_add_error (struct result_xml_state *state, char *name, gpg_error_t err) -{ +{ char code[20]; char msg[1024]; snprintf (code, sizeof (code) - 1, "0x%x", err); @@ -720,7 +720,7 @@ result_add_error (struct result_xml_state *state, char *name, gpg_error_t err) gpg_error_t result_add_pubkey_algo (struct result_xml_state *state, char *name, gpgme_pubkey_algo_t algo) -{ +{ char code[20]; char msg[80]; snprintf (code, sizeof (code) - 1, "0x%x", algo); @@ -736,7 +736,7 @@ result_add_pubkey_algo (struct result_xml_state *state, gpg_error_t result_add_hash_algo (struct result_xml_state *state, char *name, gpgme_hash_algo_t algo) -{ +{ char code[20]; char msg[80]; snprintf (code, sizeof (code) - 1, "0x%x", algo); @@ -751,7 +751,7 @@ result_add_hash_algo (struct result_xml_state *state, gpg_error_t result_add_keyid (struct result_xml_state *state, char *name, char *keyid) -{ +{ result_xml_tag_start (state, name, NULL); result_xml_tag_data (state, keyid); result_xml_tag_end (state); @@ -761,7 +761,7 @@ result_add_keyid (struct result_xml_state *state, char *name, char *keyid) gpg_error_t result_add_fpr (struct result_xml_state *state, char *name, char *fpr) -{ +{ result_xml_tag_start (state, name, NULL); result_xml_tag_data (state, fpr); result_xml_tag_end (state); @@ -785,7 +785,7 @@ result_add_timestamp (struct result_xml_state *state, char *name, gpg_error_t result_add_sig_mode (struct result_xml_state *state, char *name, gpgme_sig_mode_t sig_mode) -{ +{ char *mode; char code[20]; @@ -815,7 +815,7 @@ result_add_sig_mode (struct result_xml_state *state, char *name, gpg_error_t result_add_value (struct result_xml_state *state, char *name, unsigned int val) -{ +{ char code[20]; snprintf (code, sizeof (code) - 1, "0x%x", val); @@ -828,7 +828,7 @@ result_add_value (struct result_xml_state *state, gpg_error_t result_add_string (struct result_xml_state *state, char *name, char *str) -{ +{ result_xml_tag_start (state, name, NULL); result_xml_tag_data (state, str); result_xml_tag_end (state); @@ -854,7 +854,7 @@ result_encrypt_to_xml (gpgme_ctx_t ctx, int indent, if (inv_recp) { result_xml_tag_start (&state, "invalid-recipients", NULL); - + while (inv_recp) { result_xml_tag_start (&state, "invalid-key", NULL); @@ -867,7 +867,7 @@ result_encrypt_to_xml (gpgme_ctx_t ctx, int indent, result_xml_tag_end (&state); } result_xml_tag_end (&state); - + return 0; } @@ -920,7 +920,7 @@ result_decrypt_to_xml (gpgme_ctx_t ctx, int indent, result_xml_tag_end (&state); } result_xml_tag_end (&state); - + return 0; } @@ -944,7 +944,7 @@ result_sign_to_xml (gpgme_ctx_t ctx, int indent, if (inv_key) { result_xml_tag_start (&state, "invalid-signers", NULL); - + while (inv_key) { result_xml_tag_start (&state, "invalid-key", NULL); @@ -980,7 +980,7 @@ result_sign_to_xml (gpgme_ctx_t ctx, int indent, } result_xml_tag_end (&state); - + return 0; } @@ -1014,7 +1014,7 @@ result_verify_to_xml (gpgme_ctx_t ctx, int indent, while (sig) { result_xml_tag_start (&state, "signature", NULL); - + /* FIXME: Could be done better. */ result_add_value (&state, "summary", sig->summary); if (sig->fpr) @@ -1032,7 +1032,7 @@ result_verify_to_xml (gpgme_ctx_t ctx, int indent, result_add_hash_algo (&state, "hash-algo", sig->hash_algo); if (sig->pka_address) result_add_string (&state, "pka_address", sig->pka_address); - + result_xml_tag_end (&state); sig = sig->next; } @@ -1040,7 +1040,7 @@ result_verify_to_xml (gpgme_ctx_t ctx, int indent, } result_xml_tag_end (&state); - + return 0; } @@ -1078,7 +1078,7 @@ result_import_to_xml (gpgme_ctx_t ctx, int indent, if (stat) { result_xml_tag_start (&state, "imports", NULL); - + while (stat) { result_xml_tag_start (&state, "import-status", NULL); @@ -1096,7 +1096,7 @@ result_import_to_xml (gpgme_ctx_t ctx, int indent, } result_xml_tag_end (&state); - + return 0; } @@ -1120,7 +1120,7 @@ result_genkey_to_xml (gpgme_ctx_t ctx, int indent, result_add_fpr (&state, "fpr", res->fpr); result_xml_tag_end (&state); - + return 0; } @@ -1141,7 +1141,7 @@ result_keylist_to_xml (gpgme_ctx_t ctx, int indent, result_add_value (&state, "truncated", res->truncated); result_xml_tag_end (&state); - + return 0; } @@ -1162,7 +1162,7 @@ result_vfs_mount_to_xml (gpgme_ctx_t ctx, int indent, result_add_string (&state, "mount-dir", res->mount_dir); result_xml_tag_end (&state); - + return 0; } @@ -1209,7 +1209,7 @@ typedef struct gpgme_tool *gpgme_tool_t; /* Forward declaration. */ -void gt_write_status (gpgme_tool_t gt, +void gt_write_status (gpgme_tool_t gt, status_t status, ...) GT_GCC_A_SENTINEL(0); void @@ -1281,7 +1281,7 @@ gt_get_key (gpgme_tool_t gt, const char *pattern, gpgme_key_t *r_key) if (!gt || !r_key || !pattern) return gpg_error (GPG_ERR_INV_VALUE); - + ctx = gt->ctx; err = gpgme_new (&listctx); @@ -1343,10 +1343,10 @@ gt_get_key (gpgme_tool_t gt, const char *pattern, gpgme_key_t *r_key) } } gpgme_release (listctx); - + if (! err) - gt_write_status (gt, STATUS_RECIPIENT, - ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? + gt_write_status (gt, STATUS_RECIPIENT, + ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? (*r_key)->subkeys->fpr : "invalid", NULL); return err; } @@ -1390,7 +1390,7 @@ gt_reset (gpgme_tool_t gt) { gpg_error_t err; gpgme_ctx_t ctx; - + err = _gt_gpgme_new (gt, &ctx); if (err) return err; @@ -1482,7 +1482,7 @@ gt_protocol_from_name (const char *name) return GPGME_PROTOCOL_UNKNOWN; } - + gpg_error_t gt_set_protocol (gpgme_tool_t gt, gpgme_protocol_t proto) { @@ -1572,7 +1572,7 @@ gt_get_keylist_mode (gpgme_tool_t gt) const char *modes[NR_KEYLIST_MODES + 1]; int idx = 0; gpgme_keylist_mode_t mode = gpgme_get_keylist_mode (gt->ctx); - + if (mode & GPGME_KEYLIST_MODE_LOCAL) modes[idx++] = "local"; if (mode & GPGME_KEYLIST_MODE_EXTERN) @@ -1693,18 +1693,18 @@ gt_import_keys (gpgme_tool_t gt, char *fpr[]) int cnt; int idx; gpgme_key_t *keys; - + cnt = 0; while (fpr[cnt]) cnt++; - + if (! cnt) return gpg_error (GPG_ERR_INV_VALUE); keys = malloc ((cnt + 1) * sizeof (gpgme_key_t)); if (! keys) return gpg_error_from_syserror (); - + for (idx = 0; idx < cnt; idx++) { err = gpgme_get_key (gt->ctx, fpr[idx], &keys[idx], 0); @@ -1716,7 +1716,7 @@ gt_import_keys (gpgme_tool_t gt, char *fpr[]) keys[cnt] = NULL; err = gpgme_op_import_keys (gt->ctx, keys); } - + /* Rollback. */ while (--idx >= 0) gpgme_key_unref (keys[idx]); @@ -1786,7 +1786,7 @@ gt_vfs_create (gpgme_tool_t gt, const char *container_file, int flags) } -static const char hlp_passwd[] = +static const char hlp_passwd[] = "PASSWD \n" "\n" "Ask the backend to change the passphrase for the key\n" @@ -1922,7 +1922,7 @@ server_parse_fd (assuan_context_t ctx, char *line, assuan_fd_t *rfd, else return assuan_command_parse_fd (ctx, line, rfd); } - + static gpgme_data_encoding_t server_data_encoding (const char *line) @@ -2033,7 +2033,7 @@ reset_notify (assuan_context_t ctx, char *line) } -static const char hlp_version[] = +static const char hlp_version[] = "VERSION []\n" "\n" "Call the function gpgme_check_version."; @@ -2065,7 +2065,7 @@ cmd_engine (assuan_context_t ctx, char *line) } -static const char hlp_protocol[] = +static const char hlp_protocol[] = "PROTOCOL []\n" "\n" "With NAME, set the protocol. Without, return the current\n" @@ -2109,11 +2109,11 @@ cmd_armor (assuan_context_t ctx, char *line) if (line && *line) { int flag = 0; - + if (! strcasecmp (line, "true") || ! strcasecmp (line, "yes") || line[0] == '1') flag = 1; - + return gt_set_armor (server->gt, flag); } else @@ -2137,7 +2137,7 @@ cmd_textmode (assuan_context_t ctx, char *line) if (! strcasecmp (line, "true") || ! strcasecmp (line, "yes") || line[0] == '1') flag = 1; - + return gt_set_textmode (server->gt, flag); } else @@ -2160,12 +2160,12 @@ cmd_include_certs (assuan_context_t ctx, char *line) if (line && *line) { int include_certs = 0; - + if (! strcasecmp (line, "default")) include_certs = GPGME_INCLUDE_CERTS_DEFAULT; else include_certs = atoi (line); - + return gt_set_include_certs (server->gt, include_certs); } else @@ -2186,7 +2186,7 @@ cmd_keylist_mode (assuan_context_t ctx, char *line) if (line && *line) { gpgme_keylist_mode_t mode = 0; - + if (strstr (line, "local")) mode |= GPGME_KEYLIST_MODE_LOCAL; if (strstr (line, "extern")) @@ -2199,7 +2199,7 @@ cmd_keylist_mode (assuan_context_t ctx, char *line) mode |= GPGME_KEYLIST_MODE_EPHEMERAL; if (strstr (line, "validate")) mode |= GPGME_KEYLIST_MODE_VALIDATE; - + return gt_set_keylist_mode (server->gt, mode); } else @@ -2339,7 +2339,7 @@ _cmd_decrypt_verify (assuan_context_t ctx, char *line, int verify) out_fn = server->output_filename; if (out_fd == ASSUAN_INVALID_FD && !out_fn) return GPG_ERR_ASS_NO_OUTPUT; - + err = server_data_obj (inp_fd, inp_fn, 0, server->input_enc, &inp_data, &server->input_stream); if (err) @@ -2352,7 +2352,7 @@ _cmd_decrypt_verify (assuan_context_t ctx, char *line, int verify) return err; } - err = gt_decrypt_verify (server->gt, inp_data, out_data, verify); + err = gt_decrypt_verify (server->gt, inp_data, out_data, verify); gpgme_data_release (inp_data); gpgme_data_release (out_data); @@ -2410,7 +2410,7 @@ _cmd_sign_encrypt (assuan_context_t ctx, char *line, int sign) flags |= GPGME_ENCRYPT_PREPARE; if (strstr (line, "--expect-sign")) flags |= GPGME_ENCRYPT_EXPECT_SIGN; - + inp_fd = assuan_get_input_fd (ctx); inp_fn = server->input_filename; out_fd = assuan_get_output_fd (ctx); @@ -2433,7 +2433,7 @@ _cmd_sign_encrypt (assuan_context_t ctx, char *line, int sign) } } - err = gt_sign_encrypt (server->gt, flags, inp_data, out_data, sign); + err = gt_sign_encrypt (server->gt, flags, inp_data, out_data, sign); gpgme_data_release (inp_data); gpgme_data_release (out_data); @@ -2510,7 +2510,7 @@ cmd_sign (assuan_context_t ctx, char *line) out_fn = server->output_filename; if (out_fd == ASSUAN_INVALID_FD && !out_fn) return GPG_ERR_ASS_NO_OUTPUT; - + err = server_data_obj (inp_fd, inp_fn, 0, server->input_enc, &inp_data, &server->input_stream); if (err) @@ -2614,7 +2614,7 @@ static gpg_error_t cmd_import (assuan_context_t ctx, char *line) { struct server *server = assuan_get_pointer (ctx); - + if (line && *line) { char *fprs[2] = { line, NULL }; @@ -2627,7 +2627,7 @@ cmd_import (assuan_context_t ctx, char *line) assuan_fd_t inp_fd; char *inp_fn; gpgme_data_t inp_data; - + inp_fd = assuan_get_input_fd (ctx); inp_fn = server->input_filename; if (inp_fd == ASSUAN_INVALID_FD && !inp_fn) @@ -2637,9 +2637,9 @@ cmd_import (assuan_context_t ctx, char *line) &server->input_stream); if (err) return err; - - err = gt_import (server->gt, inp_data); - + + err = gt_import (server->gt, inp_data); + gpgme_data_release (inp_data); server_reset_fds (server); @@ -2648,7 +2648,7 @@ cmd_import (assuan_context_t ctx, char *line) } -static const char hlp_export[] = +static const char hlp_export[] = "EXPORT [--extern] [--minimal] []\n" "\n" "Export the keys described by PATTERN. Write the\n" @@ -2730,7 +2730,7 @@ cmd_genkey (assuan_context_t ctx, char *line) return GPG_ERR_ASS_NO_INPUT; out_fd = assuan_get_output_fd (ctx); out_fn = server->output_filename; - + err = server_data_obj (inp_fd, inp_fn, 0, server->input_enc, &inp_data, &server->input_stream); if (err) @@ -2789,7 +2789,7 @@ cmd_genkey (assuan_context_t ctx, char *line) if (parms_data) gpgme_data_release (parms_data); - return err; + return err; } @@ -2811,7 +2811,7 @@ cmd_delete (assuan_context_t ctx, char *line) } -static const char hlp_keylist[] = +static const char hlp_keylist[] = "KEYLIST [--secret-only] []\n" "\n" "List all certificates or only those specified by PATTERNS. Each\n" @@ -2877,14 +2877,14 @@ cmd_keylist (assuan_context_t ctx, char *line) gpgme_key_unref (key); } } - + server_reset_fds (server); return err; } -static const char hlp_getauditlog[] = +static const char hlp_getauditlog[] = "GETAUDITLOG [--html] [--with-help]\n" "\n" "Call the function gpgme_op_getauditlog with the given flags. Write\n" @@ -3087,7 +3087,7 @@ register_commands (assuan_context_t ctx) table[idx].help); if (err) return err; - } + } return 0; } @@ -3153,7 +3153,7 @@ gpgme_server (gpgme_tool_t gt) log_error (0, err, "assuan accept problem"); break; } - + err = assuan_process (server.assuan_ctx); if (err) log_error (0, err, "assuan processing failed"); diff --git a/src/gpgme-w32spawn.c b/src/gpgme-w32spawn.c index ccf88a90..8a4ab544 100644 --- a/src/gpgme-w32spawn.c +++ b/src/gpgme-w32spawn.c @@ -2,17 +2,17 @@ Copyright (C) 2008 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -63,7 +63,7 @@ build_commandline (char **argv) int n = 0; char *buf; char *p; - + /* We have to quote some things because under Windows the program parses the commandline and does some unquoting. We enclose the whole argument in double-quotes, and escape literal double-quotes @@ -145,7 +145,7 @@ my_spawn (char **argv, struct spawn_fd_item_s *fd_list, unsigned int flags) memset (&sec_attr, 0, sizeof sec_attr); sec_attr.nLength = sizeof sec_attr; sec_attr.bInheritHandle = FALSE; - + arg_string = build_commandline (argv); if (!arg_string) return -1; @@ -182,11 +182,11 @@ my_spawn (char **argv, struct spawn_fd_item_s *fd_list, unsigned int flags) fprintf (stderr, PGM":dup 0x%x to stderr\n", fd_list[i].peer_name); } } - + if (!duped_stdin || !duped_stdout || !duped_stderr) { SECURITY_ATTRIBUTES sa; - + memset (&sa, 0, sizeof sa); sa.nLength = sizeof sa; sa.bInheritHandle = TRUE; @@ -214,8 +214,8 @@ my_spawn (char **argv, struct spawn_fd_item_s *fd_list, unsigned int flags) if (!duped_stderr) si.hStdError = hnul; } - - cr_flags |= CREATE_SUSPENDED; + + cr_flags |= CREATE_SUSPENDED; cr_flags |= DETACHED_PROCESS; if (!CreateProcessA (argv[0], arg_string, @@ -239,7 +239,7 @@ my_spawn (char **argv, struct spawn_fd_item_s *fd_list, unsigned int flags) /* Close the /dev/nul handle if used. */ if (hnul != INVALID_HANDLE_VALUE) CloseHandle (hnul); - + for (i = 0; fd_list[i].handle != -1; i++) CloseHandle ((HANDLE) fd_list[i].handle); @@ -248,7 +248,7 @@ my_spawn (char **argv, struct spawn_fd_item_s *fd_list, unsigned int flags) static int initialized; static BOOL (WINAPI * func)(DWORD); void *handle; - + if (!initialized) { /* Available since W2000; thus we dynload it. */ @@ -261,7 +261,7 @@ my_spawn (char **argv, struct spawn_fd_item_s *fd_list, unsigned int flags) FreeLibrary (handle); } } - + if (func) { int rc = func (pi.dwProcessId); @@ -269,7 +269,7 @@ my_spawn (char **argv, struct spawn_fd_item_s *fd_list, unsigned int flags) (int)pi.dwProcessId, rc); } } - + ResumeThread (pi.hThread); CloseHandle (pi.hThread); CloseHandle (pi.hProcess); @@ -281,8 +281,8 @@ my_spawn (char **argv, struct spawn_fd_item_s *fd_list, unsigned int flags) #define MAX_TRANS 10 int -translate_get_from_file (const char *trans_file, - struct spawn_fd_item_s *fd_list, +translate_get_from_file (const char *trans_file, + struct spawn_fd_item_s *fd_list, unsigned int *r_flags) { /* Hold roughly MAX_TRANS triplets of 64 bit numbers in hex @@ -340,7 +340,7 @@ translate_get_from_file (const char *trans_file, if (tail == NULL || ! (*tail == '\0' || isspace (*tail))) break; linep = tail; - + while (isspace (*((unsigned char *)linep))) linep++; if (*linep == '\0') diff --git a/src/gpgme.c b/src/gpgme.c index 927b2a09..771fcc00 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -71,7 +71,7 @@ gpgme_new (gpgme_ctx_t *r_ctx) return TRACE_ERR (gpg_error_from_errno (errno)); INIT_LOCK (ctx->lock); - + _gpgme_engine_info_copy (&ctx->engine_info); if (!ctx->engine_info) { @@ -727,7 +727,7 @@ gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, gpgme_protocol_t proto, if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + /* Shut down the engine when changing engine info. */ if (ctx->engine) { @@ -789,7 +789,7 @@ gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name, "name=%s, value=%s, flags=0x%x", name ? name : "(null)", value ? value : "(null)", flags); - + if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); @@ -826,7 +826,7 @@ gpgme_sig_notation_get (gpgme_ctx_t ctx) return ctx->sig_notations; } - + const char * gpgme_pubkey_algo_name (gpgme_pubkey_algo_t algo) diff --git a/src/import.c b/src/import.c index 3bc74413..f599c232 100644 --- a/src/import.c +++ b/src/import.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -77,7 +77,7 @@ gpgme_op_import_result (gpgme_ctx_t ctx) return NULL; } - + if (_gpgme_debug_trace ()) { gpgme_import_status_t impstat; @@ -318,7 +318,7 @@ gpgme_op_import (gpgme_ctx_t ctx, gpgme_data_t keydata) static gpgme_error_t -_gpgme_op_import_keys_start (gpgme_ctx_t ctx, int synchronous, +_gpgme_op_import_keys_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t *keys) { gpgme_error_t err; @@ -382,7 +382,7 @@ gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t *keys) while (keys[i]) { TRACE_LOG3 ("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"); i++; } @@ -421,7 +421,7 @@ gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t *keys) while (keys[i]) { TRACE_LOG3 ("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"); i++; } diff --git a/src/key.c b/src/key.c index 37db81de..c1d8ceb5 100644 --- a/src/key.c +++ b/src/key.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -78,7 +78,7 @@ _gpgme_key_add_subkey (gpgme_key_t key, gpgme_subkey_t *r_subkey) static char * set_user_id_part (char *tail, const char *buf, size_t len) { - while (len && (buf[len - 1] == ' ' || buf[len - 1] == '\t')) + while (len && (buf[len - 1] == ' ' || buf[len - 1] == '\t')) len--; for (; len; len--) *tail++ = *buf++; @@ -157,10 +157,10 @@ parse_user_id (char *src, char **name, char **email, { in_name = 1; start = src; - } + } src++; } - + if (in_name) { if (!*name) @@ -169,7 +169,7 @@ parse_user_id (char *src, char **name, char **email, tail = set_user_id_part (tail, start, src - start); } } - + /* Let unused parts point to an EOS. */ tail--; if (!*name) @@ -187,7 +187,7 @@ parse_x509_user_id (char *src, char **name, char **email, { if (*src == '<' && src[strlen (src) - 1] == '>') *email = src; - + /* Let unused parts point to an EOS. */ tail--; if (!*name) @@ -361,7 +361,7 @@ gpgme_key_unref (gpgme_key_t key) free (uid); uid = next_uid; } - + if (key->issuer_serial) free (key->issuer_serial); if (key->issuer_name) @@ -518,7 +518,7 @@ gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what, case GPGME_ATTR_FPR: return subkey ? subkey->fpr : NULL; - case GPGME_ATTR_ALGO: + case GPGME_ATTR_ALGO: return subkey ? gpgme_pubkey_algo_name (subkey->pubkey_algo) : NULL; case GPGME_ATTR_TYPE: @@ -527,10 +527,10 @@ gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what, case GPGME_ATTR_OTRUST: return otrust_to_string (key->owner_trust); - case GPGME_ATTR_USERID: + case GPGME_ATTR_USERID: return uid ? uid->uid : NULL; - case GPGME_ATTR_NAME: + case GPGME_ATTR_NAME: return uid ? uid->name : NULL; case GPGME_ATTR_EMAIL: @@ -542,7 +542,7 @@ gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what, case GPGME_ATTR_VALIDITY: return uid ? validity_to_string (uid->validity) : NULL; - case GPGME_ATTR_KEY_CAPS: + case GPGME_ATTR_KEY_CAPS: return subkey ? capabilities_to_string (subkey) : NULL; case GPGME_ATTR_SERIAL: @@ -604,7 +604,7 @@ gpgme_key_get_ulong_attr (gpgme_key_t key, _gpgme_attr_t what, return (subkey && subkey->timestamp >= 0) ? (unsigned long) subkey->timestamp : 0; - case GPGME_ATTR_EXPIRE: + case GPGME_ATTR_EXPIRE: return (subkey && subkey->expires >= 0) ? (unsigned long) subkey->expires : 0; @@ -693,13 +693,13 @@ gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx, case GPGME_ATTR_KEYID: return certsig->keyid; - case GPGME_ATTR_ALGO: + case GPGME_ATTR_ALGO: return gpgme_pubkey_algo_name (certsig->pubkey_algo); case GPGME_ATTR_USERID: return certsig->uid; - case GPGME_ATTR_NAME: + case GPGME_ATTR_NAME: return certsig->name; case GPGME_ATTR_EMAIL: @@ -707,7 +707,7 @@ gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx, case GPGME_ATTR_COMMENT: return certsig->comment; - + default: return NULL; } @@ -725,13 +725,13 @@ gpgme_key_sig_get_ulong_attr (gpgme_key_t key, int uid_idx, _gpgme_attr_t what, switch (what) { - case GPGME_ATTR_ALGO: + case GPGME_ATTR_ALGO: return (unsigned long) certsig->pubkey_algo; - case GPGME_ATTR_CREATED: + case GPGME_ATTR_CREATED: return certsig->timestamp < 0 ? 0L : (unsigned long) certsig->timestamp; - case GPGME_ATTR_EXPIRE: + case GPGME_ATTR_EXPIRE: return certsig->expires < 0 ? 0L : (unsigned long) certsig->expires; case GPGME_ATTR_KEY_REVOKED: diff --git a/src/keylist.c b/src/keylist.c index 29e30a0f..3d240aa6 100644 --- a/src/keylist.c +++ b/src/keylist.c @@ -4,17 +4,17 @@ 2008, 2009 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -218,7 +218,7 @@ set_userid_flags (gpgme_key_t key, const char *src) case 'r': uid->revoked = 1; break; - + case 'i': uid->invalid = 1; break; @@ -469,17 +469,17 @@ keylist_colon_handler (void *priv, char *line) rectype = RT_CRT; else if (!strcmp (field[0], "crs")) rectype = RT_CRS; - else if (!strcmp (field[0], "fpr") && key) + else if (!strcmp (field[0], "fpr") && key) rectype = RT_FPR; else if (!strcmp (field[0], "uid") && key) rectype = RT_UID; else if (!strcmp (field[0], "sub") && key) - rectype = RT_SUB; + rectype = RT_SUB; else if (!strcmp (field[0], "ssb") && key) rectype = RT_SSB; else if (!strcmp (field[0], "spk") && key) rectype = RT_SPK; - else + else rectype = RT_NONE; /* Only look at signatures immediately following a user ID. For @@ -529,7 +529,7 @@ keylist_colon_handler (void *priv, char *line) int i = atoi (field[2]); /* Ignore invalid values. */ if (i > 1) - subkey->length = i; + subkey->length = i; } /* Field 4 has the public key algorithm. */ @@ -560,7 +560,7 @@ keylist_colon_handler (void *priv, char *line) if (!key->issuer_serial) return gpg_error_from_errno (errno); } - + /* Field 9 has the ownertrust. */ if (fields >= 9) set_ownertrust (key, field[8]); @@ -632,7 +632,7 @@ keylist_colon_handler (void *priv, char *line) /* Field 8 is reserved (LID). */ /* Field 9 has the ownertrust. */ /* Field 10, the user ID, is n/a for a subkey. */ - + /* Field 11 has the signature class. */ /* Field 12 has the capabilities. */ @@ -730,11 +730,11 @@ keylist_colon_handler (void *priv, char *line) if (i >= 1 && i < 128) keysig->pubkey_algo = i; } - + /* Field 5 has the long keyid. */ if (fields >= 5 && strlen (field[4]) == DIM(keysig->_keyid) - 1) strcpy (keysig->_keyid, field[4]); - + /* Field 6 has the timestamp (seconds). */ if (fields >= 6) keysig->timestamp = _gpgme_parse_timestamp (field[5], NULL); @@ -802,7 +802,7 @@ keylist_colon_handler (void *priv, char *line) keysig->_last_notation = notation; } } - + case RT_NONE: /* Unknown record. */ break; @@ -961,19 +961,19 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key) if (!opd->key_cond) return TRACE_ERR (gpg_error (GPG_ERR_EOF)); - opd->key_cond = 0; + opd->key_cond = 0; assert (opd->key_queue); } queue_item = opd->key_queue; opd->key_queue = queue_item->next; if (!opd->key_queue) opd->key_cond = 0; - + *r_key = queue_item->key; free (queue_item); return TRACE_SUC2 ("key=%p (%s)", *r_key, - ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? + ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? (*r_key)->subkeys->fpr : "invalid"); } @@ -983,7 +983,7 @@ gpgme_error_t gpgme_op_keylist_end (gpgme_ctx_t ctx) { TRACE (DEBUG_CTX, "gpgme_op_keylist_end", ctx); - + if (!ctx) return gpg_error (GPG_ERR_INV_VALUE); @@ -1006,7 +1006,7 @@ gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, gpgme_key_t *r_key, if (!ctx || !r_key || !fpr) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - + if (strlen (fpr) < 8) /* We have at least a key ID. */ return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); @@ -1068,7 +1068,7 @@ gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, gpgme_key_t *r_key, if (! err) { TRACE_LOG2 ("key=%p (%s)", *r_key, - ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? + ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? (*r_key)->subkeys->fpr : "invalid"); } return TRACE_ERR (err); diff --git a/src/op-support.c b/src/op-support.c index 000560bb..808eac87 100644 --- a/src/op-support.c +++ b/src/op-support.c @@ -2,17 +2,17 @@ Copyright (C) 2002, 2003, 2004, 2007 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -72,7 +72,7 @@ _gpgme_op_data_lookup (gpgme_ctx_t ctx, ctx_op_data_id_t type, void **hook, /* type is: 0: asynchronous operation (use global or user event loop). 1: synchronous operation (always use private event loop). 2: asynchronous private operation (use private or user - event loop). + event loop). 256: Modification flag to suppress the engine reset. */ gpgme_error_t diff --git a/src/opassuan.c b/src/opassuan.c index 21c25cab..e58240c7 100644 --- a/src/opassuan.c +++ b/src/opassuan.c @@ -2,17 +2,17 @@ Copyright (C) 2009 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -79,7 +79,7 @@ opassuan_start (gpgme_ctx_t ctx, int synchronous, /* XXXX. This is the asynchronous variant. */ gpgme_error_t -gpgme_op_assuan_transact_start (gpgme_ctx_t ctx, +gpgme_op_assuan_transact_start (gpgme_ctx_t ctx, const char *command, gpgme_assuan_data_cb_t data_cb, void *data_cb_value, @@ -128,7 +128,7 @@ gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx, if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); - err = opassuan_start (ctx, 1, command, + err = opassuan_start (ctx, 1, command, data_cb, data_cb_value, inq_cb, inq_cb_value, status_cb, status_cb_value); @@ -147,7 +147,7 @@ gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx, } if (op_err_p) *op_err_p = op_err; - + out: return TRACE_ERR (err); } diff --git a/src/ops.h b/src/ops.h index 7b3025bb..782265e4 100644 --- a/src/ops.h +++ b/src/ops.h @@ -1,19 +1,19 @@ /* ops.h - Internal operation support. Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/passphrase.c b/src/passphrase.c index c36b6ae4..17f14436 100644 --- a/src/passphrase.c +++ b/src/passphrase.c @@ -1,19 +1,19 @@ /* passphrase.c - Passphrase callback. Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -133,7 +133,7 @@ _gpgme_passphrase_command_handler (void *priv, gpgme_status_code_t code, if (err) return err; - if (code == GPGME_STATUS_GET_HIDDEN + if (code == GPGME_STATUS_GET_HIDDEN && (!strcmp (key, "passphrase.enter") || !strcmp (key, "passphrase.pin.ask"))) { diff --git a/src/passwd.c b/src/passwd.c index 97b69603..0ed54ba6 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -2,17 +2,17 @@ Copyright (C) 2010 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -53,7 +53,7 @@ parse_error (char *args) if (where) *where = '\0'; - where = args; + where = args; } else return gpg_error (GPG_ERR_INV_ENGINE); @@ -91,7 +91,7 @@ passwd_status_handler (void *priv, gpgme_status_code_t code, char *args) case GPGME_STATUS_SUCCESS: opd->success_seen = 1; break; - + case GPGME_STATUS_EOF: /* In case the OpenPGP engine does not properly implement the passwd command we won't get a success status back and thus we @@ -147,7 +147,7 @@ passwd_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t key, /* Change the passphrase for KEY. FLAGS is reserved for future use and must be passed as 0. The engine is expected to present a user interface to enter the old and the new passphrase. This is the - asynchronous variant. + asynchronous variant. Note that if ever the need arises to supply a passphrase we can do this with a flag value and the passphrase callback feature. */ diff --git a/src/posix-io.c b/src/posix-io.c index 02782172..ceb88316 100644 --- a/src/posix-io.c +++ b/src/posix-io.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2004, 2005, 2007, 2010 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -195,7 +195,7 @@ _gpgme_io_close (int fd) handler (fd, handler_value); } - /* Then do the close. */ + /* Then do the close. */ res = close (fd); return TRACE_SYSRES (res); } @@ -212,7 +212,7 @@ _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler, "close_handler=%p/%p", handler, value); assert (fd != -1); - + LOCK (notify_table_lock); for (idx=0; idx < notify_table_size; idx++) if (notify_table[idx].fd == -1) @@ -246,7 +246,7 @@ _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler, notify_table[idx].fd = fd; notify_table[idx].handler = handler; notify_table[idx].value = value; - + leave: UNLOCK (notify_table_lock); @@ -389,7 +389,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, TRACE_LOG3 ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd, fd_list[i].dup_to); pid = fork (); - if (pid == -1) + if (pid == -1) return TRACE_SYSRES (-1); if (!pid) @@ -450,7 +450,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, close (fd_list[i].fd); } - + if (! seen_stdin || ! seen_stderr) { fd = open ("/dev/null", O_RDWR); @@ -492,7 +492,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, if (fd != 0 && fd != 2) close (fd); } - + execv (path, (char *const *) argv); /* Hmm: in that case we could write a special status code to the status-pipe. */ @@ -559,7 +559,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) any = 0; for (i = 0; i < nfds; i++) { - if (fds[i].fd == -1) + if (fds[i].fd == -1) continue; if (fds[i].for_read) { @@ -581,7 +581,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) } fds[i].signaled = 0; } - TRACE_END (dbg_help, "]"); + TRACE_END (dbg_help, "]"); if (!any) return TRACE_SYSRES (0); @@ -606,7 +606,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) } TRACE_END (dbg_help, "]"); } - + /* The variable N is used to optimize it a little bit. */ for (n = count, i = 0; i < nfds && n; i++) { @@ -649,7 +649,7 @@ _gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags) nread += iov->iov_len; iov++; } - + TRACE_LOG1 ("about to receive %d bytes", nread); do diff --git a/src/posix-sema.c b/src/posix-sema.c index b1808fd9..d04ce616 100644 --- a/src/posix-sema.c +++ b/src/posix-sema.c @@ -1,19 +1,19 @@ -/* posix-sema.c +/* posix-sema.c Copyright (C) 2001 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2004, 2007 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/posix-util.c b/src/posix-util.c index d7ed8f09..478055ab 100644 --- a/src/posix-util.c +++ b/src/posix-util.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -100,7 +100,7 @@ _gpgme_get_conf_int (const char *key, int *value) return 0; } -void +void _gpgme_allow_set_foreground_window (pid_t pid) { (void)pid; diff --git a/src/priv-io.h b/src/priv-io.h index 770c0617..4058b3b1 100644 --- a/src/priv-io.h +++ b/src/priv-io.h @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/progress.c b/src/progress.c index 4fe6b635..76ec47f5 100644 --- a/src/progress.c +++ b/src/progress.c @@ -1,19 +1,19 @@ /* progress.c - status handler for progress status Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -71,7 +71,7 @@ _gpgme_progress_status_handler (void *priv, gpgme_status_code_t code, } } } - } + } if (type != 'X') ctx->progress_cb (ctx->progress_cb_value, args_cpy, type, current, total); diff --git a/src/putc_unlocked.c b/src/putc_unlocked.c index a15aade8..6f046207 100644 --- a/src/putc_unlocked.c +++ b/src/putc_unlocked.c @@ -7,12 +7,12 @@ under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/sema.h b/src/sema.h index 7d3870e9..4b7c0af6 100644 --- a/src/sema.h +++ b/src/sema.h @@ -3,17 +3,17 @@ Copyright (C) 2001, 2003, 2004, 2007 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -43,7 +43,7 @@ struct critsect_s } \ while (0) #define DESTROY_LOCK(name) _gpgme_sema_cs_destroy (&(name)) - + #define LOCK(name) \ do \ diff --git a/src/sig-notation.c b/src/sig-notation.c index 5800c378..8386378a 100644 --- a/src/sig-notation.c +++ b/src/sig-notation.c @@ -2,17 +2,17 @@ Copyright (C) 2005 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -56,7 +56,7 @@ sig_notation_set_flags (gpgme_sig_notation_t notation, /* We copy the flags into individual bits to make them easier accessible individually for the user. */ notation->human_readable = flags & GPGME_SIG_NOTATION_HUMAN_READABLE ? 1 : 0; - notation->critical = flags & GPGME_SIG_NOTATION_CRITICAL ? 1 : 0; + notation->critical = flags & GPGME_SIG_NOTATION_CRITICAL ? 1 : 0; notation->flags = flags; } diff --git a/src/sign.c b/src/sign.c index 2f308a06..15092049 100644 --- a/src/sign.c +++ b/src/sign.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004, 2007 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -273,7 +273,7 @@ _gpgme_sign_status_handler (void *priv, gpgme_status_code_t code, char *args) case GPGME_STATUS_INV_RECP: if (opd->inv_sgnr_seen && opd->ignore_inv_recp) - break; + break; /* FALLTROUGH */ case GPGME_STATUS_INV_SGNR: if (code == GPGME_STATUS_INV_SGNR) diff --git a/src/signers.c b/src/signers.c index ae74e815..b2e8cfa1 100644 --- a/src/signers.c +++ b/src/signers.c @@ -1,19 +1,19 @@ /* signers.c - Maintain signer sets. Copyright (C) 2001 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -66,7 +66,7 @@ gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key) { TRACE_BEG2 (DEBUG_CTX, "gpgme_signers_add", ctx, - "key=%p (%s)", key, (key->subkeys && key->subkeys->fpr) ? + "key=%p (%s)", key, (key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid"); if (!ctx || !key) diff --git a/src/trust-item.c b/src/trust-item.c index 4dd0c4e5..226298b4 100644 --- a/src/trust-item.c +++ b/src/trust-item.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -120,7 +120,7 @@ const char *gpgme_trust_item_get_string_attr (gpgme_trust_item_t item, val = item->keyid; break; - case GPGME_ATTR_OTRUST: + case GPGME_ATTR_OTRUST: val = item->owner_trust; break; @@ -128,7 +128,7 @@ const char *gpgme_trust_item_get_string_attr (gpgme_trust_item_t item, val = item->validity; break; - case GPGME_ATTR_USERID: + case GPGME_ATTR_USERID: val = item->name; break; @@ -156,11 +156,11 @@ int gpgme_trust_item_get_int_attr (gpgme_trust_item_t item, _gpgme_attr_t what, switch (what) { - case GPGME_ATTR_LEVEL: + case GPGME_ATTR_LEVEL: val = item->level; break; - case GPGME_ATTR_TYPE: + case GPGME_ATTR_TYPE: val = item->type; break; diff --git a/src/trustlist.c b/src/trustlist.c index a96b6c72..ca7d7ee0 100644 --- a/src/trustlist.c +++ b/src/trustlist.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -83,7 +83,7 @@ trustlist_colon_handler (void *priv, char *line) { field++; pend = strchr (p, ':'); - if (pend) + if (pend) *pend++ = 0; switch (field) @@ -232,7 +232,7 @@ gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item) return TRACE_ERR (err); if (!opd->trust_cond) return TRACE_ERR (gpg_error (GPG_ERR_EOF)); - opd->trust_cond = 0; + opd->trust_cond = 0; assert (opd->trust_queue); } q = opd->trust_queue; diff --git a/src/vasprintf.c b/src/vasprintf.c index 03d38ff2..4c40131d 100644 --- a/src/vasprintf.c +++ b/src/vasprintf.c @@ -33,10 +33,10 @@ Boston, MA 02111-1307, USA. */ #define va_copy(d, s) (*(d) = *(s)) #elif defined (MUST_COPY_VA_BYVAL) #define va_copy(d, s) ((d) = (s)) -#else +#else #define va_copy(d, s) memcpy ((d), (s), sizeof (va_list)) -#endif -#endif +#endif +#endif #ifdef TEST diff --git a/src/version.c b/src/version.c index 3aef4045..227a1067 100644 --- a/src/version.c +++ b/src/version.c @@ -1,19 +1,19 @@ /* version.c - Version check routines. Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -69,7 +69,7 @@ do_subsystem_inits (void) /* We need to make sure that the sockets are initialized. */ { WSADATA wsadat; - + WSAStartup (0x202, &wsadat); } #endif @@ -159,7 +159,7 @@ _gpgme_compare_versions (const char *my_version, if (my_major > rq_major || (my_major == rq_major && my_minor > rq_minor) - || (my_major == rq_major && my_minor == rq_minor + || (my_major == rq_major && my_minor == rq_minor && my_micro > rq_micro) || (my_major == rq_major && my_minor == rq_minor && my_micro == rq_micro && strcmp (my_plvl, rq_plvl) >= 0)) @@ -191,7 +191,7 @@ gpgme_check_version (const char *req_version) TRACE2 (DEBUG_INIT, "gpgme_check_version", 0, "req_version=%s, VERSION=%s", req_version? req_version:"(null)", VERSION); - + result = _gpgme_compare_versions (VERSION, req_version) ? VERSION : NULL; if (result != NULL) _gpgme_selftest = 0; @@ -233,7 +233,7 @@ gpgme_check_version_internal (const char *req_version, /* Extract the version string of a program from STRING. The version number is expected to be in GNU style format: - + foo 1.2.3 foo (bar system) 1.2.3 foo 1.2.3 cruft diff --git a/src/vfs-create.c b/src/vfs-create.c index e8dab472..48931b9a 100644 --- a/src/vfs-create.c +++ b/src/vfs-create.c @@ -2,17 +2,17 @@ Copyright (C) 2009 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -62,7 +62,7 @@ vfs_start (gpgme_ctx_t ctx, int synchronous, #if 0 /* XXXX. This is the asynchronous variant. */ static gpgme_error_t -gpgme_op_vfs_transact_start (gpgme_ctx_t ctx, +gpgme_op_vfs_transact_start (gpgme_ctx_t ctx, const char *command, gpgme_assuan_data_cb_t data_cb, void *data_cb_value, @@ -93,7 +93,7 @@ gpgme_op_vfs_transact (gpgme_ctx_t ctx, if (!ctx) return gpg_error (GPG_ERR_INV_VALUE); - + err = vfs_start (ctx, 1, command, data_cb, data_cb_value, inq_cb, inq_cb_value, status_cb, status_cb_value); if (!err) @@ -142,7 +142,7 @@ _gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[], free (container_file_esc); return err; } - + err = gpgme_op_vfs_transact (ctx, cmd, NULL, NULL, NULL, NULL, NULL, NULL, op_err); free (cmd); @@ -161,7 +161,7 @@ _gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[], return err; } free (container_file_esc); - + err = gpgme_op_vfs_transact (ctx, cmd, NULL, NULL, NULL, NULL, NULL, NULL, op_err); free (cmd); @@ -187,11 +187,11 @@ gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[], if (_gpgme_debug_trace () && recp) { int i = 0; - + while (recp[i]) { TRACE_LOG3 ("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"); i++; } diff --git a/src/vfs-mount.c b/src/vfs-mount.c index 327e3531..b9b1b4d2 100644 --- a/src/vfs-mount.c +++ b/src/vfs-mount.c @@ -2,17 +2,17 @@ Copyright (C) 2009 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -119,7 +119,7 @@ vfs_start (gpgme_ctx_t ctx, int synchronous, #if 0 /* XXXX. This is the asynchronous variant. */ static gpgme_error_t -gpgme_op_vfs_transact_start (gpgme_ctx_t ctx, +gpgme_op_vfs_transact_start (gpgme_ctx_t ctx, const char *command, gpgme_assuan_data_cb_t data_cb, void *data_cb_value, @@ -150,7 +150,7 @@ gpgme_op_vfs_transact (gpgme_ctx_t ctx, if (!ctx) return gpg_error (GPG_ERR_INV_VALUE); - + err = vfs_start (ctx, 1, command, data_cb, data_cb_value, inq_cb, inq_cb_value, status_cb, status_cb_value); if (!err) @@ -217,7 +217,7 @@ _gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file, if (asprintf (&cmd, "MOUNT") < 0) return gpg_error_from_syserror (); } - + err = gpgme_op_vfs_transact (ctx, cmd, NULL, NULL, NULL, NULL, _gpgme_vfs_mount_status_handler, ctx, op_err); free (cmd); diff --git a/src/w32-ce.c b/src/w32-ce.c index 88a8f316..e42f053c 100644 --- a/src/w32-ce.c +++ b/src/w32-ce.c @@ -1,19 +1,19 @@ -/* w32-ce.h +/* w32-ce.h Copyright (C) 2010 g10 Code GmbH Copyright (C) 1991,92,97,2000,02 Free Software Foundation, Inc. This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -35,7 +35,7 @@ but that header also redefines some Windows functions which we need to avoid unless having included shlobj.h. */ #include -#include +#include #include #include @@ -92,7 +92,7 @@ utf8_to_wchar (const char *string) } nbytes = (size_t)(n+1) * sizeof(*result); - if (nbytes / sizeof(*result) != (n+1)) + if (nbytes / sizeof(*result) != (n+1)) { gpg_err_set_errno (ENOMEM); return NULL; @@ -317,7 +317,7 @@ RegQueryValueExA (HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, free (name); return ERROR_NOT_ENOUGH_MEMORY; } - + err = RegQueryValueExW (hKey, name, lpReserved, &type, data, &data_len); if (lpType) *lpType = type; @@ -337,7 +337,7 @@ RegQueryValueExA (HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, /* This is valid since we allocated one more above. */ ((char*)data)[data_len] = '\0'; ((char*)data)[data_len + 1] = '\0'; - + data_c = wchar_to_utf8 ((wchar_t*) data); if (!data_c) return GetLastError(); @@ -439,7 +439,7 @@ SHGetSpecialFolderPathA (HWND hwndOwner, LPSTR lpszPath, int nFolder, path_c = wchar_to_utf8 (path); if (! path_c) return 0; - + strncpy (lpszPath, path_c, MAX_PATH); free (path_c); lpszPath[MAX_PATH - 1] = '\0'; @@ -449,7 +449,7 @@ SHGetSpecialFolderPathA (HWND hwndOwner, LPSTR lpszPath, int nFolder, /* Replacement for the access function. Note that we can't use fopen here because wince might now allow to have a shared read for an executable; it is better to to read the file attributes. - + Limitation: Only F_OK is supported. */ int @@ -476,7 +476,7 @@ _gpgme_wince_access (const char *fname, int mode) /* Perform a binary search for KEY in BASE which has NMEMB elements - of SIZE bytes each. The comparisons are done by (*COMPAR)(). + of SIZE bytes each. The comparisons are done by (*COMPAR)(). Code taken from glibc-2.6. */ void * _gpgme_wince_bsearch (const void *key, const void *base, diff --git a/src/w32-ce.h b/src/w32-ce.h index 36f1e9e5..c52ea992 100644 --- a/src/w32-ce.h +++ b/src/w32-ce.h @@ -1,18 +1,18 @@ -/* w32-ce.h +/* w32-ce.h Copyright (C) 2010 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -74,7 +74,7 @@ int _gpgme_wince_access (const char *fname, int mode); void *_gpgme_wince_bsearch (const void *key, const void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *)); -#define bsearch(a,b,c,d,e) _gpgme_wince_bsearch ((a),(b),(c),(d),(e)) +#define bsearch(a,b,c,d,e) _gpgme_wince_bsearch ((a),(b),(c),(d),(e)) #if defined(_MSC_VER) /* Remove the redefined __leave keyword. It is defined by MSC for diff --git a/src/w32-glib-io.c b/src/w32-glib-io.c index 5c72f036..cb1bb3c3 100644 --- a/src/w32-glib-io.c +++ b/src/w32-glib-io.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2004, 2005 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -83,7 +83,7 @@ #define MAX_SLAFD 256 -static struct +static struct { int used; @@ -230,7 +230,7 @@ int _gpgme_io_fd2str (char *buf, int buflen, int fd) { HANDLE hndl; - + TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_fd2str", fd, "fd=%d", fd); if (giochannel_table[fd].fd != -1) hndl = (HANDLE) _get_osfhandle (giochannel_table[fd].fd); @@ -238,7 +238,7 @@ _gpgme_io_fd2str (char *buf, int buflen, int fd) hndl = (HANDLE) giochannel_table[fd].socket; TRACE_SUC1 ("syshd=%p", hndl); - + return snprintf (buf, buflen, "%d", (int) hndl); } @@ -299,7 +299,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) nread = -1; saved_errno = EIO; } - + if (nread != 0 && nread != -1) TRACE_LOGBUF (buffer, nread); @@ -401,7 +401,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) if (filedes[inherit_idx] < 0) { int saved_errno = errno; - + _close (fds[0]); _close (fds[1]); errno = saved_errno; @@ -414,13 +414,13 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) if (filedes[1 - inherit_idx] < 0) { int saved_errno = errno; - + _gpgme_io_close (fds[inherit_idx]); _close (fds[1 - inherit_idx]); errno = saved_errno; return TRACE_SYSRES (-1); } - + return TRACE_SUC5 ("read=0x%x/%p, write=0x%x/%p, channel=%p", filedes[0], (HANDLE) _get_osfhandle (giochannel_table[filedes[0]].fd), @@ -456,7 +456,7 @@ _gpgme_io_close (int fd) { if (giochannel_table[fd].primary) g_io_channel_shutdown (giochannel_table[fd].chan, 1, NULL); - + g_io_channel_unref (giochannel_table[fd].chan); } else @@ -465,7 +465,7 @@ _gpgme_io_close (int fd) assert (giochannel_table[fd].fd != -1); _close (giochannel_table[fd].fd); } - + giochannel_table[fd].used = 0; giochannel_table[fd].fd = -1; giochannel_table[fd].socket = INVALID_SOCKET; @@ -502,7 +502,7 @@ _gpgme_io_set_nonblocking (int fd) { GIOChannel *chan; GIOStatus status; - + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd); chan = find_channel (fd); @@ -540,7 +540,7 @@ build_commandline (char **argv) int n = 0; char *buf; char *p; - + /* We have to quote some things because under Windows the program parses the commandline and does some unquoting. We enclose the whole argument in double-quotes, and escape literal double-quotes @@ -621,7 +621,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, TRACE_LOG2 ("argv[%2i] = %s", i, argv[i]); i++; } - + /* We do not inherit any handles by default, and just insert those handles we want the child to have afterwards. But some handle values occur on the command line, and we need to move @@ -643,7 +643,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, memset (&sec_attr, 0, sizeof sec_attr); sec_attr.nLength = sizeof sec_attr; sec_attr.bInheritHandle = FALSE; - + arg_string = build_commandline (args); free (args); if (!arg_string) @@ -685,7 +685,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, } free (arg_string); - + if (flags & IOSPAWN_FLAG_ALLOW_SET_FG) _gpgme_allow_set_foreground_window ((pid_t)pi.dwProcessId); @@ -739,7 +739,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, { /* Strip the newline. */ len = strlen (line) - 1; - + /* Format is: Local name, stdin/stdout/stderr, peer name, argv idx. */ snprintf (&line[len], BUFFER_MAX - len, "0x%x %d 0x%x %d \n", fd_list[i].fd, fd_list[i].dup_to, @@ -761,18 +761,18 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, close (tmp_fd); /* The temporary file is deleted by the gpgme-w32spawn process (hopefully). */ - + TRACE_LOG4 ("CreateProcess ready: hProcess=%p, hThread=%p, " "dwProcessID=%d, dwThreadId=%d", - pi.hProcess, pi.hThread, + pi.hProcess, pi.hThread, (int) pi.dwProcessId, (int) pi.dwThreadId); - + if (r_pid) *r_pid = (pid_t)pi.dwProcessId; if (ResumeThread (pi.hThread) < 0) TRACE_LOG1 ("ResumeThread failed: ec=%d", (int) GetLastError ()); - + if (!CloseHandle (pi.hThread)) TRACE_LOG1 ("CloseHandle of thread failed: ec=%d", (int) GetLastError ()); @@ -810,7 +810,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) { int npollfds; GPollFD *pollfds; - int *pollfds_map; + int *pollfds_map; int i; int j; int any; @@ -842,14 +842,14 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) { GIOChannel *chan = NULL; - if (fds[i].fd == -1) + if (fds[i].fd == -1) continue; if ((fds[i].for_read || fds[i].for_write) && !(chan = find_channel (fds[i].fd))) { TRACE_ADD1 (dbg_help, "[BAD0x%x ", fds[i].fd); - TRACE_END (dbg_help, "]"); + TRACE_END (dbg_help, "]"); assert (!"see log file"); } else if (fds[i].for_read ) @@ -872,7 +872,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) } fds[i].signaled = 0; } - TRACE_END (dbg_help, "]"); + TRACE_END (dbg_help, "]"); if (!any) { count = 0; @@ -900,7 +900,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) } TRACE_END (dbg_help, "]"); } - + /* COUNT is used to stop the lop as soon as possible. */ for (n = count, i = 0; i < npollfds && n; i++) { @@ -955,7 +955,7 @@ _gpgme_io_dup (int fd) errno = EIO; return TRACE_SYSRES (-1); } - + chan = giochannel_table[fd].chan; g_io_channel_ref (chan); giochannel_table[newfd].used = 1; @@ -1016,7 +1016,7 @@ _gpgme_io_socket (int domain, int type, int proto) } TRACE_SUC2 ("fd=%i, socket=0x%x", fd, res); - + return fd; } @@ -1024,7 +1024,7 @@ _gpgme_io_socket (int domain, int type, int proto) int _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) { - GIOChannel *chan; + GIOChannel *chan; int sockfd; int res; GIOFlags flags; diff --git a/src/w32-io.c b/src/w32-io.c index 56a05c4b..cbc3064f 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004, 2007, 2010 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -82,7 +82,7 @@ static struct want to close something. Using the same handle for these duplicates works just fine. */ int dup_from; -} fd_table[MAX_SLAFD]; +} fd_table[MAX_SLAFD]; /* Returns the FD or -1 on resource limit. */ @@ -147,7 +147,7 @@ struct reader_context_s { HANDLE file_hd; int file_sock; - HANDLE thread_hd; + HANDLE thread_hd; int refcount; DECLARE_LOCK (mutex); @@ -157,7 +157,7 @@ struct reader_context_s int eof_shortcut; int error; int error_code; - + /* This is manually reset. */ HANDLE have_data_ev; /* This is automatically reset. */ @@ -182,11 +182,11 @@ struct writer_context_s { HANDLE file_hd; int file_sock; - HANDLE thread_hd; + HANDLE thread_hd; int refcount; DECLARE_LOCK (mutex); - + int stop_me; int error; int error_code; @@ -195,7 +195,7 @@ struct writer_context_s HANDLE have_data; HANDLE is_empty; HANDLE stopped; - size_t nbytes; + size_t nbytes; char buffer[WRITEBUF_SIZE]; }; @@ -257,7 +257,7 @@ set_synchronize (HANDLE hd) } -static DWORD CALLBACK +static DWORD CALLBACK reader (void *arg) { struct reader_context_s *ctx = arg; @@ -278,7 +278,7 @@ reader (void *arg) /* Leave a 1 byte gap so that we can see whether it is empty or full. */ if ((ctx->writepos + 1) % READBUF_SIZE == ctx->readpos) - { + { /* Wait for space. */ if (!ResetEvent (ctx->have_space_ev)) TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); @@ -298,7 +298,7 @@ reader (void *arg) if (nbytes > READBUF_SIZE - ctx->writepos) nbytes = READBUF_SIZE - ctx->writepos; UNLOCK (ctx->mutex); - + TRACE_LOG2 ("%s %d bytes", sock? "receiving":"reading", nbytes); if (sock) @@ -358,7 +358,7 @@ reader (void *arg) break; } TRACE_LOG1 ("got %u bytes", nread); - + ctx->writepos = (ctx->writepos + nread) % READBUF_SIZE; if (!SetEvent (ctx->have_data_ev)) TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, @@ -370,7 +370,7 @@ reader (void *arg) TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, (int) GetLastError ()); SetEvent (ctx->stopped); - + return TRACE_SUC (); } @@ -387,7 +387,7 @@ create_reader (int fd) memset (&sec_attr, 0, sizeof sec_attr); sec_attr.nLength = sizeof sec_attr; sec_attr.bInheritHandle = FALSE; - + ctx = calloc (1, sizeof *ctx); if (!ctx) { @@ -447,7 +447,7 @@ create_reader (int fd) free (ctx); TRACE_SYSERR (EIO); return NULL; - } + } else { /* We set the priority of the thread higher because we know that @@ -472,7 +472,7 @@ destroy_reader (struct reader_context_s *ctx) return; } ctx->stop_me = 1; - if (ctx->have_space_ev) + if (ctx->have_space_ev) SetEvent (ctx->have_space_ev); UNLOCK (ctx->mutex); @@ -497,7 +497,7 @@ destroy_reader (struct reader_context_s *ctx) WaitForSingleObject (ctx->stopped, INFINITE); TRACE1 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx->file_hd, "thread %p has terminated", ctx->thread_hd); - + if (ctx->stopped) CloseHandle (ctx->stopped); if (ctx->have_data_ev) @@ -573,7 +573,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) struct reader_context_s *ctx; TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_read", fd, "buffer=%p, count=%u", buffer, count); - + ctx = find_reader (fd, 1); if (!ctx) { @@ -593,7 +593,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) TRACE_LOG1 ("data from thread %p available", ctx->thread_hd); LOCK (ctx->mutex); } - + if (ctx->readpos == ctx->writepos || ctx->error) { UNLOCK (ctx->mutex); @@ -608,7 +608,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) gpg_err_set_errno (ctx->error_code); return TRACE_SYSRES (-1); } - + nread = ctx->readpos < ctx->writepos ? ctx->writepos - ctx->readpos : READBUF_SIZE - ctx->readpos; @@ -637,7 +637,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) return TRACE_SYSRES (-1); } UNLOCK (ctx->mutex); - + TRACE_LOGBUF (buffer, nread); return TRACE_SYSRES (nread); } @@ -646,7 +646,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) /* The writer does use a simple buffering strategy so that we are informed about write errors as soon as possible (i. e. with the the next call to the write function. */ -static DWORD CALLBACK +static DWORD CALLBACK writer (void *arg) { struct writer_context_s *ctx = arg; @@ -669,7 +669,7 @@ writer (void *arg) break; } if (!ctx->nbytes) - { + { if (!SetEvent (ctx->is_empty)) TRACE_LOG1 ("SetEvent failed: ec=%d", (int) GetLastError ()); if (!ResetEvent (ctx->have_data)) @@ -686,7 +686,7 @@ writer (void *arg) break; } UNLOCK (ctx->mutex); - + TRACE_LOG2 ("%s %d bytes", sock?"sending":"writing", ctx->nbytes); /* Note that CTX->nbytes is not zero at this point, because @@ -727,7 +727,7 @@ writer (void *arg) } } TRACE_LOG1 ("wrote %d bytes", (int) nwritten); - + LOCK (ctx->mutex); ctx->nbytes -= nwritten; UNLOCK (ctx->mutex); @@ -760,7 +760,7 @@ create_writer (int fd) TRACE_SYSERR (errno); return NULL; } - + if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used) { TRACE_SYSERR (EIO); @@ -813,7 +813,7 @@ create_writer (int fd) free (ctx); TRACE_SYSERR (EIO); return NULL; - } + } else { /* We set the priority of the thread higher because we know @@ -837,7 +837,7 @@ destroy_writer (struct writer_context_s *ctx) return; } ctx->stop_me = 1; - if (ctx->have_data) + if (ctx->have_data) SetEvent (ctx->have_data); UNLOCK (ctx->mutex); @@ -854,13 +854,13 @@ destroy_writer (struct writer_context_s *ctx) "unblock control call failed for thread %p", ctx->thread_hd); } #endif - + TRACE1 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx->file_hd, "waiting for termination of thread %p", ctx->thread_hd); WaitForSingleObject (ctx->stopped, INFINITE); TRACE1 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx->file_hd, "thread %p has terminated", ctx->thread_hd); - + if (ctx->stopped) CloseHandle (ctx->stopped); if (ctx->have_data) @@ -900,7 +900,7 @@ find_writer (int fd, int start_it) { wt = create_writer (fd); writer_table[i].fd = fd; - writer_table[i].context = wt; + writer_table[i].context = wt; writer_table[i].used = 1; } @@ -1058,14 +1058,14 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) { fd_table[rfd].handle = hd; fd_table[wfd].rvid = rvid; - } + } #else memset (&sec_attr, 0, sizeof (sec_attr)); sec_attr.nLength = sizeof (sec_attr); sec_attr.bInheritHandle = FALSE; - + if (!CreatePipe (&rh, &wh, &sec_attr, PIPEBUF_SIZE)) { TRACE_LOG1 ("CreatePipe failed: ec=%d", (int) GetLastError ()); @@ -1173,7 +1173,7 @@ _gpgme_io_close (int fd) if (fd_table[fd].handle != INVALID_HANDLE_VALUE) { if (!CloseHandle (fd_table[fd].handle)) - { + { TRACE_LOG1 ("CloseHandle failed: ec=%d", (int) GetLastError ()); /* FIXME: Should translate the error code. */ gpg_err_set_errno (EIO); @@ -1183,7 +1183,7 @@ _gpgme_io_close (int fd) else if (fd_table[fd].socket != INVALID_SOCKET) { if (closesocket (fd_table[fd].socket)) - { + { TRACE_LOG1 ("closesocket failed: ec=%d", (int) WSAGetLastError ()); /* FIXME: Should translate the error code. */ gpg_err_set_errno (EIO); @@ -1194,7 +1194,7 @@ _gpgme_io_close (int fd) } release_fd (fd); - + return TRACE_SYSRES (0); } @@ -1253,7 +1253,7 @@ build_commandline (char **argv, int fd0, int fd0_isnull, p = fdbuf; *p = 0; - + if (fd0 != -1) { if (fd0_isnull) @@ -1280,7 +1280,7 @@ build_commandline (char **argv, int fd0, int fd0_isnull, } strcpy (p, "-&S2=null "); p += strlen (p); - + n = strlen (fdbuf); for (i=0; (s = argv[i]); i++) { @@ -1297,7 +1297,7 @@ build_commandline (char **argv, int fd0, int fd0_isnull, return NULL; p = stpcpy (p, fdbuf); - for (i = 0; argv[i]; i++) + for (i = 0; argv[i]; i++) { if (!i) continue; /* Ignore argv[0]. */ @@ -1322,7 +1322,7 @@ build_commandline (char **argv, int fd0, int fd0_isnull, p = stpcpy (p, argv[i]); } - return buf; + return buf; } #else static char * @@ -1332,7 +1332,7 @@ build_commandline (char **argv) int n = 0; char *buf; char *p; - + /* We have to quote some things because under Windows the program parses the commandline and does some unquoting. We enclose the whole argument in double-quotes, and escape literal double-quotes @@ -1432,7 +1432,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, gpg_err_set_errno (EBADF); return TRACE_SYSRES (-1); } - + if (fd_list[i].dup_to == 0) { fd_in = fd_list[i].fd; @@ -1550,7 +1550,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, memset (&sec_attr, 0, sizeof sec_attr); sec_attr.nLength = sizeof sec_attr; sec_attr.bInheritHandle = FALSE; - + arg_string = build_commandline (args); free (args); if (!arg_string) @@ -1603,7 +1603,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, int fd = fd_list[i].fd; HANDLE ohd = INVALID_HANDLE_VALUE; HANDLE hd = INVALID_HANDLE_VALUE; - + /* Make it inheritable for the wrapper process. */ if (fd >= 0 && fd < MAX_SLAFD && fd_table[fd].used) ohd = fd_table[fd].handle; @@ -1629,7 +1629,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, /* Return the child name of this handle. */ fd_list[i].peer_name = handle_to_fd (hd); } - + /* Write the handle translation information to the temporary file. */ { @@ -1651,7 +1651,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, { /* Strip the newline. */ len = strlen (line) - 1; - + /* Format is: Local name, stdin/stdout/stderr, peer name, argv idx. */ snprintf (&line[len], BUFFER_MAX - len, "0x%x %d 0x%x %d \n", fd_list[i].fd, fd_list[i].dup_to, @@ -1678,16 +1678,16 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, TRACE_LOG4 ("CreateProcess ready: hProcess=%p, hThread=%p, " "dwProcessID=%d, dwThreadId=%d", - pi.hProcess, pi.hThread, + pi.hProcess, pi.hThread, (int) pi.dwProcessId, (int) pi.dwThreadId); - + if (r_pid) *r_pid = (pid_t)pi.dwProcessId; - + if (ResumeThread (pi.hThread) < 0) TRACE_LOG1 ("ResumeThread failed: ec=%d", (int) GetLastError ()); - + if (!CloseHandle (pi.hThread)) TRACE_LOG1 ("CloseHandle of thread failed: ec=%d", (int) GetLastError ()); @@ -1749,7 +1749,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) if (fds[i].for_read) { struct reader_context_s *ctx = find_reader (fds[i].fd,1); - + if (!ctx) TRACE_LOG1 ("error: no reader for FD 0x%x (ignored)", fds[i].fd); @@ -1772,7 +1772,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) else if (fds[i].for_write) { struct writer_context_s *ctx = find_writer (fds[i].fd,1); - + if (!ctx) TRACE_LOG1 ("error: no writer for FD 0x%x (ignored)", fds[i].fd); @@ -1795,7 +1795,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) } } TRACE_END (dbg_help, "]"); - if (!any) + if (!any) return TRACE_SYSRES (0); code = WaitForMultipleObjects (nwait, waitbuf, 0, nonblock ? 0 : 1000); @@ -1835,7 +1835,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) { int k; int j = handle_to_fd (waitbuf[i]); - + TRACE_LOG1 ("WFMO invalid handle %d removed", j); for (k = 0 ; k < nfds; k++) { @@ -1856,7 +1856,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) TRACE_LOG1 ("WFMO returned %d", code); count = -1; } - + if (count > 0) { TRACE_SEQ (dbg_help, "select OK [ "); @@ -1876,7 +1876,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) /* FIXME: Should determine a proper error code. */ gpg_err_set_errno (EIO); } - + return TRACE_SYSRES (count); } @@ -1926,7 +1926,7 @@ _gpgme_io_dup (int fd) newfd = new_fd(); if (newfd == -1) return TRACE_SYSRES (-1); - + fd_table[newfd].handle = fd_table[fd].handle; fd_table[newfd].socket = fd_table[fd].socket; fd_table[newfd].rvid = fd_table[fd].rvid; @@ -2023,7 +2023,7 @@ _gpgme_io_socket (int domain, int type, int proto) fd = new_fd(); if (fd == -1) return TRACE_SYSRES (-1); - + res = socket (domain, type, proto); if (res == INVALID_SOCKET) { @@ -2034,7 +2034,7 @@ _gpgme_io_socket (int domain, int type, int proto) fd_table[fd].socket = res; TRACE_SUC2 ("socket=0x%x (0x%x)", fd, fd_table[fd].socket); - + return fd; } @@ -2052,7 +2052,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) gpg_err_set_errno (EBADF); return TRACE_SYSRES (-1); } - + res = connect (fd_table[fd].socket, addr, addrlen); if (res) { diff --git a/src/w32-sema.c b/src/w32-sema.c index 504e6822..648a6bbd 100644 --- a/src/w32-sema.c +++ b/src/w32-sema.c @@ -1,19 +1,19 @@ -/* w32-sema.c +/* w32-sema.c Copyright (C) 2001 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2004, 2007 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -54,7 +54,7 @@ critsect_init (struct critsect_s *s) CRITICAL_SECTION *mp; static CRITICAL_SECTION init_lock; static int initialized; - + if (!initialized) { /* The very first time we call this function, we assume that only one thread is running, so that we can bootstrap the diff --git a/src/w32-util.c b/src/w32-util.c index b33aa2c6..7feaf6b9 100644 --- a/src/w32-util.c +++ b/src/w32-util.c @@ -4,17 +4,17 @@ Copyright (C) 2001, 2002, 2003, 2004, 2007 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -51,7 +51,7 @@ but that header also redefines some Windows functions which we need to avoid unless having included shlobj.h. */ #include -#include +#include #include #include @@ -105,10 +105,10 @@ dlclose (void * hd) return 0; } return -1; -} +} #endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */ -void +void _gpgme_allow_set_foreground_window (pid_t pid) { #ifdef HAVE_ALLOW_SET_FOREGROUND_WINDOW @@ -162,7 +162,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) HKEY root_key, key_handle; DWORD n1, nbytes, type; char *result = NULL; - + if (!root) root_key = HKEY_CURRENT_USER; else if (!strcmp( root, "HKEY_CLASSES_ROOT")) @@ -179,7 +179,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) root_key = HKEY_CURRENT_CONFIG; else return NULL; - + if (RegOpenKeyExA (root_key, dir, 0, KEY_READ, &key_handle)) { if (root) @@ -215,10 +215,10 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) #ifndef HAVE_W32CE_SYSTEM /* Windows CE does not have an environment. */ - if (type == REG_EXPAND_SZ && strchr (result, '%')) + if (type == REG_EXPAND_SZ && strchr (result, '%')) { char *tmp; - + n1 += 1000; tmp = malloc (n1 + 1); if (!tmp) @@ -247,7 +247,7 @@ read_w32_registry_string (const char *root, const char *dir, const char *name) result = malloc (strlen (tmp)+1); if (!result) result = tmp; - else + else { strcpy (result, tmp); free (tmp); @@ -271,7 +271,7 @@ static char * find_program_in_registry (const char *name) { char *program = NULL; - + program = read_w32_registry_string (NULL, "Software\\GNU\\GnuPG", name); if (program) { @@ -326,7 +326,7 @@ find_program_at_standard_place (const char *name) { char path[MAX_PATH]; char *result = NULL; - + /* See http://wiki.tcl.tk/17492 for details on compatibility. */ if (SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILES, 0)) { @@ -595,7 +595,7 @@ _gpgme_mkstemp (int *fd, char **name) else { int len = strlen(tmp); - + /* GetTempPath may return with \ on the end */ while(len > 0 && tmp[len - 1] == '\\') { diff --git a/src/wait-global.c b/src/wait-global.c index 77fd47f2..f3aa399b 100644 --- a/src/wait-global.c +++ b/src/wait-global.c @@ -1,19 +1,19 @@ -/* wait-global.c +/* wait-global.c Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -306,10 +306,10 @@ gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status, gpgme_error_t err = 0; gpgme_error_t local_op_err = 0; struct wait_item_s *item; - + assert (nr); nr--; - + item = (struct wait_item_s *) fdt.fds[i].opaque; assert (item); ictx = item->ctx; @@ -352,7 +352,7 @@ gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status, struct gpgme_io_event_done_data data; data.err = 0; data.op_err = 0; - + /* FIXME: This does not perform too well. We have to release the lock because the I/O event handler acquires it to remove the context from the active diff --git a/src/wait-private.c b/src/wait-private.c index c5cbd3cf..d0552cea 100644 --- a/src/wait-private.c +++ b/src/wait-private.c @@ -1,19 +1,19 @@ -/* wait-private.c +/* wait-private.c Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -95,7 +95,7 @@ _gpgme_wait_on_condition (gpgme_ctx_t ctx, volatile int *cond, return err; } - + for (i = 0; i < ctx->fdt.size && nr; i++) { if (ctx->fdt.fds[i].fd != -1 && ctx->fdt.fds[i].signaled) @@ -110,9 +110,9 @@ _gpgme_wait_on_condition (gpgme_ctx_t ctx, volatile int *cond, if (ctx->canceled) err = gpg_error (GPG_ERR_CANCELED); UNLOCK (ctx->lock); - + if (!err) - err = _gpgme_run_io_cb (&ctx->fdt.fds[i], 0, &op_err); + err = _gpgme_run_io_cb (&ctx->fdt.fds[i], 0, &op_err); if (err) { /* An error occured. Close all fds in this context, diff --git a/src/wait-user.c b/src/wait-user.c index 63dccfa7..42bb3a5b 100644 --- a/src/wait-user.c +++ b/src/wait-user.c @@ -1,19 +1,19 @@ -/* wait-user.c +/* wait-user.c Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA diff --git a/src/wait.c b/src/wait.c index a552b54d..992f2350 100644 --- a/src/wait.c +++ b/src/wait.c @@ -1,19 +1,19 @@ -/* wait.c +/* wait.c Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -74,7 +74,7 @@ fd_table_put (fd_table_t fdt, int fd, int dir, void *opaque, int *idx) * sizeof (*new_fds)); if (!new_fds) return gpg_error_from_errno (errno); - + fdt->fds = new_fds; fdt->size += FDT_ALLOCSIZE; for (j = 0; j < FDT_ALLOCSIZE; j++) diff --git a/src/wait.h b/src/wait.h index 6ea51e25..4beac6e1 100644 --- a/src/wait.h +++ b/src/wait.h @@ -1,19 +1,19 @@ /* wait.h - Definitions for the wait queue interface. Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH - + This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -88,7 +88,7 @@ struct io_cb_data { /* If this is the first field, the old internal code will still work. */ void *handler_value; - + /* The I/O callback can pass an operational error here. */ gpgme_error_t op_err; }; diff --git a/tests/run-export.c b/tests/run-export.c index b70ed91c..43332087 100644 --- a/tests/run-export.c +++ b/tests/run-export.c @@ -2,17 +2,17 @@ Copyright (C) 2008, 2009 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -48,7 +48,7 @@ show_usage (int ex) exit (ex); } -int +int main (int argc, char **argv) { int last_argc = -1; @@ -86,9 +86,9 @@ main (int argc, char **argv) } else if (!strncmp (*argv, "--", 2)) show_usage (1); - - } - + + } + if (!argc) show_usage (1); @@ -101,7 +101,7 @@ main (int argc, char **argv) /* Lookup the keys. */ err = gpgme_op_keylist_ext_start (ctx, (const char**)argv, 0, 0); fail_if_err (err); - + while (!(err = gpgme_op_keylist_next (ctx, &key))) { printf ("keyid: %s (fpr: %s)\n", @@ -138,7 +138,7 @@ main (int argc, char **argv) fail_if_err (err); gpgme_set_armor (ctx, 1); - err = gpgme_op_export_keys (ctx, keyarray, mode, + err = gpgme_op_export_keys (ctx, keyarray, mode, (mode & GPGME_KEYLIST_MODE_EXTERN)? NULL:out); fail_if_err (err); diff --git a/tests/run-import.c b/tests/run-import.c index cd101b01..9225f610 100644 --- a/tests/run-import.c +++ b/tests/run-import.c @@ -2,17 +2,17 @@ Copyright (C) 2008, 2009 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -49,7 +49,7 @@ show_usage (int ex) exit (ex); } -int +int main (int argc, char **argv) { int last_argc = -1; @@ -89,9 +89,9 @@ main (int argc, char **argv) } else if (!strncmp (*argv, "--", 2)) show_usage (1); - - } - + + } + if (!argc) show_usage (1); @@ -110,7 +110,7 @@ main (int argc, char **argv) if (url_mode) gpgme_data_set_encoding (data, (nul_mode? GPGME_DATA_ENCODING_URL0 : GPGME_DATA_ENCODING_URL)); - + err = gpgme_op_import (ctx, data); fail_if_err (err); impres = gpgme_op_import_result (ctx); @@ -120,7 +120,7 @@ main (int argc, char **argv) exit (1); } print_import_result (impres); - + gpgme_data_release (data); } diff --git a/tests/run-keylist.c b/tests/run-keylist.c index 0f2154a8..c0c72022 100644 --- a/tests/run-keylist.c +++ b/tests/run-keylist.c @@ -2,17 +2,17 @@ Copyright (C) 2008, 2009 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -57,7 +57,7 @@ show_usage (int ex) } -int +int main (int argc, char **argv) { int last_argc = -1; @@ -136,9 +136,9 @@ main (int argc, char **argv) } else if (!strncmp (*argv, "--", 2)) show_usage (1); - - } - + + } + if (argc > 1) show_usage (1); @@ -152,12 +152,12 @@ main (int argc, char **argv) err = gpgme_op_keylist_start (ctx, argc? argv[0]:NULL, 0); fail_if_err (err); - + while (!(err = gpgme_op_keylist_next (ctx, &key))) { gpgme_user_id_t uid; int nuids; - + printf ("keyid : %s\n", key->subkeys?nonnull (key->subkeys->keyid):"?"); printf ("fpr : %s\n", key->subkeys?nonnull (key->subkeys->fpr):"?"); @@ -176,7 +176,7 @@ main (int argc, char **argv) for (nuids=0, uid=key->uids; uid; uid = uid->next, nuids++) { printf ("userid %d: %s\n", nuids, nonnull(uid->uid)); - printf ("valid %d: %s\n", nuids, + printf ("valid %d: %s\n", nuids, uid->validity == GPGME_VALIDITY_UNKNOWN? "unknown": uid->validity == GPGME_VALIDITY_UNDEFINED? "undefined": uid->validity == GPGME_VALIDITY_NEVER? "never": diff --git a/tests/run-sign.c b/tests/run-sign.c index b16b9ef5..e1498ea8 100644 --- a/tests/run-sign.c +++ b/tests/run-sign.c @@ -2,17 +2,17 @@ Copyright (C) 2009 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -44,10 +44,10 @@ print_result (gpgme_sign_result_t result, gpgme_sig_mode_t type) gpgme_new_signature_t sig; for (invkey = result->invalid_signers; invkey; invkey = invkey->next) - printf ("Signing key `%s' not used: %s <%s>\n", - nonnull (invkey->fpr), + printf ("Signing key `%s' not used: %s <%s>\n", + nonnull (invkey->fpr), gpg_strerror (invkey->reason), gpg_strsource (invkey->reason)); - + for (sig = result->signatures; sig; sig = sig->next) { printf ("Key fingerprint: %s\n", nonnull (sig->fpr)); @@ -76,7 +76,7 @@ show_usage (int ex) } -int +int main (int argc, char **argv) { int last_argc = -1; @@ -131,9 +131,9 @@ main (int argc, char **argv) } else if (!strncmp (*argv, "--", 2)) show_usage (1); - - } - + + } + if (argc != 1) show_usage (1); @@ -153,7 +153,7 @@ main (int argc, char **argv) if (key_string) { gpgme_key_t akey; - + err = gpgme_get_key (ctx, key_string, &akey, 1); if (err) { diff --git a/tests/run-support.h b/tests/run-support.h index db7b7d5a..b1aea4be 100644 --- a/tests/run-support.h +++ b/tests/run-support.h @@ -3,17 +3,17 @@ Copyright (C) 2001, 2002, 2003, 2004, 2009 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -60,7 +60,7 @@ print_data (gpgme_data_t dh) #define BUF_SIZE 512 char buf[BUF_SIZE + 1]; int ret; - + ret = gpgme_data_seek (dh, 0, SEEK_SET); if (ret) fail_if_err (gpgme_err_code_from_errno (errno)); @@ -108,7 +108,7 @@ make_filename (const char *fname) if (!srcdir) srcdir = "."; buf = malloc (strlen(srcdir) + strlen(fname) + 2); - if (!buf) + if (!buf) exit (8); strcpy (buf, srcdir); strcat (buf, "/"); diff --git a/tests/run-verify.c b/tests/run-verify.c index 4837d9c7..b49ea2ab 100644 --- a/tests/run-verify.c +++ b/tests/run-verify.c @@ -2,17 +2,17 @@ Copyright (C) 2009 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ @@ -63,7 +63,7 @@ print_summary (gpgme_sigsum_t summary) fputs (" sys-error", stdout); } -static void +static void print_validity (gpgme_validity_t val) { const char *s = NULL; @@ -133,7 +133,7 @@ show_usage (int ex) } -int +int main (int argc, char **argv) { int last_argc = -1; @@ -176,17 +176,17 @@ main (int argc, char **argv) } else if (!strncmp (*argv, "--", 2)) show_usage (1); - - } - + + } + if (argc < 1 || argc > 2) show_usage (1); - + fp_sig = fopen (argv[0], "rb"); if (!fp_sig) { err = gpgme_error_from_syserror (); - fprintf (stderr, PGM ": can't open `%s': %s\n", + fprintf (stderr, PGM ": can't open `%s': %s\n", argv[0], gpgme_strerror (err)); exit (1); } @@ -196,7 +196,7 @@ main (int argc, char **argv) if (!fp_msg) { err = gpgme_error_from_syserror (); - fprintf (stderr, PGM ": can't open `%s': %s\n", + fprintf (stderr, PGM ": can't open `%s': %s\n", argv[1], gpgme_strerror (err)); exit (1); } diff --git a/tests/t-data.c b/tests/t-data.c index a319484f..888475fd 100644 --- a/tests/t-data.c +++ b/tests/t-data.c @@ -7,12 +7,12 @@ under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -190,7 +190,7 @@ write_test (round_t round, gpgme_data_t data) } } -int +int main (int argc, char **argv) { round_t round = TEST_INITIALIZER; diff --git a/tests/t-engine-info.c b/tests/t-engine-info.c index 3864fe5f..beb49923 100644 --- a/tests/t-engine-info.c +++ b/tests/t-engine-info.c @@ -2,17 +2,17 @@ Copyright (C) 2003, 2004, 2007 g10 Code GmbH This file is part of GPGME. - + GPGME is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -67,7 +67,7 @@ check_engine_info (gpgme_engine_info_t info, gpgme_protocol_t protocol, } -int +int main (int argc, char **argv ) { gpgme_engine_info_t info; diff --git a/tests/t-version.c b/tests/t-version.c index 06bff60a..97d55a9f 100644 --- a/tests/t-version.c +++ b/tests/t-version.c @@ -7,12 +7,12 @@ under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + GPGME is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -26,7 +26,7 @@ #include -int +int main (int argc, char **argv) { const char *null_result;