]> granicus.if.org Git - neomutt/commitdiff
Fix conststrings type mismatches. (closes #3926)
authorKevin McCarthy <kevin@8t8.us>
Sat, 18 Mar 2017 20:38:20 +0000 (13:38 -0700)
committerRichard Russon <rich@flatcap.org>
Tue, 21 Mar 2017 16:11:38 +0000 (16:11 +0000)
The generation programs for conststrings.c: txt2c.c and txt2c.sh,
specified the resultant types as "unsigned char[]" while version.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.

version.c

index 6845a8db22e128918d6fcaf792ec3554c2dcf910..93804972f3d7ebe6c10985661a4f4c4fda22f612 100644 (file)
--- a/version.c
+++ b/version.c
@@ -44,9 +44,9 @@ const char * mutt_hcache_backend_list (void);
 
 const int SCREEN_WIDTH = 80;
 
-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 const char *Copyright = N_(
   "Copyright (C) 1996-2016 Michael R. Elkins <me@mutt.org>\n"
@@ -439,13 +439,13 @@ print_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:"));
   print_compile_options();