[Scummvm-cvs-logs] SF.net SVN: scummvm:[33123] residual/trunk
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Sun Jul 20 15:34:33 CEST 2008
Revision: 33123
http://scummvm.svn.sourceforge.net/scummvm/?rev=33123&view=rev
Author: drmccoy
Date: 2008-07-20 13:34:04 +0000 (Sun, 20 Jul 2008)
Log Message:
-----------
Massive warnings fix, mostly "char *"->"const char *"
Modified Paths:
--------------
residual/trunk/engine/backend/dc/driver_ronin.h
residual/trunk/engine/backend/dc/driver_ronin_gfx.cpp
residual/trunk/engine/backend/driver.h
residual/trunk/engine/backend/sdl/driver_sdl.cpp
residual/trunk/engine/backend/sdl/driver_sdl.h
residual/trunk/engine/costume.cpp
residual/trunk/engine/costume.h
residual/trunk/engine/engine.h
residual/trunk/engine/lua/lapi.cpp
residual/trunk/engine/lua/lauxlib.cpp
residual/trunk/engine/lua/lauxlib.h
residual/trunk/engine/lua/lbuiltin.cpp
residual/trunk/engine/lua/ldo.cpp
residual/trunk/engine/lua/liolib.cpp
residual/trunk/engine/lua/llex.cpp
residual/trunk/engine/lua/llex.h
residual/trunk/engine/lua/lmem.cpp
residual/trunk/engine/lua/lmem.h
residual/trunk/engine/lua/lobject.cpp
residual/trunk/engine/lua/lobject.h
residual/trunk/engine/lua/lstring.cpp
residual/trunk/engine/lua/lstring.h
residual/trunk/engine/lua/lstrlib.cpp
residual/trunk/engine/lua/ltm.cpp
residual/trunk/engine/lua/ltm.h
residual/trunk/engine/lua/lua.h
residual/trunk/engine/lua/luadebug.h
residual/trunk/engine/lua/lualib.h
residual/trunk/engine/lua/lundump.cpp
residual/trunk/engine/lua/lvm.cpp
residual/trunk/engine/lua/lzio.cpp
residual/trunk/engine/lua/lzio.h
residual/trunk/engine/lua.cpp
residual/trunk/engine/lua.h
residual/trunk/engine/savegame.cpp
residual/trunk/engine/savegame.h
residual/trunk/engine/tinygl/error.cpp
residual/trunk/engine/tinygl/list.cpp
residual/trunk/engine/tinygl/zgl.h
residual/trunk/engine/walkplane.h
residual/trunk/icons/residual.xpm
Modified: residual/trunk/engine/backend/dc/driver_ronin.h
===================================================================
--- residual/trunk/engine/backend/dc/driver_ronin.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/backend/dc/driver_ronin.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -97,7 +97,7 @@
void prepareSmushFrame(int width, int height, byte *bitmap);
void drawSmushFrame(int offsetX, int offsetY);
- char *getVideoDeviceName();
+ const char *getVideoDeviceName();
const ControlDescriptor *listControls();
int getNumControls();
Modified: residual/trunk/engine/backend/dc/driver_ronin_gfx.cpp
===================================================================
--- residual/trunk/engine/backend/dc/driver_ronin_gfx.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/backend/dc/driver_ronin_gfx.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -604,7 +604,7 @@
_polyCount++;
}
-char *DriverRonin::getVideoDeviceName()
+const char *DriverRonin::getVideoDeviceName()
{
return "Dreamcast PowerVR Video Device";
}
Modified: residual/trunk/engine/backend/driver.h
===================================================================
--- residual/trunk/engine/backend/driver.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/backend/driver.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -124,7 +124,7 @@
virtual void prepareSmushFrame(int width, int height, byte *bitmap) = 0;
virtual void drawSmushFrame(int offsetX, int offsetY) = 0;
- virtual char *getVideoDeviceName() = 0;
+ virtual const char *getVideoDeviceName() = 0;
/** @name Events and Time */
//@{
@@ -192,7 +192,7 @@
*
*/
struct ControlDescriptor {
- char *name;
+ const char *name;
int key;
};
Modified: residual/trunk/engine/backend/sdl/driver_sdl.cpp
===================================================================
--- residual/trunk/engine/backend/sdl/driver_sdl.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/backend/sdl/driver_sdl.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -317,7 +317,7 @@
#endif
}
-char *DriverSDL::getVideoDeviceName() {
+const char *DriverSDL::getVideoDeviceName() {
return "SDL Video Device";
}
Modified: residual/trunk/engine/backend/sdl/driver_sdl.h
===================================================================
--- residual/trunk/engine/backend/sdl/driver_sdl.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/backend/sdl/driver_sdl.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -54,7 +54,7 @@
void setupIcon();
- char *getVideoDeviceName();
+ const char *getVideoDeviceName();
const ControlDescriptor *listControls();
int getNumControls();
Modified: residual/trunk/engine/costume.cpp
===================================================================
--- residual/trunk/engine/costume.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/costume.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -954,7 +954,7 @@
_chores[i].stop();
}
-int Costume::isChoring(char *name, bool excludeLooping) {
+int Costume::isChoring(const char *name, bool excludeLooping) {
for (int i = 0; i < _numChores; i++) {
if (!strcmp(_chores[i]._name, name) && _chores[i]._playing && !(excludeLooping && _chores[i]._looping))
return i;
Modified: residual/trunk/engine/costume.h
===================================================================
--- residual/trunk/engine/costume.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/costume.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -54,7 +54,7 @@
Model::HierNode *getModelNodes();
void setColormap(char *map);
void stopChores();
- int isChoring(char *name, bool excludeLooping);
+ int isChoring(const char *name, bool excludeLooping);
int isChoring(int num, bool excludeLooping);
int isChoring(bool excludeLooping);
Modified: residual/trunk/engine/engine.h
===================================================================
--- residual/trunk/engine/engine.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/engine.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -174,7 +174,7 @@
bool _savegameLoadRequest;
bool _savegameSaveRequest;
- char *_savegameFileName;
+ const char *_savegameFileName;
SaveGame *_savedState;
Engine();
Modified: residual/trunk/engine/lua/lapi.cpp
===================================================================
--- residual/trunk/engine/lua/lapi.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lapi.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -136,13 +136,13 @@
}
-lua_Object lua_gettagmethod (int tag, char *event)
+lua_Object lua_gettagmethod (int tag, const char *event)
{
return put_luaObject(luaT_gettagmethod(tag, event));
}
-lua_Object lua_settagmethod (int tag, char *event)
+lua_Object lua_settagmethod (int tag, const char *event)
{
checkCparams(1);
luaT_settagmethod(tag, event, L->stack.top-1);
@@ -208,7 +208,7 @@
}
-lua_Object lua_getglobal (char *name)
+lua_Object lua_getglobal (const char *name)
{
luaD_checkstack(2); /* may need that to call T.M. */
luaV_getglobal(luaS_new(name));
@@ -216,14 +216,14 @@
}
-lua_Object lua_rawgetglobal (char *name)
+lua_Object lua_rawgetglobal (const char *name)
{
TaggedString *ts = luaS_new(name);
return put_luaObject(&ts->u.s.globalval);
}
-void lua_setglobal (char *name)
+void lua_setglobal (const char *name)
{
checkCparams(1);
luaD_checkstack(2); /* may need that to call T.M. */
@@ -231,7 +231,7 @@
}
-void lua_rawsetglobal (char *name)
+void lua_rawsetglobal (const char *name)
{
TaggedString *ts = luaS_new(name);
checkCparams(1);
@@ -285,7 +285,7 @@
else return (nvalue(Address(object)));
}
-char *lua_getstring (lua_Object object)
+const char *lua_getstring (lua_Object object)
{
luaC_checkGC(); /* "tostring" may create a new string */
if (object == LUA_NOOBJECT || tostring(Address(object)))
@@ -329,7 +329,7 @@
incr_top;
}
-void lua_pushlstring (char *s, long len)
+void lua_pushlstring (const char *s, long len)
{
tsvalue(L->stack.top) = luaS_newlstr(s, len);
ttype(L->stack.top) = LUA_T_STRING;
@@ -337,7 +337,7 @@
luaC_checkGC();
}
-void lua_pushstring (char *s)
+void lua_pushstring (const char *s)
{
if (s == NULL)
lua_pushnil();
@@ -508,7 +508,7 @@
}
-void lua_funcinfo (lua_Object func, char **filename, int *linedefined)
+void lua_funcinfo (lua_Object func, const char **filename, int *linedefined)
{
if (!lua_isfunction(func))
lua_error("API - `funcinfo' called with a non-function value");
@@ -532,7 +532,7 @@
}
-char *lua_getobjname (lua_Object o, char **name)
+const char *lua_getobjname (lua_Object o, const char **name)
{ /* try to find a name for given function */
set_normalized(L->stack.top, Address(o)); /* to be accessed by "checkfunc */
if ((*name = luaT_travtagmethods(checkfunc)) != NULL)
Modified: residual/trunk/engine/lua/lauxlib.cpp
===================================================================
--- residual/trunk/engine/lua/lauxlib.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lauxlib.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -20,7 +20,7 @@
#include "lmem.h"
-int luaL_findstring (char *name, char *list[]) {
+int luaL_findstring (const char *name, const char *list[]) {
int i;
for (i=0; list[i]; i++)
if (strcmp(list[i], name) == 0)
@@ -28,9 +28,9 @@
return -1; /* name not found */
}
-void luaL_argerror (int numarg, char *extramsg)
+void luaL_argerror (int numarg, const char *extramsg)
{
- char *funcname;
+ const char *funcname;
lua_getobjname(lua_stackedfunction(0), &funcname);
if (funcname == NULL)
funcname = "???";
@@ -41,7 +41,7 @@
numarg, funcname, extramsg);
}
-char *luaL_check_lstr (int numArg, long *len)
+const char *luaL_check_lstr (int numArg, long *len)
{
lua_Object o = lua_getparam(numArg);
luaL_arg_check(lua_isstring(o), numArg, "string expected");
@@ -49,7 +49,7 @@
return lua_getstring(o);
}
-char *luaL_opt_lstr (int numArg, char *def, long *len)
+const char *luaL_opt_lstr (int numArg, const char *def, long *len)
{
return (lua_getparam(numArg) == LUA_NOOBJECT) ? def :
luaL_check_lstr(numArg, len);
@@ -120,7 +120,7 @@
}
-void luaL_verror (char *fmt, ...)
+void luaL_verror (const char *fmt, ...)
{
char buff[500];
va_list argp;
Modified: residual/trunk/engine/lua/lauxlib.h
===================================================================
--- residual/trunk/engine/lua/lauxlib.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lauxlib.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -13,7 +13,7 @@
struct luaL_reg {
- char *name;
+ const char *name;
lua_CFunction func;
};
@@ -30,17 +30,17 @@
void luaL_openlib (struct luaL_reg *l, int n);
void luaL_addlibtolist(luaL_reg *l, int n);
-void luaL_argerror (int numarg, char *extramsg);
+void luaL_argerror (int numarg, const char *extramsg);
#define luaL_check_string(n) (luaL_check_lstr((n), NULL))
-char *luaL_check_lstr (int numArg, long *len);
+const char *luaL_check_lstr (int numArg, long *len);
#define luaL_opt_string(n, d) (luaL_opt_lstr((n), (d), NULL))
-char *luaL_opt_lstr (int numArg, char *def, long *len);
+const char *luaL_opt_lstr (int numArg, const char *def, long *len);
double luaL_check_number (int numArg);
double luaL_opt_number (int numArg, double def);
lua_Object luaL_functionarg (int arg);
lua_Object luaL_tablearg (int arg);
lua_Object luaL_nonnullarg (int numArg);
-void luaL_verror (char *fmt, ...);
+void luaL_verror (const char *fmt, ...);
char *luaL_openspace (int size);
void luaL_resetbuffer (void);
void luaL_addchar (int c);
@@ -49,7 +49,7 @@
int luaL_newbuffer (int size);
void luaL_oldbuffer (int old);
char *luaL_buffer (void);
-int luaL_findstring (char *name, char *list[]);
+int luaL_findstring (const char *name, const char *list[]);
#endif
Modified: residual/trunk/engine/lua/lbuiltin.cpp
===================================================================
--- residual/trunk/engine/lua/lbuiltin.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lbuiltin.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -119,7 +119,7 @@
static void internaldostring (void)
{
long l;
- char *s = luaL_check_lstr(1, &l);
+ const char *s = luaL_check_lstr(1, &l);
if (*s == ID_CHUNK)
lua_error("`dostring' cannot run pre-compiled code");
if (lua_dobuffer(s, l, luaL_opt_string(2, NULL)) == 0)
@@ -130,7 +130,7 @@
static void internaldofile (void)
{
- char *fname = luaL_opt_string(1, NULL);
+ const char *fname = luaL_opt_string(1, NULL);
if (lua_dofile(fname) == 0)
if (luaA_passresults() == 0)
lua_pushuserdata(NULL); /* at least one result to signal no errors */
@@ -216,12 +216,13 @@
lua_pushnumber(lua_getnumber(o));
}
else {
- char *s = luaL_check_string(1);
+ const char *s = luaL_check_string(1);
+ char *e;
unsigned long n;
luaL_arg_check(0 <= base && base <= 36, 2, "base out of range");
- n = strtol(s, &s, base);
- while (isspace(*s)) s++; /* skip trailing spaces */
- if (*s) lua_pushnil(); /* invalid format: return nil */
+ n = strtol(s, &e, base);
+ while (isspace(*e)) e++; /* skip trailing spaces */
+ if (*e) lua_pushnil(); /* invalid format: return nil */
else lua_pushnumber(n);
}
}
@@ -243,7 +244,7 @@
static void setglobal (void)
{
- char *n = luaL_check_string(1);
+ const char *n = luaL_check_string(1);
lua_Object value = luaL_nonnullarg(2);
lua_pushobject(value);
lua_setglobal(n);
@@ -252,7 +253,7 @@
static void rawsetglobal (void)
{
- char *n = luaL_check_string(1);
+ const char *n = luaL_check_string(1);
lua_Object value = luaL_nonnullarg(2);
lua_pushobject(value);
lua_rawsetglobal(n);
@@ -287,7 +288,7 @@
{
lua_Object f = luaL_nonnullarg(1);
lua_Object arg = luaL_tablearg(2);
- char *options = luaL_opt_string(3, "");
+ const char *options = luaL_opt_string(3, "");
lua_Object err = lua_getparam(4);
int narg = getnarg(arg);
int i, status;
Modified: residual/trunk/engine/lua/ldo.cpp
===================================================================
--- residual/trunk/engine/lua/ldo.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/ldo.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -342,7 +342,7 @@
-static void message (char *s)
+static void message (const char *s)
{
TObject im = L->errorim;
if (ttype(&im) != LUA_T_NIL) {
@@ -354,7 +354,7 @@
/*
** Reports an error, and jumps up to the available recover label
*/
-void lua_error (char *s)
+void lua_error (const char *s)
{
if (s) message(s);
if (L->errorJmp)
@@ -465,7 +465,7 @@
}
-int lua_dofile (char *filename)
+int lua_dofile (const char *filename)
{
ZIO z;
int status;
@@ -493,7 +493,7 @@
#define SSIZE_PREF "20"
-static void build_name (char *str, char *name) {
+static void build_name (const char *str, char *name) {
if (str == NULL || *str == ID_CHUNK)
strcpy(name, "(buffer)");
else {
@@ -508,12 +508,12 @@
}
-int lua_dostring (char *str) {
+int lua_dostring (const char *str) {
return lua_dobuffer(str, strlen(str), NULL);
}
-int lua_dobuffer (char *buff, int size, char *name) {
+int lua_dobuffer (const char *buff, int size, const char *name) {
char newname[SIZE_PREF+25];
ZIO z;
int status;
Modified: residual/trunk/engine/lua/liolib.cpp
===================================================================
--- residual/trunk/engine/lua/liolib.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/liolib.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -78,7 +78,7 @@
else return 0;
}
-static FILE *getfile (char *name)
+static FILE *getfile (const char *name)
{
lua_Object f = lua_getglobal(name);
if (!ishandler(f))
@@ -87,7 +87,7 @@
}
-static FILE *getfileparam (char *name, int *arg)
+static FILE *getfileparam (const char *name, int *arg)
{
lua_Object f = lua_getparam(*arg);
if (ishandler(f)) {
@@ -99,7 +99,7 @@
}
-static void closefile (char *name)
+static void closefile (const char *name)
{
FILE *f = getfile(name);
if (f == stdin || f == stdout) return;
@@ -110,14 +110,14 @@
}
-static void setfile (FILE *f, char *name, int tag)
+static void setfile (FILE *f, const char *name, int tag)
{
lua_pushusertag(f, tag);
lua_setglobal(name);
}
-static void setreturn (FILE *f, char *name)
+static void setreturn (FILE *f, const char *name)
{
int tag = gettag(IOTAG);
setfile(f, name, tag);
@@ -136,7 +136,7 @@
else if (lua_tag(f) == gettag(IOTAG))
current = (FILE *)lua_getuserdata(f);
else {
- char *s = luaL_check_string(FIRSTARG);
+ const char *s = luaL_check_string(FIRSTARG);
if (*s == '|')
current = popen(s+1, "r");
else {
@@ -166,7 +166,7 @@
else if (lua_tag(f) == gettag(IOTAG))
current = (FILE *)lua_getuserdata(f);
else {
- char *s = luaL_check_string(FIRSTARG);
+ const char *s = luaL_check_string(FIRSTARG);
current = (*s == '|') ? popen(s+1,"w") : fopen(s,"w");
if (current == NULL) {
pushresult(0);
@@ -179,7 +179,7 @@
static void io_appendto (void)
{
- char *s = luaL_check_string(FIRSTARG);
+ const char *s = luaL_check_string(FIRSTARG);
FILE *fp = fopen (s, "a");
if (fp != NULL)
setreturn(fp, FOUTPUT);
@@ -205,7 +205,7 @@
static void io_read (void) {
int arg = FIRSTARG;
FILE *f = getfileparam(FINPUT, &arg);
- char *p = luaL_opt_string(arg, NULL);
+ const char *p = luaL_opt_string(arg, NULL);
luaL_resetbuffer();
if (p == NULL) /* default: read a line */
read_until(f, '\n');
@@ -228,7 +228,7 @@
p++;
continue;
default: {
- char *ep; /* get what is next */
+ const char *ep; /* get what is next */
int m; /* match result */
if (c == NEED_OTHER) c = getc(f);
if (c == EOF) {
@@ -273,7 +273,7 @@
int arg = FIRSTARG;
FILE *f = getfileparam(FOUTPUT, &arg);
int status = 1;
- char *s;
+ const char *s;
long l;
while ((s = luaL_opt_lstr(arg++, NULL, &l)) != NULL)
status = status && (fwrite(s, 1, l, f) == (unsigned long)l);
@@ -322,7 +322,7 @@
{
time_t t;
struct tm *tm;
- char *s = luaL_opt_string(1, "%c");
+ const char *s = luaL_opt_string(1, "%c");
char b[BUFSIZ];
time(&t); tm = localtime(&t);
if (strftime(b,sizeof(b),s,tm))
@@ -336,7 +336,7 @@
{
static int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC,
LC_TIME};
- static char *catnames[] = {"all", "collate", "ctype", "monetary",
+ static const char *catnames[] = {"all", "collate", "ctype", "monetary",
"numeric", "time", NULL};
int op = luaL_findstring(luaL_opt_string(2, "all"), catnames);
luaL_arg_check(op != -1, 2, "invalid option");
@@ -368,9 +368,9 @@
int level = 1; /* skip level 0 (it's this function) */
lua_Object func;
while ((func = lua_stackedfunction(level++)) != LUA_NOOBJECT) {
- char *name;
+ const char *name;
int currentline;
- char *filename;
+ const char *filename;
int linedefined;
lua_funcinfo(func, &filename, &linedefined);
fprintf(f, (level==2) ? "Active Stack:\n\t" : "\t");
Modified: residual/trunk/engine/lua/llex.cpp
===================================================================
--- residual/trunk/engine/lua/llex.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/llex.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -30,7 +30,7 @@
#define save_and_next(LS) (save(LS->current), next(LS))
-char *reserved [] = {"and", "do", "else", "elseif", "end", "function",
+const char *reserved [] = {"and", "do", "else", "elseif", "end", "function",
"if", "local", "nil", "not", "or", "repeat", "return", "then",
"until", "while"};
@@ -45,7 +45,7 @@
}
-void luaX_syntaxerror (LexState *ls, char *s, char *token) {
+void luaX_syntaxerror (LexState *ls, const char *s, const char *token) {
if (token[0] == 0)
token = "<eof>";
luaL_verror("%.100s;\n last token read: `%.50s' at line %d in chunk `%.50s'",
@@ -53,7 +53,7 @@
}
-void luaX_error (LexState *ls, char *s) {
+void luaX_error (LexState *ls, const char *s) {
save(0);
luaX_syntaxerror(ls, s, luaL_buffer());
}
@@ -117,7 +117,7 @@
static int checkcond (LexState *LS, char *buff)
{
- static char *opts[] = {"nil", "1", NULL};
+ static const char *opts[] = {"nil", "1", NULL};
int i = luaL_findstring(buff, opts);
if (i >= 0) return i;
else if (isalpha((unsigned char)buff[0]) || buff[0] == '_')
@@ -162,7 +162,7 @@
static void inclinenumber (LexState *LS)
{
- static char *pragmas [] =
+ static const char *pragmas [] =
{"debug", "nodebug", "endinput", "end", "ifnot", "if", "else", NULL};
next(LS); /* skip '\n' */
++LS->linenumber;
Modified: residual/trunk/engine/lua/llex.h
===================================================================
--- residual/trunk/engine/lua/llex.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/llex.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -54,8 +54,8 @@
void luaX_init (void);
void luaX_setinput (LexState *LS, ZIO *z);
int luaX_lex (LexState *LS);
-void luaX_syntaxerror (LexState *ls, char *s, char *token);
-void luaX_error (LexState *ls, char *s);
+void luaX_syntaxerror (LexState *ls, const char *s, const char *token);
+void luaX_error (LexState *ls, const char *s);
void luaX_token2str (LexState *ls, int token, char *s);
Modified: residual/trunk/engine/lua/lmem.cpp
===================================================================
--- residual/trunk/engine/lua/lmem.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lmem.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -14,7 +14,7 @@
int luaM_growaux (void **block, unsigned long nelems, int size,
- char *errormsg, unsigned long limit)
+ const char *errormsg, unsigned long limit)
{
if (nelems >= limit)
lua_error(errormsg);
Modified: residual/trunk/engine/lua/lmem.h
===================================================================
--- residual/trunk/engine/lua/lmem.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lmem.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -22,7 +22,7 @@
void *luaM_realloc (void *oldblock, unsigned long size);
int luaM_growaux (void **block, unsigned long nelems, int size,
- char *errormsg, unsigned long limit);
+ const char *errormsg, unsigned long limit);
#define luaM_free(b) free((b))
#define luaM_malloc(t) malloc((t))
Modified: residual/trunk/engine/lua/lobject.cpp
===================================================================
--- residual/trunk/engine/lua/lobject.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lobject.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -10,7 +10,7 @@
#include "lua.h"
-char *luaO_typenames[] = { /* ORDER LUA_T */
+const char *luaO_typenames[] = { /* ORDER LUA_T */
"userdata", "number", "string", "table", "function", "function", "task",
"nil", "function", "mark", "mark", "mark", "line", NULL
};
Modified: residual/trunk/engine/lua/lobject.h
===================================================================
--- residual/trunk/engine/lua/lobject.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lobject.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -191,7 +191,7 @@
} Hash;
-extern char *luaO_typenames[];
+extern const char *luaO_typenames[];
extern TObject luaO_nilobject;
Modified: residual/trunk/engine/lua/lstring.cpp
===================================================================
--- residual/trunk/engine/lua/lstring.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lstring.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -37,7 +37,7 @@
}
-static unsigned long hash_s (char *s, long l)
+static unsigned long hash_s (const char *s, long l)
{
unsigned long h = 0;
while (l--)
@@ -86,7 +86,7 @@
}
-static TaggedString *newone_s (char *str, long l, unsigned long h)
+static TaggedString *newone_s (const char *str, long l, unsigned long h)
{
TaggedString *ts = (TaggedString *)luaM_malloc(sizeof(TaggedString)+l);
memcpy(ts->str, str, l);
@@ -114,7 +114,7 @@
return ts;
}
-static TaggedString *insert_s (char *str, long l, stringtable *tb)
+static TaggedString *insert_s (const char *str, long l, stringtable *tb)
{
TaggedString *ts;
unsigned long h = hash_s(str, l);
@@ -130,8 +130,7 @@
j = i;
else if (ts->constindex >= 0 &&
ts->u.s.len == l &&
- (memcmp(str, ts->str, l) == 0))
- return ts;
+ (memcmp(str, ts->str, l) == 0)) return ts;
if (++i == size) i=0;
}
/* not found */
@@ -177,18 +176,18 @@
return insert_u(udata, tag, &L->string_root[(unsigned long)udata%NUM_HASHS]);
}
-TaggedString *luaS_newlstr (char *str, long l)
+TaggedString *luaS_newlstr (const char *str, long l)
{
int i = (l==0)?0:(unsigned char)str[0];
return insert_s(str, l, &L->string_root[i%NUM_HASHS]);
}
-TaggedString *luaS_new (char *str)
+TaggedString *luaS_new (const char *str)
{
return luaS_newlstr(str, strlen(str));
}
-TaggedString *luaS_newfixedstring (char *str)
+TaggedString *luaS_newfixedstring (const char *str)
{
TaggedString *ts = luaS_new(str);
if (ts->head.marked == 0)
@@ -305,7 +304,7 @@
}
-int luaS_globaldefined (char *name)
+int luaS_globaldefined (const char *name)
{
TaggedString *ts = luaS_new(name);
return ts->u.s.globalval.ttype != LUA_T_NIL;
Modified: residual/trunk/engine/lua/lstring.h
===================================================================
--- residual/trunk/engine/lua/lstring.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lstring.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -15,12 +15,12 @@
TaggedString *luaS_createudata (void *udata, int tag);
TaggedString *luaS_collector (void);
void luaS_free (TaggedString *l);
-TaggedString *luaS_newlstr (char *str, long l);
-TaggedString *luaS_new (char *str);
-TaggedString *luaS_newfixedstring (char *str);
+TaggedString *luaS_newlstr (const char *str, long l);
+TaggedString *luaS_new (const char *str);
+TaggedString *luaS_newfixedstring (const char *str);
void luaS_rawsetglobal (TaggedString *ts, TObject *newval);
char *luaS_travsymbol (int (*fn)(TObject *));
-int luaS_globaldefined (char *name);
+int luaS_globaldefined (const char *name);
TaggedString *luaS_collectudata (void);
void luaS_freeall (void);
Modified: residual/trunk/engine/lua/lstrlib.cpp
===================================================================
--- residual/trunk/engine/lua/lstrlib.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lstrlib.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -16,7 +16,7 @@
-static void addnchar (char *s, int n)
+static void addnchar (const char *s, int n)
{
char *b = luaL_openspace(n);
memcpy(b, s, n);
@@ -48,7 +48,7 @@
static void str_sub (void)
{
long l;
- char *s = luaL_check_lstr(1, &l);
+ const char *s = luaL_check_lstr(1, &l);
long start = posrelat((int)luaL_check_number(2), l);
long end = posrelat((int)luaL_opt_number(3, -1), l);
if (1 <= start && start <= end && end <= l)
@@ -61,7 +61,7 @@
{
long l;
int i;
- char *s = luaL_check_lstr(1, &l);
+ const char *s = luaL_check_lstr(1, &l);
luaL_resetbuffer();
for (i=0; i<l; i++)
luaL_addchar(tolower((unsigned char)(s[i])));
@@ -73,7 +73,7 @@
{
long l;
int i;
- char *s = luaL_check_lstr(1, &l);
+ const char *s = luaL_check_lstr(1, &l);
luaL_resetbuffer();
for (i=0; i<l; i++)
luaL_addchar(toupper((unsigned char)(s[i])));
@@ -83,7 +83,7 @@
static void str_rep (void)
{
long l;
- char *s = luaL_check_lstr(1, &l);
+ const char *s = luaL_check_lstr(1, &l);
int n = (int)luaL_check_number(2);
luaL_resetbuffer();
while (n-- > 0)
@@ -95,7 +95,7 @@
static void str_byte (void)
{
long l;
- char *s = luaL_check_lstr(1, &l);
+ const char *s = luaL_check_lstr(1, &l);
long pos = posrelat((int)luaL_opt_number(2, 1), l);
luaL_arg_check(0<pos && pos<=l, 2, "out of range");
lua_pushnumber((unsigned char)s[pos-1]);
@@ -123,9 +123,9 @@
struct Capture {
int level; /* total number of captures (finished or unfinished) */
- char *src_end; /* end ('\0') of source string */
+ const char *src_end; /* end ('\0') of source string */
struct {
- char *init;
+ const char *init;
int len; /* -1 signals unfinished capture */
} capture[MAX_CAPT];
};
@@ -162,7 +162,7 @@
}
-static char *bracket_end (char *p)
+static const char *bracket_end (const char *p)
{
return (*p == 0) ? NULL : strchr((*p=='^') ? p+2 : p+1, ']');
}
@@ -187,7 +187,7 @@
}
-int luaI_singlematch (int c, char *p, char **ep)
+int luaI_singlematch (int c, const char *p, const char **ep)
{
switch (*p) {
case '.': /* matches any char */
@@ -202,7 +202,7 @@
*ep = p+1;
return matchclass(c, (unsigned char)*p);
case '[': {
- char *end = bracket_end(p+1);
+ const char *end = bracket_end(p+1);
int sig = *(p+1) == '^' ? (p++, 0) : 1;
if (end == NULL) lua_error("incorrect pattern (missing `]')");
*ep = end+1;
@@ -227,7 +227,7 @@
}
-static char *matchbalance (char *s, int b, int e, struct Capture *cap)
+static const char *matchbalance (const char *s, int b, int e, struct Capture *cap)
{
if (*s != b) return NULL;
else {
@@ -243,7 +243,7 @@
}
-static char *matchitem (char *s, char *p, struct Capture *cap, char **ep)
+static const char *matchitem (const char *s, const char *p, struct Capture *cap, const char **ep)
{
if (*p == ESC) {
p++;
@@ -270,12 +270,12 @@
}
-static char *match (char *s, char *p, struct Capture *cap)
+static const char *match (const char *s, const char *p, struct Capture *cap)
{
init: /* using goto's to optimize tail recursion */
switch (*p) {
case '(': { /* start capture */
- char *res;
+ const char *res;
if (cap->level >= MAX_CAPT) lua_error("too many captures");
cap->capture[cap->level].init = s;
cap->capture[cap->level].len = -1;
@@ -286,7 +286,7 @@
}
case ')': { /* end capture */
int l = capture_to_close(cap);
- char *res;
+ const char *res;
cap->capture[l].len = s - cap->capture[l].init; /* close capture */
if ((res = match(s, p+1, cap)) == NULL) /* match failed? */
cap->capture[l].len = -1; /* undo capture */
@@ -297,23 +297,23 @@
return s;
/* else go through */
default: { /* it is a pattern item */
- char *ep; /* get what is next */
- char *s1 = matchitem(s, p, cap, &ep);
+ const char *ep; /* get what is next */
+ const char *s1 = matchitem(s, p, cap, &ep);
switch (*ep) {
case '*': { /* repetition */
- char *res;
+ const char *res;
if (s1 && s1>s && ((res=match(s1, p, cap)) != NULL))
return res;
p=ep+1; goto init; /* else return match(s, ep+1, cap); */
}
case '?': { /* optional */
- char *res;
+ const char *res;
if (s1 && ((res=match(s1, ep+1, cap)) != NULL))
return res;
p=ep+1; goto init; /* else return match(s, ep+1, cap); */
}
case '-': { /* repetition */
- char *res;
+ const char *res;
if ((res = match(s, ep+1, cap)) != NULL)
return res;
else if (s1 && s1>s) {
@@ -335,8 +335,8 @@
static void str_find (void)
{
long l;
- char *s = luaL_check_lstr(1, &l);
- char *p = luaL_check_string(2);
+ const char *s = luaL_check_lstr(1, &l);
+ const char *p = luaL_check_string(2);
long init = posrelat((int)luaL_opt_number(3, 1), l) - 1;
struct Capture cap;
luaL_arg_check(0 <= init && init <= l, 3, "out of range");
@@ -351,10 +351,10 @@
}
else {
int anchor = (*p == '^') ? (p++, 1) : 0;
- char *s1=s+init;
+ const char *s1=s+init;
cap.src_end = s+l;
do {
- char *res;
+ const char *res;
cap.level = 0;
if ((res=match(s1, p, &cap)) != NULL) {
lua_pushnumber(s1-s+1); /* start */
@@ -371,7 +371,7 @@
static void add_s (lua_Object newp, struct Capture *cap)
{
if (lua_isstring(newp)) {
- char *news = lua_getstring(newp);
+ const char *news = lua_getstring(newp);
int l = lua_strlen(newp);
int i;
for (i=0; i<l; i++) {
@@ -414,8 +414,8 @@
static void str_gsub (void)
{
long srcl;
- char *src = luaL_check_lstr(1, &srcl);
- char *p = luaL_check_string(2);
+ const char *src = luaL_check_lstr(1, &srcl);
+ const char *p = luaL_check_string(2);
lua_Object newp = lua_getparam(3);
int max_s = (int)luaL_opt_number(4, srcl+1);
int anchor = (*p == '^') ? (p++, 1) : 0;
@@ -426,7 +426,7 @@
luaL_resetbuffer();
cap.src_end = src+srcl;
while (n < max_s) {
- char *e;
+ const char *e;
cap.level = 0;
e = match(src, p, &cap);
if (e) {
@@ -446,7 +446,7 @@
}
-static void luaI_addquoted (char *s)
+static void luaI_addquoted (const char *s)
{
luaL_addchar('"');
for (; *s; s++) {
@@ -462,7 +462,7 @@
static void str_format (void)
{
int arg = 1;
- char *strfrmt = luaL_check_string(arg);
+ const char *strfrmt = luaL_check_string(arg);
struct Capture cap;
cap.src_end = strfrmt+strlen(strfrmt)+1;
luaL_resetbuffer();
@@ -474,7 +474,7 @@
else { /* format item */
char form[MAX_FORMAT]; /* store the format ('%...') */
char *buff;
- char *initf = strfrmt;
+ const char *initf = strfrmt;
form[0] = '%';
cap.level = 0;
if (isdigit((unsigned char)initf[0]) && initf[1] == '$') {
@@ -493,7 +493,7 @@
luaI_addquoted(luaL_check_string(arg));
continue;
case 's': {
- char *s = luaL_check_string(arg);
+ const char *s = luaL_check_string(arg);
buff = luaL_openspace(strlen(s));
sprintf(buff, form, s);
break;
Modified: residual/trunk/engine/lua/ltm.cpp
===================================================================
--- residual/trunk/engine/lua/ltm.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/ltm.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -16,14 +16,14 @@
#include "ltm.h"
-char *luaT_eventname[] = { /* ORDER IM */
+const char *luaT_eventname[] = { /* ORDER IM */
"gettable", "settable", "index", "getglobal", "setglobal", "add",
"sub", "mul", "div", "pow", "unm", "lt", "le", "gt", "ge",
"concat", "gc", "function", NULL
};
-static int luaI_checkevent (char *name, char *list[])
+static int luaI_checkevent (const char *name, const char *list[])
{
int e = luaL_findstring(name, list);
if (e < 0)
@@ -133,7 +133,7 @@
}
-TObject *luaT_gettagmethod (int t, char *event)
+TObject *luaT_gettagmethod (int t, const char *event)
{
int e = luaI_checkevent(event, luaT_eventname);
checktag(t);
@@ -144,7 +144,7 @@
}
-void luaT_settagmethod (int t, char *event, TObject *func)
+void luaT_settagmethod (int t, const char *event, TObject *func)
{
TObject temp = *func;
int e = luaI_checkevent(event, luaT_eventname);
@@ -157,7 +157,7 @@
}
-char *luaT_travtagmethods (int (*fn)(TObject *))
+const char *luaT_travtagmethods (int (*fn)(TObject *))
{
int e;
if (fn(&L->errorim))
Modified: residual/trunk/engine/lua/ltm.h
===================================================================
--- residual/trunk/engine/lua/ltm.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/ltm.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -48,15 +48,15 @@
#define luaT_getim(tag,event) (&L->IMtable[-(tag)].int_method[event])
#define luaT_getimbyObj(o,e) (luaT_getim(luaT_efectivetag(o),(e)))
-extern char *luaT_eventname[];
+extern const char *luaT_eventname[];
void luaT_init (void);
void luaT_realtag (int tag);
int luaT_efectivetag (TObject *o);
-void luaT_settagmethod (int t, char *event, TObject *func);
-TObject *luaT_gettagmethod (int t, char *event);
-char *luaT_travtagmethods (int (*fn)(TObject *));
+void luaT_settagmethod (int t, const char *event, TObject *func);
+TObject *luaT_gettagmethod (int t, const char *event);
+const char *luaT_travtagmethods (int (*fn)(TObject *));
void luaT_setfallback (void); /* only if LUA_COMPAT2_5 */
Modified: residual/trunk/engine/lua/lua.h
===================================================================
--- residual/trunk/engine/lua/lua.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lua.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -40,18 +40,18 @@
void lua_close (void);
lua_State *lua_setstate (lua_State *st);
-lua_Object lua_settagmethod (int tag, char *event); /* In: new method */
-lua_Object lua_gettagmethod (int tag, char *event);
+lua_Object lua_settagmethod (int tag, const char *event); /* In: new method */
+lua_Object lua_gettagmethod (int tag, const char *event);
lua_Object lua_seterrormethod (void); /* In: new method */
int lua_newtag (void);
int lua_copytagmethods (int tagto, int tagfrom);
void lua_settag (int tag); /* In: object */
-void lua_error (char *s);
-int lua_dofile (char *filename); /* Out: returns */
-int lua_dostring (char *string); /* Out: returns */
-int lua_dobuffer (char *buff, int size, char *name);
+void lua_error (const char *s);
+int lua_dofile (const char *filename); /* Out: returns */
+int lua_dostring (const char *string); /* Out: returns */
+int lua_dobuffer (const char *buff, int size, const char *name);
/* Out: returns */
int lua_callfunction (lua_Object f);
/* In: parameters; Out: returns */
@@ -72,7 +72,7 @@
int lua_isfunction (lua_Object object);
double lua_getnumber (lua_Object object);
-char *lua_getstring (lua_Object object);
+const char *lua_getstring (lua_Object object);
long lua_strlen (lua_Object object);
lua_CFunction lua_getcfunction (lua_Object object);
void *lua_getuserdata (lua_Object object);
@@ -80,18 +80,18 @@
void lua_pushnil (void);
void lua_pushnumber (double n);
-void lua_pushlstring (char *s, long len);
-void lua_pushstring (char *s);
+void lua_pushlstring (const char *s, long len);
+void lua_pushstring (const char *s);
void lua_pushcclosure (lua_CFunction fn, int n);
void lua_pushusertag (void *u, int tag);
void lua_pushobject (lua_Object object);
lua_Object lua_pop (void);
-lua_Object lua_getglobal (char *name);
-lua_Object lua_rawgetglobal (char *name);
-void lua_setglobal (char *name); /* In: value */
-void lua_rawsetglobal (char *name); /* In: value */
+lua_Object lua_getglobal (const char *name);
+lua_Object lua_rawgetglobal (const char *name);
+void lua_setglobal (const char *name); /* In: value */
+void lua_rawsetglobal (const char *name); /* In: value */
void lua_settable (void); /* In: table, index, value */
void lua_rawsettable (void); /* In: table, index, value */
Modified: residual/trunk/engine/lua/luadebug.h
===================================================================
--- residual/trunk/engine/lua/luadebug.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/luadebug.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -14,12 +14,12 @@
typedef lua_Object lua_Function;
typedef void (*lua_LHFunction) (int line);
-typedef void (*lua_CHFunction) (lua_Function func, char *file, int line);
+typedef void (*lua_CHFunction) (lua_Function func, const char *file, int line);
lua_Function lua_stackedfunction (int level);
-void lua_funcinfo (lua_Object func, char **filename, int *linedefined);
+void lua_funcinfo (lua_Object func, const char **filename, int *linedefined);
int lua_currentline (lua_Function func);
-char *lua_getobjname (lua_Object o, char **name);
+const char *lua_getobjname (lua_Object o, const char **name);
lua_Object lua_getlocal (lua_Function func, int local_number, char **name);
int lua_setlocal (lua_Function func, int local_number);
Modified: residual/trunk/engine/lua/lualib.h
===================================================================
--- residual/trunk/engine/lua/lualib.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lualib.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -28,7 +28,7 @@
/* Auxiliary functions (private) */
-int luaI_singlematch (int c, char *p, char **ep);
+int luaI_singlematch (int c, const char *p, const char **ep);
#endif
Modified: residual/trunk/engine/lua/lundump.cpp
===================================================================
--- residual/trunk/engine/lua/lundump.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lundump.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -181,7 +181,7 @@
static void LoadSignature(ZIO* Z)
{
- char* s=SIGNATURE;
+ const char* s=SIGNATURE;
while (*s!=0 && ezgetc(Z)==*s)
++s;
if (*s!=0) luaL_verror("bad signature in %s",zname(Z));
Modified: residual/trunk/engine/lua/lvm.cpp
===================================================================
--- residual/trunk/engine/lua/lvm.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lvm.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -206,7 +206,7 @@
}
-static void call_binTM (IMS event, char *msg)
+static void call_binTM (IMS event, const char *msg)
{
TObject *im = luaT_getimbyObj(L->stack.top-2, event);/* try first operand */
if (ttype(im) == LUA_T_NIL) {
Modified: residual/trunk/engine/lua/lzio.cpp
===================================================================
--- residual/trunk/engine/lua/lzio.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lzio.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -20,11 +20,11 @@
return EOZ;
}
-ZIO* zmopen (ZIO* z, char* b, int size, char *name)
+ZIO* zmopen (ZIO* z, const char* b, int size, const char *name)
{
if (b==NULL) return NULL;
z->n=size;
- z->p= (unsigned char *)b;
+ z->p= (const unsigned char *)b;
z->filbuf=zmfilbuf;
z->u=NULL;
z->name=name;
@@ -33,7 +33,7 @@
/* ------------------------------------------------------------ strings --- */
-ZIO* zsopen (ZIO* z, char* s, char *name)
+ZIO* zsopen (ZIO* z, const char* s, const char *name)
{
if (s==NULL) return NULL;
return zmopen(z,s,strlen(s),name);
@@ -51,7 +51,7 @@
}
-ZIO* zFopen (ZIO* z, FILE* f, char *name)
+ZIO* zFopen (ZIO* z, FILE* f, const char *name)
{
if (f==NULL) return NULL;
z->n=0;
Modified: residual/trunk/engine/lua/lzio.h
===================================================================
--- residual/trunk/engine/lua/lzio.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua/lzio.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -22,9 +22,9 @@
typedef struct zio ZIO;
-ZIO* zFopen (ZIO* z, FILE* f, char *name); /* open FILEs */
-ZIO* zsopen (ZIO* z, char* s, char *name); /* string */
-ZIO* zmopen (ZIO* z, char* b, int size, char *name); /* memory */
+ZIO* zFopen (ZIO* z, FILE* f, const char *name); /* open FILEs */
+ZIO* zsopen (ZIO* z, const char* s, const char *name); /* string */
+ZIO* zmopen (ZIO* z, const char* b, int size, const char *name); /* memory */
int zread (ZIO* z, void* b, int n); /* read next n bytes */
@@ -39,10 +39,10 @@
struct zio {
int n; /* bytes still unread */
- unsigned char* p; /* current position in buffer */
+ const unsigned char* p; /* current position in buffer */
int (*filbuf)(ZIO* z);
void* u; /* additional data */
- char *name;
+ const char *name;
unsigned char buffer[ZBSIZE]; /* buffer */
};
Modified: residual/trunk/engine/lua.cpp
===================================================================
--- residual/trunk/engine/lua.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -81,8 +81,8 @@
#define strmatch(src, dst) (strlen(src) == strlen(dst) && strcmp(src, dst) == 0)
#define DEBUG_FUNCTION() debugFunction("Function", __FUNCTION__)
-static void debugFunction(char *debugMessage, const char *funcName);
-static void stubWarning(char *funcName);
+static void debugFunction(const char *debugMessage, const char *funcName);
+static void stubWarning(const char *funcName);
static inline bool isObject(int num) {
lua_Object param = lua_getparam(num);
@@ -222,7 +222,7 @@
lua_pushnil();
}
-static Costume *get_costume(Actor *a, int param, char *called_from) {
+static Costume *get_costume(Actor *a, int param, const char *called_from) {
Costume *result;
if (lua_isnil(lua_getparam(param))) {
result = a->currentCostume();
@@ -239,7 +239,7 @@
// Lua interface to bundle_dofile
static void new_dofile() {
- char *fname_str = luaL_check_string(1);
+ const char *fname_str = luaL_check_string(1);
bundle_dofile(fname_str);
}
@@ -278,9 +278,9 @@
}
static void FunctionName() {
- char *name;
+ const char *name;
char buf[256];
- char *filename;
+ const char *filename;
int line;
DEBUG_FUNCTION();
@@ -321,7 +321,7 @@
// File functions
static void CheckForFile() {
- char *filename = luaL_check_string(1);
+ const char *filename = luaL_check_string(1);
DEBUG_FUNCTION();
pushbool(g_resourceloader->fileExists(filename));
@@ -359,7 +359,7 @@
// Registry functions
static void ReadRegistryValue() {
- char *key;
+ const char *key;
const char *val;
DEBUG_FUNCTION();
@@ -369,8 +369,8 @@
}
static void WriteRegistryValue() {
- char *key;
- char *val;
+ const char *key;
+ const char *val;
DEBUG_FUNCTION();
key = luaL_check_string(1);
@@ -420,7 +420,7 @@
}
static void SetSayLineDefaults() {
- char *key_text = NULL;
+ const char *key_text = NULL;
lua_Object table_obj;
lua_Object key = LUA_NOOBJECT;
@@ -892,7 +892,7 @@
}
static void SetActorColormap() {
- char *mapname;
+ const char *mapname;
CMap *_cmap;
Actor *act;
@@ -1467,7 +1467,7 @@
DEBUG_FUNCTION();
Actor *act = check_actor(1);
- char *name = lua_getstring(lua_getparam(2));
+ const char *name = lua_getstring(lua_getparam(2));
act->setShadowPlane(name);
}
@@ -1476,7 +1476,7 @@
DEBUG_FUNCTION();
Actor *act = check_actor(1);
- char *name = lua_getstring(lua_getparam(2));
+ const char *name = lua_getstring(lua_getparam(2));
act->addShadowPlane(name);
}
@@ -1534,7 +1534,7 @@
static void TextFileGetLine() {
char textBuf[512];
textBuf[0] = 0;
- char *filename;
+ const char *filename;
FILE *file;
DEBUG_FUNCTION();
@@ -1555,7 +1555,7 @@
static void TextFileGetLineCount() {
char textBuf[512];
- char *filename;
+ const char *filename;
FILE *file;
DEBUG_FUNCTION();
@@ -1592,8 +1592,8 @@
// Localization function
static void LocalizeString() {
- char msgId[32], buf[640], *str;
- char *result;
+ char msgId[32], buf[640];
+ const char *str, *result;
DEBUG_FUNCTION();
str = luaL_check_string(1);
@@ -1607,7 +1607,7 @@
} else {
result = str;
}
- lua_pushstring(const_cast<char *>(result));
+ lua_pushstring(result);
}
static void SayLine() {
@@ -1623,7 +1623,7 @@
if (!lua_isnil(param2)) {
do {
if (lua_isstring(param2)) {
- char *tmpstr = lua_getstring(param2);
+ const char *tmpstr = lua_getstring(param2);
msg = parseMsgText(tmpstr, msgId);
} else if (lua_isnumber(param2)) {
pan = 64;
@@ -1774,7 +1774,7 @@
numSectors = g_engine->currScene()->getSectorCount();
if (lua_isstring(sectorName)) {
- char *name = luaL_check_string(1);
+ const char *name = luaL_check_string(1);
for (i = 0; i < numSectors; i++) {
Sector *sector = g_engine->currScene()->getSectorBase(i);
@@ -1906,7 +1906,7 @@
static void ImStartSound() {
int priority, group;
- char *soundName;
+ const char *soundName;
DEBUG_FUNCTION();
soundName = luaL_check_string(1);
@@ -1930,7 +1930,7 @@
}
static void ImStopSound() {
- char *soundName;
+ const char *soundName;
DEBUG_FUNCTION();
soundName = luaL_check_string(1);
@@ -1953,7 +1953,7 @@
}
static void ImSetVoiceEffect() {
- char *effectName;
+ const char *effectName;
DEBUG_FUNCTION();
effectName = luaL_check_string(1);
@@ -1993,7 +1993,7 @@
static void ImSetParam() {
int param, value;
- char *soundName;
+ const char *soundName;
DEBUG_FUNCTION();
soundName = luaL_check_string(1);
@@ -2014,7 +2014,7 @@
}
void ImGetParam() {
- char *soundName;
+ const char *soundName;
int param;
DEBUG_FUNCTION();
@@ -2036,7 +2036,7 @@
static void ImFadeParam() {
int opcode, value, duration;
- char *soundName;
+ const char *soundName;
DEBUG_FUNCTION();
soundName = luaL_check_string(1);
@@ -2093,7 +2093,7 @@
g_engine->currScene()->getSoundParameters(&minVolume, &maxVolume);
}
- char *soundName = lua_getstring(lua_getresult(1));
+ const char *soundName = lua_getstring(lua_getresult(1));
if (isActor(lua_getparam(2))) {
Actor *act = check_actor(2);
@@ -2197,7 +2197,7 @@
}
static void luaFileFindFirst() {
- char *path, *extension;
+ const char *path, *extension;
lua_Object pathObj;
DEBUG_FUNCTION();
@@ -2291,7 +2291,7 @@
}
static void GetImage() {
- char *bitmapName;
+ const char *bitmapName;
DEBUG_FUNCTION();
bitmapName = luaL_check_string(1);
@@ -2326,7 +2326,7 @@
}
void getTextObjectParams(TextObject *textObject, lua_Object table_obj) {
- char *key_text = NULL;
+ const char *key_text = NULL;
lua_Object key = LUA_NOOBJECT;
DEBUG_FUNCTION();
@@ -2481,7 +2481,7 @@
static void MakeTextObject() {
TextObject *textObject = new TextObject();
lua_Object tableObj;
- char *line;
+ const char *line;
DEBUG_FUNCTION();
line = lua_getstring(lua_getparam(1));
@@ -2538,7 +2538,7 @@
DEBUG_FUNCTION();
TextObject *textObject = new TextObject();
lua_Object tableObj;
- char *line;
+ const char *line;
DEBUG_FUNCTION();
line = lua_getstring(lua_getparam(1));
@@ -2894,7 +2894,7 @@
static void NewObjectState() {
ObjectState *state = NULL;
ObjectState::Position pos;
- char *bitmap, *zbitmap;
+ const char *bitmap, *zbitmap;
bool visible;
int setupID;
@@ -2986,7 +2986,8 @@
*/
static void GetSaveGameImage() {
int width = 250, height = 188;
- char *filename, *data;
+ const char *filename;
+ char *data;
Bitmap *screenshot;
int dataSize;
@@ -3013,7 +3014,7 @@
lua_Object table, table2;
SaveGame *savedState;
int count = 0;
- char *str;
+ const char *str;
printf("SubmitSaveGameData() started.\n");
DEBUG_FUNCTION();
@@ -3042,7 +3043,7 @@
static void GetSaveGameData() {
lua_Object result;
- char *filename;
+ const char *filename;
int dataSize;
printf("GetSaveGameData() started.\n");
@@ -3127,7 +3128,7 @@
DEBUG_FUNCTION();
param1 = lua_getparam(1);
if (lua_isstring(param1)) {
- char *fontName = lua_getstring(param1);
+ const char *fontName = lua_getstring(param1);
Font *result = g_resourceloader->loadFont(fontName);
if (result) {
result->luaRef();
@@ -3243,7 +3244,7 @@
* generate warnings about missing functions when the debug flag
* is set to "Stub", warnings, or everything.
*/
-static void debugFunction(char *debugMessage, const char *funcName) {
+static void debugFunction(const char *debugMessage, const char *funcName) {
bool stubFn = strcmp(debugMessage, "WARNING: Stub function") == 0;
FILE *output;
@@ -3289,7 +3290,7 @@
}
// Stub function for builtin functions not yet implemented
-static void stubWarning(char *funcName) {
+static void stubWarning(const char *funcName) {
// If the user doesn't want these debug messages then don't print them
if (debugLevel != DEBUG_WARN && debugLevel != DEBUG_STUB && debugLevel != DEBUG_FUNC && debugLevel != DEBUG_ALL)
return;
@@ -3454,7 +3455,7 @@
// Entries in the system table
static struct {
- char *name;
+ const char *name;
int key;
} system_defaults[] = {
{ "frameTime", 0 },
@@ -3891,7 +3892,7 @@
return result;
}
-lua_Object getTableFunction(lua_Object table, char *name) {
+lua_Object getTableFunction(lua_Object table, const char *name) {
lua_pushobject(table);
lua_pushstring(const_cast<char *>(name));
lua_Object handler = lua_gettable();
@@ -3917,8 +3918,8 @@
return handler;
}
-lua_Object getTableValue(lua_Object table, char *name) {
- char *key_text = NULL;
+lua_Object getTableValue(lua_Object table, const char *name) {
+ const char *key_text = NULL;
lua_Object key = LUA_NOOBJECT;
if (!lua_istable(table)) {
@@ -3978,14 +3979,14 @@
return lua_getresult(2);
}
-void setTableValue(lua_Object table, char *name, int newvalue) {
+void setTableValue(lua_Object table, const char *name, int newvalue) {
lua_pushobject(table);
lua_pushstring(name);
lua_pushnumber(newvalue);
lua_settable();
}
-void setTableValue(lua_Object table, char *name, lua_Object newvalue) {
+void setTableValue(lua_Object table, const char *name, lua_Object newvalue) {
lua_pushobject(table);
lua_pushstring(name);
if (newvalue == 0)
@@ -4019,5 +4020,5 @@
lua_Object getEventHandler(const char *name) {
lua_Object system_table = lua_getglobal("system");
- return getTableFunction(system_table, (char *)name);
+ return getTableFunction(system_table, name);
}
Modified: residual/trunk/engine/lua.h
===================================================================
--- residual/trunk/engine/lua.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/lua.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -50,17 +50,17 @@
lua_Object getEventHandler(const char *name);
// set the value for a table item
-void setTableValue(lua_Object table, char *name, int newvalue);
-void setTableValue(lua_Object table, char *name, lua_Object newvalue);
+void setTableValue(lua_Object table, const char *name, int newvalue);
+void setTableValue(lua_Object table, const char *name, lua_Object newvalue);
// get the value of a table item
-lua_Object getTableValue(lua_Object table, char *name);
+lua_Object getTableValue(lua_Object table, const char *name);
lua_Object getIndexedTableValue(lua_Object table, int index);
// make a Vector3d object from coordinate table values
Vector3d tableToVector(lua_Object table);
// get a function stored in a table
-lua_Object getTableFunction(lua_Object table, char *name);
+lua_Object getTableFunction(lua_Object table, const char *name);
#endif
Modified: residual/trunk/engine/savegame.cpp
===================================================================
--- residual/trunk/engine/savegame.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/savegame.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -31,7 +31,7 @@
#define SAVEGAME_VERSION 2
// Constructor. Should create/open a saved game
-SaveGame::SaveGame(char *filename, bool saving) :
+SaveGame::SaveGame(const char *filename, bool saving) :
_saving(saving), _currentSection(0) {
if (_saving) {
uint32 tag = SAVEGAME_HEADERTAG;
@@ -99,6 +99,7 @@
}
delete[] _sectionBuffer;
_sectionBuffer = NULL;
+ _currentSection = 0;
}
void SaveGame::read(void *data, int size) {
@@ -110,7 +111,7 @@
_sectionPtr += size;
}
-void SaveGame::write(void *data, int size) {
+void SaveGame::write(const void *data, int size) {
if (!_saving)
error("SaveGame::writeBlock called when restoring a savegame!");
if (_currentSection == 0)
Modified: residual/trunk/engine/savegame.h
===================================================================
--- residual/trunk/engine/savegame.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/savegame.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -38,13 +38,13 @@
class SaveGame {
public:
- SaveGame(char *filename, bool saving);
+ SaveGame(const char *filename, bool saving);
~SaveGame();
uint32 beginSection(uint32 sectionTag);
void endSection();
void read(void *data, int size);
- void write(void *data, int size);
+ void write(const void *data, int size);
protected:
bool _saving;
Modified: residual/trunk/engine/tinygl/error.cpp
===================================================================
--- residual/trunk/engine/tinygl/error.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/tinygl/error.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -3,7 +3,7 @@
#include "engine/tinygl/zgl.h"
-void gl_fatal_error(char *format, ...) {
+void gl_fatal_error(const char *format, ...) {
va_list ap;
va_start(ap, format);
Modified: residual/trunk/engine/tinygl/list.cpp
===================================================================
--- residual/trunk/engine/tinygl/list.cpp 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/tinygl/list.cpp 2008-07-20 13:34:04 UTC (rev 33123)
@@ -1,7 +1,7 @@
#include "engine/tinygl/zgl.h"
-static char *op_table_str[] = {
+static const char *op_table_str[] = {
#define ADD_OP(a, b, c) "gl" #a " " #c,
#include "engine/tinygl/opinfo.h"
@@ -64,7 +64,7 @@
void gl_print_op(FILE *f, TGLParam *p) {
int op;
- char *s;
+ const char *s;
op = p[0].op;
p++;
Modified: residual/trunk/engine/tinygl/zgl.h
===================================================================
--- residual/trunk/engine/tinygl/zgl.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/tinygl/zgl.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -321,7 +321,7 @@
GLContext *gl_get_context(void);
-void gl_fatal_error(char *format, ...);
+void gl_fatal_error(const char *format, ...);
// specular buffer "api"
GLSpecBuf *specbuf_get_buffer(GLContext *c, const int shininess_i, const float shininess);
Modified: residual/trunk/engine/walkplane.h
===================================================================
--- residual/trunk/engine/walkplane.h 2008-07-20 13:24:30 UTC (rev 33122)
+++ residual/trunk/engine/walkplane.h 2008-07-20 13:34:04 UTC (rev 33123)
@@ -43,8 +43,8 @@
void setVisible(bool visible);
const char *name() const { return _name.c_str(); }
- const int id() const { return _id; }
- const int type() const { return _type; } // FIXME: Implement type de-masking
+ int id() const { return _id; }
+ int type() const { return _type; } // FIXME: Implement type de-masking
bool visible() const { return _visible; }
bool isPointInSector(Vector3d point) const;
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