summaryrefslogtreecommitdiff
path: root/graphics/xfpovray/files/patch-warnings
blob: 23a213199904b104e517f0721f7bdf3368f3a8dd (plain) (blame)
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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
--- flx/flx_show_dialog/flx_show_dialog.c	1998-01-11 10:51:40.000000000 -0500
+++ flx/flx_show_dialog/flx_show_dialog.c	2015-03-09 00:09:19.000000000 -0400
@@ -56,6 +56,6 @@
 ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-
-#include "forms.h"
+#include <stdlib.h>
+#include <forms.h>
 #include "flx.h"
 #include "flx_show_dialog.h" /* Internal to this routine */
@@ -68,9 +68,4 @@
 
 static void usage();
-void flx_set_dialog_lcol();
-void flx_set_dialog_font();
-void flx_set_dialog_color();
-void flx_set_dialog_bgcolor();
-
  
  
--- flx/flx_util/flx_justify_input.c	1998-02-20 20:00:26.000000000 -0500
+++ flx/flx_util/flx_justify_input.c	2015-03-08 23:15:09.000000000 -0400
@@ -30,13 +30,10 @@
 
 
-#include "forms.h"
+#include <forms.h>
+#include "flx.h"
 
 #include <stdlib.h>
 #include <string.h>
 
-
-void flx_justify_input(FL_OBJECT *input_obj, char *string, int STYLE, int SIZE);
-
-
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
-void flx_justify_input(FL_OBJECT *input_obj, char *string, int STYLE, int SIZE)
+void flx_justify_input(FL_OBJECT *input_obj, const char *string, int STYLE, int SIZE)
--- flx/flx_util/flx_scale_form.c	1997-09-02 21:57:24.000000000 -0400
+++ flx/flx_util/flx_scale_form.c	2015-03-08 23:18:56.000000000 -0400
@@ -22,5 +22,5 @@
 
-
-#include "forms.h"
+#include <forms.h>
+#include "flx.h"
 
 #include <stdio.h>
@@ -29,7 +30,4 @@
 
 
-void flx_scale_form(FL_FORM *form);
-
-
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
 /* Scales a form based on the current font */
--- flx/flx_filebox/flx_filebox.c	1998-02-21 12:38:23.000000000 -0500
+++ flx/flx_filebox/flx_filebox.c	2015-03-08 23:29:18.000000000 -0400
@@ -59,5 +59,5 @@
 #include <unistd.h>
 
-#include "forms.h"
+#include <forms.h>
 #include "flx.h" 
 #include "flx_filebox.h"
@@ -65,7 +65,4 @@
 #define USE_COLOR 1
 
-
-
- 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 char *flx_filebox(const char *directory, 
@@ -272,5 +269,5 @@
         fl_set_object_posthandler(theForm->file_input, change_focus);
 
-        if ((default_file != "") && (default_file != NULL)) {
+        if (default_file != NULL && default_file[0] != '\0') {
            fl_set_input(theForm->file_input, default_file);
            flx_justify_input (theForm->file_input, default_file, 
@@ -589,21 +586,18 @@
     struct dirent **dir_s;
     int i, numEntries;
-    
-    struct stat *stat_buf = (struct stat *) vmalloc (sizeof(struct stat));    
+ 
+    struct stat *stat_buf = vmalloc (sizeof(struct stat));    
     int filetype;
         
     char *sfile;
-    char *file_color     = "@C0"; /* default black */ 
-    char *link_color     = "@C0"; 
-    char *dir_color      = "@C0"; 
-    char *chardev_color  = "@C0"; 
-    char *blockdev_color = "@C0"; 
-    char *socket_color   = "@C0"; 
-    char *fifo_color     = "@C0"; 
+    const char *file_color     = "@C0"; /* default black */ 
+    const char *link_color     = "@C0"; 
+    const char *dir_color      = "@C0"; 
+    const char *chardev_color  = "@C0"; 
+    const char *blockdev_color = "@C0"; 
+    const char *socket_color   = "@C0"; 
+    const char *fifo_color     = "@C0"; 
 
     char *currentFile;
-    int currentWidth, maxWidth = 0;
-    int min_browser_width = 175;     
-
 
     if (USE_COLOR) {
@@ -656,5 +650,5 @@
 */
 
-        currentFile = (char *) vmalloc (strlen(theForm->dir) + strlen("/") +
+        currentFile = vmalloc (strlen(theForm->dir) + strlen("/") +
             strlen(dir_s[i]->d_name) + 1);
         sprintf(currentFile, "%s/%s", theForm->dir, dir_s[i]->d_name);
@@ -683,5 +677,5 @@
         
         /* Filename used for display in filebox: add color */
-        sfile = (char *) vmalloc (strlen(dir_s[i]->d_name) + 3 + 1);
+        sfile = vmalloc (strlen(dir_s[i]->d_name) + 3 + 1);
                 
         switch (filetype) {
@@ -761,18 +755,5 @@
     free(stat_buf);
 
-
-/*
-    if (maxWidth > min_browser_width) {
-       fl_set_object_geometry(theForm->file_browser, 
-           230, 40, wide_string_p + 20, 165);
-    }
-    else {
-       fl_set_object_geometry(theForm->file_browser, 
-           230, 40, 190, 165);    
-    }
-*/
-
     fl_unfreeze_form(theForm->main);
-    
 
 } /* end function parse_dir() */
@@ -804,5 +785,5 @@
 
     
-    chunk = (void *) malloc (chunk_size);
+    chunk = malloc (chunk_size);
     if (chunk == NULL) {
        perror("flx_filebox");
--- flx/flx.h	1997-11-10 22:57:34.000000000 -0500
+++ flx/flx.h	2015-03-08 23:32:37.000000000 -0400
@@ -61,4 +61,16 @@
 extern FL_FORM *flx_help_dialog(const char *help_text);
 
+int flx_show_dialog (const char *type_str, const char *message_str);
+void flx_set_dialog_bgcolor (int theBgColor);
+void flx_set_dialog_color (int theInactiveColor, int theActiveColor);
+void flx_set_dialog_font (int theLabelStyle, int theLabelSize);
+void flx_set_dialog_lcol (int theLabelColor);
+
+void flx_justify_input(FL_OBJECT *input_obj, const char *string, int STYLE, int SIZE);
+
+void flx_scale_form(FL_FORM *form);
+char *flx_filebox(const char *dir, const char *pattern, const char *default_file);
+
+char *flx_show_input (int type, const char *message_str, const char *initial);
 
 #endif /* FLX_H */
--- flx/flx_filebox/flx_filebox.h	1997-09-03 22:28:48.000000000 -0400
+++ flx/flx_filebox/flx_filebox.h	2015-03-08 23:37:08.000000000 -0400
@@ -55,5 +55,4 @@
 static void FilterCB   (FL_OBJECT *ob, long data);
 static void LocationCB (FL_OBJECT *ob, long data);
-static void QuitCB     (FL_OBJECT *ob, long data);
 
 /* 
--- src/build_pages.c	1998-02-22 22:53:11.000000000 -0500
+++ src/build_pages.c	2015-03-09 00:15:48.000000000 -0400
@@ -1,3 +1,4 @@
-#include "forms.h"
+#include <forms.h>
+#include "flx.h"
 #include "xfpovray.h"
 #include "pov-defaults.h"
--- flx/flx_show_dialog/flx_show_input.c	1998-01-31 20:39:42.000000000 -0500
+++ flx/flx_show_dialog/flx_show_input.c	2015-03-09 00:36:57.000000000 -0400
@@ -48,6 +48,6 @@
 ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-
-#include "forms.h"
+#include <forms.h>
+#include "flx.h"
 #include "question.xpm"
 
@@ -58,10 +58,4 @@
 extern int FLX_DIALOG_LSTYLE;
 extern int FLX_DIALOG_LSIZE;
-
-void flx_set_dialog_lcol();
-void flx_set_dialog_font();
-void flx_set_dialog_color();
-void flx_set_dialog_bgcolor();
-
  
  
@@ -73,5 +67,4 @@
     FL_OBJECT *obj, *obj_input, *ret;
 
-    int button_width  = 70;
     int button_height = 25;
     int min_x         = 180;
@@ -82,6 +75,4 @@
                     
     int label_width, label_height;
-    int button_label_width, button_label_height;
-    int status = 0;
     int form_x, form_y, yoffset, ymax_height;
     char **discriminator;
--- src/xfpovray.h	1998-02-22 23:29:43.000000000 -0500
+++ src/xfpovray.h	2015-03-09 00:39:07.000000000 -0400
@@ -140,8 +140,10 @@
 void YesNoCB		   (FL_OBJECT *obj, long data);
 
-/* 
+/*
 ** Other utility functions 
 */
-void write_config (char *ini_file);
+
+int read_config(const char *ini_file);
+void write_config (const char *ini_file);
 void show_image   (void);
 void save_state   (void);
@@ -320,3 +322,7 @@
 #endif
 
+int tokenize(char *command_string, char *tokenlist[], size_t maxtoken);
+char *strtruncate (char *string, char endat);
+
+void showtip(FL_OBJECT *ob, char *s);
 #endif /* XFPOVRAY_H */
--- src/callbacks.c	1998-02-22 22:33:45.000000000 -0500
+++ src/callbacks.c	2015-03-09 00:38:37.000000000 -0400
@@ -3,6 +3,7 @@
 */
 
-
-#include "forms.h"
+#include <time.h>
+#include <forms.h>
+#include "flx.h"
 #include "xfpovray.h"
 #include "pov-defaults.h"
@@ -29,10 +30,6 @@
 extern char *TEMP_FILE;
  
-extern void write_config(char *ini_file);
 extern int  povray_pid;
 extern int  auto_view;
-extern void show_image(void);
-extern int  PovCheckCB(XEvent *ev, void *data);
-extern void run_program  (int count, ...);
  
 struct preview_options {
@@ -157,5 +154,5 @@
                       temp = (char *) fl_calloc (1, 
 			  strlen(fl_get_input (xfData->sceneFileInput)) + 1);
-                      sprintf(temp, fl_get_input (xfData->sceneFileInput));
+                      strcpy(temp, fl_get_input (xfData->sceneFileInput));
 
 		      path = (char *) fl_calloc (1, strlen(temp) + 1);
@@ -168,5 +165,5 @@
 		      }
 		      basename = (char *) fl_calloc (1, strlen(tokenList[i])+1);
-		      sprintf(basename, tokenList[i]);
+		      strcpy(basename, tokenList[i]);
                       strtruncate (basename, '.');
                       strcat(basename, ".ini");		      
@@ -607,5 +604,4 @@
 void GetFileCB(FL_OBJECT *ob, long data)
 {   
-    int pid, type;
     char *temp;
 
@@ -805,5 +801,5 @@
     char temp[256];
     char buf[256];
-    int i, pid, key;
+    int key;
     char *t;
  
@@ -1219,5 +1215,4 @@
 void QuitCB(FL_OBJECT *ob, long data)
 { 
-    int pid;
     char *temp;
     int menuItem = fl_get_menu(ob);
--- src/config.c	1998-02-22 23:38:31.000000000 -0500
+++ src/config.c	2015-03-09 00:45:15.000000000 -0400
@@ -3,5 +3,7 @@
 */
 
-#include "forms.h"
+#include <stdlib.h>
+#include <forms.h>
+#include "flx.h"
 #include "xfpovray.h"
 #include "pov-defaults.h"
@@ -29,14 +31,12 @@
 ** Function to write the POV-Ray configuration file 
 */
-void write_config(char *ini_file)
+void write_config(const char *ini_file)
 {
     FILE *options_file;
-    int i, do_free = FALSE;
-   
-    
+    int i;
+
+
     if (ini_file == NULL) {
-       ini_file = (char *) fl_calloc (1, strlen(POV_INIFILE) + 1);
-       sprintf(ini_file, "%s", POV_INIFILE);
-       do_free = TRUE;
+       ini_file = POV_INIFILE;
     }
               
@@ -228,9 +228,4 @@
     fl_load_browser (configPage->configBrowser, ini_file);    
     fl_unfreeze_form (configPage->form);
-    
-    if (do_free)
-       free (ini_file);
-
- 
 }
 
@@ -240,5 +235,5 @@
 ** Function to read the POV-Ray configuration file, and update widget values 
 */
-int read_config(char *ini_file)
+int read_config(const char *ini_file)
 {
 
--- src/run_program.c	1998-01-31 17:24:36.000000000 -0500
+++ src/run_program.c	2015-03-08 23:02:20.000000000 -0400
@@ -11,7 +11,11 @@
 */
 
+#include <err.h>
 #include <stdarg.h>
+#include <stdlib.h>
 #include <stdio.h>
-
+#include <unistd.h>
+#include <forms.h>
+#include "xfpovray.h"
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
@@ -24,5 +26,4 @@
     
-
-    arg_list = (char **) malloc ((count + 1) * sizeof(char *));
+    arg_list = malloc ((count + 1) * sizeof(char *));
     if (arg_list == NULL) {
        perror ("run_program");
@@ -49,18 +51,15 @@
     ** Run the program as a child process 
     */    
-    pid = fork();
+    pid = vfork();
     if (pid == 0) {
        if (execvp (program, arg_list) == -1) {
-          fprintf (stderr, "\nrun: could not exec() %s\n", arg_list[0]);
+          err(255, "\nrun: could not exec() %s", arg_list[0]);
           /* sigchld catcher handles the error */
-          _exit (255);
        }   
     }
     else if (pid < 0)
-       fprintf (stderr, "\nrun: could not fork()\n");
+       warn("\nrun: could not vfork()");
 
     free (arg_list);
-    
-        
     return;
 }
--- src/state.c	1998-02-23 00:26:07.000000000 -0500
+++ src/state.c	2015-03-09 01:07:31.000000000 -0400
@@ -4,7 +4,10 @@
 */
 
-
-#include "forms.h"
+#include <sys/param.h>
+#include <err.h>
+#include <forms.h>
 #include <stdlib.h>
+
+#include "flx.h"
 #include "xfpovray.h"
 #include "pov-defaults.h"
@@ -36,23 +39,19 @@
 {
     FILE *state_file;
-    char filename[256];
-    char temp[256];
+    char filename[MAXPATHLEN];
     int i;
    
        
     /* Get home directory, and set filepath */
-    sprintf (filename, "%s/.xfpovray/xfpovray.state", getenv("HOME"));
+    snprintf (filename, sizeof filename, "%s/.xfpovray/xfpovray.state", getenv("HOME"));
 
     if ((state_file = fopen(filename, "w")) == NULL) {
-       fprintf (stderr, "Unable to open %s for writing! State not saved.\n",
+       warn("Unable to open %s for writing! State not saved.",
                filename);
        return;
     }
 
-
     /* Write the current state */
-    sprintf(temp, "; xfpovray %s, generated by state.c\n", xfp_version); 
-    fprintf (state_file, temp);
-
+    fprintf(state_file, "; xfpovray %s, generated by state.c\n", xfp_version); 
 
     /* Parsing */
@@ -63,6 +62,5 @@
                    fl_get_input (parsingPage->libpathInput[i]));    
         else
-           fprintf (state_file, "library_path=NULL\n", 
-                   fl_get_input (parsingPage->libpathInput[i]));    
+           fprintf (state_file, "library_path=NULL\n");
     }
     
@@ -142,5 +140,5 @@
 
     if (strcmp(fl_get_input (tracingPage->antialiasThreshold), "") == 0)
-       fprintf (state_file, "antialias_threshold=%d\n", 
+       fprintf (state_file, "antialias_threshold=%f\n", 
            POV_ANTIALIAS_THRESHOLD);
     else
@@ -155,5 +153,5 @@
   
     if (strcmp(fl_get_input (tracingPage->jitterInput), "") == 0)
-       fprintf (state_file, "jitter_amount=%d\n", POV_JITTER_AMOUNT);
+       fprintf (state_file, "jitter_amount=%f\n", POV_JITTER_AMOUNT);
     else
        fprintf (state_file, "jitter_amount=%s\n", 
@@ -240,7 +238,7 @@
     FILE *state_file;
     char filename[512];
-    int i, numLibs = 0;
+    int numLibs = 0;
     char buf[80];
-    char *key;
+    const char *key;
     char *value;
     const char delimiter[] = "=";     
--- src/tips.c	1998-01-18 22:47:13.000000000 -0500
+++ src/tips.c	2015-03-09 01:10:51.000000000 -0400
@@ -1,5 +1,7 @@
-#include "forms.h"
+#include <forms.h>
 #include <stdlib.h>
 
+#include "xfpovray.h"
+
 extern int show_tips;
  
@@ -9,5 +11,6 @@
  * use the post handler as a tipper
  */
-int post_handler(FL_OBJECT *ob, int event, 
+static int
+post_handler(FL_OBJECT *ob, int event, 
     FL_Coord mx, FL_Coord my, int key, void *xev)
 {
--- src/util.c	1998-02-21 20:57:40.000000000 -0500
+++ src/util.c	2015-03-09 01:15:38.000000000 -0400
@@ -6,5 +6,6 @@
 #include <string.h>
 
-
+#include <forms.h>
+#include "xfpovray.h"
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 
@@ -27,5 +28,5 @@
 {
     static char tokensep[] = "/";
-    int tokencount;
+    size_t tokencount;
     char *thistoken;