[vlc-commits] config/help: only print variable range if explicitly set

Filip Roséen git at videolan.org
Thu Oct 13 18:05:39 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Wed Oct 12 19:39:36 2016 +0200| [da135a7fd29c065df13c3d5053d7ccc78399f28f] | committer: Thomas Guillem

config/help: only print variable range if explicitly set

Unless a module has specified their own range for a certain variable,
the ranges for an integer is always [ INT_MIN, INT_MAX ], and float [
FLT_MIN, FLT_MAX ]. Printing out these ranges explicitly shall not
happen unless a module has specified some other range for a variable.

These changes addresses the above.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 src/config/help.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/config/help.c b/src/config/help.c
index 9d7e785..16afba3 100644
--- a/src/config/help.c
+++ b/src/config/help.c
@@ -27,6 +27,8 @@
 #include <stdlib.h>
 #include <wchar.h>
 #include <wctype.h>
+#include <limits.h>
+#include <float.h>
 
 #include <vlc_common.h>
 #include <vlc_modules.h>
@@ -432,7 +434,7 @@ static void print_item(const module_t *m, const module_config_t *item,
                             module_gettext(m, item->list_text[i]));
                 }
             }
-            else if (item->min.i != 0 || item->max.i != 0)
+            else if (item->min.i != INT_MIN || item->max.i != INT_MAX)
             {
                 if (asprintf(&typebuf, "%s [%"PRId64" .. %"PRId64"]",
                              type, item->min.i, item->max.i) >= 0)
@@ -444,7 +446,7 @@ static void print_item(const module_t *m, const module_config_t *item,
 
         case CONFIG_ITEM_FLOAT:
             type = _("float");
-            if (item->min.f != 0.f || item->max.f != 0.f)
+            if (item->min.f != FLT_MIN || item->max.f != FLT_MAX)
             {
                 if (asprintf(&typebuf, "%s [%f .. %f]", type,
                              item->min.f, item->max.f) >= 0)



More information about the vlc-commits mailing list