mesa: utils: fix check of option is not found
findOption() will return ALT_XML_MAX_OPTIONS if an given option is not
found in _cache. So the check from those driQueryOptionXXX() functions
should look for condition (i == ALT_XML_MAX_OPTIONS) rather than
(i < ALT_XML_MAX_OPTIONS).
Fixes: 48c0faf42671 ("FROMLIST: mesa: utils: provide alternate default config mechanism")
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Change-Id: Ie317a6806f1be491eb29dc65ab38a929d4f6d720
diff --git a/src/util/altxmlconfig.c b/src/util/altxmlconfig.c
index bbbc68a..28b929e 100644
--- a/src/util/altxmlconfig.c
+++ b/src/util/altxmlconfig.c
@@ -218,7 +218,7 @@
{
uint32_t i = findOption (name);
/* If not found, return default */
- if (i < ALT_XML_MAX_OPTIONS)
+ if (i == ALT_XML_MAX_OPTIONS)
return false;
assert (_cache.info[i].type == DRI_BOOL);
@@ -230,7 +230,7 @@
{
uint32_t i = findOption (name);
/* If not found, return default */
- if (i < ALT_XML_MAX_OPTIONS)
+ if (i == ALT_XML_MAX_OPTIONS)
return 0;
assert (_cache.info[i].type == DRI_ENUM || _cache.info[i].type == DRI_INT);
@@ -242,7 +242,7 @@
{
uint32_t i = findOption (name);
/* If not found, return default */
- if (i < ALT_XML_MAX_OPTIONS)
+ if (i == ALT_XML_MAX_OPTIONS)
return 0.0;
assert (_cache.info[i].type == DRI_FLOAT);
@@ -254,7 +254,7 @@
{
uint32_t i = findOption (name);
/* If not found, return default */
- if (i < ALT_XML_MAX_OPTIONS)
+ if (i == ALT_XML_MAX_OPTIONS)
return NULL;
assert (_cache.info[i].type == DRI_STRING);