From 5d31d763d060f6851b5274fa8679370ad0dbfc9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Mon, 26 Nov 2012 14:41:47 +0000 Subject: use common_parsedriver() rather than sscanf() svn path=/trunk/externals/iem/mediasettings/; revision=16593 --- midisettings.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/midisettings.c b/midisettings.c index 37566d9..369e91b 100644 --- a/midisettings.c +++ b/midisettings.c @@ -1,9 +1,9 @@ /****************************************************** * * midisettings - get/set midi preferences from within Pd-patches - * Copyright (C) 2010 IOhannes m zmölnig + * Copyright (C) 2010-2012 IOhannes m zmölnig * - * forum::für::umläute + * forum::für::umläute * * institute of electronic music and acoustics (iem) * university of music and dramatic arts, graz (kug) @@ -14,13 +14,7 @@ * license: GNU General Public License v.3 or later * ******************************************************/ -#include "m_pd.h" -#include "s_stuff.h" -#include -#include - -#define MAXNDEV 20 -#define DEVDESCSIZE 80 +#include "mediasettings.h" #ifndef MAXMIDIINDEV # define MAXMIDIINDEV 4 @@ -35,8 +29,6 @@ # define MAXMIDIDEV MAXMIDIOUTDEV #endif - - extern int sys_midiapi; static t_class *midisettings_class; @@ -168,8 +160,10 @@ t_ms_symkeys*ms_driverparse(t_ms_symkeys*drivers, const char*buf) { int length=stop-start; if(length>=MAXPDSTRING)length=MAXPDSTRING-1; snprintf(substring, length, "%s", buf+start+1); - - if(2==sscanf(substring, "%s %d", drivername, &driverid)) { + + if(common_parsedriver(substring, length, + drivername, MAXPDSTRING, + &driverid)) { drivers=ms_symkeys_add(drivers, gensym(drivername), driverid, 0); } else { if((start+1)!=(stop)) /* empty APIs string */ -- cgit v1.2.1