summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2001-11-20 19:13:28 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2001-11-20 19:13:28 +0000
commit043ab1c4c9f57870d29efe95620b273a3a2b7798 (patch)
tree107fc5d1501bc8645d19685cf59f2d1093f72a05
parent48bc964e952c205f5c759ccaf93b063ec9ec813a (diff)
downloadxine-lib-043ab1c4c9f57870d29efe95620b273a3a2b7798.tar.gz
xine-lib-043ab1c4c9f57870d29efe95620b273a3a2b7798.tar.bz2
add more checks against incorrect configfile usage
CVS patchset: 1094 CVS date: 2001/11/20 19:13:28
-rw-r--r--src/xine-engine/configfile.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c
index 696a8c226..86c775147 100644
--- a/src/xine-engine/configfile.c
+++ b/src/xine-engine/configfile.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: configfile.c,v 1.10 2001/11/20 17:22:14 miguelfreitas Exp $
+ * $Id: configfile.c,v 1.11 2001/11/20 19:13:28 guenter Exp $
*
* config file management - implementation
*
@@ -381,6 +381,13 @@ static void config_file_update_num (config_values_t *this,
}
+ if ((entry->type == CONFIG_TYPE_UNKNOWN)
+ || (entry->type == CONFIG_TYPE_STRING)) {
+ printf ("configfile: error - tried to update non-num type %d (key %s, value %d)\n",
+ entry->type, entry->key, value);
+ return;
+ }
+
entry->num_value = value;
if (entry->callback)
@@ -396,14 +403,18 @@ static void config_file_update_string (config_values_t *this,
if (!entry) {
-#ifdef CONFIG_LOG
- printf ("configfile: WARNING! tried to update unknown key %s (to %s)\n",
+ printf ("configfile: error - tried to update unknown key %s (to %s)\n",
key, value);
-#endif
return;
}
+ if (entry->type != CONFIG_TYPE_STRING) {
+ printf ("configfile: error - tried to update non-string type %d (key %s, value %s)\n",
+ entry->type, entry->key, value);
+ return;
+ }
+
entry->str_value = copy_string (value);
if (entry->callback)
@@ -561,6 +572,9 @@ config_values_t *config_file_init (char *filename) {
/*
* $Log: configfile.c,v $
+ * Revision 1.11 2001/11/20 19:13:28 guenter
+ * add more checks against incorrect configfile usage
+ *
* Revision 1.10 2001/11/20 17:22:14 miguelfreitas
* testing some configfile stuff...
*