Resolved dangerous usage of c_str(). The value returned by c_str() is invalid after this call

This commit is contained in:
Matthew Budd 2020-06-14 20:11:59 -04:00
parent c5bbd3cec5
commit 9748d39169
1 changed files with 3 additions and 5 deletions

View File

@ -446,7 +446,6 @@ static void KeyboardCommands (void)
{
int is_shift, is_alt;
char *movie_fname = "";
// get the keyboard input
// check if the family keyboard is enabled
@ -573,10 +572,9 @@ static void KeyboardCommands (void)
{
if (is_shift)
{
movie_fname =
const_cast <char *>(FCEU_MakeFName (FCEUMKF_MOVIE, 0, 0).c_str ());
FCEUI_printf ("Recording movie to %s\n", movie_fname);
FCEUI_SaveMovie (movie_fname, MOVIE_FLAG_NONE, L"");
std::string movie_fname = FCEU_MakeFName (FCEUMKF_MOVIE, 0, 0);
FCEUI_printf ("Recording movie to %s\n", movie_fname.c_str() );
FCEUI_SaveMovie(movie_fname.c_str() , MOVIE_FLAG_NONE, L"");
}
else
{