summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2006-03-27 07:02:14 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2006-03-27 07:02:14 +0000
commit58e32f18c8d2202adba3f2edeb0fc9d51e025b79 (patch)
tree5d19af18d68ad5d2088a5f58b62a61ebe9f91fcf
parente58589bb825d3631d97c7d048e79daee9204374a (diff)
downloadrockbox-58e32f18c8d2202adba3f2edeb0fc9d51e025b79.tar.gz
rockbox-58e32f18c8d2202adba3f2edeb0fc9d51e025b79.zip
More alignment fixes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9275 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/tagcache.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index b485eb4647..0c8a6aaa1d 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -1408,7 +1408,7 @@ static bool allocate_tagcache(void)
1408 } 1408 }
1409 1409
1410 /* Load the header. */ 1410 /* Load the header. */
1411 hdr = (struct ramcache_header *)audiobuf; 1411 hdr = (struct ramcache_header *)(((long)audiobuf & ~0x03) + 0x04);
1412 memset(hdr, 0, sizeof(struct ramcache_header)); 1412 memset(hdr, 0, sizeof(struct ramcache_header));
1413 len = sizeof(struct tagcache_header); 1413 len = sizeof(struct tagcache_header);
1414 rc = read(fd, &hdr->h, len); 1414 rc = read(fd, &hdr->h, len);
@@ -1424,8 +1424,11 @@ static bool allocate_tagcache(void)
1424 1424
1425 hdr->indices = (struct index_entry *)(hdr + 1); 1425 hdr->indices = (struct index_entry *)(hdr + 1);
1426 1426
1427 /* Now calculate the required cache size. */ 1427 /**
1428 tagcache_size = hdr->h.datasize + 1428 * Now calculate the required cache size plus
1429 * some extra space for alignment fixes.
1430 */
1431 tagcache_size = hdr->h.datasize + 128 +
1429 sizeof(struct index_entry) * hdr->h.entry_count + 1432 sizeof(struct index_entry) * hdr->h.entry_count +
1430 sizeof(struct ramcache_header) + TAG_COUNT*sizeof(void *); 1433 sizeof(struct ramcache_header) + TAG_COUNT*sizeof(void *);
1431 logf("tagcache: %d bytes allocated.", tagcache_size); 1434 logf("tagcache: %d bytes allocated.", tagcache_size);
@@ -1523,6 +1526,14 @@ static bool load_tagcache(void)
1523 { 1526 {
1524 yield(); 1527 yield();
1525 fe = (struct tagfile_entry *)p; 1528 fe = (struct tagfile_entry *)p;
1529#ifdef ROCKBOX_STRICT_ALIGN
1530 /* Make sure the entry is long aligned. */
1531 if ((long)fe & 0x03)
1532 {
1533 bytesleft -= 4 - ((long)fe & 0x03);
1534 fe = (struct tagfile_entry *)(((long)fe & ~0x03) + 0x04);
1535 }
1536#endif
1526 rc = read(fd, fe, sizeof(struct tagfile_entry)); 1537 rc = read(fd, fe, sizeof(struct tagfile_entry));
1527 if (rc != sizeof(struct tagfile_entry)) 1538 if (rc != sizeof(struct tagfile_entry))
1528 { 1539 {