From 4f8d2a52d6e4a08c7c93d8db91c5f0456329605d Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Sat, 13 Apr 2002 09:08:03 +0000 Subject: [PATCH] Fixed gcc -Wall warnings (char array subscripts, signed/unsigned compares). --- src/sbbs3/filedat.c | 2 +- src/sbbs3/mailsrvr.c | 4 ---- src/sbbs3/misc.c | 2 +- src/sbbs3/scfglib2.c | 6 +++--- src/sbbs3/userdat.c | 18 +++++++++--------- src/sbbs3/xtrn.cpp | 8 ++++---- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/sbbs3/filedat.c b/src/sbbs3/filedat.c index 479660a3e0..70fc690e67 100644 --- a/src/sbbs3/filedat.c +++ b/src/sbbs3/filedat.c @@ -485,7 +485,7 @@ BOOL DLLCALL removefiledat(scfg_t* cfg, file_t* f) /****************************************************************************/ BOOL DLLCALL findfile(scfg_t* cfg, uint dirnum, char *filename) { - char str[256],c,fname[13],HUGE16 *ixbbuf; + char str[256],fname[13],HUGE16 *ixbbuf; int i,file; long length,l; diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c index d67fa969d2..11aed555ee 100644 --- a/src/sbbs3/mailsrvr.c +++ b/src/sbbs3/mailsrvr.c @@ -83,10 +83,6 @@ int dns_getmx(char* name, char* mx, char* mx2 #define STATUS_WFC "Listening" -static const char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; -static const char *mon[]={"Jan","Feb","Mar","Apr","May","Jun" - ,"Jul","Aug","Sep","Oct","Nov","Dec"}; - static mail_startup_t* startup=NULL; static scfg_t scfg; static SOCKET server_socket=INVALID_SOCKET; diff --git a/src/sbbs3/misc.c b/src/sbbs3/misc.c index da2348aed9..e6c5c8d767 100644 --- a/src/sbbs3/misc.c +++ b/src/sbbs3/misc.c @@ -175,7 +175,7 @@ char* DLLCALL prep_file_desc(char *str) char *ultoac(ulong l, char *string) { char str[256]; - char i,j,k; + int i,j,k; ultoa(l,str,10); i=strlen(str)-1; diff --git a/src/sbbs3/scfglib2.c b/src/sbbs3/scfglib2.c index 455e3e14c0..4bb90cc361 100644 --- a/src/sbbs3/scfglib2.c +++ b/src/sbbs3/scfglib2.c @@ -857,8 +857,8 @@ char *readline_alloc(long *offset, char *outstr, int maxline, FILE *instream) /****************************************************************************/ long aftol(char *str) { - char c=0; - ulong l=0UL; + int c=0; + ulong l=0UL; strupr(str); while(str[c]) { @@ -873,7 +873,7 @@ long aftol(char *str) /*****************************************************************************/ char *ltoaf(long l,char *str) { - char c=0; + int c=0; while(c<26) { if(l&(long)(1L<<c)) diff --git a/src/sbbs3/userdat.c b/src/sbbs3/userdat.c index 732c37f8ac..a7aced0b47 100644 --- a/src/sbbs3/userdat.c +++ b/src/sbbs3/userdat.c @@ -52,9 +52,9 @@ char* nulstr=""; /****************************************************************************/ uint DLLCALL matchuser(scfg_t* cfg, char *name, BOOL sysop_alias) { - int file; + int file,c; char dat[LEN_ALIAS+2]; - char str[256],c; + char str[256]; ulong l,length; FILE *stream; @@ -486,9 +486,9 @@ int DLLCALL putuserdat(scfg_t* cfg, user_t* user) /****************************************************************************/ char* DLLCALL username(scfg_t* cfg, int usernumber,char *strin) { - char str[256]; - char c; - int file; + char str[256]; + int c; + int file; if(usernumber<1) { strin[0]=0; @@ -1153,8 +1153,8 @@ BOOL DLLCALL chk_ar(scfg_t* cfg, uchar *ar, user_t* user) /****************************************************************************/ int DLLCALL getuserrec(scfg_t* cfg, int usernumber,int start, int length, char *str) { - char c,path[256]; - int i,file; + char path[256]; + int i,c,file; if(!usernumber) return(-1); @@ -1263,9 +1263,9 @@ int DLLCALL putuserrec(scfg_t* cfg, int usernumber,int start, uint length, char /****************************************************************************/ ulong DLLCALL adjustuserrec(scfg_t* cfg, int usernumber, int start, int length, long adj) { - char str[256],c,path[256]; + char str[256],path[256]; char tmp[32]; - int i,file; + int i,c,file; long val; node_t node; diff --git a/src/sbbs3/xtrn.cpp b/src/sbbs3/xtrn.cpp index 4bd9fd0e7f..b02ee2f25e 100644 --- a/src/sbbs3/xtrn.cpp +++ b/src/sbbs3/xtrn.cpp @@ -1052,9 +1052,9 @@ int sbbs_t::external(char* cmdline, long mode, char* startup_dir) continue; } - if(rd>avail) + if(rd>(int)avail) rd=avail; - if(rd>sizeof(buf)) + if(rd>(int)sizeof(buf)) rd=sizeof(buf); if((rd=read(out_pipe[0],buf,rd))<1) { @@ -1120,7 +1120,7 @@ char * sbbs_t::cmdstr(char *instr, char *fpath, char *fspec, char *outstr) else cmd=outstr; len=strlen(instr); - for(i=j=0;i<len && j<sizeof(cmdstr_output);i++) { + for(i=j=0;i<len && j<(int)sizeof(cmdstr_output);i++) { if(instr[i]=='%') { i++; cmd[j]=0; @@ -1208,7 +1208,7 @@ char * sbbs_t::cmdstr(char *instr, char *fpath, char *fspec, char *outstr) strcat(cmd,cfg.shell[useron.shell]->code); break; case '&': /* Address of msr */ - sprintf(str,"%lu",&fakeriobp); + sprintf(str,"%lu",(DWORD)&fakeriobp); strcat(cmd,str); break; case 'Y': -- GitLab