mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
fix leak-file-handles.
git-svn-id: svn://svn.rockbox.org/rockbox/branches/v3_7@28331 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5c19400898
commit
4b5a24f46c
2 changed files with 9 additions and 4 deletions
|
@ -2491,6 +2491,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
{
|
{
|
||||||
int rat, srat, nrat; /* for rate selection */
|
int rat, srat, nrat; /* for rate selection */
|
||||||
int cont = 1, butt;
|
int cont = 1, butt;
|
||||||
|
int ret;
|
||||||
long tim = 0;
|
long tim = 0;
|
||||||
static const char* bstrg[] = {
|
static const char* bstrg[] = {
|
||||||
"64", "80", "96", "112", "128", "160", "192", "224", "256", "320"
|
"64", "80", "96", "112", "128", "160", "192", "224", "256", "320"
|
||||||
|
@ -2544,7 +2545,8 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
|
|
||||||
if(cont)
|
if(cont)
|
||||||
{
|
{
|
||||||
if(wave_open() == 0)
|
ret = wave_open();
|
||||||
|
if(ret == 0)
|
||||||
{
|
{
|
||||||
init_mp3_encoder_engine(true, brate[srat], cfg.samplerate);
|
init_mp3_encoder_engine(true, brate[srat], cfg.samplerate);
|
||||||
get_mp3_filename(wav_filename);
|
get_mp3_filename(wav_filename);
|
||||||
|
@ -2557,11 +2559,12 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
|
|
||||||
rb->close(wavfile);
|
rb->close(wavfile);
|
||||||
rb->close(mp3file);
|
rb->close(mp3file);
|
||||||
|
rb->reload_directory();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rb->close(wavfile);
|
rb->close(wavfile);
|
||||||
rb->lcd_putsxyf(0, 20, "WaveOpen failed %d", wave_open());
|
rb->lcd_putsxyf(0, 20, "WaveOpen failed %d", ret);
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
rb->sleep(5*HZ);
|
rb->sleep(5*HZ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,7 @@ static int wav2wv(const char *infile)
|
||||||
|
|
||||||
if (rb->read (in_fd, &raw_header, sizeof (raw_header)) != sizeof (raw_header)) {
|
if (rb->read (in_fd, &raw_header, sizeof (raw_header)) != sizeof (raw_header)) {
|
||||||
rb->splash(HZ*2, "could not read file!");
|
rb->splash(HZ*2, "could not read file!");
|
||||||
|
rb->close (in_fd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +136,7 @@ static int wav2wv(const char *infile)
|
||||||
rb->strncmp (native_header.data_ckID, "data", 4) ||
|
rb->strncmp (native_header.data_ckID, "data", 4) ||
|
||||||
native_header.FormatTag != 1 || native_header.BitsPerSample != 16) {
|
native_header.FormatTag != 1 || native_header.BitsPerSample != 16) {
|
||||||
rb->splash(HZ*2, "incompatible wav file!");
|
rb->splash(HZ*2, "incompatible wav file!");
|
||||||
|
rb->close (in_fd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,6 +268,7 @@ static int wav2wv(const char *infile)
|
||||||
else
|
else
|
||||||
rb->splash(HZ*3, "operation successful");
|
rb->splash(HZ*3, "operation successful");
|
||||||
|
|
||||||
|
rb->reload_directory();
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,6 +293,5 @@ enum plugin_status plugin_start(const void *parameter)
|
||||||
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
rb->cpu_boost(false);
|
rb->cpu_boost(false);
|
||||||
#endif
|
#endif
|
||||||
/* Return PLUGIN_USB_CONNECTED to force a file-tree refresh */
|
return PLUGIN_OK;
|
||||||
return PLUGIN_USB_CONNECTED;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue