Fix some potential problems detected by clang.
Most of these are unnecessary comparisons and functions returning the wrong types.
This commit is contained in:
parent
614dcfffd2
commit
172c83f254
11 changed files with 24 additions and 25 deletions
|
|
@ -200,8 +200,7 @@ main(int argc, char *argv[], char *envp[])
|
|||
}
|
||||
|
||||
if (!use_savedir) {
|
||||
if ((whoami == NULL) || (*whoami == '\0') ||
|
||||
(strcmp(whoami,"dosuser")==0))
|
||||
if ((*whoami == '\0') || (strcmp(whoami,"dosuser")==0))
|
||||
{
|
||||
echo();
|
||||
mvaddstr(23,2,"Rogue's Name? ");
|
||||
|
|
@ -209,7 +208,7 @@ main(int argc, char *argv[], char *envp[])
|
|||
noecho();
|
||||
}
|
||||
|
||||
if ((whoami == NULL) || (*whoami == '\0'))
|
||||
if (*whoami == '\0')
|
||||
strcpy(whoami,"Rodney");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ md_hasclreol(void)
|
|||
|
||||
static int md_standout_mode = 0;
|
||||
|
||||
int
|
||||
void
|
||||
md_raw_standout(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
@ -155,7 +155,7 @@ md_raw_standout(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
md_raw_standend(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
@ -223,7 +223,7 @@ md_fdopen(int fd, char *mode)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
md_normaluser(void)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
|
|
@ -596,7 +596,7 @@ md_rand(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
md_srand(int seed)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
|
|||
|
|
@ -1189,12 +1189,12 @@ extern char *md_getroguedir(void);
|
|||
extern void md_init(void);
|
||||
extern FILE * md_fdopen(int fd, char *mode);
|
||||
extern int md_unlink(char *file);
|
||||
extern int md_normaluser(void);
|
||||
extern void md_normaluser(void);
|
||||
extern int md_getuid(void);
|
||||
extern long md_memused(void);
|
||||
extern int md_readchar(WINDOW *win);
|
||||
extern int md_shellescape(void);
|
||||
extern int md_srand(int seed);
|
||||
extern void md_srand(int seed);
|
||||
extern int md_rand(void);
|
||||
extern int md_erasechar(void);
|
||||
extern int md_killchar(void);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ md_init(void)
|
|||
|
||||
static int md_standout_mode = 0;
|
||||
|
||||
int
|
||||
void
|
||||
md_raw_standout(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
@ -134,7 +134,7 @@ md_raw_standout(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
md_raw_standend(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
@ -213,7 +213,7 @@ md_creat(char *file, int mode)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
void
|
||||
md_normaluser(void)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
|
|
@ -581,7 +581,7 @@ md_rand(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
md_srand(int seed)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
|
|||
|
|
@ -1417,12 +1417,12 @@ char *md_getusername(void);
|
|||
void md_init(void);
|
||||
int md_killchar(void);
|
||||
long md_memused(void);
|
||||
int md_normaluser(void);
|
||||
void md_normaluser(void);
|
||||
int md_rand(void);
|
||||
unsigned int md_random_seed(void);
|
||||
int md_readchar(WINDOW *win);
|
||||
int md_shellescape(void);
|
||||
int md_srand(int seed);
|
||||
void md_srand(int seed);
|
||||
int md_unlink(char *file);
|
||||
int md_unlink_open_file(char *file, FILE *inf);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ char *ws_guess[MAXSTICKS]; /* Players guess at what wand is */
|
|||
char *ws_type[MAXSTICKS]; /* Is it a wand or a staff */
|
||||
char file_name[256]; /* Save file name */
|
||||
char home[PATH_MAX]; /* User's home directory */
|
||||
unsigned char prbuf[80]; /* Buffer for sprintfs */
|
||||
char prbuf[80]; /* Buffer for sprintfs */
|
||||
int max_hp; /* Player's max hit points */
|
||||
int ntraps; /* Number of traps on this level */
|
||||
int max_level; /* Deepest player has gone */
|
||||
|
|
|
|||
|
|
@ -469,7 +469,7 @@ extern int p_know[MAXPOTIONS]; /* Does he know what a potion d
|
|||
extern struct magic_item p_magic[MAXPOTIONS]; /* Names and chances for potions */
|
||||
extern struct thing player; /* The rogue */
|
||||
extern int playing; /* True until he quits */
|
||||
extern unsigned char prbuf[80]; /* Buffer for sprintfs */
|
||||
extern char prbuf[80]; /* Buffer for sprintfs */
|
||||
extern int purse; /* How much gold the rogue has */
|
||||
extern int quiet; /* Number of quiet turns */
|
||||
extern char * r_guess[MAXRINGS]; /* Players guess at what ring is */
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ main(int argc, char *argv[], char *envp[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
if ((whoami == NULL) || (*whoami == '\0') || (strcmp(whoami,"dosuser")==0))
|
||||
if ((*whoami == '\0') || (strcmp(whoami,"dosuser")==0))
|
||||
{
|
||||
echo();
|
||||
mvaddstr(23,2,"Rogue's Name? ");
|
||||
|
|
@ -189,7 +189,7 @@ main(int argc, char *argv[], char *envp[])
|
|||
noecho();
|
||||
}
|
||||
|
||||
if ((whoami == NULL) || (*whoami == '\0'))
|
||||
if (*whoami == '\0')
|
||||
strcpy(whoami,"Rodney");
|
||||
|
||||
setup();
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ main(int argc, char *argv[], char *envp[])
|
|||
byebye(1);
|
||||
}
|
||||
|
||||
if ((whoami == NULL) || (*whoami == '\0') || (strcmp(whoami,"dosuser")==0))
|
||||
if ((*whoami == '\0') || (strcmp(whoami,"dosuser")==0))
|
||||
{
|
||||
echo();
|
||||
mvaddstr(23,2,"Rogue's Name? ");
|
||||
|
|
@ -209,7 +209,7 @@ main(int argc, char *argv[], char *envp[])
|
|||
noecho();
|
||||
}
|
||||
|
||||
if ((whoami == NULL) || (*whoami == '\0'))
|
||||
if (*whoami == '\0')
|
||||
strcpy(whoami,"Rodney");
|
||||
|
||||
setup();
|
||||
|
|
|
|||
|
|
@ -1503,12 +1503,12 @@ void tstp();
|
|||
|
||||
int md_getuid(void);
|
||||
long md_memused(void);
|
||||
int md_normaluser(void);
|
||||
void md_normaluser(void);
|
||||
int md_rand(int range);
|
||||
unsigned int md_random_seed(void);
|
||||
void md_setup(void);
|
||||
int md_shellescape(void);
|
||||
int md_srand(int seed);
|
||||
void md_srand(int seed);
|
||||
|
||||
/*
|
||||
* Now all the global variables
|
||||
|
|
|
|||
|
|
@ -3152,7 +3152,7 @@ md_rand(int range)
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
md_srand(int seed)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
@ -3598,7 +3598,7 @@ md_setup(void)
|
|||
noecho(); /* Echo off */
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
md_normaluser(void)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue