Enforce JACK client name length restrictions.
This commit is contained in:
parent
16778d0039
commit
8d9557f88c
|
@ -398,6 +398,12 @@ Chain::can_configure_outputs ( Module *m, int n ) const
|
|||
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
|
||||
* changed so they can take the appropriate action (in particular the
|
||||
* JACK module). */
|
||||
|
@ -407,7 +413,6 @@ Chain::name ( const char *name )
|
|||
char ename[512];
|
||||
snprintf( ename, sizeof(ename), "%s/%s", APP_NAME, name );
|
||||
|
||||
|
||||
if ( ! _engine )
|
||||
{
|
||||
_engine = new Engine( &Chain::process, this );
|
||||
|
|
|
@ -116,6 +116,8 @@ public:
|
|||
|
||||
void log_children ( void );
|
||||
|
||||
static int maximum_name_length ( void );
|
||||
|
||||
Engine *engine ( void ) const { return _engine; }
|
||||
|
||||
LOG_CREATE_FUNC( Chain );
|
||||
|
|
|
@ -64,5 +64,4 @@ public:
|
|||
|
||||
int dropped ( void ) const { return _buffers_dropped; }
|
||||
void buffer_size_callback ( void ( *buffer_size_callback ) ( nframes_t, void * ), void *user_data );
|
||||
|
||||
};
|
||||
|
|
|
@ -238,11 +238,19 @@ void Mixer_Strip::cb_handle(Fl_Widget* o, void* v) {
|
|||
((Mixer_Strip*)(v))->cb_handle(o);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
Mixer_Strip::name ( const char *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 );
|
||||
label( s );
|
||||
if ( _chain )
|
||||
|
|
|
@ -98,5 +98,6 @@ namespace JACK
|
|||
bool zombified ( void ) const { return _zombified; }
|
||||
float cpu_load ( void ) const { return jack_cpu_load( _client ); }
|
||||
|
||||
static int maximum_name_length ( void ) { return jack_client_name_size(); }
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue