summaryrefslogtreecommitdiff
path: root/recordmydesktop/src/rmd_parseargs.c
diff options
context:
space:
mode:
authorenselic <enselic@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2009-01-10 11:57:10 +0000
committerenselic <enselic@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2009-01-10 11:57:10 +0000
commit74dae024903ee922c4863b44b9860f99a8bbfdab (patch)
treeac1ac42784ccbd8d72424abd11e12db366026b05 /recordmydesktop/src/rmd_parseargs.c
parentfc7f2f1b2aa271bed2fa9130e4a0c9b4a4034cbb (diff)
src/rmd_types.h: Make ProgArgs::jack_port_names a fixed size
100-element array. src/rmd_initialize_data.c: Reset ProgArgs::jack_port_names using memset(). src/rmd_parseargs.c: With ProgArgs::jack_port_names as a fixed size array we can read the --use-jack options in a single pass which makes the code more libpopt migration friendly. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@588 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop/src/rmd_parseargs.c')
-rw-r--r--recordmydesktop/src/rmd_parseargs.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/recordmydesktop/src/rmd_parseargs.c b/recordmydesktop/src/rmd_parseargs.c
index f0b3dcc..cb039a1 100644
--- a/recordmydesktop/src/rmd_parseargs.c
+++ b/recordmydesktop/src/rmd_parseargs.c
@@ -478,23 +478,20 @@ boolean ParseArgs(int argc, char **argv, ProgArgs *arg_return) {
#ifdef HAVE_LIBJACK
int k=i+1;
arg_return->jack_nports=0;
- while((k<argc)&&(argv[k][0]!='-')){
+ while((k<argc)&&(argv[k][0]!='-')&&k-i-1<RMD_MAX_JACK_PORTS){
arg_return->jack_nports++;
- k++;
- }
- if(arg_return->jack_nports>0){
- arg_return->jack_port_names=malloc(sizeof(char*)*
- arg_return->jack_nports);
- for(k=i+1;k<i+1+arg_return->jack_nports;k++){
- arg_return->jack_port_names[k-i-1]=
- malloc(strlen(argv[k])+1);
- strcpy(arg_return->jack_port_names[k-i-1],
- argv[k]);
- }
- i+=arg_return->jack_nports;
+
+ arg_return->jack_port_names[k-i-1]=malloc(strlen(argv[k])+1);
+ strcpy(arg_return->jack_port_names[k-i-1],argv[k]);
+
arg_return->use_jack=1;
+
+ k++;
}
- else{
+
+ i+=arg_return->jack_nports;
+
+ if (arg_return->jack_nports==0) {
fprintf(stderr,"Argument Usage: --use-jack port1"
" port2... portn\n");
return FALSE;
© All Rights Reserved