*****************************************************************************/
/* Configuration hint types */
-
-
#define CONFIG_HINT_CATEGORY 0x02 /* Start of new category */
#define CONFIG_HINT_SUBCATEGORY 0x03 /* Start of sub-category */
#define CONFIG_HINT_SUBCATEGORY_END 0x04 /* End of sub-category */
#define CONFIG_SECTION 0x08 /* Start of new section */
/* Configuration item types */
-#define CONFIG_ITEM_STRING 0x10 /* String option */
-/* unused 0x0020 */
-#define CONFIG_ITEM_MODULE 0x30 /* Module option */
+#define CONFIG_ITEM_FLOAT 0x20 /* Float option */
#define CONFIG_ITEM_INTEGER 0x40 /* Integer option */
-#define CONFIG_ITEM_BOOL 0x50 /* Bool option */
-#define CONFIG_ITEM_FLOAT 0x60 /* Float option */
-#define CONFIG_ITEM_DIRECTORY 0x70 /* Directory option */
-#define CONFIG_ITEM_KEY 0x80 /* Hot key option */
-#define CONFIG_ITEM_MODULE_CAT 0x90 /* Module option */
-#define CONFIG_ITEM_MODULE_LIST 0xA0 /* Module option */
-#define CONFIG_ITEM_MODULE_LIST_CAT 0xB0 /* Module option */
-#define CONFIG_ITEM_FONT 0xC0 /* Font option */
-#define CONFIG_ITEM_PASSWORD 0xD0 /* Password option (*) */
-#define CONFIG_ITEM_LOADFILE 0xE0 /* Read file option */
-#define CONFIG_ITEM_SAVEFILE 0xF0 /* Written file option */
-
-#define CONFIG_ITEM(x) (((x) & 0xF0) != 0)
+#define CONFIG_ITEM_BOOL 0x60 /* Bool option */
+#define CONFIG_ITEM_STRING 0x80 /* String option */
+#define CONFIG_ITEM_PASSWORD 0x81 /* Password option (*) */
+#define CONFIG_ITEM_KEY 0x82 /* Hot key option */
+#define CONFIG_ITEM_MODULE 0x84 /* Module option */
+#define CONFIG_ITEM_MODULE_CAT 0x85 /* Module option */
+#define CONFIG_ITEM_MODULE_LIST 0x86 /* Module option */
+#define CONFIG_ITEM_MODULE_LIST_CAT 0x87 /* Module option */
+#define CONFIG_ITEM_LOADFILE 0x8C /* Read file option */
+#define CONFIG_ITEM_SAVEFILE 0x8D /* Written file option */
+#define CONFIG_ITEM_DIRECTORY 0x8E /* Directory option */
+#define CONFIG_ITEM_FONT 0x8F /* Font option */
+
+#define CONFIG_ITEM(x) (((x) & ~0xF) != 0)
/*******************************************************************
* All predefined categories and subcategories
char *config_GetDataDirDefault( void );
-int IsConfigStringType( int type );
-int IsConfigIntegerType (int type);
-static inline int IsConfigFloatType (int type)
+static inline bool IsConfigStringType(unsigned type)
+{
+ return (type & CONFIG_ITEM_STRING) != 0;
+}
+
+static inline bool IsConfigIntegerType (int type)
+{
+ return (type & CONFIG_ITEM_INTEGER) != 0;
+}
+
+static inline bool IsConfigFloatType (int type)
{
return type == CONFIG_ITEM_FLOAT;
}
return src ? strdup (src) : NULL;
}
-/* Item types that use a string value (i.e. serialized in the module cache) */
-int IsConfigStringType (int type)
-{
- static const unsigned char config_types[] =
- {
- CONFIG_ITEM_STRING, CONFIG_ITEM_MODULE, CONFIG_ITEM_DIRECTORY,
- CONFIG_ITEM_KEY, CONFIG_ITEM_MODULE_CAT, CONFIG_ITEM_PASSWORD,
- CONFIG_ITEM_MODULE_LIST, CONFIG_ITEM_MODULE_LIST_CAT,
- CONFIG_ITEM_FONT, CONFIG_ITEM_LOADFILE, CONFIG_ITEM_SAVEFILE,
- };
-
- /* NOTE: this needs to be changed if we ever get more than 255 types */
- return memchr (config_types, type, sizeof (config_types)) != NULL;
-}
-
-
-int IsConfigIntegerType (int type)
-{
- static const unsigned char config_types[] =
- {
- CONFIG_ITEM_INTEGER, CONFIG_ITEM_BOOL,
- CONFIG_CATEGORY, CONFIG_SUBCATEGORY
- };
-
- return memchr (config_types, type, sizeof (config_types)) != NULL;
-}
-
#undef config_GetType
/*****************************************************************************
* config_GetType: get the type of a variable (bool, int, float, string)
return 0;
}
- switch( p_config->i_type )
+ switch( p_config->i_type & ~0x1F )
{
- case CONFIG_ITEM_BOOL:
- i_type = VLC_VAR_BOOL;
+ case CONFIG_ITEM_FLOAT:
+ i_type = VLC_VAR_FLOAT;
break;
case CONFIG_ITEM_INTEGER:
i_type = VLC_VAR_INTEGER;
break;
- case CONFIG_ITEM_FLOAT:
- i_type = VLC_VAR_FLOAT;
+ case CONFIG_ITEM_BOOL:
+ i_type = VLC_VAR_BOOL;
break;
- case CONFIG_ITEM_MODULE:
- case CONFIG_ITEM_MODULE_CAT:
- case CONFIG_ITEM_MODULE_LIST:
- case CONFIG_ITEM_MODULE_LIST_CAT:
case CONFIG_ITEM_STRING:
- case CONFIG_ITEM_PASSWORD:
- case CONFIG_ITEM_LOADFILE:
- case CONFIG_ITEM_SAVEFILE:
- case CONFIG_ITEM_DIRECTORY:
- case CONFIG_ITEM_KEY:
i_type = VLC_VAR_STRING;
break;