xref: /freebsd/contrib/expat/xmlwf/filemap.h (revision 6b2c1e49da284f28ec7b52f7c031474087e37104)
10a48773fSEric van Gyzen /*
20a48773fSEric van Gyzen                             __  __            _
30a48773fSEric van Gyzen                          ___\ \/ /_ __   __ _| |_
40a48773fSEric van Gyzen                         / _ \\  /| '_ \ / _` | __|
50a48773fSEric van Gyzen                        |  __//  \| |_) | (_| | |_
60a48773fSEric van Gyzen                         \___/_/\_\ .__/ \__,_|\__|
70a48773fSEric van Gyzen                                  |_| XML parser
80a48773fSEric van Gyzen 
90a48773fSEric van Gyzen    Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
100a48773fSEric van Gyzen    Copyright (c) 2000-2017 Expat development team
110a48773fSEric van Gyzen    Licensed under the MIT license:
120a48773fSEric van Gyzen 
130a48773fSEric van Gyzen    Permission is  hereby granted,  free of charge,  to any  person obtaining
140a48773fSEric van Gyzen    a  copy  of  this  software   and  associated  documentation  files  (the
150a48773fSEric van Gyzen    "Software"),  to  deal in  the  Software  without restriction,  including
160a48773fSEric van Gyzen    without  limitation the  rights  to use,  copy,  modify, merge,  publish,
170a48773fSEric van Gyzen    distribute, sublicense, and/or sell copies of the Software, and to permit
180a48773fSEric van Gyzen    persons  to whom  the Software  is  furnished to  do so,  subject to  the
190a48773fSEric van Gyzen    following conditions:
200a48773fSEric van Gyzen 
210a48773fSEric van Gyzen    The above copyright  notice and this permission notice  shall be included
220a48773fSEric van Gyzen    in all copies or substantial portions of the Software.
230a48773fSEric van Gyzen 
240a48773fSEric van Gyzen    THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT  WARRANTY  OF  ANY  KIND,
250a48773fSEric van Gyzen    EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF
260a48773fSEric van Gyzen    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
270a48773fSEric van Gyzen    NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
280a48773fSEric van Gyzen    DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR
290a48773fSEric van Gyzen    OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
300a48773fSEric van Gyzen    USE OR OTHER DEALINGS IN THE SOFTWARE.
315bb6a25fSPoul-Henning Kamp */
325bb6a25fSPoul-Henning Kamp 
330a48773fSEric van Gyzen #include <limits.h> /* INT_MAX */
345bb6a25fSPoul-Henning Kamp #include <stddef.h>
355bb6a25fSPoul-Henning Kamp 
360a48773fSEric van Gyzen /* The following limit (for XML_Parse's int len) derives from
370a48773fSEric van Gyzen  * this loop in xmparse.c:
380a48773fSEric van Gyzen  *
390a48773fSEric van Gyzen  *    do {
400a48773fSEric van Gyzen  *      bufferSize = (int) (2U * (unsigned) bufferSize);
410a48773fSEric van Gyzen  *    } while (bufferSize < neededSize && bufferSize > 0);
420a48773fSEric van Gyzen  */
430a48773fSEric van Gyzen #define XML_MAX_CHUNK_LEN (INT_MAX / 2 + 1)
440a48773fSEric van Gyzen 
455bb6a25fSPoul-Henning Kamp #ifdef XML_UNICODE
465bb6a25fSPoul-Henning Kamp int filemap(const wchar_t *name,
47*6b2c1e49SXin LI             void (*processor)(const void *, size_t, const wchar_t *, void *arg),
485bb6a25fSPoul-Henning Kamp             void *arg);
495bb6a25fSPoul-Henning Kamp #else
505bb6a25fSPoul-Henning Kamp int filemap(const char *name,
51*6b2c1e49SXin LI             void (*processor)(const void *, size_t, const char *, void *arg),
525bb6a25fSPoul-Henning Kamp             void *arg);
535bb6a25fSPoul-Henning Kamp #endif
54