mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-10 05:32:40 -05:00
Fix overlapping string region ape.c->read_ape_tags
Switch to strrchr to find the extension Change-Id: Id7ea01ecc2e0553f560308f8b0fc53bd33b023e5
This commit is contained in:
parent
78b2d13567
commit
ed63ef077a
1 changed files with 16 additions and 9 deletions
|
|
@ -124,7 +124,7 @@ bool read_ape_tags(int fd, struct mp3entry* id3)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcasecmp(name, "cuesheet"))
|
if (strcasecmp(name, "cuesheet") == 0)
|
||||||
{
|
{
|
||||||
id3->has_embedded_cuesheet = true;
|
id3->has_embedded_cuesheet = true;
|
||||||
id3->embedded_cuesheet.pos = lseek(fd, 0, SEEK_CUR)-item.length;
|
id3->embedded_cuesheet.pos = lseek(fd, 0, SEEK_CUR)-item.length;
|
||||||
|
|
@ -152,17 +152,24 @@ bool read_ape_tags(int fd, struct mp3entry* id3)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gather the album art format from the pseudo file name's ending. */
|
/* Gather the album art format from the pseudo file name's ending. */
|
||||||
strcpy(name, name + strlen(name) - 4);
|
/* strcpy(name, name + strlen(name) - 4); */
|
||||||
id3->albumart.type = AA_TYPE_UNKNOWN;
|
id3->albumart.type = AA_TYPE_UNKNOWN;
|
||||||
if (strcasecmp(name, ".jpg") == 0)
|
char *ext = strrchr(name, '.');
|
||||||
|
if (ext)
|
||||||
|
{
|
||||||
|
if (strcasecmp(ext, ".jpg") == 0)
|
||||||
{
|
{
|
||||||
id3->albumart.type = AA_TYPE_JPG;
|
id3->albumart.type = AA_TYPE_JPG;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(name, ".png") == 0)
|
else if (strcasecmp(ext, ".jpeg") == 0)
|
||||||
|
{
|
||||||
|
id3->albumart.type = AA_TYPE_JPG;
|
||||||
|
}
|
||||||
|
else if (strcasecmp(ext, ".png") == 0)
|
||||||
{
|
{
|
||||||
id3->albumart.type = AA_TYPE_PNG;
|
id3->albumart.type = AA_TYPE_PNG;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* Set the album art size and position. */
|
/* Set the album art size and position. */
|
||||||
if (id3->albumart.type != AA_TYPE_UNKNOWN)
|
if (id3->albumart.type != AA_TYPE_UNKNOWN)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue