From a33d5d7926ba83530063f719df0177c6ffe33c3a Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Sun, 26 Mar 2006 18:36:31 +0000 Subject: Fixed the define in config.h and more tagcache alignment issues. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9266 a1c6a512-1295-4272-9138-f99709370657 --- apps/tagcache.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'apps/tagcache.c') diff --git a/apps/tagcache.c b/apps/tagcache.c index 850eaf9733..b485eb4647 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -783,7 +783,7 @@ static bool tempbuf_unique_insert(char *str, int id) if (!strcasecmp(str, index[i].str)) { tempbuf_left -= sizeof(struct tempbuf_id); - if (tempbuf_left < 0) + if (tempbuf_left - 4 < 0) return false; idp = index[i].id; @@ -791,6 +791,17 @@ static bool tempbuf_unique_insert(char *str, int id) idp = idp->next; idp->next = (struct tempbuf_id *)&tempbuf[tempbuf_pos]; +#ifdef ROCKBOX_STRICT_ALIGN + /* Make sure the entry is long aligned. */ + if ((long)idp->next & 0x03) + { + int fix = 4 - ((long)idp->next & 0x03); + tempbuf_left -= fix; + tempbuf_pos += fix; + idp->next = (struct tempbuf_id *)(( + (long)idp->next & ~0x03) + 0x04); + } +#endif idp = idp->next; idp->id = id; idp->next = NULL; -- cgit v1.2.3