]> granicus.if.org Git - mutt/commitdiff
Fix conststrings type mismatches. (closes #3926)
authorKevin McCarthy <kevin@8t8.us>
Sat, 18 Mar 2017 20:38:20 +0000 (13:38 -0700)
committerKevin McCarthy <kevin@8t8.us>
Sat, 18 Mar 2017 20:38:20 +0000 (13:38 -0700)
The generation programs for conststrings.c: txt2c.c and txt2c.sh,
specified the resultant types as "unsigned char[]" while main.c
declared them as "const char[]".

txt2.c generates 0xXX hex codes for each individual character, thus
the "unsigned" definition.  With link-time optimization, some versions
of gcc notice the mismatch and emit a warning.

Change the declarations to match the definitions and cast to char[]
when they are used.

main.c

diff --git a/main.c b/main.c
index cafb830deb9fd870074c9f74bf6563b57f514159..0244b2d005783b0019314ca248e5fdbf1500e1f2 100644 (file)
--- a/main.c
+++ b/main.c
@@ -163,9 +163,9 @@ options:\n\
   exit (0);
 }
 
-extern const char cc_version[];
-extern const char cc_cflags[];
-extern const char configure_options[];
+extern unsigned char cc_version[];
+extern unsigned char cc_cflags[];
+extern unsigned char configure_options[];
 
 static char *
 rstrip_in_place(char *s)
@@ -222,13 +222,13 @@ static void show_version (void)
 
   puts ("\n\nCompiler:");
   rstrip_in_place((char *)cc_version);
-  puts (cc_version);
+  puts ((char *)cc_version);
 
   rstrip_in_place((char *)configure_options);
-  printf ("\nConfigure options: %s\n", configure_options);
+  printf ("\nConfigure options: %s\n", (char *)configure_options);
 
   rstrip_in_place((char *)cc_cflags);
-  printf ("\nCompilation CFLAGS: %s\n", cc_cflags);
+  printf ("\nCompilation CFLAGS: %s\n", (char *)cc_cflags);
 
   puts (_("\nCompile options:"));