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