From 3aeb7fad9a31666f5762644ebcf2725b15b9241f Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Sat, 27 Aug 2011 12:34:21 +0000 Subject: 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 --- apps/metadata/metadata_common.c | 12 ++++++------ apps/metadata/metadata_common.h | 12 ++++++------ 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); -- cgit v1.2.3