]> git.sesse.net Git - vlc/blobdiff - src/config/core.c
Use 64-bits for integers in plugin descriptors
[vlc] / src / config / core.c
index 9632e1be1d17cdcfa24b59f5342194ad67efa4e3..75907dd20b526586d00086d3afabde63605c826c 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <vlc_common.h>
 #include "vlc_keys.h"
-#include "vlc_charset.h"
 #include "vlc_configuration.h"
 
 #include <assert.h>
@@ -142,7 +141,7 @@ int config_GetType( vlc_object_t *p_this, const char *psz_name )
  * 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;
 
@@ -161,7 +160,7 @@ int config_GetInt( vlc_object_t *p_this, const char *psz_name )
         return -1;
     }
 
-    int val;
+    int64_t val;
 
     vlc_rwlock_rdlock (&config_lock);
     val = p_config->value.i;
@@ -254,7 +253,7 @@ 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 );
 
@@ -272,24 +271,25 @@ void config_PutPsz( vlc_object_t *p_this,
         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 );
     }
@@ -306,7 +306,8 @@ void config_PutPsz( vlc_object_t *p_this,
  * 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;
@@ -326,12 +327,9 @@ void config_PutInt( vlc_object_t *p_this, const char *psz_name, int i_value )
         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);