[Mplayer-cvslog] CVS: main cfgparser.c,1.13,1.14

Szabolcs Berecz szabii at users.sourceforge.net
Thu Mar 22 19:52:47 CET 2001


Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv2819

Modified Files:
	cfgparser.c 
Log Message:
strto* int/float reader

Index: cfgparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/cfgparser.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** cfgparser.c	2001/03/22 15:25:28	1.13
--- cfgparser.c	2001/03/22 18:52:45	1.14
***************
*** 57,63 ****
  {
  	int i;
! 	int tmp_int;
! 	float tmp_float;
  	int ret = -1;
  
  	for (i = 0; i < nr_options; i++) {
--- 57,64 ----
  {
  	int i;
! 	long tmp_int;
! 	double tmp_float;
  	int ret = -1;
+ 	char *endptr;
  
  	for (i = 0; i < nr_options; i++) {
***************
*** 114,118 ****
  			if (param == NULL)
  				goto err_missing_param;
! 			if (!isdigit(*param)) {
  				printf("parameter must be an integer:\n");
  				ret = ERR_OUT_OF_RANGE;
--- 115,121 ----
  			if (param == NULL)
  				goto err_missing_param;
! 
! 			tmp_int = strtol(param, &endptr, 0);
! 			if (*endptr) {
  				printf("parameter must be an integer:\n");
  				ret = ERR_OUT_OF_RANGE;
***************
*** 120,125 ****
  			}
  
- 			tmp_int = atoi(param);
- 
  			if (config[i].flags & CONF_MIN)
  				if (tmp_int < config[i].min) {
--- 123,126 ----
***************
*** 142,152 ****
  			if (param == NULL)
  				goto err_missing_param;
! 			if (!isdigit(*param) && *param != '-' && *param != '.') {
  				printf("parameter must be a floating point number:\n");
  				ret = ERR_MISSING_PARAM;
  				goto out;
  			}
- 
- 			tmp_float = atof(param);
  
  			if (config[i].flags & CONF_MIN)
--- 143,153 ----
  			if (param == NULL)
  				goto err_missing_param;
! 
! 			tmp_float = strtod(param, &endptr);
! 			if (*endptr) {
  				printf("parameter must be a floating point number:\n");
  				ret = ERR_MISSING_PARAM;
  				goto out;
  			}
  
  			if (config[i].flags & CONF_MIN)


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list