Fixed endianness bug in getsonglength

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@750 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-05-27 14:03:17 +00:00
parent ceb5fb824b
commit 76d0c7d790

View file

@ -349,7 +349,8 @@ getid3v1len(int fd)
static int static int
getsonglength(int fd, mp3entry *entry) getsonglength(int fd, mp3entry *entry)
{ {
long header=0; unsigned long header=0;
unsigned char tmp;
int version; int version;
int layer; int layer;
int bitindex; int bitindex;
@ -367,16 +368,18 @@ getsonglength(int fd, mp3entry *entry)
/* Fill up header with first 24 bits */ /* Fill up header with first 24 bits */
for(version = 0; version < 3; version++) { for(version = 0; version < 3; version++) {
header <<= 8; header <<= 8;
if(!read(fd, &header, 1)) if(!read(fd, &tmp, 1))
return -1; return -1;
header |= tmp;
} }
/* Loop trough file until we find a frame header */ /* Loop trough file until we find a frame header */
restart: restart:
do { do {
header <<= 8; header <<= 8;
if(!read(fd, &header, 1)) if(!read(fd, &tmp, 1))
return -1; return -1;
header |= tmp;
} while(!CHECKSYNC(header)); } while(!CHECKSYNC(header));
/* /*
@ -493,9 +496,10 @@ mp3info(mp3entry *entry, char *filename)
entry->filesize = getfilesize(fd); entry->filesize = getfilesize(fd);
entry->id3v2len = getid3v2len(fd); entry->id3v2len = getid3v2len(fd);
entry->id3v1len = getid3v1len(fd); entry->id3v1len = getid3v1len(fd);
/* entry->length = getsonglength(fd, entry); */ entry->length = getsonglength(fd, entry);
entry->title = NULL; entry->title = NULL;
if(HASID3V2(entry)) if(HASID3V2(entry))
setid3v2title(fd, entry); setid3v2title(fd, entry);