aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2019-05-22 18:33:34 -0700
committerPaul Gilbert2019-05-24 18:21:07 -0700
commit5381930e8b09f61b8c7969db4a657067586be897 (patch)
tree20cea271def957405b4d1f6dd58ec1a5c70b2c27 /engines
parent1a974b9749f2c12edbdf98cbe9f4b6ec9fcba40d (diff)
downloadscummvm-rg350-5381930e8b09f61b8c7969db4a657067586be897.tar.gz
scummvm-rg350-5381930e8b09f61b8c7969db4a657067586be897.tar.bz2
scummvm-rg350-5381930e8b09f61b8c7969db4a657067586be897.zip
GLK: TADS2: Fix uninitialized variable warnings
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/tads/tads2/built_in.cpp4
-rw-r--r--engines/glk/tads/tads2/execute_command.cpp12
-rw-r--r--engines/glk/tads/tads2/file_io.cpp6
-rw-r--r--engines/glk/tads/tads2/line_source_file.cpp8
-rw-r--r--engines/glk/tads/tads2/object.cpp8
5 files changed, 19 insertions, 19 deletions
diff --git a/engines/glk/tads/tads2/built_in.cpp b/engines/glk/tads/tads2/built_in.cpp
index c67399d402..5831903c76 100644
--- a/engines/glk/tads/tads2/built_in.cpp
+++ b/engines/glk/tads/tads2/built_in.cpp
@@ -1189,8 +1189,8 @@ void bifsub(bifcxdef *ctx, int argc)
/* cvtstr - convert value to a string */
void bifcvs(bifcxdef *ctx, int argc)
{
- char *p;
- int len;
+ char *p = nullptr;
+ int len = 0;
char buf[30];
bifcntargs(ctx, 1, argc);
diff --git a/engines/glk/tads/tads2/execute_command.cpp b/engines/glk/tads/tads2/execute_command.cpp
index d38d92b370..d8ad6b2e87 100644
--- a/engines/glk/tads/tads2/execute_command.cpp
+++ b/engines/glk/tads/tads2/execute_command.cpp
@@ -2645,7 +2645,7 @@ int execmd(voccxdef *ctx, objnum actor, objnum prep,
{
uchar *l = runpoplst(rcx);
uint lstsiz;
- objnum defobj;
+ objnum defobj = 0;
int objcnt;
objnum newprep;
runsdef val;
@@ -2841,7 +2841,7 @@ int execmd(voccxdef *ctx, objnum actor, objnum prep,
{
uchar *l = runpoplst(rcx);
uint lstsiz;
- objnum defobj;
+ objnum defobj = 0;
int objcnt;
runsdef val;
objnum o;
@@ -3218,7 +3218,7 @@ int execmd(voccxdef *ctx, objnum actor, objnum prep,
uchar *l = runpoplst(rcx);
uint lstsiz;
int objcnt;
- objnum defobj;
+ objnum defobj = 0;
objnum o;
runsdef val;
@@ -3469,9 +3469,9 @@ int execmd(voccxdef *ctx, objnum actor, objnum prep,
}
else
{
- int is_him;
- int is_her;
- int is_them;
+ int is_him = 0;
+ int is_her = 0;
+ int is_them = 0;
/* run through the objects and check him/her */
for (i = 0 ; i < vcnt ; ++i)
diff --git a/engines/glk/tads/tads2/file_io.cpp b/engines/glk/tads/tads2/file_io.cpp
index 10b8bca180..5495c1b3d3 100644
--- a/engines/glk/tads/tads2/file_io.cpp
+++ b/engines/glk/tads/tads2/file_io.cpp
@@ -50,7 +50,7 @@ void OS_LOADDS fioldobj(void *ctx0, mclhd handle, uchar *ptr, ushort siz)
osfildef *fp = ctx->fiolcxfp;
char buf[7];
errcxdef *ec = ctx->fiolcxerr;
- uint rdsiz;
+ uint rdsiz = 0;
/* figure out what type of object is to be loaded */
osfseek(fp, seekpos + ctx->fiolcxst, OSFSK_SET);
@@ -714,8 +714,8 @@ static void fiord1(mcmcxdef *mctx, voccxdef *vctx, tokcxdef *tctx,
uchar *p;
uchar *bufp;
ulong bsiz;
- int len1;
- int len2;
+ int len1 = 0;
+ int len2 = 0;
/* do it in a single file read, if we can, for speed */
curpos = osfpos(fp) - startofs;
diff --git a/engines/glk/tads/tads2/line_source_file.cpp b/engines/glk/tads/tads2/line_source_file.cpp
index 430b1d9767..affc3cd587 100644
--- a/engines/glk/tads/tads2/line_source_file.cpp
+++ b/engines/glk/tads/tads2/line_source_file.cpp
@@ -87,7 +87,7 @@ linfdef *linfini(mcmcxdef *mctx, errcxdef *ec, char *filename,
int i;
objnum *objp;
linfdef *linf;
- osfildef *fp;
+ osfildef *fp = nullptr;
char fbuf[OSFNMAX + 1];
tokpdef fakepath;
int len;
@@ -404,8 +404,8 @@ void linfglop2(lindef *lin, uchar *buf)
int linfwrt(lindef *lin, osfildef *fp)
{
#define linf ((linfdef *)lin)
-#define UCHAR_MAX 255
- uchar buf[UCHAR_MAX + 6];
+#define BYTE_MAX 255
+ uchar buf[BYTE_MAX + 6];
size_t len;
uint pgcnt;
uchar *objp;
@@ -413,7 +413,7 @@ int linfwrt(lindef *lin, osfildef *fp)
buf[0] = lin->linid;
len = strlen(linf->linfnam);
- if (len > UCHAR_MAX)
+ if (len > BYTE_MAX)
return FALSE;
buf[1] = (uchar)len;
oswp4(buf + 2, linf->linfcrec);
diff --git a/engines/glk/tads/tads2/object.cpp b/engines/glk/tads/tads2/object.cpp
index 4360f5fea9..4e6f309883 100644
--- a/engines/glk/tads/tads2/object.cpp
+++ b/engines/glk/tads/tads2/object.cpp
@@ -42,11 +42,11 @@ uint objgetp(mcmcxdef *mctx, objnum objn, prpnum prop, dattyp *typptr)
uint retval; /* property offset, if we find it */
uint ignprop; /* ignored property - use if real property isn't found */
uchar pbuf[2]; /* property number in portable format */
- uchar *indp;
+ uchar *indp = nullptr;
uchar *indbase;
int last;
int first;
- int cur;
+ int cur = 0;
oswp2(pbuf, prop); /* get property number in portable foramt */
objptr = (objdef *)mcmlck(mctx, objn); /* get a lock on the object */
@@ -192,7 +192,7 @@ static uint objgetap0(mcmcxdef *ctx, noreg objnum obj, prpnum prop,
{
uchar *sc;
ushort sccnt;
- ushort psav;
+ ushort psav = 0;
dattyp typsav = DAT_NIL;
objnum osavn = MCMONINV;
uchar *o1;
@@ -240,7 +240,7 @@ static uint objgetap0(mcmcxdef *ctx, noreg objnum obj, prpnum prop,
/* if we found the property, remember it */
if (poff != 0)
{
- int isdesc;
+ int isdesc = 0;
/* if we have a previous object, determine lineage */
if (found)