summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/tagcache.c13
-rw-r--r--firmware/export/config.h2
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)
783 if (!strcasecmp(str, index[i].str)) 783 if (!strcasecmp(str, index[i].str))
784 { 784 {
785 tempbuf_left -= sizeof(struct tempbuf_id); 785 tempbuf_left -= sizeof(struct tempbuf_id);
786 if (tempbuf_left < 0) 786 if (tempbuf_left - 4 < 0)
787 return false; 787 return false;
788 788
789 idp = index[i].id; 789 idp = index[i].id;
@@ -791,6 +791,17 @@ static bool tempbuf_unique_insert(char *str, int id)
791 idp = idp->next; 791 idp = idp->next;
792 792
793 idp->next = (struct tempbuf_id *)&tempbuf[tempbuf_pos]; 793 idp->next = (struct tempbuf_id *)&tempbuf[tempbuf_pos];
794#ifdef ROCKBOX_STRICT_ALIGN
795 /* Make sure the entry is long aligned. */
796 if ((long)idp->next & 0x03)
797 {
798 int fix = 4 - ((long)idp->next & 0x03);
799 tempbuf_left -= fix;
800 tempbuf_pos += fix;
801 idp->next = (struct tempbuf_id *)((
802 (long)idp->next & ~0x03) + 0x04);
803 }
804#endif
794 idp = idp->next; 805 idp = idp->next;
795 idp->id = id; 806 idp->id = id;
796 idp->next = NULL; 807 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 @@
192#endif 192#endif
193 193
194/* Determine if accesses should be strictly long aligned. */ 194/* Determine if accesses should be strictly long aligned. */
195#if (CONFIG_CPU == SH7034) || (CONFIG_CPU == CPU_ARM) 195#if (CONFIG_CPU == SH7034) || defined(CPU_ARM)
196#define ROCKBOX_STRICT_ALIGN 1 196#define ROCKBOX_STRICT_ALIGN 1
197#endif 197#endif
198 198