summaryrefslogtreecommitdiff
path: root/apps/metadata/metadata_common.c
diff options
context:
space:
mode:
authorMohamed Tarek <mt@rockbox.org>2009-05-16 19:05:50 +0000
committerMohamed Tarek <mt@rockbox.org>2009-05-16 19:05:50 +0000
commitb68707d4651876435161729beab68a329e6d9b6d (patch)
tree6420d0c528ba5ad2392fc4aeaa9b3df32e3f6914 /apps/metadata/metadata_common.c
parent399a094b657e90b7477054fe2c8bdebb85a25118 (diff)
downloadrockbox-b68707d4651876435161729beab68a329e6d9b6d.tar.gz
rockbox-b68707d4651876435161729beab68a329e6d9b6d.zip
Add read_uint8() and read_uint16be() to metadata_common.c/h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20968 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata/metadata_common.c')
-rw-r--r--apps/metadata/metadata_common.c17
1 files changed, 17 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. */
100int 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. */
110int 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. */
102int read_uint32be(int fd, uint32_t* buf) 119int read_uint32be(int fd, uint32_t* buf)
103{ 120{