#include <vlc_common.h>
#include "vlc_keys.h"
-#include "vlc_charset.h"
#include "vlc_configuration.h"
#include <assert.h>
return memchr (config_types, type, sizeof (config_types)) != NULL;
}
-
+#undef config_GetType
/*****************************************************************************
* config_GetType: get the type of a variable (bool, int, float, string)
*****************************************************************************
* This function is used to get the type of a variable from its name.
* Beware, this is quite slow.
*****************************************************************************/
-int __config_GetType( vlc_object_t *p_this, const char *psz_name )
+int config_GetType( vlc_object_t *p_this, const char *psz_name )
{
module_config_t *p_config;
int i_type;
return i_type;
}
+#undef config_GetInt
/*****************************************************************************
* config_GetInt: get the value of an int variable
*****************************************************************************
* represented by an integer (CONFIG_ITEM_INTEGER and
* CONFIG_ITEM_BOOL).
*****************************************************************************/
-int __config_GetInt( vlc_object_t *p_this, const char *psz_name )
+int64_t config_GetInt( vlc_object_t *p_this, const char *psz_name )
{
module_config_t *p_config;
return -1;
}
- int val;
+ int64_t val;
vlc_rwlock_rdlock (&config_lock);
val = p_config->value.i;
return val;
}
+#undef config_GetFloat
/*****************************************************************************
* config_GetFloat: get the value of a float variable
*****************************************************************************
* This function is used to get the value of variables which are internally
* represented by a float (CONFIG_ITEM_FLOAT).
*****************************************************************************/
-float __config_GetFloat( vlc_object_t *p_this, const char *psz_name )
+float config_GetFloat( vlc_object_t *p_this, const char *psz_name )
{
module_config_t *p_config;
return val;
}
+#undef config_GetPsz
/*****************************************************************************
* config_GetPsz: get the string value of a string variable
*****************************************************************************
* duplicate of the actual value. It isn't safe to return a pointer to the
* actual value as it can be modified at any time.
*****************************************************************************/
-char * __config_GetPsz( vlc_object_t *p_this, const char *psz_name )
+char * config_GetPsz( vlc_object_t *p_this, const char *psz_name )
{
module_config_t *p_config;
return psz_value;
}
+#undef config_PutPsz
/*****************************************************************************
* config_PutPsz: set the string value of a string variable
*****************************************************************************
* represented by a string (CONFIG_ITEM_STRING, CONFIG_ITEM_FILE,
* CONFIG_ITEM_DIRECTORY, CONFIG_ITEM_PASSWORD, and CONFIG_ITEM_MODULE).
*****************************************************************************/
-void __config_PutPsz( vlc_object_t *p_this,
+void config_PutPsz( vlc_object_t *p_this,
const char *psz_name, const char *psz_value )
{
module_config_t *p_config;
- vlc_value_t oldval, val;
+ vlc_value_t oldval;
p_config = config_FindConfig( p_this, psz_name );
return;
}
- vlc_rwlock_wrlock (&config_lock);
+ char *str;
+ if ((psz_value != NULL) && *psz_value)
+ str = strdup (psz_value);
+ else
+ str = NULL;
+ vlc_rwlock_wrlock (&config_lock);
/* backup old value */
oldval.psz_string = (char *)p_config->value.psz;
- if ((psz_value != NULL) && *psz_value)
- p_config->value.psz = strdup (psz_value);
- else
- p_config->value.psz = NULL;
-
+ p_config->value.psz = str;
p_config->b_dirty = true;
-
- val.psz_string = (char *)p_config->value.psz;
-
vlc_rwlock_unlock (&config_lock);
if( p_config->pf_callback )
{
+ vlc_value_t val;
+
+ val.psz_string = (char *)psz_value;
p_config->pf_callback( p_this, psz_name, oldval, val,
p_config->p_callback_data );
}
free( oldval.psz_string );
}
+#undef config_PutInt
/*****************************************************************************
* config_PutInt: set the integer value of an int variable
*****************************************************************************
* represented by an integer (CONFIG_ITEM_INTEGER and
* CONFIG_ITEM_BOOL).
*****************************************************************************/
-void __config_PutInt( vlc_object_t *p_this, const char *psz_name, int i_value )
+void config_PutInt( vlc_object_t *p_this, const char *psz_name,
+ int64_t i_value )
{
module_config_t *p_config;
vlc_value_t oldval;
return;
}
- /* if i_min == i_max == 0, then do not use them */
- if ((p_config->min.i == 0) && (p_config->max.i == 0))
- ;
- else if (i_value < p_config->min.i)
+ if (i_value < p_config->min.i)
i_value = p_config->min.i;
- else if (i_value > p_config->max.i)
+ if (i_value > p_config->max.i)
i_value = p_config->max.i;
vlc_rwlock_wrlock (&config_lock);
}
}
+#undef config_PutFloat
/*****************************************************************************
* config_PutFloat: set the value of a float variable
*****************************************************************************
* This function is used to set the value of variables which are internally
* represented by a float (CONFIG_ITEM_FLOAT).
*****************************************************************************/
-void __config_PutFloat( vlc_object_t *p_this,
- const char *psz_name, float f_value )
+void config_PutFloat( vlc_object_t *p_this,
+ const char *psz_name, float f_value )
{
module_config_t *p_config;
vlc_value_t oldval;
p_module->p_config = NULL;
}
+#undef config_ResetAll
/*****************************************************************************
* config_ResetAll: reset the configuration data for all the modules.
*****************************************************************************/
-void __config_ResetAll( vlc_object_t *p_this )
+void config_ResetAll( vlc_object_t *p_this )
{
VLC_UNUSED(p_this);
module_t *p_module;