[gmime] Silenced pedantic compiler warnings in the unit tests



commit e6e4d2144abbf17257836ca3ceaf2ea888acc40c
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Fri Oct 19 17:09:55 2012 -0400

    Silenced pedantic compiler warnings in the unit tests

 tests/test-cat.c     |    2 +-
 tests/test-mbox.c    |   15 ++++++++-------
 tests/test-pgp.c     |   12 ++++++++----
 tests/test-pgpmime.c |   12 ++++++++----
 tests/test-pkcs7.c   |    9 ++++++---
 tests/test-smime.c   |   12 ++++++++----
 tests/test-streams.c |    3 ++-
 7 files changed, 41 insertions(+), 24 deletions(-)
---
diff --git a/tests/test-cat.c b/tests/test-cat.c
index c799a40..9d97ec6 100644
--- a/tests/test-cat.c
+++ b/tests/test-cat.c
@@ -115,7 +115,7 @@ check_streams_match (GMimeStream *orig, GMimeStream *dup, const char *filename,
 	size_t nread, size;
 	ssize_t n;
 	
-	v(fprintf (stdout, "Matching original stream (%lld -> %lld) with %s (%lld, %lld)... ",
+	v(fprintf (stdout, "Matching original stream (%" G_GINT64_FORMAT " -> %" G_GINT64_FORMAT ") with %s (%" G_GINT64_FORMAT ", %" G_GINT64_FORMAT ")... ",
 		   orig->position, orig->bound_end, filename, dup->position, dup->bound_end));
 	
 	if (orig->bound_end != -1) {
diff --git a/tests/test-mbox.c b/tests/test-mbox.c
index bef5904..88ac657 100644
--- a/tests/test-mbox.c
+++ b/tests/test-mbox.c
@@ -92,30 +92,31 @@ header_cb (GMimeParser *parser, const char *header, const char *value, gint64 of
 {
 	GMimeStream *stream = user_data;
 	
-	g_mime_stream_printf (stream, "%lld: %s: %s\n", offset, header, value);
+	g_mime_stream_printf (stream, "%" G_GINT64_FORMAT ": %s: %s\n", offset, header, value);
 }
 
 static void
 test_parser (GMimeParser *parser, GMimeStream *mbox, GMimeStream *summary)
 {
-	gint64 headers_begin, headers_end, start, end;
+	gint64 message_begin, message_end, headers_begin, headers_end;
 	GMimeMessage *message;
 	const char *exev;
 	int nmsg = 0;
 	char *from;
 	
 	while (!g_mime_parser_eos (parser)) {
-		start = g_mime_parser_tell (parser);
+		message_begin = g_mime_parser_tell (parser);
 		if (!(message = g_mime_parser_construct_message (parser)))
 			throw (exception_new ("failed to parse message #%d", nmsg));
 		
-		end = g_mime_parser_tell (parser);
+		message_end = g_mime_parser_tell (parser);
 		
 		headers_begin = g_mime_parser_get_headers_begin (parser);
 		headers_end = g_mime_parser_get_headers_end (parser);
 		
-		g_mime_stream_printf (summary, "message offsets: %lld, %lld\n", start, end);
-		g_mime_stream_printf (summary, "header offsets: %lld, %lld\n",
+		g_mime_stream_printf (summary, "message offsets: %" G_GINT64_FORMAT ", %" G_GINT64_FORMAT "\n",
+				      message_begin, message_end);
+		g_mime_stream_printf (summary, "header offsets: %" G_GINT64_FORMAT ", %" G_GINT64_FORMAT "\n",
 				      headers_begin, headers_end);
 		
 		from = g_mime_parser_get_from (parser);
@@ -197,7 +198,7 @@ streams_match (GMimeStream *istream, GMimeStream *ostream)
 		}
 		
 		if (bufptr < bufend) {
-			sprintf (errstr, "Error: content does not match at offset %lld\n",
+			sprintf (errstr, "Error: content does not match at offset %" G_GINT64_FORMAT "\n",
 				 offset + (bufptr - buf));
 			/*fprintf (stderr, "-->'%.*s'<--\nvs\n-->'%.*s'<--\n",
 			  bufend - bufptr, bufptr, bufend - bufptr, dbufptr);*/
diff --git a/tests/test-pgp.c b/tests/test-pgp.c
index e5dea43..a80354c 100644
--- a/tests/test-pgp.c
+++ b/tests/test-pgp.c
@@ -284,10 +284,13 @@ int main (int argc, char **argv)
 	testsuite_init (argc, argv);
 	
 	/* reset .gnupg config directory */
-	system ("/bin/rm -rf ./tmp");
-	system ("/bin/mkdir ./tmp");
+	if (system ("/bin/rm -rf ./tmp") != 0)
+		return EXIT_FAILURE;
+	if (system ("/bin/mkdir ./tmp") != 0)
+		return EXIT_FAILURE;
 	setenv ("GNUPGHOME", "./tmp/.gnupg", 1);
-	system ("/usr/bin/gpg --list-keys > /dev/null 2>&1");
+	if (system ("/usr/bin/gpg --list-keys > /dev/null 2>&1") != 0)
+		return EXIT_FAILURE;
 	
 	for (i = 1; i < argc; i++) {
 		if (argv[i][0] != '-') {
@@ -401,7 +404,8 @@ int main (int argc, char **argv)
 	
 	g_mime_shutdown ();
 	
-	system ("/bin/rm -rf ./tmp");
+	if (system ("/bin/rm -rf ./tmp") != 0)
+		return EXIT_FAILURE;
 	
 	return testsuite_exit ();
 }
diff --git a/tests/test-pgpmime.c b/tests/test-pgpmime.c
index 0403433..ccf0337 100644
--- a/tests/test-pgpmime.c
+++ b/tests/test-pgpmime.c
@@ -420,10 +420,13 @@ int main (int argc, char *argv[])
 	testsuite_init (argc, argv);
 	
 	/* reset .gnupg config directory */
-	system ("/bin/rm -rf ./tmp");
-	system ("/bin/mkdir ./tmp");
+	if (system ("/bin/rm -rf ./tmp") != 0)
+		return EXIT_FAILURE;
+	if (system ("/bin/mkdir ./tmp") != 0)
+		return EXIT_FAILURE;
 	setenv ("GNUPGHOME", "./tmp/.gnupg", 1);
-	system ("/usr/bin/gpg --list-keys > /dev/null 2>&1");
+	if (system ("/usr/bin/gpg --list-keys > /dev/null 2>&1") != 0)
+		return EXIT_FAILURE;
 	
 	for (i = 1; i < argc; i++) {
 		if (argv[i][0] != '-') {
@@ -486,7 +489,8 @@ int main (int argc, char *argv[])
 	
 	g_mime_shutdown ();
 	
-	system ("/bin/rm -rf ./tmp");
+	if (system ("/bin/rm -rf ./tmp") != 0)
+		return EXIT_FAILURE;
 	
 	return testsuite_exit ();
 }
diff --git a/tests/test-pkcs7.c b/tests/test-pkcs7.c
index 7b49128..8e78f6d 100644
--- a/tests/test-pkcs7.c
+++ b/tests/test-pkcs7.c
@@ -288,8 +288,10 @@ int main (int argc, char **argv)
 	testsuite_init (argc, argv);
 	
 	/* reset .gnupg config directory */
-	system ("/bin/rm -rf ./tmp");
-	system ("/bin/mkdir ./tmp");
+	if (system ("/bin/rm -rf ./tmp") != 0)
+		return EXIT_FAILURE;
+	if (system ("/bin/mkdir ./tmp") != 0)
+		return EXIT_FAILURE;
 	g_setenv ("GNUPGHOME", "./tmp/.gnupg", 1);
 	
 	for (i = 1; i < argc; i++) {
@@ -406,7 +408,8 @@ int main (int argc, char **argv)
 	
 	g_mime_shutdown ();
 	
-	system ("/bin/rm -rf ./tmp");
+	if (system ("/bin/rm -rf ./tmp") != 0)
+		return EXIT_FAILURE;
 	
 	return testsuite_exit ();
 }
diff --git a/tests/test-smime.c b/tests/test-smime.c
index 7e58465..5d6b43b 100644
--- a/tests/test-smime.c
+++ b/tests/test-smime.c
@@ -421,10 +421,13 @@ int main (int argc, char *argv[])
 	testsuite_init (argc, argv);
 	
 	/* reset .gnupg config directory */
-	system ("/bin/rm -rf ./tmp");
-	system ("/bin/mkdir ./tmp");
+	if (system ("/bin/rm -rf ./tmp") != 0)
+		return EXIT_FAILURE;
+	if (system ("/bin/mkdir ./tmp") != 0)
+		return EXIT_FAILURE;
 	g_setenv ("GNUPGHOME", "./tmp/.gnupg", 1);
-	system ("/usr/bin/gpg --list-keys > /dev/null 2>&1");
+	if (system ("/usr/bin/gpg --list-keys > /dev/null 2>&1") != 0)
+		return EXIT_FAILURE;
 	
 	for (i = 1; i < argc; i++) {
 		if (argv[i][0] != '-') {
@@ -487,7 +490,8 @@ int main (int argc, char *argv[])
 	
 	g_mime_shutdown ();
 	
-	system ("/bin/rm -rf ./tmp");
+	if (system ("/bin/rm -rf ./tmp") != 0)
+		return EXIT_FAILURE;
 	
 	return testsuite_exit ();
 }
diff --git a/tests/test-streams.c b/tests/test-streams.c
index d78c77f..750e35f 100644
--- a/tests/test-streams.c
+++ b/tests/test-streams.c
@@ -139,7 +139,8 @@ test_stream_gets (GMimeStream *stream, const char *filename)
 	while (!g_mime_stream_eos (stream)) {
 		rbuf[0] = '\0';
 		slen = g_mime_stream_buffer_gets (stream, sbuf, sizeof (sbuf));
-		fgets (rbuf, sizeof (rbuf), fp);
+		if (!fgets (rbuf, sizeof (rbuf), fp))
+			break;
 		
 		if (strcmp (sbuf, rbuf) != 0)
 			break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]