[PATCH:mkfontscale 2/2] Add some const.

Thomas Klausner wiz at NetBSD.org
Tue Mar 18 15:21:15 PDT 2014


Sorry, I got the commit message wrong.

Here's the right one:

>From fc5a9c8fa6e405c144892849a3a3d40a8513a8f7 Mon Sep 17 00:00:00 2001
From: Thomas Klausner <wiz at NetBSD.org>
Date: Tue, 18 Mar 2014 23:15:20 +0100
Subject: [PATCH:mkfontscale 2/2] Avoid const warnings.

clang complains about both arrays:
mkfontscale.c:160:26: warning: passing 'const char *[51]' to parameter of type 'char **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
    encodings = makeList(encodings_array, countof(encodings_array), NULL, 0);
                         ^~~~~~~~~~~~~~~
./list.h:42:25: note: passing argument to parameter 'a' here
ListPtr makeList(char **a, int n, ListPtr old, int begin);
                        ^
mkfontscale.c:162:32: warning: passing 'const char *[3]' to parameter of type 'char **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
    extra_encodings = makeList(extra_encodings_array,
                               ^~~~~~~~~~~~~~~~~~~~~
./list.h:42:25: note: passing argument to parameter 'a' here
ListPtr makeList(char **a, int n, ListPtr old, int begin);
                        ^

Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
 mkfontscale.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mkfontscale.c b/mkfontscale.c
index 036a0b4..a81e60a 100644
--- a/mkfontscale.c
+++ b/mkfontscale.c
@@ -66,7 +66,7 @@
 #define QUOTE(x)	#x
 #define STRINGIFY(x)	QUOTE(x)
 
-static const char *encodings_array[] =
+static char *encodings_array[] =
     { "ascii-0",
       "iso8859-1", "iso8859-2", "iso8859-3", "iso8859-4", "iso8859-5",
       "iso8859-6", "iso8859-6.8", "iso8859-6.8x", "iso8859-6.16",
@@ -85,7 +85,7 @@ static const char *encodings_array[] =
       "gb2312.1980-0", "gb18030.2000-0", "gb18030.2000-1",
       "ksc5601.1987-0", "ksc5601.1992-3"};
 
-static const char *extra_encodings_array[] =
+static char *extra_encodings_array[] =
     { "iso10646-1", "adobe-fontspecific", "microsoft-symbol" };
 
 static ListPtr encodings, extra_encodings;
-- 
1.9.0


More information about the xorg-devel mailing list