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
This commit is contained in:
parent
399a094b65
commit
b68707d465
2 changed files with 20 additions and 0 deletions
|
@ -96,8 +96,25 @@ long read_string(int fd, char* buf, long buf_size, int eos, long size)
|
|||
*buf = 0;
|
||||
return read_bytes;
|
||||
}
|
||||
/* Read an unsigned 8-bit integer from a file. */
|
||||
int read_uint8(int fd, uint8_t* buf)
|
||||
{
|
||||
size_t n;
|
||||
|
||||
n = read(fd, (char*) buf, 1);
|
||||
return n;
|
||||
}
|
||||
|
||||
#ifdef ROCKBOX_LITTLE_ENDIAN
|
||||
/* Read an unsigned 16-bit integer from a big-endian file. */
|
||||
int read_uint16be(int fd, uint16_t* buf)
|
||||
{
|
||||
size_t n;
|
||||
|
||||
n = read(fd, (char*) buf, 2);
|
||||
*buf = betoh16(*buf);
|
||||
return n;
|
||||
}
|
||||
/* Read an unsigned 32-bit integer from a big-endian file. */
|
||||
int read_uint32be(int fd, uint32_t* buf)
|
||||
{
|
||||
|
|
|
@ -38,12 +38,15 @@ bool read_vorbis_tags(int fd, struct mp3entry *id3,
|
|||
bool skip_id3v2(int fd, struct mp3entry *id3);
|
||||
long read_string(int fd, char* buf, long buf_size, int eos, long size);
|
||||
|
||||
int read_uint8(int fd, uint8_t* buf);
|
||||
#ifdef ROCKBOX_BIG_ENDIAN
|
||||
#define read_uint16be(fd,buf) read((fd), (buf), 2)
|
||||
#define read_uint32be(fd,buf) read((fd), (buf), 4)
|
||||
int read_uint16le(int fd, uint16_t* buf);
|
||||
int read_uint32le(int fd, uint32_t* buf);
|
||||
int read_uint64le(int fd, uint64_t* buf);
|
||||
#else
|
||||
int read_uint16be(int fd, uint16_t* buf);
|
||||
int read_uint32be(int fd, uint32_t* buf);
|
||||
#define read_uint16le(fd,buf) read((fd), (buf), 2)
|
||||
#define read_uint32le(fd,buf) read((fd), (buf), 4)
|
||||
|
|
Loading…
Reference in a new issue