Browse Source

Mixer: Cope with some plugins having insane numbers of parameters.

tags/non-daw-v1.3.0
Jonathan Moore Liles 8 months ago
parent
commit
0f8017a1ef
3 changed files with 22 additions and 15 deletions
  1. +5
    -2
      mixer/src/Module.C
  2. +7
    -11
      nonlib/Log_Entry.C
  3. +10
    -2
      nonlib/Loggable.C

+ 5
- 2
mixer/src/Module.C View File

@@ -710,18 +710,21 @@ Module::chain ( Chain *v )
char *
Module::get_parameters ( void ) const
{
char *s = new char[1024];
int len = control_input.size() * 50;
char *s = new char[ len ];
s[0] = 0;
char *sp = s;

if ( control_input.size() )
{
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';
}

/* DMESSAGE("get_parameters: %s",s); */
return s;
}



+ 7
- 11
nonlib/Log_Entry.C View File

@@ -94,7 +94,6 @@ unescape ( char *s )
char *
Log_Entry::print ( void ) const
{
/* FIXME: gross over-allocation */
char *r = (char*)malloc( 1024 );

r[0] = 0;
@@ -105,20 +104,17 @@ Log_Entry::print ( void ) const

get( i, &s, &v );

/* FIXME: arbitrary limit */
char t[1024];
snprintf( t, sizeof( t ), "%s %s%s", s, v, size() == i + 1 ? "" : " " );
char *t;
asprintf( &t, "%s %s%s", s, v, size() == i + 1 ? "" : " " );

strcat( r, t );
}

char *r2 = (char*)malloc( strlen( r ) + 1 );
r = (char*)realloc( r, strlen(r) + strlen(t) + 1 );

strcpy( r2, r );
strcat( r, t );

free( r );
free(t);
}

return r2;
return r;
}

/** sigh. parse a string of ":name value :name value" pairs into an


+ 10
- 2
nonlib/Loggable.C View File

@@ -346,10 +346,18 @@ Loggable::update_id ( unsigned int id )
const char *
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;
for ( ; *s && i < sizeof( r ); ++i, ++s )
for ( ; *s && i < rl; ++i, ++s )
{
if ( '\n' == *s )
{


Loading…
Cancel
Save