[Scummvm-cvs-logs] SF.net SVN: scummvm: [22614] scummvm/trunk/engines/agi
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Wed May 24 12:53:02 CEST 2006
Revision: 22614
Author: eriktorbjorn
Date: 2006-05-24 12:51:37 -0700 (Wed, 24 May 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22614&view=rev
Log Message:
-----------
Fixed most - not all - GCC warnings.
Modified Paths:
--------------
scummvm/trunk/engines/agi/agi.h
scummvm/trunk/engines/agi/agi_v2.cpp
scummvm/trunk/engines/agi/agi_v3.cpp
scummvm/trunk/engines/agi/console.cpp
scummvm/trunk/engines/agi/console.h
scummvm/trunk/engines/agi/graphics.cpp
scummvm/trunk/engines/agi/graphics.h
scummvm/trunk/engines/agi/id.cpp
scummvm/trunk/engines/agi/objects.cpp
scummvm/trunk/engines/agi/op_cmd.cpp
scummvm/trunk/engines/agi/op_dbg.cpp
scummvm/trunk/engines/agi/op_test.cpp
scummvm/trunk/engines/agi/opcodes.h
scummvm/trunk/engines/agi/picture.cpp
scummvm/trunk/engines/agi/picture.h
scummvm/trunk/engines/agi/savegame.cpp
scummvm/trunk/engines/agi/sound.cpp
scummvm/trunk/engines/agi/sprite.cpp
scummvm/trunk/engines/agi/text.cpp
scummvm/trunk/engines/agi/text.h
scummvm/trunk/engines/agi/words.cpp
Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/agi.h 2006-05-24 19:51:37 UTC (rev 22614)
@@ -479,8 +479,8 @@
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 @@
/* 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);
Modified: scummvm/trunk/engines/agi/agi_v2.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi_v2.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/agi_v2.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -34,8 +34,8 @@
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 @@
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 @@
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);
}
Modified: scummvm/trunk/engines/agi/agi_v3.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi_v3.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/agi_v3.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -38,8 +38,8 @@
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 @@
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 @@
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);
}
Modified: scummvm/trunk/engines/agi/console.cpp
===================================================================
--- scummvm/trunk/engines/agi/console.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/console.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -427,7 +427,7 @@
/*
* 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 @@
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 @@
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 *debug;
-void report(char *message, ...) {
+void report(const char *message, ...) {
/* dummy */
}
Modified: scummvm/trunk/engines/agi/console.h
===================================================================
--- scummvm/trunk/engines/agi/console.h 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/console.h 2006-05-24 19:51:37 UTC (rev 22614)
@@ -64,7 +64,7 @@
void console_cycle(void);
void console_lock(void);
void console_prompt(void);
-void report(char *, ...);
+void report(const char *, ...);
} // End of namespace Agi
Modified: scummvm/trunk/engines/agi/graphics.cpp
===================================================================
--- scummvm/trunk/engines/agi/graphics.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/graphics.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -338,7 +338,7 @@
* @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 @@
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;
Modified: scummvm/trunk/engines/agi/graphics.h
===================================================================
--- scummvm/trunk/engines/agi/graphics.h 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/graphics.h 2006-05-24 19:51:37 UTC (rev 22614)
@@ -63,8 +63,8 @@
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 *);
Modified: scummvm/trunk/engines/agi/id.cpp
===================================================================
--- scummvm/trunk/engines/agi/id.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/id.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -310,13 +310,12 @@
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 @@
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);
Modified: scummvm/trunk/engines/agi/objects.cpp
===================================================================
--- scummvm/trunk/engines/agi/objects.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/objects.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -92,20 +92,18 @@
}
-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);
Modified: scummvm/trunk/engines/agi/op_cmd.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_cmd.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/op_cmd.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -866,7 +866,7 @@
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(quit) {
- char *buttons[] = { "Quit", "Continue", NULL };
+ const char *buttons[] = { "Quit", "Continue", NULL };
stop_sound();
if (p0) {
@@ -972,7 +972,7 @@
}
cmd(restart_game) {
- char *buttons[] = { "Restart", "Continue", NULL };
+ const char *buttons[] = { "Restart", "Continue", NULL };
int sel;
stop_sound();
Modified: scummvm/trunk/engines/agi/op_dbg.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_dbg.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/op_dbg.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -272,7 +272,7 @@
#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;
Modified: scummvm/trunk/engines/agi/op_test.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_test.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/op_test.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -410,7 +410,7 @@
#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;
Modified: scummvm/trunk/engines/agi/opcodes.h
===================================================================
--- scummvm/trunk/engines/agi/opcodes.h 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/opcodes.h 2006-05-24 19:51:37 UTC (rev 22614)
@@ -31,7 +31,7 @@
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_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 *);
Modified: scummvm/trunk/engines/agi/picture.cpp
===================================================================
--- scummvm/trunk/engines/agi/picture.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/picture.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -873,14 +873,14 @@
/**
*
*/
-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 @@
old = d;
}
- free(data);
+ free(src);
xdata = (uint8 *)realloc(xdata, ulen);
return xdata;
Modified: scummvm/trunk/engines/agi/picture.h
===================================================================
--- scummvm/trunk/engines/agi/picture.h 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/picture.h 2006-05-24 19:51:37 UTC (rev 22614)
@@ -40,7 +40,7 @@
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
Modified: scummvm/trunk/engines/agi/savegame.cpp
===================================================================
--- scummvm/trunk/engines/agi/savegame.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/savegame.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -124,7 +124,7 @@
/* */
-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 @@
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 @@
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 @@
*/
#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_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 */
Modified: scummvm/trunk/engines/agi/sound.cpp
===================================================================
--- scummvm/trunk/engines/agi/sound.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/sound.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -702,14 +702,12 @@
#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();
Modified: scummvm/trunk/engines/agi/sprite.cpp
===================================================================
--- scummvm/trunk/engines/agi/sprite.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/sprite.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -452,10 +452,10 @@
* 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) ?
Modified: scummvm/trunk/engines/agi/text.cpp
===================================================================
--- scummvm/trunk/engines/agi/text.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/text.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -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 @@
/* 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 @@
/**
* 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 @@
/**
* 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 @@
* 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 @@
* @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 @@
/**
*
*/
-static void print_status(char *message, ...) {
+static void print_status(const char *message, ...) {
char x[42];
va_list args;
@@ -484,7 +484,7 @@
* @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;
Modified: scummvm/trunk/engines/agi/text.h
===================================================================
--- scummvm/trunk/engines/agi/text.h 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/text.h 2006-05-24 19:51:37 UTC (rev 22614)
@@ -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);
Modified: scummvm/trunk/engines/agi/words.cpp
===================================================================
--- scummvm/trunk/engines/agi/words.cpp 2006-05-24 15:42:51 UTC (rev 22613)
+++ scummvm/trunk/engines/agi/words.cpp 2006-05-24 19:51:37 UTC (rev 22614)
@@ -44,21 +44,18 @@
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();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list