mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
Use int64_t instead of off_t
*Should* be equivalent, but having a clearly standardised width is much better.
This commit is contained in:
parent
44e63ce2e7
commit
73690f8f83
7 changed files with 20 additions and 13 deletions
|
|
@ -15,7 +15,7 @@ AC_CHECK_HEADERS(
|
|||
AC_MSG_ERROR([required header file not found]))
|
||||
|
||||
# Check for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_OFF_T
|
||||
AC_TYPE_INT64_T
|
||||
AC_SYS_LARGEFILE
|
||||
AC_STRUCT_ST_BLOCKS
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ struct dir_output {
|
|||
|
||||
/* The output code is responsible for updating these stats. Can be 0 when not
|
||||
* available. */
|
||||
off_t size;
|
||||
int64_t size;
|
||||
long items;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
/* public variables */
|
||||
struct dir *dirlist_parent = NULL;
|
||||
off_t dirlist_maxs = 0,
|
||||
int64_t dirlist_maxs = 0,
|
||||
dirlist_maxa = 0;
|
||||
|
||||
int dirlist_sort_desc = 1,
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ extern int dirlist_sort_desc, dirlist_sort_col, dirlist_sort_df;
|
|||
extern int dirlist_hidden;
|
||||
|
||||
/* maximum size of an item in the opened dir */
|
||||
extern off_t dirlist_maxs, dirlist_maxa;
|
||||
extern int64_t dirlist_maxs, dirlist_maxa;
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -31,6 +31,13 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/* File Flags (struct dir -> flags) */
|
||||
#define FF_DIR 0x01
|
||||
#define FF_FILE 0x02
|
||||
|
|
@ -53,7 +60,7 @@
|
|||
* fixed-size integers instead, which are much more predictable */
|
||||
struct dir {
|
||||
struct dir *parent, *next, *prev, *sub, *hlnk;
|
||||
off_t size, asize;
|
||||
int64_t size, asize;
|
||||
ino_t ino;
|
||||
long items;
|
||||
dev_t dev;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ char *cropstr(const char *from, int s) {
|
|||
}
|
||||
|
||||
|
||||
char *formatsize(const off_t from) {
|
||||
char *formatsize(int64_t from) {
|
||||
static char dat[9]; /* "xxx.xMiB" */
|
||||
float r = from;
|
||||
char c = ' ';
|
||||
|
|
@ -68,10 +68,10 @@ char *formatsize(const off_t from) {
|
|||
}
|
||||
|
||||
|
||||
char *fullsize(const off_t from) {
|
||||
char *fullsize(int64_t from) {
|
||||
static char dat[20]; /* max: 999.999.999.999.999 */
|
||||
char tmp[20];
|
||||
off_t n = from;
|
||||
int64_t n = from;
|
||||
int i, j;
|
||||
|
||||
/* the K&R method - more portable than sprintf with %lld */
|
||||
|
|
@ -283,7 +283,7 @@ struct dir *getroot(struct dir *d) {
|
|||
}
|
||||
|
||||
|
||||
void addparentstats(struct dir *d, off_t size, off_t asize, long items) {
|
||||
void addparentstats(struct dir *d, int64_t size, int64_t asize, long items) {
|
||||
while(d) {
|
||||
d->size += size;
|
||||
d->asize += asize;
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ void ncprint(int, int, char *, ...);
|
|||
char *cropstr(const char *, int);
|
||||
|
||||
/* formats size in the form of xxx.xXB */
|
||||
char *formatsize(const off_t);
|
||||
char *formatsize(int64_t );
|
||||
|
||||
/* int2string with thousand separators */
|
||||
char *fullsize(const off_t);
|
||||
char *fullsize(int64_t);
|
||||
|
||||
/* recursively free()s a directory tree */
|
||||
void freedir(struct dir *);
|
||||
|
|
@ -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 *, off_t, off_t, long);
|
||||
void addparentstats(struct dir *, int64_t, int64_t, long);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue