[Mplayer-cvslog] CVS: main cfg-common.h,1.52,1.53 cfgparser.c,1.51,1.52 cfgparser.h,1.14,1.15

Alex Beregszaszi alex at mplayerhq.hu
Wed Aug 28 18:55:43 CEST 2002


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

Modified Files:
	cfg-common.h cfgparser.c cfgparser.h 
Log Message:
64-bit -sb offsets patch by Andy Goth <unununium at openverse.com>

Index: cfg-common.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-common.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- cfg-common.h	21 Aug 2002 21:31:17 -0000	1.52
+++ cfg-common.h	28 Aug 2002 16:55:40 -0000	1.53
@@ -54,7 +54,7 @@
 	{"frames", &play_n_frames_mf, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
 
 	// seek to byte/seconds position
-	{"sb", &seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
+	{"sb", &seek_to_byte, CONF_TYPE_POSITION, CONF_MIN, 0, 0, NULL},
 	{"ss", &seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0, NULL},
 
 	// AVI specific: force non-interleaved mode

Index: cfgparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/cfgparser.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- cfgparser.c	2 May 2002 10:43:27 -0000	1.51
+++ cfgparser.c	28 Aug 2002 16:55:40 -0000	1.52
@@ -112,6 +112,9 @@
   case CONF_TYPE_STRING_LIST :
     save[sl].param.as_pointer = *((char***)conf->p);
     break;
+  case CONF_TYPE_POSITION :
+    save[sl].param.as_off_t = *((off_t*)conf->p);
+    break;
   default :
     mp_msg(MSGT_CFGPARSER,MSGL_ERR,"Should never append in m_config_save_option : conf->type=%d\n",conf->type);
   }
@@ -196,6 +199,9 @@
       break;
     }
     break;
+  case CONF_TYPE_POSITION :
+    *((off_t*)save->opt->p) = save->param.as_off_t;
+    break;
   default :
     mp_msg(MSGT_CFGPARSER,MSGL_WARN,"Why do we reverse this : name=%s type=%d ?\n",save->opt->name,save->opt->type);
   }
@@ -425,7 +431,9 @@
 {
 	int i=0,nconf = 0;
 	long tmp_int;
+	off_t tmp_off;
 	double tmp_float;
+	int dummy;
 	int ret = -1;
 	char *endptr;
 	config_t* conf=NULL;
@@ -731,6 +739,42 @@
 		case CONF_TYPE_PRINT:
 			mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s", (char *) conf[i].p);
 			exit(1);
+		case CONF_TYPE_POSITION:
+			if (param == NULL)
+				goto err_missing_param;
+
+			if (sscanf(param, sizeof(off_t) == sizeof(int) ?
+			"%d%c" : "%lld%c", &tmp_off, dummy) != 1) {
+				mp_msg(MSGT_CFGPARSER, MSGL_ERR, "parameter must be an integer: %s\n", param);
+				ret = ERR_OUT_OF_RANGE;
+				goto out;
+			}
+
+			if (conf[i].flags & CONF_MIN)
+				if (tmp_off < conf[i].min) {
+					mp_msg(MSGT_CFGPARSER, MSGL_ERR,
+					(sizeof(off_t) == sizeof(int) ?
+					"parameter must be >= %d: %s\n" :
+					"parameter must be >= %lld: %s\n"),
+					(off_t) conf[i].min, param);
+					ret = ERR_OUT_OF_RANGE;
+					goto out;
+				}
+
+			if (conf[i].flags & CONF_MAX)
+				if (tmp_off > conf[i].max) {
+					mp_msg(MSGT_CFGPARSER, MSGL_ERR,
+					(sizeof(off_t) == sizeof(int) ?
+					"parameter must be <= %d: %s\n" :
+					"parameter must be <= %lld: %s\n"),
+					(off_t) conf[i].max, param);
+					ret = ERR_OUT_OF_RANGE;
+					goto out;
+				}
+
+			*((off_t *) conf[i].p) = tmp_off;
+			ret = 1;
+			break;
 		default:
 			mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Unknown config type specified in conf-mplayer.h!\n");
 			break;

Index: cfgparser.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfgparser.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- cfgparser.h	20 Mar 2002 09:45:39 -0000	1.14
+++ cfgparser.h	28 Aug 2002 16:55:40 -0000	1.15
@@ -15,6 +15,7 @@
 #define CONF_TYPE_FUNC_FULL	7
 #define CONF_TYPE_SUBCONFIG	8
 #define CONF_TYPE_STRING_LIST           9
+#define CONF_TYPE_POSITION	10
 
 
 #define ERR_NOT_AN_OPTION	-1
@@ -73,6 +74,7 @@
     int as_int;
     float as_float;
     void* as_pointer;
+    off_t* as_off_t;
   } param;
   char* opt_name;
 };




More information about the MPlayer-cvslog mailing list