[Mesa-dev] [PATCH V3 1/2] mesa: Fix backward compatibility for XML parser

Quentin Liu quentin.liu.0415 at gmail.com
Mon Aug 21 13:27:20 UTC 2017


From: Quentin Liu <Quentin.Liu.0415 at gmail.com>

If the type of drirc options is changed, the parser will not be able to
 recognize xml files that had been present before the change. To achieve
backward compatibility, the parser is relaxed to recognize boolean type
options with enum values.
---
 src/util/xmlconfig.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c
index d3f47ec..d81a07b 100644
--- a/src/util/xmlconfig.c
+++ b/src/util/xmlconfig.c
@@ -317,8 +317,21 @@ parseValue(driOptionValue *v, driOptionType type,
const XML_Char *string)
             v->_bool = true;
             tail = string + 4;
         }
-        else
-            return false;
+        else {
+            /* Some drirc options, such as pp_celshade, were formerly enum
+             * values. Now that they have been turned into boolean values,
+             * to achieve backward compatibility relax the check here a
+             * little bit */
+            int value = strToI(string, &tail, 0);
+            if (value == 1)
+                v->_bool = true;
+            else if (value == 0)
+                v->_bool = false;
+            else
+                return false; /* wrong value here */
+            }
+       }
+
         break;
       case DRI_ENUM: /* enum is just a special integer */
       case DRI_INT:


--
2.7.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170821/dc4233a8/attachment.html>


More information about the mesa-dev mailing list