Codebase list kbd / e00dea9
Cherry-pick const fixup from upstream Andreas Henriksson 4 years ago
2 changed file(s) with 259 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 From: Alex Gladkov <gladkov.alexey@gmail.com>
1 Date: Mon, 16 Dec 2019 16:37:27 +0100
2 Subject: Fix build warining: expected 'char **' but argument is of type
3 'const char **'
4
5 Signed-off-by: Alex Gladkov <gladkov.alexey@gmail.com>
6 ---
7 src/libkeymap/analyze.l | 31 ++++++++++++++++++++++---------
8 src/loadkeys.c | 18 ++++++++++++++----
9 src/loadunimap.c | 13 +++++++++++--
10 src/mapscrn.c | 14 ++++++++++++--
11 src/resizecons.c | 11 +++++++++--
12 src/setfont.c | 42 ++++++++++++++++++++++++++++++------------
13 6 files changed, 98 insertions(+), 31 deletions(-)
14
15 diff --git a/src/libkeymap/analyze.l b/src/libkeymap/analyze.l
16 index e32ace6..9adcea7 100644
17 --- a/src/libkeymap/analyze.l
18 +++ b/src/libkeymap/analyze.l
19 @@ -98,20 +98,33 @@ stack_pop(struct lk_ctx *ctx, void *scanner)
20 * and afterwards use only "loadkeys /fullpath/mykeymap", where no
21 * lookups are required.
22 */
23 -static const char *const include_dirpath0[] = { "", 0 };
24 -static const char *const include_dirpath1[] = { "", "../include/", "../../include/", 0 };
25 -static const char *const include_dirpath3[] = {
26 - DATADIR "/" KEYMAPDIR "/include/",
27 - DATADIR "/" KEYMAPDIR "/i386/include/",
28 - DATADIR "/" KEYMAPDIR "/mac/include/", 0
29 +static char *include_dirpath0[] = {
30 + (char *) "",
31 + NULL
32 +};
33 +static char *include_dirpath1[] = {
34 + (char *) "",
35 + (char *) "../include/",
36 + (char *) "../../include/",
37 + NULL
38 +};
39 +static char *include_dirpath3[] = {
40 + (char *) DATADIR "/" KEYMAPDIR "/include/",
41 + (char *) DATADIR "/" KEYMAPDIR "/i386/include/",
42 + (char *) DATADIR "/" KEYMAPDIR "/mac/include/",
43 + NULL
44 };
45
46 -static const char *const include_suffixes[] = { "", ".inc", 0 };
47 +static char *include_suffixes[] = {
48 + (char *) "",
49 + (char *) ".inc",
50 + NULL
51 +};
52
53 static int
54 find_incl_file_near_fn(struct lk_ctx *ctx, char *s, char *fn, struct kbdfile *fp)
55 {
56 - const char *include_dirpath2[] = { 0, 0, 0, 0 };
57 + char *include_dirpath2[] = { NULL, NULL, NULL, NULL };
58 char *t, *te, *t1 = NULL, *t2 = NULL;
59 size_t len;
60 int rc = 1;
61 @@ -211,7 +224,7 @@ find_incl_file(struct lk_ctx *ctx, char *s, struct kbdfile *fp)
62
63 if ((ev = getenv("LOADKEYS_INCLUDE_PATH")) != NULL) {
64 /* try user-specified path */
65 - const char *user_dir[2] = { 0, 0 };
66 + char *user_dir[2] = { NULL, NULL };
67 while (ev) {
68 int rc;
69 char *t = strchr(ev, ':');
70 diff --git a/src/loadkeys.c b/src/loadkeys.c
71 index 406eef5..5ffa183 100644
72 --- a/src/loadkeys.c
73 +++ b/src/loadkeys.c
74 @@ -24,8 +24,18 @@
75 #include "paths.h"
76 #include "keymap.h"
77
78 -static const char *const dirpath1[] = { "", DATADIR "/" KEYMAPDIR "/**", KERNDIR "/", 0 };
79 -static const char *const suffixes[] = { "", ".kmap", ".map", 0 };
80 +static char *dirpath1[] = {
81 + (char *) "",
82 + (char *) DATADIR "/" KEYMAPDIR "/**",
83 + (char *) KERNDIR "/",
84 + NULL
85 +};
86 +static char *suffixes[] = {
87 + (char *) "",
88 + (char *) ".kmap",
89 + (char *) ".map",
90 + NULL
91 +};
92
93 static void __attribute__((noreturn))
94 usage(int rc)
95 @@ -83,8 +93,8 @@ int main(int argc, char *argv[])
96 };
97 int options = 0;
98
99 - const char *const *dirpath;
100 - const char *dirpath2[] = { 0, 0 };
101 + char **dirpath;
102 + char *dirpath2[] = { NULL, NULL };
103
104 struct lk_ctx *ctx;
105 lk_flags flags = 0;
106 diff --git a/src/loadunimap.c b/src/loadunimap.c
107 index 716c6c3..af4a04e 100644
108 --- a/src/loadunimap.c
109 +++ b/src/loadunimap.c
110 @@ -30,8 +30,17 @@
111 extern char *progname;
112 extern int force;
113
114 -static const char *const unidirpath[] = { "", DATADIR "/" UNIMAPDIR "/", 0 };
115 -static const char *const unisuffixes[] = { "", ".uni", ".sfm", 0 };
116 +static char *unidirpath[] = {
117 + (char *) "",
118 + (char *) DATADIR "/" UNIMAPDIR "/",
119 + NULL
120 +};
121 +static char *unisuffixes[] = {
122 + (char *) "",
123 + (char *) ".uni",
124 + (char *) ".sfm",
125 + NULL
126 +};
127
128 #ifdef MAIN
129 int verbose = 0;
130 diff --git a/src/mapscrn.c b/src/mapscrn.c
131 index 11739e4..5b46973 100644
132 --- a/src/mapscrn.c
133 +++ b/src/mapscrn.c
134 @@ -28,8 +28,18 @@ void loadnewmap(int fd, char *mfil);
135 static int ctoi(char *);
136
137 /* search for the map file in these directories (with trailing /) */
138 -static const char *const mapdirpath[] = { "", DATADIR "/" TRANSDIR "/", 0 };
139 -static const char *const mapsuffixes[] = { "", ".trans", "_to_uni.trans", ".acm", 0 };
140 +static char *mapdirpath[] = {
141 + (char *) "",
142 + (char *) DATADIR "/" TRANSDIR "/",
143 + NULL
144 +};
145 +static char *mapsuffixes[] = {
146 + (char *) "",
147 + (char *) ".trans",
148 + (char *) "_to_uni.trans",
149 + (char *) ".acm",
150 + NULL
151 +};
152
153 #ifdef MAIN
154 int verbose = 0;
155 diff --git a/src/resizecons.c b/src/resizecons.c
156 index ee746f3..c1072d1 100644
157 --- a/src/resizecons.c
158 +++ b/src/resizecons.c
159 @@ -102,8 +102,15 @@ static int vga_get_fontheight(void);
160 static void vga_set_cursor(int, int);
161 static void vga_set_verticaldisplayend_lowbyte(int);
162
163 -const char *const dirpath[] = { "", DATADIR "/" VIDEOMODEDIR "/", 0 };
164 -const char *const suffixes[] = { "", 0 };
165 +char *dirpath[] = {
166 + (char *) "",
167 + (char *) DATADIR "/" VIDEOMODEDIR "/",
168 + NULL
169 +};
170 +char *suffixes[] = {
171 + (char *) "",
172 + NULL
173 +};
174
175 int main(int argc, char **argv)
176 {
177 diff --git a/src/setfont.c b/src/setfont.c
178 index 3e21e7c..6a10365 100644
179 --- a/src/setfont.c
180 +++ b/src/setfont.c
181 @@ -52,11 +52,29 @@ int force = 0;
182 int debug = 0;
183
184 /* search for the font in these directories (with trailing /) */
185 -const char *const fontdirpath[] = { "", DATADIR "/" FONTDIR "/", 0 };
186 -const char *const fontsuffixes[] = { "", ".psfu", ".psf", ".cp", ".fnt", 0 };
187 +char *fontdirpath[] = {
188 + (char *) "",
189 + (char *) DATADIR "/" FONTDIR "/",
190 + NULL
191 +};
192 +char *fontsuffixes[] = {
193 + (char *) "",
194 + (char *) ".psfu",
195 + (char *) ".psf",
196 + (char *) ".cp",
197 + (char *) ".fnt",
198 + NULL
199 +};
200 /* hide partial fonts a bit - loading a single one is a bad idea */
201 -const char *const partfontdirpath[] = { "", DATADIR "/" FONTDIR "/" PARTIALDIR "/", 0 };
202 -const char *const partfontsuffixes[] = { "", 0 };
203 +char *partfontdirpath[] = {
204 + (char *) "",
205 + (char *) DATADIR "/" FONTDIR "/" PARTIALDIR "/",
206 + NULL
207 +};
208 +char *partfontsuffixes[] = {
209 + (char *) "",
210 + NULL
211 +};
212
213 static inline int
214 findfont(char *fnam, struct kbdfile *fp)
215 @@ -205,7 +223,7 @@ int main(int argc, char *argv[])
216 if (!ifilct && !mfil && !ufil &&
217 !Ofil && !ofil && !omfil && !oufil && !restore)
218 /* reset to some default */
219 - ifiles[ifilct++] = "";
220 + ifiles[ifilct++] = (char *) "";
221
222 if (Ofil)
223 saveoldfontplusunicodemap(fd, Ofil);
224 @@ -497,17 +515,17 @@ loadnewfont(int fd, char *ifil, int iunit, int hwunit, int no_m, int no_u)
225 if (iunit < 0 || iunit > 32)
226 iunit = 0;
227 if (iunit == 0) {
228 - if (findfont(ifil = "default", fp) &&
229 - findfont(ifil = "default8x16", fp) &&
230 - findfont(ifil = "default8x14", fp) &&
231 - findfont(ifil = "default8x8", fp)) {
232 + if (findfont(ifil = (char *) "default", fp) &&
233 + findfont(ifil = (char *) "default8x16", fp) &&
234 + findfont(ifil = (char *) "default8x14", fp) &&
235 + findfont(ifil = (char *) "default8x8", fp)) {
236 fprintf(stderr, _("Cannot find default font\n"));
237 exit(EX_NOINPUT);
238 }
239 } else {
240 sprintf(defname, "default8x%d", iunit);
241 if (findfont(ifil = defname, fp) &&
242 - findfont(ifil = "default", fp)) {
243 + findfont(ifil = (char *) "default", fp)) {
244 fprintf(stderr, _("Cannot find %s font\n"), ifil);
245 exit(EX_NOINPUT);
246 }
247 @@ -548,8 +566,8 @@ loadnewfont(int fd, char *ifil, int iunit, int hwunit, int no_m, int no_u)
248
249 /* instructions to combine fonts? */
250 {
251 - char *combineheader = "# combine partial fonts\n";
252 - int chlth = strlen(combineheader);
253 + char *combineheader = (char *) "# combine partial fonts\n";
254 + size_t chlth = strlen(combineheader);
255 char *p, *q;
256 if (inputlth >= chlth && !strncmp(inbuf, combineheader, chlth)) {
257 char *ifiles[MAXIFILES];
22 Various-fixes-to-the-openvt-utility.patch
33 Check-for-X-in-kbd_mode.patch
44 Support-KT_DEAD2-diacritics.patch
5 Fix-build-warining-expected-char-but-argument-is-of-type-.patch