Fix compile warnings (set-but-not-used) on big endian targets

Change-Id: Ia433122d6c0af68a47d2f4a531a0787a9d3d9f72
This commit is contained in:
Solomon Peachy 2020-10-13 13:20:56 -04:00
parent 4a3d046545
commit ca326896d0
2 changed files with 21 additions and 17 deletions

View file

@ -279,13 +279,15 @@ acceptable. Do NOT use for cryptographic purposes.
uint32_t hashs( const void *key, size_t length, uint32_t initval) uint32_t hashs( const void *key, size_t length, uint32_t initval)
{ {
uint32_t a,b,c; /* internal state */ uint32_t a,b,c; /* internal state */
#if HASH_LITTLE_ENDIAN
union { const void *ptr; size_t i; } u;/* needed for Mac Powerbook G4 */ union { const void *ptr; size_t i; } u;/* needed for Mac Powerbook G4 */
#endif
/* Set up the internal state */ /* Set up the internal state */
a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
u.ptr = key;
#if HASH_LITTLE_ENDIAN #if HASH_LITTLE_ENDIAN
u.ptr = key;
if ((u.i & 0x3) == 0) { if ((u.i & 0x3) == 0) {
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
@ -494,14 +496,16 @@ hashs2: return 2 32-bit hash values
void hashs2(const void *key, size_t length, uint32_t *pc, uint32_t *pb) void hashs2(const void *key, size_t length, uint32_t *pc, uint32_t *pb)
{ {
uint32_t a, b, c; /* internal state */ uint32_t a, b, c; /* internal state */
#if HASH_LITTLE_ENDIAN
union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */
#endif
/* Set up the internal state */ /* Set up the internal state */
a = b = c = 0xdeadbeef + ((uint32_t)length) + *pc; a = b = c = 0xdeadbeef + ((uint32_t)length) + *pc;
c += *pb; c += *pb;
u.ptr = key;
#if HASH_LITTLE_ENDIAN #if HASH_LITTLE_ENDIAN
u.ptr = key;
if (((u.i & 0x3) == 0)) { if (((u.i & 0x3) == 0)) {
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */

View file

@ -491,7 +491,6 @@ static int get_clip(long id, struct queue_entry *q)
static bool load_index_table(int fd, const struct voicefile_header *hdr) static bool load_index_table(int fd, const struct voicefile_header *hdr)
{ {
ssize_t ret; ssize_t ret;
struct clip_entry *buf;
if (index_handle > 0) /* nothing to do? */ if (index_handle > 0) /* nothing to do? */
return true; return true;
@ -505,14 +504,15 @@ static bool load_index_table(int fd, const struct voicefile_header *hdr)
if (ret == alloc_size) if (ret == alloc_size)
{ {
#ifdef ROCKBOX_LITTLE_ENDIAN
struct clip_entry *buf;
buf = core_get_data(index_handle); buf = core_get_data(index_handle);
for (int i = 0; i < hdr->id1_max + hdr->id2_max; i++) for (int i = 0; i < hdr->id1_max + hdr->id2_max; i++)
{ {
#ifdef ROCKBOX_LITTLE_ENDIAN
/* doesn't yield() */ /* doesn't yield() */
structec_convert(&buf[i], "ll", 1, true); structec_convert(&buf[i], "ll", 1, true);
#endif
} }
#endif
} }
else else
index_handle = core_free(index_handle); index_handle = core_free(index_handle);