[Mplayer-cvslog] CVS: main cfgparser.c,1.55,1.56

Arpi of Ize arpi at mplayerhq.hu
Thu Sep 26 02:28:35 CEST 2002


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv3951

Modified Files:
	cfgparser.c 
Log Message:
accept empty strings too for STRING_LIST (example: "-xyz 1,2.5,,4," )


Index: cfgparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/cfgparser.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- cfgparser.c	22 Sep 2002 02:33:21 -0000	1.55
+++ cfgparser.c	26 Sep 2002 00:28:32 -0000	1.56
@@ -612,7 +612,7 @@
 			    last_ptr = ptr;
 			    ptr = strchr(ptr,LIST_SEPARATOR);
 			    if(!ptr) {
-			      if(strlen(last_ptr) > 0)
+//			      if(strlen(last_ptr) > 0)
 				n++;
 			      break;
 			    }
@@ -630,11 +630,13 @@
 			  res = malloc((n+1)*sizeof(char*));
 			  ptr = param;
 			  n = 0;
-			  while(ptr[0] != '\0') {
+//			  while(ptr[0] != '\0') {
+			  while(1) {
 			    last_ptr = ptr;
 			    ptr = strchr(ptr,LIST_SEPARATOR);
 			     if(!ptr) {
-			       if(strlen(last_ptr) > 0) {
+			       //if(strlen(last_ptr) > 0) 
+			       {
 				 res[n] = strdup(last_ptr);
 				 n++;
 			       }
@@ -642,7 +644,7 @@
 			     }
 			     len = ptr - last_ptr;
 			     res[n] = (char*)malloc(len + 1);
-			     strncpy(res[n],last_ptr,len);
+			     if(len) strncpy(res[n],last_ptr,len);
 			     res[n][len] = '\0';
 			     ptr++;
 			     n++;




More information about the MPlayer-cvslog mailing list