summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2012-08-27 17:20:24 +0200
committerYorhel <git@yorhel.nl>2012-08-27 17:20:24 +0200
commit73690f8f835a1b1044492cab84efa3b28760063b (patch)
treec438a5cc9264175dd7e1b55b3981b14b393d6ac7 /src
parent44e63ce2e7e3d4c6388ad8bc570fd540963cc0a4 (diff)
Use int64_t instead of off_t
*Should* be equivalent, but having a clearly standardised width is much better.
Diffstat (limited to 'src')
-rw-r--r--src/dir.h2
-rw-r--r--src/dirlist.c4
-rw-r--r--src/dirlist.h2
-rw-r--r--src/global.h9
-rw-r--r--src/util.c8
-rw-r--r--src/util.h6
6 files changed, 19 insertions, 12 deletions
diff --git a/src/dir.h b/src/dir.h
index 5fb207a..94899ab 100644
--- a/src/dir.h
+++ b/src/dir.h
@@ -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;
};
diff --git a/src/dirlist.c b/src/dirlist.c
index 7c2fd00..0ffde2d 100644
--- a/src/dirlist.c
+++ b/src/dirlist.c
@@ -30,8 +30,8 @@
/* public variables */
struct dir *dirlist_parent = NULL;
-off_t dirlist_maxs = 0,
- dirlist_maxa = 0;
+int64_t dirlist_maxs = 0,
+ dirlist_maxa = 0;
int dirlist_sort_desc = 1,
dirlist_sort_col = DL_COL_SIZE,
diff --git a/src/dirlist.h b/src/dirlist.h
index 5927c1f..fb4709b 100644
--- a/src/dirlist.h
+++ b/src/dirlist.h
@@ -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
diff --git a/src/global.h b/src/global.h
index c34f44c..e244d27 100644
--- a/src/global.h
+++ b/src/global.h
@@ -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;
diff --git a/src/util.c b/src/util.c
index e4f1e22..f78bddd 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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;
diff --git a/src/util.h b/src/util.h
index a0d7641..a8dd116 100644
--- a/src/util.h
+++ b/src/util.h
@@ -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