Browse Source

Add some error checking to unjournaled state save/load.

tags/non-daw-v1.1.0
Jonathan Moore Liles 16 years ago
parent
commit
f365b9d8f7
1 changed files with 11 additions and 6 deletions
  1. +11
    -6
      Timeline/Loggable.C

+ 11
- 6
Timeline/Loggable.C View File

@@ -143,7 +143,10 @@ Loggable::load_unjournaled_state ( void )
fp = fopen( "unjournaled", "r" );

if ( ! fp )
{
DWARNING( "Could not open unjournaled state file for reading" );
return false;
}

unsigned int id;
char buf[BUFSIZ];
@@ -239,12 +242,16 @@ Loggable::close ( void )
bool
Loggable::save_unjournaled_state ( void )
{
FILE *fp;

/* FIXME: check for errors */
FILE *fp = fopen( "unjournaled", "w" );
fp = fopen( "unjournaled", "w" );

if ( ! fp )
{
DWARNING( "Could not open unjournaled state file for writing!" );
return false;
}

/* write out the unjournaled state of all currently active
* loggables */
for ( std::map <unsigned int, Log_Entry *>::iterator i = _loggables_unjournaled.begin();
i != _loggables_unjournaled.end(); ++i )
{
@@ -258,8 +265,6 @@ Loggable::save_unjournaled_state ( void )
}
}

/* write out the remembered state of inactive loggables. */

fclose( fp );

return true;


Loading…
Cancel
Save