Prevent Timeline and Mixer from attempting to open each other's project formats.

This commit is contained in:
Jonathan Moore Liles 2010-01-26 22:36:24 -06:00
parent 6db8e2f3fa
commit b222abc4e1
4 changed files with 20 additions and 6 deletions

View File

@ -117,7 +117,7 @@ Project::write_info ( void )
} }
bool bool
Project::read_info ( int *version, char **creation_date ) Project::read_info ( int *version, char **creation_date, char **created_by )
{ {
FILE *fp; FILE *fp;
@ -129,6 +129,7 @@ Project::read_info ( int *version, char **creation_date )
*version = 0; *version = 0;
*creation_date = 0; *creation_date = 0;
*created_by = 0;
char *name, *value; char *name, *value;
@ -140,6 +141,8 @@ Project::read_info ( int *version, char **creation_date )
*version = atoi( value ); *version = atoi( value );
else if ( ! strcmp( name, "created on" ) ) else if ( ! strcmp( name, "created on" ) )
*creation_date = strdup( value ); *creation_date = strdup( value );
else if ( ! strcmp( name, "created by" ) )
*created_by = strdup( value );
free( name ); free( name );
free( value ); free( value );
@ -237,8 +240,12 @@ Project::open ( const char *name )
int version; int version;
char *creation_date; char *creation_date;
char *created_by;
if ( ! read_info( &version, &creation_date ) ) if ( ! read_info( &version, &creation_date, &created_by ) )
return E_INVALID;
if ( strncmp( created_by, APP_TITLE, strlen( APP_TITLE ) ) )
return E_INVALID; return E_INVALID;
if ( version != PROJECT_VERSION ) if ( version != PROJECT_VERSION )

View File

@ -32,7 +32,7 @@ class Project
static char _created_on[40]; static char _created_on[40];
static bool write_info ( void ); static bool write_info ( void );
static bool read_info ( int *version, char **creation_date ); static bool read_info ( int *version, char **creation_date, char **created_by );
static void set_name ( const char *name ); static void set_name ( const char *name );
static const char *_errstr[]; static const char *_errstr[];

View File

@ -124,7 +124,7 @@ Project::write_info ( void )
} }
bool bool
Project::read_info ( int *version, nframes_t *sample_rate, char **creation_date ) Project::read_info ( int *version, nframes_t *sample_rate, char **creation_date, char **created_by )
{ {
FILE *fp; FILE *fp;
@ -137,6 +137,7 @@ Project::read_info ( int *version, nframes_t *sample_rate, char **creation_date
*version = 0; *version = 0;
*sample_rate = 0; *sample_rate = 0;
*creation_date = 0; *creation_date = 0;
*created_by = 0;
char *name, *value; char *name, *value;
@ -150,6 +151,8 @@ Project::read_info ( int *version, nframes_t *sample_rate, char **creation_date
*version = atoi( value ); *version = atoi( value );
else if ( ! strcmp( name, "created on" ) ) else if ( ! strcmp( name, "created on" ) )
*creation_date = strdup( value ); *creation_date = strdup( value );
else if ( ! strcmp( name, "created by" ) )
*created_by = strdup( value );
free( name ); free( name );
free( value ); free( value );
@ -248,8 +251,12 @@ Project::open ( const char *name )
int version; int version;
nframes_t rate; nframes_t rate;
char *creation_date; char *creation_date;
char *created_by;
if ( ! read_info( &version, &rate, &creation_date ) ) if ( ! read_info( &version, &rate, &creation_date, &created_by ) )
return E_INVALID;
if ( strncmp( created_by, APP_TITLE, strlen( APP_TITLE ) ) )
return E_INVALID; return E_INVALID;
if ( version != PROJECT_VERSION ) if ( version != PROJECT_VERSION )

View File

@ -32,7 +32,7 @@ class Project
static char _created_on[40]; static char _created_on[40];
static bool write_info ( void ); static bool write_info ( void );
static bool read_info ( int *version, nframes_t *sample_rate, char **creation_date ); static bool read_info ( int *version, nframes_t *sample_rate, char **creation_date, char **created_by );
static void set_name ( const char *name ); static void set_name ( const char *name );
static const char *_errstr[]; static const char *_errstr[];