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 10*cc68614dSXin LI Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> 11*cc68614dSXin LI Copyright (c) 2002 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> 12*cc68614dSXin LI Copyright (c) 2016-2017 Sebastian Pipping <sebastian@pipping.org> 130a48773fSEric van Gyzen Licensed under the MIT license: 140a48773fSEric van Gyzen 150a48773fSEric van Gyzen Permission is hereby granted, free of charge, to any person obtaining 160a48773fSEric van Gyzen a copy of this software and associated documentation files (the 170a48773fSEric van Gyzen "Software"), to deal in the Software without restriction, including 180a48773fSEric van Gyzen without limitation the rights to use, copy, modify, merge, publish, 190a48773fSEric van Gyzen distribute, sublicense, and/or sell copies of the Software, and to permit 200a48773fSEric van Gyzen persons to whom the Software is furnished to do so, subject to the 210a48773fSEric van Gyzen following conditions: 220a48773fSEric van Gyzen 230a48773fSEric van Gyzen The above copyright notice and this permission notice shall be included 240a48773fSEric van Gyzen in all copies or substantial portions of the Software. 250a48773fSEric van Gyzen 260a48773fSEric van Gyzen THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 270a48773fSEric van Gyzen EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 280a48773fSEric van Gyzen MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 290a48773fSEric van Gyzen NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 300a48773fSEric van Gyzen DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 310a48773fSEric van Gyzen OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 320a48773fSEric van Gyzen USE OR OTHER DEALINGS IN THE SOFTWARE. 335bb6a25fSPoul-Henning Kamp */ 345bb6a25fSPoul-Henning Kamp 350a48773fSEric van Gyzen #include <limits.h> /* INT_MAX */ 365bb6a25fSPoul-Henning Kamp #include <stddef.h> 375bb6a25fSPoul-Henning Kamp 380a48773fSEric van Gyzen /* The following limit (for XML_Parse's int len) derives from 390a48773fSEric van Gyzen * this loop in xmparse.c: 400a48773fSEric van Gyzen * 410a48773fSEric van Gyzen * do { 420a48773fSEric van Gyzen * bufferSize = (int) (2U * (unsigned) bufferSize); 430a48773fSEric van Gyzen * } while (bufferSize < neededSize && bufferSize > 0); 440a48773fSEric van Gyzen */ 450a48773fSEric van Gyzen #define XML_MAX_CHUNK_LEN (INT_MAX / 2 + 1) 460a48773fSEric van Gyzen 475bb6a25fSPoul-Henning Kamp #ifdef XML_UNICODE 485bb6a25fSPoul-Henning Kamp int filemap(const wchar_t *name, 496b2c1e49SXin LI void (*processor)(const void *, size_t, const wchar_t *, void *arg), 505bb6a25fSPoul-Henning Kamp void *arg); 515bb6a25fSPoul-Henning Kamp #else 525bb6a25fSPoul-Henning Kamp int filemap(const char *name, 536b2c1e49SXin LI void (*processor)(const void *, size_t, const char *, void *arg), 545bb6a25fSPoul-Henning Kamp void *arg); 555bb6a25fSPoul-Henning Kamp #endif 56