File: fix-numerous-compilation-errors.patch

package info (click to toggle)
scm 5f4-3.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,320 kB
  • sloc: ansic: 58,822; lisp: 17,257; makefile: 1,241; sh: 555; asm: 288
file content (359 lines) | stat: -rw-r--r-- 11,874 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
From: Gwen Weinholt <git@weinholt.se>
Date: Sun, 22 Sep 2024 19:36:08 +0200
Subject: Fix numerous compilation errors

---
 crs.c     | 15 ++++++++++-----
 differ.c  |  6 +++---
 posix.c   |  2 +-
 repl.c    | 18 +++++++++---------
 scm.c     | 11 ++++++-----
 scm.h     |  6 +++---
 scmmain.c |  7 ++++---
 script.c  | 23 ++++++++++++-----------
 x.c       |  6 +++---
 x.h       |  3 ++-
 10 files changed, 53 insertions(+), 44 deletions(-)

diff --git a/crs.c b/crs.c
index 87197a7..1fdbb3f 100755
--- a/crs.c
+++ b/crs.c
@@ -69,9 +69,10 @@ static ptobfuns winptob = {
   bwaddch,
   bwaddstr,
   bwwrite,
-  wrefresh,
-  wgetch,
-  freewindow};
+  (int (*)(FILE *))wrefresh,
+  (int (*)(FILE *))wgetch,
+  freewindow,
+  0};
 
 SCM mkwindow(win)
      WINDOW *win;
@@ -100,6 +101,10 @@ SCM lendwin()
   if (IMP(*loc_stdscr)) return BOOL_F;
   return ERR==endwin() ? BOOL_F : BOOL_T;
 }
+void lendwin_void()
+{
+  (void)lendwin();
+}
 
 static char s_newwin[] = "newwin", s_subwin[] = "subwin", s_mvwin[] = "mvwin",
 	    s_overlay[] = "overlay", s_overwrite[] = "overwrite";
@@ -238,7 +243,7 @@ SCM lunctrl(c)
 {
   ASRTER(ICHRP(c), c, ARG1, s_unctrl);
   {
-    char *str = unctrl(ICHR(c));
+    const char *str = unctrl(ICHR(c));
     return makfrom0str(str);
   }
 }
@@ -387,5 +392,5 @@ void init_crs()
   make_subr(s_mvwin, tc7_subr_3, lmvwin);
   make_subr(s_box, tc7_subr_3, lbox);
   add_feature("curses");
-  add_final(lendwin);
+  add_final(lendwin_void);
 }
diff --git a/differ.c b/differ.c
index fcff12e..dcdb6c7 100755
--- a/differ.c
+++ b/differ.c
@@ -65,17 +65,17 @@ SCM_EXPORT SCM  diff2editlen P((SCM Fp, SCM A, SCM Args));
 #define MAX(a,b)		(a<b ? b : a)
 #define MIN(a,b)		(a>b ? b : a)
 
-I32 *long_subarray(ra, start, end)
+void *long_subarray(ra, start, end)
      I32 *ra; int start, end;
 {
   return &(ra[start]);
 }
-short *short_subarray(ra, start, end)
+void *short_subarray(ra, start, end)
      short *ra; int start, end;
 {
   return &(ra[start]);
 }
-char *char_subarray(ra, start, end)
+void *char_subarray(ra, start, end)
      char *ra; int start, end;
 {
   return &(ra[start]);
diff --git a/posix.c b/posix.c
index 159dba2..ecf597b 100644
--- a/posix.c
+++ b/posix.c
@@ -191,7 +191,7 @@ SCM l_grinfo(name)
   ve[ 0] = makfrom0str(entry->gr_name);
   ve[ 1] = makfrom0str(entry->gr_passwd);
   ve[ 2] = ulong2num((unsigned long)entry->gr_gid);
-  ve[ 3] = makfromstrs(-1, entry->gr_mem);
+  ve[ 3] = makfromstrs(-1, (const char * const*)entry->gr_mem);
   return ans;
 }
 SCM l_setgr(arg)
diff --git a/repl.c b/repl.c
index 8197e4a..ce0f770 100644
--- a/repl.c
+++ b/repl.c
@@ -1288,7 +1288,7 @@ int scm_verbose = 1;		/* Low so that monitor info won't be */
 static int errjmp_recursive = 0;
 static int errobj_codep;
 static SCM err_exp, err_env;
-static char *err_pos, *err_s_subr;
+static const char *err_pos, *err_s_subr;
 static cell tmp_errobj = {(SCM)UNDEFINED, (SCM)EOL};
 static cell tmp_loadpath = {(SCM)BOOL_F, (SCM)EOL};
 SCM *loc_errobj = (SCM *)&tmp_errobj;
@@ -1308,7 +1308,7 @@ int handle_it(i)
   SCM proc;
   char *name = errmsgs[i-WNA].s_response;
   if (errjmp_bad || errjmp_recursive)
-    wta(UNDEFINED, (char *)i, ""); /* sends it to def_err_response */
+    wta(UNDEFINED, (char *)(intptr_t)i, ""); /* sends it to def_err_response */
   /* NEWCELL does not defer interrupts; so be careful to maintain the
      freelist integrity. */
   if (name) {
@@ -2112,14 +2112,14 @@ static void def_err_response()
     lputc((short)err_pos <= ARGn ? ' ' : '1' + (short)err_pos - ARG1, cur_errp);
   }
 #else
-  if ((~0x1fL) & (long)err_pos) lputs(err_pos, cur_errp);
-  else if (WNA > (long)err_pos) {
+  if ((~0x1fL) & (intptr_t)err_pos) lputs(err_pos, cur_errp);
+  else if (WNA > (intptr_t)err_pos) {
     lputs("Wrong type in arg", cur_errp);
-    lputc((long)err_pos <= ARGn ? ' ' : '1' + (int)err_pos - ARG1, cur_errp);
+    lputc((intptr_t)err_pos <= ARGn ? ' ' : '1' + (intptr_t)err_pos - ARG1, cur_errp);
   }
 #endif
-  else lputs(errmsgs[((int)err_pos)-WNA].msg, cur_errp);
-  lputs(((long)err_pos==WNA)?" given ":" ", cur_errp);
+  else lputs(errmsgs[((intptr_t)err_pos)-WNA].msg, cur_errp);
+  lputs(((intptr_t)err_pos==WNA)?" given ":" ", cur_errp);
   err_pos = 0;
   if (!UNBNDP(obj))
     if (reset_safeport(sys_safep, 55, cur_errp))
@@ -2176,8 +2176,8 @@ void everr(exp, env, arg, pos, s_subr, codep)
   errobj_codep = codep;
   if (errjmp_bad || errjmp_recursive) def_err_response();
   longjump(CONT(rootcont)->jmpbuf,
-	   (~0x1fL) & (long)pos || (WNA > (long)pos) ?
-	   COOKIE(1) : COOKIE((int)pos));
+	   (~0x1fL) & (intptr_t)pos || (WNA > (intptr_t)pos) ?
+	   COOKIE(1) : COOKIE((intptr_t)pos));
   /* will do error processing at stack base */
 }
 void wta(arg, pos, s_subr)
diff --git a/scm.c b/scm.c
index f6766d6..20c4355 100644
--- a/scm.c
+++ b/scm.c
@@ -165,7 +165,8 @@ static struct {
 
 void process_signals()
 {
-  int i, n;
+  int i;
+  size_t n;
   unsigned long mask = 1L;
   /* printf("process_signals; output_deferred=%d\n", output_deferred); fflush(stdout); */
   if (output_deferred) {
@@ -177,7 +178,7 @@ void process_signals()
       i = n + SIGNAL_BASE;
       SIG_deferred &= ~mask;
       if (i != handle_it(i))
-	wta(UNDEFINED, (char *)i, "");
+       wta(UNDEFINED, (char *)(intptr_t)i, "");
     }
     mask <<= 1;
   }
@@ -260,7 +261,7 @@ static SIGRETTYPE err_signal(sig)
   signal(sig, err_signal);
   while (i--)
     if (sig == sigdesc[i].signo) break;
-  wta(MAKINUM(sig), (i < 0 ? s_unksig : (char *)(i + SIGNAL_BASE)), "");
+  wta(MAKINUM(sig), (i < 0 ? s_unksig : (char *)(intptr_t)(i + SIGNAL_BASE)), "");
 }
 
 static SIGRETTYPE scmable_signal(sig)
@@ -291,7 +292,7 @@ static SIGRETTYPE scmable_signal(sig)
     i += SIGNAL_BASE;
     if (i != handle_it(i)) {
       errno = oerr;
-      wta(UNDEFINED, (char *)i, "");
+      wta(UNDEFINED, (char *)(intptr_t)i, "");
     }
   }
   errno = oerr;
@@ -669,7 +670,7 @@ void restore_signals()
 void scm_init_from_argv(argc, argv, script_arg, iverbose, buf0stdin)
      int argc;
      const char * const *argv;
-     char *script_arg;
+     const char *script_arg;
      int iverbose;
      int buf0stdin;
 {
diff --git a/scm.h b/scm.h
index 870c369..834c9ce 100644
--- a/scm.h
+++ b/scm.h
@@ -784,7 +784,7 @@ SCM_EXPORT void init_iprocs P((iproc *subra, int type));
 SCM_EXPORT void final_scm P((int));
 SCM_EXPORT void init_sbrk P((void));
 SCM_EXPORT int  init_buf0 P((FILE *inport));
-SCM_EXPORT void scm_init_from_argv P((int argc, const char * const *argv, char *script_arg,
+SCM_EXPORT void scm_init_from_argv P((int argc, const char * const *argv, const char *script_arg,
                               int iverbose, int buf0stdin));
 SCM_EXPORT void init_signals P((void));
 SCM_EXPORT SCM  scm_top_level P((char *initpath, SCM (*toplvl_fun)()));
@@ -1095,8 +1095,8 @@ SCM_EXPORT int  scm_bigdblcomp P((SCM b, double d));
 SCM_EXPORT char *       scm_cat_path P((char *str1, const char *str2, long n));
 SCM_EXPORT char *       scm_try_path P((char *path));
 SCM_EXPORT char *       script_find_executable P((const char *command));
-SCM_EXPORT char **      script_process_argv P((int argc, const char **argv));
-SCM_EXPORT int  script_count_argv P((const char **argv));
+SCM_EXPORT const char *const *script_process_argv P((int argc, const char *const *argv));
+SCM_EXPORT int  script_count_argv P((const char *const *argv));
 SCM_EXPORT char *       find_impl_file P((const char *exec_path, const char *generic_name,
                           const char *initname, const char *sep));
 
diff --git a/scmmain.c b/scmmain.c
index ace196d..ec75229 100755
--- a/scmmain.c
+++ b/scmmain.c
@@ -83,10 +83,11 @@ void scmmain_init_user_scm();
 
 int main(argc, argv)
      int argc;
-     const char **argv;
+     const char *const *argv;
 {
-  char *script_arg = 0;		/* location of SCSH style script file or 0. */
-  char *implpath = 0, **nargv;
+  const char *script_arg = 0; /* location of SCSH style script file or 0. */
+  char *implpath = 0;
+  const char *const *nargv;
   int nargc, iverbose = 0, buf0stdin;
   SCM retval;
 /* added by Dai Inukai 2001-03-21 */
diff --git a/script.c b/script.c
index 5a80186..910d213 100755
--- a/script.c
+++ b/script.c
@@ -146,7 +146,7 @@ char *find_impl_file(exec_path, generic_name, initname, sep)
      const char *generic_name, *initname, *sep;
 {
   char *sepptr = strrchr(exec_path, sep[0]);
-  char *extptr = exec_path + strlen(exec_path);
+  const char *extptr = exec_path + strlen(exec_path);
   char *path = 0;
 
 #ifdef _WIN32
@@ -192,7 +192,7 @@ char *find_impl_file(exec_path, generic_name, initname, sep)
 
       /* Look for initname in peer directory "lib". */
       if (path) {
-	strncpy(sepptr, "lib", 3);
+	strncpy(sepptr, "lib", 4);
 	path = scm_sep_init_try(path, sep, initname);
 	if (path) return path;
       }
@@ -351,15 +351,16 @@ int script_meta_arg_P(arg)
 #endif
 }
 
-char **script_process_argv(argc, argv)
+const char *const *script_process_argv(argc, argv)
      int argc;
-     const char **argv;
+     const char *const *argv;
 {
   int nargc = argc, argi = 1, nargi = 1;
-  char *narg, **nargv;
+  char *narg;
+  const char **nargv;
   if (!(argc > 2 && script_meta_arg_P(argv[1]))) return 0L;
-  if (!(nargv = (char **)malloc((1 + nargc) * sizeof(char *)))) return 0L;
-  nargv[0] = argv[0];
+  if (!(nargv = malloc((1 + nargc) * sizeof(char *)))) return 0L;
+  nargv[0] = (char *)argv[0];
   while (((argi+1) < argc) && (script_meta_arg_P(argv[argi]))) {
     FILE *f = fopen(argv[++argi], "r");
     if (f) {
@@ -370,19 +371,19 @@ char **script_process_argv(argc, argv)
       case '\n': goto found_args;
       }
     found_args: while ((narg = script_read_arg(f)))
-      if (!(nargv = (char **)realloc(nargv, (1 + ++nargc) * sizeof(char *))))
+      if (!(nargv = realloc(nargv, (1 + ++nargc) * sizeof(char *))))
 	return 0L;
       else nargv[nargi++] = narg;
       fclose(f);
-      nargv[nargi++] = argv[argi++];
+      nargv[nargi++] = (char *)argv[argi++];
     }
   }
-  while (argi <= argc) nargv[nargi++] = argv[argi++];
+  while (argi <= argc) nargv[nargi++] = (char *)argv[argi++];
   return nargv;
 }
 
 int script_count_argv(argv)
-     const char **argv;
+     const char *const *argv;
 {
   int argc = 0;
   while (argv[argc]) argc++;
diff --git a/x.c b/x.c
index e6db874..3b6584c 100755
--- a/x.c
+++ b/x.c
@@ -334,7 +334,7 @@ SCM make_xcolormap(sdpy, cmp)
   xcm->display = sdpy;
   xcm->dpy = DISPLAY(xcm->display)->dpy;
   xcm->cm = cmp;
-  XSaveContext(XDISPLAY(sdpy), (XID)cmp, xtc_cmp, z);
+  XSaveContext(XDISPLAY(sdpy), (XID)cmp, xtc_cmp, (void*)(intptr_t)z);
   ALLOW_INTS;
   return z;
 }
@@ -582,7 +582,7 @@ SCM CCC2SCM(ccc)
     DEFER_INTS;
     CAR(s_ccc) = tc16_xccc;
     SETCDR(s_ccc, ccc);
-    XSaveContext(ccc->dpy, (XID)ccc, xtc_ccc, s_ccc);
+    XSaveContext(ccc->dpy, (XID)ccc, xtc_ccc, (void*)(intptr_t)s_ccc);
     ALLOW_INTS;
   }
   return s_ccc;
@@ -2050,7 +2050,7 @@ SCM x_fill_rectangle(swin, sgc, sargs)
 
 void xldraw_string(sdbl, sgc, sargs, proc, s_caller)
      SCM sdbl, sgc, sargs;
-     int (*proc)();
+     XDrawStringFunc proc;
      char *s_caller;
 {
   XPoint position;
diff --git a/x.h b/x.h
index 4423211..6c52a9f 100755
--- a/x.h
+++ b/x.h
@@ -82,7 +82,8 @@ SCM x_get_window_property(SCM swin, SCM sprop, SCM sargs);
 SCM x_list_properties(SCM swin);
 SCM x_clear_area(SCM swin, SCM spos, SCM sargs);
 SCM x_fill_rectangle(SCM swin, SCM sgc, SCM sargs);
-void xldraw_string(SCM sdbl, SCM sgc, SCM sargs, int (*proc)(void), char *s_caller);
+typedef int (*XDrawStringFunc)(Display *, Drawable, GC, int, int, const char *, int);
+void xldraw_string(SCM sdbl, SCM sgc, SCM sargs, XDrawStringFunc proc, char *s_caller);
 SCM x_draw_string(SCM sdbl, SCM sgc, SCM sargs);
 SCM x_image_string(SCM sdbl, SCM sgc, SCM sargs);
 SCM x_draw_points(SCM sdbl, SCM sgc, SCM sargs);