Browse Source

Enforce JACK client name length restrictions.

tags/non-daw-v1.1.0
Jonathan Moore Liles 15 years ago
parent
commit
8d9557f88c
5 changed files with 19 additions and 4 deletions
  1. +6
    -1
      Mixer/Chain.C
  2. +2
    -0
      Mixer/Chain.H
  3. +0
    -1
      Mixer/Engine/Engine.H
  4. +10
    -2
      Mixer/Mixer_Strip.C
  5. +1
    -0
      nonlib/JACK/Client.H

+ 6
- 1
Mixer/Chain.C View File

@@ -398,6 +398,12 @@ Chain::can_configure_outputs ( Module *m, int n ) const
return true; return true;
} }


int
Chain::maximum_name_length ( void )
{
return JACK::Client::maximum_name_length() - strlen( APP_NAME "/" );
}

/* rename chain... we have to let our modules know our name has /* rename chain... we have to let our modules know our name has
* changed so they can take the appropriate action (in particular the * changed so they can take the appropriate action (in particular the
* JACK module). */ * JACK module). */
@@ -407,7 +413,6 @@ Chain::name ( const char *name )
char ename[512]; char ename[512];
snprintf( ename, sizeof(ename), "%s/%s", APP_NAME, name ); snprintf( ename, sizeof(ename), "%s/%s", APP_NAME, name );



if ( ! _engine ) if ( ! _engine )
{ {
_engine = new Engine( &Chain::process, this ); _engine = new Engine( &Chain::process, this );


+ 2
- 0
Mixer/Chain.H View File

@@ -116,6 +116,8 @@ public:


void log_children ( void ); void log_children ( void );


static int maximum_name_length ( void );

Engine *engine ( void ) const { return _engine; } Engine *engine ( void ) const { return _engine; }


LOG_CREATE_FUNC( Chain ); LOG_CREATE_FUNC( Chain );


+ 0
- 1
Mixer/Engine/Engine.H View File

@@ -64,5 +64,4 @@ public:


int dropped ( void ) const { return _buffers_dropped; } int dropped ( void ) const { return _buffers_dropped; }
void buffer_size_callback ( void ( *buffer_size_callback ) ( nframes_t, void * ), void *user_data ); void buffer_size_callback ( void ( *buffer_size_callback ) ( nframes_t, void * ), void *user_data );

}; };

+ 10
- 2
Mixer/Mixer_Strip.C View File

@@ -238,11 +238,19 @@ void Mixer_Strip::cb_handle(Fl_Widget* o, void* v) {
((Mixer_Strip*)(v))->cb_handle(o); ((Mixer_Strip*)(v))->cb_handle(o);
} }




void void
Mixer_Strip::name ( const char *name ) { Mixer_Strip::name ( const char *name ) {


char *s = strdup( name ); char *s = strdup( name );

if ( strlen( s ) > Chain::maximum_name_length() )
{
s[Chain::maximum_name_length() - 1] = '\0';

fl_alert( "Name \"%s\" is too long, truncating to \"%s\"", name, s );
}

name_field->value( s ); name_field->value( s );
label( s ); label( s );
if ( _chain ) if ( _chain )


+ 1
- 0
nonlib/JACK/Client.H View File

@@ -98,5 +98,6 @@ namespace JACK
bool zombified ( void ) const { return _zombified; } bool zombified ( void ) const { return _zombified; }
float cpu_load ( void ) const { return jack_cpu_load( _client ); } float cpu_load ( void ) const { return jack_cpu_load( _client ); }


static int maximum_name_length ( void ) { return jack_client_name_size(); }
}; };
} }

Loading…
Cancel
Save