GLK: TADS2: Further compilation fixes

This commit is contained in:
Paul Gilbert 2019-05-22 18:27:26 -07:00
parent aa5fd603b6
commit 1a974b9749
7 changed files with 14 additions and 31 deletions

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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];

View File

@ -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);

View File

@ -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