Debian Codegraph @

debian/patches/constchar2

raw
1 Index: atom4-4.1/ncurses/textui.cc
2 ===================================================================
3 --- atom4-4.1.orig/ncurses/textui.cc
4 +++ atom4-4.1/ncurses/textui.cc
5 @@ -103,7 +103,7 @@ void ncurses_ui::handlekey() {
6 }
7 }
8
9 -int ncurses_ui::formatstr(char *fmt, ...) {
10 +int ncurses_ui::formatstr(const char *fmt, ...) {
11 va_list args;
12 int rc;
13
14 @@ -114,7 +114,7 @@ int ncurses_ui::formatstr(char *fmt, ...
15 return rc;
16 }
17
18 -int ncurses_ui::message(char *fmt, ...) {
19 +int ncurses_ui::message(const char *fmt, ...) {
20 va_list args;
21 int rc;
22
23 @@ -129,7 +129,7 @@ int ncurses_ui::message(char *fmt, ...)
24 }
25
26 void ncurses_ui::draw_tile(WINDOW *w, celltype cell) {
27 - char *glyph;
28 + const char *glyph;
29 int color, bold=0;
30
31 if (cell>='a' && cell<='h') {
32 @@ -252,7 +252,7 @@ int ncurses_ui::wait_key() {
33 return wgetch(iowin);
34 }
35
36 -int ncurses_ui::ask_yn(char *question) {
37 +int ncurses_ui::ask_yn(const char *question) {
38 int ch;
39
40 message("%s (y/n) ", question);
41 Index: atom4-4.1/ncurses/textui.h
42 ===================================================================
43 --- atom4-4.1.orig/ncurses/textui.h
44 +++ atom4-4.1/ncurses/textui.h
45 @@ -85,8 +85,8 @@ private:
46 char strbuf[STRBUF_SIZE]; // temp buffer for formatting strings
47
48 int use_color() { return options&ENABLE_COLOR; }
49 - int formatstr(char *fmt, ...);
50 - int message(char *fmt, ...);
51 + int formatstr(const char *fmt, ...);
52 + int message(const char *fmt, ...);
53 void draw_tile(WINDOW *w, celltype cell);
54 friend void render_cell(int x, int y, celltype cell, void *context);
55 void render_board();
56 @@ -94,7 +94,7 @@ private:
57 void render_iowin();
58 void refresh();
59 int wait_key();
60 - int ask_yn(char *msg);
61 + int ask_yn(const char *msg);
62 int init_color();
63 public:
64 ncurses_ui(atom4 *game, eventloop *loop, int *exitflag, int options=0);
65 Index: atom4-4.1/x/xutil.cc
66 ===================================================================
67 --- atom4-4.1.orig/x/xutil.cc
68 +++ atom4-4.1/x/xutil.cc
69 @@ -181,9 +181,9 @@ void xwindow::mouse_move(XMotionEvent ev
70 */
71
72 appwindow::appwindow(xconnection *connection,
73 - char *winstr, char *iconstr,
74 + const char *winstr, const char *iconstr,
75 int win_wd, int win_ht,
76 - char *resource_class, char *resource_name) :
77 + const char *resource_class, const char *resource_name) :
78 xwindow(connection, NULL, 0,0, win_wd, win_ht, 0,0,0),
79 disp(connection->display()) {
80 XWMHints *wmhints;
81 @@ -207,8 +207,8 @@ appwindow::appwindow(xconnection *connec
82 classhints = XAllocClassHint();
83 if (!classhints) throw exception("Cannot allocate class hints");
84
85 - classhints->res_name = resource_class;
86 - classhints->res_class = resource_name;
87 + classhints->res_name = const_cast<char*>(resource_class);
88 + classhints->res_class = const_cast<char*>(resource_name);
89
90 sizehints = XAllocSizeHints();
91 if (!sizehints) throw exception("Cannot allocate size hints");
92 @@ -217,9 +217,9 @@ appwindow::appwindow(xconnection *connec
93 sizehints->min_width = sizehints->max_width = wd;
94 sizehints->min_height = sizehints->max_height = ht;
95
96 - if (!XStringListToTextProperty(&winstr, 1, &win_name))
97 + if (!XStringListToTextProperty(const_cast<char**>(&winstr), 1, &win_name))
98 throw exception("Error while creating TextProperty");
99 - if (!XStringListToTextProperty(&iconstr, 1, &icon_name))
100 + if (!XStringListToTextProperty(const_cast<char**>(&iconstr), 1, &icon_name))
101 throw exception("Error while creating TextProperty");
102
103 // Set these as our WM settings
104 @@ -252,7 +252,7 @@ appwindow::~appwindow() {}
105
106 // FIXME: should use generic image loader
107 tiled_bckgnd::tiled_bckgnd(xconnection *connection, Drawable drawable,
108 - char *xpmfile)
109 + const char *xpmfile)
110 : conn(connection), d(drawable) {
111 Display *disp = conn->display();
112 XpmAttributes attr;
113 Index: atom4-4.1/x/xutil.h
114 ===================================================================
115 --- atom4-4.1.orig/x/xutil.h
116 +++ atom4-4.1/x/xutil.h
117 @@ -125,9 +125,9 @@ protected:
118 Display *disp; // [R] (for convenience only)
119 public:
120 appwindow(xconnection *conn,
121 - char *win_name, char *icon_name,
122 + const char *win_name, const char *icon_name,
123 int width, int height,
124 - char *resource_class, char *resource_name);
125 + const char *resource_class, const char *resource_name);
126 ~appwindow();
127 };
128
129 @@ -141,7 +141,7 @@ class tiled_bckgnd {
130 GC tilegc;
131 public:
132 // FIXME: should use generic image loader
133 - tiled_bckgnd(xconnection *conn, Drawable d, char *xpmfile);
134 + tiled_bckgnd(xconnection *conn, Drawable d, const char *xpmfile);
135 ~tiled_bckgnd();
136
137 void paint(int x, int y, int w, int h);
138 Index: atom4-4.1/x/xscoreboard.cc
139 ===================================================================
140 --- atom4-4.1.orig/x/xscoreboard.cc
141 +++ atom4-4.1/x/xscoreboard.cc
142 @@ -39,7 +39,7 @@
143 #define DATADIR "." // search current dir if undefined
144 #endif
145
146 -static char *wheelnames[NUM_WHEELS] = {
147 +static const char *wheelnames[NUM_WHEELS] = {
148 DATADIR "/wheel12-1.xpm",
149 DATADIR "/wheel12-2.xpm",
150 DATADIR "/wheel12-3.xpm",
151 @@ -108,7 +108,7 @@ xscoreboard::~xscoreboard() {
152 XFreeFont(disp, titlefont);
153 }
154
155 -void xscoreboard::draw_center(XFontStruct *font, GC gc, char *text, int y) {
156 +void xscoreboard::draw_center(XFontStruct *font, GC gc, const char *text, int y) {
157 XCharStruct result;
158 int dummy, x;
159 int textlen = strlen(text);
160 Index: atom4-4.1/x/xsprite.cc
161 ===================================================================
162 --- atom4-4.1.orig/x/xsprite.cc
163 +++ atom4-4.1/x/xsprite.cc
164 @@ -35,7 +35,7 @@ xsprite_engine::~xsprite_engine() {
165 XFreeGC(disp, drawgc);
166 }
167
168 -xflatsprite::xflatsprite(xsprite_engine *engine, char *xpmfile) : eng(engine) {
169 +xflatsprite::xflatsprite(xsprite_engine *engine, const char *xpmfile) : eng(engine) {
170 Display *disp = eng->display();
171 Drawable d = eng->get_drawable();
172 XpmAttributes attr;
173 Index: atom4-4.1/x/xsprite.h
174 ===================================================================
175 --- atom4-4.1.orig/x/xsprite.h
176 +++ atom4-4.1/x/xsprite.h
177 @@ -54,7 +54,7 @@ class xflatsprite {
178 int wd, ht; // width & height
179 int ox, oy; // image origin (==XPM hotspot)
180 public:
181 - xflatsprite(xsprite_engine *engine, char *xpmfile);
182 + xflatsprite(xsprite_engine *engine, const char *xpmfile);
183 ~xflatsprite();
184
185 void draw(Drawable d, int x, int y);
186 Index: atom4-4.1/x/xtriboard.cc
187 ===================================================================
188 --- atom4-4.1.orig/x/xtriboard.cc
189 +++ atom4-4.1/x/xtriboard.cc
190 @@ -19,7 +19,7 @@
191
192 #define TILE_XPM DATADIR "/tritile12.xpm"
193
194 -char *xtriboard::ballnames[NUM_BALLS]={
195 +const char *xtriboard::ballnames[NUM_BALLS]={
196 DATADIR "/blackball12.xpm",
197 DATADIR "/redball12.xpm",
198 DATADIR "/greenball12.xpm",
199 Index: atom4-4.1/x/xtriboard.h
200 ===================================================================
201 --- atom4-4.1.orig/x/xtriboard.h
202 +++ atom4-4.1/x/xtriboard.h
203 @@ -32,7 +32,7 @@ class xtriboard : public xwindow {
204 tiled_bckgnd *tritile; // tiled background
205
206 // FIXME: this should be moved to class XAtom4
207 - static char *ballnames[NUM_BALLS];
208 + static const char *ballnames[NUM_BALLS];
209 xflatsprite *balls[8];
210
211 // Auto-positioning cursor
212 Index: atom4-4.1/x/xscoreboard.h
213 ===================================================================
214 --- atom4-4.1.orig/x/xscoreboard.h
215 +++ atom4-4.1/x/xscoreboard.h
216 @@ -30,7 +30,7 @@ class xscoreboard : public xwindow {
217 XFontStruct *scorefont; // regular font
218 GC textgc;
219
220 - void draw_center(XFontStruct *font, GC gc, char *text, int y);
221 + void draw_center(XFontStruct *font, GC gc, const char *text, int y);
222 void render_score(int player, int y);
223 void render_wheel(int wheel);
224 public: