[Xcb] [proto 6/6] schema: Restricted enum item values

Daniel Martin consume.noise at gmail.com
Fri Nov 22 14:26:54 PST 2013


Restrict decimal values by using an xsd:unsignedInt instead of an
xsd:integer. xsd:unsignedInt is an unsigned 32-bit integer.
And restrict bit values by adding a type, which allows values within the
range of [0, 32) only.

Signed-off-by: Daniel Martin <consume.noise at gmail.com>
---
 src/xcb.xsd    | 14 +++++++++++---
 src/xinput.xml |  2 +-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/xcb.xsd b/src/xcb.xsd
index fd22701..9904e2b 100644
--- a/src/xcb.xsd
+++ b/src/xcb.xsd
@@ -162,7 +162,7 @@ authorization from the authors.
         </xsd:complexType>
       </xsd:element>
       <xsd:element name="value" type="xsd:integer" />
-      <xsd:element name="bit" type="xsd:integer" />
+      <xsd:element name="bit" type="bitType" />
     </xsd:choice>
   </xsd:group>
   
@@ -223,6 +223,14 @@ authorization from the authors.
     <xsd:attribute name="ref" type="xsd:string" use="required" />
   </xsd:complexType>
 
+  <!-- Type for bit values -->
+  <xsd:simpleType name="bitType">
+    <xsd:restriction base="xsd:integer">
+      <xsd:minInclusive value="0" />
+      <xsd:maxExclusive value="32" />
+    </xsd:restriction>
+  </xsd:simpleType>
+
   <!-- Type for documentation -->
   <xsd:group name="doc-fields">
     <xsd:sequence>
@@ -351,8 +359,8 @@ authorization from the authors.
             <xsd:element name="item">
               <xsd:complexType>
                 <xsd:choice minOccurs="1" maxOccurs="1">
-                  <xsd:element name="value" type="xsd:integer" />
-                  <xsd:element name="bit" type="xsd:integer" />
+                  <xsd:element name="value" type="xsd:unsignedInt" />
+                  <xsd:element name="bit" type="bitType" />
                 </xsd:choice>
                 <xsd:attribute name="name" type="xsd:string" use="required" />
               </xsd:complexType>
diff --git a/src/xinput.xml b/src/xinput.xml
index dd3f184..d00b004 100644
--- a/src/xinput.xml
+++ b/src/xinput.xml
@@ -1000,7 +1000,7 @@ <request name="ListDeviceProperties" opcode="36">
     <!-- ChangeDeviceProperty -->
 
     <enum name="PropertyFormat">
-        <item name="8Bits">  <value> 8</value> </item>
+        <item name="8Bits">  <value>8</value> </item>
         <item name="16Bits"> <value>16</value> </item>
         <item name="32Bits"> <value>32</value> </item>
     </enum>
-- 
1.8.4.2



More information about the Xcb mailing list