summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2011-08-27 12:34:21 +0000
committerNils Wallménius <nils@rockbox.org>2011-08-27 12:34:21 +0000
commit3aeb7fad9a31666f5762644ebcf2725b15b9241f (patch)
tree0ea749ba0b878917988a368f61800bc85f5b3c28 /apps
parent813b7623c1aa43a4fa0efebd701f637569230ad9 (diff)
FS#12163 by Sean Bartell
get_long_be shifts an unsigned char left--which results in a signed int. It then implicitly casts to unsigned long, which sign-extends the int, leaving unwanted 1's in the upper bits. This affects AIFF. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30364 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/metadata/metadata_common.c12
-rw-r--r--apps/metadata/metadata_common.h12
2 files changed, 12 insertions, 12 deletions
diff --git a/apps/metadata/metadata_common.c b/apps/metadata/metadata_common.c
index 1ad89d1b7a..781123717a 100644
--- a/apps/metadata/metadata_common.c
+++ b/apps/metadata/metadata_common.c
@@ -155,7 +155,7 @@ uint64_t get_uint64_le(void* buf)
}
/* Read an unaligned 32-bit little endian long from buffer. */
-unsigned long get_long_le(void* buf)
+uint32_t get_long_le(void* buf)
{
unsigned char* p = (unsigned char*) buf;
@@ -163,7 +163,7 @@ unsigned long get_long_le(void* buf)
}
/* Read an unaligned 16-bit little endian short from buffer. */
-unsigned short get_short_le(void* buf)
+uint16_t get_short_le(void* buf)
{
unsigned char* p = (unsigned char*) buf;
@@ -171,7 +171,7 @@ unsigned short get_short_le(void* buf)
}
/* Read an unaligned 32-bit big endian long from buffer. */
-unsigned long get_long_be(void* buf)
+uint32_t get_long_be(void* buf)
{
unsigned char* p = (unsigned char*) buf;
@@ -179,7 +179,7 @@ unsigned long get_long_be(void* buf)
}
/* Read an unaligned 16-bit little endian short from buffer. */
-unsigned short get_short_be(void* buf)
+uint16_t get_short_be(void* buf)
{
unsigned char* p = (unsigned char*) buf;
@@ -187,14 +187,14 @@ unsigned short get_short_be(void* buf)
}
/* Read an unaligned 32-bit little endian long from buffer. */
-long get_slong(void* buf)
+int32_t get_slong(void* buf)
{
unsigned char* p = (unsigned char*) buf;
return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
}
-unsigned long get_itunes_int32(char* value, int count)
+uint32_t get_itunes_int32(char* value, int count)
{
static const char hexdigits[] = "0123456789ABCDEF";
const char* c;
diff --git a/apps/metadata/metadata_common.h b/apps/metadata/metadata_common.h
index a48c2a4e89..db91729de4 100644
--- a/apps/metadata/metadata_common.h
+++ b/apps/metadata/metadata_common.h
@@ -59,11 +59,11 @@ int read_uint64be(int fd, uint64_t* buf);
#endif
uint64_t get_uint64_le(void* buf);
-unsigned long get_long_le(void* buf);
-unsigned short get_short_le(void* buf);
-unsigned long get_long_be(void* buf);
-unsigned short get_short_be(void* buf);
-long get_slong(void* buf);
-unsigned long get_itunes_int32(char* value, int count);
+uint32_t get_long_le(void* buf);
+uint16_t get_short_le(void* buf);
+uint32_t get_long_be(void* buf);
+uint16_t get_short_be(void* buf);
+int32_t get_slong(void* buf);
+uint32_t get_itunes_int32(char* value, int count);
long parse_tag(const char* name, char* value, struct mp3entry* id3,
char* buf, long buf_remaining, enum tagtype type);