lrcplayer:
* fix possible infinite loop in save_changes(). hopefully fix FS#11457. * use .lrc file instead of .lrc8 file when saveing changes to the lyrics read from id3 tag. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27305 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
079e19491a
commit
851e06617b
|
@ -1959,14 +1959,7 @@ static void save_changes(void)
|
||||||
if (!current.changed_lrc)
|
if (!current.changed_lrc)
|
||||||
return;
|
return;
|
||||||
rb->splash(HZ/2, "Saving changes...");
|
rb->splash(HZ/2, "Saving changes...");
|
||||||
if (current.type > NUM_TYPES)
|
if (current.type == TXT || current.type > NUM_TYPES)
|
||||||
{
|
|
||||||
/* save changes to new .lrc8 file */
|
|
||||||
rb->strcpy(new_file, current.lrc_file);
|
|
||||||
p = rb->strrchr(new_file, '.');
|
|
||||||
rb->strcpy(p, extentions[LRC8]);
|
|
||||||
}
|
|
||||||
else if (current.type == TXT)
|
|
||||||
{
|
{
|
||||||
/* save changes to new .lrc file */
|
/* save changes to new .lrc file */
|
||||||
rb->strcpy(new_file, current.lrc_file);
|
rb->strcpy(new_file, current.lrc_file);
|
||||||
|
@ -1994,7 +1987,10 @@ static void save_changes(void)
|
||||||
}
|
}
|
||||||
current.offset = 0;
|
current.offset = 0;
|
||||||
if (current.type > NUM_TYPES)
|
if (current.type > NUM_TYPES)
|
||||||
|
{
|
||||||
curr = -1;
|
curr = -1;
|
||||||
|
rb->write(fd, BOM, BOM_SIZE);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
size = rb->filesize(fe);
|
size = rb->filesize(fe);
|
||||||
while (curr < size)
|
while (curr < size)
|
||||||
|
@ -2005,8 +2001,7 @@ static void save_changes(void)
|
||||||
temp_lrc; temp_lrc = temp_lrc->next)
|
temp_lrc; temp_lrc = temp_lrc->next)
|
||||||
{
|
{
|
||||||
offset = temp_lrc->file_offset;
|
offset = temp_lrc->file_offset;
|
||||||
if (offset == -1 ||
|
if (offset < next && temp_lrc->old_time_start == -1)
|
||||||
(offset < next && temp_lrc->old_time_start == -1))
|
|
||||||
{
|
{
|
||||||
lrc_line = temp_lrc;
|
lrc_line = temp_lrc;
|
||||||
next = offset;
|
next = offset;
|
||||||
|
@ -2014,7 +2009,7 @@ static void save_changes(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset = current.offset_file_offset;
|
offset = current.offset_file_offset;
|
||||||
if (offset >= curr && offset < next)
|
if (offset >= 0 && offset < next)
|
||||||
{
|
{
|
||||||
lrc_line = NULL;
|
lrc_line = NULL;
|
||||||
next = offset;
|
next = offset;
|
||||||
|
@ -2073,16 +2068,11 @@ static void save_changes(void)
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
if (current.type == TXT)
|
if (current.type == TXT || current.type > NUM_TYPES)
|
||||||
{
|
{
|
||||||
current.type = LRC;
|
current.type = LRC;
|
||||||
rb->strcpy(current.lrc_file, new_file);
|
rb->strcpy(current.lrc_file, new_file);
|
||||||
}
|
}
|
||||||
else if (current.type > NUM_TYPES)
|
|
||||||
{
|
|
||||||
current.type = LRC8;
|
|
||||||
rb->strcpy(current.lrc_file, new_file);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rb->remove(current.lrc_file);
|
rb->remove(current.lrc_file);
|
||||||
|
@ -2915,14 +2905,15 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
return PLUGIN_ERROR;
|
return PLUGIN_ERROR;
|
||||||
}
|
}
|
||||||
ext = rb->strrchr(current.lrc_file, '.');
|
ext = rb->strrchr(current.lrc_file, '.');
|
||||||
for (current.type = 0; ext && current.type < NUM_TYPES; current.type++)
|
if (!ext) ext = current.lrc_file;
|
||||||
|
for (current.type = 0; current.type < NUM_TYPES; current.type++)
|
||||||
{
|
{
|
||||||
if (!rb->strcmp(ext, extentions[current.type]))
|
if (!rb->strcmp(ext, extentions[current.type]))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!ext || current.type == NUM_TYPES)
|
if (current.type == NUM_TYPES)
|
||||||
{
|
{
|
||||||
rb->splashf(HZ, "%s is not supported", ext? ext: current.lrc_file);
|
rb->splashf(HZ, "%s is not supported", ext);
|
||||||
return PLUGIN_ERROR;
|
return PLUGIN_ERROR;
|
||||||
}
|
}
|
||||||
current.found_lrc = true;
|
current.found_lrc = true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user