diff options
Diffstat (limited to 'apps/metadata')
-rw-r--r-- | apps/metadata/metadata_common.c | 17 | ||||
-rw-r--r-- | apps/metadata/metadata_common.h | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/apps/metadata/metadata_common.c b/apps/metadata/metadata_common.c index 37768bdd4a..38761e3dae 100644 --- a/apps/metadata/metadata_common.c +++ b/apps/metadata/metadata_common.c | |||
@@ -96,8 +96,25 @@ long read_string(int fd, char* buf, long buf_size, int eos, long size) | |||
96 | *buf = 0; | 96 | *buf = 0; |
97 | return read_bytes; | 97 | return read_bytes; |
98 | } | 98 | } |
99 | /* Read an unsigned 8-bit integer from a file. */ | ||
100 | int read_uint8(int fd, uint8_t* buf) | ||
101 | { | ||
102 | size_t n; | ||
103 | |||
104 | n = read(fd, (char*) buf, 1); | ||
105 | return n; | ||
106 | } | ||
99 | 107 | ||
100 | #ifdef ROCKBOX_LITTLE_ENDIAN | 108 | #ifdef ROCKBOX_LITTLE_ENDIAN |
109 | /* Read an unsigned 16-bit integer from a big-endian file. */ | ||
110 | int read_uint16be(int fd, uint16_t* buf) | ||
111 | { | ||
112 | size_t n; | ||
113 | |||
114 | n = read(fd, (char*) buf, 2); | ||
115 | *buf = betoh16(*buf); | ||
116 | return n; | ||
117 | } | ||
101 | /* Read an unsigned 32-bit integer from a big-endian file. */ | 118 | /* Read an unsigned 32-bit integer from a big-endian file. */ |
102 | int read_uint32be(int fd, uint32_t* buf) | 119 | int read_uint32be(int fd, uint32_t* buf) |
103 | { | 120 | { |
diff --git a/apps/metadata/metadata_common.h b/apps/metadata/metadata_common.h index 2a48b25dc6..c8c0dc463f 100644 --- a/apps/metadata/metadata_common.h +++ b/apps/metadata/metadata_common.h | |||
@@ -38,12 +38,15 @@ bool read_vorbis_tags(int fd, struct mp3entry *id3, | |||
38 | bool skip_id3v2(int fd, struct mp3entry *id3); | 38 | bool skip_id3v2(int fd, struct mp3entry *id3); |
39 | long read_string(int fd, char* buf, long buf_size, int eos, long size); | 39 | long read_string(int fd, char* buf, long buf_size, int eos, long size); |
40 | 40 | ||
41 | int read_uint8(int fd, uint8_t* buf); | ||
41 | #ifdef ROCKBOX_BIG_ENDIAN | 42 | #ifdef ROCKBOX_BIG_ENDIAN |
43 | #define read_uint16be(fd,buf) read((fd), (buf), 2) | ||
42 | #define read_uint32be(fd,buf) read((fd), (buf), 4) | 44 | #define read_uint32be(fd,buf) read((fd), (buf), 4) |
43 | int read_uint16le(int fd, uint16_t* buf); | 45 | int read_uint16le(int fd, uint16_t* buf); |
44 | int read_uint32le(int fd, uint32_t* buf); | 46 | int read_uint32le(int fd, uint32_t* buf); |
45 | int read_uint64le(int fd, uint64_t* buf); | 47 | int read_uint64le(int fd, uint64_t* buf); |
46 | #else | 48 | #else |
49 | int read_uint16be(int fd, uint16_t* buf); | ||
47 | int read_uint32be(int fd, uint32_t* buf); | 50 | int read_uint32be(int fd, uint32_t* buf); |
48 | #define read_uint16le(fd,buf) read((fd), (buf), 2) | 51 | #define read_uint16le(fd,buf) read((fd), (buf), 2) |
49 | #define read_uint32le(fd,buf) read((fd), (buf), 4) | 52 | #define read_uint32le(fd,buf) read((fd), (buf), 4) |