changeset 977:d3354ad8aa7b

small fix
author szabii
date Sun, 03 Jun 2001 23:24:31 +0000
parents 90408bd383a5
children 219e0a7feeaa
files libvo/vo_fbdev.c
diffstat 1 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_fbdev.c	Sun Jun 03 23:10:37 2001 +0000
+++ b/libvo/vo_fbdev.c	Sun Jun 03 23:24:31 2001 +0000
@@ -140,8 +140,17 @@
 
 static int parse_fbmode_cfg(char *cfgfile)
 {
+#define CHECK_IN_MODE_DEF\
+	do {\
+	if (!in_mode_def) {\
+		printf("'needs 'mode' first");\
+		goto err_out_print_linenum;\
+	}\
+	} while (0)
+
 	fb_mode_t *mode = NULL;
 	char *endptr;	// strtoul()...
+	int in_mode_def = 0;
 	int tmp, i;
 
 	if (verbose > 0)
@@ -172,6 +181,10 @@
 		if (tmp == RET_EOL)
 			continue;
 		if (!strcmp(token[0], "mode")) {
+			if (in_mode_def) {
+				printf("'endmode' required");
+				goto err_out_print_linenum;
+			}
 			if (!validate_mode(mode))
 				goto err_out_not_valid;
 		loop_enter:
@@ -197,7 +210,9 @@
 				printf("can't strdup -> 'name': %s\n", strerror(errno));
 				goto err_out;
 			}
+			in_mode_def = 1;
 		} else if (!strcmp(token[0], "geometry")) {
+			CHECK_IN_MODE_DEF;
 			if (get_token(5) < 0)
 				goto err_out_parse_error;
 			mode->xres = strtoul(token[0], &endptr, 0);
@@ -216,6 +231,7 @@
 			if (*endptr)
 				goto err_out_parse_error;
 		} else if (!strcmp(token[0], "timings")) {
+			CHECK_IN_MODE_DEF;
 			if (get_token(7) < 0)
 				goto err_out_parse_error;
 			mode->pixclock = strtoul(token[0], &endptr, 0);
@@ -240,8 +256,10 @@
 			if (*endptr)
 				goto err_out_parse_error;
 		} else if (!strcmp(token[0], "endmode")) {
-			/* FIXME NOTHING for now*/
+			CHECK_IN_MODE_DEF;
+			in_mode_def = 0;
 		} else if (!strcmp(token[0], "accel")) {
+			CHECK_IN_MODE_DEF;
 			if (get_token(1) < 0)
 				goto err_out_parse_error;
 			/*
@@ -249,6 +267,7 @@
 			 * so we just ignore it.
 			 */
 		} else if (!strcmp(token[0], "hsync")) {
+			CHECK_IN_MODE_DEF;
 			if (get_token(1) < 0)
 				goto err_out_parse_error;
 			if (!strcmp(token[0], "low"))
@@ -258,6 +277,7 @@
 			else
 				goto err_out_parse_error;
 		} else if (!strcmp(token[0], "vsync")) {
+			CHECK_IN_MODE_DEF;
 			if (get_token(1) < 0)
 				goto err_out_parse_error;
 			if (!strcmp(token[0], "low"))
@@ -267,6 +287,7 @@
 			else
 				goto err_out_parse_error;
 		} else if (!strcmp(token[0], "csync")) {
+			CHECK_IN_MODE_DEF;
 			if (get_token(1) < 0)
 				goto err_out_parse_error;
 			if (!strcmp(token[0], "low"))
@@ -276,6 +297,7 @@
 			else
 				goto err_out_parse_error;
 		} else if (!strcmp(token[0], "extsync")) {
+			CHECK_IN_MODE_DEF;
 			if (get_token(1) < 0)
 				goto err_out_parse_error;
 			if (!strcmp(token[0], "false"))
@@ -285,6 +307,7 @@
 			else
 				goto err_out_parse_error;
 		} else if (!strcmp(token[0], "laced")) {
+			CHECK_IN_MODE_DEF;
 			if (get_token(1) < 0)
 				goto err_out_parse_error;
 			if (!strcmp(token[0], "false"))
@@ -294,6 +317,7 @@
 			else
 				goto err_out_parse_error;
 		} else if (!strcmp(token[0], "double")) {
+			CHECK_IN_MODE_DEF;
 			if (get_token(1) < 0)
 				goto err_out_parse_error;
 			if (!strcmp(token[0], "false"))