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 ++++++++++++- firmware/export/config.h | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) 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; diff --git a/firmware/export/config.h b/firmware/export/config.h index 5ac333d5e4..f99007304d 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -192,7 +192,7 @@ #endif /* Determine if accesses should be strictly long aligned. */ -#if (CONFIG_CPU == SH7034) || (CONFIG_CPU == CPU_ARM) +#if (CONFIG_CPU == SH7034) || defined(CPU_ARM) #define ROCKBOX_STRICT_ALIGN 1 #endif -- cgit v1.2.3