[gmime: 3/27] Fixed a bunch of compiler warnings in the unit tests
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime: 3/27] Fixed a bunch of compiler warnings in the unit tests
- Date: Thu, 23 Nov 2017 15:44:09 +0000 (UTC)
commit 3becd89eb1933e9731ca08f2dc0a996868a7435f
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date: Tue Nov 7 12:02:13 2017 -0500
Fixed a bunch of compiler warnings in the unit tests
tests/test-pgp.c | 16 ++++++++--------
tests/test-pkcs7.c | 12 ++++++------
tests/testsuite.c | 41 ++++++++++++++++++++---------------------
tests/testsuite.h | 10 +++++-----
4 files changed, 39 insertions(+), 40 deletions(-)
---
diff --git a/tests/test-pgp.c b/tests/test-pgp.c
index c4225da..b3f7c2d 100644
--- a/tests/test-pgp.c
+++ b/tests/test-pgp.c
@@ -403,13 +403,13 @@ int main (int argc, char **argv)
g_mime_stream_reset (istream);
what = "GMimeGpgContext::sign";
- testsuite_check (what);
+ testsuite_check ("%s", what);
try {
test_sign (ctx, FALSE, istream, ostream);
testsuite_check_passed ();
what = "GMimeGpgContext::verify";
- testsuite_check (what);
+ testsuite_check ("%s", what);
g_mime_stream_reset (istream);
g_mime_stream_reset (ostream);
test_verify (ctx, istream, ostream);
@@ -423,13 +423,13 @@ int main (int argc, char **argv)
ostream = g_mime_stream_mem_new ();
what = "GMimeGpgContext::sign (detached)";
- testsuite_check (what);
+ testsuite_check ("%s", what);
try {
test_sign (ctx, TRUE, istream, ostream);
testsuite_check_passed ();
what = "GMimeGpgContext::verify (detached)";
- testsuite_check (what);
+ testsuite_check ("%s", what);
g_mime_stream_reset (istream);
g_mime_stream_reset (ostream);
test_verify_detached (ctx, istream, ostream);
@@ -443,13 +443,13 @@ int main (int argc, char **argv)
ostream = g_mime_stream_mem_new ();
what = "GMimeGpgContext::encrypt";
- testsuite_check (what);
+ testsuite_check ("%s", what);
try {
test_encrypt (ctx, FALSE, istream, ostream);
testsuite_check_passed ();
what = "GMimeGpgContext::decrypt";
- testsuite_check (what);
+ testsuite_check ("%s", what);
g_mime_stream_reset (istream);
g_mime_stream_reset (ostream);
test_decrypt (ctx, FALSE, istream, ostream);
@@ -463,13 +463,13 @@ int main (int argc, char **argv)
ostream = g_mime_stream_mem_new ();
what = "GMimeGpgContext::encrypt+sign";
- testsuite_check (what);
+ testsuite_check ("%s", what);
try {
test_encrypt (ctx, TRUE, istream, ostream);
testsuite_check_passed ();
what = "GMimeGpgContext::decrypt+verify";
- testsuite_check (what);
+ testsuite_check ("%s", what);
g_mime_stream_reset (istream);
g_mime_stream_reset (ostream);
test_decrypt (ctx, TRUE, istream, ostream);
diff --git a/tests/test-pkcs7.c b/tests/test-pkcs7.c
index 93f8e24..086462b 100644
--- a/tests/test-pkcs7.c
+++ b/tests/test-pkcs7.c
@@ -371,13 +371,13 @@ int main (int argc, char **argv)
g_mime_stream_reset (istream);
what = "GMimePkcs7Context::sign";
- testsuite_check (what);
+ testsuite_check ("%s", what);
try {
test_sign (ctx, FALSE, istream, ostream);
testsuite_check_passed ();
what = "GMimePkcs7Context::verify";
- testsuite_check (what);
+ testsuite_check ("%s", what);
g_mime_stream_reset (istream);
g_mime_stream_reset (ostream);
test_verify (ctx, istream, ostream);
@@ -391,13 +391,13 @@ int main (int argc, char **argv)
ostream = g_mime_stream_mem_new ();
what = "GMimePkcs7Context::sign (detached)";
- testsuite_check (what);
+ testsuite_check ("%s", what);
try {
test_sign (ctx, TRUE, istream, ostream);
testsuite_check_passed ();
what = "GMimePkcs7Context::verify (detached)";
- testsuite_check (what);
+ testsuite_check ("%s", what);
g_mime_stream_reset (istream);
g_mime_stream_reset (ostream);
test_verify_detached (ctx, istream, ostream);
@@ -411,13 +411,13 @@ int main (int argc, char **argv)
ostream = g_mime_stream_mem_new ();
what = "GMimePkcs7Context::encrypt";
- testsuite_check (what);
+ testsuite_check ("%s", what);
try {
test_encrypt (ctx, istream, ostream);
testsuite_check_passed ();
what = "GMimePkcs7Context::decrypt";
- testsuite_check (what);
+ testsuite_check ("%s", what);
g_mime_stream_reset (istream);
g_mime_stream_reset (ostream);
test_decrypt (ctx, istream, ostream);
diff --git a/tests/testsuite.c b/tests/testsuite.c
index cd1580c..07f61f6 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -425,12 +425,6 @@ testsuite_setup_gpghome (const char *gpg)
{
char *command;
FILE *fp;
-#if DEBUG_GNUPG
- const char *files[] = { "./tmp/.gnupg/gpg.conf", "./tmp/.gnupg/gpgsm.conf",
"./tmp/.gnupg/gpg-agent.conf", "./tmp/.gnupg/dirmngr.conf", NULL };
- const char debug[] = "log-file socket://%s/tmp/.gnupg/S.log\ndebug 1024\nverbose\n";
- int i;
- char *cwd;
-#endif
/* reset .gnupg config directory */
if (system ("/bin/rm -rf ./tmp") != 0)
@@ -479,25 +473,30 @@ testsuite_setup_gpghome (const char *gpg)
return EXIT_FAILURE;
#if DEBUG_GNUPG
- cwd = g_get_current_dir ();
-
- for (i = 0; files[i]; i++) {
- if (!(fp = fopen (files[i], "a")))
- return EXIT_FAILURE;
+ if (TRUE) {
+ const char *files[] = { "./tmp/.gnupg/gpg.conf", "./tmp/.gnupg/gpgsm.conf",
"./tmp/.gnupg/gpg-agent.conf", "./tmp/.gnupg/dirmngr.conf", NULL };
+ const char debug[] = "log-file socket://%s/tmp/.gnupg/S.log\ndebug 1024\nverbose\n";
+ char *cwd = g_get_current_dir ();
+ int i;
- if (fprintf (fp, debug, cwd) == -1) {
- g_free (cwd);
- fclose (fp);
- return EXIT_FAILURE;
+ for (i = 0; files[i]; i++) {
+ if (!(fp = fopen (files[i], "a")))
+ return EXIT_FAILURE;
+
+ if (fprintf (fp, debug, cwd) == -1) {
+ g_free (cwd);
+ fclose (fp);
+ return EXIT_FAILURE;
+ }
+
+ if (fclose (fp)) {
+ g_free (cwd);
+ return EXIT_FAILURE;
+ }
}
- if (fclose (fp)) {
- g_free (cwd);
- return EXIT_FAILURE;
- }
+ g_free (cwd);
}
-
- g_free (cwd);
#endif
return EXIT_SUCCESS;
diff --git a/tests/testsuite.h b/tests/testsuite.h
index 4a885e9..f8a2970 100644
--- a/tests/testsuite.h
+++ b/tests/testsuite.h
@@ -31,16 +31,16 @@ G_BEGIN_DECLS
void testsuite_init (int argc, char **argv);
int testsuite_exit (void);
-void testsuite_printf (FILE *out, int verbosity, const char *fmt, ...);
+void testsuite_printf (FILE *out, int verbosity, const char *fmt, ...) G_GNUC_PRINTF (3, 4);
void testsuite_vprintf (FILE *out, int verbosity, const char *fmt, va_list args);
/* start/end a test collection */
void testsuite_start (const char *test);
void testsuite_end (void);
-void testsuite_check (const char *checking, ...);
-void testsuite_check_failed (const char *fmt, ...);
-void testsuite_check_warn (const char *fmt, ...);
+void testsuite_check (const char *checking, ...) G_GNUC_PRINTF (1, 2);
+void testsuite_check_failed (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
+void testsuite_check_warn (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
void testsuite_check_passed (void);
int testsuite_total_errors (void);
@@ -60,7 +60,7 @@ typedef struct _Exception {
char *message;
} Exception;
-Exception *exception_new (const char *fmt, ...);
+Exception *exception_new (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
void exception_free (Exception *ex);
/* PRIVATE: do not use! */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]