1
1

Use int instead of long for struct dir->items

2 billion files should be enough for everyone. You probably won't have
enough memory to scan such a filesystem. int is a better choice than
long, as sizeof(int) is 4 on pretty much any system where ncdu runs.
Этот коммит содержится в:
Yorhel 2012-08-27 18:32:29 +02:00
родитель 73690f8f83
Коммит a61c784b8c
5 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -80,7 +80,7 @@ struct dir_output {
/* The output code is responsible for updating these stats. Can be 0 when not
* available. */
int64_t size;
long items;
int items;
};

Просмотреть файл

@ -182,7 +182,7 @@ void dir_draw() {
if(dir_fatalerr)
fprintf(stderr, "\r%s.\n", dir_fatalerr);
else
fprintf(stderr, "\r%-55s %8ld files /%s",
fprintf(stderr, "\r%-55s %8d files /%s",
cropstr(dir_curpath, 55), dir_output.items, formatsize(dir_output.size));
break;
case 2:

Просмотреть файл

@ -62,7 +62,7 @@ struct dir {
struct dir *parent, *next, *prev, *sub, *hlnk;
int64_t size, asize;
ino_t ino;
long items;
int items;
dev_t dev;
unsigned char flags;
char name[3]; /* must be large enough to hold ".." */

Просмотреть файл

@ -283,7 +283,7 @@ struct dir *getroot(struct dir *d) {
}
void addparentstats(struct dir *d, int64_t size, int64_t asize, long items) {
void addparentstats(struct dir *d, int64_t size, int64_t asize, int items) {
while(d) {
d->size += size;
d->asize += asize;

Просмотреть файл

@ -82,7 +82,7 @@ char *getpath(struct dir *);
struct dir *getroot(struct dir *);
/* Adds a value to the size, asize and items fields of *d and its parents */
void addparentstats(struct dir *, int64_t, int64_t, long);
void addparentstats(struct dir *, int64_t, int64_t, int);
#endif