2 * Copyright 2015 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 WS_XML_WRITER_ENCODING_TYPE encoding
;
30 void *ws_alloc( WS_HEAP
*, SIZE_T
) DECLSPEC_HIDDEN
;
31 void *ws_alloc_zero( WS_HEAP
*, SIZE_T
) DECLSPEC_HIDDEN
;
32 void *ws_realloc( WS_HEAP
*, void *, SIZE_T
, SIZE_T
) DECLSPEC_HIDDEN
;
33 void *ws_realloc_zero( WS_HEAP
*, void *, SIZE_T
, SIZE_T
) DECLSPEC_HIDDEN
;
34 void ws_free( WS_HEAP
*, void *, SIZE_T
) DECLSPEC_HIDDEN
;
35 struct xmlbuf
*alloc_xmlbuf( WS_HEAP
*, WS_XML_WRITER_ENCODING_TYPE
, WS_CHARSET
) DECLSPEC_HIDDEN
;
36 void free_xmlbuf( struct xmlbuf
* ) DECLSPEC_HIDDEN
;
40 WS_XML_DICTIONARY dict
;
44 struct dictionary dict_builtin DECLSPEC_HIDDEN
;
45 const struct dictionary dict_builtin_static DECLSPEC_HIDDEN
;
47 ULONG
format_bool( const BOOL
*, unsigned char * ) DECLSPEC_HIDDEN
;
48 ULONG
format_int8( const INT8
*, unsigned char * ) DECLSPEC_HIDDEN
;
49 ULONG
format_int16( const INT16
*, unsigned char * ) DECLSPEC_HIDDEN
;
50 ULONG
format_int32( const INT32
*, unsigned char * ) DECLSPEC_HIDDEN
;
51 ULONG
format_int64( const INT64
*, unsigned char * ) DECLSPEC_HIDDEN
;
52 ULONG
format_uint64( const UINT64
*, unsigned char * ) DECLSPEC_HIDDEN
;
53 ULONG
format_double( const double *, unsigned char * ) DECLSPEC_HIDDEN
;
54 ULONG
format_datetime( const WS_DATETIME
*, unsigned char * ) DECLSPEC_HIDDEN
;
55 ULONG
format_guid( const GUID
*, unsigned char * ) DECLSPEC_HIDDEN
;
56 ULONG
format_urn( const GUID
*, unsigned char * ) DECLSPEC_HIDDEN
;
58 const char *debugstr_xmlstr( const WS_XML_STRING
* ) DECLSPEC_HIDDEN
;
59 WS_XML_STRING
*alloc_xml_string( const unsigned char *, ULONG
) DECLSPEC_HIDDEN
;
60 WS_XML_STRING
*dup_xml_string( const WS_XML_STRING
* ) DECLSPEC_HIDDEN
;
61 HRESULT
add_xml_string( WS_XML_STRING
* ) DECLSPEC_HIDDEN
;
62 void free_xml_string( WS_XML_STRING
* ) DECLSPEC_HIDDEN
;
63 WS_XML_UTF8_TEXT
*alloc_utf8_text( const unsigned char *, ULONG
) DECLSPEC_HIDDEN
;
64 HRESULT
append_attribute( WS_XML_ELEMENT_NODE
*, WS_XML_ATTRIBUTE
* ) DECLSPEC_HIDDEN
;
65 void free_attribute( WS_XML_ATTRIBUTE
* ) DECLSPEC_HIDDEN
;
66 WS_TYPE
map_value_type( WS_VALUE_TYPE
) DECLSPEC_HIDDEN
;
67 BOOL
set_fpword( unsigned short, unsigned short * ) DECLSPEC_HIDDEN
;
68 void restore_fpword( unsigned short ) DECLSPEC_HIDDEN
;
69 HRESULT
set_output( WS_XML_WRITER
* ) DECLSPEC_HIDDEN
;
70 ULONG
get_type_size( WS_TYPE
, const WS_STRUCT_DESCRIPTION
* ) DECLSPEC_HIDDEN
;
71 HRESULT
read_header( WS_XML_READER
*, const WS_XML_STRING
*, const WS_XML_STRING
*, WS_TYPE
,
72 const void *, WS_READ_OPTION
, WS_HEAP
*, void *, ULONG
) DECLSPEC_HIDDEN
;
74 #define INVALID_PARAMETER_INDEX 0xffff
75 HRESULT
get_param_desc( const WS_STRUCT_DESCRIPTION
*, USHORT
, const WS_FIELD_DESCRIPTION
** ) DECLSPEC_HIDDEN
;
76 HRESULT
write_input_params( WS_XML_WRITER
*, const WS_ELEMENT_DESCRIPTION
*,
77 const WS_PARAMETER_DESCRIPTION
*, ULONG
, const void ** ) DECLSPEC_HIDDEN
;
78 HRESULT
read_output_params( WS_XML_READER
*, WS_HEAP
*, const WS_ELEMENT_DESCRIPTION
*,
79 const WS_PARAMETER_DESCRIPTION
*, ULONG
, const void ** ) DECLSPEC_HIDDEN
;
83 NODE_FLAG_IGNORE_TRAILING_ELEMENT_CONTENT
= 0x1,
88 WS_XML_ELEMENT_NODE hdr
;
95 struct node
*alloc_node( WS_XML_NODE_TYPE
) DECLSPEC_HIDDEN
;
96 void free_node( struct node
* ) DECLSPEC_HIDDEN
;
97 void destroy_nodes( struct node
* ) DECLSPEC_HIDDEN
;
98 HRESULT
copy_node( WS_XML_READER
*, struct node
** ) DECLSPEC_HIDDEN
;
100 static inline WS_XML_NODE_TYPE
node_type( const struct node
*node
)
102 return node
->hdr
.node
.nodeType
;
105 BOOL
move_to_root_element( struct node
*, struct node
** ) DECLSPEC_HIDDEN
;
106 BOOL
move_to_next_element( struct node
** ) DECLSPEC_HIDDEN
;
107 BOOL
move_to_prev_element( struct node
** ) DECLSPEC_HIDDEN
;
108 BOOL
move_to_child_element( struct node
** ) DECLSPEC_HIDDEN
;
109 BOOL
move_to_end_element( struct node
** ) DECLSPEC_HIDDEN
;
110 BOOL
move_to_parent_element( struct node
** ) DECLSPEC_HIDDEN
;
111 BOOL
move_to_first_node( struct node
** ) DECLSPEC_HIDDEN
;
112 BOOL
move_to_next_node( struct node
** ) DECLSPEC_HIDDEN
;
113 BOOL
move_to_prev_node( struct node
** ) DECLSPEC_HIDDEN
;
114 BOOL
move_to_bof( struct node
*, struct node
** ) DECLSPEC_HIDDEN
;
115 BOOL
move_to_eof( struct node
*, struct node
** ) DECLSPEC_HIDDEN
;
116 BOOL
move_to_child_node( struct node
** ) DECLSPEC_HIDDEN
;
117 BOOL
move_to_parent_node( struct node
** ) DECLSPEC_HIDDEN
;
134 ULONG
prop_size( const struct prop_desc
*, ULONG
) DECLSPEC_HIDDEN
;
135 void prop_init( const struct prop_desc
*, ULONG
, struct prop
*, void * ) DECLSPEC_HIDDEN
;
136 HRESULT
prop_set( const struct prop
*, ULONG
, ULONG
, const void *, ULONG
) DECLSPEC_HIDDEN
;
137 HRESULT
prop_get( const struct prop
*, ULONG
, ULONG
, void *, ULONG
) DECLSPEC_HIDDEN
;
139 HRESULT
message_set_action( WS_MESSAGE
*, const WS_XML_STRING
* ) DECLSPEC_HIDDEN
;
140 void message_set_send_context( WS_MESSAGE
*, const WS_PROXY_MESSAGE_CALLBACK_CONTEXT
* ) DECLSPEC_HIDDEN
;
141 void message_set_receive_context( WS_MESSAGE
*, const WS_PROXY_MESSAGE_CALLBACK_CONTEXT
* ) DECLSPEC_HIDDEN
;
142 void message_do_send_callback( WS_MESSAGE
* ) DECLSPEC_HIDDEN
;
143 void message_do_receive_callback( WS_MESSAGE
* ) DECLSPEC_HIDDEN
;
144 HRESULT
message_insert_http_headers( WS_MESSAGE
*, HINTERNET
) DECLSPEC_HIDDEN
;
146 HRESULT
channel_send_message( WS_CHANNEL
*, WS_MESSAGE
* ) DECLSPEC_HIDDEN
;
147 HRESULT
channel_receive_message( WS_CHANNEL
* ) DECLSPEC_HIDDEN
;
148 HRESULT
channel_get_reader( WS_CHANNEL
*, WS_XML_READER
** ) DECLSPEC_HIDDEN
;
150 HRESULT
parse_url( const WS_STRING
*, WS_URL_SCHEME_TYPE
*, WCHAR
**, USHORT
* ) DECLSPEC_HIDDEN
;
155 RECORD_ENDELEMENT
= 0x01,
156 RECORD_COMMENT
= 0x02,
158 RECORD_SHORT_ATTRIBUTE
= 0x04,
159 RECORD_ATTRIBUTE
= 0x05,
160 RECORD_SHORT_DICTIONARY_ATTRIBUTE
= 0x06,
161 RECORD_DICTIONARY_ATTRIBUTE
= 0x07,
162 RECORD_SHORT_XMLNS_ATTRIBUTE
= 0x08,
163 RECORD_XMLNS_ATTRIBUTE
= 0x09,
164 RECORD_SHORT_DICTIONARY_XMLNS_ATTRIBUTE
= 0x0a,
165 RECORD_DICTIONARY_XMLNS_ATTRIBUTE
= 0x0b,
166 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_A
= 0x0c,
167 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_B
= 0x0d,
168 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_C
= 0x0e,
169 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_D
= 0x0f,
170 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_E
= 0x10,
171 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_F
= 0x11,
172 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_G
= 0x12,
173 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_H
= 0x13,
174 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_I
= 0x14,
175 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_J
= 0x15,
176 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_K
= 0x16,
177 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_L
= 0x17,
178 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_M
= 0x18,
179 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_N
= 0x19,
180 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_O
= 0x1a,
181 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_P
= 0x1b,
182 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_Q
= 0x1c,
183 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_R
= 0x1d,
184 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_S
= 0x1e,
185 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_T
= 0x1f,
186 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_U
= 0x20,
187 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_V
= 0x21,
188 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_W
= 0x22,
189 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_X
= 0x23,
190 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_Y
= 0x24,
191 RECORD_PREFIX_DICTIONARY_ATTRIBUTE_Z
= 0x25,
192 RECORD_PREFIX_ATTRIBUTE_A
= 0x26,
193 RECORD_PREFIX_ATTRIBUTE_B
= 0x27,
194 RECORD_PREFIX_ATTRIBUTE_C
= 0x28,
195 RECORD_PREFIX_ATTRIBUTE_D
= 0x29,
196 RECORD_PREFIX_ATTRIBUTE_E
= 0x2a,
197 RECORD_PREFIX_ATTRIBUTE_F
= 0x2b,
198 RECORD_PREFIX_ATTRIBUTE_G
= 0x2c,
199 RECORD_PREFIX_ATTRIBUTE_H
= 0x2d,
200 RECORD_PREFIX_ATTRIBUTE_I
= 0x2e,
201 RECORD_PREFIX_ATTRIBUTE_J
= 0x2f,
202 RECORD_PREFIX_ATTRIBUTE_K
= 0x30,
203 RECORD_PREFIX_ATTRIBUTE_L
= 0x31,
204 RECORD_PREFIX_ATTRIBUTE_M
= 0x32,
205 RECORD_PREFIX_ATTRIBUTE_N
= 0x33,
206 RECORD_PREFIX_ATTRIBUTE_O
= 0x34,
207 RECORD_PREFIX_ATTRIBUTE_P
= 0x35,
208 RECORD_PREFIX_ATTRIBUTE_Q
= 0x36,
209 RECORD_PREFIX_ATTRIBUTE_R
= 0x37,
210 RECORD_PREFIX_ATTRIBUTE_S
= 0x38,
211 RECORD_PREFIX_ATTRIBUTE_T
= 0x39,
212 RECORD_PREFIX_ATTRIBUTE_U
= 0x3a,
213 RECORD_PREFIX_ATTRIBUTE_V
= 0x3b,
214 RECORD_PREFIX_ATTRIBUTE_W
= 0x3c,
215 RECORD_PREFIX_ATTRIBUTE_X
= 0x3d,
216 RECORD_PREFIX_ATTRIBUTE_Y
= 0x3e,
217 RECORD_PREFIX_ATTRIBUTE_Z
= 0x3f,
218 RECORD_SHORT_ELEMENT
= 0x40,
219 RECORD_ELEMENT
= 0x41,
220 RECORD_SHORT_DICTIONARY_ELEMENT
= 0x42,
221 RECORD_DICTIONARY_ELEMENT
= 0x43,
222 RECORD_PREFIX_DICTIONARY_ELEMENT_A
= 0x44,
223 RECORD_PREFIX_DICTIONARY_ELEMENT_B
= 0x45,
224 RECORD_PREFIX_DICTIONARY_ELEMENT_C
= 0x46,
225 RECORD_PREFIX_DICTIONARY_ELEMENT_D
= 0x47,
226 RECORD_PREFIX_DICTIONARY_ELEMENT_E
= 0x48,
227 RECORD_PREFIX_DICTIONARY_ELEMENT_F
= 0x49,
228 RECORD_PREFIX_DICTIONARY_ELEMENT_G
= 0x4a,
229 RECORD_PREFIX_DICTIONARY_ELEMENT_H
= 0x4b,
230 RECORD_PREFIX_DICTIONARY_ELEMENT_I
= 0x4c,
231 RECORD_PREFIX_DICTIONARY_ELEMENT_J
= 0x4d,
232 RECORD_PREFIX_DICTIONARY_ELEMENT_K
= 0x4e,
233 RECORD_PREFIX_DICTIONARY_ELEMENT_L
= 0x4f,
234 RECORD_PREFIX_DICTIONARY_ELEMENT_M
= 0x50,
235 RECORD_PREFIX_DICTIONARY_ELEMENT_N
= 0x51,
236 RECORD_PREFIX_DICTIONARY_ELEMENT_O
= 0x52,
237 RECORD_PREFIX_DICTIONARY_ELEMENT_P
= 0x53,
238 RECORD_PREFIX_DICTIONARY_ELEMENT_Q
= 0x54,
239 RECORD_PREFIX_DICTIONARY_ELEMENT_R
= 0x55,
240 RECORD_PREFIX_DICTIONARY_ELEMENT_S
= 0x56,
241 RECORD_PREFIX_DICTIONARY_ELEMENT_T
= 0x57,
242 RECORD_PREFIX_DICTIONARY_ELEMENT_U
= 0x58,
243 RECORD_PREFIX_DICTIONARY_ELEMENT_V
= 0x59,
244 RECORD_PREFIX_DICTIONARY_ELEMENT_W
= 0x5a,
245 RECORD_PREFIX_DICTIONARY_ELEMENT_X
= 0x5b,
246 RECORD_PREFIX_DICTIONARY_ELEMENT_Y
= 0x5c,
247 RECORD_PREFIX_DICTIONARY_ELEMENT_Z
= 0x5d,
248 RECORD_PREFIX_ELEMENT_A
= 0x5e,
249 RECORD_PREFIX_ELEMENT_B
= 0x5f,
250 RECORD_PREFIX_ELEMENT_C
= 0x60,
251 RECORD_PREFIX_ELEMENT_D
= 0x61,
252 RECORD_PREFIX_ELEMENT_E
= 0x62,
253 RECORD_PREFIX_ELEMENT_F
= 0x63,
254 RECORD_PREFIX_ELEMENT_G
= 0x64,
255 RECORD_PREFIX_ELEMENT_H
= 0x65,
256 RECORD_PREFIX_ELEMENT_I
= 0x66,
257 RECORD_PREFIX_ELEMENT_J
= 0x67,
258 RECORD_PREFIX_ELEMENT_K
= 0x68,
259 RECORD_PREFIX_ELEMENT_L
= 0x69,
260 RECORD_PREFIX_ELEMENT_M
= 0x6a,
261 RECORD_PREFIX_ELEMENT_N
= 0x6b,
262 RECORD_PREFIX_ELEMENT_O
= 0x6c,
263 RECORD_PREFIX_ELEMENT_P
= 0x6d,
264 RECORD_PREFIX_ELEMENT_Q
= 0x6e,
265 RECORD_PREFIX_ELEMENT_R
= 0x6f,
266 RECORD_PREFIX_ELEMENT_S
= 0x70,
267 RECORD_PREFIX_ELEMENT_T
= 0x71,
268 RECORD_PREFIX_ELEMENT_U
= 0x72,
269 RECORD_PREFIX_ELEMENT_V
= 0x73,
270 RECORD_PREFIX_ELEMENT_W
= 0x74,
271 RECORD_PREFIX_ELEMENT_X
= 0x75,
272 RECORD_PREFIX_ELEMENT_Y
= 0x76,
273 RECORD_PREFIX_ELEMENT_Z
= 0x77,
274 /* 0x78 ... 0x7f reserved */
275 RECORD_ZERO_TEXT
= 0x80,
276 RECORD_ZERO_TEXT_WITH_ENDELEMENT
= 0x81,
277 RECORD_ONE_TEXT
= 0x82,
278 RECORD_ONE_TEXT_WITH_ENDELEMENT
= 0x83,
279 RECORD_FALSE_TEXT
= 0x84,
280 RECORD_FALSE_TEXT_WITH_ENDELEMENT
= 0x85,
281 RECORD_TRUE_TEXT
= 0x86,
282 RECORD_TRUE_TEXT_WITH_ENDELEMENT
= 0x87,
283 RECORD_INT8_TEXT
= 0x88,
284 RECORD_INT8_TEXT_WITH_ENDELEMENT
= 0x89,
285 RECORD_INT16_TEXT
= 0x8a,
286 RECORD_INT16_TEXT_WITH_ENDELEMENT
= 0x8b,
287 RECORD_INT32_TEXT
= 0x8c,
288 RECORD_INT32_TEXT_WITH_ENDELEMENT
= 0x8d,
289 RECORD_INT64_TEXT
= 0x8e,
290 RECORD_INT64_TEXT_WITH_ENDELEMENT
= 0x8f,
291 RECORD_FLOAT_TEXT
= 0x90,
292 RECORD_FLOAT_TEXT_WITH_ENDELEMENT
= 0x91,
293 RECORD_DOUBLE_TEXT
= 0x92,
294 RECORD_DOUBLE_TEXT_WITH_ENDELEMENT
= 0x93,
295 RECORD_DECIMAL_TEXT
= 0x94,
296 RECORD_DECIMAL_TEXT_WITH_ENDELEMENT
= 0x95,
297 RECORD_DATETIME_TEXT
= 0x96,
298 RECORD_DATETIME_TEXT_WITH_ENDELEMENT
= 0x97,
299 RECORD_CHARS8_TEXT
= 0x98,
300 RECORD_CHARS8_TEXT_WITH_ENDELEMENT
= 0x99,
301 RECORD_CHARS16_TEXT
= 0x9a,
302 RECORD_CHARS16_TEXT_WITH_ENDELEMENT
= 0x9b,
303 RECORD_CHARS32_TEXT
= 0x9c,
304 RECORD_CHARS32_TEXT_WITH_ENDELEMENT
= 0x9d,
305 RECORD_BYTES8_TEXT
= 0x9e,
306 RECORD_BYTES8_TEXT_WITH_ENDELEMENT
= 0x9f,
307 RECORD_BYTES16_TEXT
= 0xa0,
308 RECORD_BYTES16_TEXT_WITH_ENDELEMENT
= 0xa1,
309 RECORD_BYTES32_TEXT
= 0xa2,
310 RECORD_BYTES32_TEXT_WITH_ENDELEMENT
= 0xa3,
311 RECORD_STARTLIST_TEXT
= 0xa4,
313 RECORD_ENDLIST_TEXT
= 0xa6,
315 RECORD_EMPTY_TEXT
= 0xa8,
316 RECORD_EMPTY_TEXT_WITH_ENDELEMENT
= 0xa9,
317 RECORD_DICTIONARY_TEXT
= 0xaa,
318 RECORD_DICTIONARY_TEXT_WITH_ENDELEMENT
= 0xab,
319 RECORD_UNIQUEID_TEXT
= 0xac,
320 RECORD_UNIQUEID_TEXT_WITH_ENDELEMENT
= 0xad,
321 RECORD_TIMESPAN_TEXT
= 0xae,
322 RECORD_TIMESPAN_TEXT_WITH_ENDELEMENT
= 0xaf,
323 RECORD_UUID_TEXT
= 0xb0,
324 RECORD_UUID_TEXT_WITH_ENDELEMENT
= 0xb1,
325 RECORD_UINT64_TEXT
= 0xb2,
326 RECORD_UINT64_TEXT_WITH_ENDELEMENT
= 0xb3,
327 RECORD_BOOL_TEXT
= 0xb4,
328 RECORD_BOOL_TEXT_WITH_ENDELEMENT
= 0xb5,
329 RECORD_UNICODE_CHARS8_TEXT
= 0xb6,
330 RECORD_UNICODE_CHARS8_TEXT_WITH_ENDELEMENT
= 0xb7,
331 RECORD_UNICODE_CHARS16_TEXT
= 0xb8,
332 RECORD_UNICODE_CHARS16_TEXT_WITH_ENDELEMENT
= 0xb9,
333 RECORD_UNICODE_CHARS32_TEXT
= 0xba,
334 RECORD_UNICODE_CHARS32_TEXT_WITH_ENDELEMENT
= 0xbb,
335 RECORD_QNAME_DICTIONARY_TEXT
= 0xbc,
336 RECORD_QNAME_DICTIONARY_TEXT_WITH_ENDELEMENT
= 0xbd,
337 /* 0xbe ... 0xff reserved */
340 #define TICKS_PER_SEC 10000000
341 #define TICKS_PER_MIN (60 * (ULONGLONG)TICKS_PER_SEC)
342 #define TICKS_PER_HOUR (3600 * (ULONGLONG)TICKS_PER_SEC)
343 #define TICKS_PER_DAY (86400 * (ULONGLONG)TICKS_PER_SEC)
344 #define TICKS_MAX 3155378975999999999
345 #define TICKS_1601_01_01 504911232000000000
347 static const int month_days
[2][12] =
349 {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
350 {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
353 static inline int leap_year( int year
)
355 return !(year
% 4) && (year
% 100 || !(year
% 400));
358 static inline BOOL
is_nil_value( const char *value
, ULONG size
)
361 for (i
= 0; i
< size
; i
++) if (value
[i
]) return FALSE
;
365 static inline BOOL
is_valid_parent( const struct node
*node
)
367 if (!node
) return FALSE
;
368 return (node_type( node
) == WS_XML_NODE_TYPE_ELEMENT
|| node_type( node
) == WS_XML_NODE_TYPE_BOF
);
371 static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size
)
373 return HeapAlloc(GetProcessHeap(), 0, size
);
376 static inline void* __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t size
)
378 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, size
);
381 static inline void* __WINE_ALLOC_SIZE(2) heap_realloc(void *mem
, size_t size
)
383 return HeapReAlloc(GetProcessHeap(), 0, mem
, size
);
386 static inline void* __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem
, size_t size
)
388 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, mem
, size
);
391 static inline BOOL
heap_free(void *mem
)
393 return HeapFree(GetProcessHeap(), 0, mem
);