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 | |
parent | 79798ff5f30dea7419f360e197763abb3b46259a (diff) | |
download | rockbox-2c2e261648d5ae1befe5c4f269a655cc06b6e1e9.tar.gz rockbox-2c2e261648d5ae1befe5c4f269a655cc06b6e1e9.zip |
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')
-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; | |||
77 | /********************* rockbox helper functions *************************/ | 77 | /********************* rockbox helper functions *************************/ |
78 | 78 | ||
79 | /* emulate stdio functions */ | 79 | /* emulate stdio functions */ |
80 | static int fread(void *ptr, size_t size, size_t nobj) | 80 | static size_t tta_fread(void *ptr, size_t size, size_t nobj) |
81 | { | 81 | { |
82 | size_t read_size; | 82 | size_t read_size; |
83 | unsigned char *buffer = ci->request_buffer(&read_size, size * nobj); | 83 | 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) | |||
90 | return read_size; | 90 | return read_size; |
91 | } | 91 | } |
92 | 92 | ||
93 | static int fseek(long offset, int origin) | 93 | static int tta_fseek(long offset, int origin) |
94 | { | 94 | { |
95 | switch (origin) | 95 | switch (origin) |
96 | { | 96 | { |
@@ -129,7 +129,7 @@ crc32 (unsigned char *buffer, unsigned int len) { | |||
129 | #define GET_BINARY(value, bits) \ | 129 | #define GET_BINARY(value, bits) \ |
130 | while (bit_count < bits) { \ | 130 | while (bit_count < bits) { \ |
131 | if (bitpos == iso_buffers_end) { \ | 131 | if (bitpos == iso_buffers_end) { \ |
132 | if (!fread(isobuffers, 1, ISO_BUFFERS_SIZE)) { \ | 132 | if (!tta_fread(isobuffers, 1, ISO_BUFFERS_SIZE)) { \ |
133 | ttainfo->STATE = READ_ERROR; \ | 133 | ttainfo->STATE = READ_ERROR; \ |
134 | return -1; \ | 134 | return -1; \ |
135 | } \ | 135 | } \ |
@@ -149,7 +149,7 @@ crc32 (unsigned char *buffer, unsigned int len) { | |||
149 | value = 0; \ | 149 | value = 0; \ |
150 | while (!(bit_cache ^ bit_mask[bit_count])) { \ | 150 | while (!(bit_cache ^ bit_mask[bit_count])) { \ |
151 | if (bitpos == iso_buffers_end) { \ | 151 | if (bitpos == iso_buffers_end) { \ |
152 | if (!fread(isobuffers, 1, ISO_BUFFERS_SIZE)) { \ | 152 | if (!tta_fread(isobuffers, 1, ISO_BUFFERS_SIZE)) { \ |
153 | ttainfo->STATE = READ_ERROR; \ | 153 | ttainfo->STATE = READ_ERROR; \ |
154 | return -1; \ | 154 | return -1; \ |
155 | } \ | 155 | } \ |
@@ -207,7 +207,7 @@ static int done_buffer_read(void) { | |||
207 | 207 | ||
208 | if (rbytes < sizeof(int)) { | 208 | if (rbytes < sizeof(int)) { |
209 | ci->memcpy(isobuffers, bitpos, 4); | 209 | ci->memcpy(isobuffers, bitpos, 4); |
210 | if (!fread(isobuffers + rbytes, 1, ISO_BUFFERS_SIZE - rbytes)) | 210 | if (!tta_fread(isobuffers + rbytes, 1, ISO_BUFFERS_SIZE - rbytes)) |
211 | return -1; | 211 | return -1; |
212 | bitpos = isobuffers; | 212 | bitpos = isobuffers; |
213 | } | 213 | } |
@@ -249,10 +249,10 @@ int set_tta_info (tta_info *info) | |||
249 | ci->memset (info, 0, sizeof(tta_info)); | 249 | ci->memset (info, 0, sizeof(tta_info)); |
250 | 250 | ||
251 | /* skip id3v2 tags */ | 251 | /* skip id3v2 tags */ |
252 | fseek(ci->id3->id3v2len, SEEK_SET); | 252 | tta_fseek(ci->id3->id3v2len, SEEK_SET); |
253 | 253 | ||
254 | /* read TTA header */ | 254 | /* read TTA header */ |
255 | if (fread (&ttahdr, 1, sizeof (ttahdr)) == 0) { | 255 | if (tta_fread (&ttahdr, 1, sizeof (ttahdr)) == 0) { |
256 | info->STATE = READ_ERROR; | 256 | info->STATE = READ_ERROR; |
257 | return -1; | 257 | return -1; |
258 | } | 258 | } |
@@ -374,7 +374,7 @@ int set_position (unsigned int pos, enum tta_seek_type type) | |||
374 | return -1; | 374 | return -1; |
375 | } | 375 | } |
376 | seek_pos = ttainfo->DATAPOS + seek_table[data_pos = pos]; | 376 | seek_pos = ttainfo->DATAPOS + seek_table[data_pos = pos]; |
377 | if (fseek(seek_pos, SEEK_SET) < 0) { | 377 | if (tta_fseek(seek_pos, SEEK_SET) < 0) { |
378 | ttainfo->STATE = READ_ERROR; | 378 | ttainfo->STATE = READ_ERROR; |
379 | return -1; | 379 | return -1; |
380 | } | 380 | } |
@@ -418,7 +418,7 @@ int player_init (tta_info *info) { | |||
418 | } | 418 | } |
419 | 419 | ||
420 | /* read seek table */ | 420 | /* read seek table */ |
421 | if (!fread(seek_table, st_size, 1)) { | 421 | if (!tta_fread(seek_table, st_size, 1)) { |
422 | ttainfo->STATE = READ_ERROR; | 422 | ttainfo->STATE = READ_ERROR; |
423 | return -1; | 423 | return -1; |
424 | } | 424 | } |