[vlc-commits] commit: Use 64-bits for integers in plugin descriptors ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Sun Jul 11 13:44:04 CEST 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 11 14:43:01 2010 +0300| [cafd2e02288005f71157bc74cf13b7d1d68fb808] | committer: Rémi Denis-Courmont 

Use 64-bits for integers in plugin descriptors

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cafd2e02288005f71157bc74cf13b7d1d68fb808
---

 include/vlc_plugin.h |   15 ++++++++-------
 src/config/core.c    |    7 ++-----
 src/modules/entry.c  |   12 +++++++++---
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h
index 3f51b6e..2788e4a 100644
--- a/include/vlc_plugin.h
+++ b/include/vlc_plugin.h
@@ -120,8 +120,8 @@ enum vlc_module_properties
 /**
  * Current plugin ABI version
  */
-# define MODULE_SYMBOL 1_2_0c
-# define MODULE_SUFFIX "__1_2_0c"
+# define MODULE_SYMBOL 1_2_0d
+# define MODULE_SUFFIX "__1_2_0d"
 
 /*****************************************************************************
  * Add a few defines. You do not want to read this section. Really.
@@ -273,16 +273,16 @@ enum vlc_module_properties
 
 #define add_int_inner( type, name, text, longtext, advc, cb, v ) \
     add_typename_inner( type, name, text, longtext, advc, cb ) \
-    vlc_config_set (p_config, VLC_CONFIG_VALUE, (int)(v));
+    vlc_config_set (p_config, VLC_CONFIG_VALUE, (int64_t)(v));
 
 
 #define set_category( i_id ) \
     add_type_inner( CONFIG_CATEGORY ) \
-    vlc_config_set (p_config, VLC_CONFIG_VALUE, (int)(i_id));
+    vlc_config_set (p_config, VLC_CONFIG_VALUE, (int64_t)(i_id));
 
 #define set_subcategory( i_id ) \
     add_type_inner( CONFIG_SUBCATEGORY ) \
-    vlc_config_set (p_config, VLC_CONFIG_VALUE, (int)(i_id));
+    vlc_config_set (p_config, VLC_CONFIG_VALUE, (int64_t)(i_id));
 
 #define set_section( text, longtext ) \
     add_typedesc_inner( CONFIG_SECTION, text, longtext )
@@ -366,7 +366,7 @@ enum vlc_module_properties
 #define add_bool( name, v, p_callback, text, longtext, advc ) \
     add_typename_inner( CONFIG_ITEM_BOOL, name, text, longtext, advc, \
                         p_callback ) \
-    if (v) vlc_config_set (p_config, VLC_CONFIG_VALUE, (int)true);
+    if (v) vlc_config_set (p_config, VLC_CONFIG_VALUE, (int64_t)true);
 
 /* For removed option */
 #define add_obsolete_inner( name, type ) \
@@ -410,7 +410,8 @@ enum vlc_module_properties
                     (vlc_callback_t)(list_update_func));
 
 #define change_integer_range( minv, maxv ) \
-    vlc_config_set (p_config, VLC_CONFIG_RANGE, (int)(minv), (int)(maxv));
+    vlc_config_set (p_config, VLC_CONFIG_RANGE, \
+                    (int64_t)(minv), (int64_t)(maxv));
 
 #define change_float_range( minv, maxv ) \
     vlc_config_set (p_config, VLC_CONFIG_RANGE, \
diff --git a/src/config/core.c b/src/config/core.c
index b6e3f17..75907dd 100644
--- a/src/config/core.c
+++ b/src/config/core.c
@@ -327,12 +327,9 @@ void config_PutInt( vlc_object_t *p_this, const char *psz_name,
         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);
diff --git a/src/modules/entry.c b/src/modules/entry.c
index 80f2802..df7277b 100644
--- a/src/modules/entry.c
+++ b/src/modules/entry.c
@@ -28,6 +28,7 @@
 #include <vlc_memory.h>
 #include <assert.h>
 #include <stdarg.h>
+#include <limits.h>
 
 #include "modules/modules.h"
 #include "config/configuration.h"
@@ -136,6 +137,11 @@ static module_config_t *vlc_config_create (module_t *module, int type)
     }
 
     memset (tab + confsize, 0, sizeof (tab[confsize]));
+    if (IsConfigIntegerType (type))
+    {
+        tab[confsize].max.i = INT_MAX;
+        tab[confsize].min.i = INT_MIN;
+    }
     tab[confsize].i_type = type;
 
     if (type & CONFIG_ITEM)
@@ -263,7 +269,7 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
             if (IsConfigIntegerType (item->i_type))
             {
                 item->orig.i = item->saved.i =
-                item->value.i = va_arg (ap, int);
+                item->value.i = va_arg (ap, int64_t);
             }
             else
             if (IsConfigFloatType (item->i_type))
@@ -288,8 +294,8 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
              || item->i_type == CONFIG_ITEM_MODULE_LIST_CAT
              || item->i_type == CONFIG_ITEM_MODULE_CAT)
             {
-                item->min.i = va_arg (ap, int);
-                item->max.i = va_arg (ap, int);
+                item->min.i = va_arg (ap, int64_t);
+                item->max.i = va_arg (ap, int64_t);
             }
             else
             if (IsConfigFloatType (item->i_type))



More information about the vlc-commits mailing list