diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2010-08-27 12:38:25 +0000 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2010-08-27 12:38:25 +0000 |
| commit | 2c2e261648d5ae1befe5c4f269a655cc06b6e1e9 (patch) | |
| tree | 16ea536a547deb252276c29d34eeee08f029866f /apps | |
| parent | 79798ff5f30dea7419f360e197763abb3b46259a (diff) | |
| download | rockbox-2c2e261648d5ae1befe5c4f269a655cc06b6e1e9.zip rockbox-2c2e261648d5ae1befe5c4f269a655cc06b6e1e9.tar.gz rockbox-2c2e261648d5ae1befe5c4f269a655cc06b6e1e9.tar.bz2 rockbox-2c2e261648d5ae1befe5c4f269a655cc06b6e1e9.tar.xz | |
Use system headers a bit more: use host's fcntl.h for O_RDONLY etc.
Removes the need to fix up those in the simulator.
Also work around some posix-mingw incompatibilities (e.g. getcwd()).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27904 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/codecs/libtta/ttadec.c | 18 | ||||
| -rw-r--r-- | apps/language.c | 2 | ||||
| -rw-r--r-- | apps/metadata.h | 2 | ||||
| -rw-r--r-- | apps/tree.c | 4 | ||||
| -rw-r--r-- | apps/tree.h | 8 |
5 files changed, 20 insertions, 14 deletions
diff --git a/apps/codecs/libtta/ttadec.c b/apps/codecs/libtta/ttadec.c index 9d53a32..cdaffcd 100644 --- a/apps/codecs/libtta/ttadec.c +++ b/apps/codecs/libtta/ttadec.c @@ -77,7 +77,7 @@ static unsigned char *bitpos IBSS_ATTR; /********************* rockbox helper functions *************************/ /* emulate stdio functions */ -static int fread(void *ptr, size_t size, size_t nobj) +static size_t tta_fread(void *ptr, size_t size, size_t nobj) { size_t read_size; unsigned char *buffer = ci->request_buffer(&read_size, size * nobj); @@ -90,7 +90,7 @@ static int fread(void *ptr, size_t size, size_t nobj) return read_size; } -static int fseek(long offset, int origin) +static int tta_fseek(long offset, int origin) { switch (origin) { @@ -129,7 +129,7 @@ crc32 (unsigned char *buffer, unsigned int len) { #define GET_BINARY(value, bits) \ while (bit_count < bits) { \ if (bitpos == iso_buffers_end) { \ - if (!fread(isobuffers, 1, ISO_BUFFERS_SIZE)) { \ + if (!tta_fread(isobuffers, 1, ISO_BUFFERS_SIZE)) { \ ttainfo->STATE = READ_ERROR; \ return -1; \ } \ @@ -149,7 +149,7 @@ crc32 (unsigned char *buffer, unsigned int len) { value = 0; \ while (!(bit_cache ^ bit_mask[bit_count])) { \ if (bitpos == iso_buffers_end) { \ - if (!fread(isobuffers, 1, ISO_BUFFERS_SIZE)) { \ + if (!tta_fread(isobuffers, 1, ISO_BUFFERS_SIZE)) { \ ttainfo->STATE = READ_ERROR; \ return -1; \ } \ @@ -207,7 +207,7 @@ static int done_buffer_read(void) { if (rbytes < sizeof(int)) { ci->memcpy(isobuffers, bitpos, 4); - if (!fread(isobuffers + rbytes, 1, ISO_BUFFERS_SIZE - rbytes)) + if (!tta_fread(isobuffers + rbytes, 1, ISO_BUFFERS_SIZE - rbytes)) return -1; bitpos = isobuffers; } @@ -249,10 +249,10 @@ int set_tta_info (tta_info *info) ci->memset (info, 0, sizeof(tta_info)); /* skip id3v2 tags */ - fseek(ci->id3->id3v2len, SEEK_SET); + tta_fseek(ci->id3->id3v2len, SEEK_SET); /* read TTA header */ - if (fread (&ttahdr, 1, sizeof (ttahdr)) == 0) { + if (tta_fread (&ttahdr, 1, sizeof (ttahdr)) == 0) { info->STATE = READ_ERROR; return -1; } @@ -374,7 +374,7 @@ int set_position (unsigned int pos, enum tta_seek_type type) return -1; } seek_pos = ttainfo->DATAPOS + seek_table[data_pos = pos]; - if (fseek(seek_pos, SEEK_SET) < 0) { + if (tta_fseek(seek_pos, SEEK_SET) < 0) { ttainfo->STATE = READ_ERROR; return -1; } @@ -418,7 +418,7 @@ int player_init (tta_info *info) { } /* read seek table */ - if (!fread(seek_table, st_size, 1)) { + if (!tta_fread(seek_table, st_size, 1)) { ttainfo->STATE = READ_ERROR; return -1; } diff --git a/apps/language.c b/apps/language.c index fea4fb3..39903c4 100644 --- a/apps/language.c +++ b/apps/language.c @@ -19,7 +19,7 @@ * ****************************************************************************/ -#include <file.h> +#include "file.h" #include "language.h" #include "lang.h" diff --git a/apps/metadata.h b/apps/metadata.h index b73d92b..39da30e 100644 --- a/apps/metadata.h +++ b/apps/metadata.h @@ -23,8 +23,8 @@ #define _METADATA_H #include <stdbool.h> -#include "file.h" #include "config.h" +#include "file.h" /* Audio file types. */ diff --git a/apps/tree.c b/apps/tree.c index 4d915ca..730c59f 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -511,13 +511,13 @@ void resume_directory(const char *dir) /* Returns the current working directory and also writes cwd to buf if non-NULL. In case of error, returns NULL. */ -char *getcwd(char *buf, size_t size) +char *getcwd(char *buf, getcwd_size_t size) { if (!buf) return tc.currdir; else if (size) { - if (strlcpy(buf, tc.currdir, size) < size) + if ((getcwd_size_t)strlcpy(buf, tc.currdir, size) < size) return buf; } /* size == 0, or truncation in strlcpy */ diff --git a/apps/tree.h b/apps/tree.h index e33fee0..993d1b4 100644 --- a/apps/tree.h +++ b/apps/tree.h @@ -79,7 +79,13 @@ void set_current_file(char *path); int rockbox_browse(const char *root, int dirfilter); bool create_playlist(void); void resume_directory(const char *dir); -char *getcwd(char *buf, size_t size); +#ifdef WIN32 +/* it takes an int on windows */ +#define getcwd_size_t int +#else +#define getcwd_size_t size_t +#endif +char *getcwd(char *buf, getcwd_size_t size); void reload_directory(void); bool check_rockboxdir(void); struct tree_context* tree_get_context(void); |