some livelog cleanup

The gamelog structure's type/flags field is 'long' but the
corresponding livelog event type field and the argument passed to
gamelog's logging were 'unsigned'.  They take the same values and
those values mean the same things so change them all to long.

The actual livelog logging assumed that time_t is a long number of
seconds, and was also using a boolean as an array index.  Perform
proper type conversions.

sysconf parsing used 'int' to hold strtol() value; change to long.
Also it was using raw_printf() instead of config_error_add() to
complain about any problems.  Clearly the livelog patch was not
updated to the current code base before being incorporated.
This commit is contained in:
PatR
2022-03-02 13:09:42 -08:00
parent 13d85abde5
commit 43e2f7d0ae
4 changed files with 59 additions and 39 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 pline.c $NHDT-Date: 1637982230 2021/11/27 03:03:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.104 $ */
/* NetHack 3.7 pline.c $NHDT-Date: 1646255375 2022/03/02 21:09:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.109 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -401,7 +401,7 @@ verbalize(const char *line, ...)
#ifdef CHRONICLE
void
gamelog_add(unsigned int glflags, long gltime, const char *str)
gamelog_add(long glflags, long gltime, const char *str)
{
struct gamelog_line *tmp;
struct gamelog_line *lst = g.gamelog;
@@ -420,13 +420,13 @@ gamelog_add(unsigned int glflags, long gltime, const char *str)
}
void
livelog_printf(unsigned ll_type, const char *line, ...)
livelog_printf(long ll_type, const char *line, ...)
{
char gamelogbuf[BUFSZ * 2];
va_list the_args;
va_start(the_args, line);
vsnprintf(gamelogbuf, sizeof gamelogbuf, line, the_args);
(void) vsnprintf(gamelogbuf, sizeof gamelogbuf, line, the_args);
va_end(the_args);
gamelog_add(ll_type, g.moves, gamelogbuf);
@@ -438,13 +438,14 @@ livelog_printf(unsigned ll_type, const char *line, ...)
void
gamelog_add(
unsigned glflags UNUSED, long gltime UNUSED, const char *msg UNUSED)
long glflags UNUSED, long gltime UNUSED, const char *msg UNUSED)
{
; /* nothing here */
}
void
livelog_printf(unsigned ll_type UNUSED, const char *line UNUSED, ...)
livelog_printf(
long ll_type UNUSED, const char *line UNUSED, ...)
{
; /* nothing here */
}