summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-11-12 22:35:32 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-11-12 22:35:32 +0000
commit84c6fd96a6b7437b9e7250db52ca19b828b0b3bf (patch)
tree3ae0b2259e8d0f72550e63903b958bc81b7bf3e5
parent099a6b58d1cca1fb052aa453cf1dec524d3ba35a (diff)
downloadrockbox-84c6fd96a6b7437b9e7250db52ca19b828b0b3bf.zip
rockbox-84c6fd96a6b7437b9e7250db52ca19b828b0b3bf.tar.gz
rockbox-84c6fd96a6b7437b9e7250db52ca19b828b0b3bf.tar.bz2
rockbox-84c6fd96a6b7437b9e7250db52ca19b828b0b3bf.tar.xz
Fixed broken unicode_munge()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2840 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/id3.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/firmware/id3.c b/firmware/id3.c
index f09ccf4..3ee25ca 100644
--- a/firmware/id3.c
+++ b/firmware/id3.c
@@ -80,9 +80,6 @@ const int freqtab[][4] =
{22050, 24000, 16000, 0}, /* MPEG version 2 */
};
-#define UNICODE_BOM_1 0xfffe
-#define UNICODE_BOM_2 0xfeff
-
/* Checks to see if the passed in string is a 16-bit wide Unicode v2
string. If it is, we attempt to convert it to a 8-bit ASCII string
(for valid 8-bit ASCII characters). If it's not unicode, we leave
@@ -109,14 +106,16 @@ static int unicode_munge(char** string, int *len) {
/* Unicode with or without BOM */
if(str[0] == 0x01 || str[0] == 0x02) {
str++;
- tmp = BYTES2INT(0, 0, str[1], str[2]);
+ tmp = BYTES2INT(0, 0, str[0], str[1]);
- if(tmp == UNICODE_BOM_2) { /* Little endian? */
+ /* Now check if there is a BOM (zero-width non-breaking space, 0xfeff)
+ and if it is in little or big endian format */
+ if(tmp == 0xfffe) { /* Little endian? */
le = true;
str += 2;
}
- if(tmp == UNICODE_BOM_1) /* Big endian? */
+ if(tmp == 0xfeff) /* Big endian? */
str += 2;
i = 0;
@@ -133,10 +132,10 @@ static int unicode_munge(char** string, int *len) {
else
outstr[i++] = str[1];
}
+ str += 2;
} while(str[0] || str[1]);
*len = i;
- (*string)++; /* Skip the encoding type byte */
return 0;
}