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/codecs/libtta/ttadec.c | |
parent | 79798ff5f30dea7419f360e197763abb3b46259a (diff) |
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/codecs/libtta/ttadec.c')
-rw-r--r-- | apps/codecs/libtta/ttadec.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/codecs/libtta/ttadec.c b/apps/codecs/libtta/ttadec.c index 9d53a327f2..cdaffcd9d9 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; } |