Commit b894bf97 authored by rswindell's avatar rswindell

Address numerous new warnings raised by GCC v6.3.0

parent eadb44ff
......@@ -59,7 +59,7 @@ void sbbs_t::multinodechat(int channel)
if(useron.rest&FLAG('C')) {
bputs(text[R_Chat]);
return;
return;
}
if(channel<1 || channel>cfg.total_chans)
......@@ -71,29 +71,29 @@ void sbbs_t::multinodechat(int channel)
menu("multchat");
bputs(text[WelcomeToMultiChat]);
if(getnodedat(cfg.node_num,&thisnode,true)==0) {
thisnode.aux=channel;
thisnode.aux=channel;
putnodedat(cfg.node_num,&thisnode);
}
bprintf(text[WelcomeToChannelN],channel,cfg.chan[channel-1]->name);
if(gurubuf) {
free(gurubuf);
gurubuf=NULL;
gurubuf=NULL;
}
if(cfg.chan[channel-1]->misc&CHAN_GURU && cfg.chan[channel-1]->guru<cfg.total_gurus
&& chk_ar(cfg.guru[cfg.chan[channel-1]->guru]->ar,&useron,&client)) {
sprintf(str,"%s%s.dat",cfg.ctrl_dir,cfg.guru[cfg.chan[channel-1]->guru]->code);
if((file=nopen(str,O_RDONLY))==-1) {
errormsg(WHERE,ERR_OPEN,str,O_RDONLY);
return;
return;
}
if((gurubuf=(char *)malloc((size_t)filelength(file)+1))==NULL) {
close(file);
errormsg(WHERE,ERR_ALLOC,str,(size_t)filelength(file)+1);
return;
return;
}
read(file,gurubuf,(size_t)filelength(file));
gurubuf[filelength(file)]=0;
close(file);
close(file);
}
usrs=0;
for(i=1;i<=cfg.sys_nodes && i<=cfg.sys_lastnode;i++) {
......@@ -106,7 +106,7 @@ void sbbs_t::multinodechat(int channel)
continue;
printnodedat(i,&node);
preusr[usrs]=(char)i;
usr[usrs++]=(char)i;
usr[usrs++]=(char)i;
}
preusrs=usrs;
if(gurubuf)
......@@ -129,7 +129,7 @@ void sbbs_t::multinodechat(int channel)
if(node.status==NODE_QUIET)
qusr[qusrs++]=(char)i;
else if(node.status==NODE_INUSE)
usr[usrs++]=(char)i;
usr[usrs++]=(char)i;
}
if(preusrs>usrs) {
if(!usrs && channel && cfg.chan[channel-1]->misc&CHAN_GURU
......@@ -149,9 +149,9 @@ void sbbs_t::multinodechat(int channel)
else
username(&cfg,node.useron,str);
bprintf(text[NodeLeftMultiChat]
,preusr[i],str,channel);
}
}
,preusr[i],str,channel);
}
}
}
else if(preusrs<usrs) {
if(!preusrs && channel && cfg.chan[channel-1]->misc&CHAN_GURU
......@@ -171,9 +171,9 @@ void sbbs_t::multinodechat(int channel)
else
username(&cfg,node.useron,str);
bprintf(text[NodeJoinedMultiChat]
,usr[i],str,channel);
}
}
,usr[i],str,channel);
}
}
}
preusrs=usrs;
for(i=0;i<usrs;i++)
......@@ -217,17 +217,18 @@ void sbbs_t::multinodechat(int channel)
break;
if(strcmp(str,unpackchatpass(tmp,&node)))
break;
bputs(text[CorrectPassword]); }
bputs(text[CorrectPassword]);
}
preusr[usrs]=(char)i;
usr[usrs++]=(char)i;
usr[usrs++]=(char)i;
}
if(i<=cfg.sys_nodes) { /* failed password */
bputs(text[WrongPassword]);
continue;
continue;
}
if(gurubuf) {
free(gurubuf);
gurubuf=NULL;
gurubuf=NULL;
}
if(cfg.chan[savch-1]->misc&CHAN_GURU
&& cfg.chan[savch-1]->guru<cfg.total_gurus
......@@ -237,17 +238,17 @@ void sbbs_t::multinodechat(int channel)
,cfg.guru[cfg.chan[savch-1]->guru]->code);
if((file=nopen(str,O_RDONLY))==-1) {
errormsg(WHERE,ERR_OPEN,str,O_RDONLY);
break;
break;
}
if((gurubuf=(char *)malloc((size_t)filelength(file)+1))==NULL) {
close(file);
errormsg(WHERE,ERR_ALLOC,str
,(size_t)filelength(file)+1);
break;
break;
}
read(file,gurubuf,(size_t)filelength(file));
gurubuf[filelength(file)]=0;
close(file);
close(file);
}
preusrs=usrs;
if(gurubuf)
......@@ -262,22 +263,22 @@ void sbbs_t::multinodechat(int channel)
if(getstr(str,8,K_UPPER|K_ALPHA|K_LINE)) {
getnodedat(cfg.node_num,&thisnode,true);
thisnode.aux=channel;
packchatpass(str,&thisnode);
packchatpass(str,&thisnode);
}
else {
getnodedat(cfg.node_num,&thisnode,true);
thisnode.aux=channel;
}
thisnode.aux=channel;
}
}
else {
getnodedat(cfg.node_num,&thisnode,true);
thisnode.aux=channel;
thisnode.aux=channel;
}
putnodedat(cfg.node_num,&thisnode);
bputs(text[YoureOnTheAir]);
if(cfg.chan[channel-1]->cost
&& !(useron.exempt&FLAG('J')))
subtract_cdt(&cfg,&useron,cfg.chan[channel-1]->cost);
subtract_cdt(&cfg,&useron,cfg.chan[channel-1]->cost);
}
else switch(i) { /* other command */
case '0': /* Global channel */
......@@ -293,7 +294,7 @@ void sbbs_t::multinodechat(int channel)
continue;
printnodedat(i,&node);
preusr[usrs]=(char)i;
usr[usrs++]=(char)i;
usr[usrs++]=(char)i;
}
preusrs=usrs;
if(getnodedat(cfg.node_num,&thisnode,true)==0) {
......@@ -318,10 +319,10 @@ void sbbs_t::multinodechat(int channel)
bprintf("%-*.*s",LEN_CHATACTCMD
,LEN_CHATACTCMD,cfg.chatact[i]->cmd);
if(!((i+1)%8)) {
CRLF;
CRLF;
}
else
bputs(" ");
bputs(" ");
}
CRLF;
break;
......@@ -337,7 +338,7 @@ void sbbs_t::multinodechat(int channel)
CRLF;
for(i=1;i<=cfg.sys_nodes && i<=cfg.sys_lastnode;i++) {
getnodedat(i,&node,0);
printnodedat(i,&node);
printnodedat(i,&node);
}
CRLF;
break;
......@@ -379,13 +380,13 @@ void sbbs_t::multinodechat(int channel)
bputs(text[ChatChanLstTitles]);
if(cfg.total_chans>=10) {
bputs(" ");
bputs(text[ChatChanLstTitles]);
bputs(text[ChatChanLstTitles]);
}
CRLF;
bputs(text[ChatChanLstUnderline]);
if(cfg.total_chans>=10) {
bputs(" ");
bputs(text[ChatChanLstUnderline]);
bputs(text[ChatChanLstUnderline]);
}
CRLF;
if(cfg.total_chans>=10)
......@@ -404,18 +405,18 @@ void sbbs_t::multinodechat(int channel)
bprintf(text[ChatChanLstFmt]
,k+1
,cfg.chan[k]->name
,cfg.chan[k]->cost);
}
,cfg.chan[k]->cost);
}
}
CRLF;
CRLF;
}
CRLF;
CRLF;
}
break;
case '?': /* menu */
menu("multchat");
break;
}
break;
}
} else {
ungetkey(ch);
j=0;
......@@ -430,13 +431,13 @@ void sbbs_t::multinodechat(int channel)
: useron.handle
,cfg.node_num,':',nulstr);
sprintf(tmp,"%*s",(int)bstrlen(str),nulstr);
strcat(pgraph,tmp);
strcat(pgraph,tmp);
}
strcat(pgraph,line);
strcat(pgraph,crlf);
if(!wordwrap[0])
break;
j++;
j++;
}
if(pgraph[0]) {
if(channel && useron.chat&CHAT_ACTION) {
......@@ -451,7 +452,7 @@ void sbbs_t::multinodechat(int channel)
,LEN_CHATACTCMD+2,pgraph);
str[strlen(str)-2]=0;
if(!stricmp(cfg.chatact[i]->cmd,str))
break;
break;
}
if(i<cfg.total_chatacts) {
......@@ -464,7 +465,7 @@ void sbbs_t::multinodechat(int channel)
if(n) {
if(usr[j]==n)
break;
continue;
continue;
}
username(&cfg,node.useron,str);
if(!strnicmp(str,p,strlen(str)))
......@@ -472,7 +473,7 @@ void sbbs_t::multinodechat(int channel)
getuserrec(&cfg,node.useron,U_HANDLE
,LEN_HANDLE,str);
if(!strnicmp(str,p,strlen(str)))
break;
break;
}
if(!usrs
&& cfg.chan[channel-1]->guru<cfg.total_gurus)
......@@ -499,7 +500,7 @@ void sbbs_t::multinodechat(int channel)
? text[UNKNOWN_USER] : useron.alias
,"you");
strcat(buf,crlf);
putnmsg(&cfg,usr[j],buf);
putnmsg(&cfg,usr[j],buf);
}
......@@ -514,14 +515,14 @@ void sbbs_t::multinodechat(int channel)
if(i==j)
continue;
getnodedat(usr[i],&node,0);
putnmsg(&cfg,usr[i],buf);
putnmsg(&cfg,usr[i],buf);
}
for(i=0;i<qusrs;i++) {
getnodedat(qusr[i],&node,0);
putnmsg(&cfg,qusr[i],buf);
putnmsg(&cfg,qusr[i],buf);
}
continue;
}
continue;
}
}
sprintf(buf,text[ChatLineFmt]
......@@ -533,20 +534,20 @@ void sbbs_t::multinodechat(int channel)
bputs(buf);
for(i=0;i<usrs;i++) {
getnodedat(usr[i],&node,0);
putnmsg(&cfg,usr[i],buf);
putnmsg(&cfg,usr[i],buf);
}
for(i=0;i<qusrs;i++) {
getnodedat(qusr[i],&node,0);
putnmsg(&cfg,qusr[i],buf);
putnmsg(&cfg,qusr[i],buf);
}
if(!usrs && channel && gurubuf
&& cfg.chan[channel-1]->misc&CHAN_GURU)
guruchat(pgraph,gurubuf,cfg.chan[channel-1]->guru,guru_lastanswer);
}
}
}
}
}
if(sys_status&SS_ABORT)
break;
break;
}
lncntr=0;
}
......@@ -562,12 +563,12 @@ bool sbbs_t::guru_page(void)
if(useron.rest&FLAG('C')) {
bputs(text[R_Chat]);
return(false);
return(false);
}
if(!cfg.total_gurus) {
bprintf(text[SysopIsNotAvailable],"The Guru");
return(false);
return(false);
}
if(cfg.total_gurus==1 && chk_ar(cfg.guru[0]->ar,&useron,&client))
i=0;
......@@ -576,17 +577,17 @@ bool sbbs_t::guru_page(void)
uselect(1,i,nulstr,cfg.guru[i]->name,cfg.guru[i]->ar);
i=uselect(0,0,0,0,0);
if(i<0)
return(false);
return(false);
}
sprintf(path,"%s%s.dat",cfg.ctrl_dir,cfg.guru[i]->code);
if((file=nopen(path,O_RDONLY))==-1) {
errormsg(WHERE,ERR_OPEN,path,O_RDONLY);
return(false);
return(false);
}
if((gurubuf=(char *)malloc((size_t)filelength(file)+1))==NULL) {
close(file);
errormsg(WHERE,ERR_ALLOC,path,(size_t)filelength(file)+1);
return(false);
return(false);
}
read(file,gurubuf,(size_t)filelength(file));
gurubuf[filelength(file)]=0;
......@@ -605,7 +606,7 @@ void sbbs_t::chatsection()
if(useron.rest&FLAG('C')) {
bputs(text[R_Chat]);
return;
return;
}
action=NODE_CHAT;
......
......@@ -1602,8 +1602,6 @@ int main(int argc, char **argv)
for(j=cfg.arcdefs;j>i;j--)
memcpy(&cfg.arcdef[j],&cfg.arcdef[j-1]
,sizeof(arcdef_t));
strcpy(cfg.arcdef[j].name
,cfg.arcdef[j-1].name);
cfg.arcdefs++;
memset(&cfg.arcdef[i],0,sizeof(arcdef_t));
strcpy(cfg.arcdef[i].name,str);
......
......@@ -79,7 +79,7 @@ int sbbs_t::loadmsg(smbmsg_t *msg, ulong number)
return i;
}
if((i=smb_getmsghdr(&smb,msg))!=SMB_SUCCESS) {
SAFEPRINTF4(str,"(%06"PRIX32") #%"PRIu32"/%lu %s",msg->idx.offset,msg->idx.number
SAFEPRINTF4(str,"(%06" PRIX32 ") #%" PRIu32 "/%lu %s",msg->idx.offset,msg->idx.number
,number,smb.file);
smb_unlockmsghdr(&smb,msg);
errormsg(WHERE,ERR_READ,str,i,smb.last_error);
......
......@@ -3899,7 +3899,7 @@ int sbbs_t::putcom(const char *str, size_t len)
if(!len)
len=strlen(str);
for(i=0;i<len && online;i++)
if(outcom(str[i])!=0)
if(outcom(str[i])!=0)
break;
return i;
}
......@@ -4015,10 +4015,10 @@ void sbbs_t::reset_logon_vars(void)
batdn_total=batup_total=0;
usrgrps=usrlibs=0;
curgrp=curlib=0;
for(i=0;i<cfg.total_libs;i++)
curdir[i]=0;
for(i=0;i<cfg.total_grps;i++)
cursub[i]=0;
for(i=0;i<cfg.total_libs;i++)
curdir[i]=0;
for(i=0;i<cfg.total_grps;i++)
cursub[i]=0;
cur_cps=3000;
cur_rate=30000;
dte_rate=38400;
......@@ -5014,8 +5014,8 @@ NO_SSH:
#endif // __unix__ (unix-domain spy sockets)
/* signal caller that we've started up successfully */
if(startup->started!=NULL)
startup->started(startup->cbdata);
if(startup->started!=NULL)
startup->started(startup->cbdata);
lprintf(LOG_INFO,"Terminal Server thread started for nodes %d through %d", first_node, last_node);
......
......@@ -144,7 +144,7 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, uint subnum
,str,sizeof(str))
,sys_timezone(&cfg)
);
fprintf(hdrs,"ExportedFrom: %s %s %"PRIu32"\n"
fprintf(hdrs,"ExportedFrom: %s %s %" PRIu32 "\n"
,cfg.sys_id
,subnum==INVALID_SUB ? "mail":cfg.sub[subnum]->code
,msg->hdr.number
......
......@@ -105,8 +105,12 @@ extern int thread_suid_broken; /* NPTL is no longer broken */
#if defined(JAVASCRIPT)
#include "comio.h" /* needed for COM_HANDLE definition only */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmisleading-indentation"
#pragma GCC diagnostic ignored "-Wignored-attributes"
#include <jsversion.h>
#include <jsapi.h>
#pragma GCC diagnostic pop
#define JS_DestroyScript(cx,script)
#define JSSTRING_TO_RASTRING(cx, str, ret, sizeptr, lenptr) \
......
......@@ -557,7 +557,7 @@ static void thread_up(void* p, BOOL up, BOOL setuid)
if(up)
thread_count++;
else if(thread_count>0)
thread_count--;
thread_count--;
pthread_mutex_unlock(&mutex);
lputs(LOG_INFO,NULL); /* update displayed stats */
}
......@@ -575,7 +575,7 @@ static void socket_open(void* p, BOOL open)
pthread_mutex_lock(&mutex);
if(open)
socket_count++;
else if(socket_count>0)
else if(socket_count>0)
socket_count--;
pthread_mutex_unlock(&mutex);
lputs(LOG_INFO,NULL); /* update displayed stats */
......
......@@ -54,7 +54,7 @@
#define VERSION_NUM (31700 + (tolower(REVISION)-'a'))
#define VERSION_HEX (0x31700 + (tolower(REVISION)-'a'))
#define VERSION_NOTICE "Synchronet BBS for "PLATFORM_DESC\
#define VERSION_NOTICE "Synchronet BBS for " PLATFORM_DESC\
" Version " VERSION
#define SYNCHRONET_CRC 0x9BCDD162
#define COPYRIGHT_NOTICE "Copyright 2016 Rob Swindell"
......
......@@ -291,8 +291,8 @@ js_log(JSContext *cx, uintN argc, jsval *arglist)
if((client=(service_client_t*)JS_GetContextPrivate(cx))==NULL)
return(JS_FALSE);
if(startup==NULL || startup->lputs==NULL)
return(JS_FALSE);
if(startup==NULL || startup->lputs==NULL)
return(JS_FALSE);
if(argc > 1 && JSVAL_IS_NUMBER(argv[i])) {
if(!JS_ValueToInt32(cx,argv[i++],&level))
......
/* Synchronet user data-related routines (exported) */
// vi: tabstop=4
/* $Id$ */
......@@ -1128,8 +1129,8 @@ char* DLLCALL nodestatus(scfg_t* cfg, node_t* node, char* buf, size_t buflen)
strcat(str,"C");
strcat(str,"]");
}
if(node->errors)
sprintf(str+strlen(str)
if(node->errors)
sprintf(str+strlen(str)
," %d error%c",node->errors, node->errors>1 ? 's' : '\0' );
strncpy(buf,str,buflen);
......
......@@ -5184,8 +5184,8 @@ js_log(JSContext *cx, uintN argc, jsval *arglist)
if((session=(http_session_t*)JS_GetContextPrivate(cx))==NULL)
return(JS_FALSE);
if(startup==NULL || startup->lputs==NULL)
return(JS_FALSE);
if(startup==NULL || startup->lputs==NULL)
return(JS_FALSE);
if(argc > 1 && JSVAL_IS_NUMBER(argv[i])) {
if(!JS_ValueToInt32(cx,argv[i++],&level))
......
......@@ -430,7 +430,7 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, ulong tl
write(file,str,strlen(str));
sprintf(str,"%s\n%s\n%d\n%s\n%lu\n%s\n%s\n%s\n%s\n"
"%"PRIx32"\n%d\n"
"%" PRIx32 "\n%d\n"
,ltoaf(useron.flags3,tmp) /* Flag set #3 */
,ltoaf(useron.flags4,tmp2) /* Flag set #4 */
,0 /* Time-slice type */
......@@ -1161,7 +1161,7 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, ulong tl
if((p=strchr(tmp,' '))!=NULL)
*p=0;
sprintf(str,"%u\n%s\n%s\n%s\n%lu\n%u\n%lu\n%"PRId32"\n"
sprintf(str,"%u\n%s\n%s\n%s\n%lu\n%u\n%lu\n%" PRId32 "\n"
,useron.number /* User number */
,name /* User name */
,useron.pass /* Password */
......@@ -1180,7 +1180,7 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, ulong tl
l=((((long)tm.tm_hour*60L)+(long)tm.tm_min)*60L)
+(long)tm.tm_sec;
sprintf(str,"%s\n%s\n%u\n%u\n%u\n%u\n%"PRId32"\n%lu\n%s\n"
sprintf(str,"%s\n%s\n%u\n%u\n%u\n%u\n%" PRId32 "\n%lu\n%s\n"
"%s\n%s\n%lu\n%s\n%u\n%u\n%u\n%u\n%u\n%lu\n%u\n"
"%lu\n%lu\n%s\n%s\n"
,dropdir
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment