Mixer: Cope with some plugins having insane numbers of parameters.
This commit is contained in:
parent
e909d9594b
commit
0f8017a1ef
|
@ -710,18 +710,21 @@ Module::chain ( Chain *v )
|
||||||
char *
|
char *
|
||||||
Module::get_parameters ( void ) const
|
Module::get_parameters ( void ) const
|
||||||
{
|
{
|
||||||
char *s = new char[1024];
|
int len = control_input.size() * 50;
|
||||||
|
char *s = new char[ len ];
|
||||||
|
|
||||||
s[0] = 0;
|
s[0] = 0;
|
||||||
char *sp = s;
|
char *sp = s;
|
||||||
|
|
||||||
if ( control_input.size() )
|
if ( control_input.size() )
|
||||||
{
|
{
|
||||||
for ( unsigned int i = 0; i < control_input.size(); ++i )
|
for ( unsigned int i = 0; i < control_input.size(); ++i )
|
||||||
sp += snprintf( sp, 1024 - (sp - s),"%f:", control_input[i].control_value() );
|
sp += snprintf( sp, len - (sp - s),"%f:", control_input[i].control_value() );
|
||||||
|
|
||||||
*(sp - 1) = '\0';
|
*(sp - 1) = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DMESSAGE("get_parameters: %s",s); */
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,6 @@ unescape ( char *s )
|
||||||
char *
|
char *
|
||||||
Log_Entry::print ( void ) const
|
Log_Entry::print ( void ) const
|
||||||
{
|
{
|
||||||
/* FIXME: gross over-allocation */
|
|
||||||
char *r = (char*)malloc( 1024 );
|
char *r = (char*)malloc( 1024 );
|
||||||
|
|
||||||
r[0] = 0;
|
r[0] = 0;
|
||||||
|
@ -105,20 +104,17 @@ Log_Entry::print ( void ) const
|
||||||
|
|
||||||
get( i, &s, &v );
|
get( i, &s, &v );
|
||||||
|
|
||||||
/* FIXME: arbitrary limit */
|
char *t;
|
||||||
char t[1024];
|
asprintf( &t, "%s %s%s", s, v, size() == i + 1 ? "" : " " );
|
||||||
snprintf( t, sizeof( t ), "%s %s%s", s, v, size() == i + 1 ? "" : " " );
|
|
||||||
|
r = (char*)realloc( r, strlen(r) + strlen(t) + 1 );
|
||||||
|
|
||||||
strcat( r, t );
|
strcat( r, t );
|
||||||
|
|
||||||
|
free(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *r2 = (char*)malloc( strlen( r ) + 1 );
|
return r;
|
||||||
|
|
||||||
strcpy( r2, r );
|
|
||||||
|
|
||||||
free( r );
|
|
||||||
|
|
||||||
return r2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** sigh. parse a string of ":name value :name value" pairs into an
|
/** sigh. parse a string of ":name value :name value" pairs into an
|
||||||
|
|
|
@ -346,10 +346,18 @@ Loggable::update_id ( unsigned int id )
|
||||||
const char *
|
const char *
|
||||||
Loggable::escape ( const char *s )
|
Loggable::escape ( const char *s )
|
||||||
{
|
{
|
||||||
static char r[512];
|
static size_t rl = 256;
|
||||||
|
static char *r = new char[rl + 1];
|
||||||
|
|
||||||
|
if ( strlen(s) * 2 > rl )
|
||||||
|
{
|
||||||
|
delete []r;
|
||||||
|
rl = strlen(s) * 2;
|
||||||
|
r = new char[ rl + 1 ];
|
||||||
|
}
|
||||||
|
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for ( ; *s && i < sizeof( r ); ++i, ++s )
|
for ( ; *s && i < rl; ++i, ++s )
|
||||||
{
|
{
|
||||||
if ( '\n' == *s )
|
if ( '\n' == *s )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue