From 493a9efa7a2bcd4fedd3be99cd5c6e3801f9a994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20=C3=96lmann?= Date: Fri, 11 Jan 2019 06:19:46 +0100 Subject: [PATCH] mu, tests: fix gcc-8.2.0 warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this commit gcc-8.2.0 whines | CC mu-msg-json.lo | mu-msg-json.c: In function ‘get_temp_file_maybe’: | mu-msg-json.c:254:14: warning: unused variable ‘tmpfile’ [-Wunused-variable] | char *tmp, *tmpfile; | ^~~~~~~ | mu-msg-json.c:254:8: warning: unused variable ‘tmp’ [-Wunused-variable] | char *tmp, *tmpfile; | ^~~ | mu-msg-json.c: In function ‘add_part_crypto’: | mu-msg-json.c:276:21: warning: unused variable ‘s’ [-Wunused-variable] | char *signers, *s; | ^ | mu-msg-json.c:276:11: warning: unused variable ‘signers’ [-Wunused-variable] | char *signers, *s; | ^~~~~~~ | mu-msg-json.c: In function ‘each_part’: | mu-msg-json.c:332:14: warning: variable ‘cid’ set but not used [-Wunused-but-set-variable] | const char *cid; | ^~~ and | CC test-mu-str.o | test-mu-str.c: In function ‘test_mu_str_subject_normalize’: | test-mu-str.c:282:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "test123", "test123" }, | ^~~~~~~~~ | test-mu-str.c:282:16: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "test123", "test123" }, | ^~~~~~~~~ | test-mu-str.c:283:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "Re:test123", "test123" }, | ^~~~~~~~~~~~ | test-mu-str.c:283:19: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "Re:test123", "test123" }, | ^~~~~~~~~ | test-mu-str.c:284:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "Re: Fwd: test123", "test123" }, | ^~~~~~~~~~~~~~~~~~ | test-mu-str.c:284:25: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "Re: Fwd: test123", "test123" }, | ^~~~~~~~~ | test-mu-str.c:285:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "Re[3]: Fwd: test123", "test123" }, | ^~~~~~~~~~~~~~~~~~~~~ | test-mu-str.c:285:28: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "Re[3]: Fwd: test123", "test123" }, | ^~~~~~~~~ | test-mu-str.c:286:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "operation: mindcrime", "operation: mindcrime" }, /*...*/ | ^~~~~~~~~~~~~~~~~~~~~~ | test-mu-str.c:286:29: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "operation: mindcrime", "operation: mindcrime" }, /*...*/ | ^~~~~~~~~~~~~~~~~~~~~~ | test-mu-str.c:287:5: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "", "" } | ^~ | test-mu-str.c:287:9: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | { "", "" } | ^~ --- lib/mu-msg-json.c | 5 ----- lib/tests/test-mu-str.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/mu-msg-json.c b/lib/mu-msg-json.c index dceb6a4a..944fb068 100644 --- a/lib/mu-msg-json.c +++ b/lib/mu-msg-json.c @@ -251,8 +251,6 @@ errexit: static gchar* get_temp_file_maybe (MuMsg *msg, MuMsgPart *part, MuMsgOptions opts) { - char *tmp, *tmpfile; - opts |= MU_MSG_OPTION_USE_EXISTING; if (!(opts & MU_MSG_OPTION_EXTRACT_IMAGES) || @@ -273,7 +271,6 @@ typedef struct _PartInfo PartInfo; static void add_part_crypto (JsonBuilder *bob, MuMsgPart *mpart, PartInfo *pinfo) { - char *signers, *s; const char *verdict; MuMsgPartSigStatusReport *report; @@ -329,13 +326,11 @@ static void each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo) { char *name, *tmpfile; - const char *cid; pinfo->bob = json_builder_begin_object(pinfo->bob); name = mu_msg_part_get_filename (part, TRUE); tmpfile = get_temp_file_maybe (msg, part, pinfo->opts); - cid = mu_msg_part_get_content_id(part); add_int_member (pinfo->bob, "index", part->index); add_string_member (pinfo->bob, "name", name); diff --git a/lib/tests/test-mu-str.c b/lib/tests/test-mu-str.c index bbdb2483..cf3906c4 100644 --- a/lib/tests/test-mu-str.c +++ b/lib/tests/test-mu-str.c @@ -277,7 +277,7 @@ test_mu_str_subject_normalize (void) int i; struct { - char *src, *exp; + const char *src, *exp; } tests[] = { { "test123", "test123" }, { "Re:test123", "test123" },