summaryrefslogtreecommitdiff
path: root/apps/tagcache.c
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2006-03-26 18:36:31 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2006-03-26 18:36:31 +0000
commita33d5d7926ba83530063f719df0177c6ffe33c3a (patch)
tree79b86d5caad832b758aba723ef5b92e16d716236 /apps/tagcache.c
parente9721bff5822b474efc457720212d68293f95a14 (diff)
downloadrockbox-a33d5d7926ba83530063f719df0177c6ffe33c3a.zip
rockbox-a33d5d7926ba83530063f719df0177c6ffe33c3a.tar.gz
rockbox-a33d5d7926ba83530063f719df0177c6ffe33c3a.tar.bz2
rockbox-a33d5d7926ba83530063f719df0177c6ffe33c3a.tar.xz
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
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r--apps/tagcache.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 850eaf9..b485eb4 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;