Replace deprecated scanf %a modifier with %m.

This commit is contained in:
Jonathan Moore Liles 2017-03-27 23:16:09 -07:00
parent e7f4a1c4b9
commit 1daf0f6150
14 changed files with 27 additions and 27 deletions

View File

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

View File

@ -220,7 +220,7 @@ get_connections_for_ports ( std::vector<Module::Port> ports )
char *strip_name = 0; char *strip_name = 0;
// char *client_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 ); free( client_id );
char *s = NULL; char *s = NULL;
@ -228,7 +228,7 @@ get_connections_for_ports ( std::vector<Module::Port> ports )
free( strip_name ); free( strip_name );
strip_name = s; 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 ); free( client_id );
char *s = NULL; char *s = NULL;
@ -236,7 +236,7 @@ get_connections_for_ports ( std::vector<Module::Port> ports )
free( strip_name ); free( strip_name );
strip_name = s; 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 ); free( client_id );
char *s = NULL; char *s = NULL;
@ -244,7 +244,7 @@ get_connections_for_ports ( std::vector<Module::Port> ports )
free( strip_name ); free( strip_name );
strip_name = s; 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 ); free( client_id );
char *s = NULL; char *s = NULL;
@ -252,7 +252,7 @@ get_connections_for_ports ( std::vector<Module::Port> ports )
free( strip_name ); free( strip_name );
strip_name = s; strip_name = s;
} }
else if ( 1 == sscanf( *c, "%a[^:]:", &strip_name ) ) else if ( 1 == sscanf( *c, "%m[^:]:", &strip_name ) )
{ {
char *s = NULL; char *s = NULL;
asprintf( &s, "@C3%s%s", is_output ? "@r" : "", strip_name ); asprintf( &s, "@C3%s%s", is_output ? "@r" : "", strip_name );
@ -663,7 +663,7 @@ JACK_Module::handle ( int m )
char *port_name; char *port_name;
int end; 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 ); DMESSAGE( "Scanning %s", port_name );
port_names.push_back( port_name ); port_names.push_back( port_name );

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; 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; return -1;
Mixer_Strip *o = mixer->track_by_number( n ); Mixer_Strip *o = mixer->track_by_number( n );
@ -647,7 +647,7 @@ Mixer::load_translations ( void )
char *to; char *to;
char *from; 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 ); osc_endpoint->add_translation( from, to );
free(from); free(from);
@ -1087,7 +1087,7 @@ Mixer::handle ( int m )
char *file; 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 ); WARNING( "invalid drop \"%s\"\n", text );
return 0; return 0;

View File

@ -301,7 +301,7 @@ Module::Port::osc_number_path ( void )
char *client_name; char *client_name;
char *strip_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; return NULL;
free( strip_name ); free( strip_name );

View File

@ -285,7 +285,7 @@ Plugin_Chooser::load_favorites ( void )
char *type; char *type;
int favorites = 0; 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(); for ( std::list<Plugin_Module::Plugin_Info>::iterator i = _plugins.begin();
i != _plugins.end(); i != _plugins.end();

View File

@ -141,7 +141,7 @@ Project::read_info ( int *version, char **creation_date, char **created_by )
char *name, *value; 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 ); MESSAGE( "Info: %s = %s", name, value );

View File

@ -313,7 +313,7 @@ public:
char *opcode; char *opcode;
int control; 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.channel( channel );
event.opcode( MIDI::midievent::CONTROL_CHANGE ); event.opcode( MIDI::midievent::CONTROL_CHANGE );
@ -451,7 +451,7 @@ load_settings ( void )
char *signal_name; char *signal_name;
char *midi_event; 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 ); DMESSAGE( "%s, %s", midi_event, signal_name );

View File

@ -179,7 +179,7 @@ Loggable::load_unjournaled_state ( void )
unsigned int id; unsigned int id;
char *buf; 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 ); _loggables[ id ].unjournaled_state = new Log_Entry( buf );
free(buf); free(buf);
@ -224,7 +224,7 @@ Loggable::replay ( FILE *fp )
if ( _progress_callback ) if ( _progress_callback )
_progress_callback( 0, _progress_callback_arg ); _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, "}" ) ) ) if ( ! ( ! strcmp( buf, "{" ) || ! strcmp( buf, "}" ) ) )
{ {
@ -408,8 +408,8 @@ Loggable::do_this ( const char *s, bool reverse )
if ( reverse ) if ( reverse )
{ {
// 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<]<< %a[^\n]", classname, command, &arguments ); sscanf( s, "%s %*X %s%*[^\n<]<< %m[^\n]", classname, command, &arguments );
create = "destroy"; create = "destroy";
destroy = "create"; destroy = "create";
@ -417,7 +417,7 @@ Loggable::do_this ( const char *s, bool reverse )
} }
else else
{ {
sscanf( s, "%s %*X %s %a[^\n<]", classname, command, &arguments ); sscanf( s, "%s %*X %s %m[^\n<]", classname, command, &arguments );
create = "create"; create = "create";
destroy = "destroy"; destroy = "destroy";
} }

View File

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

View File

@ -152,7 +152,7 @@ process_patch ( const char *patch )
int retval; 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 ); &leftc, &leftp, dir, &rightc, &rightp );
if ( retval == EOF ) if ( retval == EOF )

View File

@ -254,7 +254,7 @@ public:
MESSAGE( "Loading file config \"%s\"", path ); 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 ); DMESSAGE( "%s=%s", name, value );

View File

@ -1222,7 +1222,7 @@ load_session_file ( const char * path )
char * client_id = NULL; char * client_id = NULL;
// load the client list // 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(); Client *c = new Client();

View File

@ -152,7 +152,7 @@ Project::read_info ( int *version, nframes_t *sample_rate, char **creation_date,
char *name, *value; 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 ); MESSAGE( "Info: %s = %s", name, value );

View File

@ -1194,7 +1194,7 @@ Track::handle ( int m )
char *port_name; char *port_name;
int end; 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 ); DMESSAGE( "Scanning %s", port_name );
port_names.push_back( port_name ); port_names.push_back( port_name );