Fix clang-tidy reports

This commit is contained in:
Arun Prakash Jana 2018-11-03 15:50:01 +05:30
parent 65f26d0f5d
commit 3a738632a0
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 18 additions and 10 deletions

28
nnn.c
View File

@ -164,7 +164,7 @@ disabledbg()
#define MAX_CMD_LEN 5120 #define MAX_CMD_LEN 5120
#define CURSR " > " #define CURSR " > "
#define EMPTY " " #define EMPTY " "
#define CURSYM(flag) (flag ? CURSR : EMPTY) #define CURSYM(flag) ((flag) ? CURSR : EMPTY)
#define FILTER '/' #define FILTER '/'
#define REGEX_MAX 128 #define REGEX_MAX 128
#define BM_MAX 10 #define BM_MAX 10
@ -198,7 +198,7 @@ disabledbg()
#define exitcurses() endwin() #define exitcurses() endwin()
#define clearprompt() printmsg("") #define clearprompt() printmsg("")
#define printwarn() printmsg(strerror(errno)) #define printwarn() printmsg(strerror(errno))
#define istopdir(path) (path[1] == '\0' && path[0] == '/') #define istopdir(path) ((path)[1] == '\0' && (path)[0] == '/')
#define copyfilter() xstrlcpy(fltr, ifilter, NAME_MAX) #define copyfilter() xstrlcpy(fltr, ifilter, NAME_MAX)
#define copycurname() xstrlcpy(oldname, dents[cur].name, NAME_MAX + 1) #define copycurname() xstrlcpy(oldname, dents[cur].name, NAME_MAX + 1)
#define settimeout() timeout(1000) #define settimeout() timeout(1000)
@ -867,8 +867,8 @@ static int xstricmp(const char * const s1, const char * const s2)
if (num1 != num2) { if (num1 != num2) {
if (num1 > num2) if (num1 > num2)
return 1; return 1;
else
return -1; return -1;
} }
} }
@ -945,7 +945,8 @@ static int entrycmp(const void *va, const void *vb)
/* Sort directories first */ /* Sort directories first */
if (S_ISDIR(pb->mode) && !S_ISDIR(pa->mode)) if (S_ISDIR(pb->mode) && !S_ISDIR(pa->mode))
return 1; return 1;
else if (S_ISDIR(pa->mode) && !S_ISDIR(pb->mode))
if (S_ISDIR(pa->mode) && !S_ISDIR(pb->mode))
return -1; return -1;
/* Do the actual sorting */ /* Do the actual sorting */
@ -955,14 +956,16 @@ static int entrycmp(const void *va, const void *vb)
if (cfg.sizeorder) { if (cfg.sizeorder) {
if (pb->size > pa->size) if (pb->size > pa->size)
return 1; return 1;
else if (pb->size < pa->size)
if (pb->size < pa->size)
return -1; return -1;
} }
if (cfg.blkorder) { if (cfg.blkorder) {
if (pb->blocks > pa->blocks) if (pb->blocks > pa->blocks)
return 1; return 1;
else if (pb->blocks < pa->blocks)
if (pb->blocks < pa->blocks)
return -1; return -1;
} }
@ -1894,8 +1897,8 @@ static size_t get_fs_info(const char *path, bool type)
if (type == CAPACITY) if (type == CAPACITY)
return svb.f_blocks << ffs(svb.f_bsize >> 1); return svb.f_blocks << ffs(svb.f_bsize >> 1);
else
return svb.f_bavail << ffs(svb.f_frsize >> 1); return svb.f_bavail << ffs(svb.f_frsize >> 1);
} }
static int show_mediainfo(char *fpath, char *arg) static int show_mediainfo(char *fpath, char *arg)
@ -2068,6 +2071,9 @@ static int show_help(char *path)
return 0; return 0;
} }
static int sum_bsizes(const char */*fpath*/, const struct stat *sb,
int typeflag, struct FTW */*ftwbuf*/);
static int sum_bsizes(const char *fpath, const struct stat *sb, static int sum_bsizes(const char *fpath, const struct stat *sb,
int typeflag, struct FTW *ftwbuf) int typeflag, struct FTW *ftwbuf)
{ {
@ -3134,7 +3140,9 @@ nochange:
mkpath(path, dents[cur].name, newpath, PATH_MAX); mkpath(path, dents[cur].name, newpath, PATH_MAX);
spawn(tmp, newpath, NULL, path, r); spawn(tmp, newpath, NULL, path, r);
continue; continue;
} else if (sel == SEL_ARCHIVE) { }
if (sel == SEL_ARCHIVE) {
/* newpath is used as temporary buffer */ /* newpath is used as temporary buffer */
if (!get_output(newpath, PATH_MAX, "which", utils[APACK], NULL, 0)) { if (!get_output(newpath, PATH_MAX, "which", utils[APACK], NULL, 0)) {
printmsg("apack missing"); printmsg("apack missing");