Commits

Christian Heimes committed 68e496c

port Python modules to modified expat API

  • Participants
  • Parent commits 38051f0

Comments (0)

Files changed (15)

File Modules26/_elementtree.c

     char* encoding = NULL;
 
 #ifdef XML_BOMB_PROTECTION
-    int ignore_dtd_flag = 0;
+    long ignore_dtd_flag = 0;
     PyObject *ignore_dtd = NULL, *indirections = NULL, *expansions = NULL;
-    unsigned long max_indirections;
-    unsigned long max_expansions;
+    long max_indirections;
+    long max_expansions;
 
     static char *kwlist[] = {"target", "encoding",
                              "max_entity_indirections",
 
 #ifdef XML_BOMB_PROTECTION
     if (indirections == NULL || indirections == Py_None) {
-        max_indirections = XML_DEFAULT_MAX_ENTITY_INDIRECTIONS;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                                 &max_indirections);
     }
     else {
-        max_indirections = PyLong_AsUnsignedLong(indirections);
-        if ((max_indirections == (unsigned long)-1) && PyErr_Occurred()) {
+        max_indirections = PyLong_AsLong(indirections);
+        if ((max_indirections == -1) && PyErr_Occurred()) {
             return NULL;
         }
-        if (max_indirections > UINT_MAX) {
+        if ((max_indirections > UINT_MAX) || (max_indirections < 0)) {
             PyErr_Format(PyExc_ValueError,
-                         "max_entity_indirections must not be greater than %i",
+                         "max_entity_indirections be between 0 and %i",
                          UINT_MAX);
             return NULL;
         }
     }
 
     if (expansions == NULL || expansions == Py_None) {
-        max_expansions = XML_DEFAULT_MAX_ENTITY_EXPANSIONS;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                                 &max_expansions);
     }
     else {
-        max_expansions = PyLong_AsUnsignedLong(expansions);
-        if ((max_expansions == (unsigned long)-1) && PyErr_Occurred()) {
+        max_expansions = PyLong_AsLong(expansions);
+        if ((max_expansions == -1) && PyErr_Occurred()) {
             return NULL;
         }
-        if (max_expansions > UINT_MAX) {
+        if ((max_expansions > UINT_MAX) || (max_expansions < 0)) {
             PyErr_Format(PyExc_ValueError,
-                         "max_entity_expansions must not be greater than %i",
+                         "max_entity_expansions be between 0 and %i",
                          UINT_MAX);
             return NULL;
         }
     }
 
     if (ignore_dtd == NULL) {
-        ignore_dtd_flag = 0;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_RESET_DTD,
+                                 &ignore_dtd_flag);
     }
     else if ((ignore_dtd_flag = PyObject_IsTrue(ignore_dtd)) == -1) {
              return NULL;
     }
 
 #ifdef XML_BOMB_PROTECTION
-    EXPAT(SetMaxEntityIndirections)(self->parser, (unsigned int)max_indirections);
-    assert(EXPAT(GetMaxEntityIndirections)(self->parser) ==
-               (unsigned int)max_indirections);
-    EXPAT(SetMaxEntityExpansions)(self->parser,
-                                 (unsigned int)max_expansions);
-    assert(EXPAT(GetMaxEntityExpansions)(self->parser) ==
-           (unsigned int)max_expansions);
-    EXPAT(SetResetDTDFlag)(self->parser,
-                           ignore_dtd_flag ? XML_TRUE : XML_FALSE);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                      max_indirections);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                      max_expansions);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_RESET_DTD,
+                      ignore_dtd_flag);
 #endif
 
     /* setup target handlers */
     }
 #ifdef XML_BOMB_PROTECTION
     else if (strcmp(name, "ignore_dtd") == 0) {
-        return PyBool_FromLong(EXPAT(GetResetDTDFlag)(self->parser));
+        long value = -1;
+        EXPAT(GetFeature)(self->parser, XML_FEATURE_RESET_DTD, &value);
+        return PyBool_FromLong(value);
     }
     else if (strcmp(name, "max_entity_indirections") == 0) {
-        return PyLong_FromUnsignedLong(EXPAT(GetMaxEntityIndirections)
-                                        (self->parser));
+        long value = -1;
+        EXPAT(GetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                          &value);
+        return PyLong_FromLong(value);
     }
     else if (strcmp(name, "max_entity_expansions") == 0) {
-        return PyLong_FromUnsignedLong(EXPAT(GetMaxEntityExpansions)
-                                        (self->parser));
+        long value = -1;
+        EXPAT(GetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                          &value);
+        return PyLong_FromLong(value);
     }
 #endif
     else {

File Modules26/pyexpat.c

     }
 #ifdef XML_BOMB_PROTECTION
     if (name[0] == 'm') {
-        if (strcmp(name, "max_entity_indirections") == 0)
-            return PyInt_FromLong((long)
-                                    XML_GetMaxEntityIndirections(self->itself));
-        if (strcmp(name, "max_entity_expansions") == 0)
-            return PyInt_FromLong((long)
-                                    XML_GetMaxEntityExpansions(self->itself));
+        if (strcmp(name, "max_entity_indirections") == 0) {
+            long value = -1;
+            XML_GetFeature(self->itself, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                           &value);
+            return PyInt_FromLong(value);
+        }
+        if (strcmp(name, "max_entity_expansions") == 0) {
+            long value = -1;
+            XML_GetFeature(self->itself, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                           &value);
+            return PyInt_FromLong(value);
+        }
     }
 #endif
 
 
 #ifdef XML_BOMB_PROTECTION
     if (strcmp(name, "reset_dtd") == 0) {
-        if (XML_GetResetDTDFlag(self->itself) == XML_TRUE) {
-            Py_RETURN_TRUE;
-        }
-        else {
-            Py_RETURN_FALSE;
-        }
+        long value = -1;
+        XML_GetFeature(self->itself, XML_FEATURE_RESET_DTD, &value);
+        return PyBool_FromLong(value);
     }
 #endif
 
                          UINT_MAX);
             return -1;
         }
-        XML_SetMaxEntityExpansions(self->itself, (unsigned int)value);
+        XML_SetFeature(self->itself, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                       value);
         return 0;
     }
 
                          UINT_MAX);
             return -1;
         }
-        XML_SetMaxEntityIndirections(self->itself, (unsigned int)value);
+        XML_SetFeature(self->itself, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                       value);
         return 0;
     }
 
         if ((value = PyObject_IsTrue(v)) == -1) {
             return -1;
         }
-        XML_SetResetDTDFlag(self->itself, value ? XML_TRUE : XML_FALSE);
+        XML_SetFeature(self->itself, XML_FEATURE_RESET_DTD,
+                       value ? XML_TRUE : XML_FALSE);
         return 0;
     }
 #endif
     capi.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler;
     capi.SetUserData = XML_SetUserData;
 #ifdef XML_BOMB_PROTECTION
-    capi.GetMaxEntityIndirections = XML_GetMaxEntityIndirections;
-    capi.SetMaxEntityIndirections = XML_SetMaxEntityIndirections;
-    capi.GetEntityExpansions = XML_GetEntityExpansions;
-    capi.GetMaxEntityExpansions = XML_GetMaxEntityExpansions;
-    capi.SetMaxEntityExpansions = XML_SetMaxEntityExpansions;
-    capi.GetResetDTDFlag = XML_GetResetDTDFlag;
-    capi.SetResetDTDFlag = XML_SetResetDTDFlag;
+    capi.GetFeature = XML_GetFeature;
+    capi.SetFeature = XML_SetFeature;
+    capi.GetFeatureDefault = XML_GetFeatureDefault;
+    capi.SetFeatureDefault = XML_SetFeatureDefault;
 #endif
 
     /* export as cobject */

File Modules26/pyexpat.h

                                        XML_StartDoctypeDeclHandler start);
 #ifdef XML_BOMB_PROTECTION
     /* CAPI 1.1 bomb protection additions */
-    unsigned int (*GetMaxEntityIndirections)(XML_Parser parser);
-    void (*SetMaxEntityIndirections)(XML_Parser parser, unsigned int value);
-
-    unsigned int (*GetEntityExpansions)(XML_Parser parser);
-    unsigned int (*GetMaxEntityExpansions)(XML_Parser parser);
-    void (*SetMaxEntityExpansions)(XML_Parser parser, unsigned int value);
-
-    XML_Bool (*GetResetDTDFlag)(XML_Parser parser);
-    void (*SetResetDTDFlag)(XML_Parser parser, XML_Bool value);
+    int (*GetFeature)(XML_Parser parser, enum XML_FeatureEnum feature,
+                      long *value);
+    int (*SetFeature)(XML_Parser parser, enum XML_FeatureEnum feature,
+                      long value);
+    int (*GetFeatureDefault)(enum XML_FeatureEnum feature, long *value);
+    int (*SetFeatureDefault)(enum XML_FeatureEnum feature, long value);
 #endif
     /* always add new stuff to the end! */
 };
-

File Modules27/_elementtree.c

     char* encoding = NULL;
 
 #ifdef XML_BOMB_PROTECTION
-    int ignore_dtd_flag = 0;
+    long ignore_dtd_flag = 0;
     PyObject *ignore_dtd = NULL, *indirections = NULL, *expansions = NULL;
-    unsigned long max_indirections;
-    unsigned long max_expansions;
+    long max_indirections;
+    long max_expansions;
 
     static char *kwlist[] = {"target", "encoding",
                              "max_entity_indirections",
 
 #ifdef XML_BOMB_PROTECTION
     if (indirections == NULL || indirections == Py_None) {
-        max_indirections = XML_DEFAULT_MAX_ENTITY_INDIRECTIONS;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                                 &max_indirections);
     }
     else {
-        max_indirections = PyLong_AsUnsignedLong(indirections);
-        if ((max_indirections == (unsigned long)-1) && PyErr_Occurred()) {
+        max_indirections = PyLong_AsLong(indirections);
+        if ((max_indirections == -1) && PyErr_Occurred()) {
             return NULL;
         }
-        if (max_indirections > UINT_MAX) {
+        if ((max_indirections > UINT_MAX) || (max_indirections < 0)) {
             PyErr_Format(PyExc_ValueError,
-                         "max_entity_indirections must not be greater than %i",
+                         "max_entity_indirections be between 0 and %i",
                          UINT_MAX);
             return NULL;
         }
     }
 
     if (expansions == NULL || expansions == Py_None) {
-        max_expansions = XML_DEFAULT_MAX_ENTITY_EXPANSIONS;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                                 &max_expansions);
     }
     else {
-        max_expansions = PyLong_AsUnsignedLong(expansions);
-        if ((max_expansions == (unsigned long)-1) && PyErr_Occurred()) {
+        max_expansions = PyLong_AsLong(expansions);
+        if ((max_expansions == -1) && PyErr_Occurred()) {
             return NULL;
         }
-        if (max_expansions > UINT_MAX) {
+        if ((max_expansions > UINT_MAX) || (max_expansions < 0)) {
             PyErr_Format(PyExc_ValueError,
-                         "max_entity_expansions must not be greater than %i",
+                         "max_entity_expansions be between 0 and %i",
                          UINT_MAX);
             return NULL;
         }
     }
 
     if (ignore_dtd == NULL) {
-        ignore_dtd_flag = 0;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_RESET_DTD,
+                                 &ignore_dtd_flag);
     }
     else if ((ignore_dtd_flag = PyObject_IsTrue(ignore_dtd)) == -1) {
              return NULL;
     }
 
 #ifdef XML_BOMB_PROTECTION
-    EXPAT(SetMaxEntityIndirections)(self->parser, (unsigned int)max_indirections);
-    assert(EXPAT(GetMaxEntityIndirections)(self->parser) ==
-               (unsigned int)max_indirections);
-    EXPAT(SetMaxEntityExpansions)(self->parser,
-                                 (unsigned int)max_expansions);
-    assert(EXPAT(GetMaxEntityExpansions)(self->parser) ==
-           (unsigned int)max_expansions);
-    EXPAT(SetResetDTDFlag)(self->parser,
-                           ignore_dtd_flag ? XML_TRUE : XML_FALSE);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                      max_indirections);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                      max_expansions);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_RESET_DTD,
+                      ignore_dtd_flag);
 #endif
 
     /* setup target handlers */
     }
 #ifdef XML_BOMB_PROTECTION
     else if (strcmp(name, "ignore_dtd") == 0) {
-        return PyBool_FromLong(EXPAT(GetResetDTDFlag)(self->parser));
+        long value = -1;
+        EXPAT(GetFeature)(self->parser, XML_FEATURE_RESET_DTD, &value);
+        return PyBool_FromLong(value);
     }
     else if (strcmp(name, "max_entity_indirections") == 0) {
-        return PyLong_FromUnsignedLong(EXPAT(GetMaxEntityIndirections)
-                                        (self->parser));
+        long value = -1;
+        EXPAT(GetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                          &value);
+        return PyLong_FromLong(value);
     }
     else if (strcmp(name, "max_entity_expansions") == 0) {
-        return PyLong_FromUnsignedLong(EXPAT(GetMaxEntityExpansions)
-                                        (self->parser));
+        long value = -1;
+        EXPAT(GetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                          &value);
+        return PyLong_FromLong(value);
     }
 #endif
     else {

File Modules27/pyexpat.c

     }
 #ifdef XML_BOMB_PROTECTION
     if (name[0] == 'm') {
-        if (strcmp(name, "max_entity_indirections") == 0)
-            return PyInt_FromLong((long)
-                                    XML_GetMaxEntityIndirections(self->itself));
-        if (strcmp(name, "max_entity_expansions") == 0)
-            return PyInt_FromLong((long)
-                                    XML_GetMaxEntityExpansions(self->itself));
+        if (strcmp(name, "max_entity_indirections") == 0) {
+            long value = -1;
+            XML_GetFeature(self->itself, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                           &value);
+            return PyInt_FromLong(value);
+        }
+        if (strcmp(name, "max_entity_expansions") == 0) {
+            long value = -1;
+            XML_GetFeature(self->itself, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                           &value);
+            return PyInt_FromLong(value);
+        }
     }
 #endif
 
 
 #ifdef XML_BOMB_PROTECTION
     if (strcmp(name, "reset_dtd") == 0) {
-        if (XML_GetResetDTDFlag(self->itself) == XML_TRUE) {
-            Py_RETURN_TRUE;
-        }
-        else {
-            Py_RETURN_FALSE;
-        }
+        long value = -1;
+        XML_GetFeature(self->itself, XML_FEATURE_RESET_DTD, &value);
+        return PyBool_FromLong(value);
     }
 #endif
 
                          UINT_MAX);
             return -1;
         }
-        XML_SetMaxEntityExpansions(self->itself, (unsigned int)value);
+        XML_SetFeature(self->itself, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                       value);
         return 0;
     }
 
                          UINT_MAX);
             return -1;
         }
-        XML_SetMaxEntityIndirections(self->itself, (unsigned int)value);
+        XML_SetFeature(self->itself, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                       value);
         return 0;
     }
 
         if ((value = PyObject_IsTrue(v)) == -1) {
             return -1;
         }
-        XML_SetResetDTDFlag(self->itself, value ? XML_TRUE : XML_FALSE);
+        XML_SetFeature(self->itself, XML_FEATURE_RESET_DTD,
+                       value ? XML_TRUE : XML_FALSE);
         return 0;
     }
 #endif
     capi.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler;
     capi.SetUserData = XML_SetUserData;
 #ifdef XML_BOMB_PROTECTION
-    capi.GetMaxEntityIndirections = XML_GetMaxEntityIndirections;
-    capi.SetMaxEntityIndirections = XML_SetMaxEntityIndirections;
-    capi.GetEntityExpansions = XML_GetEntityExpansions;
-    capi.GetMaxEntityExpansions = XML_GetMaxEntityExpansions;
-    capi.SetMaxEntityExpansions = XML_SetMaxEntityExpansions;
-    capi.GetResetDTDFlag = XML_GetResetDTDFlag;
-    capi.SetResetDTDFlag = XML_SetResetDTDFlag;
+    capi.GetFeature = XML_GetFeature;
+    capi.SetFeature = XML_SetFeature;
+    capi.GetFeatureDefault = XML_GetFeatureDefault;
+    capi.SetFeatureDefault = XML_SetFeatureDefault;
 #endif
 
     /* export using capsule */

File Modules27/pyexpat.h

                                        XML_StartDoctypeDeclHandler start);
 #ifdef XML_BOMB_PROTECTION
     /* CAPI 1.1 bomb protection additions */
-    unsigned int (*GetMaxEntityIndirections)(XML_Parser parser);
-    void (*SetMaxEntityIndirections)(XML_Parser parser, unsigned int value);
-
-    unsigned int (*GetEntityExpansions)(XML_Parser parser);
-    unsigned int (*GetMaxEntityExpansions)(XML_Parser parser);
-    void (*SetMaxEntityExpansions)(XML_Parser parser, unsigned int value);
-
-    XML_Bool (*GetResetDTDFlag)(XML_Parser parser);
-    void (*SetResetDTDFlag)(XML_Parser parser, XML_Bool value);
+    int (*GetFeature)(XML_Parser parser, enum XML_FeatureEnum feature,
+                      long *value);
+    int (*SetFeature)(XML_Parser parser, enum XML_FeatureEnum feature,
+                      long value);
+    int (*GetFeatureDefault)(enum XML_FeatureEnum feature, long *value);
+    int (*SetFeatureDefault)(enum XML_FeatureEnum feature, long value);
 #endif
     /* always add new stuff to the end! */
 };
-

File Modules31/_elementtree.c

     char* encoding = NULL;
 
 #ifdef XML_BOMB_PROTECTION
-    int ignore_dtd_flag = 0;
+    long ignore_dtd_flag = 0;
     PyObject *ignore_dtd = NULL, *indirections = NULL, *expansions = NULL;
-    unsigned long max_indirections;
-    unsigned long max_expansions;
+    long max_indirections;
+    long max_expansions;
 
     static char *kwlist[] = {"target", "encoding",
                               "max_entity_indirections",
 
 #ifdef XML_BOMB_PROTECTION
     if (indirections == NULL || indirections == Py_None) {
-        max_indirections = XML_DEFAULT_MAX_ENTITY_INDIRECTIONS;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                                 &max_indirections);
     }
     else {
-        max_indirections = PyLong_AsUnsignedLong(indirections);
-        if ((max_indirections == (unsigned long)-1) && PyErr_Occurred()) {
+        max_indirections = PyLong_AsLong(indirections);
+        if ((max_indirections == -1) && PyErr_Occurred()) {
             return NULL;
         }
-        if (max_indirections > UINT_MAX) {
+        if ((max_indirections > UINT_MAX) || (max_indirections < 0)) {
             PyErr_Format(PyExc_ValueError,
-                         "max_entity_indirections must not be greater than %i",
+                         "max_entity_indirections be between 0 and %i",
                          UINT_MAX);
             return NULL;
         }
     }
 
     if (expansions == NULL || expansions == Py_None) {
-        max_expansions = XML_DEFAULT_MAX_ENTITY_EXPANSIONS;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                                 &max_expansions);
     }
     else {
-        max_expansions = PyLong_AsUnsignedLong(expansions);
-        if ((max_expansions == (unsigned long)-1) && PyErr_Occurred()) {
+        max_expansions = PyLong_AsLong(expansions);
+        if ((max_expansions == -1) && PyErr_Occurred()) {
             return NULL;
         }
-        if (max_expansions > UINT_MAX) {
+        if ((max_expansions > UINT_MAX) || (max_expansions < 0)) {
             PyErr_Format(PyExc_ValueError,
-                         "max_entity_expansions must not be greater than %i",
+                         "max_entity_expansions be between 0 and %i",
                          UINT_MAX);
             return NULL;
         }
     }
 
     if (ignore_dtd == NULL) {
-        ignore_dtd_flag = 0;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_RESET_DTD,
+                                 &ignore_dtd_flag);
     }
     else if ((ignore_dtd_flag = PyObject_IsTrue(ignore_dtd)) == -1) {
              return NULL;
     }
 
 #ifdef XML_BOMB_PROTECTION
-    EXPAT(SetMaxEntityIndirections)(self->parser, (unsigned int)max_indirections);
-    assert(EXPAT(GetMaxEntityIndirections)(self->parser) ==
-               (unsigned int)max_indirections);
-    EXPAT(SetMaxEntityExpansions)(self->parser,
-                                 (unsigned int)max_expansions);
-    assert(EXPAT(GetMaxEntityExpansions)(self->parser) ==
-           (unsigned int)max_expansions);
-    EXPAT(SetResetDTDFlag)(self->parser,
-                           ignore_dtd_flag ? XML_TRUE : XML_FALSE);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                      max_indirections);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                      max_expansions);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_RESET_DTD,
+                      ignore_dtd_flag);
 #endif
 
     /* setup target handlers */
 #ifdef XML_BOMB_PROTECTION
     }
     else if (strcmp(name, "ignore_dtd") == 0) {
-         return PyBool_FromLong(EXPAT(GetResetDTDFlag)
-                                (self->parser));
+        long value = -1;
+        EXPAT(GetFeature)(self->parser, XML_FEATURE_RESET_DTD, &value);
+        return PyBool_FromLong(value);
     }
     else if (strcmp(name, "max_entity_indirections") == 0) {
-         return PyLong_FromUnsignedLong(EXPAT(GetMaxEntityIndirections)
-                                        (self->parser));
+        long value = -1;
+        EXPAT(GetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                          &value);
+        return PyLong_FromLong(value);
     }
     else if (strcmp(name, "max_entity_expansions") == 0) {
-         return PyLong_FromUnsignedLong(EXPAT(GetMaxEntityExpansions)
-                                        (self->parser));
+        long value = -1;
+        EXPAT(GetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                          &value);
+        return PyLong_FromLong(value);
 #endif
     } else {
         return PyObject_GenericGetAttr((PyObject*) self, nameobj);

File Modules31/pyexpat.c

     }
 #ifdef XML_BOMB_PROTECTION
     if (name[0] == 'm') {
-        if (strcmp(name, "max_entity_indirections") == 0)
-            return PyLong_FromLong((long)
-                                    XML_GetMaxEntityIndirections(self->itself));
-        if (strcmp(name, "max_entity_expansions") == 0)
-            return PyLong_FromLong((long)
-                                    XML_GetMaxEntityExpansions(self->itself));
+        if (strcmp(name, "max_entity_indirections") == 0) {
+            long value = -1;
+            XML_GetFeature(self->itself, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                           &value);
+            return PyLong_FromLong(value);
+        }
+        if (strcmp(name, "max_entity_expansions") == 0){
+            long value = -1;
+            XML_GetFeature(self->itself, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                           &value);
+            return PyLong_FromLong(value);
+        }
     }
 #endif
     if (strcmp(name, "namespace_prefixes") == 0)
     }
 #ifdef XML_BOMB_PROTECTION
     if (strcmp(name, "reset_dtd") == 0) {
-        if (XML_GetResetDTDFlag(self->itself) == XML_TRUE) {
-            Py_RETURN_TRUE;
-        }
-        else {
-            Py_RETURN_FALSE;
-        }
+        long value = -1;
+        XML_GetFeature(self->itself, XML_FEATURE_RESET_DTD, &value);
+        return PyBool_FromLong(value);
     }
 #endif
     return PyObject_GenericGetAttr((PyObject*)self, nameobj);
                          UINT_MAX);
             return -1;
         }
-        XML_SetMaxEntityExpansions(self->itself, (unsigned int)value);
+        XML_SetFeature(self->itself, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                       value);
         return 0;
     }
 
                          UINT_MAX);
             return -1;
         }
-        XML_SetMaxEntityIndirections(self->itself, (unsigned int)value);
+        XML_SetFeature(self->itself, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                       value);
         return 0;
     }
 
         if ((value = PyObject_IsTrue(v)) == -1) {
             return -1;
         }
-        XML_SetResetDTDFlag(self->itself, value ? XML_TRUE : XML_FALSE);
+        XML_SetFeature(self->itself, XML_FEATURE_RESET_DTD,
+                       value ? XML_TRUE : XML_FALSE);
         return 0;
     }
 #endif
     capi.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler;
     capi.SetUserData = XML_SetUserData;
 #ifdef XML_BOMB_PROTECTION
-    capi.GetMaxEntityIndirections = XML_GetMaxEntityIndirections;
-    capi.SetMaxEntityIndirections = XML_SetMaxEntityIndirections;
-    capi.GetEntityExpansions = XML_GetEntityExpansions;
-    capi.GetMaxEntityExpansions = XML_GetMaxEntityExpansions;
-    capi.SetMaxEntityExpansions = XML_SetMaxEntityExpansions;
-    capi.GetResetDTDFlag = XML_GetResetDTDFlag;
-    capi.SetResetDTDFlag = XML_SetResetDTDFlag;
+    capi.GetFeature = XML_GetFeature;
+    capi.SetFeature = XML_SetFeature;
+    capi.GetFeatureDefault = XML_GetFeatureDefault;
+    capi.SetFeatureDefault = XML_SetFeatureDefault;
 #endif
 
     /* export using capsule */

File Modules31/pyexpat.h

 
 #ifdef XML_BOMB_PROTECTION
     /* CAPI 1.1 bomb protection additions */
-    unsigned int (*GetMaxEntityIndirections)(XML_Parser parser);
-    void (*SetMaxEntityIndirections)(XML_Parser parser, unsigned int value);
-
-    unsigned int (*GetEntityExpansions)(XML_Parser parser);
-    unsigned int (*GetMaxEntityExpansions)(XML_Parser parser);
-    void (*SetMaxEntityExpansions)(XML_Parser parser, unsigned int value);
-
-    XML_Bool (*GetResetDTDFlag)(XML_Parser parser);
-    void (*SetResetDTDFlag)(XML_Parser parser, XML_Bool value);
+    int (*GetFeature)(XML_Parser parser, enum XML_FeatureEnum feature,
+                      long *value);
+    int (*SetFeature)(XML_Parser parser, enum XML_FeatureEnum feature,
+                      long value);
+    int (*GetFeatureDefault)(enum XML_FeatureEnum feature, long *value);
+    int (*SetFeatureDefault)(enum XML_FeatureEnum feature, long value);
 #endif
 
     /* always add new stuff to the end! */

File Modules32/_elementtree.c

     char* encoding = NULL;
 
 #ifdef XML_BOMB_PROTECTION
-    int ignore_dtd_flag = 0;
+    long ignore_dtd_flag = 0;
     PyObject *ignore_dtd = NULL, *indirections = NULL, *expansions = NULL;
-    unsigned long max_indirections;
-    unsigned long max_expansions;
+    long max_indirections;
+    long max_expansions;
 
     static char *kwlist[] = {"target", "encoding",
                               "max_entity_indirections",
 
 #ifdef XML_BOMB_PROTECTION
     if (indirections == NULL || indirections == Py_None) {
-        max_indirections = XML_DEFAULT_MAX_ENTITY_INDIRECTIONS;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                                 &max_indirections);
     }
     else {
-        max_indirections = PyLong_AsUnsignedLong(indirections);
-        if ((max_indirections == (unsigned long)-1) && PyErr_Occurred()) {
+        max_indirections = PyLong_AsLong(indirections);
+        if ((max_indirections == -1) && PyErr_Occurred()) {
             return NULL;
         }
-        if (max_indirections > UINT_MAX) {
+        if ((max_indirections > UINT_MAX) || (max_indirections < 0)) {
             PyErr_Format(PyExc_ValueError,
-                         "max_entity_indirections must not be greater than %i",
+                         "max_entity_indirections be between 0 and %i",
                          UINT_MAX);
             return NULL;
         }
     }
 
     if (expansions == NULL || expansions == Py_None) {
-        max_expansions = XML_DEFAULT_MAX_ENTITY_EXPANSIONS;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                                 &max_expansions);
     }
     else {
-        max_expansions = PyLong_AsUnsignedLong(expansions);
-        if ((max_expansions == (unsigned long)-1) && PyErr_Occurred()) {
+        max_expansions = PyLong_AsLong(expansions);
+        if ((max_expansions == -1) && PyErr_Occurred()) {
             return NULL;
         }
-        if (max_expansions > UINT_MAX) {
+        if ((max_expansions > UINT_MAX) || (max_expansions < 0)) {
             PyErr_Format(PyExc_ValueError,
-                         "max_entity_expansions must not be greater than %i",
+                         "max_entity_expansions be between 0 and %i",
                          UINT_MAX);
             return NULL;
         }
     }
 
     if (ignore_dtd == NULL) {
-        ignore_dtd_flag = 0;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_RESET_DTD,
+                                 &ignore_dtd_flag);
     }
     else if ((ignore_dtd_flag = PyObject_IsTrue(ignore_dtd)) == -1) {
              return NULL;
     }
 
 #ifdef XML_BOMB_PROTECTION
-    EXPAT(SetMaxEntityIndirections)(self->parser, (unsigned int)max_indirections);
-    assert(EXPAT(GetMaxEntityIndirections)(self->parser) ==
-               (unsigned int)max_indirections);
-    EXPAT(SetMaxEntityExpansions)(self->parser,
-                                 (unsigned int)max_expansions);
-    assert(EXPAT(GetMaxEntityExpansions)(self->parser) ==
-           (unsigned int)max_expansions);
-    EXPAT(SetResetDTDFlag)(self->parser,
-                           ignore_dtd_flag ? XML_TRUE : XML_FALSE);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                      max_indirections);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                      max_expansions);
+    EXPAT(SetFeature)(self->parser, XML_FEATURE_RESET_DTD,
+                      ignore_dtd_flag);
 #endif
 
     /* setup target handlers */
         }
 #ifdef XML_BOMB_PROTECTION
         else if (PyUnicode_CompareWithASCIIString(nameobj, "ignore_dtd") == 0) {
-             return PyBool_FromLong(EXPAT(GetResetDTDFlag)
-                                    (self->parser));
+            long value = -1;
+            EXPAT(GetFeature)(self->parser, XML_FEATURE_RESET_DTD, &value);
+            return PyBool_FromLong(value);
         }
         else if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_indirections") == 0) {
-             return PyLong_FromUnsignedLong(EXPAT(GetMaxEntityIndirections)
-                                            (self->parser));
+            long value = -1;
+            EXPAT(GetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                              &value);
+            return PyLong_FromLong(value);
         }
         else if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_expansions") == 0) {
-             return PyLong_FromUnsignedLong(EXPAT(GetMaxEntityExpansions)
-                                            (self->parser));
+            long value = -1;
+            EXPAT(GetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                              &value);
+            return PyLong_FromLong(value);
         }
 #endif
         else

File Modules32/pyexpat.c

     }
 #ifdef XML_BOMB_PROTECTION
     if (name[0] == 'm') {
-        if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_indirections") == 0)
-            return PyLong_FromLong((long)
-                                    XML_GetMaxEntityIndirections(self->itself));
-        if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_expansions") == 0)
-            return PyLong_FromLong((long)
-                                    XML_GetMaxEntityExpansions(self->itself));
+        if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_indirections") == 0) {
+            long value = -1;
+            XML_GetFeature(self->itself, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                           &value);
+            return PyLong_FromLong(value);
+        }
+        if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_expansions") == 0) {
+            long value = -1;
+            XML_GetFeature(self->itself, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                           &value);
+            return PyLong_FromLong(value);
+        }
     }
 #endif
     if (PyUnicode_CompareWithASCIIString(nameobj, "namespace_prefixes") == 0)
     }
 #ifdef XML_BOMB_PROTECTION
     if (PyUnicode_CompareWithASCIIString(nameobj, "reset_dtd") == 0) {
-        if (XML_GetResetDTDFlag(self->itself) == XML_TRUE) {
-            Py_RETURN_TRUE;
-        }
-        else {
-            Py_RETURN_FALSE;
-        }
+        long value = -1;
+        XML_GetFeature(self->itself, XML_FEATURE_RESET_DTD, &value);
+        return PyBool_FromLong(value);
     }
 #endif
   generic:
                          UINT_MAX);
             return -1;
         }
-        XML_SetMaxEntityExpansions(self->itself, (unsigned int)value);
+        XML_SetFeature(self->itself, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                       value);
         return 0;
     }
 
                          UINT_MAX);
             return -1;
         }
-        XML_SetMaxEntityIndirections(self->itself, (unsigned int)value);
+        XML_SetFeature(self->itself, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                       value);
         return 0;
     }
 
         if ((value = PyObject_IsTrue(v)) == -1) {
             return -1;
         }
-        XML_SetResetDTDFlag(self->itself, value ? XML_TRUE : XML_FALSE);
+        XML_SetFeature(self->itself, XML_FEATURE_RESET_DTD,
+                       value ? XML_TRUE : XML_FALSE);
         return 0;
     }
 #endif
     capi.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler;
     capi.SetUserData = XML_SetUserData;
 #ifdef XML_BOMB_PROTECTION
-    capi.GetMaxEntityIndirections = XML_GetMaxEntityIndirections;
-    capi.SetMaxEntityIndirections = XML_SetMaxEntityIndirections;
-    capi.GetEntityExpansions = XML_GetEntityExpansions;
-    capi.GetMaxEntityExpansions = XML_GetMaxEntityExpansions;
-    capi.SetMaxEntityExpansions = XML_SetMaxEntityExpansions;
-    capi.GetResetDTDFlag = XML_GetResetDTDFlag;
-    capi.SetResetDTDFlag = XML_SetResetDTDFlag;
+    capi.GetFeature = XML_GetFeature;
+    capi.SetFeature = XML_SetFeature;
+    capi.GetFeatureDefault = XML_GetFeatureDefault;
+    capi.SetFeatureDefault = XML_SetFeatureDefault;
 #endif
 
     /* export using capsule */

File Modules32/pyexpat.h

 
 #ifdef XML_BOMB_PROTECTION
     /* CAPI 1.1 bomb protection additions */
-    unsigned int (*GetMaxEntityIndirections)(XML_Parser parser);
-    void (*SetMaxEntityIndirections)(XML_Parser parser, unsigned int value);
-
-    unsigned int (*GetEntityExpansions)(XML_Parser parser);
-    unsigned int (*GetMaxEntityExpansions)(XML_Parser parser);
-    void (*SetMaxEntityExpansions)(XML_Parser parser, unsigned int value);
-
-    XML_Bool (*GetResetDTDFlag)(XML_Parser parser);
-    void (*SetResetDTDFlag)(XML_Parser parser, XML_Bool value);
+    int (*GetFeature)(XML_Parser parser, enum XML_FeatureEnum feature,
+                      long *value);
+    int (*SetFeature)(XML_Parser parser, enum XML_FeatureEnum feature,
+                      long value);
+    int (*GetFeatureDefault)(enum XML_FeatureEnum feature, long *value);
+    int (*SetFeatureDefault)(enum XML_FeatureEnum feature, long value);
 #endif
 
     /* always add new stuff to the end! */

File Modules33/_elementtree.c

     XMLParserObject *self_xp = (XMLParserObject *)self;
     PyObject *target = NULL, *html = NULL;
     char *encoding = NULL;
-    int ignore_dtd_flag = 0;
+    long ignore_dtd_flag = 0;
 
 #ifdef XML_BOMB_PROTECTION
     PyObject *ignore_dtd = NULL, *indirections = NULL, *expansions = NULL;
-    unsigned long max_indirections;
-    unsigned long max_expansions;
+    long max_indirections;
+    long max_expansions;
 
     static char *kwlist[] = {"html", "target", "encoding",
                               "max_entity_indirections",
 
 #ifdef XML_BOMB_PROTECTION
     if (indirections == NULL || indirections == Py_None) {
-        max_indirections = XML_DEFAULT_MAX_ENTITY_INDIRECTIONS;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                                 &max_indirections);
     }
     else {
-        max_indirections = PyLong_AsUnsignedLong(indirections);
-        if ((max_indirections == (unsigned long)-1) && PyErr_Occurred()) {
+        max_indirections = PyLong_AsLong(indirections);
+        if ((max_indirections == -1) && PyErr_Occurred()) {
             return -1;
         }
-        if (max_indirections > UINT_MAX) {
+        if ((max_indirections > UINT_MAX) || (max_indirections < 0)) {
             PyErr_Format(PyExc_ValueError,
-                         "max_entity_indirections must not be greater than %i",
+                         "max_entity_indirections be between 0 and %i",
                          UINT_MAX);
             return -1;
         }
     }
 
     if (expansions == NULL || expansions == Py_None) {
-        max_expansions = XML_DEFAULT_MAX_ENTITY_EXPANSIONS;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                                 &max_expansions);
     }
     else {
-        max_expansions = PyLong_AsUnsignedLong(expansions);
-        if ((max_expansions == (unsigned long)-1) && PyErr_Occurred()) {
+        max_expansions = PyLong_AsLong(expansions);
+        if ((max_expansions == -1) && PyErr_Occurred()) {
             return -1;
         }
-        if (max_expansions > UINT_MAX) {
+        if ((max_expansions > UINT_MAX) || (max_expansions < 0)) {
             PyErr_Format(PyExc_ValueError,
-                         "max_entity_expansions must not be greater than %i",
+                         "max_entity_expansions be between 0 and %i",
                          UINT_MAX);
             return -1;
         }
     }
 
     if (ignore_dtd == NULL) {
-        ignore_dtd_flag = 0;
+        EXPAT(GetFeatureDefault)(XML_FEATURE_RESET_DTD,
+                                 &ignore_dtd_flag);
     }
     else if ((ignore_dtd_flag = PyObject_IsTrue(ignore_dtd)) == -1) {
-        return -1;
+             return -1;
     }
 #endif
 
     }
 
 #ifdef XML_BOMB_PROTECTION
-    EXPAT(SetMaxEntityIndirections)(self_xp->parser, (unsigned int)max_indirections);
-    assert(EXPAT(GetMaxEntityIndirections)(self_xp->parser) ==
-               (unsigned int)max_indirections);
-    EXPAT(SetMaxEntityExpansions)(self_xp->parser,
-                                 (unsigned int)max_expansions);
-    assert(EXPAT(GetMaxEntityExpansions)(self_xp->parser) ==
-           (unsigned int)max_expansions);
-    EXPAT(SetResetDTDFlag)(self_xp->parser,
-                           ignore_dtd_flag ? XML_TRUE : XML_FALSE);
+    EXPAT(SetFeature)(self_xp->parser, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                      max_indirections);
+    EXPAT(SetFeature)(self_xp->parser, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                      max_expansions);
+    EXPAT(SetFeature)(self_xp->parser, XML_FEATURE_RESET_DTD,
+                      ignore_dtd_flag);
 #endif
 
     if (target) {
         }
 #ifdef XML_BOMB_PROTECTION
         else if (PyUnicode_CompareWithASCIIString(nameobj, "ignore_dtd") == 0) {
-             return PyBool_FromLong(EXPAT(GetResetDTDFlag)
-                                    (self->parser));
+            long value = -1;
+            EXPAT(GetFeature)(self->parser, XML_FEATURE_RESET_DTD, &value);
+            return PyBool_FromLong(value);
         }
         else if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_indirections") == 0) {
-             return PyLong_FromUnsignedLong(EXPAT(GetMaxEntityIndirections)
-                                            (self->parser));
+            long value = -1;
+            EXPAT(GetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                              &value);
+            return PyLong_FromLong(value);
         }
         else if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_expansions") == 0) {
-             return PyLong_FromUnsignedLong(EXPAT(GetMaxEntityExpansions)
-                                            (self->parser));
+            long value = -1;
+            EXPAT(GetFeature)(self->parser, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                              &value);
+            return PyLong_FromLong(value);
         }
 #endif
         else

File Modules33/pyexpat.c

     }
 #ifdef XML_BOMB_PROTECTION
     if (first_char == 'm') {
-        if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_indirections") == 0)
-            return PyLong_FromLong((long)
-                                    XML_GetMaxEntityIndirections(self->itself));
-        if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_expansions") == 0)
-            return PyLong_FromLong((long)
-                                    XML_GetMaxEntityExpansions(self->itself));
+        if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_indirections") == 0) {
+            long value = -1;
+            XML_GetFeature(self->itself, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                           &value);
+            return PyLong_FromLong(value);
+        }
+        if (PyUnicode_CompareWithASCIIString(nameobj, "max_entity_expansions") == 0) {
+            long value = -1;
+            XML_GetFeature(self->itself, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                           &value);
+            return PyLong_FromLong(value);        }
     }
 #endif
     if (PyUnicode_CompareWithASCIIString(nameobj, "namespace_prefixes") == 0)
     }
 #ifdef XML_BOMB_PROTECTION
     if (PyUnicode_CompareWithASCIIString(nameobj, "reset_dtd") == 0) {
-        if (XML_GetResetDTDFlag(self->itself) == XML_TRUE) {
-            Py_RETURN_TRUE;
-        }
-        else {
-            Py_RETURN_FALSE;
-        }
+        long value = -1;
+        XML_GetFeature(self->itself, XML_FEATURE_RESET_DTD, &value);
+        return PyBool_FromLong(value);
     }
 #endif
   generic:
                          UINT_MAX);
             return -1;
         }
-        XML_SetMaxEntityExpansions(self->itself, (unsigned int)value);
+        XML_SetFeature(self->itself, XML_FEATURE_MAX_ENTITY_EXPANSIONS,
+                       value);
         return 0;
     }
 
                          UINT_MAX);
             return -1;
         }
-        XML_SetMaxEntityIndirections(self->itself, (unsigned int)value);
+        XML_SetFeature(self->itself, XML_FEATURE_MAX_ENTITY_INDIRECTIONS,
+                       value);
         return 0;
     }
 
         if ((value = PyObject_IsTrue(v)) == -1) {
             return -1;
         }
-        XML_SetResetDTDFlag(self->itself, value ? XML_TRUE : XML_FALSE);
+        XML_SetFeature(self->itself, XML_FEATURE_RESET_DTD,
+                       value ? XML_TRUE : XML_FALSE);
         return 0;
     }
 #endif
     capi.SetUserData = XML_SetUserData;
     capi.SetStartDoctypeDeclHandler = XML_SetStartDoctypeDeclHandler;
 #ifdef XML_BOMB_PROTECTION
-    capi.GetMaxEntityIndirections = XML_GetMaxEntityIndirections;
-    capi.SetMaxEntityIndirections = XML_SetMaxEntityIndirections;
-    capi.GetEntityExpansions = XML_GetEntityExpansions;
-    capi.GetMaxEntityExpansions = XML_GetMaxEntityExpansions;
-    capi.SetMaxEntityExpansions = XML_SetMaxEntityExpansions;
-    capi.GetResetDTDFlag = XML_GetResetDTDFlag;
-    capi.SetResetDTDFlag = XML_SetResetDTDFlag;
+    capi.GetFeature = XML_GetFeature;
+    capi.SetFeature = XML_SetFeature;
+    capi.GetFeatureDefault = XML_GetFeatureDefault;
+    capi.SetFeatureDefault = XML_SetFeatureDefault;
 #endif
 
     /* export using capsule */

File Modules33/pyexpat.h

                                        XML_StartDoctypeDeclHandler start);
 #ifdef XML_BOMB_PROTECTION
     /* CAPI 1.1 bomb protection additions */
-    unsigned int (*GetMaxEntityIndirections)(XML_Parser parser);
-    void (*SetMaxEntityIndirections)(XML_Parser parser, unsigned int value);
-
-    unsigned int (*GetEntityExpansions)(XML_Parser parser);
-    unsigned int (*GetMaxEntityExpansions)(XML_Parser parser);
-    void (*SetMaxEntityExpansions)(XML_Parser parser, unsigned int value);
-
-    XML_Bool (*GetResetDTDFlag)(XML_Parser parser);
-    void (*SetResetDTDFlag)(XML_Parser parser, XML_Bool value);
+    int (*GetFeature)(XML_Parser parser, enum XML_FeatureEnum feature,
+                      long *value);
+    int (*SetFeature)(XML_Parser parser, enum XML_FeatureEnum feature,
+                      long value);
+    int (*GetFeatureDefault)(enum XML_FeatureEnum feature, long *value);
+    int (*SetFeatureDefault)(enum XML_FeatureEnum feature, long value);
 #endif
     /* always add new stuff to the end! */
 };