aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-05-24 19:51:37 +0000
committerTorbjörn Andersson2006-05-24 19:51:37 +0000
commit4a583216fbfd7eee2197bac249c3f62007c2d4e4 (patch)
tree1f4d29458dd829d0d8f11b386040ec1a18b12a1a
parent8d954b7ae50c0391ba49ceeb26294a21bbe5b77f (diff)
downloadscummvm-rg350-4a583216fbfd7eee2197bac249c3f62007c2d4e4.tar.gz
scummvm-rg350-4a583216fbfd7eee2197bac249c3f62007c2d4e4.tar.bz2
scummvm-rg350-4a583216fbfd7eee2197bac249c3f62007c2d4e4.zip
Fixed most - not all - GCC warnings.
svn-id: r22614
-rw-r--r--engines/agi/agi.h8
-rw-r--r--engines/agi/agi_v2.cpp18
-rw-r--r--engines/agi/agi_v3.cpp10
-rw-r--r--engines/agi/console.cpp10
-rw-r--r--engines/agi/console.h2
-rw-r--r--engines/agi/graphics.cpp4
-rw-r--r--engines/agi/graphics.h4
-rw-r--r--engines/agi/id.cpp10
-rw-r--r--engines/agi/objects.cpp8
-rw-r--r--engines/agi/op_cmd.cpp6
-rw-r--r--engines/agi/op_dbg.cpp2
-rw-r--r--engines/agi/op_test.cpp2
-rw-r--r--engines/agi/opcodes.h4
-rw-r--r--engines/agi/picture.cpp6
-rw-r--r--engines/agi/picture.h2
-rw-r--r--engines/agi/savegame.cpp10
-rw-r--r--engines/agi/sound.cpp4
-rw-r--r--engines/agi/sprite.cpp6
-rw-r--r--engines/agi/text.cpp16
-rw-r--r--engines/agi/text.h10
-rw-r--r--engines/agi/words.cpp11
21 files changed, 71 insertions, 82 deletions
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index b3d143b98c..853a40f429 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -479,8 +479,8 @@ struct agi_loader {
int (*detect_game) ();
int (*load_resource) (int, int);
int (*unload_resource) (int, int);
- int (*load_objects) (char *);
- int (*load_words) (char *);
+ int (*load_objects) (const char *);
+ int (*load_words) (const char *);
};
extern struct agi_game game;
@@ -497,14 +497,14 @@ void agi_unload_resources(void);
/* words */
int show_words(void);
-int load_words(char *);
+int load_words(const char *);
void unload_words(void);
int find_word(char *word, int *flen);
void dictionary_words(char *);
/* objects */
int show_objects(void);
-int load_objects(char *fname);
+int load_objects(const char *fname);
int alloc_objects(int);
void unload_objects(void);
char *object_name(unsigned int);
diff --git a/engines/agi/agi_v2.cpp b/engines/agi/agi_v2.cpp
index deb849c200..f03554e4fc 100644
--- a/engines/agi/agi_v2.cpp
+++ b/engines/agi/agi_v2.cpp
@@ -34,8 +34,8 @@ static int agi_v2_deinit(void);
static int agi_v2_detect_game();
static int agi_v2_load_resource(int, int);
static int agi_v2_unload_resource(int, int);
-static int agi_v2_load_objects(char *);
-static int agi_v2_load_words(char *);
+static int agi_v2_load_objects(const char *);
+static int agi_v2_load_words(const char *);
struct agi_loader agi_v2 = {
2,
@@ -60,17 +60,15 @@ static int agi_v2_detect_game() {
return v2id_game();
}
-static int agi_v2_load_dir(struct agi_dir *agid, char *fname) {
+static int agi_v2_load_dir(struct agi_dir *agid, const char *fname) {
Common::File fp;
uint8 *mem;
uint32 flen;
- unsigned int i;
- char *path;
+ uint i;
- path = fname;
- report("Loading directory: %s\n", path);
+ report("Loading directory: %s\n", fname);
- if ((!fp.open(path))) {
+ if (!fp.open(fname)) {
return err_BadFileOpen;
}
@@ -298,11 +296,11 @@ int agi_v2_load_resource(int t, int n) {
return ec;
}
-static int agi_v2_load_objects(char *fname) {
+static int agi_v2_load_objects(const char *fname) {
return load_objects(fname);
}
-static int agi_v2_load_words(char *fname) {
+static int agi_v2_load_words(const char *fname) {
return load_words(fname);
}
diff --git a/engines/agi/agi_v3.cpp b/engines/agi/agi_v3.cpp
index 5c99472b78..c76524ef53 100644
--- a/engines/agi/agi_v3.cpp
+++ b/engines/agi/agi_v3.cpp
@@ -38,8 +38,8 @@ static int agi_v3_deinit(void);
static int agi_v3_detect_game();
static int agi_v3_load_resource(int, int);
static int agi_v3_unload_resource(int, int);
-static int agi_v3_load_objects(char *);
-static int agi_v3_load_words(char *);
+static int agi_v3_load_objects(const char *);
+static int agi_v3_load_words(const char *);
struct agi_loader agi_v3 = {
3,
@@ -220,7 +220,7 @@ uint8 *agi_v3_load_vol_res(struct agi_dir *agid) {
Common::File fp;
Common::String path;
- debugC(3, kDebugLevelResources, "(%p)", agid);
+ debugC(3, kDebugLevelResources, "(%p)", (void *)agid);
sprintf(x, "vol.%i", agid->volume);
path = Common::String(game.name) + x;
@@ -378,11 +378,11 @@ int agi_v3_load_resource(int t, int n) {
return ec;
}
-static int agi_v3_load_objects(char *fname) {
+static int agi_v3_load_objects(const char *fname) {
return load_objects(fname);
}
-static int agi_v3_load_words(char *fname) {
+static int agi_v3_load_words(const char *fname) {
return load_words(fname);
}
diff --git a/engines/agi/console.cpp b/engines/agi/console.cpp
index e8265fd6eb..4a6b439867 100644
--- a/engines/agi/console.cpp
+++ b/engines/agi/console.cpp
@@ -427,7 +427,7 @@ static void ccmd_cont() {
/*
* Register console commands
*/
-static void console_cmd(char *cmd, char *dsc, void (*handler) (void)) {
+static void console_cmd(const char *cmd, const char *dsc, void (*handler) (void)) {
assert(num_ccmd < MAX_CCMD);
strcpy(ccmd_list[num_ccmd].cmd, cmd);
@@ -537,7 +537,7 @@ static void build_console_layer() {
build_console_lines(console.max_y / 10);
}
-void report(char *message, ...) {
+void report(const char *message, ...) {
char x[512], y[512], z[64], *msg, *n;
va_list args;
int i, s, len;
@@ -547,9 +547,9 @@ void report(char *message, ...) {
va_start(args, message);
#ifdef HAVE_VSNPRINTF
- vsnprintf(y, 510, (char *)message, args);
+ vsnprintf(y, 510, message, args);
#else
- vsprintf(y, (char *)message, args);
+ vsprintf(y, message, args);
#endif
va_end(args);
@@ -822,7 +822,7 @@ void console_lock() {
void *debug;
-void report(char *message, ...) {
+void report(const char *message, ...) {
/* dummy */
}
diff --git a/engines/agi/console.h b/engines/agi/console.h
index 9043f8906f..d2d694a181 100644
--- a/engines/agi/console.h
+++ b/engines/agi/console.h
@@ -64,7 +64,7 @@ int console_init(void);
void console_cycle(void);
void console_lock(void);
void console_prompt(void);
-void report(char *, ...);
+void report(const char *, ...);
} // End of namespace Agi
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index cf3ccc3577..361eff245e 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -338,7 +338,7 @@ void print_character(int x, int y, char c, int fg, int bg) {
* @param a set if the button has focus
* @param p set if the button is pressed
*/
-void draw_button(int x, int y, char *s, int a, int p) {
+void draw_button(int x, int y, const char *s, int a, int p) {
int len = strlen(s);
int x1, y1, x2, y2;
@@ -360,7 +360,7 @@ void draw_button(int x, int y, char *s, int a, int p) {
flush_block(x1, y1, x2, y2);
}
-int test_button(int x, int y, char *s) {
+int test_button(int x, int y, const char *s) {
int len = strlen(s);
int x1, y1, x2, y2;
diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h
index e851e0ff75..85be6eb3c3 100644
--- a/engines/agi/graphics.h
+++ b/engines/agi/graphics.h
@@ -63,8 +63,8 @@ void flush_screen(void);
void clear_screen(int);
void clear_console_screen(int);
void draw_box(int, int, int, int, int, int, int);
-void draw_button(int, int, char *, int, int);
-int test_button(int, int, char *);
+void draw_button(int, int, const char *, int, int);
+int test_button(int, int, const char *);
void draw_rectangle(int, int, int, int, int);
void save_block(int, int, int, int, uint8 *);
void restore_block(int, int, int, int, uint8 *);
diff --git a/engines/agi/id.cpp b/engines/agi/id.cpp
index 70a1a9e098..4320864a75 100644
--- a/engines/agi/id.cpp
+++ b/engines/agi/id.cpp
@@ -310,13 +310,12 @@ int v2id_game() {
uint32 len, c, crc;
uint8 *buff;
Common::File fp;
- char *fn[] = { "viewdir", "logdir", "picdir", "snddir", "words.tok", "object", "" };
+ const char *fn[] = { "viewdir", "logdir", "picdir", "snddir", "words.tok", "object", "" };
buff = (uint8 *)malloc(8192);
for (crc = y = 0; fn[y][0]; y++) {
- char *path = fn[y];
- if (fp.open(path)) {
+ if (fp.open(fn[y])) {
for (len = 1; len > 0;) {
memset(buff, 0, 8192);
len = fp.read(buff, 8000);
@@ -350,14 +349,13 @@ int v3id_game() {
uint32 len, c, crc;
uint8 *buff;
Common::File fp;
- char *fn[] = { "words.tok", "object", "" };
+ const char *fn[] = { "words.tok", "object", "" };
Common::String path;
buff = (uint8 *)malloc(8192);
for (crc = 0, y = 0; fn[y][0] != 0x0; y++) {
- path = fn[y];
- if (fp.open(path)) {
+ if (fp.open(fn[y])) {
len = 1;
while (len > 0) {
memset(buff, 0, 8192);
diff --git a/engines/agi/objects.cpp b/engines/agi/objects.cpp
index cb05cdd891..a381910ac6 100644
--- a/engines/agi/objects.cpp
+++ b/engines/agi/objects.cpp
@@ -92,20 +92,18 @@ int decode_objects(uint8 *mem, uint32 flen) {
}
-int load_objects(char *fname) {
+int load_objects(const char *fname) {
Common::File fp;
uint32 flen;
uint8 *mem;
- char *path;
objects = NULL;
game.num_objects = 0;
debugC(5, kDebugLevelResources, "(fname = %s)", fname);
- path = fname;
- report("Loading objects: %s\n", path);
+ report("Loading objects: %s\n", fname);
- if (!fp.open(path))
+ if (!fp.open(fname))
return err_BadFileOpen;
fp.seek(0, SEEK_END);
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index a9b2307150..9b30b0eacd 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -866,7 +866,7 @@ cmd(set_game_id) {
cmd(pause) {
int tmp = game.clock_enabled;
- char *b[] = { "Continue", NULL };
+ const char *b[] = { "Continue", NULL };
game.clock_enabled = false;
selection_box(" Game is paused. \n\n\n", b);
@@ -958,7 +958,7 @@ cmd(status) {
}
cmd(quit) {
- char *buttons[] = { "Quit", "Continue", NULL };
+ const char *buttons[] = { "Quit", "Continue", NULL };
stop_sound();
if (p0) {
@@ -972,7 +972,7 @@ cmd(quit) {
}
cmd(restart_game) {
- char *buttons[] = { "Restart", "Continue", NULL };
+ const char *buttons[] = { "Restart", "Continue", NULL };
int sel;
stop_sound();
diff --git a/engines/agi/op_dbg.cpp b/engines/agi/op_dbg.cpp
index 2a8af3bc68..dcf6e75b01 100644
--- a/engines/agi/op_dbg.cpp
+++ b/engines/agi/op_dbg.cpp
@@ -272,7 +272,7 @@ struct agi_logicnames logic_names_cmd[] = {
#ifdef USE_CONSOLE
-void debug_console(int lognum, int mode, char *str) {
+void debug_console(int lognum, int mode, const char *str) {
struct agi_logicnames *x;
uint8 a, c, z;
diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp
index d4a98bb0ac..94bd7ffd88 100644
--- a/engines/agi/op_test.cpp
+++ b/engines/agi/op_test.cpp
@@ -410,7 +410,7 @@ int test_if_code(int lognum) {
#ifdef USE_CONSOLE
if (debug_.enabled && (debug_.logic0 || lognum))
- debug_console(lognum, 0xFF, retval ? (char *)"=true" : (char *)"=false");
+ debug_console(lognum, 0xFF, retval ? "=true" : "=false");
#endif
return retval;
diff --git a/engines/agi/opcodes.h b/engines/agi/opcodes.h
index 02379373f5..2a1b9b87d0 100644
--- a/engines/agi/opcodes.h
+++ b/engines/agi/opcodes.h
@@ -31,7 +31,7 @@ namespace Agi {
struct agi_logicnames {
#ifdef USE_CONSOLE /* ifndef NO_DEBUG */
- char *name;
+ const char *name;
#endif
uint16 num_args;
uint16 arg_mask;
@@ -41,7 +41,7 @@ extern struct agi_logicnames logic_names_test[];
extern struct agi_logicnames logic_names_cmd[];
extern struct agi_logicnames logic_names_if[];
-void debug_console(int, int, char *);
+void debug_console(int, int, const char *);
int test_if_code(int);
void new_room(int);
void execute_agi_command(uint8, uint8 *);
diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp
index 771f3e2a3e..900bf10a91 100644
--- a/engines/agi/picture.cpp
+++ b/engines/agi/picture.cpp
@@ -873,14 +873,14 @@ static void draw_picture() {
/**
*
*/
-uint8 *convert_v3_pic(uint8 *data, uint32 len) {
+uint8 *convert_v3_pic(uint8 *src, uint32 len) {
uint8 d, old = 0, x, *in, *xdata, *out, mode = 0;
uint32 i, ulen;
xdata = (uint8 *) malloc(len + len / 2);
out = xdata;
- in = data;
+ in = src;
for (i = ulen = 0; i < len; i++, ulen++) {
d = *in++;
@@ -908,7 +908,7 @@ uint8 *convert_v3_pic(uint8 *data, uint32 len) {
old = d;
}
- free(data);
+ free(src);
xdata = (uint8 *)realloc(xdata, ulen);
return xdata;
diff --git a/engines/agi/picture.h b/engines/agi/picture.h
index 0e1b5c9dd2..6700f436b3 100644
--- a/engines/agi/picture.h
+++ b/engines/agi/picture.h
@@ -40,7 +40,7 @@ struct agi_picture {
int decode_picture(int, int);
int unload_picture(int);
void show_pic(void);
-uint8 *convert_v3_pic(uint8 *data, uint32 len);
+uint8 *convert_v3_pic(uint8 *src, uint32 len);
} // End of namespace Agi
diff --git a/engines/agi/savegame.cpp b/engines/agi/savegame.cpp
index 77c46394e2..8ec2454298 100644
--- a/engines/agi/savegame.cpp
+++ b/engines/agi/savegame.cpp
@@ -124,7 +124,7 @@ void replay_image_stack_call(uint8 type, int16 p1, int16 p2, int16 p3,
/* */
-static char *strSig = "AGI:";
+static const char *strSig = "AGI:";
static void write_uint8(Common::File *f, int8 val) {
f->write(&val, 1);
@@ -162,7 +162,7 @@ static int16 read_sint16(Common::File *f) {
return (int16) ((buf[0] << 8) | buf[1]);
}
-static void write_string(Common::File *f, char *s) {
+static void write_string(Common::File *f, const char *s) {
write_sint16(f, (int16) strlen(s));
f->write(s, strlen(s));
}
@@ -173,7 +173,7 @@ static void read_string(Common::File *f, char *s) {
s[size] = (char)0;
}
-static void write_bytes(Common::File *f, char *s, int16 size) {
+static void write_bytes(Common::File *f, const char *s, int16 size) {
f->write(s, size);
}
@@ -187,7 +187,7 @@ static void read_bytes(Common::File *f, char *s, int16 size) {
*/
#define SAVEGAME_VERSION 1
-int save_game(char *s, char *d) {
+int save_game(char *s, const char *d) {
int16 i;
struct image_stack_element *ptr = image_stack;
Common::File f;
@@ -659,7 +659,7 @@ int savegame_simple() {
int savegame_dialog() {
char path[MAX_PATH];
char *desc;
- char *buttons[] = { "Do as I say!", "I regret", NULL };
+ const char *buttons[] = { "Do as I say!", "I regret", NULL };
char dstr[200];
int rc, slot = 0;
int hm, vm, hp, vp; /* box margins */
diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp
index 6eef21802c..15598ba153 100644
--- a/engines/agi/sound.cpp
+++ b/engines/agi/sound.cpp
@@ -702,14 +702,12 @@ void unload_instruments() {
#endif /* USE_IIGS_SOUND */
static void fill_audio(void *udata, int16 * stream, uint len) {
- int16 *origData = stream;
len <<= 2;
- uint origLen = len;
uint32 p = 0;
static uint32 n = 0, s = 0;
- debugC(5, kDebugLevelSound, "(%p, %p, %d)", udata, stream, len);
+ debugC(5, kDebugLevelSound, "(%p, %p, %d)", (void *)udata, (void *)stream, len);
memcpy(stream, (uint8 *) buffer + s, p = n);
for (n = 0, len -= p; n < len; p += n, len -= n) {
play_sound();
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp
index f807e1da01..af8588a84d 100644
--- a/engines/agi/sprite.cpp
+++ b/engines/agi/sprite.cpp
@@ -452,10 +452,10 @@ static void free_list(struct list_head *head) {
* sprites of the given list have moved.
*/
static void commit_sprites(struct list_head *head) {
- struct list_head *h;
+ struct list_head *pos;
- list_for_each(h, head, next) {
- struct sprite *s = list_entry(h, struct sprite, list);
+ list_for_each(pos, head, next) {
+ struct sprite *s = list_entry(pos, struct sprite, list);
int x1, y1, x2, y2, w, h;
w = (s->v->cel_data->width > s->v->cel_data_2->width) ?
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 73d9dc1f1c..2b837c2237 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -30,7 +30,7 @@
namespace Agi {
-static void print_text2(int l, char *msg, int foff, int xoff, int yoff,
+static void print_text2(int l, const char *msg, int foff, int xoff, int yoff,
int len, int fg, int bg) {
int x1, y1;
int maxx, minx, ofoff;
@@ -113,7 +113,7 @@ static void print_text2(int l, char *msg, int foff, int xoff, int yoff,
/* len is in characters, not pixels!!
*/
-static void blit_textbox(char *p, int y, int x, int len) {
+static void blit_textbox(const char *p, int y, int x, int len) {
/* if x | y = -1, then centre the box */
int xoff, yoff, lin, h, w;
char *msg, *m;
@@ -189,7 +189,7 @@ static void erase_textbox() {
/**
* Print text in the AGI engine screen.
*/
-void print_text(char *msg, int f, int x, int y, int len, int fg, int bg) {
+void print_text(const char *msg, int f, int x, int y, int len, int fg, int bg) {
f *= CHAR_COLS;
x *= CHAR_COLS;
y *= CHAR_LINES;
@@ -201,7 +201,7 @@ void print_text(char *msg, int f, int x, int y, int len, int fg, int bg) {
/**
* Print text in the AGI engine console.
*/
-void print_text_console(char *msg, int x, int y, int len, int fg, int bg) {
+void print_text_console(const char *msg, int x, int y, int len, int fg, int bg) {
x *= CHAR_COLS;
y *= 10;
@@ -290,7 +290,7 @@ void close_window() {
* centered in the screen and waits until a key is pressed.
* @param p The text to be displayed
*/
-int message_box(char *s) {
+int message_box(const char *s) {
int k;
erase_both();
@@ -310,7 +310,7 @@ int message_box(char *s) {
* @param p The text to be displayed
* @param b NULL-terminated list of button labels
*/
-int selection_box(char *m, char **b) {
+int selection_box(const char *m, const char **b) {
int x, y, i, s;
int key, active = 0;
int rc = -1;
@@ -451,7 +451,7 @@ int print(char *p, int lin, int col, int len) {
/**
*
*/
-static void print_status(char *message, ...) {
+static void print_status(const char *message, ...) {
char x[42];
va_list args;
@@ -484,7 +484,7 @@ static char *safe_strcat(char *s, const char *t) {
* @param n logic number
*/
#define MAX_LEN 768
-char *agi_sprintf(char *s) {
+char *agi_sprintf(const char *s) {
static char y[MAX_LEN];
char x[MAX_LEN];
char z[16], *p;
diff --git a/engines/agi/text.h b/engines/agi/text.h
index d68a8db9c5..c39d1ed4b3 100644
--- a/engines/agi/text.h
+++ b/engines/agi/text.h
@@ -29,15 +29,15 @@
namespace Agi {
-int message_box(char *);
-int selection_box(char *, char **);
+int message_box(const char *);
+int selection_box(const char *, const char **);
void close_window(void);
void draw_window(int, int, int, int);
-void print_text(char *, int, int, int, int, int, int);
-void print_text_console(char *, int, int, int, int, int);
+void print_text(const char *, int, int, int, int, int, int);
+void print_text_console(const char *, int, int, int, int, int);
int print(char *, int, int, int);
char *word_wrap_string(char *, int *);
-char *agi_sprintf(char *);
+char *agi_sprintf(const char *);
void write_status(void);
void write_prompt(void);
void clear_lines(int, int, int);
diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp
index 77cdd97667..43f049cda3 100644
--- a/engines/agi/words.cpp
+++ b/engines/agi/words.cpp
@@ -44,21 +44,18 @@ static char *my_strndup(char *src, int n) {
return tmp;
}
-int load_words(char *fname) {
+int load_words(const char *fname) {
Common::File fp;
uint32 flen;
uint8 *mem = NULL;
- char *path = NULL;
words = NULL;
- path = fname;
-
- if (!fp.open(path)) {
- report("Warning: can't open %s\n", path);
+ if (!fp.open(fname)) {
+ report("Warning: can't open %s\n", fname);
return err_OK /*err_BadFileOpen */ ;
}
- report("Loading dictionary: %s\n", path);
+ report("Loading dictionary: %s\n", fname);
fp.seek(0, SEEK_END);
flen = fp.pos();