aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/tads/tads2
diff options
context:
space:
mode:
Diffstat (limited to 'engines/glk/tads/tads2')
-rw-r--r--engines/glk/tads/tads2/error.cpp10
-rw-r--r--engines/glk/tads/tads2/output.cpp21
-rw-r--r--engines/glk/tads/tads2/run.cpp2
-rw-r--r--engines/glk/tads/tads2/run.h2
-rw-r--r--engines/glk/tads/tads2/runtime_driver.cpp4
-rw-r--r--engines/glk/tads/tads2/text_io.h2
-rw-r--r--engines/glk/tads/tads2/vocabulary_parser.cpp4
7 files changed, 14 insertions, 31 deletions
diff --git a/engines/glk/tads/tads2/error.cpp b/engines/glk/tads/tads2/error.cpp
index 62c5e9a3e6..ad83d06f21 100644
--- a/engines/glk/tads/tads2/error.cpp
+++ b/engines/glk/tads/tads2/error.cpp
@@ -184,16 +184,6 @@ void errsign(errcxdef *ctx, int e) {
#endif
}
-/* enter a string argument */
-char *errstr(errcxdef *ctx, const char *str, int len) {
- char *ret = &ctx->errcxbuf[ctx->errcxofs];
-
- memcpy(ret, str, (size_t)len);
- ret[len] = '\0';
- ctx->errcxofs += len + 1;
- return(ret);
-}
-
/* log an error: base function */
void errlogn(errcxdef *ctx, int err) {
error("errlogn");
diff --git a/engines/glk/tads/tads2/output.cpp b/engines/glk/tads/tads2/output.cpp
index 6ff2a992a4..6f5cd842e7 100644
--- a/engines/glk/tads/tads2/output.cpp
+++ b/engines/glk/tads/tads2/output.cpp
@@ -194,8 +194,7 @@ static objnum cmdActor; /* current actor */
/* forward declarations of static functions */
static void outstring_stream(out_stream_info *stream, const char *s);
static void outchar_noxlat_stream(out_stream_info *stream, char c);
-static char out_parse_entity(char *outbuf, size_t outbuf_size,
- char **sp, size_t *slenp);
+static char out_parse_entity(char *outbuf, size_t outbuf_size, const char **sp, size_t *slenp);
/* ------------------------------------------------------------------------ */
@@ -1741,7 +1740,7 @@ static void out_pop_stream()
* Get the next character, writing the previous character to the given
* output stream if it's not null.
*/
-static char nextout_copy(char **s, size_t *slen,
+static char nextout_copy(const char **s, size_t *slen,
char prv, out_stream_info *stream)
{
/* if there's a stream, write the previous character to the stream */
@@ -1759,7 +1758,7 @@ static char nextout_copy(char **s, size_t *slen,
* the next character after the tag name.
*/
static char read_tag(char *dst, size_t dstlen, int *is_end_tag,
- char **s, size_t *slen, out_stream_info *stream)
+ const char **s, size_t *slen, out_stream_info *stream)
{
char c;
@@ -2722,12 +2721,10 @@ static int outformatlen_stream(out_stream_info *stream,
/*
* Parse an HTML entity markup
*/
-static char out_parse_entity(char *outbuf, size_t outbuf_size,
- char **sp, size_t *slenp)
-{
+static char out_parse_entity(char *outbuf, size_t outbuf_size, const char **sp, size_t *slenp) {
char ampbuf[10];
char *dst;
- char *orig_s;
+ const char *orig_s;
size_t orig_slen;
const amp_tbl_t *ampptr;
size_t lo, hi, cur;
@@ -2988,8 +2985,7 @@ void tio_set_html_expansion(unsigned int html_char_val,
/*
* Write out a c-style (null-terminated) string.
*/
-int outformat(char *s)
-{
+int outformat(const char *s) {
return outformatlen(s, strlen(s));
}
@@ -2999,11 +2995,10 @@ int outformat(char *s)
* This routine sends out a string, one character at a time (via outchar).
* Escape codes ('\n', and so forth) are handled here.
*/
-int outformatlen(char *s, uint slen)
-{
+int outformatlen(const char *s, uint slen) {
char c;
uint orig_slen;
- char *orig_s;
+ const char *orig_s;
int ret;
int called_filter;
diff --git a/engines/glk/tads/tads2/run.cpp b/engines/glk/tads/tads2/run.cpp
index 5a9ede0f2b..4179ff2864 100644
--- a/engines/glk/tads/tads2/run.cpp
+++ b/engines/glk/tads/tads2/run.cpp
@@ -281,7 +281,7 @@ void runrepush(runcxdef *ctx, runsdef *val)
}
/* push a counted-length string onto the stack */
-void runpstr(runcxdef *ctx, char *str, int len, int sav)
+void runpstr(runcxdef *ctx, const char *str, int len, int sav)
{
runsdef val;
diff --git a/engines/glk/tads/tads2/run.h b/engines/glk/tads/tads2/run.h
index 6c303b81ce..297cb9d540 100644
--- a/engines/glk/tads/tads2/run.h
+++ b/engines/glk/tads/tads2/run.h
@@ -146,7 +146,7 @@ void runpnil(runcxdef *ctx);
void runpbuf(runcxdef *ctx, int typ, void *val);
/* push a counted-length string onto the stack */
-void runpstr(runcxdef *ctx, char *str, int len, int sav);
+void runpstr(runcxdef *ctx, const char *str, int len, int sav);
/*
* Push a C-style string onto the stack, converting escape codes. If
diff --git a/engines/glk/tads/tads2/runtime_driver.cpp b/engines/glk/tads/tads2/runtime_driver.cpp
index 20ba6c1e99..aec86702ae 100644
--- a/engines/glk/tads/tads2/runtime_driver.cpp
+++ b/engines/glk/tads/tads2/runtime_driver.cpp
@@ -789,9 +789,7 @@ static void trdmain1(errcxdef *ec, int argc, char *argv[],
#endif
/* log an error */
-static void trdlogerr(void *ctx0, char *fac, int err,
- int argc, erradef *argv)
-{
+static void trdlogerr(void *ctx0, const char *fac, int err, int argc, erradef *argv) {
errcxdef *ctx = (errcxdef *)ctx0;
char buf[256];
char msg[256];
diff --git a/engines/glk/tads/tads2/text_io.h b/engines/glk/tads/tads2/text_io.h
index 9a0e19885d..d4dd16ff7d 100644
--- a/engines/glk/tads/tads2/text_io.h
+++ b/engines/glk/tads/tads2/text_io.h
@@ -95,7 +95,7 @@ void outfmt(tiocxdef *ctx, uchar *txt);
int outformat(const char *s);
/* format a counted-length string, which may not be null-terminated */
-int outformatlen(char *s, uint len);
+int outformatlen(const char *s, uint len);
/* flush output, with specified newline mode */
void outflushn(int nl);
diff --git a/engines/glk/tads/tads2/vocabulary_parser.cpp b/engines/glk/tads/tads2/vocabulary_parser.cpp
index 719005851c..0b7bed6db9 100644
--- a/engines/glk/tads/tads2/vocabulary_parser.cpp
+++ b/engines/glk/tads/tads2/vocabulary_parser.cpp
@@ -667,7 +667,7 @@ struct vocerr_va_info
char user_msg[400];
/* the sprintf-style format string to display */
- char *fmt;
+ const char *fmt;
/*
* Pointer to the output buffer to use to format the string 'fmt' with
@@ -734,7 +734,7 @@ static void vocerr_va_prep(voccxdef *ctx, struct vocerr_va_info *info,
};
struct argbuf_t args[5];
struct argbuf_t *argp;
- char *p;
+ const char *p;
/*
* Retrieve the arguments by examining the format string. We