Skip to content

Commit

Permalink
Merge pull request #702 from wyld-sw/master
Browse files Browse the repository at this point in the history
Address several compiler warnings (some pedantic).
  • Loading branch information
tanabi authored Dec 18, 2023
2 parents d3896f4 + 6b0b3fd commit e497140
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 39 deletions.
3 changes: 2 additions & 1 deletion include/mfun.h
Original file line number Diff line number Diff line change
Expand Up @@ -2915,6 +2915,7 @@ const char *mfn_with(MFUNARGS);
*/
const char *mfn_xor(MFUNARGS);

#ifndef NO_MFUN_LIST
/**
* This structure defines a single MPI function and is used by the list of
* MPI functions.
Expand Down Expand Up @@ -3090,5 +3091,5 @@ static struct mfun_dat mfun_list[] = {

{NULL, NULL, 0, 0, 0, 0, 0} /* Ends the mfun list */
};

#endif /* !NO_MFUN_LIST */
#endif /* !MFUN_H */
7 changes: 5 additions & 2 deletions src/boolexp.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,10 @@ size_boolexp(struct boolexp *b)
case BOOLEXP_AND:
case BOOLEXP_OR:
result += size_boolexp(b->sub2);
/* fall through */
case BOOLEXP_NOT:
result += size_boolexp(b->sub1);
/* fall through */
case BOOLEXP_CONST:
break; /* CONST size is "baked into" sizeof *b */
case BOOLEXP_PROP:
Expand Down Expand Up @@ -823,8 +825,9 @@ unparse_boolexp1(dbref player, struct boolexp *b, short outer_type, int fullname
if (PropType(b->prop_check) == PROP_STRTYP)
strcatn(buftop, sizeof(boolexp_buf) - (size_t)(buftop - boolexp_buf),
PropDataStr(b->prop_check));
buftop += strlen(buftop);
break;

buftop += strlen(buftop);
break;
default:
panic("unparse_boolexp1(): bad type !");
}
Expand Down
27 changes: 17 additions & 10 deletions src/edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ disassemble(dbref player, dbref program)
case PROG_CLEARED:
snprintf(buf, sizeof(buf), "%d: (line ?) CLEARED INST AT %s:%d",
i, (char *) curr->data.addr, curr->line);
/* fall through */
default:
snprintf(buf, sizeof(buf), "%d: (line ?) UNKNOWN INST", i);
}
Expand Down Expand Up @@ -635,8 +636,10 @@ do_delete(dbref player, dbref program, int arg[], int argc)
switch (argc) {
case 0:
arg[0] = PROGRAM_CURR_LINE(program);
/* fall through */
case 1:
arg[1] = arg[0];
/* fall through */
case 2:
/*
* delete from line 1 to line 2
Expand Down Expand Up @@ -680,7 +683,8 @@ do_delete(dbref player, dbref program, int arg[], int argc)
notifyf(player, "%d line%s deleted", n, n != 1 ? "s" : "");
} else
notify(player, "No line to delete!");
break;

break;
default:
notify(player, "Too many arguments!");
break;
Expand Down Expand Up @@ -775,8 +779,10 @@ list_program(dbref player, dbref program, int *oarg, int argc,
switch (argc) {
case 0:
arg[0] = PROGRAM_CURR_LINE(program);
/* fall through */
case 1:
arg[1] = arg[0];
/* fall through */
case 2:
if ((arg[0] > arg[1]) && (arg[1] != -1)) {
notifyf_nolisten(player, "%sArguments don't make sense!%s", msg_start, msg_end);
Expand Down Expand Up @@ -1310,16 +1316,17 @@ read_program(dbref i)

if (!*buf)
strcpyn(buf, sizeof(buf), " ");
nu->this_line = alloc_string(buf);

if (!first) {
prev = nu;
first = nu;
} else {
prev->next = nu;
nu->prev = prev;
prev = nu;
}
nu->this_line = alloc_string(buf);

if (!first) {
prev = nu;
first = nu;
} else {
prev->next = nu;
nu->prev = prev;
prev = nu;
}
}

fclose(f);
Expand Down
11 changes: 11 additions & 0 deletions src/fbsignal.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ bailout(int sig)
void
sig_dump_status(int i)
{
(void)i;
dump_status();
}

Expand All @@ -272,6 +273,7 @@ sig_dump_status(int i)
void
sig_emerg(int i)
{
(void)i;
/*
* @TODO This should probably log_status as well ?
*/
Expand Down Expand Up @@ -307,6 +309,8 @@ wall_status(const char *s)
void
sig_reconfigure(int i)
{
(void)i;

wall_status("Configuration reload requested remotely.");

#ifdef USE_SSL
Expand All @@ -328,6 +332,8 @@ sig_reconfigure(int i)
void
sig_shutdown(int i)
{
(void)i;

log_status("SHUTDOWN: via SIGNAL");
shutdown_flag = 1;
restart_flag = 0;
Expand All @@ -341,6 +347,8 @@ sig_shutdown(int i)
void
sig_reap(int i)
{
(void)i;

/*
* If DISKBASE is not defined, then there are two types of
* children that can die. First is the nameservice resolver.
Expand Down Expand Up @@ -445,6 +453,8 @@ sig_reap(int i)
void
sig_reap(int i)
{
(void)i;

}
#endif

Expand All @@ -456,6 +466,7 @@ sig_reap(int i)
void
sig_shutdown(int i)
{
(void)i;
}

/*
Expand Down
15 changes: 7 additions & 8 deletions src/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1209,8 +1209,7 @@ welcome_user(struct descriptor_data *d)
* to DEFAULT_WELCOME_MESSAGE anyway.
*/
size_t ct = fread(buf, sizeof(char), BUFFER_LEN - 1, f);
if (ct >= 0)
buf[ct] = '\0';
buf[ct] = '\0';
fclose(f);
}
}
Expand Down Expand Up @@ -3202,6 +3201,9 @@ process_input_naws(struct descriptor_data *d, const char* q)
d->detected_width = ntohs(*((unsigned short*)d->width_buf));

break;

default:
break;
}
}

Expand Down Expand Up @@ -3776,7 +3778,6 @@ update_server_certificates(void)
{
time_t new_mtime_cert_file;
time_t new_mtime_key_file;
SSL_CTX* new_ctx;

new_mtime_cert_file = cert_file_mtime( tp_ssl_cert_file );
new_mtime_key_file = cert_file_mtime( tp_ssl_key_file );
Expand Down Expand Up @@ -3811,7 +3812,6 @@ update_server_certificates(void)
static SSL_CTX *
configure_new_ssl_ctx(void)
{
EC_KEY *eckey;
int ssl_status_ok = 1;

SSL_CTX *new_ssl_ctx = SSL_CTX_new(SSLv23_server_method());
Expand Down Expand Up @@ -3860,10 +3860,9 @@ configure_new_ssl_ctx(void)
* In OpenSSL >= 1.0.2, this exists; otherwise, fallback to the older
* API where we have to name a curve.
*/
eckey = NULL;
SSL_CTX_set_ecdh_auto(new_ssl_ctx, 1);
#else
eckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
EC_KEY eckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
SSL_CTX_set_tmp_ecdh(new_ssl_ctx, eckey);
#endif

Expand Down Expand Up @@ -3941,8 +3940,8 @@ reconfigure_ssl(void)
* Also, this doesn't wait for the resolver's pid.... it waits for any
* process to exit. Theoretically a forked dump could make this return.
*/
void
static kill_resolver(void)
static void
kill_resolver(void)
{
int i;

Expand Down
3 changes: 3 additions & 0 deletions src/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2869,10 +2869,13 @@ do_abort_interp(dbref player, const char *msg, struct inst *pc,
switch (nargs) {
case 4:
RCLEAR(oper4, file, line);
/* fall through */
case 3:
RCLEAR(oper3, file, line);
/* fall through */
case 2:
RCLEAR(oper2, file, line);
/* fall through */
case 1:
RCLEAR(oper1, file, line);
}
Expand Down
1 change: 1 addition & 0 deletions src/look.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ can_see(dbref player, dbref thing, int can_see_loc)
if (tp_dark_sleepers) {
return (!Dark(thing) && PLAYER_DESCRCOUNT(thing));
}
/* fall through */
default:
return (!Dark(thing) || (controls(player, thing) && !(FLAGS(player) & STICKY)));
}
Expand Down
1 change: 1 addition & 0 deletions src/mfuns.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "fbtime.h"
#include "game.h"
#include "interface.h"
#define NO_MFUN_LIST
#include "mfun.h"
#include "mpi.h"
#include "props.h"
Expand Down
1 change: 1 addition & 0 deletions src/mfuns2.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "inst.h"
#include "interp.h"
#include "interface.h"
#define NO_MFUN_LIST
#include "mfun.h"
#include "mpi.h"
#include "player.h"
Expand Down
11 changes: 7 additions & 4 deletions src/move.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,8 @@ do_get(int descr, dbref player, const char *what, const char *obj)
switch (Typeof(thing)) {
case TYPE_THING:
ts_useobject(thing);
/* fall through */

case TYPE_PROGRAM:
if (obj && *obj) {
cando = could_doit(descr, player, thing);
Expand All @@ -918,6 +920,7 @@ do_get(int descr, dbref player, const char *what, const char *obj)
}

break;

default:
notify(player, "You can't take that!");
break;
Expand Down Expand Up @@ -975,15 +978,15 @@ do_drop(int descr, dbref player, const char *name, const char *obj)
if (Wizard(OWNER(player)))
match_absolute(&md); /* the wizard has long fingers */

if ((cont = noisy_match_result(&md)) == NOTHING) {
return;
}
if ((cont = noisy_match_result(&md)) == NOTHING) {
return;
}
}

switch (Typeof(thing)) {
case TYPE_THING:
ts_useobject(thing);

/* fall through */
case TYPE_PROGRAM:
if (LOCATION(thing) != player) {
/* Shouldn't ever happen. */
Expand Down
2 changes: 1 addition & 1 deletion src/p_connects.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ prim_nextdescr(PRIM_PROTOTYPE)
void
prim_descriptors(PRIM_PROTOTYPE)
{
int mydescr, mycount = 0;
int mycount = 0;
int *darr;
int dcount;
struct descriptor_data* d;
Expand Down
2 changes: 2 additions & 0 deletions src/p_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ prim_moveto(PRIM_PROTOTYPE)
&& !(Typeof(dest) == TYPE_THING
&& (FLAGS(dest) & VEHICLE)))
abort_interp("Bad destination.");
/* fall through */

case TYPE_THING:
if (parent_loop_check(victim, dest))
Expand Down Expand Up @@ -295,6 +296,7 @@ prim_moveto(PRIM_PROTOTYPE)
abort_interp("Destination doesn't accept zombies.");

ts_lastuseobject(victim);
/* fall through */

case TYPE_PROGRAM: {
dbref matchroom = NOTHING;
Expand Down
6 changes: 6 additions & 0 deletions src/p_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,7 @@ prim_checkargs(PRIM_PROTOTYPE)

if (Typeof(ref) == TYPE_GARBAGE)
ABORT_CHECKARGS("Invalid dbref.");
/* fall through */

case 'd':
if (ref < HOME)
Expand All @@ -1327,6 +1328,7 @@ prim_checkargs(PRIM_PROTOTYPE)
case 'P':
if (ref < 0)
ABORT_CHECKARGS("Expected player dbref.");
/* fall through */

case 'p':
if ((ref >= 0) && (Typeof(ref) != TYPE_PLAYER))
Expand All @@ -1340,6 +1342,7 @@ prim_checkargs(PRIM_PROTOTYPE)
case 'R':
if ((ref < 0) && (ref != HOME))
ABORT_CHECKARGS("Expected room dbref.");
/* fall through */

case 'r':
if ((ref >= 0) && (Typeof(ref) != TYPE_ROOM))
Expand All @@ -1350,6 +1353,7 @@ prim_checkargs(PRIM_PROTOTYPE)
case 'T':
if (ref < 0)
ABORT_CHECKARGS("Expected thing dbref.");
/* fall through */

case 't':
if ((ref >= 0) && (Typeof(ref) != TYPE_THING))
Expand All @@ -1363,6 +1367,7 @@ prim_checkargs(PRIM_PROTOTYPE)
case 'E':
if (ref < 0)
ABORT_CHECKARGS("Expected exit dbref.");
/* fall through */

case 'e':
if ((ref >= 0) && (Typeof(ref) != TYPE_EXIT))
Expand All @@ -1376,6 +1381,7 @@ prim_checkargs(PRIM_PROTOTYPE)
case 'F':
if (ref < 0)
ABORT_CHECKARGS("Expected program dbref.");
/* fall through */

case 'f':
if ((ref >= 0) && (Typeof(ref) != TYPE_PROGRAM))
Expand Down
2 changes: 2 additions & 0 deletions src/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ toad_player(int descr, dbref player, dbref victim, dbref recipient)
FLAGS(stuff) &= ~(ABODE | WIZARD);
SetMLevel(stuff, 1);
}
/* fall through */

case TYPE_ROOM:
case TYPE_THING:
case TYPE_EXIT:
Expand Down
2 changes: 0 additions & 2 deletions src/prochelp.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ print_sections(FILE * f, FILE * hf)
char sectname[256];
char *osectptr;
char *sectptr;
char buf[256];
char buf3[256];
char buf4[256];
char *currsect;
Expand All @@ -429,7 +428,6 @@ print_sections(FILE * f, FILE * hf)

for (struct topiclist *sptr = secthead; sptr; sptr = sptr->next) {
currsect = sptr->section;
buf[0] = '\0';

strcpyn(sectname, sizeof(sectname), currsect);
sectptr = strchr(sectname, '|');
Expand Down
Loading

0 comments on commit e497140

Please sign in to comment.