summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libtta/ttadec.c18
-rw-r--r--apps/language.c2
-rw-r--r--apps/metadata.h2
-rw-r--r--apps/tree.c4
-rw-r--r--apps/tree.h8
5 files changed, 20 insertions, 14 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 */
80static int fread(void *ptr, size_t size, size_t nobj) 80static 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
93static int fseek(long offset, int origin) 93static 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 }
diff --git a/apps/language.c b/apps/language.c
index fea4fb3264..39903c4346 100644
--- a/apps/language.c
+++ b/apps/language.c
@@ -19,7 +19,7 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include <file.h> 22#include "file.h"
23 23
24#include "language.h" 24#include "language.h"
25#include "lang.h" 25#include "lang.h"
diff --git a/apps/metadata.h b/apps/metadata.h
index b73d92b83f..39da30e1a5 100644
--- a/apps/metadata.h
+++ b/apps/metadata.h
@@ -23,8 +23,8 @@
23#define _METADATA_H 23#define _METADATA_H
24 24
25#include <stdbool.h> 25#include <stdbool.h>
26#include "file.h"
27#include "config.h" 26#include "config.h"
27#include "file.h"
28 28
29 29
30/* Audio file types. */ 30/* Audio file types. */
diff --git a/apps/tree.c b/apps/tree.c
index 4d915ca3b8..730c59f611 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -511,13 +511,13 @@ void resume_directory(const char *dir)
511 511
512/* Returns the current working directory and also writes cwd to buf if 512/* Returns the current working directory and also writes cwd to buf if
513 non-NULL. In case of error, returns NULL. */ 513 non-NULL. In case of error, returns NULL. */
514char *getcwd(char *buf, size_t size) 514char *getcwd(char *buf, getcwd_size_t size)
515{ 515{
516 if (!buf) 516 if (!buf)
517 return tc.currdir; 517 return tc.currdir;
518 else if (size) 518 else if (size)
519 { 519 {
520 if (strlcpy(buf, tc.currdir, size) < size) 520 if ((getcwd_size_t)strlcpy(buf, tc.currdir, size) < size)
521 return buf; 521 return buf;
522 } 522 }
523 /* size == 0, or truncation in strlcpy */ 523 /* size == 0, or truncation in strlcpy */
diff --git a/apps/tree.h b/apps/tree.h
index e33fee00d7..993d1b4569 100644
--- a/apps/tree.h
+++ b/apps/tree.h
@@ -79,7 +79,13 @@ void set_current_file(char *path);
79int rockbox_browse(const char *root, int dirfilter); 79int rockbox_browse(const char *root, int dirfilter);
80bool create_playlist(void); 80bool create_playlist(void);
81void resume_directory(const char *dir); 81void resume_directory(const char *dir);
82char *getcwd(char *buf, size_t size); 82#ifdef WIN32
83/* it takes an int on windows */
84#define getcwd_size_t int
85#else
86#define getcwd_size_t size_t
87#endif
88char *getcwd(char *buf, getcwd_size_t size);
83void reload_directory(void); 89void reload_directory(void);
84bool check_rockboxdir(void); 90bool check_rockboxdir(void);
85struct tree_context* tree_get_context(void); 91struct tree_context* tree_get_context(void);