aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2019-05-22 21:39:41 -0700
committerPaul Gilbert2019-05-24 18:21:07 -0700
commit0d0dbf601e70b569936469c88b9f2a8f0197e6e6 (patch)
tree4c35c984841746f749a40c63b537d9bd6fb404b0
parent8f9fcec16c41ba4bfc51e7b92bdc701f5a2a2e6b (diff)
downloadscummvm-rg350-0d0dbf601e70b569936469c88b9f2a8f0197e6e6.tar.gz
scummvm-rg350-0d0dbf601e70b569936469c88b9f2a8f0197e6e6.tar.bz2
scummvm-rg350-0d0dbf601e70b569936469c88b9f2a8f0197e6e6.zip
GLK: TADS2: Fix uninitialized variable warnings
-rw-r--r--engines/glk/tads/tads2/output.cpp2
-rw-r--r--engines/glk/tads/tads2/run.cpp17
-rw-r--r--engines/glk/tads/tads2/run.h6
3 files changed, 14 insertions, 11 deletions
diff --git a/engines/glk/tads/tads2/output.cpp b/engines/glk/tads/tads2/output.cpp
index 79284b7b92..5f7e46b70b 100644
--- a/engines/glk/tads/tads2/output.cpp
+++ b/engines/glk/tads/tads2/output.cpp
@@ -2448,7 +2448,7 @@ static int outformatlen_stream(out_stream_info *stream,
|| !scumm_stricmp(tagbuf, "em")
|| !scumm_stricmp(tagbuf, "strong"))
{
- int attr;
+ int attr = 0;
/* choose the attribute flag */
switch (tagbuf[0])
diff --git a/engines/glk/tads/tads2/run.cpp b/engines/glk/tads/tads2/run.cpp
index 64b52a4d79..0def6a771b 100644
--- a/engines/glk/tads/tads2/run.cpp
+++ b/engines/glk/tads/tads2/run.cpp
@@ -1096,15 +1096,19 @@ void runexe(runcxdef *ctx, uchar *p0, objnum self, objnum target,
runsdef val; /* stack element (for pushing) */
runsdef val2; /* another one (for popping in two-op instructions) */
uint ofs; /* offset in code of current execution */
- prpnum prop; /* property number, when needed */
- objnum obj; /* object number, when needed */
+ prpnum prop = 0; /* property number, when needed */
+ objnum obj = 0; /* object number, when needed */
runsdef *noreg rstsp; /* sp to reset to on DISCARD instructions */
- uchar *lstp; /* list pointer */
+ uchar *lstp = nullptr; /* list pointer */
int nargc; /* argument count of called function */
runsdef *valp;
runsdef *stkval;
- int i;
+ int i = 0;
int brkchk;
+ runsdef val3;
+ int asityp;
+ int asiext = 0;
+ int lclnum = 0;
#ifndef DBG_OFF
int err;
@@ -1954,11 +1958,6 @@ resume_from_error:
default:
if ((opc & OPCASI_MASK) == OPCASI_MASK)
{
- runsdef val3;
- int asityp;
- int asiext;
- int lclnum;
-
valp = &val;
stkval = &val;
diff --git a/engines/glk/tads/tads2/run.h b/engines/glk/tads/tads2/run.h
index 0a39fca4e2..8b7c5905fc 100644
--- a/engines/glk/tads/tads2/run.h
+++ b/engines/glk/tads/tads2/run.h
@@ -57,7 +57,11 @@ struct runsdef {
objnum runsvobj; /* object value */
prpnum runsvprp; /* property number value */
uchar *runsvstr; /* string/list value */
- } runsv;
+ } runsv;
+
+ runsdef() : runstyp(0) {
+ runsv.runsvnum = 0;
+ }
};
/* external function control structure */