diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2003-03-18 00:39:57 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2003-03-18 00:39:57 +0000 |
commit | e98bad5b386d58a6add0b7db31ea7090cb791b55 (patch) | |
tree | 34d05b75f305da2bba228af448e9de953250136c /uisimulator | |
parent | 55fc6df87491f20e0776b167cf58e84d49e00efd (diff) | |
download | rockbox-e98bad5b386d58a6add0b7db31ea7090cb791b55.tar.gz rockbox-e98bad5b386d58a6add0b7db31ea7090cb791b55.zip |
Added the filesize() function
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3473 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/win32/file.h | 3 | ||||
-rw-r--r-- | uisimulator/win32/io.c | 9 | ||||
-rw-r--r-- | uisimulator/x11/file.h | 2 | ||||
-rw-r--r-- | uisimulator/x11/io.c | 9 |
4 files changed, 23 insertions, 0 deletions
diff --git a/uisimulator/win32/file.h b/uisimulator/win32/file.h index 3cda3b9d8c..7dd7c8e94c 100644 --- a/uisimulator/win32/file.h +++ b/uisimulator/win32/file.h @@ -23,11 +23,14 @@ #include <string.h> int win32_rename(char *oldpath, char *newpath); +int win32_filesize(int fd); #define rename(x,y) win32_rename(x,y) +#define filesize(x,y) win32_filesize(x,y) #include "../../firmware/include/file.h" #undef rename +#undef filesize #endif diff --git a/uisimulator/win32/io.c b/uisimulator/win32/io.c index 974fdadbbd..ac85bb193e 100644 --- a/uisimulator/win32/io.c +++ b/uisimulator/win32/io.c @@ -36,3 +36,12 @@ int win32_rename(char *oldpath, char* newpath) } return -1; } + +int win32_filesize(int fd) +{ + int old = lseek(fd, 0, SEEK_CUR); + int size = lseek(fd, 0, SEEK_END); + lseek(fd, old, SEEK_SET); + + return(size); +} diff --git a/uisimulator/x11/file.h b/uisimulator/x11/file.h index cf77eea4ba..f11f5056c9 100644 --- a/uisimulator/x11/file.h +++ b/uisimulator/x11/file.h @@ -25,12 +25,14 @@ int x11_open(char *name, int opts); int x11_close(int fd); +int x11_filesize(int fd); int x11_creat(char *name, int mode); int x11_remove(char *name); int x11_rename(char *oldpath, char *newpath); #define open(x,y) x11_open(x,y) #define close(x) x11_close(x) +#define filesize(x) x11_filesize(x) #define creat(x,y) x11_creat(x,y) #define remove(x) x11_remove(x) #define rename(x,y) x11_rename(x,y) diff --git a/uisimulator/x11/io.c b/uisimulator/x11/io.c index bc9c99fa10..c33a42d636 100644 --- a/uisimulator/x11/io.c +++ b/uisimulator/x11/io.c @@ -156,6 +156,15 @@ int x11_rename(char *oldpath, char* newpath) return -1; } +int x11_filesize(int fd) +{ + int old = lseek(fd, 0, SEEK_CUR); + int size = lseek(fd, 0, SEEK_END); + lseek(fd, old, SEEK_SET); + + return(size); +} + void fat_size(unsigned int* size, unsigned int* free) { struct statfs fs; |