aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gpgsm
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-09-13 18:48:06 +0000
committerWerner Koch <[email protected]>2016-09-13 18:48:06 +0000
commit9064eebdc05e7149c2c8cc899fbd7874622fb769 (patch)
treee5bffc999f3c38f13cde215945ae8683a5e0c891 /tests/gpgsm
parenttests: Use gpgme_io_write in passhrase callbacks. (diff)
downloadgpgme-9064eebdc05e7149c2c8cc899fbd7874622fb769.tar.gz
gpgme-9064eebdc05e7149c2c8cc899fbd7874622fb769.zip
tests: Mark lots of unused vars and fix const mismatches.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tests/gpgsm')
-rw-r--r--tests/gpgsm/t-decrypt.c12
-rw-r--r--tests/gpgsm/t-encrypt.c12
-rw-r--r--tests/gpgsm/t-export.c12
-rw-r--r--tests/gpgsm/t-genkey.c14
-rw-r--r--tests/gpgsm/t-import.c20
-rw-r--r--tests/gpgsm/t-keylist.c24
-rw-r--r--tests/gpgsm/t-sign.c14
-rw-r--r--tests/gpgsm/t-support.h10
-rw-r--r--tests/gpgsm/t-verify.c16
9 files changed, 69 insertions, 65 deletions
diff --git a/tests/gpgsm/t-decrypt.c b/tests/gpgsm/t-decrypt.c
index 654c7e12..658809c7 100644
--- a/tests/gpgsm/t-decrypt.c
+++ b/tests/gpgsm/t-decrypt.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 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
@@ -48,8 +48,8 @@ static const char test_cip1[] =
"-----END CMS OBJECT-----\n";
-int
-main (int argc, char *argv[])
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -78,7 +78,7 @@ main (int argc, char *argv[])
exit (1);
}
print_data (out);
-
+
gpgme_data_release (in);
gpgme_data_release (out);
gpgme_release (ctx);
diff --git a/tests/gpgsm/t-encrypt.c b/tests/gpgsm/t-encrypt.c
index 45c772b8..50c7a339 100644
--- a/tests/gpgsm/t-encrypt.c
+++ b/tests/gpgsm/t-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
@@ -33,8 +33,8 @@
#include "t-support.h"
-int
-main (int argc, char **argv)
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -54,7 +54,7 @@ main (int argc, char **argv)
err = gpgme_data_new (&out);
fail_if_err (err);
-
+
err = gpgme_get_key (ctx, "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E",
&key[0], 0);
fail_if_err (err);
diff --git a/tests/gpgsm/t-export.c b/tests/gpgsm/t-export.c
index d8856f27..120df6b5 100644
--- a/tests/gpgsm/t-export.c
+++ b/tests/gpgsm/t-export.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 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
@@ -34,15 +34,15 @@
#include "t-support.h"
-int
-main (int argc, char *argv[])
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
gpgme_data_t out;
const char *pattern1[] = { "DFN Top Level Certification Authority", NULL };
const char *pattern2[] = { "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E",
- "DFN Server Certification Authority",
+ "DFN Server Certification Authority",
NULL };
init_gpgme (GPGME_PROTOCOL_CMS);
diff --git a/tests/gpgsm/t-genkey.c b/tests/gpgsm/t-genkey.c
index 9de9d547..fb05034f 100644
--- a/tests/gpgsm/t-genkey.c
+++ b/tests/gpgsm/t-genkey.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 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
@@ -40,6 +40,8 @@ static int progress_called;
static void
progress (void *self, const char *what, int type, int current, int total)
{
+ (void)self;
+
if (!strcmp (what, "primegen") && !current && !total
&& (type == '.' || type == '+' || type == '!'
|| type == '^' || type == '<' || type == '>'))
@@ -57,8 +59,8 @@ progress (void *self, const char *what, int type, int current, int total)
}
-int
-main (int argc, char *argv[])
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -83,7 +85,7 @@ main (int argc, char *argv[])
gpgme_set_armor (ctx, 1);
gpgme_set_progress_cb (ctx, progress, NULL);
-
+
err = gpgme_op_genkey (ctx, parms, certreq, NULL);
fail_if_err (err);
diff --git a/tests/gpgsm/t-import.c b/tests/gpgsm/t-import.c
index adfebaaa..a8dfccaa 100644
--- a/tests/gpgsm/t-import.c
+++ b/tests/gpgsm/t-import.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 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
@@ -36,9 +36,11 @@
void
-check_result (gpgme_import_result_t result, char *fpr, int total,
+check_result (gpgme_import_result_t result, const char *fpr, int total,
int total_stat)
{
+ (void)fpr;
+
if (result->considered != total)
{
fprintf (stderr, "Unexpected number of considered keys %i\n",
@@ -118,14 +120,14 @@ check_result (gpgme_import_result_t result, char *fpr, int total,
result->not_imported);
exit (1);
}
-
+
{
int n;
gpgme_import_status_t r;
for (n=0, r=result->imports; r; r=r->next)
n++;
-
+
if (n != total_stat)
{
fprintf (stderr, "Unexpected number of status reports\n");
@@ -135,8 +137,8 @@ check_result (gpgme_import_result_t result, char *fpr, int total,
}
-int
-main (int argc, char **argv)
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -149,7 +151,7 @@ main (int argc, char **argv)
err = gpgme_new (&ctx);
fail_if_err (err);
-
+
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
err = gpgme_data_new_from_file (&in, cert_1, 1);
diff --git a/tests/gpgsm/t-keylist.c b/tests/gpgsm/t-keylist.c
index 5204ab2e..314109c8 100644
--- a/tests/gpgsm/t-keylist.c
+++ b/tests/gpgsm/t-keylist.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 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
@@ -36,15 +36,15 @@
struct
{
- char *fpr;
+ const char *fpr;
int secret;
long timestamp;
long expires;
- char *issuer_serial;
- char *issuer_name;
- char *chain_id;
- char *uid;
- char *email;
+ const char *issuer_serial;
+ const char *issuer_name;
+ const char *chain_id;
+ const char *uid;
+ const char *email;
gpgme_validity_t validity;
unsigned int key_length;
}
@@ -80,8 +80,8 @@ keys[] =
};
-int
-main (int argc, char **argv)
+int
+main (void)
{
gpgme_error_t err;
gpgme_ctx_t ctx;
@@ -97,7 +97,7 @@ main (int argc, char **argv)
err = gpgme_op_keylist_start (ctx, NULL, 0);
fail_if_err (err);
-
+
while (!(err = gpgme_op_keylist_next (ctx, &key)))
{
if (!keys[i].fpr)
diff --git a/tests/gpgsm/t-sign.c b/tests/gpgsm/t-sign.c
index dc2d841e..d4e143dd 100644
--- a/tests/gpgsm/t-sign.c
+++ b/tests/gpgsm/t-sign.c
@@ -3,17 +3,17 @@
Copyright (C) 2001, 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,8 +80,8 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)
}
-int
-main (int argc, char *argv[])
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -109,8 +109,8 @@ main (int argc, char *argv[])
check_result (result, GPGME_SIG_MODE_NORMAL);
print_data (out);
gpgme_data_release (out);
-
- /* Now a detached signature. */
+
+ /* Now a detached signature. */
gpgme_data_seek (in, 0, SEEK_SET);
err = gpgme_data_new (&out);
fail_if_err (err);
diff --git a/tests/gpgsm/t-support.h b/tests/gpgsm/t-support.h
index ae3ad1f6..c3074db1 100644
--- a/tests/gpgsm/t-support.h
+++ b/tests/gpgsm/t-support.h
@@ -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
@@ -47,7 +47,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_error_from_errno (errno));
@@ -93,7 +93,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/gpgsm/t-verify.c b/tests/gpgsm/t-verify.c
index 901b46fb..004a125e 100644
--- a/tests/gpgsm/t-verify.c
+++ b/tests/gpgsm/t-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
@@ -52,7 +52,7 @@ static const char test_sig1[] =
static void
-check_result (gpgme_verify_result_t result, int summary, char *fpr,
+check_result (gpgme_verify_result_t result, int summary, const char *fpr,
gpgme_error_t status, gpgme_validity_t validity)
{
gpgme_signature_t sig;
@@ -134,8 +134,8 @@ show_auditlog (gpgme_ctx_t ctx)
-int
-main (int argc, char **argv)
+int
+main (void)
{
gpgme_ctx_t ctx;
gpgme_error_t err;
@@ -147,7 +147,7 @@ main (int argc, char **argv)
err = gpgme_new (&ctx);
fail_if_err (err);
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
-
+
/* Checking a valid message. */
err = gpgme_data_new_from_mem (&text, test_text1, strlen (test_text1), 0);
fail_if_err (err);
@@ -179,6 +179,6 @@ main (int argc, char **argv)
gpgme_data_release (text);
gpgme_data_release (sig);
- gpgme_release (ctx);
+ gpgme_release (ctx);
return got_errors? 1 : 0;
}