1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 01_printf.dpatch by Darren Salt <linux@youmustbejoking.demon.co.uk>
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Various printf fixups.
8
diff -urNad glbsp-2.20~/cmdline/display.h glbsp-2.20/cmdline/display.h
9
--- glbsp-2.20~/cmdline/display.h 2005-09-13 11:15:36.000000000 +0100
10
+++ glbsp-2.20/cmdline/display.h 2006-08-12 16:29:55.738110936 +0100
12
void TextShutdown(void);
13
void TextDisableProgress(void);
15
-void TextFatalError(const char *str, ...);
16
-void TextPrintMsg(const char *str, ...);
17
+void TextFatalError(const char *str, ...) __attribute__ ((format (printf, 1, 2)));
18
+void TextPrintMsg(const char *str, ...) __attribute__ ((format (printf, 1, 2)));
19
void TextTicker(void);
21
boolean_g TextDisplayOpen(displaytype_e type);
22
diff -urNad glbsp-2.20~/glbsp.h glbsp-2.20/glbsp.h
23
--- glbsp-2.20~/glbsp.h 2005-09-13 11:18:05.000000000 +0100
24
+++ glbsp-2.20/glbsp.h 2006-08-12 16:29:23.385655876 +0100
26
// goes wrong, e.g. out of memory. This routine should show the
27
// error to the user and abort the program.
29
- void (* fatal_error)(const char *str, ...);
30
+ void (* fatal_error)(const char *str, ...) __attribute__ ((format (printf, 1, 2)));
32
// The print_msg routine is used to display the various messages
33
// that occur, e.g. "Building GL nodes on MAP01" and that kind of
36
- void (* print_msg)(const char *str, ...);
37
+ void (* print_msg)(const char *str, ...) __attribute__ ((format (printf, 1, 2)));
39
// This routine is called frequently whilst building the nodes, and
40
// can be used to keep a GUI responsive to user input. Many
41
diff -urNad glbsp-2.20~/seg.c glbsp-2.20/seg.c
42
--- glbsp-2.20~/seg.c 2005-09-13 11:18:37.000000000 +0100
43
+++ glbsp-2.20/seg.c 2006-08-12 16:29:23.385655876 +0100
45
cur->vertex->x, cur->vertex->y,
46
cur->before ? cur->before->index : -1,
47
cur->after ? cur->after->index : -1,
49
next->vertex->x, next->vertex->y,
50
next->before ? next->before->index : -1,
51
next->after ? next->after->index : -1);
54
if (!cur->self_ref && !next->self_ref)
55
PrintMiniWarn("Sector mismatch: #%d (%1.1f,%1.1f) != #%d (%1.1f,%1.1f)\n",
56
- cur->after->index, next->before->index,
57
- cur->vertex->x, cur->vertex->y,
58
- next->vertex->x, next->vertex->y);
59
+ cur->after->index, cur->vertex->x, cur->vertex->y,
60
+ next->before->index, next->vertex->x, next->vertex->y);
62
// choose the non-self-referencing sector when we can
63
if (cur->self_ref && !next->self_ref)
64
diff -urNad glbsp-2.20~/system.c glbsp-2.20/system.c
65
--- glbsp-2.20~/system.c 2005-09-13 11:19:06.000000000 +0100
66
+++ glbsp-2.20/system.c 2006-08-12 16:29:23.389655932 +0100
69
if (sizeof(uint8_g) != 1)
70
FatalError("Sanity check failed: sizeof(uint8_g) = %d",
72
+ (int)sizeof(uint8_g));
74
if (sizeof(uint16_g) != 2)
75
FatalError("Sanity check failed: sizeof(uint16_g) = %d",
77
+ (int)sizeof(uint16_g));
79
if (sizeof(uint32_g) != 4)
80
FatalError("Sanity check failed: sizeof(uint32_g) = %d",
82
+ (int)sizeof(uint32_g));
84
/* check endianness */
86
diff -urNad glbsp-2.20~/system.h glbsp-2.20/system.h
87
--- glbsp-2.20~/system.h 2005-09-13 11:19:12.000000000 +0100
88
+++ glbsp-2.20/system.h 2006-08-12 16:29:23.389655932 +0100
90
/* ----- function prototypes ---------------------------- */
92
// fatal error messages (these don't return)
93
-void FatalError(const char *str, ...);
94
-void InternalError(const char *str, ...);
95
+void FatalError(const char *str, ...) __attribute__ ((format (printf, 1, 2)));
96
+void InternalError(const char *str, ...) __attribute__ ((format (printf, 1, 2)));
98
// display normal messages & warnings to the screen
99
-void PrintMsg(const char *str, ...);
100
-void PrintVerbose(const char *str, ...);
101
-void PrintWarn(const char *str, ...);
102
-void PrintMiniWarn(const char *str, ...);
103
+void PrintMsg(const char *str, ...) __attribute__ ((format (printf, 1, 2)));
104
+void PrintVerbose(const char *str, ...) __attribute__ ((format (printf, 1, 2)));
105
+void PrintWarn(const char *str, ...) __attribute__ ((format (printf, 1, 2)));
106
+void PrintMiniWarn(const char *str, ...) __attribute__ ((format (printf, 1, 2)));
108
// set message for certain errors
109
void SetErrorMsg(const char *str);
111
// these are only used for debugging
112
void InitDebug(void);
113
void TermDebug(void);
114
-void PrintDebug(const char *str, ...);
115
+void PrintDebug(const char *str, ...) __attribute__ ((format (printf, 1, 2)));
117
// macros for the display stuff
118
#define DisplayOpen (* cur_funcs->display_open)
119
diff -urNad glbsp-2.20~/wad.c glbsp-2.20/wad.c
120
--- glbsp-2.20~/wad.c 2005-09-13 11:19:36.000000000 +0100
121
+++ glbsp-2.20/wad.c 2006-08-12 16:29:23.389655932 +0100
125
if (ftell(out_file) != lump->new_start)
126
- PrintWarn("Consistency failure writing %s (%08X, %08X\n",
127
+ PrintWarn("Consistency failure writing %s (%08lX, %08X\n",
128
lump->name, ftell(out_file), lump->new_start);
130
if (lump->length == 0)
133
if (ftell(out_file) != wad.dir_start)
134
PrintWarn("Consistency failure writing lump directory "
135
- "(%08X,%08X)\n", ftell(out_file), wad.dir_start);
136
+ "(%08lX,%08X)\n", ftell(out_file), wad.dir_start);
138
for (cur=wad.dir_head; cur; cur=cur->next)
140
@@ -1563,7 +1563,7 @@
141
case LIMIT_VERTEXES: PrintMsg("Number of Vertices %s.\n", msg); break;
142
case LIMIT_SECTORS: PrintMsg("Number of Sectors %s.\n", msg); break;
143
case LIMIT_SIDEDEFS: PrintMsg("Number of Sidedefs %s\n", msg); break;
144
- case LIMIT_LINEDEFS: PrintMsg("Number of Linedefs\n", msg); break;
145
+ case LIMIT_LINEDEFS: PrintMsg("Number of Linedefs %s\n", msg); break;
147
case LIMIT_SEGS: PrintMsg("Number of Segs %s.\n", msg); break;
148
case LIMIT_SSECTORS: PrintMsg("Number of Subsectors %s.\n", msg); break;