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
|
Index: atom4-4.1/ncurses/textui.cc
===================================================================
--- atom4-4.1.orig/ncurses/textui.cc
+++ atom4-4.1/ncurses/textui.cc
@@ -103,7 +103,7 @@ void ncurses_ui::handlekey() {
}
}
-int ncurses_ui::formatstr(char *fmt, ...) {
+int ncurses_ui::formatstr(const char *fmt, ...) {
va_list args;
int rc;
@@ -114,7 +114,7 @@ int ncurses_ui::formatstr(char *fmt, ...
return rc;
}
-int ncurses_ui::message(char *fmt, ...) {
+int ncurses_ui::message(const char *fmt, ...) {
va_list args;
int rc;
@@ -129,7 +129,7 @@ int ncurses_ui::message(char *fmt, ...)
}
void ncurses_ui::draw_tile(WINDOW *w, celltype cell) {
- char *glyph;
+ const char *glyph;
int color, bold=0;
if (cell>='a' && cell<='h') {
@@ -252,7 +252,7 @@ int ncurses_ui::wait_key() {
return wgetch(iowin);
}
-int ncurses_ui::ask_yn(char *question) {
+int ncurses_ui::ask_yn(const char *question) {
int ch;
message("%s (y/n) ", question);
Index: atom4-4.1/ncurses/textui.h
===================================================================
--- atom4-4.1.orig/ncurses/textui.h
+++ atom4-4.1/ncurses/textui.h
@@ -85,8 +85,8 @@ private:
char strbuf[STRBUF_SIZE]; // temp buffer for formatting strings
int use_color() { return options&ENABLE_COLOR; }
- int formatstr(char *fmt, ...);
- int message(char *fmt, ...);
+ int formatstr(const char *fmt, ...);
+ int message(const char *fmt, ...);
void draw_tile(WINDOW *w, celltype cell);
friend void render_cell(int x, int y, celltype cell, void *context);
void render_board();
@@ -94,7 +94,7 @@ private:
void render_iowin();
void refresh();
int wait_key();
- int ask_yn(char *msg);
+ int ask_yn(const char *msg);
int init_color();
public:
ncurses_ui(atom4 *game, eventloop *loop, int *exitflag, int options=0);
Index: atom4-4.1/x/xutil.cc
===================================================================
--- atom4-4.1.orig/x/xutil.cc
+++ atom4-4.1/x/xutil.cc
@@ -181,9 +181,9 @@ void xwindow::mouse_move(XMotionEvent ev
*/
appwindow::appwindow(xconnection *connection,
- char *winstr, char *iconstr,
+ const char *winstr, const char *iconstr,
int win_wd, int win_ht,
- char *resource_class, char *resource_name) :
+ const char *resource_class, const char *resource_name) :
xwindow(connection, NULL, 0,0, win_wd, win_ht, 0,0,0),
disp(connection->display()) {
XWMHints *wmhints;
@@ -207,8 +207,8 @@ appwindow::appwindow(xconnection *connec
classhints = XAllocClassHint();
if (!classhints) throw exception("Cannot allocate class hints");
- classhints->res_name = resource_class;
- classhints->res_class = resource_name;
+ classhints->res_name = const_cast<char*>(resource_class);
+ classhints->res_class = const_cast<char*>(resource_name);
sizehints = XAllocSizeHints();
if (!sizehints) throw exception("Cannot allocate size hints");
@@ -217,9 +217,9 @@ appwindow::appwindow(xconnection *connec
sizehints->min_width = sizehints->max_width = wd;
sizehints->min_height = sizehints->max_height = ht;
- if (!XStringListToTextProperty(&winstr, 1, &win_name))
+ if (!XStringListToTextProperty(const_cast<char**>(&winstr), 1, &win_name))
throw exception("Error while creating TextProperty");
- if (!XStringListToTextProperty(&iconstr, 1, &icon_name))
+ if (!XStringListToTextProperty(const_cast<char**>(&iconstr), 1, &icon_name))
throw exception("Error while creating TextProperty");
// Set these as our WM settings
@@ -252,7 +252,7 @@ appwindow::~appwindow() {}
// FIXME: should use generic image loader
tiled_bckgnd::tiled_bckgnd(xconnection *connection, Drawable drawable,
- char *xpmfile)
+ const char *xpmfile)
: conn(connection), d(drawable) {
Display *disp = conn->display();
XpmAttributes attr;
Index: atom4-4.1/x/xutil.h
===================================================================
--- atom4-4.1.orig/x/xutil.h
+++ atom4-4.1/x/xutil.h
@@ -125,9 +125,9 @@ protected:
Display *disp; // [R] (for convenience only)
public:
appwindow(xconnection *conn,
- char *win_name, char *icon_name,
+ const char *win_name, const char *icon_name,
int width, int height,
- char *resource_class, char *resource_name);
+ const char *resource_class, const char *resource_name);
~appwindow();
};
@@ -141,7 +141,7 @@ class tiled_bckgnd {
GC tilegc;
public:
// FIXME: should use generic image loader
- tiled_bckgnd(xconnection *conn, Drawable d, char *xpmfile);
+ tiled_bckgnd(xconnection *conn, Drawable d, const char *xpmfile);
~tiled_bckgnd();
void paint(int x, int y, int w, int h);
Index: atom4-4.1/x/xscoreboard.cc
===================================================================
--- atom4-4.1.orig/x/xscoreboard.cc
+++ atom4-4.1/x/xscoreboard.cc
@@ -39,7 +39,7 @@
#define DATADIR "." // search current dir if undefined
#endif
-static char *wheelnames[NUM_WHEELS] = {
+static const char *wheelnames[NUM_WHEELS] = {
DATADIR "/wheel12-1.xpm",
DATADIR "/wheel12-2.xpm",
DATADIR "/wheel12-3.xpm",
@@ -108,7 +108,7 @@ xscoreboard::~xscoreboard() {
XFreeFont(disp, titlefont);
}
-void xscoreboard::draw_center(XFontStruct *font, GC gc, char *text, int y) {
+void xscoreboard::draw_center(XFontStruct *font, GC gc, const char *text, int y) {
XCharStruct result;
int dummy, x;
int textlen = strlen(text);
Index: atom4-4.1/x/xsprite.cc
===================================================================
--- atom4-4.1.orig/x/xsprite.cc
+++ atom4-4.1/x/xsprite.cc
@@ -35,7 +35,7 @@ xsprite_engine::~xsprite_engine() {
XFreeGC(disp, drawgc);
}
-xflatsprite::xflatsprite(xsprite_engine *engine, char *xpmfile) : eng(engine) {
+xflatsprite::xflatsprite(xsprite_engine *engine, const char *xpmfile) : eng(engine) {
Display *disp = eng->display();
Drawable d = eng->get_drawable();
XpmAttributes attr;
Index: atom4-4.1/x/xsprite.h
===================================================================
--- atom4-4.1.orig/x/xsprite.h
+++ atom4-4.1/x/xsprite.h
@@ -54,7 +54,7 @@ class xflatsprite {
int wd, ht; // width & height
int ox, oy; // image origin (==XPM hotspot)
public:
- xflatsprite(xsprite_engine *engine, char *xpmfile);
+ xflatsprite(xsprite_engine *engine, const char *xpmfile);
~xflatsprite();
void draw(Drawable d, int x, int y);
Index: atom4-4.1/x/xtriboard.cc
===================================================================
--- atom4-4.1.orig/x/xtriboard.cc
+++ atom4-4.1/x/xtriboard.cc
@@ -19,7 +19,7 @@
#define TILE_XPM DATADIR "/tritile12.xpm"
-char *xtriboard::ballnames[NUM_BALLS]={
+const char *xtriboard::ballnames[NUM_BALLS]={
DATADIR "/blackball12.xpm",
DATADIR "/redball12.xpm",
DATADIR "/greenball12.xpm",
Index: atom4-4.1/x/xtriboard.h
===================================================================
--- atom4-4.1.orig/x/xtriboard.h
+++ atom4-4.1/x/xtriboard.h
@@ -32,7 +32,7 @@ class xtriboard : public xwindow {
tiled_bckgnd *tritile; // tiled background
// FIXME: this should be moved to class XAtom4
- static char *ballnames[NUM_BALLS];
+ static const char *ballnames[NUM_BALLS];
xflatsprite *balls[8];
// Auto-positioning cursor
Index: atom4-4.1/x/xscoreboard.h
===================================================================
--- atom4-4.1.orig/x/xscoreboard.h
+++ atom4-4.1/x/xscoreboard.h
@@ -30,7 +30,7 @@ class xscoreboard : public xwindow {
XFontStruct *scorefont; // regular font
GC textgc;
- void draw_center(XFontStruct *font, GC gc, char *text, int y);
+ void draw_center(XFontStruct *font, GC gc, const char *text, int y);
void render_score(int player, int y);
void render_wheel(int wheel);
public:
|