[vlc-devel] [PATCH 4/7] config/help: only print variable range if explicitly set

Filip Roséen filip at atch.se
Wed Oct 12 19:39:36 CEST 2016


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.
---
 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)
-- 
2.10.0



More information about the vlc-devel mailing list