4848#ifndef Expat_INCLUDED
4949# define Expat_INCLUDED 1
5050
51- # include < stdint.h> // for uint8_t
51+ # include < stdint.h> // for int64_t, uint8_t, uint64_t
5252# include < stdlib.h>
5353# include " expat_external.h"
5454
@@ -140,6 +140,26 @@ enum XML_Error {
140140 XML_ERROR_NOT_STARTED ,
141141};
142142
143+ /* Added in 2.9.0. */
144+ enum XML_Prop_Error {
145+ XML_PROP_ERROR_NONE = 0 , // i.e. success
146+
147+ XML_PROP_ERROR_INVALID_KEY = 1 , // i.e. the property is not known at all
148+ XML_PROP_ERROR_INVALID_TYPE = 2 , // i.e. the property is known but expects a
149+ // different type (so a different
150+ // getter/setter would need to be called)
151+ XML_PROP_ERROR_INVALID_VALUE = 3 , // i.e. the value is invalid (with a setter
152+ // function) or a NULL-pointer (with a
153+ // getter function)
154+
155+ XML_PROP_ERROR_PARSER_NULL = 4 , // i.e. the parser argument is NULL
156+ XML_PROP_ERROR_PARSER_NOT_ROOT = 5 , // i.e. the parser is not a root parser
157+ // but a subparser (and a root parser is
158+ // needed)
159+
160+ /* potentially more error codes upcoming here */
161+ };
162+
143163enum XML_Content_Type {
144164 XML_CTYPE_EMPTY = 1 ,
145165 XML_CTYPE_ANY ,
@@ -757,29 +777,6 @@ XML_GetSpecifiedAttributeCount(XML_Parser parser);
757777XMLPARSEAPI (int )
758778XML_GetIdAttributeIndex (XML_Parser parser);
759779
760- # ifdef XML_ATTR_INFO
761- /* Source file byte offsets for the start and end of attribute names and values.
762- The value indices are exclusive of surrounding quotes; thus in a UTF-8 source
763- file an attribute value of "blah" will yield:
764- info->valueEnd - info->valueStart = 4 bytes.
765- */
766- typedef struct {
767- XML_Index nameStart; /* Offset to beginning of the attribute name. */
768- XML_Index nameEnd; /* Offset after the attribute name's last byte. */
769- XML_Index valueStart; /* Offset to beginning of the attribute value. */
770- XML_Index valueEnd; /* Offset after the attribute value's last byte. */
771- } XML_AttrInfo;
772-
773- /* Returns an array of XML_AttrInfo structures for the attribute/value pairs
774- passed in last call to the XML_StartElementHandler that were specified
775- in the start-tag rather than defaulted. Each attribute/value pair counts
776- as 1; thus the number of entries in the array is
777- XML_GetSpecifiedAttributeCount(parser) / 2.
778- */
779- XMLPARSEAPI (const XML_AttrInfo *)
780- XML_GetAttributeInfo (XML_Parser parser);
781- # endif
782-
783780/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
784781 detected. The last call to XML_Parse must have isFinal true; len
785782 may be zero for this call (or any other).
@@ -964,15 +961,24 @@ XML_GetErrorCode(XML_Parser parser);
964961 return 0 to indicate an error.
965962 Note: XML_GetCurrentByteIndex returns -1 to indicate an error.
966963*/
964+ XML_ATTR_DEPRECATED (" please use XML_GetCurrentLineNumber64 instead" )
967965XMLPARSEAPI (XML_Size) XML_GetCurrentLineNumber(XML_Parser parser);
966+ XMLPARSEAPI (uint64_t ) XML_GetCurrentLineNumber64(XML_Parser parser);
967+ XML_ATTR_DEPRECATED (" please use XML_GetCurrentColumnNumber64 instead" )
968968XMLPARSEAPI (XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser);
969+ XMLPARSEAPI (uint64_t ) XML_GetCurrentColumnNumber64(XML_Parser parser);
970+ XML_ATTR_DEPRECATED (" please use XML_GetCurrentByteIndex64 instead" )
969971XMLPARSEAPI (XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);
972+ XMLPARSEAPI (int64_t ) XML_GetCurrentByteIndex64(XML_Parser parser);
970973
971974/* Return the number of bytes in the current event.
972975 Returns 0 if the event is in an internal entity.
973976*/
977+ XML_ATTR_DEPRECATED (" please use XML_GetCurrentByteCount64 instead" )
974978XMLPARSEAPI (int )
975979XML_GetCurrentByteCount (XML_Parser parser);
980+ XMLPARSEAPI (uint64_t )
981+ XML_GetCurrentByteCount64 (XML_Parser parser);
976982
977983/* If XML_CONTEXT_BYTES is >=1, returns the input buffer, sets
978984 the integer pointed to by offset to the offset within this buffer
@@ -984,8 +990,11 @@ XML_GetCurrentByteCount(XML_Parser parser);
984990 NOTE: The character pointer returned should not be used outside
985991 the handler that makes the call.
986992*/
993+ XML_ATTR_DEPRECATED (" please use XML_GetInputContext64 instead" )
987994XMLPARSEAPI (const char *)
988995XML_GetInputContext (XML_Parser parser, int *offset, int *size);
996+ XMLPARSEAPI (const char *)
997+ XML_GetInputContext64 (XML_Parser parser, int64_t *offset, uint64_t *size);
989998
990999/* For backwards compatibility with previous versions. */
9911000# define XML_GetErrorLineNumber XML_GetCurrentLineNumber
@@ -1040,14 +1049,15 @@ enum XML_FeatureEnum {
10401049 XML_FEATURE_UNICODE_WCHAR_T ,
10411050 XML_FEATURE_DTD ,
10421051 XML_FEATURE_CONTEXT_BYTES ,
1052+ /* Added in Expat 1.95.5, removed in Expat 2.9.0. */
10431053 XML_FEATURE_MIN_SIZE ,
10441054 XML_FEATURE_SIZEOF_XML_CHAR ,
10451055 XML_FEATURE_SIZEOF_XML_LCHAR ,
10461056 /* Added in Expat 2.0.0. */
10471057 XML_FEATURE_NS ,
10481058 /* Added in Expat 2.0.1. */
10491059 XML_FEATURE_LARGE_SIZE ,
1050- /* Added in Expat 2.1.0. */
1060+ /* Added in Expat 2.1.0, removed in Expat 2.9.0 . */
10511061 XML_FEATURE_ATTR_INFO ,
10521062 /* Added in Expat 2.4.0. */
10531063 XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT ,
@@ -1069,6 +1079,41 @@ typedef struct {
10691079XMLPARSEAPI (const XML_Feature *)
10701080XML_GetFeatureList (void );
10711081
1082+ /* Added in Expat 2.9.0. */
1083+ enum XML_Parser_Property {
1084+ # if defined(XML_TESTING)
1085+ XML_PROP_INVALID = 0 ,
1086+ # endif
1087+ # if XML_GE == 1
1088+ XML_PROP_ALLOC_TRACKER_ACTIVATION_THRESHOLD = 1 , // of type `uint64_t`
1089+ XML_PROP_ALLOC_TRACKER_MAXIMUM_AMPLIFICATION = 2 , // of type `double`
1090+ XML_PROP_BILLION_LAUGHS_ACTIVATION_THRESHOLD = 3 , // of type `uint64_t`
1091+ XML_PROP_BILLION_LAUGHS_MAXIMUM_AMPLIFICATION = 4 , // of type `double`
1092+ # endif
1093+ XML_PROP_REPARSE_DEFERRAL_ENABLED = 5 , // of type `XML_Bool`
1094+ /* more properties upcoming here */
1095+ };
1096+
1097+ /* Added in Expat 2.9.0. */
1098+ XMLPARSEAPI (enum XML_Prop_Error)
1099+ XML_GetPropertyBool (XML_Parser parser, enum XML_Parser_Property property,
1100+ XML_Bool *value);
1101+ XMLPARSEAPI (enum XML_Prop_Error)
1102+ XML_GetPropertyDouble (XML_Parser parser, enum XML_Parser_Property property,
1103+ double *value);
1104+ XMLPARSEAPI (enum XML_Prop_Error)
1105+ XML_GetPropertyUInt64 (XML_Parser parser, enum XML_Parser_Property property,
1106+ uint64_t *value);
1107+ XMLPARSEAPI (enum XML_Prop_Error)
1108+ XML_SetPropertyBool (XML_Parser parser, enum XML_Parser_Property property,
1109+ XML_Bool value);
1110+ XMLPARSEAPI (enum XML_Prop_Error)
1111+ XML_SetPropertyDouble (XML_Parser parser, enum XML_Parser_Property property,
1112+ double value);
1113+ XMLPARSEAPI (enum XML_Prop_Error)
1114+ XML_SetPropertyUInt64 (XML_Parser parser, enum XML_Parser_Property property,
1115+ uint64_t value);
1116+
10721117# if defined(XML_DTD) || (defined(XML_GE) && XML_GE == 1)
10731118/* Added in Expat 2.4.0 for XML_DTD defined and
10741119 * added in Expat 2.6.0 for XML_GE == 1. */
@@ -1101,8 +1146,8 @@ XML_SetReparseDeferralEnabled(XML_Parser parser, XML_Bool enabled);
11011146 See https://semver.org
11021147*/
11031148# define XML_MAJOR_VERSION 2
1104- # define XML_MINOR_VERSION 8
1105- # define XML_MICRO_VERSION 5
1149+ # define XML_MINOR_VERSION 9
1150+ # define XML_MICRO_VERSION 0
11061151
11071152# ifdef __cplusplus
11081153}
0 commit comments