Browse Source

Replace deprecated scanf %a modifier with %m.

tags/non-daw-v1.2.0
Jonathan Moore Liles 5 years ago
parent
commit
1daf0f6150
14 changed files with 27 additions and 27 deletions
  1. +1
    -1
      FL/Fl_Flip_Button.H
  2. +6
    -6
      mixer/src/JACK_Module.C
  3. +3
    -3
      mixer/src/Mixer.C
  4. +1
    -1
      mixer/src/Module.C
  5. +1
    -1
      mixer/src/Plugin_Chooser.C
  6. +1
    -1
      mixer/src/Project.C
  7. +2
    -2
      mixer/src/midi-mapper.C
  8. +5
    -5
      nonlib/Loggable.C
  9. +2
    -2
      sequencer/src/smf.C
  10. +1
    -1
      session-manager/src/jackpatch.c
  11. +1
    -1
      session-manager/src/nsm-proxy.C
  12. +1
    -1
      session-manager/src/nsmd.C
  13. +1
    -1
      timeline/src/Project.C
  14. +1
    -1
      timeline/src/Track.C

+ 1
- 1
FL/Fl_Flip_Button.H View File

@@ -41,7 +41,7 @@ public:
Fl_Flip_Button ( int X, int Y, int W, int H, const char *L = 0 ) :
Fl_Button( X, Y, W, H, 0 )
{
sscanf( L, "%a[^/]/%as", &_off, &_on );
sscanf( L, "%m[^/]/%ms", &_off, &_on );

type( FL_TOGGLE_BUTTON );
}


+ 6
- 6
mixer/src/JACK_Module.C View File

@@ -220,7 +220,7 @@ get_connections_for_ports ( std::vector<Module::Port> ports )
char *strip_name = 0;
// char *client_name = 0;
if ( 2 == sscanf( *c, "Non-Mixer.%a[^:/]/%a[^:]:", &client_id, &strip_name ) )
if ( 2 == sscanf( *c, "Non-Mixer.%m[^:/]/%m[^:]:", &client_id, &strip_name ) )
{
free( client_id );
char *s = NULL;
@@ -228,7 +228,7 @@ get_connections_for_ports ( std::vector<Module::Port> ports )
free( strip_name );
strip_name = s;
}
else if ( 2 == sscanf( *c, "Non-Mixer.%a[^:(] (%a[^:)]):", &client_id, &strip_name ) )
else if ( 2 == sscanf( *c, "Non-Mixer.%m[^:(] (%m[^:)]):", &client_id, &strip_name ) )
{
free( client_id );
char *s = NULL;
@@ -236,7 +236,7 @@ get_connections_for_ports ( std::vector<Module::Port> ports )
free( strip_name );
strip_name = s;
}
else if ( 2 == sscanf( *c, "Non-Timeline.%a[^:/]:%a[^/]/", &client_id, &strip_name ) )
else if ( 2 == sscanf( *c, "Non-Timeline.%m[^:/]:%m[^/]/", &client_id, &strip_name ) )
{
free( client_id );
char *s = NULL;
@@ -244,7 +244,7 @@ get_connections_for_ports ( std::vector<Module::Port> ports )
free( strip_name );
strip_name = s;
}
else if ( 2 == sscanf( *c, "Non-DAW.%a[^:/]:%a[^/]/", &client_id, &strip_name ) )
else if ( 2 == sscanf( *c, "Non-DAW.%m[^:/]:%m[^/]/", &client_id, &strip_name ) )
{
free( client_id );
char *s = NULL;
@@ -252,7 +252,7 @@ get_connections_for_ports ( std::vector<Module::Port> ports )
free( strip_name );
strip_name = s;
}
else if ( 1 == sscanf( *c, "%a[^:]:", &strip_name ) )
else if ( 1 == sscanf( *c, "%m[^:]:", &strip_name ) )
{
char *s = NULL;
asprintf( &s, "@C3%s%s", is_output ? "@r" : "", strip_name );
@@ -663,7 +663,7 @@ JACK_Module::handle ( int m )

char *port_name;
int end;
while ( sscanf( text, "jack.port://%a[^\r\n]\r\n%n", &port_name, &end ) > 0 )
while ( sscanf( text, "jack.port://%m[^\r\n]\r\n%n", &port_name, &end ) > 0 )
{
DMESSAGE( "Scanning %s", port_name );
port_names.push_back( port_name );


+ 3
- 3
mixer/src/Mixer.C View File

@@ -609,7 +609,7 @@ Mixer::osc_strip_by_number ( const char *path, const char *types, lo_arg **argv,

OSC::Endpoint *ep = (OSC::Endpoint*)user_data;
if ( 3 != sscanf( path, "%a[^/]/strip#/%d/%a[^\n]", &client_name, &n, &rem ) )
if ( 3 != sscanf( path, "%m[^/]/strip#/%d/%m[^\n]", &client_name, &n, &rem ) )
return -1;

Mixer_Strip *o = mixer->track_by_number( n );
@@ -647,7 +647,7 @@ Mixer::load_translations ( void )
char *to;
char *from;

while ( 2 == fscanf( fp, "%a[^|> ] |> %a[^ \n]\n", &from, &to ) )
while ( 2 == fscanf( fp, "%m[^|> ] |> %m[^ \n]\n", &from, &to ) )
{
osc_endpoint->add_translation( from, to );
free(from);
@@ -1087,7 +1087,7 @@ Mixer::handle ( int m )

char *file;
if ( ! sscanf( text, "file://%a[^\r\n]\n", &file ) )
if ( ! sscanf( text, "file://%m[^\r\n]\n", &file ) )
{
WARNING( "invalid drop \"%s\"\n", text );
return 0;


+ 1
- 1
mixer/src/Module.C View File

@@ -301,7 +301,7 @@ Module::Port::osc_number_path ( void )
char *client_name;
char *strip_name;

if ( 3 != sscanf( _scaled_signal->path(), "%a[^/]/strip/%a[^/]/%a[^\n]", &client_name, &strip_name, &rem ) )
if ( 3 != sscanf( _scaled_signal->path(), "%m[^/]/strip/%m[^/]/%m[^\n]", &client_name, &strip_name, &rem ) )
return NULL;

free( strip_name );


+ 1
- 1
mixer/src/Plugin_Chooser.C View File

@@ -285,7 +285,7 @@ Plugin_Chooser::load_favorites ( void )
char *type;
int favorites = 0;

while ( 2 == fscanf( fp, "%a[^:]:%lu\n", &type, &id ) )
while ( 2 == fscanf( fp, "%m[^:]:%lu\n", &type, &id ) )
{
for ( std::list<Plugin_Module::Plugin_Info>::iterator i = _plugins.begin();
i != _plugins.end();


+ 1
- 1
mixer/src/Project.C View File

@@ -141,7 +141,7 @@ Project::read_info ( int *version, char **creation_date, char **created_by )

char *name, *value;

while ( fscanf( fp, "%a[^\n]\n\t%a[^\n]\n", &name, &value ) == 2 )
while ( fscanf( fp, "%m[^\n]\n\t%m[^\n]\n", &name, &value ) == 2 )
{
MESSAGE( "Info: %s = %s", name, value );



+ 2
- 2
mixer/src/midi-mapper.C View File

@@ -313,7 +313,7 @@ public:
char *opcode;
int control;

if ( 3 == sscanf( s, "%as %d %d", &opcode, &channel, &control ) )
if ( 3 == sscanf( s, "%ms %d %d", &opcode, &channel, &control ) )
{
event.channel( channel );
event.opcode( MIDI::midievent::CONTROL_CHANGE );
@@ -451,7 +451,7 @@ load_settings ( void )
char *signal_name;
char *midi_event;

while ( 2 == fscanf( fp, "[%a[^]]] %a[^\n]\n", &midi_event, &signal_name ) )
while ( 2 == fscanf( fp, "[%m[^]]] %m[^\n]\n", &midi_event, &signal_name ) )
{
DMESSAGE( "%s, %s", midi_event, signal_name );



+ 5
- 5
nonlib/Loggable.C View File

@@ -179,7 +179,7 @@ Loggable::load_unjournaled_state ( void )
unsigned int id;
char *buf;

while ( fscanf( fp, "%X set %a[^\n]\n", &id, &buf ) == 2 )
while ( fscanf( fp, "%X set %m[^\n]\n", &id, &buf ) == 2 )
{
_loggables[ id ].unjournaled_state = new Log_Entry( buf );
free(buf);
@@ -224,7 +224,7 @@ Loggable::replay ( FILE *fp )
if ( _progress_callback )
_progress_callback( 0, _progress_callback_arg );

while ( fscanf( fp, "%a[^\n]\n", &buf ) == 1 )
while ( fscanf( fp, "%m[^\n]\n", &buf ) == 1 )
{
if ( ! ( ! strcmp( buf, "{" ) || ! strcmp( buf, "}" ) ) )
{
@@ -408,8 +408,8 @@ Loggable::do_this ( const char *s, bool reverse )

if ( reverse )
{
// sscanf( s, "%s %*X %s %*[^\n<]<< %a[^\n]", classname, command, &arguments );
sscanf( s, "%s %*X %s%*[^\n<]<< %a[^\n]", classname, command, &arguments );
// sscanf( s, "%s %*X %s %*[^\n<]<< %m[^\n]", classname, command, &arguments );
sscanf( s, "%s %*X %s%*[^\n<]<< %m[^\n]", classname, command, &arguments );
create = "destroy";
destroy = "create";

@@ -417,7 +417,7 @@ Loggable::do_this ( const char *s, bool reverse )
}
else
{
sscanf( s, "%s %*X %s %a[^\n<]", classname, command, &arguments );
sscanf( s, "%s %*X %s %m[^\n<]", classname, command, &arguments );
create = "create";
destroy = "destroy";
}


+ 2
- 2
sequencer/src/smf.C View File

@@ -744,7 +744,7 @@ smf::read_phrase_info ( phrase *p )

char *s;

if ( 1 != sscanf( data, "Non: xywh=%a[0-9:]",
if ( 1 != sscanf( data, "Non: xywh=%m[0-9:]",
&s ) )
WARNING( "Invalid phrase info event" );
else
@@ -863,7 +863,7 @@ smf::read_pattern_info ( pattern *p )
int ppqn, key, note, mode;
char *s;

if ( 5 != sscanf( data, "Non: xywh=%a[0-9:], ppqn=%d, key=%d, note=%d, mode=%d",
if ( 5 != sscanf( data, "Non: xywh=%m[0-9:], ppqn=%d, key=%d, note=%d, mode=%d",
&s, &ppqn, &key, &note, &mode ) )
WARNING( "Invalid pattern info event" );
else


+ 1
- 1
session-manager/src/jackpatch.c View File

@@ -152,7 +152,7 @@ process_patch ( const char *patch )

int retval;

retval = sscanf( patch, " %a[^:]:%a[^|] |%1[<>|] %a[^:]:%a[^\n]",
retval = sscanf( patch, " %m[^:]:%m[^|] |%1[<>|] %m[^:]:%m[^\n]",
&leftc, &leftp, dir, &rightc, &rightp );

if ( retval == EOF )


+ 1
- 1
session-manager/src/nsm-proxy.C View File

@@ -254,7 +254,7 @@ public:

MESSAGE( "Loading file config \"%s\"", path );

while ( 2 == fscanf( fp, "%a[^\n]\n\t%a[^\n]\n", &name, &value ) )
while ( 2 == fscanf( fp, "%m[^\n]\n\t%m[^\n]\n", &name, &value ) )
{

DMESSAGE( "%s=%s", name, value );


+ 1
- 1
session-manager/src/nsmd.C View File

@@ -1222,7 +1222,7 @@ load_session_file ( const char * path )
char * client_id = NULL;
// load the client list
while ( fscanf( fp, "%a[^:]:%a[^:]:%a[^:\n]\n", &client_name, &client_executable, &client_id ) > 0 )
while ( fscanf( fp, "%m[^:]:%m[^:]:%m[^:\n]\n", &client_name, &client_executable, &client_id ) > 0 )
{
Client *c = new Client();


+ 1
- 1
timeline/src/Project.C View File

@@ -152,7 +152,7 @@ Project::read_info ( int *version, nframes_t *sample_rate, char **creation_date,

char *name, *value;

while ( fscanf( fp, "%a[^\n]\n\t%a[^\n]\n", &name, &value ) == 2 )
while ( fscanf( fp, "%m[^\n]\n\t%m[^\n]\n", &name, &value ) == 2 )
{
MESSAGE( "Info: %s = %s", name, value );



+ 1
- 1
timeline/src/Track.C View File

@@ -1194,7 +1194,7 @@ Track::handle ( int m )

char *port_name;
int end;
while ( sscanf( text, "jack.port://%a[^\r\n]\r\n%n", &port_name, &end ) > 0 )
while ( sscanf( text, "jack.port://%m[^\r\n]\r\n%n", &port_name, &end ) > 0 )
{
DMESSAGE( "Scanning %s", port_name );
port_names.push_back( port_name );


Loading…
Cancel
Save