From 791fa1050d1f0d751030f1c887612281d06ab8b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C4=83t=C4=83lin=20R=C4=83ceanu?= Date: Mon, 17 Jul 2017 02:52:00 +0300 Subject: [PATCH] Update libexpat to commit 5f1f1f1d98fef39ef885d4271029b4c3fd814a2d, after version 2.2.2 --- src/expat/AUTHORS | 10 + src/expat/CMake.README | 12 +- src/expat/CMakeLists.txt | 53 +- src/expat/COPYING | 2 +- src/expat/Changes | 189 +- src/expat/ConfigureChecks.cmake | 2 +- src/expat/MANIFEST | 62 +- src/expat/Makefile.in | 40 +- src/expat/README | 2 +- src/expat/aclocal.m4 | 4 +- src/expat/amiga/Makefile | 336 -- src/expat/amiga/README.txt | 98 - src/expat/amiga/expat.xml | 264 -- src/expat/amiga/expat_68k.c | 939 ----- src/expat/amiga/expat_68k.h | 94 - src/expat/amiga/expat_68k_handler_stubs.c | 185 - src/expat/amiga/expat_base.h | 40 - src/expat/amiga/expat_lib.c | 247 -- src/expat/amiga/expat_vectors.c | 505 --- src/expat/amiga/include/inline4/expat.h | 94 - src/expat/amiga/include/interfaces/expat.h | 98 - src/expat/amiga/include/libraries/expat.h | 566 --- src/expat/amiga/include/proto/expat.h | 52 - src/expat/amiga/launch.c | 57 - src/expat/bcb5/README.txt | 87 - src/expat/bcb5/all_projects.bpg | 49 - src/expat/bcb5/elements.bpf | 4 - src/expat/bcb5/elements.bpr | 149 - src/expat/bcb5/elements.mak | 186 - src/expat/bcb5/expat.bpf | 6 - src/expat/bcb5/expat.bpr | 140 - src/expat/bcb5/expat.mak | 187 - src/expat/bcb5/expat_static.bpf | 5 - src/expat/bcb5/expat_static.bpr | 143 - src/expat/bcb5/expat_static.mak | 189 - src/expat/bcb5/expatw.bpf | 6 - src/expat/bcb5/expatw.bpr | 146 - src/expat/bcb5/expatw.mak | 187 - src/expat/bcb5/expatw_static.bpf | 5 - src/expat/bcb5/expatw_static.bpr | 152 - src/expat/bcb5/expatw_static.mak | 190 - src/expat/bcb5/libexpat_mtd.def | 141 - src/expat/bcb5/libexpatw_mtd.def | 140 - src/expat/bcb5/makefile.mak | 37 - src/expat/bcb5/outline.bpf | 4 - src/expat/bcb5/outline.bpr | 132 - src/expat/bcb5/outline.mak | 186 - src/expat/bcb5/setup.bat | 9 - src/expat/bcb5/xmlwf.bpf | 7 - src/expat/bcb5/xmlwf.bpr | 136 - src/expat/bcb5/xmlwf.mak | 187 - src/expat/configure | 1218 ++---- src/expat/configure.ac | 121 +- src/expat/conftools/config.guess | 32 +- src/expat/conftools/config.sub | 31 +- src/expat/conftools/get-version.sh | 19 +- src/expat/conftools/install-sh | 4 +- src/expat/doc/reference.html | 2 +- src/expat/examples/elements.c | 6 +- src/expat/examples/outline.c | 4 - src/expat/expat.dsw | 110 - src/expat/expat_config.h.in | 15 +- src/expat/lib/Makefile.MPW | 206 - src/expat/lib/amigaconfig.h | 29 - src/expat/lib/expat.h | 23 +- src/expat/lib/expat_external.h | 12 +- src/expat/lib/siphash.h | 371 ++ src/expat/lib/winconfig.h | 10 + src/expat/lib/xmlparse.c | 711 +++- src/expat/lib/xmlrole.c | 10 +- src/expat/lib/xmltok.c | 34 +- src/expat/m4/libtool.m4 | 13 +- src/expat/tests/benchmark/benchmark.c | 4 - src/expat/tests/benchmark/benchmark.dsw | 44 - src/expat/tests/chardata.h | 2 +- src/expat/tests/memcheck.c | 173 + src/expat/tests/memcheck.h | 34 + src/expat/tests/minicheck.c | 37 +- src/expat/tests/minicheck.h | 5 - src/expat/tests/runtests.c | 4325 +++++++++++++++++++- src/expat/tests/xmltest.sh | 5 +- src/expat/vms/README.vms | 23 - src/expat/vms/descrip.mms | 70 - src/expat/vms/expat_config.h | 52 - src/expat/win32/MANIFEST.txt | 2 - src/expat/win32/README.txt | 21 +- src/expat/win32/expat.iss | 24 +- src/expat/xmlwf/codepage.c | 6 +- src/expat/xmlwf/filemap.h | 12 + src/expat/xmlwf/readfilemap.c | 21 +- src/expat/xmlwf/unixfilemap.c | 4 + src/expat/xmlwf/win32filemap.c | 11 +- src/expat/xmlwf/xmlfile.c | 51 +- src/expat/xmlwf/xmlwf.c | 8 +- src/expat/xmlwf/xmlwin32url.cxx | 10 +- 95 files changed, 6363 insertions(+), 8323 deletions(-) create mode 100644 src/expat/AUTHORS delete mode 100644 src/expat/amiga/Makefile delete mode 100644 src/expat/amiga/README.txt delete mode 100644 src/expat/amiga/expat.xml delete mode 100644 src/expat/amiga/expat_68k.c delete mode 100644 src/expat/amiga/expat_68k.h delete mode 100644 src/expat/amiga/expat_68k_handler_stubs.c delete mode 100644 src/expat/amiga/expat_base.h delete mode 100644 src/expat/amiga/expat_lib.c delete mode 100644 src/expat/amiga/expat_vectors.c delete mode 100644 src/expat/amiga/include/inline4/expat.h delete mode 100644 src/expat/amiga/include/interfaces/expat.h delete mode 100644 src/expat/amiga/include/libraries/expat.h delete mode 100644 src/expat/amiga/include/proto/expat.h delete mode 100644 src/expat/amiga/launch.c delete mode 100644 src/expat/bcb5/README.txt delete mode 100644 src/expat/bcb5/all_projects.bpg delete mode 100644 src/expat/bcb5/elements.bpf delete mode 100644 src/expat/bcb5/elements.bpr delete mode 100644 src/expat/bcb5/elements.mak delete mode 100644 src/expat/bcb5/expat.bpf delete mode 100644 src/expat/bcb5/expat.bpr delete mode 100644 src/expat/bcb5/expat.mak delete mode 100644 src/expat/bcb5/expat_static.bpf delete mode 100644 src/expat/bcb5/expat_static.bpr delete mode 100644 src/expat/bcb5/expat_static.mak delete mode 100644 src/expat/bcb5/expatw.bpf delete mode 100644 src/expat/bcb5/expatw.bpr delete mode 100644 src/expat/bcb5/expatw.mak delete mode 100644 src/expat/bcb5/expatw_static.bpf delete mode 100644 src/expat/bcb5/expatw_static.bpr delete mode 100644 src/expat/bcb5/expatw_static.mak delete mode 100644 src/expat/bcb5/libexpat_mtd.def delete mode 100644 src/expat/bcb5/libexpatw_mtd.def delete mode 100644 src/expat/bcb5/makefile.mak delete mode 100644 src/expat/bcb5/outline.bpf delete mode 100644 src/expat/bcb5/outline.bpr delete mode 100644 src/expat/bcb5/outline.mak delete mode 100644 src/expat/bcb5/setup.bat delete mode 100644 src/expat/bcb5/xmlwf.bpf delete mode 100644 src/expat/bcb5/xmlwf.bpr delete mode 100644 src/expat/bcb5/xmlwf.mak delete mode 100644 src/expat/expat.dsw delete mode 100644 src/expat/lib/Makefile.MPW delete mode 100644 src/expat/lib/amigaconfig.h create mode 100644 src/expat/lib/siphash.h delete mode 100644 src/expat/tests/benchmark/benchmark.dsw create mode 100644 src/expat/tests/memcheck.c create mode 100644 src/expat/tests/memcheck.h delete mode 100644 src/expat/vms/README.vms delete mode 100644 src/expat/vms/descrip.mms delete mode 100644 src/expat/vms/expat_config.h diff --git a/src/expat/AUTHORS b/src/expat/AUTHORS new file mode 100644 index 0000000000..99475bb1b2 --- /dev/null +++ b/src/expat/AUTHORS @@ -0,0 +1,10 @@ +Expat is brought to you by: + +Clark Cooper +Fred L. Drake, Jr. +Greg Stein +James Clark +Karl Waclawek +Rhodri James +Sebastian Pipping +Steven Solie diff --git a/src/expat/CMake.README b/src/expat/CMake.README index 0340c680dc..35ee90cc39 100755 --- a/src/expat/CMake.README +++ b/src/expat/CMake.README @@ -3,25 +3,25 @@ The cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual Studio) and should work on all other platform cmake supports. -Assuming ~/expat-2.2.0 is the source directory of expat, add a subdirectory +Assuming ~/expat-2.2.2 is the source directory of expat, add a subdirectory build and change into that directory: -~/expat-2.2.0$ mkdir build && cd build -~/expat-2.2.0/build$ +~/expat-2.2.2$ mkdir build && cd build +~/expat-2.2.2/build$ From that directory, call cmake first, then call make, make test and make install in the usual way: -~/expat-2.2.0/build$ cmake .. +~/expat-2.2.2/build$ cmake .. -- The C compiler identification is GNU -- The CXX compiler identification is GNU .... -- Configuring done -- Generating done --- Build files have been written to: /home/patrick/expat-2.2.0/build +-- Build files have been written to: /home/patrick/expat-2.2.2/build If you want to specify the install location for your files, append -DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call. -~/expat-2.2.0/build$ make && make test && make install +~/expat-2.2.2/build$ make && make test && make install Scanning dependencies of target expat [ 5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o [ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o diff --git a/src/expat/CMakeLists.txt b/src/expat/CMakeLists.txt index 8180408105..2d145383a6 100755 --- a/src/expat/CMakeLists.txt +++ b/src/expat/CMakeLists.txt @@ -6,7 +6,7 @@ project(expat) cmake_minimum_required(VERSION 2.6) set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org") set(PACKAGE_NAME "expat") -set(PACKAGE_VERSION "2.2.0") +set(PACKAGE_VERSION "2.2.2") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}") @@ -14,6 +14,8 @@ option(BUILD_tools "build the xmlwf tool for expat library" ON) option(BUILD_examples "build the examples for expat library" ON) option(BUILD_tests "build the tests for expat library" ON) option(BUILD_shared "build a shared expat library" ON) +option(BUILD_doc "build man page for xmlwf" ON) +option(INSTALL "install expat files in cmake install target" ON) # configuration options set(XML_CONTEXT_BYTES 1024 CACHE STRING "Define to specify how much context to retain around the current parse point") @@ -35,22 +37,27 @@ if(BUILD_tests) enable_testing() endif(BUILD_tests) -include(ConfigureChecks.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/ConfigureChecks.cmake) -include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib) +set(EXTRA_LINK_AND_COMPILE_FLAGS "-fno-strict-aliasing") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${EXTRA_LINK_AND_COMPILE_FLAGS}") + +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib) if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996) endif(MSVC) if(WIN32) - add_definitions(-DWIN32) set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Add a suffix, usually d on Windows") endif(WIN32) set(expat_SRCS lib/xmlparse.c lib/xmlrole.c - lib/xmltok.c - lib/xmltok_impl.c + lib/xmltok.c + lib/xmltok_impl.c lib/xmltok_ns.c ) @@ -69,7 +76,7 @@ endif(BUILD_shared) add_library(expat ${_SHARED} ${expat_SRCS}) set(LIBCURRENT 7) # sync -set(LIBREVISION 2) # with +set(LIBREVISION 4) # with set(LIBAGE 6) # configure.ac! math(EXPR LIBCURRENT_MINUS_AGE "${LIBCURRENT} - ${LIBAGE}") @@ -79,7 +86,13 @@ if(NOT WIN32) set_property(TARGET expat PROPERTY NO_SONAME ${NO_SONAME}) endif(NOT WIN32) -install(TARGETS expat RUNTIME DESTINATION bin +macro(expat_install) + if(INSTALL) + install(${ARGN}) + endif() +endmacro() + +expat_install(TARGETS expat RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) @@ -89,11 +102,8 @@ set(libdir "\${prefix}/lib") set(includedir "\${prefix}/include") configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc) -install(FILES lib/expat.h lib/expat_external.h DESTINATION include) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig) - - -add_custom_command(TARGET expat PRE_BUILD COMMAND $(MAKE) -C doc xmlwf.1) +expat_install(FILES lib/expat.h lib/expat_external.h DESTINATION include) +expat_install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig) if(BUILD_tools AND NOT WINCE) set(xmlwf_SRCS @@ -106,8 +116,17 @@ if(BUILD_tools AND NOT WINCE) add_executable(xmlwf ${xmlwf_SRCS}) set_property(TARGET xmlwf PROPERTY RUNTIME_OUTPUT_DIRECTORY xmlwf) target_link_libraries(xmlwf expat) - install(TARGETS xmlwf DESTINATION bin) - install(FILES doc/xmlwf.1 DESTINATION share/man/man1) + expat_install(TARGETS xmlwf DESTINATION bin) + if(BUILD_doc AND NOT MSVC) + if(CMAKE_GENERATOR STREQUAL "Unix Makefiles") + set(make_command "$(MAKE)") + else() + set(make_command "make") + endif() + + add_custom_command(TARGET expat PRE_BUILD COMMAND "${make_command}" -C "${PROJECT_SOURCE_DIR}/doc" xmlwf.1) + expat_install(FILES "${PROJECT_SOURCE_DIR}/doc/xmlwf.1" DESTINATION share/man/man1) + endif() endif(BUILD_tools AND NOT WINCE) if(BUILD_examples) @@ -122,12 +141,12 @@ endif(BUILD_examples) if(BUILD_tests) ## these are unittests that can be run on any platform - add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c) + add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c tests/memcheck.c) set_property(TARGET runtests PROPERTY RUNTIME_OUTPUT_DIRECTORY tests) target_link_libraries(runtests expat) add_test(runtests tests/runtests) - add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c) + add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c tests/memcheck.c) set_property(TARGET runtestspp PROPERTY RUNTIME_OUTPUT_DIRECTORY tests) target_link_libraries(runtestspp expat) add_test(runtestspp tests/runtestspp) diff --git a/src/expat/COPYING b/src/expat/COPYING index 092c83baee..8d288f0f28 100644 --- a/src/expat/COPYING +++ b/src/expat/COPYING @@ -1,5 +1,5 @@ Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper -Copyright (c) 2001-2016 Expat maintainers +Copyright (c) 2001-2017 Expat maintainers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/src/expat/Changes b/src/expat/Changes index 583c868576..bc5bc4f3eb 100644 --- a/src/expat/Changes +++ b/src/expat/Changes @@ -1,3 +1,181 @@ +NOTE: We are looking for help with a few things: + https://github.com/libexpat/libexpat/labels/help%20wanted + If you can help, please get in touch. Thanks! + +Release 2.2.? ???????????????? + Other changes: + #23 Test suite: Fix memory leaks + + Special thanks to: + Rhodri James + and + Core Infrastructure Initiative + +Release 2.2.2 Wed July 12 2017 + Security fixes: + #43 Protect against compilation without any source of high + quality entropy enabled, e.g. with CMake build system; + commit ff0207e6076e9828e536b8d9cd45c9c92069b895 + #60 Windows with _UNICODE: + Unintended use of LoadLibraryW with a non-wide string + resulted in failure to load advapi32.dll and degradation + in quality of used entropy when compiled with _UNICODE for + Windows; you can launch existing binaries with + EXPAT_ENTROPY_DEBUG=1 in the environment to inspect the + quality of entropy used during runtime; commits + * 95b95032f907ef1cd17ee7a9a1768010a825d61d + * 73a5a2e9c081f49f2d775cf7ced864158b68dc80 + [MOX-006] Fix non-NULL parser parameter validation in XML_Parse; + resulted in NULL dereference, previously; + commit ac256dafdffc9622ab0dc2c62fcecb0dfcfa71fe + + Bug fixes: + #69 Fix improper use of unsigned long long integer literals + + Other changes: + #73 Start requiring a C99 compiler + #49 Fix "==" Bashism in configure script + #50 Fix too eager getrandom detection for Debian GNU/kFreeBSD + #52 and macOS + #51 Address lack of stdint.h in Visual Studio 2003 to 2008 + #58 Address compile warnings + #68 Fix "./buildconf.sh && ./configure" for some versions + of Dash for /bin/sh + #72 CMake: Ease use of Expat in context of a parent project + with multipe CMakeLists.txt files + #72 CMake: Resolve mistaken executable permissions + #76 Address compile warning with -DNDEBUG (not recommended!) + #77 Address compile warning about macro redefinition + + Special thanks to: + Alexander Bluhm + Ben Boeckel + Cătălin Răceanu + Kerin Millar + László Böszörményi + S. P. Zeidler + Segev Finer + Václav Slavík + Victor Stinner + Viktor Szakats + and + Radically Open Security + +Release 2.2.1 Sat June 17 2017 + Security fixes: + CVE-2017-9233 -- External entity infinite loop DoS + Details: https://libexpat.github.io/doc/cve-2017-9233/ + Commit c4bf96bb51dd2a1b0e185374362ee136fe2c9d7f + [MOX-002] CVE-2016-9063 -- Detect integer overflow; commit + d4f735b88d9932bd5039df2335eefdd0723dbe20 + (Fixed version of existing downstream patches!) + (SF.net) #539 Fix regression from fix to CVE-2016-0718 cutting off + longer tag names; commits + * 896b6c1fd3b842f377d1b62135dccf0a579cf65d + * af507cef2c93cb8d40062a0abe43a4f4e9158fb2 + #16 * 0dbbf43fdb20f593ddf4fa1ff67288000dd4a7fd + #25 More integer overflow detection (function poolGrow); commits + * 810b74e4703dcfdd8f404e3cb177d44684775143 + * 44178553f3539ce69d34abee77a05e879a7982ac + [MOX-002] Detect overflow from len=INT_MAX call to XML_Parse; commits + * 4be2cb5afcc018d996f34bbbce6374b7befad47f + * 7e5b71b748491b6e459e5c9a1d090820f94544d8 + [MOX-005] #30 Use high quality entropy for hash initialization: + * arc4random_buf on BSD, systems with libbsd + (when configured with --with-libbsd), CloudABI + * RtlGenRandom on Windows XP / Server 2003 and later + * getrandom on Linux 3.17+ + In a way, that's still part of CVE-2016-5300. + https://github.com/libexpat/libexpat/pull/30/commits + [MOX-005] For the low quality entropy extraction fallback code, + the parser instance address can no longer leak, commit + 04ad658bd3079dd15cb60fc67087900f0ff4b083 + [MOX-003] Prevent use of uninitialised variable; commit + [MOX-004] a4dc944f37b664a3ca7199c624a98ee37babdb4b + Add missing parameter validation to public API functions + and dedicated error code XML_ERROR_INVALID_ARGUMENT: + [MOX-006] * NULL checks; commits + * d37f74b2b7149a3a95a680c4c4cd2a451a51d60a (merge/many) + * 9ed727064b675b7180c98cb3d4f75efba6966681 + * 6a747c837c50114dfa413994e07c0ba477be4534 + * Negative length (XML_Parse); commit + [MOX-002] 70db8d2538a10f4c022655d6895e4c3e78692e7f + [MOX-001] #35 Change hash algorithm to William Ahern's version of SipHash + to go further with fixing CVE-2012-0876. + https://github.com/libexpat/libexpat/pull/39/commits + + Bug fixes: + #32 Fix sharing of hash salt across parsers; + relevant where XML_ExternalEntityParserCreate is called + prior to XML_Parse, in particular (e.g. FBReader) + #28 xmlwf: Auto-disable use of memory-mapping (and parsing + as a single chunk) for files larger than ~1 GB (2^30 bytes) + rather than failing with error "out of memory" + #3 Fix double free after malloc failure in DTD code; commit + 7ae9c3d3af433cd4defe95234eae7dc8ed15637f + #17 Fix memory leak on parser error for unbound XML attribute + prefix with new namespaces defined in the same tag; + found by Google's OSS-Fuzz; commits + * 16f87daae5a16132e479e4f71862128c7a915c73 + * b47dbc9745932c160893d433220e462bd605f8cd + xmlwf on Windows: Add missing calls to CloseHandle + + New features: + #30 Introduced environment switch EXPAT_ENTROPY_DEBUG=1 + for runtime debugging of entropy extraction + + Other changes: + Increase code coverage + #33 Reject use of XML_UNICODE_WCHAR_T with sizeof(wchar_t) != 2; + XML_UNICODE_WCHAR_T was never meant to be used outside + of Windows; 4-byte wchar_t is common on Linux + (SF.net) #538 Start using -fno-strict-aliasing + (SF.net) #540 Support compilation against cloudlibc of CloudABI + Allow MinGW cross-compilation + (SF.net) #534 CMake: Introduce option "BUILD_doc" (enabled by default) + to bypass compilation of the xmlwf.1 man page + (SF.net) pr2 CMake: Introduce option "INSTALL" (enabled by default) + to bypass installation of expat files + CMake: Fix ninja support + Autotools: Add parameters --enable-xml-context [COUNT] + and --disable-xml-context; default of context of 1024 + bytes enabled unchanged + #14 Drop AmigaOS 4.x code and includes + #14 Drop ancient build systems: + * Borland C++ Builder + * OpenVMS + * Open Watcom + * Visual Studio 6.0 + * Pre-X Mac OS (MPW Makefile) + If you happen to rely on some of these, please get in + touch for joining with maintenance. + #10 Move from WIN32 to _WIN32 + #13 Fix "make run-xmltest" order instability + Address compile warnings + Bump version info from 7:2:6 to 7:3:6 + Add AUTHORS file + + Infrastructure: + #1 Migrate from SourceForge to GitHub (except downloads): + https://github.com/libexpat/ + #1 Re-create http://libexpat.org/ project website + Start utilizing Travis CI + + Special thanks to: + Andy Wang + Don Lewis + Ed Schouten + Karl Waclawek + Pascal Cuoq + Rhodri James + Sergei Nikulov + Tobias Taschner + Viktor Szakats + and + Core Infrastructure Initiative + Mozilla Foundation (MOSS Track 3: Secure Open Source) + Radically Open Security + Release 2.2.0 Tue June 21 2016 Security fixes: #537 CVE-2016-0718 -- Fix crash on malformed input @@ -63,24 +241,25 @@ Release 2.1.1 Sat March 12 2016 libtool now invoked with --verbose Release 2.1.0 Sat March 24 2012 + - Security fixes: + #2958794: CVE-2012-1148 - Memory leak in poolGrow. + #2895533: CVE-2012-1147 - Resource leak in readfilemap.c. + #3496608: CVE-2012-0876 - Hash DOS attack. + #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8(). + #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences. - Bug Fixes: #1742315: Harmful XML_ParserCreateNS suggestion. - #2895533: CVE-2012-1147 - Resource leak in readfilemap.c. #1785430: Expat build fails on linux-amd64 with gcc version>=4.1 -O3. #1983953, 2517952, 2517962, 2649838: Build modifications using autoreconf instead of buildconf.sh. #2815947, #2884086: OBJEXT and EXEEXT support while building. - #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences. #2517938: xmlwf should return non-zero exit status if not well-formed. #2517946: Wrong statement about XMLDecl in xmlwf.1 and xmlwf.sgml. #2855609: Dangling positionPtr after error. - #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8(). - #2958794: CVE-2012-1148 - Memory leak in poolGrow. #2990652: CMake support. #3010819: UNEXPECTED_STATE with a trailing "%" in entity value. #3206497: Unitialized memory returned from XML_Parse. #3287849: make check fails on mingw-w64. - #3496608: CVE-2012-0876 - Hash DOS attack. - Patches: #1749198: pkg-config support. #3010222: Fix for bug #3010819. diff --git a/src/expat/ConfigureChecks.cmake b/src/expat/ConfigureChecks.cmake index f03faa637d..057cfa58d6 100644 --- a/src/expat/ConfigureChecks.cmake +++ b/src/expat/ConfigureChecks.cmake @@ -40,5 +40,5 @@ else(HAVE_SYS_TYPES_H) set(SIZE_T "unsigned") endif(HAVE_SYS_TYPES_H) -configure_file(expat_config.h.cmake expat_config.h) +configure_file(expat_config.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/expat_config.h") add_definitions(-DHAVE_EXPAT_CONFIG_H) diff --git a/src/expat/MANIFEST b/src/expat/MANIFEST index afb9acacdf..c8479ed0a2 100644 --- a/src/expat/MANIFEST +++ b/src/expat/MANIFEST @@ -1,44 +1,4 @@ -amiga/launch.c -amiga/expat_68k.c -amiga/expat_68k.h -amiga/expat_68k_handler_stubs.c -amiga/expat_base.h -amiga/expat_vectors.c -amiga/expat_lib.c -amiga/expat.xml -amiga/README.txt -amiga/Makefile -amiga/include/proto/expat.h -amiga/include/libraries/expat.h -amiga/include/interfaces/expat.h -amiga/include/inline4/expat.h -bcb5/README.txt -bcb5/all_projects.bpg -bcb5/elements.bpf -bcb5/elements.bpr -bcb5/elements.mak -bcb5/expat.bpf -bcb5/expat.bpr -bcb5/expat.mak -bcb5/expat_static.bpf -bcb5/expat_static.bpr -bcb5/expat_static.mak -bcb5/expatw.bpf -bcb5/expatw.bpr -bcb5/expatw.mak -bcb5/expatw_static.bpf -bcb5/expatw_static.bpr -bcb5/expatw_static.mak -bcb5/libexpat_mtd.def -bcb5/libexpatw_mtd.def -bcb5/makefile.mak -bcb5/outline.bpf -bcb5/outline.bpr -bcb5/outline.mak -bcb5/setup.bat -bcb5/xmlwf.bpf -bcb5/xmlwf.bpr -bcb5/xmlwf.mak +AUTHORS doc/expat.png doc/reference.html doc/style.css @@ -58,8 +18,8 @@ configure.ac expat_config.h.in expat_config.h.cmake expat.pc.in -expat.dsw aclocal.m4 +run.sh.in conftools/PrintPath conftools/ac_c_bigendian_cross.m4 conftools/expat.m4 @@ -75,26 +35,18 @@ m4/ltoptions.m4 m4/ltsugar.m4 m4/lt~obsolete.m4 examples/elements.c -examples/elements.dsp examples/outline.c -examples/outline.dsp -lib/Makefile.MPW -lib/amigaconfig.h lib/ascii.h lib/asciitab.h -lib/expat.dsp lib/expat.h lib/expat_external.h -lib/expat_static.dsp -lib/expatw.dsp -lib/expatw_static.dsp lib/iasciitab.h lib/internal.h lib/latin1tab.h lib/libexpat.def lib/libexpatw.def -lib/macconfig.h lib/nametab.h +lib/siphash.h lib/utf8tab.h lib/winconfig.h lib/xmlparse.c @@ -107,19 +59,16 @@ lib/xmltok_impl.h lib/xmltok_ns.c tests/benchmark/README.txt tests/benchmark/benchmark.c -tests/benchmark/benchmark.dsp -tests/benchmark/benchmark.dsw tests/README.txt tests/chardata.c tests/chardata.h +tests/memcheck.c +tests/memcheck.h tests/minicheck.c tests/minicheck.h tests/runtests.c tests/runtestspp.cpp tests/xmltest.sh -vms/README.vms -vms/descrip.mms -vms/expat_config.h win32/MANIFEST.txt win32/README.txt win32/expat.iss @@ -137,5 +86,4 @@ xmlwf/xmlmime.h xmlwf/xmltchar.h xmlwf/xmlurl.h xmlwf/xmlwf.c -xmlwf/xmlwf.dsp xmlwf/xmlwin32url.cxx diff --git a/src/expat/Makefile.in b/src/expat/Makefile.in index 3310aa9aae..76f77b17f8 100644 --- a/src/expat/Makefile.in +++ b/src/expat/Makefile.in @@ -57,8 +57,8 @@ clean: cd lib && rm -f $(LIBRARY) *.@OBJEXT@ *.lo && rm -rf .libs _libs cd xmlwf && rm -f xmlwf *.@OBJEXT@ *.lo && rm -rf .libs _libs cd examples && rm -f elements outline *.@OBJEXT@ *.lo && rm -rf .libs _libs - cd tests && rm -rf .libs runtests runtests.@OBJEXT@ runtestspp runtestspp.@OBJEXT@ - cd tests && rm -f chardata.@OBJEXT@ minicheck.@OBJEXT@ + cd tests && rm -rf .libs runtests@EXEEXT@ runtests.@OBJEXT@ runtestspp@EXEEXT@ runtestspp.@OBJEXT@ + cd tests && rm -f chardata.@OBJEXT@ memcheck.@OBJEXT@ minicheck.@OBJEXT@ rm -rf .libs libexpat.la rm -f examples/core tests/core xmlwf/core @@ -73,9 +73,9 @@ extraclean: distclean rm -f aclocal.m4 m4/* rm -f conftools/ltmain.sh conftools/install-sh conftools/config.guess conftools/config.sub -check: tests/runtests tests/runtestspp - tests/runtests - tests/runtestspp +check: tests/runtests@EXEEXT@ tests/runtestspp@EXEEXT@ + ./run.sh tests/runtests@EXEEXT@ + ./run.sh tests/runtestspp@EXEEXT@ $(MANFILE): $(MAKE) -C doc xmlwf.1 @@ -124,7 +124,7 @@ LTFLAGS = --verbose COMPILE = $(CC) $(INCLUDES) $(CFLAGS) $(DEFS) $(CPPFLAGS) CXXCOMPILE = $(CXX) $(INCLUDES) $(CXXFLAGS) $(DEFS) $(CPPFLAGS) LTCOMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -LINK_LIB = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -no-undefined $(VSNFLAG) -rpath $(libdir) $(LDFLAGS) -o $@ +LINK_LIB = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -no-undefined $(VSNFLAG) -rpath $(libdir) $(LDFLAGS) @LIBS@ -o $@ LINK_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LDFLAGS) -o $@ LINK_CXX_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(CXXCOMPILE) $(LDFLAGS) -o $@ @@ -135,7 +135,7 @@ $(LIBRARY): $(LIB_OBJS) expat.pc: $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $@ -lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \ +lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/siphash.h lib/xmlrole.h lib/xmltok.h \ $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h lib/xmlrole.lo: lib/xmlrole.c lib/ascii.h lib/xmlrole.h \ @@ -151,7 +151,7 @@ XMLWF_OBJS = xmlwf/xmlwf.@OBJEXT@ xmlwf/xmlfile.@OBJEXT@ xmlwf/codepage.@OBJEXT@ xmlwf/xmlwf.@OBJEXT@: xmlwf/xmlwf.c xmlwf/xmlfile.@OBJEXT@: xmlwf/xmlfile.c xmlwf/codepage.@OBJEXT@: xmlwf/codepage.c -xmlwf/@FILEMAP@.@OBJEXT@: xmlwf/@FILEMAP@.c +xmlwf/@FILEMAP@.@OBJEXT@: xmlwf/@FILEMAP@.c xmlwf/filemap.h xmlwf/xmlwf@EXEEXT@: $(XMLWF_OBJS) $(LIBRARY) $(LINK_EXE) $(XMLWF_OBJS) $(LIBRARY) @@ -165,12 +165,13 @@ examples/outline: examples/outline.@OBJEXT@ $(LIBRARY) tests/chardata.@OBJEXT@: tests/chardata.c tests/chardata.h tests/minicheck.@OBJEXT@: tests/minicheck.c tests/minicheck.h -tests/runtests.@OBJEXT@: tests/runtests.c tests/chardata.h -tests/runtests: tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) - $(LINK_EXE) tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) -tests/runtestspp.@OBJEXT@: tests/runtestspp.cpp tests/runtests.c tests/chardata.h -tests/runtestspp: tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) - $(LINK_CXX_EXE) tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) +tests/memcheck.@OBJEXT@: tests/memcheck.c tests/memcheck.h +tests/runtests.@OBJEXT@: tests/runtests.c tests/chardata.h tests/memcheck.h lib/siphash.h +tests/runtests@EXEEXT@: tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ tests/memcheck.@OBJEXT@ $(LIBRARY) + $(LINK_EXE) tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ tests/memcheck.@OBJEXT@ $(LIBRARY) +tests/runtestspp.@OBJEXT@: tests/runtestspp.cpp tests/runtests.c tests/chardata.h tests/memcheck.h +tests/runtestspp@EXEEXT@: tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ tests/memcheck.@OBJEXT@ $(LIBRARY) + $(LINK_CXX_EXE) tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ tests/memcheck.@OBJEXT@ $(LIBRARY) tests/benchmark/benchmark.@OBJEXT@: tests/benchmark/benchmark.c tests/benchmark/benchmark: tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY) @@ -180,14 +181,19 @@ run-benchmark: tests/benchmark/benchmark tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3 tests/xmlts.zip: - wget --output-document=tests/xmlts.zip \ - http://www.w3.org/XML/Test/xmlts20080827.zip + if test "$(XMLTS_ZIP)" = ""; then \ + wget --output-document=tests/xmlts.zip \ + https://www.w3.org/XML/Test/xmlts20080827.zip; \ + else \ + cp $(XMLTS_ZIP) tests/xmlts.zip; \ + fi tests/xmlconf: tests/xmlts.zip cd tests && unzip -q xmlts.zip run-xmltest: xmlwf/xmlwf@EXEEXT@ tests/xmlconf - tests/xmltest.sh 2>&1 | tee tests/xmltest.log + tests/xmltest.sh "$(PWD)/run.sh $(PWD)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee tests/xmltest.log + dos2unix tests/xmltest.log diff -u tests/xmltest.log.expected tests/xmltest.log .PHONY: qa diff --git a/src/expat/README b/src/expat/README index a7d28450d5..c86018f4aa 100644 --- a/src/expat/README +++ b/src/expat/README @@ -1,5 +1,5 @@ - Expat, Release 2.2.0 + Expat, Release 2.2.2 This is Expat, a C library for parsing XML, written by James Clark. Expat is a stream-oriented XML parser. This means that you register diff --git a/src/expat/aclocal.m4 b/src/expat/aclocal.m4 index eba9be3e3a..210610f5ea 100644 --- a/src/expat/aclocal.m4 +++ b/src/expat/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.15.1 -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/src/expat/amiga/Makefile b/src/expat/amiga/Makefile deleted file mode 100644 index c6d1261998..0000000000 --- a/src/expat/amiga/Makefile +++ /dev/null @@ -1,336 +0,0 @@ -# -# Makefile for AmigaOS -# - -.PHONY: help all check clean package -.PHONY: clib2 newlib library so - -vpath %.c ../lib ../examples ../xmlwf ../tests ../tests/benchmark -vpath %.h ../lib ../tests - -############################################################################# - -help: - @echo "Requires:" - @echo " AmigaOS 4.x" - @echo " SDK 53.13" - @echo "" - @echo "Targets:" - @echo " all - make libraries, xmlwf, examples and runs tests" - @echo " install - install expat libraries and tools into SDK" - @echo " clean - clean object files" - @echo " check - run all the tests" - @echo " package - prepare distribution archive" - -all: clib2 newlib library so check - -clib2: clib2/libexpat.a clib2/xmlwf clib2/elements clib2/outline clib2/runtests clib2/benchmark - -newlib: newlib/libexpat.a newlib/xmlwf newlib/elements newlib/outline newlib/runtests newlib/benchmark - -library: libs/expat.library libs/xmlwf libs/elements libs/outline libs/runtests libs/benchmark - -so: so/libexpat.so so/xmlwf so/elements so/outline so/runtests so/benchmark - -check: clib2/runtests newlib/runtests libs/runtests so/runtests - clib2/runtests - newlib/runtests - libs/runtests - so/runtests - -clean: - -delete clib2/#?.o quiet - -delete newlib/#?.o quiet - -delete libs/#?.o quiet - -delete so/#?.o quiet - -package: - $(MAKE) all - -delete T:expat all force quiet - makedir all T:expat/Workbench/Libs - copy clone libs/expat.library T:expat/Workbench/Libs - makedir all T:expat/Workbench/SObjs - copy clone so/libexpat.so T:expat/Workbench/SObjs - makedir all T:expat/SDK/Local/C - copy clone libs/xmlwf T:expat/SDK/Local/C - makedir all T:expat/SDK/Local/clib2/lib - copy clone clib2/libexpat.a T:expat/SDK/Local/clib2/lib - makedir all T:expat/SDK/Local/newlib/lib - copy clone newlib/libexpat.a T:expat/SDK/Local/newlib/lib - makedir all T:expat/SDK/Local/common/include - copy clone /lib/expat.h /lib/expat_external.h T:expat/SDK/Local/common/include - makedir all T:expat/SDK/Include/include_h/inline4 - copy clone include/inline4/expat.h T:expat/SDK/Include/include_h/inline4 - makedir all T:expat/SDK/Include/include_h/interfaces - copy clone include/interfaces/expat.h T:expat/SDK/Include/include_h/interfaces - makedir all T:expat/SDK/Include/include_h/libraries - copy clone include/libraries/expat.h T:expat/SDK/Include/include_h/libraries - makedir all T:expat/SDK/Include/include_h/proto - copy clone include/proto/expat.h T:expat/SDK/Include/include_h/proto - makedir all T:expat/SDK/Documentation/Libs/Expat - copy clone /COPYING T:expat/SDK/Documentation/Libs/Expat - copy clone /README T:expat/SDK/Documentation/Libs/Expat - copy clone README.txt T:expat/SDK/Documentation/Libs/Expat/README.AmigaOS - -delete expat.lha - lha -r a expat.lha T:expat - -############################################################################# - -CC := gcc -LIBTOOL := ar -STRIP := strip - -CFLAGS := -DNDEBUG -O3 -LTFLAGS := -crs -STRIPFLAGS := -R.comment - -############################################################################# - -clib2/libexpat.a: clib2/xmlparse.o clib2/xmltok.o clib2/xmlrole.o - $(LIBTOOL) $(LTFLAGS) $@ $^ - protect $@ -e - -clib2/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \ - expat_external.h internal.h amigaconfig.h - -clib2/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \ - internal.h amigaconfig.h - -clib2/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \ - iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \ - expat_external.h internal.h amigaconfig.h - -############################################################################# - -clib2/xmlwf: clib2/xmlwf.o clib2/xmlfile.o clib2/codepage.o clib2/readfilemap.o - $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -clib2/xmlwf.o: xmlwf.c - -clib2/xmlfile.o: xmlfile.c - -clib2/codepage.o: codepage.c - -clib2/readfilemap.o: readfilemap.c - -############################################################################# - -clib2/elements: clib2/elements.o - $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -clib2/elements.o: elements.c - -############################################################################# - -clib2/outline: clib2/outline.o - $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -clib2/outline.o: outline.c - -############################################################################# - -clib2/runtests: clib2/runtests.o clib2/chardata.o clib2/minicheck.o - $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a - -clib2/chardata.o: chardata.c chardata.h - -clib2/minicheck.o: minicheck.c minicheck.h - -clib2/runtests.o: runtests.c chardata.h - -############################################################################# - -clib2/benchmark: clib2/benchmark.o - $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a -lm - -clib2/benchmark.o: benchmark.c - -############################################################################# - -newlib/libexpat.a: newlib/xmlparse.o newlib/xmltok.o newlib/xmlrole.o - $(LIBTOOL) $(LTFLAGS) $@ $^ - protect $@ -e - -newlib/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \ - expat_external.h internal.h amigaconfig.h - -newlib/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \ - internal.h amigaconfig.h - -newlib/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \ - iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \ - expat_external.h internal.h amigaconfig.h - -############################################################################# - -newlib/xmlwf: newlib/xmlwf.o newlib/xmlfile.o newlib/codepage.o newlib/readfilemap.o - $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -newlib/xmlwf.o: xmlwf.c - -newlib/xmlfile.o: xmlfile.c - -newlib/codepage.o: codepage.c - -newlib/readfilemap.o: readfilemap.c - -############################################################################# - -newlib/elements: newlib/elements.o - $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -newlib/elements.o: elements.c - -############################################################################# - -newlib/outline: newlib/outline.o - $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -newlib/outline.o: outline.c - -############################################################################# - -newlib/runtests: newlib/runtests.o newlib/chardata.o newlib/minicheck.o - $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a - -newlib/chardata.o: chardata.c chardata.h - -newlib/minicheck.o: minicheck.c minicheck.h - -newlib/runtests.o: runtests.c chardata.h - -############################################################################# - -newlib/benchmark: newlib/benchmark.o - $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a - -newlib/benchmark.o: benchmark.c - -############################################################################# - -libs/expat.library: libs/expat_lib.o libs/expat_68k.o libs/expat_68k_handler_stubs.o libs/expat_vectors.o newlib/libexpat.a - $(CC) -mcrt=newlib -nostartfiles $^ -o $@ newlib/libexpat.a -Wl,--cref,-M,-Map=$@.map - protect $@ -e - $(STRIP) $(STRIPFLAGS) $@ - -libs/expat_lib.o: expat_lib.c expat_base.h - -libs/expat_68k.o: expat_68k.c expat_68k.h expat_base.h - -libs/expat_68k_handler_stubs.o: expat_68k_handler_stubs.c expat_68k.h - -libs/expat_vectors.o: expat_vectors.c - -libs/launch.o: launch.c - -############################################################################# - -libs/xmlwf: libs/xmlwf.o libs/xmlfile.o libs/codepage.o libs/readfilemap.o libs/launch.o - $(CC) -mcrt=newlib $^ -o $@ - $(STRIP) $(STRIPFLAGS) $@ - -libs/xmlwf.o: xmlwf.c - -libs/xmlfile.o: xmlfile.c - -libs/codepage.o: codepage.c - -libs/readfilemap.o: readfilemap.c - -############################################################################# - -libs/elements: libs/elements.o libs/launch.o - $(CC) -mcrt=newlib $^ -o $@ - $(STRIP) $(STRIPFLAGS) $@ - -libs/elements.o: elements.c - -############################################################################# - -libs/outline: libs/outline.o libs/launch.o - $(CC) -mcrt=newlib $^ -o $@ - $(STRIP) $(STRIPFLAGS) $@ - -libs/outline.o: outline.c - -############################################################################# - -libs/runtests: libs/runtests.o libs/chardata.o libs/minicheck.o libs/launch.o - $(CC) -mcrt=newlib $^ -o $@ - -libs/chardata.o: chardata.c chardata.h - -libs/minicheck.o: minicheck.c minicheck.h - -libs/runtests.o: runtests.c chardata.h - -############################################################################# - -libs/benchmark: libs/benchmark.o libs/launch.o - $(CC) -mcrt=newlib $^ -o $@ - -libs/benchmark.o: benchmark.c - -############################################################################# - -so/libexpat.so: so/xmlparse.o so/xmltok.o so/xmlrole.o - $(CC) -mcrt=newlib -shared -o $@ $^ - protect $@ -e - -so/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \ - expat_external.h internal.h amigaconfig.h - -so/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \ - internal.h amigaconfig.h - -so/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \ - iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \ - expat_external.h internal.h amigaconfig.h - -############################################################################# - -so/xmlwf: newlib/xmlwf.o newlib/xmlfile.o newlib/codepage.o newlib/readfilemap.o - $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat - $(STRIP) $(STRIPFLAGS) $@ - -############################################################################# - -so/elements: newlib/elements.o - $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat - $(STRIP) $(STRIPFLAGS) $@ - -############################################################################# - -so/outline: newlib/outline.o - $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat - $(STRIP) $(STRIPFLAGS) $@ - -############################################################################# - -so/runtests: newlib/runtests.o newlib/chardata.o newlib/minicheck.o - $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat - -############################################################################# - -so/benchmark: newlib/benchmark.o - $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat - -############################################################################# - -clib2/%.o: %.c - $(CC) -mcrt=clib2 $(CFLAGS) -I../lib -c $< -o $@ - -newlib/%.o: %.c - $(CC) -mcrt=newlib $(CFLAGS) -I../lib -c $< -o $@ - -libs/%.o: %.c - $(CC) -mcrt=newlib $(CFLAGS) -D__USE_INLINE__ -I. -Iinclude -Iinclude/libraries -I../lib -c $< -o $@ - -so/%.o: %.c - $(CC) -mcrt=newlib $(CFLAGS) -fPIC -I../lib -c $< -o $@ diff --git a/src/expat/amiga/README.txt b/src/expat/amiga/README.txt deleted file mode 100644 index 3ba9267ef8..0000000000 --- a/src/expat/amiga/README.txt +++ /dev/null @@ -1,98 +0,0 @@ -SUMMARY -======= -This is a port of expat for AmigaOS 4.x which includes the -SDK, some XML tools and the libraries. - -Four library flavours are supported: -1. static clib2 (libexpat.a) -2. static newlib (libexpat.a) -3. AmigaOS library (expat.library) -4. AmigaOS shared object library (libexpat.so) - -The AmigaOS library version is based on the work of Fredrik Wikstrom. - - -BUILDING -======== -To build all the library flavours, all the tools, examples and run the -test suite, simply type 'make all' in the amiga subdirectory. - - -INSTALLATION -============ -To install expat into the standard AmigaOS SDK type 'make install' -in the amiga subdirectory. - - -CONFIGURATION -============= -You may want to edit the lib/amigaconfig.h file to remove -DTD and/or XML namespace support if they are not required by your -specific application for a smaller and faster implementation. - - -SOURCE CODE -=========== -The source code is actively maintained and merged with the official -Expat repository available at http://expat.sourceforge.net/ - - -HISTORY -======= -53.1 - bumped version to match AmigaOS streaming - - modified to remove all global variables (except INewLib) - - removed replacements for malloc(), etc. which are now - handled by the respective C library - - compiled with the latest binutils which bumps the - AMIGAOS_DYNVERSION to 2 for the libexpat.so target - - now strips the expat.library binary - -5.2 - fixed XML_Parse 68k stub which enables xmlviewer to work - without crashing - - added some new functions to the 68k jump table available - in the latest expat.library for AmigaOS 3.x - - patches provided by Fredrik Wikstrom - -5.1 - fixed package archive which was missing libexpat.so - - fixed library protection bits - - fixed up copyright notices - -5.0 - integrated 68k patches from Fredrik Wikstrom which means - expat.library is now callable from 68k code - - bumped version for the addition of the 68k interface so - executables can explicitly ask for version 5 and know - it includes the 68k interface - - refactored Makefile to avoid recursive make calls and - build all the library flavours - - added static newlib version - - added shared objects version - - added package target to Makefile - - compiled with SDK 53.13 (GCC 4.2.4) at -O3 - -4.2 - updated to correspond to Expat 2.0.1 release - - bumped copyright banners and versions - - simplified amigaconfig.h - - updated include/libraries/expat.h file - - modified launch.c to use contructor/deconstructor - - removed need for amiga_main() from expat utilities - -4.1 - fixed memory freeing bug in shared library version - - now allocates shared memory - -4.0 - updated for corresponding Expat 2.0 release - - some minor CVS related changes - -3.1 - removed obsolete sfd file - - added library description xml file - - refactored Makefile - - removed extraneous VARARGS68K keywords - - reworked default memory handling functions in shared lib - - updated amigaconfig.h - -3.0 - initial release - - based on expat 1.95.8 - - -TO DO -===== -- wide character support (UTF-16) diff --git a/src/expat/amiga/expat.xml b/src/expat/amiga/expat.xml deleted file mode 100644 index d6aeae2e3a..0000000000 --- a/src/expat/amiga/expat.xml +++ /dev/null @@ -1,264 +0,0 @@ - - - - - libraries/expat.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/expat/amiga/expat_68k.c b/src/expat/amiga/expat_68k.c deleted file mode 100644 index aa4c6e2706..0000000000 --- a/src/expat/amiga/expat_68k.c +++ /dev/null @@ -1,939 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -/* -** Note: This file was originally automatically generated by fdtrans. -*/ - -#ifdef __USE_INLINE__ -#undef __USE_INLINE__ -#endif - -#include -#include -#include -#include -#include -#include "expat_68k.h" -#include "expat_base.h" - - -STATIC ULONG stub_OpenPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct LibraryManagerInterface *Self = (struct LibraryManagerInterface *) ExtLib->ILibrary; - - return (ULONG) Self->Open(0); -} -struct EmuTrap stub_Open = { TRAPINST, TRAPTYPE, stub_OpenPPC }; - -STATIC ULONG stub_ClosePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct LibraryManagerInterface *Self = (struct LibraryManagerInterface *) ExtLib->ILibrary; - - return (ULONG) Self->Close(); -} -struct EmuTrap stub_Close = { TRAPINST, TRAPTYPE, stub_ClosePPC }; - -STATIC ULONG stub_ExpungePPC(ULONG *regarray) -{ - return 0UL; -} -struct EmuTrap stub_Expunge = { TRAPINST, TRAPTYPE, stub_ExpungePPC }; - -STATIC ULONG stub_ReservedPPC(ULONG *regarray) -{ - return 0UL; -} -struct EmuTrap stub_Reserved = { TRAPINST, TRAPTYPE, stub_ReservedPPC }; - -static M68kXML_Parser stub_XML_ParserCreatePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; - - M68kXML_Parser p; - p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); - if (p) { - p->p = Self->XML_ParserCreate((const XML_Char *)regarray[8]); - if (p->p) { - p->IExec = IExec; - Self->XML_SetUserData(p->p, p); - return p; - } - IExec->FreeVec(p); - } - return NULL; -} -struct EmuTrap stub_XML_ParserCreate = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreatePPC }; - -static M68kXML_Parser stub_XML_ParserCreateNSPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; - - M68kXML_Parser p; - p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); - if (p) { - p->p = Self->XML_ParserCreateNS((const XML_Char *)regarray[8], (XML_Char)regarray[0]); - if (p->p) { - p->IExec = IExec; - Self->XML_SetUserData(p->p, p); - return p; - } - IExec->FreeVec(p); - } - return NULL; -} -struct EmuTrap stub_XML_ParserCreateNS = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreateNSPPC }; - -static M68kXML_Parser stub_XML_ParserCreate_MMPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; - - M68kXML_Parser p; - p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); - if (p) { - p->p = Self->XML_ParserCreate_MM((const XML_Char *)regarray[8], - (const XML_Memory_Handling_Suite *)regarray[9], - (const XML_Char *)regarray[10]); - if (p->p) { - p->IExec = IExec; - Self->XML_SetUserData(p->p, p); - return p; - } - IExec->FreeVec(p); - } - return NULL; -} -struct EmuTrap stub_XML_ParserCreate_MM = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreate_MMPPC }; - -static M68kXML_Parser stub_XML_ExternalEntityParserCreatePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; - - M68kXML_Parser p; - p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); - if (p) { - p->p = Self->XML_ExternalEntityParserCreate((XML_Parser)regarray[8], - (const XML_Char *)regarray[9], (const XML_Char *)regarray[10]); - if (p->p) { - p->IExec = IExec; - Self->XML_SetUserData(p->p, p); - return p; - } - IExec->FreeVec(p); - } - return NULL; -} -struct EmuTrap stub_XML_ExternalEntityParserCreate = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExternalEntityParserCreatePPC }; - -static void stub_XML_ParserFreePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - if (p) { - Self->XML_ParserFree(p->p); - IExec->FreeVec(p); - } -} -struct EmuTrap stub_XML_ParserFree = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserFreePPC }; - -static int stub_XML_ParsePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_SetUserData(p->p, p); - return Self->XML_Parse(p->p, (const char *)regarray[9], (int)regarray[0], (int)regarray[1]); -} -struct EmuTrap stub_XML_Parse = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParsePPC }; - -static int stub_XML_ParseBufferPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_ParseBuffer(p->p, (int)regarray[0], (int)regarray[1]); -} -struct EmuTrap stub_XML_ParseBuffer = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParseBufferPPC }; - -static void * stub_XML_GetBufferPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetBuffer(p->p, (int)regarray[0]); -} -struct EmuTrap stub_XML_GetBuffer = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetBufferPPC }; - -static void stub_XML_SetStartElementHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startelementhandler = (void *)regarray[9]; - Self->XML_SetStartElementHandler(p->p, _68k_startelementhandler); -} -struct EmuTrap stub_XML_SetStartElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartElementHandlerPPC }; - -static void stub_XML_SetEndElementHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->endelementhandler = (void *)regarray[9]; - Self->XML_SetEndElementHandler(p->p, _68k_endelementhandler); -} -struct EmuTrap stub_XML_SetEndElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndElementHandlerPPC }; - -static void stub_XML_SetElementHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startelementhandler = (void *)regarray[9]; - p->endelementhandler = (void *)regarray[10]; - Self->XML_SetElementHandler(p->p, _68k_startelementhandler, _68k_endelementhandler); -} -struct EmuTrap stub_XML_SetElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetElementHandlerPPC }; - -static void stub_XML_SetCharacterDataHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->chardatahandler = (void *)regarray[9]; - Self->XML_SetCharacterDataHandler(p->p, _68k_chardatahandler); -} -struct EmuTrap stub_XML_SetCharacterDataHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCharacterDataHandlerPPC }; - -static void stub_XML_SetProcessingInstructionHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->procinsthandler = (void *)regarray[9]; - Self->XML_SetProcessingInstructionHandler(p->p, _68k_procinsthandler); -} -struct EmuTrap stub_XML_SetProcessingInstructionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetProcessingInstructionHandlerPPC }; - -static void stub_XML_SetCommentHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->commenthandler = (void *)regarray[9]; - Self->XML_SetCommentHandler(p->p, _68k_commenthandler); -} -struct EmuTrap stub_XML_SetCommentHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCommentHandlerPPC }; - -static void stub_XML_SetStartCdataSectionHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startcdatahandler = (void *)regarray[9]; - Self->XML_SetStartCdataSectionHandler(p->p, _68k_startcdatahandler); -} -struct EmuTrap stub_XML_SetStartCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartCdataSectionHandlerPPC }; - -static void stub_XML_SetEndCdataSectionHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->endcdatahandler = (void *)regarray[9]; - Self->XML_SetEndCdataSectionHandler(p->p, _68k_endcdatahandler); -} -struct EmuTrap stub_XML_SetEndCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndCdataSectionHandlerPPC }; - -static void stub_XML_SetCdataSectionHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startcdatahandler = (void *)regarray[9]; - p->endcdatahandler = (void *)regarray[10]; - Self->XML_SetCdataSectionHandler(p->p, _68k_startcdatahandler, _68k_endcdatahandler); -} -struct EmuTrap stub_XML_SetCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCdataSectionHandlerPPC }; - -static void stub_XML_SetDefaultHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->defaulthandler = (void *)regarray[9]; - Self->XML_SetDefaultHandler(p->p, _68k_defaulthandler); -} -struct EmuTrap stub_XML_SetDefaultHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDefaultHandlerPPC }; - -static void stub_XML_SetDefaultHandlerExpandPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->defaulthandlerexp = (void *)regarray[9]; - Self->XML_SetDefaultHandlerExpand(p->p, _68k_defaulthandlerexp); -} -struct EmuTrap stub_XML_SetDefaultHandlerExpand = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDefaultHandlerExpandPPC }; - -static void stub_XML_SetExternalEntityRefHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->extentrefhandler = (void *)regarray[9]; - Self->XML_SetExternalEntityRefHandler(p->p, _68k_extentrefhandler); -} -struct EmuTrap stub_XML_SetExternalEntityRefHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetExternalEntityRefHandlerPPC }; - -static void stub_XML_SetExternalEntityRefHandlerArgPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->extenthandlerarg = (void *)regarray[9]; -} -struct EmuTrap stub_XML_SetExternalEntityRefHandlerArg = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetExternalEntityRefHandlerArgPPC }; - -static void stub_XML_SetUnknownEncodingHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->unknownenchandler = (void *)regarray[9]; - p->enchandlerarg = (void *)regarray[10]; - Self->XML_SetUnknownEncodingHandler(p->p, _68k_unknownenchandler, p); -} -struct EmuTrap stub_XML_SetUnknownEncodingHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUnknownEncodingHandlerPPC }; - -static void stub_XML_SetStartNamespaceDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startnamespacehandler = (void *)regarray[9]; - Self->XML_SetStartNamespaceDeclHandler(p->p, _68k_startnamespacehandler); -} -struct EmuTrap stub_XML_SetStartNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartNamespaceDeclHandlerPPC }; - -static void stub_XML_SetEndNamespaceDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->endnamespacehandler = (void *)regarray[9]; - Self->XML_SetEndNamespaceDeclHandler(p->p, _68k_endnamespacehandler); -} -struct EmuTrap stub_XML_SetEndNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndNamespaceDeclHandlerPPC }; - -static void stub_XML_SetNamespaceDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startnamespacehandler = (void *)regarray[9]; - p->endnamespacehandler = (void *)regarray[10]; - Self->XML_SetNamespaceDeclHandler(p->p, _68k_startnamespacehandler, _68k_endnamespacehandler); -} -struct EmuTrap stub_XML_SetNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNamespaceDeclHandlerPPC }; - -static void stub_XML_SetXmlDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->xmldeclhandler = (void *)regarray[9]; - Self->XML_SetXmlDeclHandler(p->p, _68k_xmldeclhandler); -} -struct EmuTrap stub_XML_SetXmlDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetXmlDeclHandlerPPC }; - -static void stub_XML_SetStartDoctypeDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startdoctypehandler = (void *)regarray[9]; - Self->XML_SetStartDoctypeDeclHandler(p->p, _68k_startdoctypehandler); -} -struct EmuTrap stub_XML_SetStartDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartDoctypeDeclHandlerPPC }; - -static void stub_XML_SetEndDoctypeDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->enddoctypehandler = (void *)regarray[9]; - Self->XML_SetEndDoctypeDeclHandler(p->p, _68k_enddoctypehandler); -} -struct EmuTrap stub_XML_SetEndDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndDoctypeDeclHandlerPPC }; - -static void stub_XML_SetDoctypeDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startdoctypehandler = (void *)regarray[9]; - p->enddoctypehandler = (void *)regarray[10]; - Self->XML_SetDoctypeDeclHandler(p->p, _68k_startdoctypehandler, _68k_enddoctypehandler); -} -struct EmuTrap stub_XML_SetDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDoctypeDeclHandlerPPC }; - -static void stub_XML_SetElementDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->elementdeclhandler = (void *)regarray[9]; - Self->XML_SetElementDeclHandler(p->p, _68k_elementdeclhandler); -} -struct EmuTrap stub_XML_SetElementDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetElementDeclHandlerPPC }; - -static void stub_XML_SetAttlistDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->attlistdeclhandler = (void *)regarray[9]; - Self->XML_SetAttlistDeclHandler(p->p, _68k_attlistdeclhandler); -} -struct EmuTrap stub_XML_SetAttlistDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetAttlistDeclHandlerPPC }; - -static void stub_XML_SetEntityDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->entitydeclhandler = (void *)regarray[9]; - Self->XML_SetEntityDeclHandler(p->p, _68k_entitydeclhandler); -} -struct EmuTrap stub_XML_SetEntityDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEntityDeclHandlerPPC }; - -static void stub_XML_SetUnparsedEntityDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->unparseddeclhandler = (void *)regarray[9]; - Self->XML_SetUnparsedEntityDeclHandler(p->p, _68k_unparseddeclhandler); -} -struct EmuTrap stub_XML_SetUnparsedEntityDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUnparsedEntityDeclHandlerPPC }; - -static void stub_XML_SetNotationDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->notationdeclhandler = (void *)regarray[9]; - Self->XML_SetNotationDeclHandler(p->p, _68k_notationdeclhandler); -} -struct EmuTrap stub_XML_SetNotationDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNotationDeclHandlerPPC }; - -static void stub_XML_SetNotStandaloneHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->notstandalonehandler = (void *)regarray[9]; - Self->XML_SetNotStandaloneHandler(p->p, _68k_notstandalonehandler); -} -struct EmuTrap stub_XML_SetNotStandaloneHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNotStandaloneHandlerPPC }; - -static int stub_XML_GetErrorCodePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetErrorCode(p->p); -} -struct EmuTrap stub_XML_GetErrorCode = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetErrorCodePPC }; - -static const XML_LChar * stub_XML_ErrorStringPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - return Self->XML_ErrorString((int)regarray[0]); -} -struct EmuTrap stub_XML_ErrorString = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ErrorStringPPC }; - -static long stub_XML_GetCurrentByteIndexPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetCurrentByteIndex(p->p); -} -struct EmuTrap stub_XML_GetCurrentByteIndex = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentByteIndexPPC }; - -static int stub_XML_GetCurrentLineNumberPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetCurrentLineNumber(p->p); -} -struct EmuTrap stub_XML_GetCurrentLineNumber = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentLineNumberPPC }; - -static int stub_XML_GetCurrentColumnNumberPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetCurrentColumnNumber(p->p); -} -struct EmuTrap stub_XML_GetCurrentColumnNumber = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentColumnNumberPPC }; - -static int stub_XML_GetCurrentByteCountPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetCurrentByteCount(p->p); -} -struct EmuTrap stub_XML_GetCurrentByteCount = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentByteCountPPC }; - -static const char * stub_XML_GetInputContextPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetInputContext(p->p, (int *)regarray[9], (int *)regarray[10]); -} -struct EmuTrap stub_XML_GetInputContext = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetInputContextPPC }; - -static void stub_XML_SetUserDataPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->handlerarg = (void *)regarray[9]; -} -struct EmuTrap stub_XML_SetUserData = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUserDataPPC }; - -static void stub_XML_DefaultCurrentPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_DefaultCurrent(p->p); -} -struct EmuTrap stub_XML_DefaultCurrent = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_DefaultCurrentPPC }; - -static void stub_XML_UseParserAsHandlerArgPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->handlerarg = p; -} -struct EmuTrap stub_XML_UseParserAsHandlerArg = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_UseParserAsHandlerArgPPC }; - -static int stub_XML_SetBasePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_SetBase(p->p, (const XML_Char *)regarray[9]); -} -struct EmuTrap stub_XML_SetBase = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetBasePPC }; - -static const XML_Char * stub_XML_GetBasePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetBase(p->p); -} -struct EmuTrap stub_XML_GetBase = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetBasePPC }; - -static int stub_XML_GetSpecifiedAttributeCountPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetSpecifiedAttributeCount(p->p); -} -struct EmuTrap stub_XML_GetSpecifiedAttributeCount = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetSpecifiedAttributeCountPPC }; - -static int stub_XML_GetIdAttributeIndexPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetIdAttributeIndex(p->p); -} -struct EmuTrap stub_XML_GetIdAttributeIndex = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetIdAttributeIndexPPC }; - -static int stub_XML_SetEncodingPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_SetEncoding(p->p, (const XML_Char *)regarray[9]); -} -struct EmuTrap stub_XML_SetEncoding = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEncodingPPC }; - -static int stub_XML_SetParamEntityParsingPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_SetParamEntityParsing(p->p, (enum XML_ParamEntityParsing)regarray[9]); -} -struct EmuTrap stub_XML_SetParamEntityParsing = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetParamEntityParsingPPC }; - -static void stub_XML_SetReturnNSTripletPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_SetReturnNSTriplet(p->p, (int)regarray[0]); -} -struct EmuTrap stub_XML_SetReturnNSTriplet = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetReturnNSTripletPPC }; - -static const XML_LChar * stub_XML_ExpatVersionPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - return Self->XML_ExpatVersion(); -} -struct EmuTrap stub_XML_ExpatVersion = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExpatVersionPPC }; - -static XML_Expat_Version stub_XML_ExpatVersionInfoPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - return Self->XML_ExpatVersionInfo(); -} -struct EmuTrap stub_XML_ExpatVersionInfo = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExpatVersionInfoPPC }; - -static int stub_XML_ParserResetPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_ParserReset(p->p, (const XML_Char *)regarray[9]); -} -struct EmuTrap stub_XML_ParserReset = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserResetPPC }; - -static void stub_XML_SetSkippedEntityHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->skippedentityhandler = (void *)regarray[9]; - Self->XML_SetSkippedEntityHandler(p->p, _68k_skippedentityhandler); -} -struct EmuTrap stub_XML_SetSkippedEntityHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetSkippedEntityHandlerPPC }; - -static int stub_XML_UseForeignDTDPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_UseForeignDTD(p->p, (XML_Bool)regarray[0]); -} -struct EmuTrap stub_XML_UseForeignDTD = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_UseForeignDTDPPC }; - -static const XML_Feature * stub_XML_GetFeatureListPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - return Self->XML_GetFeatureList(); -} -struct EmuTrap stub_XML_GetFeatureList = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetFeatureListPPC }; - -static int stub_XML_StopParserPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_StopParser(p->p, (XML_Bool)regarray[0]); -} -struct EmuTrap stub_XML_StopParser = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_StopParserPPC }; - -static int stub_XML_ResumeParserPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_ResumeParser(p->p); -} -struct EmuTrap stub_XML_ResumeParser = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ResumeParserPPC }; - -static void stub_XML_GetParsingStatusPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_GetParsingStatus(p->p, (XML_ParsingStatus *)regarray[9]); -} -struct EmuTrap stub_XML_GetParsingStatus = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetParsingStatusPPC }; - -static void stub_XML_FreeContentModelPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_FreeContentModel(p->p, (XML_Content *)regarray[9]); -} -struct EmuTrap stub_XML_FreeContentModel = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_FreeContentModelPPC }; - -static void *stub_XML_MemMallocPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_MemMalloc(p->p, (size_t)regarray[0]); -} -struct EmuTrap stub_XML_MemMalloc = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemMallocPPC }; - -static void *stub_XML_MemReallocPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_MemRealloc(p->p, (void *)regarray[9], (size_t)regarray[0]); -} -struct EmuTrap stub_XML_MemRealloc = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemReallocPPC }; - -static void stub_XML_MemFreePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_MemFree(p->p, (void *)regarray[9]); -} -struct EmuTrap stub_XML_MemFree = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemFreePPC }; - -ULONG VecTable68K[] = { - (ULONG)&stub_Open, - (ULONG)&stub_Close, - (ULONG)&stub_Expunge, - (ULONG)&stub_Reserved, - (ULONG)&stub_XML_ParserCreate, - (ULONG)&stub_XML_ParserCreateNS, - (ULONG)&stub_XML_ParserCreate_MM, - (ULONG)&stub_XML_ExternalEntityParserCreate, - (ULONG)&stub_XML_ParserFree, - (ULONG)&stub_XML_Parse, - (ULONG)&stub_XML_ParseBuffer, - (ULONG)&stub_XML_GetBuffer, - (ULONG)&stub_XML_SetStartElementHandler, - (ULONG)&stub_XML_SetEndElementHandler, - (ULONG)&stub_XML_SetElementHandler, - (ULONG)&stub_XML_SetCharacterDataHandler, - (ULONG)&stub_XML_SetProcessingInstructionHandler, - (ULONG)&stub_XML_SetCommentHandler, - (ULONG)&stub_XML_SetStartCdataSectionHandler, - (ULONG)&stub_XML_SetEndCdataSectionHandler, - (ULONG)&stub_XML_SetCdataSectionHandler, - (ULONG)&stub_XML_SetDefaultHandler, - (ULONG)&stub_XML_SetDefaultHandlerExpand, - (ULONG)&stub_XML_SetExternalEntityRefHandler, - (ULONG)&stub_XML_SetExternalEntityRefHandlerArg, - (ULONG)&stub_XML_SetUnknownEncodingHandler, - (ULONG)&stub_XML_SetStartNamespaceDeclHandler, - (ULONG)&stub_XML_SetEndNamespaceDeclHandler, - (ULONG)&stub_XML_SetNamespaceDeclHandler, - (ULONG)&stub_XML_SetXmlDeclHandler, - (ULONG)&stub_XML_SetStartDoctypeDeclHandler, - (ULONG)&stub_XML_SetEndDoctypeDeclHandler, - (ULONG)&stub_XML_SetDoctypeDeclHandler, - (ULONG)&stub_XML_SetElementDeclHandler, - (ULONG)&stub_XML_SetAttlistDeclHandler, - (ULONG)&stub_XML_SetEntityDeclHandler, - (ULONG)&stub_XML_SetUnparsedEntityDeclHandler, - (ULONG)&stub_XML_SetNotationDeclHandler, - (ULONG)&stub_XML_SetNotStandaloneHandler, - (ULONG)&stub_XML_GetErrorCode, - (ULONG)&stub_XML_ErrorString, - (ULONG)&stub_XML_GetCurrentByteIndex, - (ULONG)&stub_XML_GetCurrentLineNumber, - (ULONG)&stub_XML_GetCurrentColumnNumber, - (ULONG)&stub_XML_GetCurrentByteCount, - (ULONG)&stub_XML_GetInputContext, - (ULONG)&stub_XML_SetUserData, - (ULONG)&stub_XML_DefaultCurrent, - (ULONG)&stub_XML_UseParserAsHandlerArg, - (ULONG)&stub_XML_SetBase, - (ULONG)&stub_XML_GetBase, - (ULONG)&stub_XML_GetSpecifiedAttributeCount, - (ULONG)&stub_XML_GetIdAttributeIndex, - (ULONG)&stub_XML_SetEncoding, - (ULONG)&stub_XML_SetParamEntityParsing, - (ULONG)&stub_XML_SetReturnNSTriplet, - (ULONG)&stub_XML_ExpatVersion, - (ULONG)&stub_XML_ExpatVersionInfo, - (ULONG)&stub_XML_ParserReset, - (ULONG)&stub_XML_SetSkippedEntityHandler, - (ULONG)&stub_XML_UseForeignDTD, - (ULONG)&stub_XML_GetFeatureList, - (ULONG)&stub_XML_StopParser, - (ULONG)&stub_XML_ResumeParser, - (ULONG)&stub_XML_GetParsingStatus, - (ULONG)&stub_XML_FreeContentModel, - (ULONG)&stub_XML_MemMalloc, - (ULONG)&stub_XML_MemRealloc, - (ULONG)&stub_XML_MemFree, - (ULONG)-1 -}; diff --git a/src/expat/amiga/expat_68k.h b/src/expat/amiga/expat_68k.h deleted file mode 100644 index 6f1aac59b8..0000000000 --- a/src/expat/amiga/expat_68k.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef EXPAT_68K_H -#define EXPAT_68K_H - -#ifndef LIBRARIES_EXPAT_H -#include -#endif - -typedef struct M68kXML_ParserStruct { - XML_Parser p; - struct ExecIFace *IExec; - void *handlerarg; - void *extenthandlerarg; - void *enchandlerarg; - void *startelementhandler; - void *endelementhandler; - void *chardatahandler; - void *procinsthandler; - void *commenthandler; - void *startcdatahandler; - void *endcdatahandler; - void *defaulthandler; - void *defaulthandlerexp; - void *extentrefhandler; - void *unknownenchandler; - void *startnamespacehandler; - void *endnamespacehandler; - void *xmldeclhandler; - void *startdoctypehandler; - void *enddoctypehandler; - void *elementdeclhandler; - void *attlistdeclhandler; - void *entitydeclhandler; - void *unparseddeclhandler; - void *notationdeclhandler; - void *notstandalonehandler; - void *skippedentityhandler; -} *M68kXML_Parser; - -/* expat_68k_handler_stubs.c */ -void _68k_startelementhandler(void *userdata, const char *name, const char **attrs); -void _68k_endelementhandler(void *userdata, const char *name); -void _68k_chardatahandler(void *userdata, const char *s, int len); -void _68k_procinsthandler(void *userdata, const char *target, const char *data); -void _68k_commenthandler(void *userdata, const char *data); -void _68k_startcdatahandler(void *userdata); -void _68k_endcdatahandler(void *userdata); -void _68k_defaulthandler(void *userdata, const char *s, int len); -void _68k_defaulthandlerexp(void *userdata, const char *s, int len); -int _68k_extentrefhandler(XML_Parser parser, const char *context, const char *base, - const char *sysid, const char *pubid); -int _68k_unknownenchandler(void *enchandlerdata, const char *name, XML_Encoding *info); -void _68k_startnamespacehandler(void *userdata, const char *prefix, const char *uri); -void _68k_endnamespacehandler(void *userdata, const char *prefix); -void _68k_xmldeclhandler(void *userdata, const char *version, const char *encoding, int standalone); -void _68k_startdoctypehandler(void *userdata, const char *doctypename, - const char *sysid, const char *pubid, int has_internal_subset); -void _68k_enddoctypehandler(void *userdata); -void _68k_elementdeclhandler(void *userdata, const char *name, XML_Content *model); -void _68k_attlistdeclhandler(void *userdata, const char *elname, const char *attname, - const char *att_type, const char *dflt, int isrequired); -void _68k_entitydeclhandler(void *userdata, const char *entityname, int is_param_entity, - const char *value, int value_length, const char *base, const char *sysid, const char *pubid, - const char *notationname); -void _68k_unparseddeclhandler(void *userdata, const char *entityname, const char *base, - const char *sysid, const char *pubid, const char *notationname); -void _68k_notationdeclhandler(void *userdata, const char *notationname, const char *base, - const char *sysid, const char *pubid); -int _68k_notstandalonehandler(void *userdata); -void _68k_skippedentityhandler(void *userdata, const char *entityname, int is_param_entity); - -#endif diff --git a/src/expat/amiga/expat_68k_handler_stubs.c b/src/expat/amiga/expat_68k_handler_stubs.c deleted file mode 100644 index aca33c6ecd..0000000000 --- a/src/expat/amiga/expat_68k_handler_stubs.c +++ /dev/null @@ -1,185 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifdef __USE_INLINE__ -#undef __USE_INLINE__ -#endif - -#include "expat_68k.h" -#include -#include -#include - -static uint32 VARARGS68K call_68k_code (struct ExecIFace *IExec, void *code, int num_args, ...) { - uint32 res = 0; - - va_list vargs; - va_startlinear(vargs, num_args); - uint32 *args = va_getlinearva(vargs, uint32 *); - - uint8 *stack = IExec->AllocVec(4096, MEMF_SHARED); - if (stack) { - uint32 *sp = (uint32 *)(stack + 4096); - args += num_args; - while (num_args--) { - *--sp = *--args; - } - - res = IExec->EmulateTags(code, ET_StackPtr, sp, TAG_END); - IExec->FreeVec(stack); - } - - va_end(vargs); - - return res; -} - -void _68k_startelementhandler(void *userdata, const char *name, const char **attrs) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->startelementhandler, 3, p->handlerarg, name, attrs); -} - -void _68k_endelementhandler(void *userdata, const char *name) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->endelementhandler, 2, p->handlerarg, name); -} - -void _68k_chardatahandler(void *userdata, const char *s, int len) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->chardatahandler, 3, p->handlerarg, s, len); -} - -void _68k_procinsthandler(void *userdata, const char *target, const char *data) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->procinsthandler, 3, p->handlerarg, target, data); -} - -void _68k_commenthandler(void *userdata, const char *data) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->commenthandler, 2, p->handlerarg, data); -} - -void _68k_startcdatahandler(void *userdata) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->startcdatahandler, 1, p->handlerarg); -} - -void _68k_endcdatahandler(void *userdata) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->endcdatahandler, 1, p->handlerarg); -} - -void _68k_defaulthandler(void *userdata, const char *s, int len) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->defaulthandler, 3, p->handlerarg, s, len); -} - -void _68k_defaulthandlerexp(void *userdata, const char *s, int len) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->defaulthandlerexp, 3, p->handlerarg, s, len); -} - -int _68k_extentrefhandler(XML_Parser parser, const char *context, const char *base, - const char *sysid, const char *pubid) -{ - M68kXML_Parser p = XML_GetUserData(parser); - void *arg = p->extenthandlerarg; - return (int)call_68k_code(p->IExec, p->extentrefhandler, 5, arg ? arg : p, context, base, sysid, pubid); -} - -int _68k_unknownenchandler(void *enchandlerdata, const char *name, XML_Encoding *info) { - M68kXML_Parser p = enchandlerdata; - return (int)call_68k_code(p->IExec, p->unknownenchandler, 3, p->enchandlerarg, name, info); -} - -void _68k_startnamespacehandler(void *userdata, const char *prefix, const char *uri) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->startnamespacehandler, 3, p->handlerarg, prefix, uri); -} - -void _68k_endnamespacehandler(void *userdata, const char *prefix) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->endnamespacehandler, 2, p->handlerarg, prefix); -} - -void _68k_xmldeclhandler(void *userdata, const char *version, const char *encoding, int standalone) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->xmldeclhandler, 4, p->handlerarg, version, encoding, standalone); -} - -void _68k_startdoctypehandler(void *userdata, const char *doctypename, - const char *sysid, const char *pubid, int has_internal_subset) -{ - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->startdoctypehandler, 5, p->handlerarg, doctypename, sysid, pubid, has_internal_subset); -} - -void _68k_enddoctypehandler(void *userdata) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->enddoctypehandler, 1, p->handlerarg); -} - -void _68k_elementdeclhandler(void *userdata, const char *name, XML_Content *model) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->elementdeclhandler, 3, p->handlerarg, name, model); -} - -void _68k_attlistdeclhandler(void *userdata, const char *elname, const char *attname, - const char *att_type, const char *dflt, int isrequired) -{ - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->attlistdeclhandler, 6, p->handlerarg, elname, attname, att_type, dflt, isrequired); -} - -void _68k_entitydeclhandler(void *userdata, const char *entityname, int is_param_entity, - const char *value, int value_length, const char *base, const char *sysid, const char *pubid, - const char *notationname) -{ - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->entitydeclhandler, 9, p->handlerarg, entityname, is_param_entity, - value, value_length, base, sysid, pubid, notationname); -} - -void _68k_unparseddeclhandler(void *userdata, const char *entityname, const char *base, - const char *sysid, const char *pubid, const char *notationname) -{ - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->unparseddeclhandler, 6, p->handlerarg, entityname, base, sysid, pubid, notationname); -} - -void _68k_notationdeclhandler(void *userdata, const char *notationname, const char *base, - const char *sysid, const char *pubid) -{ - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->notationdeclhandler, 5, p->handlerarg, notationname, base, sysid, pubid); -} - -int _68k_notstandalonehandler(void *userdata) { - M68kXML_Parser p = userdata; - return (int)call_68k_code(p->IExec, p->notstandalonehandler, 1, p->handlerarg); -} - -void _68k_skippedentityhandler(void *userdata, const char *entityname, int is_param_entity) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->skippedentityhandler, 3, p->handlerarg, entityname, is_param_entity); -} diff --git a/src/expat/amiga/expat_base.h b/src/expat/amiga/expat_base.h deleted file mode 100644 index 2663639850..0000000000 --- a/src/expat/amiga/expat_base.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef EXPAT_BASE_H -#define EXPAT_BASE_H - -#include -#include -#include -#include - - -struct ExpatBase { - struct Library libNode; - uint16 pad; - BPTR SegList; - struct ExecIFace *IExec; -}; - -#endif diff --git a/src/expat/amiga/expat_lib.c b/src/expat/amiga/expat_lib.c deleted file mode 100644 index 70e91b101a..0000000000 --- a/src/expat/amiga/expat_lib.c +++ /dev/null @@ -1,247 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifdef __USE_INLINE__ -#undef __USE_INLINE__ -#endif - -#define __NOLIBBASE__ -#define __NOGLOBALIFACE__ - -#include -#include - -#include "expat_base.h" - - -#define LIBNAME "expat.library" -#define LIBPRI 0 -#define VERSION 53 -#define REVISION 1 -#define VSTRING "expat.library 53.1 (7.8.2009)" /* dd.mm.yyyy */ - - -static const char* __attribute__((used)) verstag = "\0$VER: " VSTRING; - - -struct Interface *INewlib = 0; - - -struct ExpatBase * libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *ISys); -uint32 libObtain (struct LibraryManagerInterface *Self); -uint32 libRelease (struct LibraryManagerInterface *Self); -struct ExpatBase *libOpen (struct LibraryManagerInterface *Self, uint32 version); -BPTR libClose (struct LibraryManagerInterface *Self); -BPTR libExpunge (struct LibraryManagerInterface *Self); -struct Interface *openInterface(struct ExecIFace *IExec, CONST_STRPTR libName, uint32 libVer); -void closeInterface(struct ExecIFace *IExec, struct Interface *iface); - - -static APTR lib_manager_vectors[] = { - libObtain, - libRelease, - NULL, - NULL, - libOpen, - libClose, - libExpunge, - NULL, - (APTR)-1, -}; - - -static struct TagItem lib_managerTags[] = { - { MIT_Name, (uint32)"__library" }, - { MIT_VectorTable, (uint32)lib_manager_vectors }, - { MIT_Version, 1 }, - { TAG_END, 0 } -}; - - -extern void *main_vectors[]; - -static struct TagItem lib_mainTags[] = { - { MIT_Name, (uint32)"main" }, - { MIT_VectorTable, (uint32)main_vectors }, - { MIT_Version, 1 }, - { TAG_END, 0 } -}; - - -static APTR libInterfaces[] = { - lib_managerTags, - lib_mainTags, - NULL -}; - - -extern void *VecTable68K[]; - -static struct TagItem libCreateTags[] = { - { CLT_DataSize, sizeof(struct ExpatBase) }, - { CLT_InitFunc, (uint32)libInit }, - { CLT_Interfaces, (uint32)libInterfaces }, - { CLT_Vector68K, (uint32)VecTable68K }, - { TAG_END, 0 } -}; - - -static struct Resident __attribute__((used)) lib_res = { - RTC_MATCHWORD, // rt_MatchWord - &lib_res, // rt_MatchTag - &lib_res+1, // rt_EndSkip - RTF_NATIVE | RTF_AUTOINIT, // rt_Flags - VERSION, // rt_Version - NT_LIBRARY, // rt_Type - LIBPRI, // rt_Pri - LIBNAME, // rt_Name - VSTRING, // rt_IdString - libCreateTags // rt_Init -}; - - -int32 _start() -{ - return RETURN_FAIL; -} - - -struct ExpatBase *libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *iexec) -{ - libBase->libNode.lib_Node.ln_Type = NT_LIBRARY; - libBase->libNode.lib_Node.ln_Pri = LIBPRI; - libBase->libNode.lib_Node.ln_Name = LIBNAME; - libBase->libNode.lib_Flags = LIBF_SUMUSED|LIBF_CHANGED; - libBase->libNode.lib_Version = VERSION; - libBase->libNode.lib_Revision = REVISION; - libBase->libNode.lib_IdString = VSTRING; - - libBase->SegList = seglist; - - libBase->IExec = iexec; - INewlib = openInterface(iexec, "newlib.library", 0); - - if ( INewlib != 0 ) { - return libBase; - } - - closeInterface(iexec, INewlib); - INewlib = 0; - - iexec->DeleteLibrary(&libBase->libNode); - - return NULL; -} - - -uint32 libObtain( struct LibraryManagerInterface *Self ) -{ - ++Self->Data.RefCount; - return Self->Data.RefCount; -} - - -uint32 libRelease( struct LibraryManagerInterface *Self ) -{ - --Self->Data.RefCount; - return Self->Data.RefCount; -} - - -struct ExpatBase *libOpen( struct LibraryManagerInterface *Self, uint32 version ) -{ - struct ExpatBase *libBase; - - libBase = (struct ExpatBase *)Self->Data.LibBase; - - ++libBase->libNode.lib_OpenCnt; - libBase->libNode.lib_Flags &= ~LIBF_DELEXP; - - return libBase; -} - - -BPTR libClose( struct LibraryManagerInterface *Self ) -{ - struct ExpatBase *libBase; - - libBase = (struct ExpatBase *)Self->Data.LibBase; - - --libBase->libNode.lib_OpenCnt; - if ( libBase->libNode.lib_OpenCnt ) { - return 0; - } - - if ( libBase->libNode.lib_Flags & LIBF_DELEXP ) { - return (BPTR)Self->LibExpunge(); - } - else { - return ZERO; - } -} - - -BPTR libExpunge( struct LibraryManagerInterface *Self ) -{ - struct ExpatBase *libBase = (struct ExpatBase *)Self->Data.LibBase; - BPTR result = ZERO; - - if (libBase->libNode.lib_OpenCnt == 0) { - libBase->IExec->Remove(&libBase->libNode.lib_Node); - - result = libBase->SegList; - - closeInterface(libBase->IExec, INewlib); - INewlib = 0; - - libBase->IExec->DeleteLibrary(&libBase->libNode); - } - else { - libBase->libNode.lib_Flags |= LIBF_DELEXP; - } - - return result; -} - - -struct Interface *openInterface(struct ExecIFace *IExec, CONST_STRPTR libName, uint32 libVer) -{ - struct Library *base = IExec->OpenLibrary(libName, libVer); - struct Interface *iface = IExec->GetInterface(base, "main", 1, 0); - if (iface == 0) { - IExec->CloseLibrary(base); - } - - return iface; -} - - -void closeInterface(struct ExecIFace *IExec, struct Interface *iface) -{ - if (iface != 0) - { - struct Library *base = iface->Data.LibBase; - IExec->DropInterface(iface); - IExec->CloseLibrary(base); - } -} diff --git a/src/expat/amiga/expat_vectors.c b/src/expat/amiga/expat_vectors.c deleted file mode 100644 index cf489509cd..0000000000 --- a/src/expat/amiga/expat_vectors.c +++ /dev/null @@ -1,505 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include -#include -#include -#include - -extern uint32 _Expat_Obtain(struct ExpatIFace *); -extern uint32 _Expat_Release(struct ExpatIFace *); -extern XML_Parser _Expat_XML_ParserCreate(struct ExpatIFace *, const XML_Char * encodingName); -extern XML_Parser _Expat_XML_ParserCreateNS(struct ExpatIFace *, const XML_Char * encodingName, XML_Char nsSep); -extern XML_Parser _Expat_XML_ParserCreate_MM(struct ExpatIFace *, const XML_Char * encoding, const XML_Memory_Handling_Suite * memsuite, const XML_Char * namespaceSeparator); -extern XML_Parser _Expat_XML_ExternalEntityParserCreate(struct ExpatIFace *, XML_Parser parser, const XML_Char * context, const XML_Char * encoding); -extern void _Expat_XML_ParserFree(struct ExpatIFace *, XML_Parser parser); -extern enum XML_Status _Expat_XML_Parse(struct ExpatIFace *, XML_Parser parser, const char * s, int len, int isFinal); -extern enum XML_Status _Expat_XML_ParseBuffer(struct ExpatIFace *, XML_Parser parser, int len, int isFinal); -extern void * _Expat_XML_GetBuffer(struct ExpatIFace *, XML_Parser parser, int len); -extern void _Expat_XML_SetStartElementHandler(struct ExpatIFace *, XML_Parser parser, XML_StartElementHandler start); -extern void _Expat_XML_SetEndElementHandler(struct ExpatIFace *, XML_Parser parser, XML_EndElementHandler end); -extern void _Expat_XML_SetElementHandler(struct ExpatIFace *, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); -extern void _Expat_XML_SetCharacterDataHandler(struct ExpatIFace *, XML_Parser parser, XML_CharacterDataHandler handler); -extern void _Expat_XML_SetProcessingInstructionHandler(struct ExpatIFace *, XML_Parser parser, XML_ProcessingInstructionHandler handler); -extern void _Expat_XML_SetCommentHandler(struct ExpatIFace *, XML_Parser parser, XML_CommentHandler handler); -extern void _Expat_XML_SetStartCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_StartCdataSectionHandler start); -extern void _Expat_XML_SetEndCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_EndCdataSectionHandler end); -extern void _Expat_XML_SetCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); -extern void _Expat_XML_SetDefaultHandler(struct ExpatIFace *, XML_Parser parser, XML_DefaultHandler handler); -extern void _Expat_XML_SetDefaultHandlerExpand(struct ExpatIFace *, XML_Parser parser, XML_DefaultHandler handler); -extern void _Expat_XML_SetExternalEntityRefHandler(struct ExpatIFace *, XML_Parser parser, XML_ExternalEntityRefHandler handler); -extern void _Expat_XML_SetExternalEntityRefHandlerArg(struct ExpatIFace *, XML_Parser parser, void * arg); -extern void _Expat_XML_SetUnknownEncodingHandler(struct ExpatIFace *, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data); -extern void _Expat_XML_SetStartNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartNamespaceDeclHandler start); -extern void _Expat_XML_SetEndNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EndNamespaceDeclHandler end); -extern void _Expat_XML_SetNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); -extern void _Expat_XML_SetXmlDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_XmlDeclHandler handler); -extern void _Expat_XML_SetStartDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartDoctypeDeclHandler start); -extern void _Expat_XML_SetEndDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EndDoctypeDeclHandler end); -extern void _Expat_XML_SetDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); -extern void _Expat_XML_SetElementDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_ElementDeclHandler eldecl); -extern void _Expat_XML_SetAttlistDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_AttlistDeclHandler attdecl); -extern void _Expat_XML_SetEntityDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EntityDeclHandler handler); -extern void _Expat_XML_SetUnparsedEntityDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_UnparsedEntityDeclHandler handler); -extern void _Expat_XML_SetNotationDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_NotationDeclHandler handler); -extern void _Expat_XML_SetNotStandaloneHandler(struct ExpatIFace *, XML_Parser parser, XML_NotStandaloneHandler handler); -extern enum XML_Error _Expat_XML_GetErrorCode(struct ExpatIFace *, XML_Parser parser); -extern const XML_LChar * _Expat_XML_ErrorString(struct ExpatIFace *, enum XML_Error code); -extern long _Expat_XML_GetCurrentByteIndex(struct ExpatIFace *, XML_Parser parser); -extern int _Expat_XML_GetCurrentLineNumber(struct ExpatIFace *, XML_Parser parser); -extern int _Expat_XML_GetCurrentColumnNumber(struct ExpatIFace *, XML_Parser parser); -extern int _Expat_XML_GetCurrentByteCount(struct ExpatIFace *, XML_Parser parser); -extern const char * _Expat_XML_GetInputContext(struct ExpatIFace *, XML_Parser parser, int * offset, int * size); -extern void _Expat_XML_SetUserData(struct ExpatIFace *, XML_Parser parser, void * userData); -extern void _Expat_XML_DefaultCurrent(struct ExpatIFace *, XML_Parser parser); -extern void _Expat_XML_UseParserAsHandlerArg(struct ExpatIFace *, XML_Parser parser); -extern enum XML_Status _Expat_XML_SetBase(struct ExpatIFace *, XML_Parser parser, const XML_Char * base); -extern const XML_Char * _Expat_XML_GetBase(struct ExpatIFace *, XML_Parser parser); -extern int _Expat_XML_GetSpecifiedAttributeCount(struct ExpatIFace *, XML_Parser parser); -extern int _Expat_XML_GetIdAttributeIndex(struct ExpatIFace *, XML_Parser parser); -extern enum XML_Status _Expat_XML_SetEncoding(struct ExpatIFace *, XML_Parser parser, const XML_Char * encoding); -extern int _Expat_XML_SetParamEntityParsing(struct ExpatIFace *, XML_Parser parser, enum XML_ParamEntityParsing parsing); -extern void _Expat_XML_SetReturnNSTriplet(struct ExpatIFace *, XML_Parser parser, int do_nst); -extern const XML_LChar * _Expat_XML_ExpatVersion(struct ExpatIFace *); -extern XML_Expat_Version _Expat_XML_ExpatVersionInfo(struct ExpatIFace *); -extern XML_Bool _Expat_XML_ParserReset(struct ExpatIFace *, XML_Parser parser, const XML_Char * encoding); -extern void _Expat_XML_SetSkippedEntityHandler(struct ExpatIFace *, XML_Parser parser, XML_SkippedEntityHandler handler); -extern enum XML_Error _Expat_XML_UseForeignDTD(struct ExpatIFace *, XML_Parser parser, XML_Bool useDTD); -extern const XML_Feature * _Expat_XML_GetFeatureList(struct ExpatIFace *); -extern enum XML_Status _Expat_XML_StopParser(struct ExpatIFace *, XML_Parser parser, XML_Bool resumable); -extern enum XML_Status _Expat_XML_ResumeParser(struct ExpatIFace *, XML_Parser parser); -extern void _Expat_XML_GetParsingStatus(struct ExpatIFace *, XML_Parser parser, XML_ParsingStatus * status); -extern void _Expat_XML_FreeContentModel(struct ExpatIFace *, XML_Parser parser, XML_Content * model); -extern void * _Expat_XML_MemMalloc(struct ExpatIFace *, XML_Parser parser, size_t size); -extern void * _Expat_XML_MemRealloc(struct ExpatIFace *, XML_Parser parser, void * ptr, size_t size); -extern void _Expat_XML_MemFree(struct ExpatIFace *, XML_Parser parser, void * ptr); - - -CONST APTR main_vectors[] = -{ - _Expat_Obtain, - _Expat_Release, - NULL, - NULL, - _Expat_XML_ParserCreate, - _Expat_XML_ParserCreateNS, - _Expat_XML_ParserCreate_MM, - _Expat_XML_ExternalEntityParserCreate, - _Expat_XML_ParserFree, - _Expat_XML_Parse, - _Expat_XML_ParseBuffer, - _Expat_XML_GetBuffer, - _Expat_XML_SetStartElementHandler, - _Expat_XML_SetEndElementHandler, - _Expat_XML_SetElementHandler, - _Expat_XML_SetCharacterDataHandler, - _Expat_XML_SetProcessingInstructionHandler, - _Expat_XML_SetCommentHandler, - _Expat_XML_SetStartCdataSectionHandler, - _Expat_XML_SetEndCdataSectionHandler, - _Expat_XML_SetCdataSectionHandler, - _Expat_XML_SetDefaultHandler, - _Expat_XML_SetDefaultHandlerExpand, - _Expat_XML_SetExternalEntityRefHandler, - _Expat_XML_SetExternalEntityRefHandlerArg, - _Expat_XML_SetUnknownEncodingHandler, - _Expat_XML_SetStartNamespaceDeclHandler, - _Expat_XML_SetEndNamespaceDeclHandler, - _Expat_XML_SetNamespaceDeclHandler, - _Expat_XML_SetXmlDeclHandler, - _Expat_XML_SetStartDoctypeDeclHandler, - _Expat_XML_SetEndDoctypeDeclHandler, - _Expat_XML_SetDoctypeDeclHandler, - _Expat_XML_SetElementDeclHandler, - _Expat_XML_SetAttlistDeclHandler, - _Expat_XML_SetEntityDeclHandler, - _Expat_XML_SetUnparsedEntityDeclHandler, - _Expat_XML_SetNotationDeclHandler, - _Expat_XML_SetNotStandaloneHandler, - _Expat_XML_GetErrorCode, - _Expat_XML_ErrorString, - _Expat_XML_GetCurrentByteIndex, - _Expat_XML_GetCurrentLineNumber, - _Expat_XML_GetCurrentColumnNumber, - _Expat_XML_GetCurrentByteCount, - _Expat_XML_GetInputContext, - _Expat_XML_SetUserData, - _Expat_XML_DefaultCurrent, - _Expat_XML_UseParserAsHandlerArg, - _Expat_XML_SetBase, - _Expat_XML_GetBase, - _Expat_XML_GetSpecifiedAttributeCount, - _Expat_XML_GetIdAttributeIndex, - _Expat_XML_SetEncoding, - _Expat_XML_SetParamEntityParsing, - _Expat_XML_SetReturnNSTriplet, - _Expat_XML_ExpatVersion, - _Expat_XML_ExpatVersionInfo, - _Expat_XML_ParserReset, - _Expat_XML_SetSkippedEntityHandler, - _Expat_XML_UseForeignDTD, - _Expat_XML_GetFeatureList, - _Expat_XML_StopParser, - _Expat_XML_ResumeParser, - _Expat_XML_GetParsingStatus, - _Expat_XML_FreeContentModel, - _Expat_XML_MemMalloc, - _Expat_XML_MemRealloc, - _Expat_XML_MemFree, - (APTR)-1 -}; - -uint32 _Expat_Obtain(struct ExpatIFace *Self) -{ - return ++Self->Data.RefCount; -} - -uint32 _Expat_Release(struct ExpatIFace *Self) -{ - return --Self->Data.RefCount; -} - -XML_Parser _Expat_XML_ParserCreate(struct ExpatIFace * Self, const XML_Char *encoding) -{ - return XML_ParserCreate(encoding); -} - -XML_Parser _Expat_XML_ParserCreateNS(struct ExpatIFace * Self, const XML_Char *encoding, XML_Char nsSep) -{ - return XML_ParserCreateNS(encoding, nsSep); -} - -XML_Parser _Expat_XML_ParserCreate_MM(struct ExpatIFace * Self, const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator) -{ - return XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator); -} - -XML_Parser _Expat_XML_ExternalEntityParserCreate(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *context, const XML_Char *encoding) -{ - return XML_ExternalEntityParserCreate(parser, context, encoding); -} - -void _Expat_XML_ParserFree(struct ExpatIFace *Self, XML_Parser parser) -{ - XML_ParserFree(parser); -} - -enum XML_Status _Expat_XML_Parse(struct ExpatIFace * Self, XML_Parser parser, const char * s, int len, int isFinal) -{ - return XML_Parse(parser, s, len, isFinal); -} - -enum XML_Status _Expat_XML_ParseBuffer(struct ExpatIFace * Self, XML_Parser parser, int len, int isFinal) -{ - return XML_ParseBuffer(parser, len, isFinal); -} - -void * _Expat_XML_GetBuffer(struct ExpatIFace * Self, XML_Parser parser, int len) -{ - return XML_GetBuffer(parser, len); -} - -void _Expat_XML_SetStartElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartElementHandler start) -{ - XML_SetStartElementHandler(parser, start); -} - -void _Expat_XML_SetEndElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndElementHandler end) -{ - XML_SetEndElementHandler(parser, end); -} - -void _Expat_XML_SetElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end) -{ - XML_SetElementHandler(parser, start, end); -} - -void _Expat_XML_SetCharacterDataHandler(struct ExpatIFace * Self, XML_Parser parser, XML_CharacterDataHandler handler) -{ - XML_SetCharacterDataHandler(parser, handler); -} - -void _Expat_XML_SetProcessingInstructionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ProcessingInstructionHandler handler) -{ - XML_SetProcessingInstructionHandler(parser, handler); -} - -void _Expat_XML_SetCommentHandler(struct ExpatIFace * Self, XML_Parser parser, XML_CommentHandler handler) -{ - XML_SetCommentHandler(parser, handler); -} - -void _Expat_XML_SetStartCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartCdataSectionHandler start) -{ - XML_SetStartCdataSectionHandler(parser, start); -} - -void _Expat_XML_SetEndCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndCdataSectionHandler end) -{ - XML_SetEndCdataSectionHandler(parser, end); -} - -void _Expat_XML_SetCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end) -{ - XML_SetCdataSectionHandler(parser, start, end); -} - -void _Expat_XML_SetDefaultHandler(struct ExpatIFace * Self, XML_Parser parser, XML_DefaultHandler handler) -{ - XML_SetDefaultHandler(parser, handler); -} - -void _Expat_XML_SetDefaultHandlerExpand(struct ExpatIFace * Self, XML_Parser parser, XML_DefaultHandler handler) -{ - XML_SetDefaultHandlerExpand(parser, handler); -} - -void _Expat_XML_SetExternalEntityRefHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ExternalEntityRefHandler handler) -{ - XML_SetExternalEntityRefHandler(parser, handler); -} - -void _Expat_XML_SetExternalEntityRefHandlerArg(struct ExpatIFace * Self, XML_Parser parser, void * arg) -{ - XML_SetExternalEntityRefHandlerArg(parser, arg); -} - -void _Expat_XML_SetUnknownEncodingHandler(struct ExpatIFace * Self, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data) -{ - XML_SetUnknownEncodingHandler(parser, handler, data); -} - -void _Expat_XML_SetStartNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartNamespaceDeclHandler start) -{ - XML_SetStartNamespaceDeclHandler(parser, start); -} - -void _Expat_XML_SetEndNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndNamespaceDeclHandler end) -{ - XML_SetEndNamespaceDeclHandler(parser, end); -} - -void _Expat_XML_SetNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end) -{ - XML_SetNamespaceDeclHandler(parser, start, end); -} - -void _Expat_XML_SetXmlDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_XmlDeclHandler handler) -{ - XML_SetXmlDeclHandler(parser, handler); -} - -void _Expat_XML_SetStartDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartDoctypeDeclHandler start) -{ - XML_SetStartDoctypeDeclHandler(parser, start); -} - -void _Expat_XML_SetEndDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndDoctypeDeclHandler end) -{ - XML_SetEndDoctypeDeclHandler(parser, end); -} - -void _Expat_XML_SetDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end) -{ - XML_SetDoctypeDeclHandler(parser, start, end); -} - -void _Expat_XML_SetElementDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ElementDeclHandler eldecl) -{ - XML_SetElementDeclHandler(parser, eldecl); -} - -void _Expat_XML_SetAttlistDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_AttlistDeclHandler attdecl) -{ - XML_SetAttlistDeclHandler(parser, attdecl); -} - -void _Expat_XML_SetEntityDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EntityDeclHandler handler) -{ - XML_SetEntityDeclHandler(parser, handler); -} - -void _Expat_XML_SetUnparsedEntityDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_UnparsedEntityDeclHandler handler) -{ - XML_SetUnparsedEntityDeclHandler(parser, handler); -} - -void _Expat_XML_SetNotationDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_NotationDeclHandler handler) -{ - XML_SetNotationDeclHandler(parser, handler); -} - -void _Expat_XML_SetNotStandaloneHandler(struct ExpatIFace * Self, XML_Parser parser, XML_NotStandaloneHandler handler) -{ - XML_SetNotStandaloneHandler(parser, handler); -} - -enum XML_Error _Expat_XML_GetErrorCode(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetErrorCode(parser); -} - -const XML_LChar * _Expat_XML_ErrorString(struct ExpatIFace * Self, enum XML_Error code) -{ - return XML_ErrorString(code); -} - -long _Expat_XML_GetCurrentByteIndex(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetCurrentByteIndex(parser); -} - -int _Expat_XML_GetCurrentLineNumber(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetCurrentLineNumber(parser); -} - -int _Expat_XML_GetCurrentColumnNumber(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetCurrentColumnNumber(parser); -} - -int _Expat_XML_GetCurrentByteCount(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetCurrentByteCount(parser); -} - -const char * _Expat_XML_GetInputContext(struct ExpatIFace * Self, XML_Parser parser, int * offset, int * size) -{ - return XML_GetInputContext(parser, offset, size); -} - -void _Expat_XML_SetUserData(struct ExpatIFace * Self, XML_Parser parser, void * userData) -{ - XML_SetUserData(parser, userData); -} - -void _Expat_XML_DefaultCurrent(struct ExpatIFace * Self, XML_Parser parser) -{ - XML_DefaultCurrent(parser); -} - -void _Expat_XML_UseParserAsHandlerArg(struct ExpatIFace * Self, XML_Parser parser) -{ - XML_UseParserAsHandlerArg(parser); -} - -enum XML_Status _Expat_XML_SetBase(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *p) -{ - return XML_SetBase(parser, p); -} - -const XML_Char * _Expat_XML_GetBase(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetBase(parser); -} - -int _Expat_XML_GetSpecifiedAttributeCount(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetSpecifiedAttributeCount(parser); -} - -int _Expat_XML_GetIdAttributeIndex(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetIdAttributeIndex(parser); -} - -enum XML_Status _Expat_XML_SetEncoding(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *encoding) -{ - return XML_SetEncoding(parser, encoding); -} - -int _Expat_XML_SetParamEntityParsing(struct ExpatIFace * Self, XML_Parser parser, enum XML_ParamEntityParsing parsing) -{ - return XML_SetParamEntityParsing(parser, parsing); -} - -void _Expat_XML_SetReturnNSTriplet(struct ExpatIFace * Self, XML_Parser parser, int do_nst) -{ - XML_SetReturnNSTriplet(parser, do_nst); -} - -const XML_LChar * _Expat_XML_ExpatVersion(struct ExpatIFace * Self) -{ - return XML_ExpatVersion(); -} - -XML_Expat_Version _Expat_XML_ExpatVersionInfo(struct ExpatIFace * Self) -{ - return XML_ExpatVersionInfo(); -} - -XML_Bool _Expat_XML_ParserReset(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *encoding) -{ - return XML_ParserReset(parser, encoding); -} - -void _Expat_XML_SetSkippedEntityHandler(struct ExpatIFace * Self, XML_Parser parser, XML_SkippedEntityHandler handler) -{ - XML_SetSkippedEntityHandler(parser, handler); -} - -enum XML_Error _Expat_XML_UseForeignDTD(struct ExpatIFace * Self, XML_Parser parser, XML_Bool useDTD) -{ - return XML_UseForeignDTD(parser, useDTD); -} - -const XML_Feature * _Expat_XML_GetFeatureList(struct ExpatIFace * Self) -{ - return XML_GetFeatureList(); -} - -enum XML_Status _Expat_XML_StopParser(struct ExpatIFace * Self, XML_Parser parser, XML_Bool resumable) -{ - return XML_StopParser(parser, resumable); -} - -enum XML_Status _Expat_XML_ResumeParser(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_ResumeParser(parser); -} - -void _Expat_XML_GetParsingStatus(struct ExpatIFace * Self, XML_Parser parser, XML_ParsingStatus * status) -{ - XML_GetParsingStatus(parser, status); -} - -void _Expat_XML_FreeContentModel(struct ExpatIFace * Self, XML_Parser parser, XML_Content * model) -{ - XML_FreeContentModel(parser, model); -} - -void * _Expat_XML_MemMalloc(struct ExpatIFace * Self, XML_Parser parser, size_t size) -{ - return XML_MemMalloc(parser, size); -} - -void * _Expat_XML_MemRealloc(struct ExpatIFace * Self, XML_Parser parser, void * ptr, size_t size) -{ - XML_MemRealloc(parser, ptr, size); -} - -void _Expat_XML_MemFree(struct ExpatIFace * Self, XML_Parser parser, void * ptr) -{ - XML_MemFree(parser, ptr); -} diff --git a/src/expat/amiga/include/inline4/expat.h b/src/expat/amiga/include/inline4/expat.h deleted file mode 100644 index 1e3105d94e..0000000000 --- a/src/expat/amiga/include/inline4/expat.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef INLINE4_EXPAT_H -#define INLINE4_EXPAT_H - -/* -** This file was auto generated by idltool 51.6. -** -** It provides compatibility to OS3 style library -** calls by substituting functions. -** -** Do not edit manually. -*/ - -#ifndef EXEC_TYPES_H -#include -#endif -#ifndef EXEC_EXEC_H -#include -#endif -#ifndef EXEC_INTERFACES_H -#include -#endif - -#ifndef LIBRARIES_EXPAT_H -#include -#endif - -/* Inline macros for Interface "main" */ -#define XML_ParserCreate(encodingName) IExpat->XML_ParserCreate(encodingName) -#define XML_ParserCreateNS(encodingName, nsSep) IExpat->XML_ParserCreateNS(encodingName, nsSep) -#define XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator) IExpat->XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator) -#define XML_ExternalEntityParserCreate(parser, context, encoding) IExpat->XML_ExternalEntityParserCreate(parser, context, encoding) -#define XML_ParserFree(parser) IExpat->XML_ParserFree(parser) -#define XML_Parse(parser, s, len, isFinal) IExpat->XML_Parse(parser, s, len, isFinal) -#define XML_ParseBuffer(parser, len, isFinal) IExpat->XML_ParseBuffer(parser, len, isFinal) -#define XML_GetBuffer(parser, len) IExpat->XML_GetBuffer(parser, len) -#define XML_SetStartElementHandler(parser, start) IExpat->XML_SetStartElementHandler(parser, start) -#define XML_SetEndElementHandler(parser, end) IExpat->XML_SetEndElementHandler(parser, end) -#define XML_SetElementHandler(parser, start, end) IExpat->XML_SetElementHandler(parser, start, end) -#define XML_SetCharacterDataHandler(parser, handler) IExpat->XML_SetCharacterDataHandler(parser, handler) -#define XML_SetProcessingInstructionHandler(parser, handler) IExpat->XML_SetProcessingInstructionHandler(parser, handler) -#define XML_SetCommentHandler(parser, handler) IExpat->XML_SetCommentHandler(parser, handler) -#define XML_SetStartCdataSectionHandler(parser, start) IExpat->XML_SetStartCdataSectionHandler(parser, start) -#define XML_SetEndCdataSectionHandler(parser, end) IExpat->XML_SetEndCdataSectionHandler(parser, end) -#define XML_SetCdataSectionHandler(parser, start, end) IExpat->XML_SetCdataSectionHandler(parser, start, end) -#define XML_SetDefaultHandler(parser, handler) IExpat->XML_SetDefaultHandler(parser, handler) -#define XML_SetDefaultHandlerExpand(parser, handler) IExpat->XML_SetDefaultHandlerExpand(parser, handler) -#define XML_SetExternalEntityRefHandler(parser, handler) IExpat->XML_SetExternalEntityRefHandler(parser, handler) -#define XML_SetExternalEntityRefHandlerArg(parser, arg) IExpat->XML_SetExternalEntityRefHandlerArg(parser, arg) -#define XML_SetUnknownEncodingHandler(parser, handler, data) IExpat->XML_SetUnknownEncodingHandler(parser, handler, data) -#define XML_SetStartNamespaceDeclHandler(parser, start) IExpat->XML_SetStartNamespaceDeclHandler(parser, start) -#define XML_SetEndNamespaceDeclHandler(parser, end) IExpat->XML_SetEndNamespaceDeclHandler(parser, end) -#define XML_SetNamespaceDeclHandler(parser, start, end) IExpat->XML_SetNamespaceDeclHandler(parser, start, end) -#define XML_SetXmlDeclHandler(parser, handler) IExpat->XML_SetXmlDeclHandler(parser, handler) -#define XML_SetStartDoctypeDeclHandler(parser, start) IExpat->XML_SetStartDoctypeDeclHandler(parser, start) -#define XML_SetEndDoctypeDeclHandler(parser, end) IExpat->XML_SetEndDoctypeDeclHandler(parser, end) -#define XML_SetDoctypeDeclHandler(parser, start, end) IExpat->XML_SetDoctypeDeclHandler(parser, start, end) -#define XML_SetElementDeclHandler(parser, eldecl) IExpat->XML_SetElementDeclHandler(parser, eldecl) -#define XML_SetAttlistDeclHandler(parser, attdecl) IExpat->XML_SetAttlistDeclHandler(parser, attdecl) -#define XML_SetEntityDeclHandler(parser, handler) IExpat->XML_SetEntityDeclHandler(parser, handler) -#define XML_SetUnparsedEntityDeclHandler(parser, handler) IExpat->XML_SetUnparsedEntityDeclHandler(parser, handler) -#define XML_SetNotationDeclHandler(parser, handler) IExpat->XML_SetNotationDeclHandler(parser, handler) -#define XML_SetNotStandaloneHandler(parser, handler) IExpat->XML_SetNotStandaloneHandler(parser, handler) -#define XML_GetErrorCode(parser) IExpat->XML_GetErrorCode(parser) -#define XML_ErrorString(code) IExpat->XML_ErrorString(code) -#define XML_GetCurrentByteIndex(parser) IExpat->XML_GetCurrentByteIndex(parser) -#define XML_GetCurrentLineNumber(parser) IExpat->XML_GetCurrentLineNumber(parser) -#define XML_GetCurrentColumnNumber(parser) IExpat->XML_GetCurrentColumnNumber(parser) -#define XML_GetCurrentByteCount(parser) IExpat->XML_GetCurrentByteCount(parser) -#define XML_GetInputContext(parser, offset, size) IExpat->XML_GetInputContext(parser, offset, size) -#define XML_SetUserData(parser, userData) IExpat->XML_SetUserData(parser, userData) -#define XML_DefaultCurrent(parser) IExpat->XML_DefaultCurrent(parser) -#define XML_UseParserAsHandlerArg(parser) IExpat->XML_UseParserAsHandlerArg(parser) -#define XML_SetBase(parser, base) IExpat->XML_SetBase(parser, base) -#define XML_GetBase(parser) IExpat->XML_GetBase(parser) -#define XML_GetSpecifiedAttributeCount(parser) IExpat->XML_GetSpecifiedAttributeCount(parser) -#define XML_GetIdAttributeIndex(parser) IExpat->XML_GetIdAttributeIndex(parser) -#define XML_SetEncoding(parser, encoding) IExpat->XML_SetEncoding(parser, encoding) -#define XML_SetParamEntityParsing(parser, parsing) IExpat->XML_SetParamEntityParsing(parser, parsing) -#define XML_SetReturnNSTriplet(parser, do_nst) IExpat->XML_SetReturnNSTriplet(parser, do_nst) -#define XML_ExpatVersion() IExpat->XML_ExpatVersion() -#define XML_ExpatVersionInfo() IExpat->XML_ExpatVersionInfo() -#define XML_ParserReset(parser, encoding) IExpat->XML_ParserReset(parser, encoding) -#define XML_SetSkippedEntityHandler(parser, handler) IExpat->XML_SetSkippedEntityHandler(parser, handler) -#define XML_UseForeignDTD(parser, useDTD) IExpat->XML_UseForeignDTD(parser, useDTD) -#define XML_GetFeatureList() IExpat->XML_GetFeatureList() -#define XML_StopParser(parser, resumable) IExpat->XML_StopParser(parser, resumable) -#define XML_ResumeParser(parser) IExpat->XML_ResumeParser(parser) -#define XML_GetParsingStatus(parser, status) IExpat->XML_GetParsingStatus(parser, status) -#define XML_FreeContentModel(parser, model) IExpat->XML_FreeContentModel(parser, model) -#define XML_MemMalloc(parser, size) IExpat->XML_MemMalloc(parser, size) -#define XML_MemRealloc(parser, ptr, size) IExpat->XML_MemRealloc(parser, ptr, size) -#define XML_MemFree(parser, ptr) IExpat->XML_MemFree(parser, ptr) - -#endif /* INLINE4_EXPAT_H */ diff --git a/src/expat/amiga/include/interfaces/expat.h b/src/expat/amiga/include/interfaces/expat.h deleted file mode 100644 index e9bdf4aa12..0000000000 --- a/src/expat/amiga/include/interfaces/expat.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef EXPAT_INTERFACE_DEF_H -#define EXPAT_INTERFACE_DEF_H - -/* -** This file was machine generated by idltool 51.6. -** Do not edit -*/ - -#ifndef EXEC_TYPES_H -#include -#endif -#ifndef EXEC_EXEC_H -#include -#endif -#ifndef EXEC_INTERFACES_H -#include -#endif - -#ifndef LIBRARIES_EXPAT_H -#include -#endif - -struct ExpatIFace -{ - struct InterfaceData Data; - - uint32 APICALL (*Obtain)(struct ExpatIFace *Self); - uint32 APICALL (*Release)(struct ExpatIFace *Self); - void APICALL (*Expunge)(struct ExpatIFace *Self); - struct Interface * APICALL (*Clone)(struct ExpatIFace *Self); - XML_Parser APICALL (*XML_ParserCreate)(struct ExpatIFace *Self, const XML_Char * encodingName); - XML_Parser APICALL (*XML_ParserCreateNS)(struct ExpatIFace *Self, const XML_Char * encodingName, XML_Char nsSep); - XML_Parser APICALL (*XML_ParserCreate_MM)(struct ExpatIFace *Self, const XML_Char * encoding, const XML_Memory_Handling_Suite * memsuite, const XML_Char * namespaceSeparator); - XML_Parser APICALL (*XML_ExternalEntityParserCreate)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * context, const XML_Char * encoding); - void APICALL (*XML_ParserFree)(struct ExpatIFace *Self, XML_Parser parser); - enum XML_Status APICALL (*XML_Parse)(struct ExpatIFace *Self, XML_Parser parser, const char * s, int len, int isFinal); - enum XML_Status APICALL (*XML_ParseBuffer)(struct ExpatIFace *Self, XML_Parser parser, int len, int isFinal); - void * APICALL (*XML_GetBuffer)(struct ExpatIFace *Self, XML_Parser parser, int len); - void APICALL (*XML_SetStartElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartElementHandler start); - void APICALL (*XML_SetEndElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndElementHandler end); - void APICALL (*XML_SetElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); - void APICALL (*XML_SetCharacterDataHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_CharacterDataHandler handler); - void APICALL (*XML_SetProcessingInstructionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ProcessingInstructionHandler handler); - void APICALL (*XML_SetCommentHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_CommentHandler handler); - void APICALL (*XML_SetStartCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartCdataSectionHandler start); - void APICALL (*XML_SetEndCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndCdataSectionHandler end); - void APICALL (*XML_SetCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); - void APICALL (*XML_SetDefaultHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_DefaultHandler handler); - void APICALL (*XML_SetDefaultHandlerExpand)(struct ExpatIFace *Self, XML_Parser parser, XML_DefaultHandler handler); - void APICALL (*XML_SetExternalEntityRefHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ExternalEntityRefHandler handler); - void APICALL (*XML_SetExternalEntityRefHandlerArg)(struct ExpatIFace *Self, XML_Parser parser, void * arg); - void APICALL (*XML_SetUnknownEncodingHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data); - void APICALL (*XML_SetStartNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartNamespaceDeclHandler start); - void APICALL (*XML_SetEndNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndNamespaceDeclHandler end); - void APICALL (*XML_SetNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); - void APICALL (*XML_SetXmlDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_XmlDeclHandler handler); - void APICALL (*XML_SetStartDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartDoctypeDeclHandler start); - void APICALL (*XML_SetEndDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndDoctypeDeclHandler end); - void APICALL (*XML_SetDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); - void APICALL (*XML_SetElementDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ElementDeclHandler eldecl); - void APICALL (*XML_SetAttlistDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_AttlistDeclHandler attdecl); - void APICALL (*XML_SetEntityDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EntityDeclHandler handler); - void APICALL (*XML_SetUnparsedEntityDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_UnparsedEntityDeclHandler handler); - void APICALL (*XML_SetNotationDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_NotationDeclHandler handler); - void APICALL (*XML_SetNotStandaloneHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_NotStandaloneHandler handler); - enum XML_Error APICALL (*XML_GetErrorCode)(struct ExpatIFace *Self, XML_Parser parser); - const XML_LChar * APICALL (*XML_ErrorString)(struct ExpatIFace *Self, enum XML_Error code); - long APICALL (*XML_GetCurrentByteIndex)(struct ExpatIFace *Self, XML_Parser parser); - int APICALL (*XML_GetCurrentLineNumber)(struct ExpatIFace *Self, XML_Parser parser); - int APICALL (*XML_GetCurrentColumnNumber)(struct ExpatIFace *Self, XML_Parser parser); - int APICALL (*XML_GetCurrentByteCount)(struct ExpatIFace *Self, XML_Parser parser); - const char * APICALL (*XML_GetInputContext)(struct ExpatIFace *Self, XML_Parser parser, int * offset, int * size); - void APICALL (*XML_SetUserData)(struct ExpatIFace *Self, XML_Parser parser, void * userData); - void APICALL (*XML_DefaultCurrent)(struct ExpatIFace *Self, XML_Parser parser); - void APICALL (*XML_UseParserAsHandlerArg)(struct ExpatIFace *Self, XML_Parser parser); - enum XML_Status APICALL (*XML_SetBase)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * base); - const XML_Char * APICALL (*XML_GetBase)(struct ExpatIFace *Self, XML_Parser parser); - int APICALL (*XML_GetSpecifiedAttributeCount)(struct ExpatIFace *Self, XML_Parser parser); - int APICALL (*XML_GetIdAttributeIndex)(struct ExpatIFace *Self, XML_Parser parser); - enum XML_Status APICALL (*XML_SetEncoding)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * encoding); - int APICALL (*XML_SetParamEntityParsing)(struct ExpatIFace *Self, XML_Parser parser, enum XML_ParamEntityParsing parsing); - void APICALL (*XML_SetReturnNSTriplet)(struct ExpatIFace *Self, XML_Parser parser, int do_nst); - const XML_LChar * APICALL (*XML_ExpatVersion)(struct ExpatIFace *Self); - XML_Expat_Version APICALL (*XML_ExpatVersionInfo)(struct ExpatIFace *Self); - XML_Bool APICALL (*XML_ParserReset)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * encoding); - void APICALL (*XML_SetSkippedEntityHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_SkippedEntityHandler handler); - enum XML_Error APICALL (*XML_UseForeignDTD)(struct ExpatIFace *Self, XML_Parser parser, XML_Bool useDTD); - const XML_Feature * APICALL (*XML_GetFeatureList)(struct ExpatIFace *Self); - enum XML_Status APICALL (*XML_StopParser)(struct ExpatIFace *Self, XML_Parser parser, XML_Bool resumable); - enum XML_Status APICALL (*XML_ResumeParser)(struct ExpatIFace *Self, XML_Parser parser); - void APICALL (*XML_GetParsingStatus)(struct ExpatIFace *Self, XML_Parser parser, XML_ParsingStatus * status); - void APICALL (*XML_FreeContentModel)(struct ExpatIFace *Self, XML_Parser parser, XML_Content * model); - void * APICALL (*XML_MemMalloc)(struct ExpatIFace *Self, XML_Parser parser, size_t size); - void * APICALL (*XML_MemRealloc)(struct ExpatIFace *Self, XML_Parser parser, void * ptr, size_t size); - void APICALL (*XML_MemFree)(struct ExpatIFace *Self, XML_Parser parser, void * ptr); -}; - -#endif /* EXPAT_INTERFACE_DEF_H */ diff --git a/src/expat/amiga/include/libraries/expat.h b/src/expat/amiga/include/libraries/expat.h deleted file mode 100644 index 1b57387c7b..0000000000 --- a/src/expat/amiga/include/libraries/expat.h +++ /dev/null @@ -1,566 +0,0 @@ -#ifndef LIBRARIES_EXPAT_H -#define LIBRARIES_EXPAT_H - -/* -** Copyright (c) 2001-2007 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __GNUC__ - #ifdef __PPC__ - #pragma pack(2) - #endif -#elif defined(__VBCC__) - #pragma amiga-align -#endif - -/****************************************************************************/ - - -#include - -#ifndef XMLCALL -#define XMLCALL -#endif - -typedef char XML_Char; -typedef char XML_LChar; -typedef long XML_Index; -typedef unsigned long XML_Size; - -struct XML_ParserStruct; -typedef struct XML_ParserStruct *XML_Parser; - -typedef unsigned char XML_Bool; -#define XML_TRUE ((XML_Bool) 1) -#define XML_FALSE ((XML_Bool) 0) - -enum XML_Status { - XML_STATUS_ERROR = 0, -#define XML_STATUS_ERROR XML_STATUS_ERROR - XML_STATUS_OK = 1, -#define XML_STATUS_OK XML_STATUS_OK - XML_STATUS_SUSPENDED = 2, -#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED -}; - -enum XML_Error { - XML_ERROR_NONE, - XML_ERROR_NO_MEMORY, - XML_ERROR_SYNTAX, - XML_ERROR_NO_ELEMENTS, - XML_ERROR_INVALID_TOKEN, - XML_ERROR_UNCLOSED_TOKEN, - XML_ERROR_PARTIAL_CHAR, - XML_ERROR_TAG_MISMATCH, - XML_ERROR_DUPLICATE_ATTRIBUTE, - XML_ERROR_JUNK_AFTER_DOC_ELEMENT, - XML_ERROR_PARAM_ENTITY_REF, - XML_ERROR_UNDEFINED_ENTITY, - XML_ERROR_RECURSIVE_ENTITY_REF, - XML_ERROR_ASYNC_ENTITY, - XML_ERROR_BAD_CHAR_REF, - XML_ERROR_BINARY_ENTITY_REF, - XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, - XML_ERROR_MISPLACED_XML_PI, - XML_ERROR_UNKNOWN_ENCODING, - XML_ERROR_INCORRECT_ENCODING, - XML_ERROR_UNCLOSED_CDATA_SECTION, - XML_ERROR_EXTERNAL_ENTITY_HANDLING, - XML_ERROR_NOT_STANDALONE, - XML_ERROR_UNEXPECTED_STATE, - XML_ERROR_ENTITY_DECLARED_IN_PE, - XML_ERROR_FEATURE_REQUIRES_XML_DTD, - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, - XML_ERROR_UNBOUND_PREFIX, - XML_ERROR_UNDECLARING_PREFIX, - XML_ERROR_INCOMPLETE_PE, - XML_ERROR_XML_DECL, - XML_ERROR_TEXT_DECL, - XML_ERROR_PUBLICID, - XML_ERROR_SUSPENDED, - XML_ERROR_NOT_SUSPENDED, - XML_ERROR_ABORTED, - XML_ERROR_FINISHED, - XML_ERROR_SUSPEND_PE, - XML_ERROR_RESERVED_PREFIX_XML, - XML_ERROR_RESERVED_PREFIX_XMLNS, - XML_ERROR_RESERVED_NAMESPACE_URI -}; - -enum XML_Content_Type { - XML_CTYPE_EMPTY = 1, - XML_CTYPE_ANY, - XML_CTYPE_MIXED, - XML_CTYPE_NAME, - XML_CTYPE_CHOICE, - XML_CTYPE_SEQ -}; - -enum XML_Content_Quant { - XML_CQUANT_NONE, - XML_CQUANT_OPT, - XML_CQUANT_REP, - XML_CQUANT_PLUS -}; - -typedef struct XML_cp XML_Content; - -struct XML_cp { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - XML_Char * name; - unsigned int numchildren; - XML_Content * children; -}; - - -typedef void (*XML_ElementDeclHandler) (void *userData, - const XML_Char *name, - XML_Content *model); - -void -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl); - -typedef void (*XML_AttlistDeclHandler) ( - void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired); - -void -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl); - -typedef void (*XML_XmlDeclHandler) (void *userData, - const XML_Char *version, - const XML_Char *encoding, - int standalone); - -void -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler xmldecl); - - -typedef struct { - void *(*malloc_fcn)(size_t size); - void *(*realloc_fcn)(void *ptr, size_t size); - void (*free_fcn)(void *ptr); -} XML_Memory_Handling_Suite; - -XML_Parser -XML_ParserCreate(const XML_Char *encoding); - -XML_Parser -XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); - - -XML_Parser -XML_ParserCreate_MM(const XML_Char *encoding, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *namespaceSeparator); - -XML_Bool -XML_ParserReset(XML_Parser parser, const XML_Char *encoding); - -typedef void (*XML_StartElementHandler) (void *userData, - const XML_Char *name, - const XML_Char **atts); - -typedef void (*XML_EndElementHandler) (void *userData, - const XML_Char *name); - - -typedef void (*XML_CharacterDataHandler) (void *userData, - const XML_Char *s, - int len); - -typedef void (*XML_ProcessingInstructionHandler) ( - void *userData, - const XML_Char *target, - const XML_Char *data); - -typedef void (*XML_CommentHandler) (void *userData, - const XML_Char *data); - -typedef void (*XML_StartCdataSectionHandler) (void *userData); -typedef void (*XML_EndCdataSectionHandler) (void *userData); - -typedef void (*XML_DefaultHandler) (void *userData, - const XML_Char *s, - int len); - -typedef void (*XML_StartDoctypeDeclHandler) ( - void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset); - -typedef void (*XML_EndDoctypeDeclHandler)(void *userData); - -typedef void (*XML_EntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -void -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler); - -typedef void (*XML_UnparsedEntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -typedef void (*XML_NotationDeclHandler) ( - void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -typedef void (*XML_StartNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix, - const XML_Char *uri); - -typedef void (*XML_EndNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix); - -typedef int (*XML_NotStandaloneHandler) (void *userData); - -typedef int (*XML_ExternalEntityRefHandler) ( - XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -typedef void (*XML_SkippedEntityHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity); - -typedef struct { - int map[256]; - void *data; - int (*convert)(void *data, const char *s); - void (*release)(void *data); -} XML_Encoding; - -typedef int (*XML_UnknownEncodingHandler) ( - void *encodingHandlerData, - const XML_Char *name, - XML_Encoding *info); - -void -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end); - -void -XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler handler); - -void -XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler handler); - -void -XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler); - -void -XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler); -void -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler); - -void -XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end); - -void -XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start); - -void -XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end); - -void -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler); - -void -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler); - -void -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end); - -void -XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start); - -void -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end); - -void -XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler); - -void -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler); - -void -XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end); - -void -XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start); - -void -XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end); - -void -XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler); - -void -XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler); - -void -XML_SetExternalEntityRefHandlerArg(XML_Parser parser, - void *arg); - -void -XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler); - -void -XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *encodingHandlerData); - -void -XML_DefaultCurrent(XML_Parser parser); - -void -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); - -void -XML_SetUserData(XML_Parser parser, void *userData); - -#define XML_GetUserData(parser) (*(void **)(parser)) - -enum XML_Status -XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); - -void -XML_UseParserAsHandlerArg(XML_Parser parser); - -enum XML_Error -XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); - - -enum XML_Status -XML_SetBase(XML_Parser parser, const XML_Char *base); - -const XML_Char * -XML_GetBase(XML_Parser parser); - -int -XML_GetSpecifiedAttributeCount(XML_Parser parser); - -int -XML_GetIdAttributeIndex(XML_Parser parser); - -enum XML_Status -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); - -void * -XML_GetBuffer(XML_Parser parser, int len); - -enum XML_Status -XML_ParseBuffer(XML_Parser parser, int len, int isFinal); - -enum XML_Status -XML_StopParser(XML_Parser parser, XML_Bool resumable); - -enum XML_Status -XML_ResumeParser(XML_Parser parser); - -enum XML_Parsing { - XML_INITIALIZED, - XML_PARSING, - XML_FINISHED, - XML_SUSPENDED -}; - -typedef struct { - enum XML_Parsing parsing; - XML_Bool finalBuffer; -} XML_ParsingStatus; - -void -XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); - -XML_Parser -XML_ExternalEntityParserCreate(XML_Parser parser, - const XML_Char *context, - const XML_Char *encoding); - -enum XML_ParamEntityParsing { - XML_PARAM_ENTITY_PARSING_NEVER, - XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, - XML_PARAM_ENTITY_PARSING_ALWAYS -}; - -int -XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing parsing); - -enum XML_Error -XML_GetErrorCode(XML_Parser parser); - -int XML_GetCurrentLineNumber(XML_Parser parser); -int XML_GetCurrentColumnNumber(XML_Parser parser); -long XML_GetCurrentByteIndex(XML_Parser parser); - -int -XML_GetCurrentByteCount(XML_Parser parser); - -const char * -XML_GetInputContext(XML_Parser parser, - int *offset, - int *size); - -#define XML_GetErrorLineNumber XML_GetCurrentLineNumber -#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber -#define XML_GetErrorByteIndex XML_GetCurrentByteIndex - -void -XML_FreeContentModel(XML_Parser parser, XML_Content *model); - -void * -XML_MemMalloc(XML_Parser parser, size_t size); - -void * -XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); - -void -XML_MemFree(XML_Parser parser, void *ptr); - -void -XML_ParserFree(XML_Parser parser); - -const XML_LChar * -XML_ErrorString(enum XML_Error code); - -const XML_LChar * -XML_ExpatVersion(void); - -typedef struct { - int major; - int minor; - int micro; -} XML_Expat_Version; - -XML_Expat_Version -XML_ExpatVersionInfo(void); - -enum XML_FeatureEnum { - XML_FEATURE_END = 0, - XML_FEATURE_UNICODE, - XML_FEATURE_UNICODE_WCHAR_T, - XML_FEATURE_DTD, - XML_FEATURE_CONTEXT_BYTES, - XML_FEATURE_MIN_SIZE, - XML_FEATURE_SIZEOF_XML_CHAR, - XML_FEATURE_SIZEOF_XML_LCHAR, - XML_FEATURE_NS, - XML_FEATURE_LARGE_SIZE -}; - -typedef struct { - enum XML_FeatureEnum feature; - const XML_LChar *name; - long int value; -} XML_Feature; - -const XML_Feature * -XML_GetFeatureList(void); - - -#define XML_MAJOR_VERSION 2 -#define XML_MINOR_VERSION 0 -#define XML_MICRO_VERSION 1 - - -/****************************************************************************/ - -#ifdef __GNUC__ - #ifdef __PPC__ - #pragma pack() - #endif -#elif defined(__VBCC__) - #pragma default-align -#endif - -#ifdef __cplusplus -} -#endif - -/****************************************************************************/ - -#endif /* EXPAT_EXPAT_H */ diff --git a/src/expat/amiga/include/proto/expat.h b/src/expat/amiga/include/proto/expat.h deleted file mode 100644 index 90bf62c46e..0000000000 --- a/src/expat/amiga/include/proto/expat.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef PROTO_EXPAT_H -#define PROTO_EXPAT_H - -#ifndef LIBRARIES_EXPAT_H -#include -#endif - -/****************************************************************************/ - -#ifndef __NOLIBBASE__ - #ifndef __USE_BASETYPE__ - extern struct Library * ExpatBase; - #else - extern struct Library * ExpatBase; - #endif /* __USE_BASETYPE__ */ -#endif /* __NOLIBBASE__ */ - -/****************************************************************************/ - -#ifdef __amigaos4__ - #include - #ifdef __USE_INLINE__ - #include - #endif /* __USE_INLINE__ */ - #ifndef CLIB_EXPAT_PROTOS_H - #define CLIB_EXPAT_PROTOS_H 1 - #endif /* CLIB_EXPAT_PROTOS_H */ - #ifndef __NOGLOBALIFACE__ - extern struct ExpatIFace *IExpat; - #endif /* __NOGLOBALIFACE__ */ -#else /* __amigaos4__ */ - #ifndef CLIB_EXPAT_PROTOS_H - #include - #endif /* CLIB_EXPAT_PROTOS_H */ - #if defined(__GNUC__) - #ifndef __PPC__ - #include - #else - #include - #endif /* __PPC__ */ - #elif defined(__VBCC__) - #ifndef __PPC__ - #include - #endif /* __PPC__ */ - #else - #include - #endif /* __GNUC__ */ -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -#endif /* PROTO_EXPAT_H */ diff --git a/src/expat/amiga/launch.c b/src/expat/amiga/launch.c deleted file mode 100644 index 20b069c3f8..0000000000 --- a/src/expat/amiga/launch.c +++ /dev/null @@ -1,57 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifdef __USE_INLINE__ -#undef __USE_INLINE__ -#endif - -#include -#include - -struct Library* ExpatBase = 0; -struct ExpatIFace* IExpat = 0; - - -void setup() __attribute__((constructor)); -void cleanup() __attribute__((destructor)); - - -void setup() -{ - ExpatBase = IExec->OpenLibrary("expat.library", 53); - IExpat = (struct ExpatIFace*)IExec->GetInterface(ExpatBase, "main", 1, NULL); - - if ( IExpat == 0 ) { - IExec->DebugPrintF("Can't open expat.library\n"); - } -} - - -void cleanup() -{ - IExec->DropInterface((struct Interface*)IExpat); - IExpat = 0; - - IExec->CloseLibrary(ExpatBase); - ExpatBase = 0; -} diff --git a/src/expat/bcb5/README.txt b/src/expat/bcb5/README.txt deleted file mode 100644 index 486f1ca85d..0000000000 --- a/src/expat/bcb5/README.txt +++ /dev/null @@ -1,87 +0,0 @@ - - Using a Borland compiler product - -The files in this directory support using both the free Borland command-line -compiler tools and the Borland C++ Builder IDE. The project files have been -tested with both versions 5 and 6 of the C++ Builder product. - - Using the free BCC32 command line compiler - -After downloading and installing the free C++ Builder commandline version, -perform the following steps (assuming it was installed under C:\Borland\BCC55): - -1) Add "C:\Borland\BCC55\BIN" to your path -2) Set the environment variable BCB to "C:\Borland\BCC55". -3) edit makefile.mak: enable or comment out the appropriate commands under - clean & distclean, depending on whether your OS can use deltree /y or - del /s/f/q. - -After that, you should simply cd to the bcb5 directory in your Expat directory -tree (same structure as CVS) and run "make all" or just "make". - - Naming - -The libraries have the base name "libexpat" followed optionally by an "s" -(static) or a "w" (unicode version), then an underscore and optionally -"mt" (multi-threaded) and "d" (dynamic RTL). - -To change the name of the library a project file produces, edit the project -option source (see step 1 under Unicode below) and change the name contained in -the PROJECT tag. In a make file, change the value assigned to the PROJECT -variable. Also, the LIBRARY entry in the .def file has to be changed to -correspond to the new executable name. - - - Unicode Considerations - -There are no facilities in the BCB 5 GUI to create a unicode-enabled -application. Fortunately, it is not hard to do by hand. - -1. The startup .obj system file must be changed to the unicode version. - Go to Project|Edit Option Source, and scroll down to the ALLOBJ tag. Change - c0x32.obj to c0x32w.obj. Editing this file can be quirky, but usually the - following kludge will make the change stick. Close and save the file - (CTRL-F4) then open the options dialog (CTRL-Shift-F11), then click OK on - the dialog immediately without changing anything in it. If this doesn't work, - you will have to close the project completely and edit the .bpr file by hand. - - If you are using a make file, just change the startup .obj file assigned - to the ALLOBJ variable. - -2. Add the macro define XML_UNICODE_WCHAR_T. In the GUI that goes in the options - dialog, Directories/Conditionals tab, in the Conditional define box. In a - make file, put it in the USERDEFINES variable. - -3. Of course, your code has to be written for unicode. As a start, the "main" - function is called "wmain". The tchar macros are an interesting way to - write code that can easily switch between unicode and utf-8. If these macros - are used, then simply adding the conditional define _UNICODE as well as - XML_UNICODE_WCHAR_T will bring in the unicode versions of the tchar macros. - Otherwise the utf-8 versions are used. xmlwf uses its own versions of the - tchar macros which are switched on and off by the XML_UNICODE macro, which - itself is set by the XML_UNICODE_WCHAR_T define. - - Threading - -The libexpat libraries are all built to link with the multi-threaded dynamic RTL's. -That means they require CC32xxMT.DLL present on the installation target. -To create single-threaded libs, do the following: - -1. The compiler option for multi-threading must be turned off. Following the - instructions above to edit the option source, remove the -tWM option from - the CFLAG1 tag. In a make file, remove it from the CFLAG1 variable. - -2. The single threaded RTL must be called. change the RTL in the ALLLIB tag or - variable (GUI or makefile repectively) to the version without the "mt" in the - name. For example, change cw32mti.lib to cw32i.lib. - - Static RTL's - -To build the libs with static RTL's do the following, - -1. For the static expatlibs, in the Tlib tab on the options dialog, uncheck the - "Use dynamic RTL" box. For the dynamic expatlibs, in the Linker tab on the - options dialog, uncheck "Use dynamic RTL". If you are using a make file, - remove the _RTLDLL assignment to the SYSDEFINES variable, and change the RTL - to the version without an "i" in the ALLLIB variable. For example, - cw32mti.lib would become cw32mt.lib. diff --git a/src/expat/bcb5/all_projects.bpg b/src/expat/bcb5/all_projects.bpg deleted file mode 100644 index 27c9a1cba5..0000000000 --- a/src/expat/bcb5/all_projects.bpg +++ /dev/null @@ -1,49 +0,0 @@ -#------------------------------------------------------------------------------ -VERSION = BWS.01 -#------------------------------------------------------------------------------ -!ifndef ROOT -ROOT = $(MAKEDIR)\.. -!endif -#------------------------------------------------------------------------------ -MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** -DCC = $(ROOT)\bin\dcc32.exe $** -BRCC = $(ROOT)\bin\brcc32.exe $** -#------------------------------------------------------------------------------ -PROJECTS = setup libexpat_mtd.dll libexpats_mtd.lib libexpatw_mtd.dll \ - libexpatws_mtd.lib elements.exe outline.exe xmlwf.exe -#------------------------------------------------------------------------------ -default: $(PROJECTS) -#------------------------------------------------------------------------------ - -libexpat_mtd.dll: expat.bpr - $(ROOT)\bin\bpr2mak $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -libexpats_mtd.lib: expat_static.bpr - $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -libexpatw_mtd.dll: expatw.bpr - $(ROOT)\bin\bpr2mak $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -libexpatws_mtd.lib: expatw_static.bpr - $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -elements.exe: elements.bpr - $(ROOT)\bin\bpr2mak $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -outline.exe: outline.bpr - $(ROOT)\bin\bpr2mak $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -xmlwf.exe: xmlwf.bpr - $(ROOT)\bin\bpr2mak $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -setup: setup.bat - call $** - - diff --git a/src/expat/bcb5/elements.bpf b/src/expat/bcb5/elements.bpf deleted file mode 100644 index 5c1e878d67..0000000000 --- a/src/expat/bcb5/elements.bpf +++ /dev/null @@ -1,4 +0,0 @@ -USEUNIT("..\examples\elements.c"); -USELIB("Release\libexpats_mtd.lib"); -//--------------------------------------------------------------------------- -main diff --git a/src/expat/bcb5/elements.bpr b/src/expat/bcb5/elements.bpr deleted file mode 100644 index e6e260f8a7..0000000000 --- a/src/expat/bcb5/elements.bpr +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\examples;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=8 -Item0=..\examples;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\examples;$(BCB)\lib;..\examples\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);..\lib\Release-w_static -Item4=$(BCB)\lib;$(RELEASELIBPATH);..\lib\Release_static -Item5=$(BCB)\lib;$(RELEASELIBPATH);C:\src\expat\lib\Release_static -Item6=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item7=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=17 -Item0=WIN32;NDEBUG;_CONSOLE;XML_STATIC -Item1=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_STATIC -Item2=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE;XML_STATIC -Item3=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE -Item4=WIN32;NDEBUG;_CONSOLE;_DEBUG -Item5=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG -Item6=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG;_UNICODE -Item7=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T -Item8=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T -Item9=WIN32;NDEBUG;_CONSOLE;_UNICODE;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T -Item10=WIN32;NDEBUG;_CONSOLE;_UNICODE;XML_STATIC;_DEBUG;XML_UNICODE -Item11=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T;__WCHAR_T -Item12=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE -Item13=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE;_UNICODE -Item14=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE -Item15=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG -Item16=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC - -[HistoryLists\hlIntOutputDir] -Count=5 -Item0=Release\obj\examples -Item1=Release\obj\elements -Item2=Release\obj\mts -Item3=..\examples\Release -Item4=Release - -[HistoryLists\hlFinalOutputDir] -Count=1 -Item0=Release\ - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - -@ diff --git a/src/expat/bcb5/elements.mak b/src/expat/bcb5/elements.mak deleted file mode 100644 index d4427fd512..0000000000 --- a/src/expat/bcb5/elements.mak +++ /dev/null @@ -1,186 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\elements.exe -OBJFILES = Release\obj\examples\elements.obj -RESFILES = -MAINSOURCE = elements.bpf -RESDEPEN = $(RESFILES) -LIBFILES = Release\libexpats_mtd.lib -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ - ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ - VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ - dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi -SPARELIBS = -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\examples -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = WIN32;NDEBUG;_CONSOLE;XML_STATIC -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\examples;$(BCB)\include -LIBPATH = ..\examples;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS= -w-par -w-8027 -w-8026 -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -I..\lib -c -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\examples -N0Release\obj\examples -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -IRelease\obj\examples -D"" -ap -Tpe -x -Gn -q -L..\LIB\RELEASE_STATIC -# --------------------------------------------------------------------------- -ALLOBJ = c0x32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) -L$(LIBPATH) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/src/expat/bcb5/expat.bpf b/src/expat/bcb5/expat.bpf deleted file mode 100644 index 2c423283f1..0000000000 --- a/src/expat/bcb5/expat.bpf +++ /dev/null @@ -1,6 +0,0 @@ -USEUNIT("..\lib\xmlparse.c"); -USEUNIT("..\lib\xmlrole.c"); -USEUNIT("..\lib\xmltok.c"); -USEDEF("libexpat_mtd.def"); -//--------------------------------------------------------------------------- -#define DllEntryPoint diff --git a/src/expat/bcb5/expat.bpr b/src/expat/bcb5/expat.bpr deleted file mode 100644 index 826f024015..0000000000 --- a/src/expat/bcb5/expat.bpr +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\lib;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=5 -Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=8 -Item0=_WINDOWS;WIN32;NDEBUG;_USRDLL;EXPAT_EXPORTS -Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS -Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS -Item3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS -Item4=NDEBUG;WIN32;_WINDOWS;_USRDLL;_DEBUG;EXPAT_EXPORTS -Item5=NDEBUG;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;_DEBUG -Item6=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;_DEBUG -Item7=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS - -[HistoryLists\hlIntOutputDir] -Count=7 -Item0=Release\obj\libexpat -Item1=Release\obj\libexpat_static -Item2=Release\obj\mtd -Item3=Release\obj\mt -Item4=Release\obj -Item5=Release -Item6=..\lib\Release - -[HistoryLists\hlFinalOutputDir] -Count=1 -Item0=Release\ - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - -@ diff --git a/src/expat/bcb5/expat.mak b/src/expat/bcb5/expat.mak deleted file mode 100644 index 08b3f1bc02..0000000000 --- a/src/expat/bcb5/expat.mak +++ /dev/null @@ -1,187 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\libexpat_mtd.dll -OBJFILES = Release\obj\libexpat\xmlparse.obj Release\obj\libexpat\xmlrole.obj \ - Release\obj\libexpat\xmltok.obj -RESFILES = -MAINSOURCE = expat.bpf -RESDEPEN = $(RESFILES) -LIBFILES = -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ - ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ - VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ - dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi -SPARELIBS = -DEFFILE = libexpat_mtd.def -# --------------------------------------------------------------------------- -PATHCPP = .;..\lib -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\lib;$(BCB)\include -LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS= -w-rch -w-par -w-8027 -w-8026 -w-ccc -# --------------------------------------------------------------------------- -CFLAG1 = -WD -O2 -X- -a8 -b -k- -vi -q -tWM -c -tWD -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\libexpat -N0Release\obj\libexpat -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -IRelease\obj\libexpat -D"" -aa -Tpd -x -Gn -Gi -q -# --------------------------------------------------------------------------- -ALLOBJ = c0d32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) -L$(LIBPATH) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/src/expat/bcb5/expat_static.bpf b/src/expat/bcb5/expat_static.bpf deleted file mode 100644 index 5ca458edca..0000000000 --- a/src/expat/bcb5/expat_static.bpf +++ /dev/null @@ -1,5 +0,0 @@ -USEUNIT("..\lib\xmlparse.c"); -USEUNIT("..\lib\xmlrole.c"); -USEUNIT("..\lib\xmltok.c"); -//--------------------------------------------------------------------------- -#define Library diff --git a/src/expat/bcb5/expat_static.bpr b/src/expat/bcb5/expat_static.bpr deleted file mode 100644 index 26c2502aa1..0000000000 --- a/src/expat/bcb5/expat_static.bpr +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\lib;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=5 -Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=7 -Item0=_WINDOWS;WIN32;NDEBUG;_LIB;XML_STATIC -Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;XML_STATIC -Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;XML_STATIC -Item3=WIN32;_WINDOWS;NDEBUG;_LIB;_DEBUG -Item4=WIN32;_WINDOWS;NDEBUG;_LIB -Item5=WIN32;_WINDOWS;NDEBUG;_LIB;_MBCS -Item6=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB - -[HistoryLists\hlIntOutputDir] -Count=6 -Item0=Release\obj\libexpat_static -Item1=Release\obj\mts -Item2=Release\obj\mt -Item3=Release -Item4=..\lib\Release_static -Item5=Release_static - -[HistoryLists\hlFinalOutputDir] -Count=3 -Item0=Release\ -Item1=Release -Item2=Release_static\ - -[HistoryLists\hlTlibPageSize] -Count=1 -Item0=0x0010 - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - -@ diff --git a/src/expat/bcb5/expat_static.mak b/src/expat/bcb5/expat_static.mak deleted file mode 100644 index 9322c49507..0000000000 --- a/src/expat/bcb5/expat_static.mak +++ /dev/null @@ -1,189 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\libexpats_mtd.lib -OBJFILES = Release\obj\libexpat_static\xmlparse.obj \ - Release\obj\libexpat_static\xmlrole.obj \ - Release\obj\libexpat_static\xmltok.obj -RESFILES = -MAINSOURCE = expat_static.bpf -RESDEPEN = $(RESFILES) -LIBFILES = -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = -SPARELIBS = -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\lib -PATHASM = .; -PATHPAS = .; -PATHRC = .; -LINKER = TLib -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;XML_STATIC -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\lib;$(BCB)\include -LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS = -w-rch -w-par -w-8027 -w-8026 -w-ccc -LISTFILE = -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -c -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\libexpat_static -N0Release\obj\libexpat_static -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = TLib -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -!if "$(LISTFILE)" == "" -COMMA = -!else -COMMA = , -!endif - -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) /u $@ @&&! - $(LFLAGS) $? $(COMMA) $(LISTFILE) - -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/src/expat/bcb5/expatw.bpf b/src/expat/bcb5/expatw.bpf deleted file mode 100644 index 188a6d54ea..0000000000 --- a/src/expat/bcb5/expatw.bpf +++ /dev/null @@ -1,6 +0,0 @@ -USEUNIT("..\lib\xmlparse.c"); -USEUNIT("..\lib\xmlrole.c"); -USEUNIT("..\lib\xmltok.c"); -USEDEF("libexpatw_mtd.def"); -//--------------------------------------------------------------------------- -#define DllEntryPoint diff --git a/src/expat/bcb5/expatw.bpr b/src/expat/bcb5/expatw.bpr deleted file mode 100644 index 10859332f6..0000000000 --- a/src/expat/bcb5/expatw.bpr +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\lib;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=5 -Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=9 -Item0=_WINDOWS;WIN32;NDEBUG;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T -Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T -Item2=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T -Item3=NDEBUG;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;_DEBUG;XML_UNICODE_WCHAR_T -Item4=NDEBUG;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG -Item5=NDEBUG;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG -Item6=NDEBUG;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T -Item7=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;XML_UNICODE -Item8=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T - -[HistoryLists\hlIntOutputDir] -Count=8 -Item0=Release\obj\libexpatw -Item1=Release\obj\libexpat -Item2=Release\obj\mtd -Item3=Release\obj\mt -Item4=Release_w\obj -Item5=Release-w\obj -Item6=Release-w -Item7=..\lib\Release-w - -[HistoryLists\hlFinalOutputDir] -Count=5 -Item0=Release\ -Item1=Release -Item2=Release_w\ -Item3=Release-w\ -Item4=Release-w - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - -@ diff --git a/src/expat/bcb5/expatw.mak b/src/expat/bcb5/expatw.mak deleted file mode 100644 index 848d814fa6..0000000000 --- a/src/expat/bcb5/expatw.mak +++ /dev/null @@ -1,187 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\libexpatw_mtd.dll -OBJFILES = Release\obj\libexpatw\xmlparse.obj Release\obj\libexpatw\xmlrole.obj \ - Release\obj\libexpatw\xmltok.obj -RESFILES = -MAINSOURCE = expatw.bpf -RESDEPEN = $(RESFILES) -LIBFILES = -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ - ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ - VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ - dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi -SPARELIBS = -DEFFILE = libexpatw_mtd.def -# --------------------------------------------------------------------------- -PATHCPP = .;..\lib -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL;XML_UNICODE_WCHAR_T -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\lib;$(BCB)\include -LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS= -w-rch -w-par -w-8027 -w-8026 -w-ccc -# --------------------------------------------------------------------------- -CFLAG1 = -WD -O2 -X- -a8 -b -k- -vi -q -tWM -c -tWD -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\libexpatw -N0Release\obj\libexpatw -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -IRelease\obj\libexpatw -D"" -aa -Tpd -x -Gn -Gi -w -q -# --------------------------------------------------------------------------- -ALLOBJ = c0d32w.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) -L$(LIBPATH) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/src/expat/bcb5/expatw_static.bpf b/src/expat/bcb5/expatw_static.bpf deleted file mode 100644 index 5ca458edca..0000000000 --- a/src/expat/bcb5/expatw_static.bpf +++ /dev/null @@ -1,5 +0,0 @@ -USEUNIT("..\lib\xmlparse.c"); -USEUNIT("..\lib\xmlrole.c"); -USEUNIT("..\lib\xmltok.c"); -//--------------------------------------------------------------------------- -#define Library diff --git a/src/expat/bcb5/expatw_static.bpr b/src/expat/bcb5/expatw_static.bpr deleted file mode 100644 index f73dca2c09..0000000000 --- a/src/expat/bcb5/expatw_static.bpr +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\lib;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=5 -Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=15 -Item0=_WINDOWS;WIN32;NDEBUG;_LIB;XML_STATIC;XML_UNICODE_WCHAR_T -Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;XML_STATIC;XML_UNICODE_WCHAR_T -Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;XML_STATIC;XML_UNICODE_WCHAR_T -Item3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;XML_STATIC;XML_UNICODE_WCHAR_T -Item4=WIN32;_WINDOWS;NDEBUG;_LIB;_DEBUG;XML_UNICODE_WCHAR_T -Item5=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;XML_UNICODE_WCHAR_T;_DEBUG -Item6=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;XML_UNICODE_WCHAR_T;_DEBUG;__cplusplus -Item7=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;XML_UNICODE;_DEBUG -Item8=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE;_DEBUG -Item9=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE_WCHAR_T;_DEBUG;__WCHAR_T -Item10=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE_WCHAR_T;_DEBUG;_UNICODE -Item11=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE;_DEBUG;_UNICODE -Item12=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE_WCHAR_T;_DEBUG -Item13=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE_WCHAR_T -Item14=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE_WCHAR_T;XML_UNICODE - -[HistoryLists\hlIntOutputDir] -Count=6 -Item0=Release\obj\libexpatw_static -Item1=Release\obj\libexpat_static -Item2=Release\obj\mts -Item3=Release\obj\mt -Item4=..\lib\Release-w_static -Item5=Release-w_static - -[HistoryLists\hlFinalOutputDir] -Count=3 -Item0=Release\ -Item1=Release -Item2=Release-w_static\ - -[HistoryLists\hlTlibPageSize] -Count=1 -Item0=0x0010 - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - -@ diff --git a/src/expat/bcb5/expatw_static.mak b/src/expat/bcb5/expatw_static.mak deleted file mode 100644 index 49944c77e7..0000000000 --- a/src/expat/bcb5/expatw_static.mak +++ /dev/null @@ -1,190 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\libexpatws_mtd.lib -OBJFILES = Release\obj\libexpatw_static\xmlparse.obj \ - Release\obj\libexpatw_static\xmlrole.obj \ - Release\obj\libexpatw_static\xmltok.obj -RESFILES = -MAINSOURCE = expatw_static.bpf -RESDEPEN = $(RESFILES) -LIBFILES = -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = -SPARELIBS = -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\lib -PATHASM = .; -PATHPAS = .; -PATHRC = .; -LINKER = TLib -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;XML_STATIC;XML_UNICODE_WCHAR_T -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\lib;$(BCB)\include -LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS = -w-rch -w-par -w-8027 -w-8026 -w-ccc -LISTFILE = -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -c -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\libexpatw_static -N0Release\obj\libexpatw_static -$Y- -$L- \ - -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = TLib -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -!if "$(LISTFILE)" == "" -COMMA = -!else -COMMA = , -!endif - -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) /u $@ @&&! - $(LFLAGS) $? $(COMMA) $(LISTFILE) - -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/src/expat/bcb5/libexpat_mtd.def b/src/expat/bcb5/libexpat_mtd.def deleted file mode 100644 index fc1cb9554f..0000000000 --- a/src/expat/bcb5/libexpat_mtd.def +++ /dev/null @@ -1,141 +0,0 @@ -; DEF file for BCB5 -LIBRARY LIBEXPAT_MTD -DESCRIPTION "Implements an XML parser." -EXPORTS - _XML_DefaultCurrent @1 - _XML_ErrorString @2 - _XML_ExpatVersion @3 - _XML_ExpatVersionInfo @4 - _XML_ExternalEntityParserCreate @5 - _XML_GetBase @6 - _XML_GetBuffer @7 - _XML_GetCurrentByteCount @8 - _XML_GetCurrentByteIndex @9 - _XML_GetCurrentColumnNumber @10 - _XML_GetCurrentLineNumber @11 - _XML_GetErrorCode @12 - _XML_GetIdAttributeIndex @13 - _XML_GetInputContext @14 - _XML_GetSpecifiedAttributeCount @15 - _XML_Parse @16 - _XML_ParseBuffer @17 - _XML_ParserCreate @18 - _XML_ParserCreateNS @19 - _XML_ParserCreate_MM @20 - _XML_ParserFree @21 - _XML_SetAttlistDeclHandler @22 - _XML_SetBase @23 - _XML_SetCdataSectionHandler @24 - _XML_SetCharacterDataHandler @25 - _XML_SetCommentHandler @26 - _XML_SetDefaultHandler @27 - _XML_SetDefaultHandlerExpand @28 - _XML_SetDoctypeDeclHandler @29 - _XML_SetElementDeclHandler @30 - _XML_SetElementHandler @31 - _XML_SetEncoding @32 - _XML_SetEndCdataSectionHandler @33 - _XML_SetEndDoctypeDeclHandler @34 - _XML_SetEndElementHandler @35 - _XML_SetEndNamespaceDeclHandler @36 - _XML_SetEntityDeclHandler @37 - _XML_SetExternalEntityRefHandler @38 - _XML_SetExternalEntityRefHandlerArg @39 - _XML_SetNamespaceDeclHandler @40 - _XML_SetNotStandaloneHandler @41 - _XML_SetNotationDeclHandler @42 - _XML_SetParamEntityParsing @43 - _XML_SetProcessingInstructionHandler @44 - _XML_SetReturnNSTriplet @45 - _XML_SetStartCdataSectionHandler @46 - _XML_SetStartDoctypeDeclHandler @47 - _XML_SetStartElementHandler @48 - _XML_SetStartNamespaceDeclHandler @49 - _XML_SetUnknownEncodingHandler @50 - _XML_SetUnparsedEntityDeclHandler @51 - _XML_SetUserData @52 - _XML_SetXmlDeclHandler @53 - _XML_UseParserAsHandlerArg @54 -; added with version 1.95.3 - _XML_ParserReset @55 - _XML_SetSkippedEntityHandler @56 -; added with version 1.95.5 - _XML_GetFeatureList @57 - _XML_UseForeignDTD @58 -; added with version 1.95.6 - _XML_FreeContentModel @59 - _XML_MemMalloc @60 - _XML_MemRealloc @61 - _XML_MemFree @62 -; added with version 1.95.8 - _XML_StopParser @63 - _XML_ResumeParser @64 - _XML_GetParsingStatus @65 - -; Aliases for MS compatible names - XML_DefaultCurrent = _XML_DefaultCurrent - XML_ErrorString = _XML_ErrorString - XML_ExpatVersion = _XML_ExpatVersion - XML_ExpatVersionInfo = _XML_ExpatVersionInfo - XML_ExternalEntityParserCreate = _XML_ExternalEntityParserCreate - XML_GetBase = _XML_GetBase - XML_GetBuffer = _XML_GetBuffer - XML_GetCurrentByteCount = _XML_GetCurrentByteCount - XML_GetCurrentByteIndex = _XML_GetCurrentByteIndex - XML_GetCurrentColumnNumber = _XML_GetCurrentColumnNumber - XML_GetCurrentLineNumber = _XML_GetCurrentLineNumber - XML_GetErrorCode = _XML_GetErrorCode - XML_GetIdAttributeIndex = _XML_GetIdAttributeIndex - XML_GetInputContext = _XML_GetInputContext - XML_GetSpecifiedAttributeCount = _XML_GetSpecifiedAttributeCount - XML_Parse = _XML_Parse - XML_ParseBuffer = _XML_ParseBuffer - XML_ParserCreate = _XML_ParserCreate - XML_ParserCreateNS = _XML_ParserCreateNS - XML_ParserCreate_MM = _XML_ParserCreate_MM - XML_ParserFree = _XML_ParserFree - XML_SetAttlistDeclHandler = _XML_SetAttlistDeclHandler - XML_SetBase = _XML_SetBase - XML_SetCdataSectionHandler = _XML_SetCdataSectionHandler - XML_SetCharacterDataHandler = _XML_SetCharacterDataHandler - XML_SetCommentHandler = _XML_SetCommentHandler - XML_SetDefaultHandler = _XML_SetDefaultHandler - XML_SetDefaultHandlerExpand = _XML_SetDefaultHandlerExpand - XML_SetDoctypeDeclHandler = _XML_SetDoctypeDeclHandler - XML_SetElementDeclHandler = _XML_SetElementDeclHandler - XML_SetElementHandler = _XML_SetElementHandler - XML_SetEncoding = _XML_SetEncoding - XML_SetEndCdataSectionHandler = _XML_SetEndCdataSectionHandler - XML_SetEndDoctypeDeclHandler = _XML_SetEndDoctypeDeclHandler - XML_SetEndElementHandler = _XML_SetEndElementHandler - XML_SetEndNamespaceDeclHandler = _XML_SetEndNamespaceDeclHandler - XML_SetEntityDeclHandler = _XML_SetEntityDeclHandler - XML_SetExternalEntityRefHandler = _XML_SetExternalEntityRefHandler - XML_SetExternalEntityRefHandlerArg = _XML_SetExternalEntityRefHandlerArg - XML_SetNamespaceDeclHandler = _XML_SetNamespaceDeclHandler - XML_SetNotStandaloneHandler = _XML_SetNotStandaloneHandler - XML_SetNotationDeclHandler = _XML_SetNotationDeclHandler - XML_SetParamEntityParsing = _XML_SetParamEntityParsing - XML_SetProcessingInstructionHandler = _XML_SetProcessingInstructionHandler - XML_SetReturnNSTriplet = _XML_SetReturnNSTriplet - XML_SetStartCdataSectionHandler = _XML_SetStartCdataSectionHandler - XML_SetStartDoctypeDeclHandler = _XML_SetStartDoctypeDeclHandler - XML_SetStartElementHandler = _XML_SetStartElementHandler - XML_SetStartNamespaceDeclHandler = _XML_SetStartNamespaceDeclHandler - XML_SetUnknownEncodingHandler = _XML_SetUnknownEncodingHandler - XML_SetUnparsedEntityDeclHandler = _XML_SetUnparsedEntityDeclHandler - XML_SetUserData = _XML_SetUserData - XML_SetXmlDeclHandler = _XML_SetXmlDeclHandler - XML_UseParserAsHandlerArg = _XML_UseParserAsHandlerArg - XML_ParserReset = _XML_ParserReset - XML_SetSkippedEntityHandler = _XML_SetSkippedEntityHandler - XML_GetFeatureList = _XML_GetFeatureList - XML_UseForeignDTD = _XML_UseForeignDTD - XML_FreeContentModel = _XML_FreeContentModel - XML_MemMalloc = _XML_MemMalloc - XML_MemRealloc = _XML_MemRealloc - XML_MemFree = _XML_MemFree - XML_StopParser = _XML_StopParser - XML_ResumeParser = _XML_ResumeParser - XML_GetParsingStatus = _XML_GetParsingStatus - diff --git a/src/expat/bcb5/libexpatw_mtd.def b/src/expat/bcb5/libexpatw_mtd.def deleted file mode 100644 index 418462df5a..0000000000 --- a/src/expat/bcb5/libexpatw_mtd.def +++ /dev/null @@ -1,140 +0,0 @@ -; DEF file for BCB5 -LIBRARY LIBEXPATW_MTD -DESCRIPTION "Implements an XML parser." -EXPORTS - _XML_DefaultCurrent @1 - _XML_ErrorString @2 - _XML_ExpatVersion @3 - _XML_ExpatVersionInfo @4 - _XML_ExternalEntityParserCreate @5 - _XML_GetBase @6 - _XML_GetBuffer @7 - _XML_GetCurrentByteCount @8 - _XML_GetCurrentByteIndex @9 - _XML_GetCurrentColumnNumber @10 - _XML_GetCurrentLineNumber @11 - _XML_GetErrorCode @12 - _XML_GetIdAttributeIndex @13 - _XML_GetInputContext @14 - _XML_GetSpecifiedAttributeCount @15 - _XML_Parse @16 - _XML_ParseBuffer @17 - _XML_ParserCreate @18 - _XML_ParserCreateNS @19 - _XML_ParserCreate_MM @20 - _XML_ParserFree @21 - _XML_SetAttlistDeclHandler @22 - _XML_SetBase @23 - _XML_SetCdataSectionHandler @24 - _XML_SetCharacterDataHandler @25 - _XML_SetCommentHandler @26 - _XML_SetDefaultHandler @27 - _XML_SetDefaultHandlerExpand @28 - _XML_SetDoctypeDeclHandler @29 - _XML_SetElementDeclHandler @30 - _XML_SetElementHandler @31 - _XML_SetEncoding @32 - _XML_SetEndCdataSectionHandler @33 - _XML_SetEndDoctypeDeclHandler @34 - _XML_SetEndElementHandler @35 - _XML_SetEndNamespaceDeclHandler @36 - _XML_SetEntityDeclHandler @37 - _XML_SetExternalEntityRefHandler @38 - _XML_SetExternalEntityRefHandlerArg @39 - _XML_SetNamespaceDeclHandler @40 - _XML_SetNotStandaloneHandler @41 - _XML_SetNotationDeclHandler @42 - _XML_SetParamEntityParsing @43 - _XML_SetProcessingInstructionHandler @44 - _XML_SetReturnNSTriplet @45 - _XML_SetStartCdataSectionHandler @46 - _XML_SetStartDoctypeDeclHandler @47 - _XML_SetStartElementHandler @48 - _XML_SetStartNamespaceDeclHandler @49 - _XML_SetUnknownEncodingHandler @50 - _XML_SetUnparsedEntityDeclHandler @51 - _XML_SetUserData @52 - _XML_SetXmlDeclHandler @53 - _XML_UseParserAsHandlerArg @54 -; added with version 1.95.3 - _XML_ParserReset @55 - _XML_SetSkippedEntityHandler @56 -; added with version 1.95.5 - _XML_GetFeatureList @57 - _XML_UseForeignDTD @58 -; added with version 1.95.6 - _XML_FreeContentModel @59 - _XML_MemMalloc @60 - _XML_MemRealloc @61 - _XML_MemFree @62 -; added with version 1.95.8 - _XML_StopParser @63 - _XML_ResumeParser @64 - _XML_GetParsingStatus @65 - -; Aliases for MS compatible names - XML_DefaultCurrent = _XML_DefaultCurrent - XML_ErrorString = _XML_ErrorString - XML_ExpatVersion = _XML_ExpatVersion - XML_ExpatVersionInfo = _XML_ExpatVersionInfo - XML_ExternalEntityParserCreate = _XML_ExternalEntityParserCreate - XML_GetBase = _XML_GetBase - XML_GetBuffer = _XML_GetBuffer - XML_GetCurrentByteCount = _XML_GetCurrentByteCount - XML_GetCurrentByteIndex = _XML_GetCurrentByteIndex - XML_GetCurrentColumnNumber = _XML_GetCurrentColumnNumber - XML_GetCurrentLineNumber = _XML_GetCurrentLineNumber - XML_GetErrorCode = _XML_GetErrorCode - XML_GetIdAttributeIndex = _XML_GetIdAttributeIndex - XML_GetInputContext = _XML_GetInputContext - XML_GetSpecifiedAttributeCount = _XML_GetSpecifiedAttributeCount - XML_Parse = _XML_Parse - XML_ParseBuffer = _XML_ParseBuffer - XML_ParserCreate = _XML_ParserCreate - XML_ParserCreateNS = _XML_ParserCreateNS - XML_ParserCreate_MM = _XML_ParserCreate_MM - XML_ParserFree = _XML_ParserFree - XML_SetAttlistDeclHandler = _XML_SetAttlistDeclHandler - XML_SetBase = _XML_SetBase - XML_SetCdataSectionHandler = _XML_SetCdataSectionHandler - XML_SetCharacterDataHandler = _XML_SetCharacterDataHandler - XML_SetCommentHandler = _XML_SetCommentHandler - XML_SetDefaultHandler = _XML_SetDefaultHandler - XML_SetDefaultHandlerExpand = _XML_SetDefaultHandlerExpand - XML_SetDoctypeDeclHandler = _XML_SetDoctypeDeclHandler - XML_SetElementDeclHandler = _XML_SetElementDeclHandler - XML_SetElementHandler = _XML_SetElementHandler - XML_SetEncoding = _XML_SetEncoding - XML_SetEndCdataSectionHandler = _XML_SetEndCdataSectionHandler - XML_SetEndDoctypeDeclHandler = _XML_SetEndDoctypeDeclHandler - XML_SetEndElementHandler = _XML_SetEndElementHandler - XML_SetEndNamespaceDeclHandler = _XML_SetEndNamespaceDeclHandler - XML_SetEntityDeclHandler = _XML_SetEntityDeclHandler - XML_SetExternalEntityRefHandler = _XML_SetExternalEntityRefHandler - XML_SetExternalEntityRefHandlerArg = _XML_SetExternalEntityRefHandlerArg - XML_SetNamespaceDeclHandler = _XML_SetNamespaceDeclHandler - XML_SetNotStandaloneHandler = _XML_SetNotStandaloneHandler - XML_SetNotationDeclHandler = _XML_SetNotationDeclHandler - XML_SetParamEntityParsing = _XML_SetParamEntityParsing - XML_SetProcessingInstructionHandler = _XML_SetProcessingInstructionHandler - XML_SetReturnNSTriplet = _XML_SetReturnNSTriplet - XML_SetStartCdataSectionHandler = _XML_SetStartCdataSectionHandler - XML_SetStartDoctypeDeclHandler = _XML_SetStartDoctypeDeclHandler - XML_SetStartElementHandler = _XML_SetStartElementHandler - XML_SetStartNamespaceDeclHandler = _XML_SetStartNamespaceDeclHandler - XML_SetUnknownEncodingHandler = _XML_SetUnknownEncodingHandler - XML_SetUnparsedEntityDeclHandler = _XML_SetUnparsedEntityDeclHandler - XML_SetUserData = _XML_SetUserData - XML_SetXmlDeclHandler = _XML_SetXmlDeclHandler - XML_UseParserAsHandlerArg = _XML_UseParserAsHandlerArg - XML_ParserReset = _XML_ParserReset - XML_SetSkippedEntityHandler = _XML_SetSkippedEntityHandler - XML_GetFeatureList = _XML_GetFeatureList - XML_UseForeignDTD = _XML_UseForeignDTD - XML_FreeContentModel = _XML_FreeContentModel - XML_MemMalloc = _XML_MemMalloc - XML_MemRealloc = _XML_MemRealloc - XML_MemFree = _XML_MemFree - XML_StopParser = _XML_StopParser - XML_ResumeParser = _XML_ResumeParser - XML_GetParsingStatus = _XML_GetParsingStatus diff --git a/src/expat/bcb5/makefile.mak b/src/expat/bcb5/makefile.mak deleted file mode 100644 index 548815eafe..0000000000 --- a/src/expat/bcb5/makefile.mak +++ /dev/null @@ -1,37 +0,0 @@ -all: setup expat expatw expat_static expatw_static elements outline xmlwf - -setup: - setup - -expat: - make -l -fexpat.mak - -expatw: - make -l -fexpatw.mak - -expat_static: - make -l -fexpat_static.mak - -expatw_static: - make -l -fexpatw_static.mak - -elements: - make -l -felements.mak - -outline: - make -l -foutline.mak - -xmlwf: - make -l -fxmlwf.mak - -clean: -# works on Win98/ME -# deltree /y release\obj -# works on WinNT/2000 - del /s/f/q release\obj - -distclean: -# works on Win98/ME -# deltree /y release\*.* -# works on WinNT/2000 - del /s/f/q release\* diff --git a/src/expat/bcb5/outline.bpf b/src/expat/bcb5/outline.bpf deleted file mode 100644 index 52dce83016..0000000000 --- a/src/expat/bcb5/outline.bpf +++ /dev/null @@ -1,4 +0,0 @@ -USEUNIT("..\examples\outline.c"); -USELIB("Release\libexpat_mtd.lib"); -//--------------------------------------------------------------------------- -main diff --git a/src/expat/bcb5/outline.bpr b/src/expat/bcb5/outline.bpr deleted file mode 100644 index 9ad8bed273..0000000000 --- a/src/expat/bcb5/outline.bpr +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=3 -Item0=..\examples;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=4 -Item0=..\examples;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\examples;$(BCB)\lib;..\examples\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=6 -Item0=WIN32;NDEBUG;_CONSOLE -Item1=WIN32;NDEBUG;_CONSOLE;XML_STATIC -Item2=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_STATIC -Item3=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE;XML_STATIC -Item4=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE -Item5=WIN32;NDEBUG;_CONSOLE;_DEBUG - -[HistoryLists\hlIntOutputDir] -Count=4 -Item0=Release\obj\examples -Item1=Release\obj\outline -Item2=..\examples\Release -Item3=Release - -[HistoryLists\hlFinalOutputDir] -Count=1 -Item0=Release\ - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - -@ diff --git a/src/expat/bcb5/outline.mak b/src/expat/bcb5/outline.mak deleted file mode 100644 index 510b541f64..0000000000 --- a/src/expat/bcb5/outline.mak +++ /dev/null @@ -1,186 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\outline.exe -OBJFILES = Release\obj\examples\outline.obj -RESFILES = -MAINSOURCE = outline.bpf -RESDEPEN = $(RESFILES) -LIBFILES = Release\libexpat_mtd.lib -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ - ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ - VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ - dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi -SPARELIBS = -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\examples -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = WIN32;NDEBUG;_CONSOLE -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\examples;$(BCB)\include -LIBPATH = ..\examples;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS= -w-par -w-8027 -w-8026 -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -I..\lib -c -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\examples -N0Release\obj\examples -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -IRelease\obj\examples -D"" -ap -Tpe -x -Gn -q -# --------------------------------------------------------------------------- -ALLOBJ = c0x32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) -L$(LIBPATH) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/src/expat/bcb5/setup.bat b/src/expat/bcb5/setup.bat deleted file mode 100644 index 6f4b573179..0000000000 --- a/src/expat/bcb5/setup.bat +++ /dev/null @@ -1,9 +0,0 @@ -REM CommandInterpreter: $(COMSPEC) -if not exist .\release\nul mkdir release -if not exist .\release\obj\nul mkdir release\obj -if not exist .\release\obj\libexpat\nul mkdir release\obj\libexpat -if not exist .\release\obj\libexpatw\nul mkdir release\obj\libexpatw -if not exist .\release\obj\libexpat_static\nul mkdir release\obj\libexpat_static -if not exist .\release\obj\libexpatw_static\nul mkdir release\obj\libexpatw_static -if not exist .\release\obj\examples\nul mkdir release\obj\examples -if not exist .\release\obj\xmlwf\nul mkdir release\obj\xmlwf diff --git a/src/expat/bcb5/xmlwf.bpf b/src/expat/bcb5/xmlwf.bpf deleted file mode 100644 index d06208e811..0000000000 --- a/src/expat/bcb5/xmlwf.bpf +++ /dev/null @@ -1,7 +0,0 @@ -USEUNIT("..\xmlwf\codepage.c"); -USEUNIT("..\xmlwf\win32filemap.c"); -USEUNIT("..\xmlwf\xmlfile.c"); -USEUNIT("..\xmlwf\xmlwf.c"); -USELIB("Release\libexpat_mtd.lib"); -//--------------------------------------------------------------------------- -main diff --git a/src/expat/bcb5/xmlwf.bpr b/src/expat/bcb5/xmlwf.bpr deleted file mode 100644 index 825878af91..0000000000 --- a/src/expat/bcb5/xmlwf.bpr +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\xmlwf;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=5 -Item0=..\xmlwf;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\xmlwf;$(BCB)\lib;..\xmlwf\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=6 -Item0=NDEBUG;WIN32;_CONSOLE -Item1=NDEBUG;WIN32;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE -Item2=NDEBUG;WIN32;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T -Item3=NDEBUG;WIN32;_CONSOLE;_DEBUG -Item4=NDEBUG;WIN32;_CONSOLE;_DEBUG;_UNICODE;XML_UNICODE_WCHAR_T -Item5=NDEBUG;WIN32;_CONSOLE;_DEBUG;_UNICODE - -[HistoryLists\hlIntOutputDir] -Count=3 -Item0=Release\obj\xmlwf -Item1=..\xmlwf\Release -Item2=Release - -[HistoryLists\hlFinalOutputDir] -Count=3 -Item0=Release\ -Item1=Release -Item2=.\Release\ - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams=sample.xml -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - -@ diff --git a/src/expat/bcb5/xmlwf.mak b/src/expat/bcb5/xmlwf.mak deleted file mode 100644 index c72c9cc57a..0000000000 --- a/src/expat/bcb5/xmlwf.mak +++ /dev/null @@ -1,187 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\xmlwf.exe -OBJFILES = Release\obj\xmlwf\codepage.obj Release\obj\xmlwf\win32filemap.obj \ - Release\obj\xmlwf\xmlfile.obj Release\obj\xmlwf\xmlwf.obj -RESFILES = -MAINSOURCE = xmlwf.bpf -RESDEPEN = $(RESFILES) -LIBFILES = Release\libexpat_mtd.lib -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ - ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ - VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ - dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi -SPARELIBS = -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\xmlwf -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = NDEBUG;WIN32;_CONSOLE -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\xmlwf;$(BCB)\include -LIBPATH = ..\xmlwf;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS= -w-8065 -w-par -w-8027 -w-8026 -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -I..\lib -c -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\xmlwf -N0Release\obj\xmlwf -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -IRelease\obj\xmlwf -D"" -ap -Tpe -x -Gn -q -# --------------------------------------------------------------------------- -ALLOBJ = c0x32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) -L$(LIBPATH) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/src/expat/configure b/src/expat/configure index b5fc60e3e1..af36dceacb 100755 --- a/src/expat/configure +++ b/src/expat/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for expat 2.2.0. +# Generated by GNU Autoconf 2.69 for expat 2.2.2. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='expat' PACKAGE_TARNAME='expat' -PACKAGE_VERSION='2.2.0' -PACKAGE_STRING='expat 2.2.0' +PACKAGE_VERSION='2.2.2' +PACKAGE_STRING='expat 2.2.2' PACKAGE_BUGREPORT='expat-bugs@libexpat.org' PACKAGE_URL='' @@ -736,6 +736,8 @@ with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock +with_libbsd +enable_xml_context ' ac_precious_vars='build_alias host_alias @@ -1291,7 +1293,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures expat 2.2.0 to adapt to many kinds of systems. +\`configure' configures expat 2.2.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1356,7 +1358,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of expat 2.2.0:";; + short | recursive ) echo "Configuration of expat 2.2.2:";; esac cat <<\_ACEOF @@ -1369,6 +1371,10 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-xml-context [COUNT] + Retain context around the current parse point; + default is enabled and a size of 1024 bytes + --disable-xml-context Do not retain context around the current parse point Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1382,6 +1388,9 @@ Optional Packages: --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). + --with-libbsd utilize libbsd (for arc4random_buf) + + Some influential environment variables: CC C compiler command CFLAGS C compiler flags @@ -1463,7 +1472,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -expat configure 2.2.0 +expat configure 2.2.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2007,7 +2016,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by expat $as_me 2.2.0, which was +It was created by expat $as_me 2.2.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2395,7 +2404,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. LIBCURRENT=7 # sync -LIBREVISION=2 # with +LIBREVISION=4 # with LIBAGE=6 # CMakeLists.txt! ac_config_headers="$ac_config_headers expat_config.h" @@ -4330,6 +4339,11 @@ else lt_cv_sys_max_cmd_len=8192; ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -6135,10 +6149,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - powerpcle-*linux*) + powerpcle-*linux*|powerpc64le-*linux*) LD="${LD-ld} -m elf64lppc" ;; - powerpc-*linux*) + powerpc-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -10322,11 +10336,11 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' @@ -11617,524 +11631,167 @@ CC=$lt_save_CC -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no + ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include +#include +#include +#include #include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) { - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); } -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; int main () { -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + ; return 0; } _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg + ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break + test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in +case "x$ac_cv_prog_cc_c99" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; @@ -12142,19 +11799,14 @@ $as_echo "none needed" >&6; } ;; { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c99" != xno; then : fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' @@ -15131,11 +14783,11 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`' sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -15863,6 +15515,10 @@ rm -f core conftest.err conftest.$ac_objext \ if test "x$CXXFLAGS" = x ; then CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'` fi + + CFLAGS="${CFLAGS} -fno-strict-aliasing" + CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing" + LDFLAGS="${LDFLAGS} -fno-strict-aliasing" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 @@ -16212,6 +15868,166 @@ fi done + + +# Check whether --with-libbsd was given. +if test "${with_libbsd+set}" = set; then : + withval=$with_libbsd; +else + with_libbsd=no +fi + +if test "x${with_libbsd}" != xno; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for arc4random_buf in -lbsd" >&5 +$as_echo_n "checking for arc4random_buf in -lbsd... " >&6; } +if ${ac_cv_lib_bsd_arc4random_buf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char arc4random_buf (); +int +main () +{ +return arc4random_buf (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_bsd_arc4random_buf=yes +else + ac_cv_lib_bsd_arc4random_buf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_arc4random_buf" >&5 +$as_echo "$ac_cv_lib_bsd_arc4random_buf" >&6; } +if test "x$ac_cv_lib_bsd_arc4random_buf" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBBSD 1 +_ACEOF + + LIBS="-lbsd $LIBS" + +else + + if test "x${with_libbsd}" = xyes; then : + + as_fn_error $? "Enforced use of libbsd cannot be satisfied." "$LINENO" 5 + +fi + +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for arc4random_buf (BSD or libbsd)" >&5 +$as_echo_n "checking for arc4random_buf (BSD or libbsd)... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include /* for arc4random_buf on BSD, for NULL */ + #if defined(HAVE_LIBBSD) + # include + #endif + int main() { + arc4random_buf(NULL, 0U); + return 0; + } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_ARC4RANDOM_BUF 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getrandom (Linux 3.17+, glibc 2.25+)" >&5 +$as_echo_n "checking for getrandom (Linux 3.17+, glibc 2.25+)... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include /* for NULL */ + #include + int main() { + return getrandom(NULL, 0U, 0U); + } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_GETRANDOM 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for syscall SYS_getrandom (Linux 3.17+)" >&5 +$as_echo_n "checking for syscall SYS_getrandom (Linux 3.17+)... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include /* for NULL */ + #include /* for syscall */ + #include /* for SYS_getrandom */ + int main() { + syscall(SYS_getrandom, NULL, 0, 0); + return 0; + } + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_SYSCALL_GETRANDOM 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + for ac_header in fcntl.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -16446,358 +16262,6 @@ fi -# AC_CPP_FUNC -# ------------------ # -# Checks to see if ANSI C99 CPP variable __func__ works. -# If not, perhaps __FUNCTION__ works instead. -# If not, we'll just define __func__ to "". -# AC_CPP_FUNC - - case $ac_cv_prog_cc_stdc in #( - no) : - ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 -$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } -if ${ac_cv_prog_cc_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#include - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - your preprocessor is broken; -#endif -#if BIG_OK -#else - your preprocessor is broken; -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static void -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str; - int number; - float fnumber; - - while (*format) - { - switch (*format++) - { - case 's': // string - str = va_arg (args_copy, const char *); - break; - case 'd': // int - number = va_arg (args_copy, int); - break; - case 'f': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); -} - -int -main () -{ - - // Check bool. - _Bool success = false; - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - test_varargs ("s, d' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); - - ; - return 0; -} -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c99" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c99" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c99" != xno; then : - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 -else - ac_cv_prog_cc_stdc=no -fi - -fi - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 -$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } - if ${ac_cv_prog_cc_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -fi - - case $ac_cv_prog_cc_stdc in #( - no) : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; #( - '') : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 -$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C99-conforming __func__" >&5 -$as_echo_n "checking for an ANSI C99-conforming __func__... " >&6; } -if ${ac_cv_cpp_func+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -char *foo = __func__; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_cpp_func=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -char *foo = __FUNCTION__; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_cpp_func=__FUNCTION__ -else - ac_cv_cpp_func=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_func" >&5 -$as_echo "$ac_cv_cpp_func" >&6; } -if test $ac_cv_cpp_func = __FUNCTION__; then - -$as_echo "#define __func__ __FUNCTION__" >>confdefs.h - -elif test $ac_cv_cpp_func = no; then - -$as_echo "#define __func__ \"\"" >>confdefs.h - -fi - - - $as_echo "#define XML_NS 1" >>confdefs.h @@ -16805,11 +16269,31 @@ $as_echo "#define XML_NS 1" >>confdefs.h $as_echo "#define XML_DTD 1" >>confdefs.h -$as_echo "#define XML_CONTEXT_BYTES 1024" >>confdefs.h +# Check whether --enable-xml-context was given. +if test "${enable_xml_context+set}" = set; then : + enableval=$enable_xml_context; enable_xml_context=${enableval} +fi +if test "x${enable_xml_context}" != "xno"; then : + + if test "x${enable_xml_context}" = "xyes" \ + -o "x${enable_xml_context}" = "x"; then : + + enable_xml_context=1024 + +fi + +cat >>confdefs.h <<_ACEOF +#define XML_CONTEXT_BYTES ${enable_xml_context} +_ACEOF + + +fi ac_config_files="$ac_config_files Makefile expat.pc" +ac_config_files="$ac_config_files run.sh" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -17316,7 +16800,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by expat $as_me 2.2.0, which was +This file was extended by expat $as_me 2.2.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17382,7 +16866,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -expat config.status 2.2.0 +expat config.status 2.2.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -17896,6 +17380,7 @@ do "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "expat.pc") CONFIG_FILES="$CONFIG_FILES expat.pc" ;; + "run.sh") CONFIG_FILES="$CONFIG_FILES run.sh" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -19164,6 +18649,7 @@ compiler_lib_search_path=$lt_compiler_lib_search_path_CXX _LT_EOF ;; + "run.sh":F) chmod +x run.sh ;; esac done # for ac_tag diff --git a/src/expat/configure.ac b/src/expat/configure.ac index a06c3e49fc..7d1fd03713 100644 --- a/src/expat/configure.ac +++ b/src/expat/configure.ac @@ -46,7 +46,7 @@ dnl If the API changes incompatibly set LIBAGE back to 0 dnl LIBCURRENT=7 # sync -LIBREVISION=2 # with +LIBREVISION=4 # with LIBAGE=6 # CMakeLists.txt! AC_CONFIG_HEADER(expat_config.h) @@ -61,7 +61,7 @@ AC_SUBST(LIBREVISION) AC_SUBST(LIBAGE) dnl Checks for programs. -AC_PROG_CC +AC_PROG_CC_C99 AC_PROG_CXX AC_PROG_INSTALL @@ -80,6 +80,10 @@ if test "$GCC" = yes ; then if test "x$CXXFLAGS" = x ; then CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'` fi + + CFLAGS="${CFLAGS} -fno-strict-aliasing" + CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing" + LDFLAGS="${LDFLAGS} -fno-strict-aliasing" fi dnl Checks for header files. @@ -95,6 +99,69 @@ AC_C_CONST AC_TYPE_SIZE_T AC_CHECK_FUNCS(memmove bcopy) + +AC_ARG_WITH([libbsd], [ +AS_HELP_STRING([--with-libbsd], [utilize libbsd (for arc4random_buf)]) +], [], [with_libbsd=no]) +AS_IF([test "x${with_libbsd}" != xno], [ + AC_CHECK_LIB([bsd], [arc4random_buf], [], [ + AS_IF([test "x${with_libbsd}" = xyes], [ + AC_MSG_ERROR([Enforced use of libbsd cannot be satisfied.]) + ]) + ]) +]) +AC_MSG_CHECKING([for arc4random_buf (BSD or libbsd)]) +AC_LINK_IFELSE([AC_LANG_SOURCE([ + #include /* for arc4random_buf on BSD, for NULL */ + #if defined(HAVE_LIBBSD) + # include + #endif + int main() { + arc4random_buf(NULL, 0U); + return 0; + } +])], [ + AC_DEFINE([HAVE_ARC4RANDOM_BUF], [1], + [Define to 1 if you have the `arc4random_buf' function.]) + AC_MSG_RESULT([yes]) +], [ + AC_MSG_RESULT([no]) +]) + + +AC_MSG_CHECKING([for getrandom (Linux 3.17+, glibc 2.25+)]) +AC_LINK_IFELSE([AC_LANG_SOURCE([ + #include /* for NULL */ + #include + int main() { + return getrandom(NULL, 0U, 0U); + } +])], [ + AC_DEFINE([HAVE_GETRANDOM], [1], + [Define to 1 if you have the `getrandom' function.]) + AC_MSG_RESULT([yes]) +], [ + AC_MSG_RESULT([no]) + + AC_MSG_CHECKING([for syscall SYS_getrandom (Linux 3.17+)]) + AC_LINK_IFELSE([AC_LANG_SOURCE([ + #include /* for NULL */ + #include /* for syscall */ + #include /* for SYS_getrandom */ + int main() { + syscall(SYS_getrandom, NULL, 0, 0); + return 0; + } + ])], [ + AC_DEFINE([HAVE_SYSCALL_GETRANDOM], [1], + [Define to 1 if you have `syscall' and `SYS_getrandom'.]) + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + + dnl Only needed for xmlwf: AC_CHECK_HEADERS(fcntl.h unistd.h) AC_TYPE_OFF_T @@ -107,47 +174,31 @@ else fi AC_SUBST(FILEMAP) -dnl Needed for the test support code; this was found at -dnl http://lists.gnu.org/archive/html/bug-autoconf/2002-07/msg00028.html - -# AC_CPP_FUNC -# ------------------ # -# Checks to see if ANSI C99 CPP variable __func__ works. -# If not, perhaps __FUNCTION__ works instead. -# If not, we'll just define __func__ to "". -AC_DEFUN([AC_CPP_FUNC], -[AC_REQUIRE([AC_PROG_CC_STDC])dnl -AC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func, -[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], -[[char *foo = __func__;]])], - [ac_cv_cpp_func=yes], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], -[[char *foo = __FUNCTION__;]])], - [ac_cv_cpp_func=__FUNCTION__], - [ac_cv_cpp_func=no])])]) -if test $ac_cv_cpp_func = __FUNCTION__; then - AC_DEFINE(__func__,__FUNCTION__, - [Define to __FUNCTION__ or "" if `__func__' does not conform to -ANSI C.]) -elif test $ac_cv_cpp_func = no; then - AC_DEFINE(__func__,"", - [Define to __FUNCTION__ or "" if `__func__' does not conform to -ANSI C.]) -fi -])# AC_CPP_FUNC - -AC_CPP_FUNC - dnl Some basic configuration: AC_DEFINE([XML_NS], 1, [Define to make XML Namespaces functionality available.]) AC_DEFINE([XML_DTD], 1, [Define to make parameter entity parsing functionality available.]) -AC_DEFINE([XML_CONTEXT_BYTES], 1024, - [Define to specify how much context to retain around the current parse point.]) + +AC_ARG_ENABLE([xml-context], + AS_HELP_STRING([--enable-xml-context @<:@COUNT@:>@], + [Retain context around the current parse point; + default is enabled and a size of 1024 bytes]) +AS_HELP_STRING([--disable-xml-context], + [Do not retain context around the current parse point]), + [enable_xml_context=${enableval}]) +AS_IF([test "x${enable_xml_context}" != "xno"], [ + AS_IF([test "x${enable_xml_context}" = "xyes" \ + -o "x${enable_xml_context}" = "x"], [ + enable_xml_context=1024 + ]) + AC_DEFINE_UNQUOTED([XML_CONTEXT_BYTES], [${enable_xml_context}], + [Define to specify how much context to retain around the current parse point.]) +]) AC_CONFIG_FILES([Makefile expat.pc]) +AC_CONFIG_FILES([run.sh], [chmod +x run.sh]) AC_OUTPUT abs_srcdir="`cd $srcdir && pwd`" diff --git a/src/expat/conftools/config.guess b/src/expat/conftools/config.guess index a2eeec38e0..83e1e952e9 100755 --- a/src/expat/conftools/config.guess +++ b/src/expat/conftools/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2016-04-02' +timestamp='2017-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -186,9 +186,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in - arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ @@ -997,6 +1000,9 @@ EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1029,6 +1035,9 @@ EOF ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1419,18 +1428,17 @@ esac cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/src/expat/conftools/config.sub b/src/expat/conftools/config.sub index b01fff0b6e..1ecabe4677 100755 --- a/src/expat/conftools/config.sub +++ b/src/expat/conftools/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2016-03-30' +timestamp='2017-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -67,7 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,7 +117,7 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -301,6 +301,7 @@ case $basic_machine in | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ @@ -428,6 +429,7 @@ case $basic_machine in | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ @@ -643,6 +645,14 @@ case $basic_machine in basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -1040,7 +1050,7 @@ case $basic_machine in ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1050,7 +1060,7 @@ case $basic_machine in ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1405,9 +1415,9 @@ case $os in | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ @@ -1417,7 +1427,7 @@ case $os in | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos*) + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1646,6 +1656,9 @@ case $basic_machine in sparc-* | *-sun) os=-sunos4.1.1 ;; + pru-*) + os=-elf + ;; *-be) os=-beos ;; diff --git a/src/expat/conftools/get-version.sh b/src/expat/conftools/get-version.sh index a70e0fb47a..2592f10328 100755 --- a/src/expat/conftools/get-version.sh +++ b/src/expat/conftools/get-version.sh @@ -28,19 +28,8 @@ if test ! -r "$hdr"; then exit 1 fi -MAJOR_VERSION="`sed -n -e '/MAJOR_VERSION/s/[^0-9]*//gp' $hdr`" -MINOR_VERSION="`sed -n -e '/MINOR_VERSION/s/[^0-9]*//gp' $hdr`" -MICRO_VERSION="`sed -n -e '/MICRO_VERSION/s/[^0-9]*//gp' $hdr`" +MAJOR_VERSION=$(sed -n -e '/MAJOR_VERSION/s/[^0-9]*//gp' "$hdr") +MINOR_VERSION=$(sed -n -e '/MINOR_VERSION/s/[^0-9]*//gp' "$hdr") +MICRO_VERSION=$(sed -n -e '/MICRO_VERSION/s/[^0-9]*//gp' "$hdr") -# Determine how to tell echo not to print the trailing \n. This is -# similar to Autoconf's @ECHO_C@ and @ECHO_N@; however, we don't -# generate this file via autoconf (in fact, get-version.sh is used -# to *create* ./configure), so we just do something similar inline. -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ;; - *c*,* ) ECHO_N=-n ECHO_C= ;; - *) ECHO_N= ECHO_C='\c' ;; -esac - -echo $ECHO_N "$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$ECHO_C" +printf '%s.%s.%s' "$MAJOR_VERSION" "$MINOR_VERSION" "$MICRO_VERSION" diff --git a/src/expat/conftools/install-sh b/src/expat/conftools/install-sh index 0b0fdcbba6..0360b79e7d 100755 --- a/src/expat/conftools/install-sh +++ b/src/expat/conftools/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2013-12-25.23; # UTC +scriptversion=2016-01-11.22; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -496,6 +496,6 @@ done # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/src/expat/doc/reference.html b/src/expat/doc/reference.html index a4ab40530a..350b9b67cc 100644 --- a/src/expat/doc/reference.html +++ b/src/expat/doc/reference.html @@ -277,7 +277,7 @@ directions or Unix directions below.

If you're using the GNU compiler under cygwin, follow the Unix directions in the next section. Otherwise if you have Microsoft's Developer Studio installed, then from Windows Explorer double-click on -"expat.dsp" in the lib directory and build and install in the usual +"expat.vcxproj" in the lib directory and build and install in the usual manner.

Alternatively, you may download the Win32 binary package that diff --git a/src/expat/examples/elements.c b/src/expat/examples/elements.c index 0ca1abd98a..fe1699c50e 100644 --- a/src/expat/examples/elements.c +++ b/src/expat/examples/elements.c @@ -6,11 +6,7 @@ */ #include -#include "expat.h" - -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif +#include #ifdef XML_LARGE_SIZE #if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 diff --git a/src/expat/examples/outline.c b/src/expat/examples/outline.c index d9b091761c..2d1e63c368 100644 --- a/src/expat/examples/outline.c +++ b/src/expat/examples/outline.c @@ -25,10 +25,6 @@ #include #include -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - #ifdef XML_LARGE_SIZE #if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 #define XML_FMT_INT_MOD "I64" diff --git a/src/expat/expat.dsw b/src/expat/expat.dsw deleted file mode 100644 index 2d62eec5f6..0000000000 --- a/src/expat/expat.dsw +++ /dev/null @@ -1,110 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "elements"=.\examples\elements.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name expat_static - End Project Dependency -}}} - -############################################################################### - -Project: "expat"=.\lib\expat.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "expat_static"=.\lib\expat_static.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "expatw"=.\lib\expatw.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "expatw_static"=.\lib\expatw_static.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "outline"=.\examples\outline.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name expat - End Project Dependency -}}} - -############################################################################### - -Project: "xmlwf"=.\xmlwf\xmlwf.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name expat - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/expat/expat_config.h.in b/src/expat/expat_config.h.in index 0777a7f9bd..d83920e765 100644 --- a/src/expat/expat_config.h.in +++ b/src/expat/expat_config.h.in @@ -3,6 +3,9 @@ /* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ #undef BYTEORDER +/* Define to 1 if you have the `arc4random_buf' function. */ +#undef HAVE_ARC4RANDOM_BUF + /* Define to 1 if you have the `bcopy' function. */ #undef HAVE_BCOPY @@ -15,9 +18,15 @@ /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE +/* Define to 1 if you have the `getrandom' function. */ +#undef HAVE_GETRANDOM + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `bsd' library (-lbsd). */ +#undef HAVE_LIBBSD + /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE @@ -39,6 +48,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have `syscall' and `SYS_getrandom'. */ +#undef HAVE_SYSCALL_GETRANDOM + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H @@ -88,9 +100,6 @@ /* Define to make XML Namespaces functionality available. */ #undef XML_NS -/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */ -#undef __func__ - /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/src/expat/lib/Makefile.MPW b/src/expat/lib/Makefile.MPW deleted file mode 100644 index 046af00514..0000000000 --- a/src/expat/lib/Makefile.MPW +++ /dev/null @@ -1,206 +0,0 @@ -# File: Makefile.MPW -# Targets: All, Dynamic, Static (and Clean, Clean-All) -# Created: Tuesday, July 02, 2002 -# -# MPW Makefile for building expat under the "classic" (i.e. pre-X) Mac OS -# Copyright © 2002 Daryle Walker -# Portions Copyright © 2002 Thomas Wegner -# See the COPYING file for distribution information -# -# Description: -# This Makefile lets you build static, dynamic (i.e. shared) and stub -# versions of the expat library as well as the elements.c and outline.c -# examples (built as tools for MPW). This is for PPC only; it should be -# no problem to build a 68K version of the expat library, though. -# -# Usage: -# Buildprogram All -# or Buildprogram Dynamic -# or Buildprogram Static -# -# Note: You first have to rename this file to "Makefile", or the Buildprogram -# commando will not recognize it. -# - -MAKEFILE = Makefile -¥MondoBuild¥ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified - -ObjDir = : -SrcDir = : -HdrDir = : - -ToolDir = ::examples: - -Includes = -i {HdrDir} - -Sym-PPC = -sym off - -Defines = -d MACOS_CLASSIC - -PPCCOptions = {Includes} {Sym-PPC} -w 35 {Defines} - -FragName = libexpat - - -### Source Files ### - -SrcFiles = ¶ - "{SrcDir}xmlparse.c" ¶ - "{SrcDir}xmlrole.c" ¶ - "{SrcDir}xmltok.c" - -ToolSrcFiles = ¶ - "{ToolDir}elements.c" ¶ - "{ToolDir}outline.c" - - -### Object Files ### - -ObjFiles-PPC = ¶ - "{ObjDir}xmlparse.c.o" ¶ - "{ObjDir}xmlrole.c.o" ¶ - "{ObjDir}xmltok.c.o" - -ElementToolObjFile = "{ObjDir}elements.c.o" - -OutlineToolObjFile = "{ObjDir}outline.c.o" - - -### Libraries ### - -StLibFiles-PPC = ¶ - "{PPCLibraries}StdCRuntime.o" ¶ - "{PPCLibraries}PPCCRuntime.o" ¶ - "{PPCLibraries}PPCToolLibs.o" - -ShLibFiles-PPC = ¶ - "{SharedLibraries}InterfaceLib" ¶ - "{SharedLibraries}StdCLib" ¶ - "{SharedLibraries}MathLib" - -LibFiles-PPC = ¶ - {StLibFiles-PPC} ¶ - {ShLibFiles-PPC} - - -### Special Files ### - -ExportFile = "{ObjDir}{FragName}.exp" - -StLibFile = "{ObjDir}{FragName}.MrC.o" - -ShLibFile = "{ObjDir}{FragName}" - -StubFile = "{ObjDir}{FragName}.stub" - -ElementsTool = "{ToolDir}elements" - -OutlineTool = "{ToolDir}outline" - - -### Default Rules ### - -.c.o Ä .c {¥MondoBuild¥} - {PPCC} {depDir}{default}.c -o {targDir}{default}.c.o {PPCCOptions} - - -### Build Rules ### - -All Ä Dynamic {ElementsTool} {OutlineTool} - -Static Ä {StLibFile} - -Dynamic Ä Static {ShLibFile} {StubFile} - -{StLibFile} ÄÄ {ObjFiles-PPC} {StLibFiles-PPC} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {ObjFiles-PPC} ¶ - {StLibFiles-PPC} ¶ - {Sym-PPC} ¶ - -mf -d ¶ - -t 'XCOF' ¶ - -c 'MPS ' ¶ - -xm l - -{ShLibFile} ÄÄ {StLibFile} {ShLibFiles-PPC} {ExportFile} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {StLibFile} ¶ - {ShLibFiles-PPC} ¶ - {Sym-PPC} ¶ - -@export {ExportFile} ¶ - -fragname {FragName} ¶ - -mf -d ¶ - -t 'shlb' ¶ - -c '????' ¶ - -xm s - -{StubFile} ÄÄ {ShLibFile} {¥MondoBuild¥} - shlb2stub -o {Targ} {ShLibFile} - -{ElementsTool} ÄÄ {ElementToolObjFile} {StubFile} {LibFiles-PPC} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {ElementToolObjFile} ¶ - {StLibFile} ¶ - {LibFiles-PPC} ¶ - {Sym-PPC} ¶ - -mf -d ¶ - -t 'MPST' ¶ - -c 'MPS ' - -{OutlineTool} ÄÄ {OutlineToolObjFile} {StubFile} {LibFiles-PPC} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {OutlineToolObjFile} ¶ - {StLibFile} ¶ - {LibFiles-PPC} ¶ - {Sym-PPC} ¶ - -mf -d ¶ - -t 'MPST' ¶ - -c 'MPS ' - - -### Special Rules ### - -{ExportFile} ÄÄ "{HdrDir}expat.h" {¥MondoBuild¥} - StreamEdit -d ¶ - -e "/¥('XMLPARSEAPI('Å') ')Ç0,1È'XML_'([A-Za-z0-9_]+)¨1'('/ Print 'XML_' ¨1" ¶ - "{HdrDir}expat.h" > {Targ} - - -### Required Dependencies ### - -"{ObjDir}xmlparse.c.o" Ä "{SrcDir}xmlparse.c" -"{ObjDir}xmlrole.c.o" Ä "{SrcDir}xmlrole.c" -"{ObjDir}xmltok.c.o" Ä "{SrcDir}xmltok.c" - -"{ObjDir}elements.c.o" Ä "{ToolDir}elements.c" -"{ObjDir}outline.c.o" Ä "{ToolDir}outline.c" - - -### Optional Dependencies ### -### Build this target to clean out generated intermediate files. ### - -Clean Ä - Delete {ObjFiles-PPC} {ExportFile} {ElementToolObjFile} {OutlineToolObjFile} - -### Build this target to clean out all generated files. ### - -Clean-All Ä Clean - Delete {StLibFile} {ShLibFile} {StubFile} {ElementsTool} {OutlineTool} - -### Build this target to generate "include file" dependencies. ### - -Dependencies Ä $OutOfDate - MakeDepend ¶ - -append {MAKEFILE} ¶ - -ignore "{CIncludes}" ¶ - -objdir "{ObjDir}" ¶ - -objext .o ¶ - {Defines} ¶ - {Includes} ¶ - {SrcFiles} - - diff --git a/src/expat/lib/amigaconfig.h b/src/expat/lib/amigaconfig.h deleted file mode 100644 index 49c92c7014..0000000000 --- a/src/expat/lib/amigaconfig.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef AMIGACONFIG_H -#define AMIGACONFIG_H - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#define BYTEORDER 4321 - -/* Define to 1 if you have the `bcopy' function. */ -#define HAVE_BCOPY 1 - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* whether byteorder is bigendian */ -#define WORDS_BIGENDIAN - -/* Define to specify how much context to retain around the current parse - point. */ -#define XML_CONTEXT_BYTES 1024 - -/* Define to make parameter entity parsing functionality available. */ -#define XML_DTD - -/* Define to make XML Namespaces functionality available. */ -#define XML_NS - -#endif /* AMIGACONFIG_H */ diff --git a/src/expat/lib/expat.h b/src/expat/lib/expat.h index 086e24b39c..b6b02f4955 100644 --- a/src/expat/lib/expat.h +++ b/src/expat/lib/expat.h @@ -24,7 +24,6 @@ extern "C" { struct XML_ParserStruct; typedef struct XML_ParserStruct *XML_Parser; -/* Should this be defined using stdbool.h when C99 is available? */ typedef unsigned char XML_Bool; #define XML_TRUE ((XML_Bool) 1) #define XML_FALSE ((XML_Bool) 0) @@ -95,7 +94,9 @@ enum XML_Error { /* Added in 2.0. */ XML_ERROR_RESERVED_PREFIX_XML, XML_ERROR_RESERVED_PREFIX_XMLNS, - XML_ERROR_RESERVED_NAMESPACE_URI + XML_ERROR_RESERVED_NAMESPACE_URI, + /* Added in 2.2.1. */ + XML_ERROR_INVALID_ARGUMENT }; enum XML_Content_Type { @@ -706,6 +707,7 @@ XML_UseParserAsHandlerArg(XML_Parser parser); be called, despite an external subset being parsed. Note: If XML_DTD is not defined when Expat is compiled, returns XML_ERROR_FEATURE_REQUIRES_XML_DTD. + Note: If parser == NULL, returns XML_ERROR_INVALID_ARGUMENT. */ XMLPARSEAPI(enum XML_Error) XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); @@ -729,15 +731,16 @@ XML_GetBase(XML_Parser parser); to the XML_StartElementHandler that were specified in the start-tag rather than defaulted. Each attribute/value pair counts as 2; thus this correspondds to an index into the atts array passed to the - XML_StartElementHandler. + XML_StartElementHandler. Returns -1 if parser == NULL. */ XMLPARSEAPI(int) XML_GetSpecifiedAttributeCount(XML_Parser parser); /* Returns the index of the ID attribute passed in the last call to - XML_StartElementHandler, or -1 if there is no ID attribute. Each - attribute/value pair counts as 2; thus this correspondds to an - index into the atts array passed to the XML_StartElementHandler. + XML_StartElementHandler, or -1 if there is no ID attribute or + parser == NULL. Each attribute/value pair counts as 2; thus this + correspondds to an index into the atts array passed to the + XML_StartElementHandler. */ XMLPARSEAPI(int) XML_GetIdAttributeIndex(XML_Parser parser); @@ -901,6 +904,7 @@ enum XML_ParamEntityParsing { entities is requested; otherwise it will return non-zero. Note: If XML_SetParamEntityParsing is called after XML_Parse or XML_ParseBuffer, then it has no effect and will always return 0. + Note: If parser == NULL, the function will do nothing and return 0. */ XMLPARSEAPI(int) XML_SetParamEntityParsing(XML_Parser parser, @@ -910,6 +914,7 @@ XML_SetParamEntityParsing(XML_Parser parser, Helps in preventing DoS attacks based on predicting hash function behavior. This must be called before parsing is started. Returns 1 if successful, 0 when called after parsing has started. + Note: If parser == NULL, the function will do nothing and return 0. */ XMLPARSEAPI(int) XML_SetHashSalt(XML_Parser parser, @@ -936,6 +941,10 @@ XML_GetErrorCode(XML_Parser parser); the location is the location of the character at which the error was detected; otherwise the location is the location of the last parse event, as described above. + + Note: XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber + return 0 to indicate an error. + Note: XML_GetCurrentByteIndex returns -1 to indicate an error. */ XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser); @@ -1039,7 +1048,7 @@ XML_GetFeatureList(void); */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 2 -#define XML_MICRO_VERSION 0 +#define XML_MICRO_VERSION 2 #ifdef __cplusplus } diff --git a/src/expat/lib/expat_external.h b/src/expat/lib/expat_external.h index 6846e6bbc7..892eb4bbed 100644 --- a/src/expat/lib/expat_external.h +++ b/src/expat/lib/expat_external.h @@ -5,13 +5,6 @@ #ifndef Expat_External_INCLUDED #define Expat_External_INCLUDED 1 -/* wxWidgets modification: always predefine XML_STATIC as we always use - Expat as a static library. -*/ -#ifndef XML_STATIC -#define XML_STATIC -#endif - /* External API definitions */ #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) @@ -100,7 +93,10 @@ extern "C" { #endif #ifdef XML_UNICODE_WCHAR_T -#define XML_UNICODE +# define XML_UNICODE +# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2) +# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc" +# endif #endif #ifdef XML_UNICODE /* Information is UTF-16 encoded. */ diff --git a/src/expat/lib/siphash.h b/src/expat/lib/siphash.h new file mode 100644 index 0000000000..30a6f11d93 --- /dev/null +++ b/src/expat/lib/siphash.h @@ -0,0 +1,371 @@ +/* ========================================================================== + * siphash.h - SipHash-2-4 in a single header file + * -------------------------------------------------------------------------- + * Derived by William Ahern from the reference implementation[1] published[2] + * by Jean-Philippe Aumasson and Daniel J. Berstein. + * Minimal changes by Sebastian Pipping and Victor Stinner on top, see below. + * Licensed under the CC0 Public Domain Dedication license. + * + * 1. https://www.131002.net/siphash/siphash24.c + * 2. https://www.131002.net/siphash/ + * -------------------------------------------------------------------------- + * HISTORY: + * + * 2017-07-05 (Sebastian Pipping) + * - Use _SIP_ULL macro to not require a C++11 compiler if compiled as C++ + * - Add const qualifiers at two places + * - Ensure <=80 characters line length (assuming tab width 4) + * + * 2017-06-23 (Victor Stinner) + * - Address Win64 compile warnings + * + * 2017-06-18 (Sebastian Pipping) + * - Clarify license note in the header + * - Address C89 issues: + * - Stop using inline keyword (and let compiler decide) + * - Replace _Bool by int + * - Turn macro siphash24 into a function + * - Address invalid conversion (void pointer) by explicit cast + * - Address lack of stdint.h for Visual Studio 2003 to 2008 + * - Always expose sip24_valid (for self-tests) + * + * 2012-11-04 - Born. (William Ahern) + * -------------------------------------------------------------------------- + * USAGE: + * + * SipHash-2-4 takes as input two 64-bit words as the key, some number of + * message bytes, and outputs a 64-bit word as the message digest. This + * implementation employs two data structures: a struct sipkey for + * representing the key, and a struct siphash for representing the hash + * state. + * + * For converting a 16-byte unsigned char array to a key, use either the + * macro sip_keyof or the routine sip_tokey. The former instantiates a + * compound literal key, while the latter requires a key object as a + * parameter. + * + * unsigned char secret[16]; + * arc4random_buf(secret, sizeof secret); + * struct sipkey *key = sip_keyof(secret); + * + * For hashing a message, use either the convenience macro siphash24 or the + * routines sip24_init, sip24_update, and sip24_final. + * + * struct siphash state; + * void *msg; + * size_t len; + * uint64_t hash; + * + * sip24_init(&state, key); + * sip24_update(&state, msg, len); + * hash = sip24_final(&state); + * + * or + * + * hash = siphash24(msg, len, key); + * + * To convert the 64-bit hash value to a canonical 8-byte little-endian + * binary representation, use either the macro sip_binof or the routine + * sip_tobin. The former instantiates and returns a compound literal array, + * while the latter requires an array object as a parameter. + * -------------------------------------------------------------------------- + * NOTES: + * + * o Neither sip_keyof, sip_binof, nor siphash24 will work with compilers + * lacking compound literal support. Instead, you must use the lower-level + * interfaces which take as parameters the temporary state objects. + * + * o Uppercase macros may evaluate parameters more than once. Lowercase + * macros should not exhibit any such side effects. + * ========================================================================== + */ +#ifndef SIPHASH_H +#define SIPHASH_H + +#include /* size_t */ + +#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1600) + /* For vs2003/7.1 up to vs2008/9.0; _MSC_VER 1600 is vs2010/10.0 */ + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int64 uint64_t; +#else + #include /* uint64_t uint32_t uint8_t */ +#endif + + +/* + * Workaround to not require a C++11 compiler for using ULL suffix + * if this code is included and compiled as C++; related GCC warning is: + * warning: use of C++11 long long integer constant [-Wlong-long] + */ +#define _SIP_ULL(high, low) (((uint64_t)high << 32) | low) + + +#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ( (x) >> (64 - (b)))) + +#define SIP_U32TO8_LE(p, v) \ + (p)[0] = (uint8_t)((v) >> 0); (p)[1] = (uint8_t)((v) >> 8); \ + (p)[2] = (uint8_t)((v) >> 16); (p)[3] = (uint8_t)((v) >> 24); + +#define SIP_U64TO8_LE(p, v) \ + SIP_U32TO8_LE((p) + 0, (uint32_t)((v) >> 0)); \ + SIP_U32TO8_LE((p) + 4, (uint32_t)((v) >> 32)); + +#define SIP_U8TO64_LE(p) \ + (((uint64_t)((p)[0]) << 0) | \ + ((uint64_t)((p)[1]) << 8) | \ + ((uint64_t)((p)[2]) << 16) | \ + ((uint64_t)((p)[3]) << 24) | \ + ((uint64_t)((p)[4]) << 32) | \ + ((uint64_t)((p)[5]) << 40) | \ + ((uint64_t)((p)[6]) << 48) | \ + ((uint64_t)((p)[7]) << 56)) + + +#define SIPHASH_INITIALIZER { 0, 0, 0, 0, { 0 }, 0, 0 } + +struct siphash { + uint64_t v0, v1, v2, v3; + + unsigned char buf[8], *p; + uint64_t c; +}; /* struct siphash */ + + +#define SIP_KEYLEN 16 + +struct sipkey { + uint64_t k[2]; +}; /* struct sipkey */ + +#define sip_keyof(k) sip_tokey(&(struct sipkey){ { 0 } }, (k)) + +static struct sipkey *sip_tokey(struct sipkey *key, const void *src) { + key->k[0] = SIP_U8TO64_LE((const unsigned char *)src); + key->k[1] = SIP_U8TO64_LE((const unsigned char *)src + 8); + return key; +} /* sip_tokey() */ + + +#define sip_binof(v) sip_tobin((unsigned char[8]){ 0 }, (v)) + +static void *sip_tobin(void *dst, uint64_t u64) { + SIP_U64TO8_LE((unsigned char *)dst, u64); + return dst; +} /* sip_tobin() */ + + +static void sip_round(struct siphash *H, const int rounds) { + int i; + + for (i = 0; i < rounds; i++) { + H->v0 += H->v1; + H->v1 = SIP_ROTL(H->v1, 13); + H->v1 ^= H->v0; + H->v0 = SIP_ROTL(H->v0, 32); + + H->v2 += H->v3; + H->v3 = SIP_ROTL(H->v3, 16); + H->v3 ^= H->v2; + + H->v0 += H->v3; + H->v3 = SIP_ROTL(H->v3, 21); + H->v3 ^= H->v0; + + H->v2 += H->v1; + H->v1 = SIP_ROTL(H->v1, 17); + H->v1 ^= H->v2; + H->v2 = SIP_ROTL(H->v2, 32); + } +} /* sip_round() */ + + +static struct siphash *sip24_init(struct siphash *H, + const struct sipkey *key) { + H->v0 = _SIP_ULL(0x736f6d65U, 0x70736575U) ^ key->k[0]; + H->v1 = _SIP_ULL(0x646f7261U, 0x6e646f6dU) ^ key->k[1]; + H->v2 = _SIP_ULL(0x6c796765U, 0x6e657261U) ^ key->k[0]; + H->v3 = _SIP_ULL(0x74656462U, 0x79746573U) ^ key->k[1]; + + H->p = H->buf; + H->c = 0; + + return H; +} /* sip24_init() */ + + +#define sip_endof(a) (&(a)[sizeof (a) / sizeof *(a)]) + +static struct siphash *sip24_update(struct siphash *H, const void *src, + size_t len) { + const unsigned char *p = (const unsigned char *)src, *pe = p + len; + uint64_t m; + + do { + while (p < pe && H->p < sip_endof(H->buf)) + *H->p++ = *p++; + + if (H->p < sip_endof(H->buf)) + break; + + m = SIP_U8TO64_LE(H->buf); + H->v3 ^= m; + sip_round(H, 2); + H->v0 ^= m; + + H->p = H->buf; + H->c += 8; + } while (p < pe); + + return H; +} /* sip24_update() */ + + +static uint64_t sip24_final(struct siphash *H) { + const char left = (char)(H->p - H->buf); + uint64_t b = (H->c + left) << 56; + + switch (left) { + case 7: b |= (uint64_t)H->buf[6] << 48; + case 6: b |= (uint64_t)H->buf[5] << 40; + case 5: b |= (uint64_t)H->buf[4] << 32; + case 4: b |= (uint64_t)H->buf[3] << 24; + case 3: b |= (uint64_t)H->buf[2] << 16; + case 2: b |= (uint64_t)H->buf[1] << 8; + case 1: b |= (uint64_t)H->buf[0] << 0; + case 0: break; + } + + H->v3 ^= b; + sip_round(H, 2); + H->v0 ^= b; + H->v2 ^= 0xff; + sip_round(H, 4); + + return H->v0 ^ H->v1 ^ H->v2 ^ H->v3; +} /* sip24_final() */ + + +static uint64_t siphash24(const void *src, size_t len, + const struct sipkey *key) { + struct siphash state = SIPHASH_INITIALIZER; + return sip24_final(sip24_update(sip24_init(&state, key), src, len)); +} /* siphash24() */ + + +/* + * SipHash-2-4 output with + * k = 00 01 02 ... + * and + * in = (empty string) + * in = 00 (1 byte) + * in = 00 01 (2 bytes) + * in = 00 01 02 (3 bytes) + * ... + * in = 00 01 02 ... 3e (63 bytes) + */ +static int sip24_valid(void) { + static const unsigned char vectors[64][8] = { + { 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, }, + { 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, }, + { 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, }, + { 0x2d, 0x7e, 0xfb, 0xd7, 0x96, 0x66, 0x67, 0x85, }, + { 0xb7, 0x87, 0x71, 0x27, 0xe0, 0x94, 0x27, 0xcf, }, + { 0x8d, 0xa6, 0x99, 0xcd, 0x64, 0x55, 0x76, 0x18, }, + { 0xce, 0xe3, 0xfe, 0x58, 0x6e, 0x46, 0xc9, 0xcb, }, + { 0x37, 0xd1, 0x01, 0x8b, 0xf5, 0x00, 0x02, 0xab, }, + { 0x62, 0x24, 0x93, 0x9a, 0x79, 0xf5, 0xf5, 0x93, }, + { 0xb0, 0xe4, 0xa9, 0x0b, 0xdf, 0x82, 0x00, 0x9e, }, + { 0xf3, 0xb9, 0xdd, 0x94, 0xc5, 0xbb, 0x5d, 0x7a, }, + { 0xa7, 0xad, 0x6b, 0x22, 0x46, 0x2f, 0xb3, 0xf4, }, + { 0xfb, 0xe5, 0x0e, 0x86, 0xbc, 0x8f, 0x1e, 0x75, }, + { 0x90, 0x3d, 0x84, 0xc0, 0x27, 0x56, 0xea, 0x14, }, + { 0xee, 0xf2, 0x7a, 0x8e, 0x90, 0xca, 0x23, 0xf7, }, + { 0xe5, 0x45, 0xbe, 0x49, 0x61, 0xca, 0x29, 0xa1, }, + { 0xdb, 0x9b, 0xc2, 0x57, 0x7f, 0xcc, 0x2a, 0x3f, }, + { 0x94, 0x47, 0xbe, 0x2c, 0xf5, 0xe9, 0x9a, 0x69, }, + { 0x9c, 0xd3, 0x8d, 0x96, 0xf0, 0xb3, 0xc1, 0x4b, }, + { 0xbd, 0x61, 0x79, 0xa7, 0x1d, 0xc9, 0x6d, 0xbb, }, + { 0x98, 0xee, 0xa2, 0x1a, 0xf2, 0x5c, 0xd6, 0xbe, }, + { 0xc7, 0x67, 0x3b, 0x2e, 0xb0, 0xcb, 0xf2, 0xd0, }, + { 0x88, 0x3e, 0xa3, 0xe3, 0x95, 0x67, 0x53, 0x93, }, + { 0xc8, 0xce, 0x5c, 0xcd, 0x8c, 0x03, 0x0c, 0xa8, }, + { 0x94, 0xaf, 0x49, 0xf6, 0xc6, 0x50, 0xad, 0xb8, }, + { 0xea, 0xb8, 0x85, 0x8a, 0xde, 0x92, 0xe1, 0xbc, }, + { 0xf3, 0x15, 0xbb, 0x5b, 0xb8, 0x35, 0xd8, 0x17, }, + { 0xad, 0xcf, 0x6b, 0x07, 0x63, 0x61, 0x2e, 0x2f, }, + { 0xa5, 0xc9, 0x1d, 0xa7, 0xac, 0xaa, 0x4d, 0xde, }, + { 0x71, 0x65, 0x95, 0x87, 0x66, 0x50, 0xa2, 0xa6, }, + { 0x28, 0xef, 0x49, 0x5c, 0x53, 0xa3, 0x87, 0xad, }, + { 0x42, 0xc3, 0x41, 0xd8, 0xfa, 0x92, 0xd8, 0x32, }, + { 0xce, 0x7c, 0xf2, 0x72, 0x2f, 0x51, 0x27, 0x71, }, + { 0xe3, 0x78, 0x59, 0xf9, 0x46, 0x23, 0xf3, 0xa7, }, + { 0x38, 0x12, 0x05, 0xbb, 0x1a, 0xb0, 0xe0, 0x12, }, + { 0xae, 0x97, 0xa1, 0x0f, 0xd4, 0x34, 0xe0, 0x15, }, + { 0xb4, 0xa3, 0x15, 0x08, 0xbe, 0xff, 0x4d, 0x31, }, + { 0x81, 0x39, 0x62, 0x29, 0xf0, 0x90, 0x79, 0x02, }, + { 0x4d, 0x0c, 0xf4, 0x9e, 0xe5, 0xd4, 0xdc, 0xca, }, + { 0x5c, 0x73, 0x33, 0x6a, 0x76, 0xd8, 0xbf, 0x9a, }, + { 0xd0, 0xa7, 0x04, 0x53, 0x6b, 0xa9, 0x3e, 0x0e, }, + { 0x92, 0x59, 0x58, 0xfc, 0xd6, 0x42, 0x0c, 0xad, }, + { 0xa9, 0x15, 0xc2, 0x9b, 0xc8, 0x06, 0x73, 0x18, }, + { 0x95, 0x2b, 0x79, 0xf3, 0xbc, 0x0a, 0xa6, 0xd4, }, + { 0xf2, 0x1d, 0xf2, 0xe4, 0x1d, 0x45, 0x35, 0xf9, }, + { 0x87, 0x57, 0x75, 0x19, 0x04, 0x8f, 0x53, 0xa9, }, + { 0x10, 0xa5, 0x6c, 0xf5, 0xdf, 0xcd, 0x9a, 0xdb, }, + { 0xeb, 0x75, 0x09, 0x5c, 0xcd, 0x98, 0x6c, 0xd0, }, + { 0x51, 0xa9, 0xcb, 0x9e, 0xcb, 0xa3, 0x12, 0xe6, }, + { 0x96, 0xaf, 0xad, 0xfc, 0x2c, 0xe6, 0x66, 0xc7, }, + { 0x72, 0xfe, 0x52, 0x97, 0x5a, 0x43, 0x64, 0xee, }, + { 0x5a, 0x16, 0x45, 0xb2, 0x76, 0xd5, 0x92, 0xa1, }, + { 0xb2, 0x74, 0xcb, 0x8e, 0xbf, 0x87, 0x87, 0x0a, }, + { 0x6f, 0x9b, 0xb4, 0x20, 0x3d, 0xe7, 0xb3, 0x81, }, + { 0xea, 0xec, 0xb2, 0xa3, 0x0b, 0x22, 0xa8, 0x7f, }, + { 0x99, 0x24, 0xa4, 0x3c, 0xc1, 0x31, 0x57, 0x24, }, + { 0xbd, 0x83, 0x8d, 0x3a, 0xaf, 0xbf, 0x8d, 0xb7, }, + { 0x0b, 0x1a, 0x2a, 0x32, 0x65, 0xd5, 0x1a, 0xea, }, + { 0x13, 0x50, 0x79, 0xa3, 0x23, 0x1c, 0xe6, 0x60, }, + { 0x93, 0x2b, 0x28, 0x46, 0xe4, 0xd7, 0x06, 0x66, }, + { 0xe1, 0x91, 0x5f, 0x5c, 0xb1, 0xec, 0xa4, 0x6c, }, + { 0xf3, 0x25, 0x96, 0x5c, 0xa1, 0x6d, 0x62, 0x9f, }, + { 0x57, 0x5f, 0xf2, 0x8e, 0x60, 0x38, 0x1b, 0xe5, }, + { 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, } + }; + unsigned char in[64]; + struct sipkey k; + size_t i; + + sip_tokey(&k, "\000\001\002\003\004\005\006\007\010\011" + "\012\013\014\015\016\017"); + + for (i = 0; i < sizeof in; ++i) { + in[i] = (unsigned char)i; + + if (siphash24(in, i, &k) != SIP_U8TO64_LE(vectors[i])) + return 0; + } + + return 1; +} /* sip24_valid() */ + + +#if SIPHASH_MAIN + +#include + +int main(void) { + const int ok = sip24_valid(); + + if (ok) + puts("OK"); + else + puts("FAIL"); + + return !ok; +} /* main() */ + +#endif /* SIPHASH_MAIN */ + + +#endif /* SIPHASH_H */ diff --git a/src/expat/lib/winconfig.h b/src/expat/lib/winconfig.h index c1b791d62d..9bf014d7fb 100644 --- a/src/expat/lib/winconfig.h +++ b/src/expat/lib/winconfig.h @@ -17,6 +17,12 @@ #include #include + +#if defined(HAVE_EXPAT_CONFIG_H) /* e.g. MinGW */ +# include +#else /* !defined(HAVE_EXPAT_CONFIG_H) */ + + #define XML_NS 1 #define XML_DTD 1 #define XML_CONTEXT_BYTES 1024 @@ -27,4 +33,8 @@ /* Windows has memmove() available. */ #define HAVE_MEMMOVE + +#endif /* !defined(HAVE_EXPAT_CONFIG_H) */ + + #endif /* ndef WINCONFIG_H */ diff --git a/src/expat/lib/xmlparse.c b/src/expat/lib/xmlparse.c index b308e67e2d..ba1fd9ae7c 100644 --- a/src/expat/lib/xmlparse.c +++ b/src/expat/lib/xmlparse.c @@ -1,13 +1,21 @@ /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd See the file COPYING for copying permission. + + cd4063469a95eab9a93001afb109e3dee122cdda4635bbec36257fc01c327348 (2.2.2+) */ +#if !defined(_GNU_SOURCE) +# define _GNU_SOURCE 1 /* syscall prototype */ +#endif + #include #include /* memset(), memcpy() */ #include #include /* UINT_MAX */ +#include /* fprintf */ +#include /* getenv */ -#ifdef WIN32 +#ifdef _WIN32 #define getpid GetCurrentProcessId #else #include /* gettimeofday() */ @@ -17,20 +25,55 @@ #define XML_BUILDING_EXPAT 1 -#ifdef WIN32 +#ifdef _WIN32 #include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" #elif defined(HAVE_EXPAT_CONFIG_H) #include -#endif /* ndef WIN32 */ +#endif /* ndef _WIN32 */ #include "ascii.h" #include "expat.h" +#include "siphash.h" + +#if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) +# include +# if defined(HAVE_GETRANDOM) +# include /* getrandom */ +# else +# include /* syscall */ +# include /* SYS_getrandom */ +# endif +#endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */ + +#if defined(HAVE_ARC4RANDOM_BUF) && defined(HAVE_LIBBSD) +# include +#endif + + +#if !defined(HAVE_GETRANDOM) && !defined(HAVE_SYSCALL_GETRANDOM) \ + && !defined(HAVE_ARC4RANDOM_BUF) && !defined(_WIN32) \ + && !defined(XML_POOR_ENTROPY) +# error \ + You do not have support for any sources of high quality entropy \ + enabled. For end user security, that is probably not what you want. \ + \ + Your options include: \ + * Linux + glibc >=2.25 (getrandom): HAVE_GETRANDOM, \ + * Linux + glibc <2.25 (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, \ + * BSD / macOS (arc4random_buf): HAVE_ARC4RANDOM_BUF, \ + * libbsd (arc4random_buf): HAVE_ARC4RANDOM_BUF + HAVE_LIBBSD, \ + * Windows (RtlGenRandom): _WIN32. \ + \ + If insist on not using any of these, bypass this error by defining \ + XML_POOR_ENTROPY; you have been warned. \ + \ + For CMake, one way to pass the define is: \ + cmake -DCMAKE_C_FLAGS="-pipe -O2 -DHAVE_SYSCALL_GETRANDOM" . \ + \ + If you have reasons to patch this detection code away or need changes \ + to the build system, please open a bug. Thank you! +#endif + #ifdef XML_UNICODE #define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX @@ -109,17 +152,11 @@ typedef struct { const XML_Memory_Handling_Suite *mem; } HASH_TABLE; -/* Basic character hash algorithm, taken from Python's string hash: - h = h * 1000003 ^ character, the constant being a prime number. +static size_t +keylen(KEY s); -*/ -#ifdef XML_UNICODE -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned short)(c)) -#else -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned char)(c)) -#endif +static void +copy_salt_to_sipkey(XML_Parser parser, struct sipkey * key); /* For probing (after a collision) we need a step size relative prime to the hash table size, which is a power of 2. We use double-hashing, @@ -355,6 +392,8 @@ doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr, XML_Bool haveMore); #endif /* XML_DTD */ +static void +freeBindings(XML_Parser parser, BINDING *bindings); static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, const char *s, TAG_NAME *tagNamePtr, BINDING **bindingsPtr); @@ -439,6 +478,9 @@ static ELEMENT_TYPE * getElementType(XML_Parser parser, const ENCODING *enc, const char *ptr, const char *end); +static XML_Char *copyString(const XML_Char *s, + const XML_Memory_Handling_Suite *memsuite); + static unsigned long generate_hash_secret_salt(XML_Parser parser); static XML_Bool startParsing(XML_Parser parser); @@ -697,10 +739,76 @@ static const XML_Char implicitContext[] = { ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0' }; + +#if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) + +/* Obtain entropy on Linux 3.17+ */ +static int +writeRandomBytes_getrandom(void * target, size_t count) { + int success = 0; /* full count bytes written? */ + size_t bytesWrittenTotal = 0; + const unsigned int getrandomFlags = 0; + + do { + void * const currentTarget = (void*)((char*)target + bytesWrittenTotal); + const size_t bytesToWrite = count - bytesWrittenTotal; + + const int bytesWrittenMore = +#if defined(HAVE_GETRANDOM) + getrandom(currentTarget, bytesToWrite, getrandomFlags); +#else + syscall(SYS_getrandom, currentTarget, bytesToWrite, getrandomFlags); +#endif + + if (bytesWrittenMore > 0) { + bytesWrittenTotal += bytesWrittenMore; + if (bytesWrittenTotal >= count) + success = 1; + } + } while (! success && (errno == EINTR || errno == EAGAIN)); + + return success; +} + +#endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */ + + +#ifdef _WIN32 + +typedef BOOLEAN (APIENTRY *RTLGENRANDOM_FUNC)(PVOID, ULONG); + +/* Obtain entropy on Windows XP / Windows Server 2003 and later. + * Hint on RtlGenRandom and the following article from libsodioum. + * + * Michael Howard: Cryptographically Secure Random number on Windows without using CryptoAPI + * https://blogs.msdn.microsoft.com/michael_howard/2005/01/14/cryptographically-secure-random-number-on-windows-without-using-cryptoapi/ + */ +static int +writeRandomBytes_RtlGenRandom(void * target, size_t count) { + int success = 0; /* full count bytes written? */ + const HMODULE advapi32 = LoadLibrary(TEXT("ADVAPI32.DLL")); + + if (advapi32) { + const RTLGENRANDOM_FUNC RtlGenRandom + = (RTLGENRANDOM_FUNC)GetProcAddress(advapi32, "SystemFunction036"); + if (RtlGenRandom) { + if (RtlGenRandom((PVOID)target, (ULONG)count) == TRUE) { + success = 1; + } + } + FreeLibrary(advapi32); + } + + return success; +} + +#endif /* _WIN32 */ + + static unsigned long gather_time_entropy(void) { -#ifdef WIN32 +#ifdef _WIN32 FILETIME ft; GetSystemTimeAsFileTime(&ft); /* never fails */ return ft.dwHighDateTime ^ ft.dwLowDateTime; @@ -709,27 +817,70 @@ gather_time_entropy(void) int gettimeofday_res; gettimeofday_res = gettimeofday(&tv, NULL); + +#if defined(NDEBUG) + (void)gettimeofday_res; +#else assert (gettimeofday_res == 0); +#endif /* defined(NDEBUG) */ /* Microseconds time is <20 bits entropy */ return tv.tv_usec; #endif } +static unsigned long +ENTROPY_DEBUG(const char * label, unsigned long entropy) { + const char * const EXPAT_ENTROPY_DEBUG = getenv("EXPAT_ENTROPY_DEBUG"); + if (EXPAT_ENTROPY_DEBUG && ! strcmp(EXPAT_ENTROPY_DEBUG, "1")) { + fprintf(stderr, "Entropy: %s --> 0x%0*lx (%lu bytes)\n", + label, + (int)sizeof(entropy) * 2, entropy, + (unsigned long)sizeof(entropy)); + } + return entropy; +} + static unsigned long generate_hash_secret_salt(XML_Parser parser) { - /* Process ID is 0 bits entropy if attacker has local access - * XML_Parser address is few bits of entropy if attacker has local access */ - const unsigned long entropy = - gather_time_entropy() ^ getpid() ^ (unsigned long)parser; + unsigned long entropy; + (void)parser; +#if defined(HAVE_ARC4RANDOM_BUF) || defined(__CloudABI__) + (void)gather_time_entropy; + arc4random_buf(&entropy, sizeof(entropy)); + return ENTROPY_DEBUG("arc4random_buf", entropy); +#else + /* Try high quality providers first .. */ +#ifdef _WIN32 + if (writeRandomBytes_RtlGenRandom((void *)&entropy, sizeof(entropy))) { + return ENTROPY_DEBUG("RtlGenRandom", entropy); + } +#elif defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) + if (writeRandomBytes_getrandom((void *)&entropy, sizeof(entropy))) { + return ENTROPY_DEBUG("getrandom", entropy); + } +#endif + /* .. and self-made low quality for backup: */ + + /* Process ID is 0 bits entropy if attacker has local access */ + entropy = gather_time_entropy() ^ getpid(); /* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */ if (sizeof(unsigned long) == 4) { - return entropy * 2147483647; + return ENTROPY_DEBUG("fallback(4)", entropy * 2147483647); } else { - return entropy * (unsigned long)2305843009213693951; + return ENTROPY_DEBUG("fallback(8)", + entropy * (unsigned long)2305843009213693951ULL); } +#endif +} + +static unsigned long +get_hash_secret_salt(XML_Parser parser) { + if (parser->m_parentParser != NULL) + return get_hash_secret_salt(parser->m_parentParser); + return parser->m_hash_secret_salt; } static XML_Bool /* only valid for root parser */ @@ -849,6 +1000,8 @@ parserCreate(const XML_Char *encodingName, nsAttsVersion = 0; nsAttsPower = 0; + protocolEncodingName = NULL; + poolInit(&tempPool, &(parser->m_mem)); poolInit(&temp2Pool, &(parser->m_mem)); parserInit(parser, encodingName); @@ -875,9 +1028,9 @@ parserInit(XML_Parser parser, const XML_Char *encodingName) { processor = prologInitProcessor; XmlPrologStateInit(&prologState); - protocolEncodingName = (encodingName != NULL - ? poolCopyString(&tempPool, encodingName) - : NULL); + if (encodingName != NULL) { + protocolEncodingName = copyString(encodingName, &(parser->m_mem)); + } curBase = NULL; XmlInitEncoding(&initEncoding, &encoding, 0); userData = NULL; @@ -960,6 +1113,10 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) { TAG *tStk; OPEN_INTERNAL_ENTITY *openEntityList; + + if (parser == NULL) + return XML_FALSE; + if (parentParser) return XML_FALSE; /* move tagStack to freeTagList */ @@ -986,6 +1143,8 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) unknownEncodingRelease(unknownEncodingData); poolClear(&tempPool); poolClear(&temp2Pool); + FREE((void *)protocolEncodingName); + protocolEncodingName = NULL; parserInit(parser, encodingName); dtdReset(_dtd, &parser->m_mem); return XML_TRUE; @@ -994,16 +1153,24 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) enum XML_Status XMLCALL XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) { + if (parser == NULL) + return XML_STATUS_ERROR; /* Block after XML_Parse()/XML_ParseBuffer() has been called. XXX There's no way for the caller to determine which of the XXX possible error cases caused the XML_STATUS_ERROR return. */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return XML_STATUS_ERROR; + + /* Get rid of any previous encoding name */ + FREE((void *)protocolEncodingName); + if (encodingName == NULL) + /* No new encoding name */ protocolEncodingName = NULL; else { - protocolEncodingName = poolCopyString(&tempPool, encodingName); + /* Copy the new encoding name into allocated memory */ + protocolEncodingName = copyString(encodingName, &(parser->m_mem)); if (!protocolEncodingName) return XML_STATUS_ERROR; } @@ -1017,52 +1184,88 @@ XML_ExternalEntityParserCreate(XML_Parser oldParser, { XML_Parser parser = oldParser; DTD *newDtd = NULL; - DTD *oldDtd = _dtd; - XML_StartElementHandler oldStartElementHandler = startElementHandler; - XML_EndElementHandler oldEndElementHandler = endElementHandler; - XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; - XML_ProcessingInstructionHandler oldProcessingInstructionHandler - = processingInstructionHandler; - XML_CommentHandler oldCommentHandler = commentHandler; - XML_StartCdataSectionHandler oldStartCdataSectionHandler - = startCdataSectionHandler; - XML_EndCdataSectionHandler oldEndCdataSectionHandler - = endCdataSectionHandler; - XML_DefaultHandler oldDefaultHandler = defaultHandler; - XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler - = unparsedEntityDeclHandler; - XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler; - XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler - = startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler - = endNamespaceDeclHandler; - XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler; - XML_ExternalEntityRefHandler oldExternalEntityRefHandler - = externalEntityRefHandler; - XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler; - XML_UnknownEncodingHandler oldUnknownEncodingHandler - = unknownEncodingHandler; - XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler; - XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler; - XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler; - XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler; - ELEMENT_TYPE * oldDeclElementType = declElementType; + DTD *oldDtd; + XML_StartElementHandler oldStartElementHandler; + XML_EndElementHandler oldEndElementHandler; + XML_CharacterDataHandler oldCharacterDataHandler; + XML_ProcessingInstructionHandler oldProcessingInstructionHandler; + XML_CommentHandler oldCommentHandler; + XML_StartCdataSectionHandler oldStartCdataSectionHandler; + XML_EndCdataSectionHandler oldEndCdataSectionHandler; + XML_DefaultHandler oldDefaultHandler; + XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler; + XML_NotationDeclHandler oldNotationDeclHandler; + XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler; + XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler; + XML_NotStandaloneHandler oldNotStandaloneHandler; + XML_ExternalEntityRefHandler oldExternalEntityRefHandler; + XML_SkippedEntityHandler oldSkippedEntityHandler; + XML_UnknownEncodingHandler oldUnknownEncodingHandler; + XML_ElementDeclHandler oldElementDeclHandler; + XML_AttlistDeclHandler oldAttlistDeclHandler; + XML_EntityDeclHandler oldEntityDeclHandler; + XML_XmlDeclHandler oldXmlDeclHandler; + ELEMENT_TYPE * oldDeclElementType; - void *oldUserData = userData; - void *oldHandlerArg = handlerArg; - XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities; - XML_Parser oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; + void *oldUserData; + void *oldHandlerArg; + XML_Bool oldDefaultExpandInternalEntities; + XML_Parser oldExternalEntityRefHandlerArg; #ifdef XML_DTD - enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing; - int oldInEntityValue = prologState.inEntityValue; + enum XML_ParamEntityParsing oldParamEntityParsing; + int oldInEntityValue; #endif - XML_Bool oldns_triplets = ns_triplets; + XML_Bool oldns_triplets; /* Note that the new parser shares the same hash secret as the old parser, so that dtdCopy and copyEntityTable can lookup values from hash tables associated with either parser without us having to worry which hash secrets each table has. */ - unsigned long oldhash_secret_salt = hash_secret_salt; + unsigned long oldhash_secret_salt; + + /* Validate the oldParser parameter before we pull everything out of it */ + if (oldParser == NULL) + return NULL; + + /* Stash the original parser contents on the stack */ + oldDtd = _dtd; + oldStartElementHandler = startElementHandler; + oldEndElementHandler = endElementHandler; + oldCharacterDataHandler = characterDataHandler; + oldProcessingInstructionHandler = processingInstructionHandler; + oldCommentHandler = commentHandler; + oldStartCdataSectionHandler = startCdataSectionHandler; + oldEndCdataSectionHandler = endCdataSectionHandler; + oldDefaultHandler = defaultHandler; + oldUnparsedEntityDeclHandler = unparsedEntityDeclHandler; + oldNotationDeclHandler = notationDeclHandler; + oldStartNamespaceDeclHandler = startNamespaceDeclHandler; + oldEndNamespaceDeclHandler = endNamespaceDeclHandler; + oldNotStandaloneHandler = notStandaloneHandler; + oldExternalEntityRefHandler = externalEntityRefHandler; + oldSkippedEntityHandler = skippedEntityHandler; + oldUnknownEncodingHandler = unknownEncodingHandler; + oldElementDeclHandler = elementDeclHandler; + oldAttlistDeclHandler = attlistDeclHandler; + oldEntityDeclHandler = entityDeclHandler; + oldXmlDeclHandler = xmlDeclHandler; + oldDeclElementType = declElementType; + + oldUserData = userData; + oldHandlerArg = handlerArg; + oldDefaultExpandInternalEntities = defaultExpandInternalEntities; + oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; +#ifdef XML_DTD + oldParamEntityParsing = paramEntityParsing; + oldInEntityValue = prologState.inEntityValue; +#endif + oldns_triplets = ns_triplets; + /* Note that the new parser shares the same hash secret as the old + parser, so that dtdCopy and copyEntityTable can lookup values + from hash tables associated with either parser without us having + to worry which hash secrets each table has. + */ + oldhash_secret_salt = hash_secret_salt; #ifdef XML_DTD if (!context) @@ -1202,6 +1405,7 @@ XML_ParserFree(XML_Parser parser) destroyBindings(inheritedBindings, parser); poolDestroy(&tempPool); poolDestroy(&temp2Pool); + FREE((void *)protocolEncodingName); #ifdef XML_DTD /* external parameter entity parsers share the DTD structure parser->m_dtd with the root parser, so we must not destroy it @@ -1228,12 +1432,15 @@ XML_ParserFree(XML_Parser parser) void XMLCALL XML_UseParserAsHandlerArg(XML_Parser parser) { - handlerArg = parser; + if (parser != NULL) + handlerArg = parser; } enum XML_Error XMLCALL XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) { + if (parser == NULL) + return XML_ERROR_INVALID_ARGUMENT; #ifdef XML_DTD /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) @@ -1248,6 +1455,8 @@ XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) void XMLCALL XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) { + if (parser == NULL) + return; /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return; @@ -1257,6 +1466,8 @@ XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) void XMLCALL XML_SetUserData(XML_Parser parser, void *p) { + if (parser == NULL) + return; if (handlerArg == userData) handlerArg = userData = p; else @@ -1266,6 +1477,8 @@ XML_SetUserData(XML_Parser parser, void *p) enum XML_Status XMLCALL XML_SetBase(XML_Parser parser, const XML_Char *p) { + if (parser == NULL) + return XML_STATUS_ERROR; if (p) { p = poolCopyString(&_dtd->pool, p); if (!p) @@ -1280,18 +1493,24 @@ XML_SetBase(XML_Parser parser, const XML_Char *p) const XML_Char * XMLCALL XML_GetBase(XML_Parser parser) { + if (parser == NULL) + return NULL; return curBase; } int XMLCALL XML_GetSpecifiedAttributeCount(XML_Parser parser) { + if (parser == NULL) + return -1; return nSpecifiedAtts; } int XMLCALL XML_GetIdAttributeIndex(XML_Parser parser) { + if (parser == NULL) + return -1; return idAttIndex; } @@ -1299,6 +1518,8 @@ XML_GetIdAttributeIndex(XML_Parser parser) const XML_AttrInfo * XMLCALL XML_GetAttributeInfo(XML_Parser parser) { + if (parser == NULL) + return NULL; return attInfo; } #endif @@ -1308,6 +1529,8 @@ XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end) { + if (parser == NULL) + return; startElementHandler = start; endElementHandler = end; } @@ -1315,34 +1538,39 @@ XML_SetElementHandler(XML_Parser parser, void XMLCALL XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler start) { - startElementHandler = start; + if (parser != NULL) + startElementHandler = start; } void XMLCALL XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler end) { - endElementHandler = end; + if (parser != NULL) + endElementHandler = end; } void XMLCALL XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler) { - characterDataHandler = handler; + if (parser != NULL) + characterDataHandler = handler; } void XMLCALL XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler) { - processingInstructionHandler = handler; + if (parser != NULL) + processingInstructionHandler = handler; } void XMLCALL XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler) { - commentHandler = handler; + if (parser != NULL) + commentHandler = handler; } void XMLCALL @@ -1350,6 +1578,8 @@ XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end) { + if (parser == NULL) + return; startCdataSectionHandler = start; endCdataSectionHandler = end; } @@ -1357,19 +1587,23 @@ XML_SetCdataSectionHandler(XML_Parser parser, void XMLCALL XML_SetStartCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start) { - startCdataSectionHandler = start; + if (parser != NULL) + startCdataSectionHandler = start; } void XMLCALL XML_SetEndCdataSectionHandler(XML_Parser parser, XML_EndCdataSectionHandler end) { - endCdataSectionHandler = end; + if (parser != NULL) + endCdataSectionHandler = end; } void XMLCALL XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler) { + if (parser == NULL) + return; defaultHandler = handler; defaultExpandInternalEntities = XML_FALSE; } @@ -1378,6 +1612,8 @@ void XMLCALL XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler) { + if (parser == NULL) + return; defaultHandler = handler; defaultExpandInternalEntities = XML_TRUE; } @@ -1387,6 +1623,8 @@ XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end) { + if (parser == NULL) + return; startDoctypeDeclHandler = start; endDoctypeDeclHandler = end; } @@ -1394,27 +1632,31 @@ XML_SetDoctypeDeclHandler(XML_Parser parser, void XMLCALL XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start) { - startDoctypeDeclHandler = start; + if (parser != NULL) + startDoctypeDeclHandler = start; } void XMLCALL XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end) { - endDoctypeDeclHandler = end; + if (parser != NULL) + endDoctypeDeclHandler = end; } void XMLCALL XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler) { - unparsedEntityDeclHandler = handler; + if (parser != NULL) + unparsedEntityDeclHandler = handler; } void XMLCALL XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler) { - notationDeclHandler = handler; + if (parser != NULL) + notationDeclHandler = handler; } void XMLCALL @@ -1422,6 +1664,8 @@ XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end) { + if (parser == NULL) + return; startNamespaceDeclHandler = start; endNamespaceDeclHandler = end; } @@ -1429,32 +1673,38 @@ XML_SetNamespaceDeclHandler(XML_Parser parser, void XMLCALL XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start) { - startNamespaceDeclHandler = start; + if (parser != NULL) + startNamespaceDeclHandler = start; } void XMLCALL XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end) { - endNamespaceDeclHandler = end; + if (parser != NULL) + endNamespaceDeclHandler = end; } void XMLCALL XML_SetNotStandaloneHandler(XML_Parser parser, XML_NotStandaloneHandler handler) { - notStandaloneHandler = handler; + if (parser != NULL) + notStandaloneHandler = handler; } void XMLCALL XML_SetExternalEntityRefHandler(XML_Parser parser, XML_ExternalEntityRefHandler handler) { - externalEntityRefHandler = handler; + if (parser != NULL) + externalEntityRefHandler = handler; } void XMLCALL XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) { + if (parser == NULL) + return; if (arg) externalEntityRefHandlerArg = (XML_Parser)arg; else @@ -1465,7 +1715,8 @@ void XMLCALL XML_SetSkippedEntityHandler(XML_Parser parser, XML_SkippedEntityHandler handler) { - skippedEntityHandler = handler; + if (parser != NULL) + skippedEntityHandler = handler; } void XMLCALL @@ -1473,6 +1724,8 @@ XML_SetUnknownEncodingHandler(XML_Parser parser, XML_UnknownEncodingHandler handler, void *data) { + if (parser == NULL) + return; unknownEncodingHandler = handler; unknownEncodingHandlerData = data; } @@ -1481,33 +1734,39 @@ void XMLCALL XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl) { - elementDeclHandler = eldecl; + if (parser != NULL) + elementDeclHandler = eldecl; } void XMLCALL XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl) { - attlistDeclHandler = attdecl; + if (parser != NULL) + attlistDeclHandler = attdecl; } void XMLCALL XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler) { - entityDeclHandler = handler; + if (parser != NULL) + entityDeclHandler = handler; } void XMLCALL XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler handler) { - xmlDeclHandler = handler; + if (parser != NULL) + xmlDeclHandler = handler; } int XMLCALL XML_SetParamEntityParsing(XML_Parser parser, enum XML_ParamEntityParsing peParsing) { + if (parser == NULL) + return 0; /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return 0; @@ -1523,6 +1782,10 @@ int XMLCALL XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt) { + if (parser == NULL) + return 0; + if (parser->m_parentParser) + return XML_SetHashSalt(parser->m_parentParser, hash_salt); /* block after XML_Parse()/XML_ParseBuffer() has been called */ if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) return 0; @@ -1533,6 +1796,11 @@ XML_SetHashSalt(XML_Parser parser, enum XML_Status XMLCALL XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) { + if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) { + if (parser != NULL) + parser->m_errorCode = XML_ERROR_INVALID_ARGUMENT; + return XML_STATUS_ERROR; + } switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; @@ -1585,6 +1853,13 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) const char *end; int nLeftOver; enum XML_Status result; + /* Detect overflow (a+b > MAX <==> b > MAX-a) */ + if (len > ((XML_Size)-1) / 2 - parseEndByteIndex) { + errorCode = XML_ERROR_NO_MEMORY; + eventPtr = eventEndPtr = NULL; + processor = errorProcessor; + return XML_STATUS_ERROR; + } parseEndByteIndex += len; positionPtr = s; ps_finalBuffer = (XML_Bool)isFinal; @@ -1617,11 +1892,14 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) nLeftOver = s + len - end; if (nLeftOver) { if (buffer == NULL || nLeftOver > bufferLim - buffer) { - /* FIXME avoid integer overflow */ - char *temp; - temp = (buffer == NULL - ? (char *)MALLOC(len * 2) - : (char *)REALLOC(buffer, len * 2)); + /* avoid _signed_ integer overflow */ + char *temp = NULL; + const int bytesToAllocate = (int)((unsigned)len * 2U); + if (bytesToAllocate > 0) { + temp = (buffer == NULL + ? (char *)MALLOC(bytesToAllocate) + : (char *)REALLOC(buffer, bytesToAllocate)); + } if (temp == NULL) { errorCode = XML_ERROR_NO_MEMORY; eventPtr = eventEndPtr = NULL; @@ -1629,7 +1907,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) return XML_STATUS_ERROR; } buffer = temp; - bufferLim = buffer + len * 2; + bufferLim = buffer + bytesToAllocate; } memcpy(buffer, end, nLeftOver); } @@ -1659,6 +1937,8 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal) const char *start; enum XML_Status result = XML_STATUS_OK; + if (parser == NULL) + return XML_STATUS_ERROR; switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; @@ -1712,6 +1992,8 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal) void * XMLCALL XML_GetBuffer(XML_Parser parser, int len) { + if (parser == NULL) + return NULL; if (len < 0) { errorCode = XML_ERROR_NO_MEMORY; return NULL; @@ -1808,6 +2090,8 @@ XML_GetBuffer(XML_Parser parser, int len) enum XML_Status XMLCALL XML_StopParser(XML_Parser parser, XML_Bool resumable) { + if (parser == NULL) + return XML_STATUS_ERROR; switch (ps_parsing) { case XML_SUSPENDED: if (resumable) { @@ -1840,6 +2124,8 @@ XML_ResumeParser(XML_Parser parser) { enum XML_Status result = XML_STATUS_OK; + if (parser == NULL) + return XML_STATUS_ERROR; if (ps_parsing != XML_SUSPENDED) { errorCode = XML_ERROR_NOT_SUSPENDED; return XML_STATUS_ERROR; @@ -1876,6 +2162,8 @@ XML_ResumeParser(XML_Parser parser) void XMLCALL XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) { + if (parser == NULL) + return; assert(status != NULL); *status = parser->m_parsingStatus; } @@ -1883,12 +2171,16 @@ XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) enum XML_Error XMLCALL XML_GetErrorCode(XML_Parser parser) { + if (parser == NULL) + return XML_ERROR_INVALID_ARGUMENT; return errorCode; } XML_Index XMLCALL XML_GetCurrentByteIndex(XML_Parser parser) { + if (parser == NULL) + return -1; if (eventPtr) return (XML_Index)(parseEndByteIndex - (parseEndPtr - eventPtr)); return -1; @@ -1897,6 +2189,8 @@ XML_GetCurrentByteIndex(XML_Parser parser) int XMLCALL XML_GetCurrentByteCount(XML_Parser parser) { + if (parser == NULL) + return 0; if (eventEndPtr && eventPtr) return (int)(eventEndPtr - eventPtr); return 0; @@ -1906,11 +2200,19 @@ const char * XMLCALL XML_GetInputContext(XML_Parser parser, int *offset, int *size) { #ifdef XML_CONTEXT_BYTES + if (parser == NULL) + return NULL; if (eventPtr && buffer) { - *offset = (int)(eventPtr - buffer); - *size = (int)(bufferEnd - buffer); + if (offset != NULL) + *offset = (int)(eventPtr - buffer); + if (size != NULL) + *size = (int)(bufferEnd - buffer); return buffer; } +#else + (void)parser; + (void)offset; + (void)size; #endif /* defined XML_CONTEXT_BYTES */ return (char *) 0; } @@ -1918,6 +2220,8 @@ XML_GetInputContext(XML_Parser parser, int *offset, int *size) XML_Size XMLCALL XML_GetCurrentLineNumber(XML_Parser parser) { + if (parser == NULL) + return 0; if (eventPtr && eventPtr >= positionPtr) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr = eventPtr; @@ -1928,6 +2232,8 @@ XML_GetCurrentLineNumber(XML_Parser parser) XML_Size XMLCALL XML_GetCurrentColumnNumber(XML_Parser parser) { + if (parser == NULL) + return 0; if (eventPtr && eventPtr >= positionPtr) { XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); positionPtr = eventPtr; @@ -1938,30 +2244,38 @@ XML_GetCurrentColumnNumber(XML_Parser parser) void XMLCALL XML_FreeContentModel(XML_Parser parser, XML_Content *model) { - FREE(model); + if (parser != NULL) + FREE(model); } void * XMLCALL XML_MemMalloc(XML_Parser parser, size_t size) { + if (parser == NULL) + return NULL; return MALLOC(size); } void * XMLCALL XML_MemRealloc(XML_Parser parser, void *ptr, size_t size) { + if (parser == NULL) + return NULL; return REALLOC(ptr, size); } void XMLCALL XML_MemFree(XML_Parser parser, void *ptr) { - FREE(ptr); + if (parser != NULL) + FREE(ptr); } void XMLCALL XML_DefaultCurrent(XML_Parser parser) { + if (parser == NULL) + return; if (defaultHandler) { if (openInternalEntities) reportDefault(parser, @@ -2468,7 +2782,7 @@ doContent(XML_Parser parser, &fromPtr, rawNameEnd, (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); convLen = (int)(toPtr - (XML_Char *)tag->buf); - if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) { + if ((fromPtr >= rawNameEnd) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) { tag->name.strLen = convLen; break; } @@ -2511,8 +2825,10 @@ doContent(XML_Parser parser, return XML_ERROR_NO_MEMORY; poolFinish(&tempPool); result = storeAtts(parser, enc, s, &name, &bindings); - if (result) + if (result != XML_ERROR_NONE) { + freeBindings(parser, bindings); return result; + } poolFinish(&tempPool); if (startElementHandler) { startElementHandler(handlerArg, name.str, (const XML_Char **)atts); @@ -2527,15 +2843,7 @@ doContent(XML_Parser parser, if (noElmHandlers && defaultHandler) reportDefault(parser, enc, s, next); poolClear(&tempPool); - while (bindings) { - BINDING *b = bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } + freeBindings(parser, bindings); } if (tagLevel == 0) return epilogProcessor(parser, next, end, nextPtr); @@ -2733,6 +3041,29 @@ doContent(XML_Parser parser, /* not reached */ } +/* This function does not call free() on the allocated memory, merely + * moving it to the parser's freeBindingList where it can be freed or + * reused as appropriate. + */ +static void +freeBindings(XML_Parser parser, BINDING *bindings) +{ + while (bindings) { + BINDING *b = bindings; + + /* startNamespaceDeclHandler will have been called for this + * binding in addBindings(), so call the end handler now. + */ + if (endNamespaceDeclHandler) + endNamespaceDeclHandler(handlerArg, b->prefix->name); + + bindings = bindings->nextTagBinding; + b->nextTagBinding = freeBindingList; + freeBindingList = b; + b->prefix->binding = b->prevPrefixBinding; + } +} + /* Precondition: all arguments must be non-NULL; Purpose: - normalize attributes @@ -2786,13 +3117,17 @@ storeAtts(XML_Parser parser, const ENCODING *enc, #endif attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE)); - if (temp == NULL) + if (temp == NULL) { + attsSize = oldAttsSize; return XML_ERROR_NO_MEMORY; + } atts = temp; #ifdef XML_ATTR_INFO temp2 = (XML_AttrInfo *)REALLOC((void *)attInfo, attsSize * sizeof(XML_AttrInfo)); - if (temp2 == NULL) + if (temp2 == NULL) { + attsSize = oldAttsSize; return XML_ERROR_NO_MEMORY; + } attInfo = temp2; #endif if (n > oldAttsSize) @@ -2929,6 +3264,7 @@ storeAtts(XML_Parser parser, const ENCODING *enc, int j; /* hash table index */ unsigned long version = nsAttsVersion; int nsAttsSize = (int)1 << nsAttsPower; + unsigned char oldNsAttsPower = nsAttsPower; /* size of hash table must be at least 2 * (# of prefixed attributes) */ if ((nPrefixes << 1) >> nsAttsPower) { /* true for nsAttsPower = 0 */ NS_ATT *temp; @@ -2938,8 +3274,11 @@ storeAtts(XML_Parser parser, const ENCODING *enc, nsAttsPower = 3; nsAttsSize = (int)1 << nsAttsPower; temp = (NS_ATT *)REALLOC(nsAtts, nsAttsSize * sizeof(NS_ATT)); - if (!temp) + if (!temp) { + /* Restore actual size of memory in nsAtts */ + nsAttsPower = oldNsAttsPower; return XML_ERROR_NO_MEMORY; + } nsAtts = temp; version = 0; /* force re-initialization of nsAtts hash table */ } @@ -2957,7 +3296,13 @@ storeAtts(XML_Parser parser, const ENCODING *enc, if (s[-1] == 2) { /* prefixed */ ATTRIBUTE_ID *id; const BINDING *b; - unsigned long uriHash = hash_secret_salt; + unsigned long uriHash; + struct siphash sip_state; + struct sipkey sip_key; + + copy_salt_to_sipkey(parser, &sip_key); + sip24_init(&sip_state, &sip_key); + ((XML_Char *)s)[-1] = 0; /* clear flag */ id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); if (!id || !id->prefix) @@ -2966,22 +3311,26 @@ storeAtts(XML_Parser parser, const ENCODING *enc, if (!b) return XML_ERROR_UNBOUND_PREFIX; - /* as we expand the name we also calculate its hash value */ for (j = 0; j < b->uriLen; j++) { const XML_Char c = b->uri[j]; if (!poolAppendChar(&tempPool, c)) return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); } + + sip24_update(&sip_state, b->uri, b->uriLen * sizeof(XML_Char)); + while (*s++ != XML_T(ASCII_COLON)) ; + + sip24_update(&sip_state, s, keylen(s) * sizeof(XML_Char)); + do { /* copies null terminator */ - const XML_Char c = *s; if (!poolAppendChar(&tempPool, *s)) return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); } while (*s++); + uriHash = (unsigned long)sip24_final(&sip_state); + { /* Check hash table for duplicate of expanded name (uriName). Derived from code in lookup(parser, HASH_TABLE *table, ...). */ @@ -3443,6 +3792,7 @@ initializeEncoding(XML_Parser parser) const char *s; #ifdef XML_UNICODE char encodingBuf[128]; + /* See comments abount `protoclEncodingName` in parserInit() */ if (!protocolEncodingName) s = NULL; else { @@ -3695,6 +4045,14 @@ entityValueInitProcessor(XML_Parser parser, *nextPtr = next; return XML_ERROR_NONE; } + /* If we get this token, we have the start of what might be a + normal tag, but not a declaration (i.e. it doesn't begin with + "= groupSize) { if (groupSize) { char *temp = (char *)REALLOC(groupConnector, groupSize *= 2); - if (temp == NULL) + if (temp == NULL) { + groupSize /= 2; return XML_ERROR_NO_MEMORY; + } groupConnector = temp; if (dtd->scaffIndex) { int *temp = (int *)REALLOC(dtd->scaffIndex, @@ -4487,8 +4847,10 @@ doProlog(XML_Parser parser, } else { groupConnector = (char *)MALLOC(groupSize = 32); - if (!groupConnector) + if (!groupConnector) { + groupSize = 0; return XML_ERROR_NO_MEMORY; + } } } groupConnector[prologState.level] = 0; @@ -4871,6 +5233,8 @@ processInternalEntity(XML_Parser parser, ENTITY *entity, openEntity->internalEventEndPtr = NULL; textStart = (char *)entity->textPtr; textEnd = (char *)(entity->textPtr + entity->textLen); + /* Set a safe default value in case 'next' does not get set */ + next = textStart; #ifdef XML_DTD if (entity->is_param) { @@ -4916,6 +5280,8 @@ internalEntityProcessor(XML_Parser parser, entity = openEntity->entity; textStart = ((char *)entity->textPtr) + entity->processed; textEnd = (char *)(entity->textPtr + entity->textLen); + /* Set a safe default value in case 'next' does not get set */ + next = textStart; #ifdef XML_DTD if (entity->is_param) { @@ -5876,7 +6242,6 @@ dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_H newE->defaultAtts = (DEFAULT_ATTRIBUTE *) ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); if (!newE->defaultAtts) { - ms->free_fcn(newE); return 0; } } @@ -6011,13 +6376,32 @@ keyeq(KEY s1, KEY s2) return XML_FALSE; } +static size_t +keylen(KEY s) +{ + size_t len = 0; + for (; *s; s++, len++); + return len; +} + +static void +copy_salt_to_sipkey(XML_Parser parser, struct sipkey * key) +{ + key->k[0] = 0; + key->k[1] = get_hash_secret_salt(parser); +} + static unsigned long FASTCALL hash(XML_Parser parser, KEY s) { - unsigned long h = hash_secret_salt; - while (*s) - h = CHAR_HASH(h, *s++); - return h; + struct siphash state; + struct sipkey key; + (void)sip_tobin; + (void)sip24_valid; + copy_salt_to_sipkey(parser, &key); + sip24_init(&state, &key); + sip24_update(&state, s, keylen(s) * sizeof(XML_Char)); + return (unsigned long)sip24_final(&state); } static NAMED * @@ -6260,6 +6644,35 @@ poolStoreString(STRING_POOL *pool, const ENCODING *enc, return pool->start; } +static size_t +poolBytesToAllocateFor(int blockSize) +{ + /* Unprotected math would be: + ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char); + ** + ** Detect overflow, avoiding _signed_ overflow undefined behavior + ** For a + b * c we check b * c in isolation first, so that addition of a + ** on top has no chance of making us accept a small non-negative number + */ + const size_t stretch = sizeof(XML_Char); /* can be 4 bytes */ + + if (blockSize <= 0) + return 0; + + if (blockSize > (int)(INT_MAX / stretch)) + return 0; + + { + const int stretchedBlockSize = blockSize * (int)stretch; + const int bytesToAllocate = (int)( + offsetof(BLOCK, s) + (unsigned)stretchedBlockSize); + if (bytesToAllocate < 0) + return 0; + + return (size_t)bytesToAllocate; + } +} + static XML_Bool FASTCALL poolGrow(STRING_POOL *pool) { @@ -6289,14 +6702,17 @@ poolGrow(STRING_POOL *pool) if (pool->blocks && pool->start == pool->blocks->s) { BLOCK *temp; int blockSize = (int)((unsigned)(pool->end - pool->start)*2U); + size_t bytesToAllocate; if (blockSize < 0) return XML_FALSE; + bytesToAllocate = poolBytesToAllocateFor(blockSize); + if (bytesToAllocate == 0) + return XML_FALSE; + temp = (BLOCK *) - pool->mem->realloc_fcn(pool->blocks, - (offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char))); + pool->mem->realloc_fcn(pool->blocks, (unsigned)bytesToAllocate); if (temp == NULL) return XML_FALSE; pool->blocks = temp; @@ -6308,16 +6724,26 @@ poolGrow(STRING_POOL *pool) else { BLOCK *tem; int blockSize = (int)(pool->end - pool->start); + size_t bytesToAllocate; if (blockSize < 0) return XML_FALSE; if (blockSize < INIT_BLOCK_SIZE) blockSize = INIT_BLOCK_SIZE; - else + else { + /* Detect overflow, avoiding _signed_ overflow undefined behavior */ + if ((int)((unsigned)blockSize * 2U) < 0) { + return XML_FALSE; + } blockSize *= 2; - tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char)); + } + + bytesToAllocate = poolBytesToAllocateFor(blockSize); + if (bytesToAllocate == 0) + return XML_FALSE; + + tem = (BLOCK *)pool->mem->malloc_fcn(bytesToAllocate); if (!tem) return XML_FALSE; tem->size = blockSize; @@ -6464,3 +6890,26 @@ getElementType(XML_Parser parser, } return ret; } + +static XML_Char * +copyString(const XML_Char *s, + const XML_Memory_Handling_Suite *memsuite) +{ + int charsRequired = 0; + XML_Char *result; + + /* First determine how long the string is */ + while (s[charsRequired] != 0) { + charsRequired++; + } + /* Include the terminator */ + charsRequired++; + + /* Now allocate space for the copy */ + result = memsuite->malloc_fcn(charsRequired * sizeof(XML_Char)); + if (result == NULL) + return NULL; + /* Copy the original into place */ + memcpy(result, s, charsRequired * sizeof(XML_Char)); + return result; +} diff --git a/src/expat/lib/xmlrole.c b/src/expat/lib/xmlrole.c index fcd0dc6948..a7c5630279 100644 --- a/src/expat/lib/xmlrole.c +++ b/src/expat/lib/xmlrole.c @@ -4,19 +4,13 @@ #include -#ifdef WIN32 +#ifdef _WIN32 #include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" #else #ifdef HAVE_EXPAT_CONFIG_H #include #endif -#endif /* ndef WIN32 */ +#endif /* ndef _WIN32 */ #include "expat_external.h" #include "internal.h" diff --git a/src/expat/lib/xmltok.c b/src/expat/lib/xmltok.c index a29d9e2f8a..cdf0720dd8 100644 --- a/src/expat/lib/xmltok.c +++ b/src/expat/lib/xmltok.c @@ -4,19 +4,13 @@ #include -#ifdef WIN32 +#ifdef _WIN32 #include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" #else #ifdef HAVE_EXPAT_CONFIG_H #include #endif -#endif /* ndef WIN32 */ +#endif /* ndef _WIN32 */ #include "expat_external.h" #include "internal.h" @@ -369,24 +363,24 @@ utf8_toUtf8(const ENCODING *UNUSED_P(enc), const char **fromP, const char *fromLim, char **toP, const char *toLim) { - enum XML_Convert_Result res = XML_CONVERT_COMPLETED; char *to; const char *from; - if (fromLim - *fromP > toLim - *toP) { - /* Avoid copying partial characters. */ - res = XML_CONVERT_OUTPUT_EXHAUSTED; - fromLim = *fromP + (toLim - *toP); - align_limit_to_full_utf8_characters(*fromP, &fromLim); - } + const char *fromLimInitial = fromLim; + + /* Avoid copying partial characters. */ + align_limit_to_full_utf8_characters(*fromP, &fromLim); + for (to = *toP, from = *fromP; (from < fromLim) && (to < toLim); from++, to++) *to = *from; *fromP = from; *toP = to; - if ((to == toLim) && (from < fromLim)) + if (fromLim < fromLimInitial) + return XML_CONVERT_INPUT_INCOMPLETE; + else if ((to == toLim) && (from < fromLim)) return XML_CONVERT_OUTPUT_EXHAUSTED; else - return res; + return XML_CONVERT_COMPLETED; } static enum XML_Convert_Result PTRCALL @@ -402,7 +396,7 @@ utf8_toUtf16(const ENCODING *enc, case BT_LEAD2: if (fromLim - from < 2) { res = XML_CONVERT_INPUT_INCOMPLETE; - break; + goto after; } *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f)); from += 2; @@ -410,7 +404,7 @@ utf8_toUtf16(const ENCODING *enc, case BT_LEAD3: if (fromLim - from < 3) { res = XML_CONVERT_INPUT_INCOMPLETE; - break; + goto after; } *to++ = (unsigned short)(((from[0] & 0xf) << 12) | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f)); @@ -441,6 +435,8 @@ utf8_toUtf16(const ENCODING *enc, break; } } + if (from < fromLim) + res = XML_CONVERT_OUTPUT_EXHAUSTED; after: *fromP = from; *toP = to; diff --git a/src/expat/m4/libtool.m4 b/src/expat/m4/libtool.m4 index da4a4f6c02..ae7c906132 100644 --- a/src/expat/m4/libtool.m4 +++ b/src/expat/m4/libtool.m4 @@ -1417,10 +1417,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - powerpcle-*linux*) + powerpcle-*linux*|powerpc64le-*linux*) LD="${LD-ld} -m elf64lppc" ;; - powerpc-*linux*) + powerpc-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -1708,6 +1708,11 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=8192; ;; + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. @@ -2636,11 +2641,11 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + library_names_spec='$libname$release$versuffix$shared_ext $libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + shrext_cmds='`test .$module = .yes && echo .bundle || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' diff --git a/src/expat/tests/benchmark/benchmark.c b/src/expat/tests/benchmark/benchmark.c index 0f0fd18c1d..efa2858a33 100644 --- a/src/expat/tests/benchmark/benchmark.c +++ b/src/expat/tests/benchmark/benchmark.c @@ -4,10 +4,6 @@ #include #include "expat.h" -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - #ifdef XML_LARGE_SIZE #define XML_FMT_INT_MOD "ll" #else diff --git a/src/expat/tests/benchmark/benchmark.dsw b/src/expat/tests/benchmark/benchmark.dsw deleted file mode 100644 index db8504c0f3..0000000000 --- a/src/expat/tests/benchmark/benchmark.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "benchmark"=.\benchmark.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name expat - End Project Dependency -}}} - -############################################################################### - -Project: "expat"=..\..\lib\expat.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/expat/tests/chardata.h b/src/expat/tests/chardata.h index e8dc4ce22c..0db4b999b5 100644 --- a/src/expat/tests/chardata.h +++ b/src/expat/tests/chardata.h @@ -18,7 +18,7 @@ extern "C" { typedef struct { int count; /* # of chars, < 0 if not set */ - XML_Char data[1024]; + XML_Char data[2048]; } CharData; diff --git a/src/expat/tests/memcheck.c b/src/expat/tests/memcheck.c new file mode 100644 index 0000000000..4a24ddc1e4 --- /dev/null +++ b/src/expat/tests/memcheck.c @@ -0,0 +1,173 @@ +/* Copyright (c) 2017 The Expat Maintainers + * Copying is permitted under the MIT license. See the file COPYING + * for details. + * + * memcheck.c : debug allocators for the Expat test suite + */ + +#include +#include +#include "memcheck.h" + + +/* Structures to keep track of what has been allocated. Speed isn't a + * big issue for the tests this is required for, so we will use a + * doubly-linked list to make deletion easier. + */ + +typedef struct allocation_entry { + struct allocation_entry * next; + struct allocation_entry * prev; + void * allocation; + size_t num_bytes; +} AllocationEntry; + +static AllocationEntry *alloc_head = NULL; +static AllocationEntry *alloc_tail = NULL; + +static AllocationEntry *find_allocation(void *ptr); + + +/* Allocate some memory and keep track of it. */ +void * +tracking_malloc(size_t size) +{ + AllocationEntry *entry = malloc(sizeof(AllocationEntry)); + + if (entry == NULL) { + printf("Allocator failure\n"); + return NULL; + } + entry->num_bytes = size; + entry->allocation = malloc(size); + if (entry->allocation == NULL) { + free(entry); + return NULL; + } + entry->next = NULL; + + /* Add to the list of allocations */ + if (alloc_head == NULL) { + entry->prev = NULL; + alloc_head = alloc_tail = entry; + } else { + entry->prev = alloc_tail; + alloc_tail->next = entry; + alloc_tail = entry; + } + + return entry->allocation; +} + +static AllocationEntry * +find_allocation(void *ptr) +{ + AllocationEntry *entry; + + for (entry = alloc_head; entry != NULL; entry = entry->next) { + if (entry->allocation == ptr) { + return entry; + } + } + return NULL; +} + +/* Free some memory and remove the tracking for it */ +void +tracking_free(void *ptr) +{ + AllocationEntry *entry; + + if (ptr == NULL) { + /* There won't be an entry for this */ + return; + } + + entry = find_allocation(ptr); + if (entry != NULL) { + /* This is the relevant allocation. Unlink it */ + if (entry->prev != NULL) + entry->prev->next = entry->next; + else + alloc_head = entry->next; + if (entry->next != NULL) + entry->next->prev = entry->prev; + else + alloc_tail = entry->next; + free(entry); + } else { + printf("Attempting to free unallocated memory at %p\n", ptr); + } + free(ptr); +} + +/* Reallocate some memory and keep track of it */ +void * +tracking_realloc(void *ptr, size_t size) +{ + AllocationEntry *entry; + + if (ptr == NULL) { + /* By definition, this is equivalent to malloc(size) */ + return tracking_malloc(size); + } + if (size == 0) { + /* By definition, this is equivalent to free(ptr) */ + tracking_free(ptr); + return NULL; + } + + /* Find the allocation entry for this memory */ + entry = find_allocation(ptr); + if (entry == NULL) { + printf("Attempting to realloc unallocated memory at %p\n", ptr); + entry = malloc(sizeof(AllocationEntry)); + if (entry == NULL) { + printf("Reallocator failure\n"); + return NULL; + } + entry->allocation = realloc(ptr, size); + if (entry->allocation == NULL) { + free(entry); + return NULL; + } + + /* Add to the list of allocations */ + entry->next = NULL; + if (alloc_head == NULL) { + entry->prev = NULL; + alloc_head = alloc_tail = entry; + } else { + entry->prev = alloc_tail; + alloc_tail->next = entry; + alloc_tail = entry; + } + } else { + entry->allocation = realloc(ptr, size); + if (entry->allocation == NULL) { + /* Realloc semantics say the original is still allocated */ + entry->allocation = ptr; + return NULL; + } + } + + entry->num_bytes = size; + return entry->allocation; +} + +int +tracking_report(void) +{ + AllocationEntry *entry; + + if (alloc_head == NULL) + return 1; + + /* Otherwise we have allocations that haven't been freed */ + for (entry = alloc_head; entry != NULL; entry = entry->next) + { + printf("Allocated %lu bytes at %p\n", + (long unsigned)entry->num_bytes, entry->allocation); + } + return 0; +} diff --git a/src/expat/tests/memcheck.h b/src/expat/tests/memcheck.h new file mode 100644 index 0000000000..2c92724153 --- /dev/null +++ b/src/expat/tests/memcheck.h @@ -0,0 +1,34 @@ +/* Copyright (c) 2017 The Expat Maintainers + * Copying is permitted under the MIT license. See the file COPYING + * for details. + * + * memcheck.h + * + * Interface to allocation functions that will track what has or has + * not been freed. +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef XML_MEMCHECK_H +#define XML_MEMCHECK_H 1 + +/* Allocation declarations */ + +void *tracking_malloc(size_t size); +void tracking_free(void *ptr); +void *tracking_realloc(void *ptr, size_t size); + +/* End-of-test check to see if unfreed allocations remain. Returns + * TRUE (1) if there is nothing, otherwise prints a report of the + * remaining allocations and returns FALSE (0). + */ +int tracking_report(void); + +#endif /* XML_MEMCHECK_H */ + +#ifdef __cplusplus +} +#endif diff --git a/src/expat/tests/minicheck.c b/src/expat/tests/minicheck.c index 5a1f5ed0e2..a6cae231b7 100644 --- a/src/expat/tests/minicheck.c +++ b/src/expat/tests/minicheck.c @@ -63,16 +63,39 @@ tcase_add_test(TCase *tc, tcase_test_function test) size_t new_size = sizeof(tcase_test_function) * nalloc; tcase_test_function *new_tests = realloc(tc->tests, new_size); assert(new_tests != NULL); - if (new_tests != tc->tests) { - free(tc->tests); - tc->tests = new_tests; - } + tc->tests = new_tests; tc->allocated = nalloc; } tc->tests[tc->ntests] = test; tc->ntests++; } +static void +tcase_free(TCase *tc) +{ + if (! tc) { + return; + } + + free(tc->tests); + free(tc); +} + +static void +suite_free(Suite *suite) +{ + if (! suite) { + return; + } + + while (suite->tests != NULL) { + TCase *next = suite->tests->next_tcase; + tcase_free(suite->tests); + suite->tests = next; + } + free(suite); +} + SRunner * srunner_create(Suite *suite) { @@ -178,6 +201,10 @@ srunner_ntests_failed(SRunner *runner) void srunner_free(SRunner *runner) { - free(runner->suite); + if (! runner) { + return; + } + + suite_free(runner->suite); free(runner); } diff --git a/src/expat/tests/minicheck.h b/src/expat/tests/minicheck.h index 9b06f51a88..3702cf8191 100644 --- a/src/expat/tests/minicheck.h +++ b/src/expat/tests/minicheck.h @@ -26,11 +26,6 @@ extern "C" { #define __func__ __FUNCTION__ #endif -/* ISO C90 does not support '__func__' predefined identifier */ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ < 199901) -# define __func__ "(unknown)" -#endif - #define START_TEST(testname) static void testname(void) { \ _check_set_test_info(__func__, __FILE__, __LINE__); \ { diff --git a/src/expat/tests/runtests.c b/src/expat/tests/runtests.c index c0cdea9975..480167a662 100644 --- a/src/expat/tests/runtests.c +++ b/src/expat/tests/runtests.c @@ -14,18 +14,18 @@ #include #include #include /* ptrdiff_t */ +#include #ifndef __cplusplus # include #endif +#include #include "expat.h" #include "chardata.h" #include "internal.h" /* for UNUSED_P only */ #include "minicheck.h" - -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif +#include "memcheck.h" +#include "siphash.h" #ifdef XML_LARGE_SIZE #define XML_FMT_INT_MOD "ll" @@ -33,7 +33,19 @@ #define XML_FMT_INT_MOD "l" #endif -static XML_Parser parser; + +#if defined(NDEBUG) +# error \ + The test suite relies on assert(...) at the moment. \ + You have NDEBUG defined which removes that code so that failures in the \ + test suite can go unnoticed. \ + \ + While we rely on assert(...), compiling the test suite with NDEBUG \ + defined is not supported. +#endif + + +static XML_Parser parser = NULL; static void @@ -47,8 +59,10 @@ basic_setup(void) static void basic_teardown(void) { - if (parser != NULL) + if (parser != NULL) { XML_ParserFree(parser); + parser = NULL; + } } /* Generate a failure using the parser state to create an error message; @@ -113,6 +127,23 @@ _expect_failure(const char *text, enum XML_Error errorCode, const char *errorMes /* Dummy handlers for when we need to set a handler to tickle a bug, but it doesn't need to do anything. */ +static unsigned long dummy_handler_flags = 0; + +#define DUMMY_START_DOCTYPE_HANDLER_FLAG (1UL << 0) +#define DUMMY_END_DOCTYPE_HANDLER_FLAG (1UL << 1) +#define DUMMY_ENTITY_DECL_HANDLER_FLAG (1UL << 2) +#define DUMMY_NOTATION_DECL_HANDLER_FLAG (1UL << 3) +#define DUMMY_ELEMENT_DECL_HANDLER_FLAG (1UL << 4) +#define DUMMY_ATTLIST_DECL_HANDLER_FLAG (1UL << 5) +#define DUMMY_COMMENT_HANDLER_FLAG (1UL << 6) +#define DUMMY_PI_HANDLER_FLAG (1UL << 7) +#define DUMMY_START_ELEMENT_HANDLER_FLAG (1UL << 8) +#define DUMMY_START_CDATA_HANDLER_FLAG (1UL << 9) +#define DUMMY_END_CDATA_HANDLER_FLAG (1UL << 10) +#define DUMMY_UNPARSED_ENTITY_DECL_HANDLER_FLAG (1UL << 11) +#define DUMMY_START_NS_DECL_HANDLER_FLAG (1UL << 12) +#define DUMMY_END_NS_DECL_HANDLER_FLAG (1UL << 13) + static void XMLCALL dummy_start_doctype_handler(void *UNUSED_P(userData), @@ -120,11 +151,15 @@ dummy_start_doctype_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(sysid), const XML_Char *UNUSED_P(pubid), int UNUSED_P(has_internal_subset)) -{} +{ + dummy_handler_flags |= DUMMY_START_DOCTYPE_HANDLER_FLAG; +} static void XMLCALL dummy_end_doctype_handler(void *UNUSED_P(userData)) -{} +{ + dummy_handler_flags |= DUMMY_END_DOCTYPE_HANDLER_FLAG; +} static void XMLCALL dummy_entity_decl_handler(void *UNUSED_P(userData), @@ -136,7 +171,9 @@ dummy_entity_decl_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(systemId), const XML_Char *UNUSED_P(publicId), const XML_Char *UNUSED_P(notationName)) -{} +{ + dummy_handler_flags |= DUMMY_ENTITY_DECL_HANDLER_FLAG; +} static void XMLCALL dummy_notation_decl_handler(void *UNUSED_P(userData), @@ -144,13 +181,22 @@ dummy_notation_decl_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(base), const XML_Char *UNUSED_P(systemId), const XML_Char *UNUSED_P(publicId)) -{} +{ + dummy_handler_flags |= DUMMY_NOTATION_DECL_HANDLER_FLAG; +} static void XMLCALL dummy_element_decl_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name), - XML_Content *UNUSED_P(model)) -{} + XML_Content *model) +{ + /* The content model must be freed by the handler. Unfortunately + * we cannot pass the parser as the userData because this is used + * with other handlers that require other userData. + */ + XML_FreeContentModel(parser, model); + dummy_handler_flags |= DUMMY_ELEMENT_DECL_HANDLER_FLAG; +} static void XMLCALL dummy_attlist_decl_handler(void *UNUSED_P(userData), @@ -159,21 +205,85 @@ dummy_attlist_decl_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(att_type), const XML_Char *UNUSED_P(dflt), int UNUSED_P(isrequired)) -{} +{ + dummy_handler_flags |= DUMMY_ATTLIST_DECL_HANDLER_FLAG; +} static void XMLCALL dummy_comment_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(data)) -{} +{ + dummy_handler_flags |= DUMMY_COMMENT_HANDLER_FLAG; +} static void XMLCALL dummy_pi_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(target), const XML_Char *UNUSED_P(data)) -{} +{ + dummy_handler_flags |= DUMMY_PI_HANDLER_FLAG; +} static void XMLCALL dummy_start_element(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts)) +{ + dummy_handler_flags |= DUMMY_START_ELEMENT_HANDLER_FLAG; +} + +static void XMLCALL +dummy_end_element(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name)) {} +static void XMLCALL +dummy_start_cdata_handler(void *UNUSED_P(userData)) +{ + dummy_handler_flags |= DUMMY_START_CDATA_HANDLER_FLAG; +} + +static void XMLCALL +dummy_end_cdata_handler(void *UNUSED_P(userData)) +{ + dummy_handler_flags |= DUMMY_END_CDATA_HANDLER_FLAG; +} + +static void XMLCALL +dummy_cdata_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(s), + int UNUSED_P(len)) +{} + +static void XMLCALL +dummy_start_namespace_decl_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(prefix), + const XML_Char *UNUSED_P(uri)) +{ + dummy_handler_flags |= DUMMY_START_NS_DECL_HANDLER_FLAG; +} + +static void XMLCALL +dummy_end_namespace_decl_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(prefix)) +{ + dummy_handler_flags |= DUMMY_END_NS_DECL_HANDLER_FLAG; +} + +/* This handler is obsolete, but while the code exists we should + * ensure that dealing with the handler is covered by tests. + */ +static void XMLCALL +dummy_unparsed_entity_decl_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(entityName), + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId), + const XML_Char *UNUSED_P(notationName)) +{ + dummy_handler_flags |= DUMMY_UNPARSED_ENTITY_DECL_HANDLER_FLAG; +} + +static void XMLCALL +dummy_default_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(s), + int UNUSED_P(len)) +{} /* * Character & encoding tests. @@ -201,6 +311,45 @@ START_TEST(test_u0000_char) } END_TEST +START_TEST(test_siphash_self) +{ + if (! sip24_valid()) + fail("SipHash self-test failed"); +} +END_TEST + +START_TEST(test_siphash_spec) +{ + /* https://131002.net/siphash/siphash.pdf (page 19, "Test values") */ + const char message[] = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09" + "\x0a\x0b\x0c\x0d\x0e"; + const size_t len = sizeof(message) - 1; + const uint64_t expected = _SIP_ULL(0xa129ca61U, 0x49be45e5U); + struct siphash state; + struct sipkey key; + (void)sip_tobin; + + sip_tokey(&key, + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09" + "\x0a\x0b\x0c\x0d\x0e\x0f"); + sip24_init(&state, &key); + + /* Cover spread across calls */ + sip24_update(&state, message, 4); + sip24_update(&state, message + 4, len - 4); + + /* Cover null length */ + sip24_update(&state, message, 0); + + if (sip24_final(&state) != expected) + fail("sip24_final failed spec test\n"); + + /* Cover wrapper */ + if (siphash24(message, len, &key) != expected) + fail("siphash24 failed spec test\n"); +} +END_TEST + START_TEST(test_bom_utf8) { /* This test is really just making sure we don't core on a UTF-8 BOM. */ @@ -417,9 +566,11 @@ START_TEST(test_utf8_auto_align) if (actualMovementInChars != cases[i].expectedMovementInChars) { size_t j = 0; success = false; - printf("[-] UTF-8 case %2lu: Expected movement by %2ld chars" - ", actually moved by %2ld chars: \"", - i + 1, cases[i].expectedMovementInChars, actualMovementInChars); + printf("[-] UTF-8 case %2u: Expected movement by %2d chars" + ", actually moved by %2d chars: \"", + (unsigned)(i + 1), + (int)cases[i].expectedMovementInChars, + (int)actualMovementInChars); for (; j < strlen(cases[i].input); j++) { printf("\\x%02x", (unsigned char)cases[i].input[j]); } @@ -488,6 +639,13 @@ START_TEST(test_latin1_umlauts) run_character_check(text, utf8); XML_ParserReset(parser, NULL); run_attribute_check(text, utf8); + /* Repeat with a default handler */ + XML_ParserReset(parser, NULL); + XML_SetDefaultHandler(parser, dummy_default_handler); + run_character_check(text, utf8); + XML_ParserReset(parser, NULL); + XML_SetDefaultHandler(parser, dummy_default_handler); + run_attribute_check(text, utf8); } END_TEST @@ -671,6 +829,50 @@ START_TEST(test_really_long_lines) } END_TEST +/* Test cdata processing across a buffer boundary */ +START_TEST(test_really_long_encoded_lines) +{ + /* As above, except that we want to provoke an output buffer + * overflow with a non-trivial encoding. For this we need to pass + * the whole cdata in one go, not byte-by-byte. + */ + void *buffer; + const char *text = + "" + "" + /* 64 chars */ + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + /* until we have at least 1024 characters on the line: */ + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" + ""; + int parse_len = strlen(text); + + /* Need a cdata handler to provoke the code path we want to test */ + XML_SetCharacterDataHandler(parser, dummy_cdata_handler); + buffer = XML_GetBuffer(parser, parse_len); + if (buffer == NULL) + fail("Could not allocate parse buffer"); + memcpy(buffer, text, parse_len); + if (XML_ParseBuffer(parser, parse_len, XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + /* * Element event tests. @@ -855,6 +1057,37 @@ START_TEST(test_unknown_encoding_internal_entity) } END_TEST +/* Test unrecognised encoding handler */ +static void dummy_release(void *UNUSED_P(data)) +{ +} + +static int XMLCALL +UnrecognisedEncodingHandler(void *UNUSED_P(data), + const XML_Char *UNUSED_P(encoding), + XML_Encoding *info) +{ + info->data = NULL; + info->convert = NULL; + info->release = dummy_release; + return XML_STATUS_ERROR; +} + +START_TEST(test_unrecognised_encoding_internal_entity) +{ + const char *text = + "\n" + "]>\n" + ""; + + XML_SetUnknownEncodingHandler(parser, + UnrecognisedEncodingHandler, + NULL); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) + fail("Unrecognised encoding not rejected"); +} +END_TEST + /* Regression test for SF bug #620106. */ static int XMLCALL external_entity_loader_set_encoding(XML_Parser parser, @@ -879,16 +1112,17 @@ external_entity_loader_set_encoding(XML_Parser parser, if ( _XML_Parse_SINGLE_BYTES(extparser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) { xml_failure(parser); - return 0; + return XML_STATUS_ERROR; } - return 1; + XML_ParserFree(extparser); + return XML_STATUS_OK; } START_TEST(test_ext_entity_set_encoding) { const char *text = "\n" + " \n" "]>\n" "&en;"; @@ -898,6 +1132,111 @@ START_TEST(test_ext_entity_set_encoding) } END_TEST +/* Test external entities with no handler */ +START_TEST(test_ext_entity_no_handler) +{ + const char *text = + "\n" + "]>\n" + "&en;"; + + XML_SetDefaultHandler(parser, dummy_default_handler); + run_character_check(text, ""); +} +END_TEST + +/* Test UTF-8 BOM is accepted */ +static int XMLCALL +external_entity_loader_set_bom(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ /* This text says it's an unsupported encoding, but it's really + UTF-8, which we tell Expat using XML_SetEncoding(). + */ + const char *text = + "\xEF\xBB\xBF" /* BOM */ + "" + "\xC3\xA9"; + XML_Parser extparser; + + extparser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (extparser == NULL) + fail("Could not create external entity parser."); + if (!XML_SetEncoding(extparser, "utf-8")) + fail("XML_SetEncoding() ignored for external entity"); + if ( _XML_Parse_SINGLE_BYTES(extparser, text, strlen(text), XML_TRUE) + == XML_STATUS_ERROR) { + xml_failure(extparser); + return XML_STATUS_ERROR; + } + + XML_ParserFree(extparser); + return XML_STATUS_OK; +} + +START_TEST(test_ext_entity_set_bom) +{ + const char *text = + "\n" + "]>\n" + "&en;"; + + XML_SetExternalEntityRefHandler(parser, + external_entity_loader_set_bom); + run_character_check(text, "\xC3\xA9"); +} +END_TEST + + +/* Test that bad encodings are faulted */ +static int XMLCALL +external_entity_loader_bad_encoding(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + /* Claim this is an unsupported encoding */ + const char *text = + "" + "u"; + XML_Parser extparser; + + extparser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (extparser == NULL) + fail("Could not create external entity parser."); + if (!XML_SetEncoding(extparser, "unknown")) + fail("XML_SetEncoding unknown encoding failed"); + if (_XML_Parse_SINGLE_BYTES(extparser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + fail("Unsupported encoding not faulted"); + if (XML_GetErrorCode(extparser) != XML_ERROR_UNKNOWN_ENCODING) + xml_failure(extparser); + + XML_ParserFree(extparser); + return XML_STATUS_ERROR; +} + +START_TEST(test_ext_entity_bad_encoding) +{ + const char *text = + "\n" + "]>\n" + "&en;"; + + XML_SetExternalEntityRefHandler(parser, + external_entity_loader_bad_encoding); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + fail("Bad encoding should not have been accepted"); +} +END_TEST + /* Test that no error is reported for unknown entities if we don't read an external subset. This was fixed in Expat 1.95.5. */ @@ -951,9 +1290,10 @@ external_entity_loader(XML_Parser parser, fail("Could not create external entity parser."); if ( _XML_Parse_SINGLE_BYTES(extparser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) { - xml_failure(parser); + xml_failure(extparser); return XML_STATUS_ERROR; } + XML_ParserFree(extparser); return XML_STATUS_OK; } @@ -996,6 +1336,56 @@ START_TEST(test_wfc_undeclared_entity_with_external_subset) { } END_TEST +/* Test that an error is reported if our NotStandalone handler fails */ +static int XMLCALL +reject_not_standalone_handler(void *UNUSED_P(userData)) +{ + return XML_STATUS_ERROR; +} + +START_TEST(test_not_standalone_handler_reject) +{ + const char *text = + "\n" + "\n" + "&entity;"; + char foo_text[] = + ""; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetUserData(parser, foo_text); + XML_SetExternalEntityRefHandler(parser, external_entity_loader); + XML_SetNotStandaloneHandler(parser, reject_not_standalone_handler); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) + fail("NotStandalone handler failed to reject"); +} +END_TEST + +/* Test that no error is reported if our NotStandalone handler succeeds */ +static int XMLCALL +accept_not_standalone_handler(void *UNUSED_P(userData)) +{ + return XML_STATUS_OK; +} + +START_TEST(test_not_standalone_handler_accept) +{ + const char *text = + "\n" + "\n" + "&entity;"; + char foo_text[] = + ""; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetUserData(parser, foo_text); + XML_SetExternalEntityRefHandler(parser, external_entity_loader); + XML_SetNotStandaloneHandler(parser, accept_not_standalone_handler); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + START_TEST(test_wfc_no_recursive_entity_refs) { const char *text = @@ -1010,13 +1400,86 @@ START_TEST(test_wfc_no_recursive_entity_refs) } END_TEST +/* Test incomplete external entities are faulted */ +typedef struct ext_faults +{ + const char *parse_text; + const char *fail_text; + enum XML_Error error; +} ExtFaults; + +static int XMLCALL +external_entity_faulter(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + XML_Parser ext_parser; + ExtFaults *fault = (ExtFaults *)XML_GetUserData(parser); + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + if (_XML_Parse_SINGLE_BYTES(ext_parser, + fault->parse_text, + strlen(fault->parse_text), + XML_TRUE) != XML_STATUS_ERROR) + fail(fault->fail_text); + if (XML_GetErrorCode(ext_parser) != fault->error) + xml_failure(ext_parser); + + XML_ParserFree(ext_parser); + return XML_STATUS_ERROR; +} + +START_TEST(test_ext_entity_invalid_parse) +{ + const char *text = + "\n" + "]>\n" + "&en;"; + const ExtFaults faults[] = { + { + "<", + "Incomplete element declaration not faulted", + XML_ERROR_UNCLOSED_TOKEN + }, + { + "<\xe2\x82", /* First two bytes of a three-byte char */ + "Incomplete character not faulted", + XML_ERROR_PARTIAL_CHAR + }, + { + "\xe2\x82", + "Incomplete character in CDATA not faulted", + XML_ERROR_PARTIAL_CHAR + }, + { NULL, NULL, XML_ERROR_NONE } + }; + const ExtFaults *fault = faults; + + for (; fault->parse_text != NULL; fault++) { + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, external_entity_faulter); + XML_SetUserData(parser, (void *)fault); + expect_failure(text, + XML_ERROR_EXTERNAL_ENTITY_HANDLING, + "Parser did not report external entity error"); + XML_ParserReset(parser, NULL); + } +} +END_TEST + + /* Regression test for SF bug #483514. */ START_TEST(test_dtd_default_handling) { const char *text = "\n" - "\n" + "\n" + "\n" "\n" "\n" "\n" @@ -1024,15 +1487,16 @@ START_TEST(test_dtd_default_handling) "]>"; XML_SetDefaultHandler(parser, accumulate_characters); - XML_SetDoctypeDeclHandler(parser, - dummy_start_doctype_handler, - dummy_end_doctype_handler); + XML_SetStartDoctypeDeclHandler(parser, dummy_start_doctype_handler); + XML_SetEndDoctypeDeclHandler(parser, dummy_end_doctype_handler); XML_SetEntityDeclHandler(parser, dummy_entity_decl_handler); XML_SetNotationDeclHandler(parser, dummy_notation_decl_handler); XML_SetElementDeclHandler(parser, dummy_element_decl_handler); XML_SetAttlistDeclHandler(parser, dummy_attlist_decl_handler); XML_SetProcessingInstructionHandler(parser, dummy_pi_handler); XML_SetCommentHandler(parser, dummy_comment_handler); + XML_SetStartCdataSectionHandler(parser, dummy_start_cdata_handler); + XML_SetEndCdataSectionHandler(parser, dummy_end_cdata_handler); run_character_check(text, "\n\n\n\n\n\n\n"); } END_TEST @@ -1046,7 +1510,7 @@ END_TEST START_TEST(test_empty_ns_without_namespaces) { const char *text = - "\n" + "\n" " \n" ""; @@ -1064,7 +1528,7 @@ START_TEST(test_ns_in_attribute_default_without_namespaces) const char *text = "\n" + " xmlns:e CDATA 'http://example.org/'>\n" " ]>\n" ""; @@ -1146,9 +1610,74 @@ START_TEST(test_suspend_parser_between_char_data_calls) xml_failure(parser); if (XML_GetErrorCode(parser) != XML_ERROR_NONE) xml_failure(parser); + /* Try parsing directly */ + if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) + fail("Attempt to continue parse while suspended not faulted"); + if (XML_GetErrorCode(parser) != XML_ERROR_SUSPENDED) + fail("Suspended parse not faulted with correct error"); } END_TEST + +static XML_Bool abortable = XML_FALSE; + +static void +parser_stop_character_handler(void *UNUSED_P(userData), + const XML_Char *UNUSED_P(s), + int UNUSED_P(len)) +{ + XML_StopParser(parser, resumable); + XML_SetCharacterDataHandler(parser, NULL); + if (!resumable) { + /* Check that aborting an aborted parser is faulted */ + if (XML_StopParser(parser, XML_FALSE) != XML_STATUS_ERROR) + fail("Aborting aborted parser not faulted"); + if (XML_GetErrorCode(parser) != XML_ERROR_FINISHED) + xml_failure(parser); + } else if (abortable) { + /* Check that aborting a suspended parser works */ + if (XML_StopParser(parser, XML_FALSE) == XML_STATUS_ERROR) + xml_failure(parser); + } else { + /* Check that suspending a suspended parser works */ + if (XML_StopParser(parser, XML_TRUE) != XML_STATUS_ERROR) + fail("Suspending suspended parser not faulted"); + if (XML_GetErrorCode(parser) != XML_ERROR_SUSPENDED) + xml_failure(parser); + } +} + +/* Test repeated calls to XML_StopParser are handled correctly */ +START_TEST(test_repeated_stop_parser_between_char_data_calls) +{ + const char *text = long_character_data_text; + + XML_SetCharacterDataHandler(parser, parser_stop_character_handler); + resumable = XML_FALSE; + abortable = XML_FALSE; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + fail("Failed to double-stop parser"); + + XML_ParserReset(parser, NULL); + XML_SetCharacterDataHandler(parser, parser_stop_character_handler); + resumable = XML_TRUE; + abortable = XML_FALSE; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_SUSPENDED) + fail("Failed to double-suspend parser"); + + XML_ParserReset(parser, NULL); + XML_SetCharacterDataHandler(parser, parser_stop_character_handler); + resumable = XML_TRUE; + abortable = XML_TRUE; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + fail("Failed to suspend-abort parser"); +} +END_TEST + + START_TEST(test_good_cdata_ascii) { const char *text = "Hello, world!]]>"; @@ -1158,6 +1687,20 @@ START_TEST(test_good_cdata_ascii) CharData_Init(&storage); XML_SetUserData(parser, &storage); XML_SetCharacterDataHandler(parser, accumulate_characters); + /* Add start and end handlers for coverage */ + XML_SetStartCdataSectionHandler(parser, dummy_start_cdata_handler); + XML_SetEndCdataSectionHandler(parser, dummy_end_cdata_handler); + + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckXMLChars(&storage, expected); + + /* Try again, this time with a default handler */ + XML_ParserReset(parser, NULL); + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + XML_SetCharacterDataHandler(parser, accumulate_characters); + XML_SetDefaultHandler(parser, dummy_default_handler); if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); @@ -1190,6 +1733,115 @@ START_TEST(test_good_cdata_utf16) } END_TEST +/* Test UTF16 conversion of a long cdata string */ + +/* 16 characters: handy macro to reduce visual clutter */ +#define A_TO_P_IN_UTF16 "\0A\0B\0C\0D\0E\0F\0G\0H\0I\0J\0K\0L\0M\0N\0O\0P" + +START_TEST(test_long_cdata_utf16) +{ + /* Test data is: + * + * + */ + const char text[] = + "\0<\0?\0x\0m\0l\0 " + "\0v\0e\0r\0s\0i\0o\0n\0=\0'\0\x31\0.\0\x30\0'\0 " + "\0e\0n\0c\0o\0d\0i\0n\0g\0=\0'\0u\0t\0f\0-\0\x31\0\x36\0'\0?\0>" + "\0<\0a\0>\0<\0!\0[\0C\0D\0A\0T\0A\0[" + /* 64 characters per line */ + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 A_TO_P_IN_UTF16 + A_TO_P_IN_UTF16 + "\0]\0]\0>\0<\0/\0a\0>"; + const char *expected = + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" + "ABCDEFGHIJKLMNOP"; + CharData storage; + void *buffer; + + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + XML_SetCharacterDataHandler(parser, accumulate_characters); + buffer = XML_GetBuffer(parser, sizeof(text) - 1); + if (buffer == NULL) + fail("Could not allocate parse buffer"); + memcpy(buffer, text, sizeof(text) - 1); + if (XML_ParseBuffer(parser, + sizeof(text) - 1, + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckXMLChars(&storage, expected); +} +END_TEST + +/* Test handling of multiple unit UTF-16 characters */ +START_TEST(test_multichar_cdata_utf16) +{ + /* Test data is: + * + * + * + * where {MINIM} is U+1d15e (a minim or half-note) + * UTF-16: 0xd834 0xdd5e + * UTF-8: 0xf0 0x9d 0x85 0x9e + * and {CROTCHET} is U+1d15f (a crotchet or quarter-note) + * UTF-16: 0xd834 0xdd5e + * UTF-8: 0xf0 0x9d 0x85 0x9e + */ + const char text[] = + "\0<\0?\0x\0m\0l\0" + " \0v\0e\0r\0s\0i\0o\0n\0=\0'\0\x31\0.\0\x30\0'\0" + " \0e\0n\0c\0o\0d\0i\0n\0g\0=\0'\0u\0t\0f\0-\0""1\0""6\0'" + "\0?\0>\0\n" + "\0<\0a\0>\0<\0!\0[\0C\0D\0A\0T\0A\0[" + "\xd8\x34\xdd\x5e\xd8\x34\xdd\x5f" + "\0]\0]\0>\0<\0/\0a\0>"; + const char *expected = "\xf0\x9d\x85\x9e\xf0\x9d\x85\x9f"; + CharData storage; + + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + XML_SetCharacterDataHandler(parser, accumulate_characters); + + if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckXMLChars(&storage, expected); +} +END_TEST + + START_TEST(test_bad_cdata) { struct CaseData { @@ -1244,6 +1896,1689 @@ START_TEST(test_bad_cdata) } END_TEST +/* Test failures in UTF-16 CDATA */ +START_TEST(test_bad_cdata_utf16) +{ + struct CaseData { + size_t text_bytes; + const char *text; + enum XML_Error expected_error; + }; + + const char prolog[] = + "\0<\0?\0x\0m\0l\0" + " \0v\0e\0r\0s\0i\0o\0n\0=\0'\0\x31\0.\0\x30\0'\0" + " \0e\0n\0c\0o\0d\0i\0n\0g\0=\0'\0u\0t\0f\0-\0""1\0""6\0'" + "\0?\0>\0\n" + "\0<\0a\0>"; + struct CaseData cases[] = { + {1, "\0", XML_ERROR_UNCLOSED_TOKEN}, + {2, "\0<", XML_ERROR_UNCLOSED_TOKEN}, + {3, "\0<\0", XML_ERROR_UNCLOSED_TOKEN}, + {4, "\0<\0!", XML_ERROR_UNCLOSED_TOKEN}, + {5, "\0<\0!\0", XML_ERROR_UNCLOSED_TOKEN}, + {6, "\0<\0!\0[", XML_ERROR_UNCLOSED_TOKEN}, + {7, "\0<\0!\0[\0", XML_ERROR_UNCLOSED_TOKEN}, + {8, "\0<\0!\0[\0C", XML_ERROR_UNCLOSED_TOKEN}, + {9, "\0<\0!\0[\0C\0", XML_ERROR_UNCLOSED_TOKEN}, + {10, "\0<\0!\0[\0C\0D", XML_ERROR_UNCLOSED_TOKEN}, + {11, "\0<\0!\0[\0C\0D\0", XML_ERROR_UNCLOSED_TOKEN}, + {12, "\0<\0!\0[\0C\0D\0A", XML_ERROR_UNCLOSED_TOKEN}, + {13, "\0<\0!\0[\0C\0D\0A\0", XML_ERROR_UNCLOSED_TOKEN}, + {14, "\0<\0!\0[\0C\0D\0A\0T", XML_ERROR_UNCLOSED_TOKEN}, + {15, "\0<\0!\0[\0C\0D\0A\0T\0", XML_ERROR_UNCLOSED_TOKEN}, + {16, "\0<\0!\0[\0C\0D\0A\0T\0A", XML_ERROR_UNCLOSED_TOKEN}, + {17, "\0<\0!\0[\0C\0D\0A\0T\0A\0", XML_ERROR_UNCLOSED_TOKEN}, + {18, "\0<\0!\0[\0C\0D\0A\0T\0A\0[", + XML_ERROR_UNCLOSED_CDATA_SECTION}, + {19, "\0<\0!\0[\0C\0D\0A\0T\0A\0[\0", + XML_ERROR_UNCLOSED_CDATA_SECTION}, + {20, "\0<\0!\0[\0C\0D\0A\0T\0A\0[\0Z", + XML_ERROR_UNCLOSED_CDATA_SECTION}, + /* Now add a four-byte UTF-16 character */ + {21, "\0<\0!\0[\0C\0D\0A\0T\0A\0[\0Z\xd8", + XML_ERROR_UNCLOSED_CDATA_SECTION}, + {22, "\0<\0!\0[\0C\0D\0A\0T\0A\0[\0Z\xd8\x34", + XML_ERROR_PARTIAL_CHAR}, + {23, "\0<\0!\0[\0C\0D\0A\0T\0A\0[\0Z\xd8\x34\xdd", + XML_ERROR_PARTIAL_CHAR}, + {24, "\0<\0!\0[\0C\0D\0A\0T\0A\0[\0Z\xd8\x34\xdd\x5e", + XML_ERROR_UNCLOSED_CDATA_SECTION} + }; + size_t i; + + for (i = 0; i < sizeof(cases)/sizeof(struct CaseData); i++) { + enum XML_Status actual_status; + enum XML_Error actual_error; + + if (_XML_Parse_SINGLE_BYTES(parser, prolog, sizeof(prolog)-1, + XML_FALSE) == XML_STATUS_ERROR) + xml_failure(parser); + actual_status = _XML_Parse_SINGLE_BYTES(parser, + cases[i].text, + cases[i].text_bytes, + XML_TRUE); + assert(actual_status == XML_STATUS_ERROR); + actual_error = XML_GetErrorCode(parser); + if (actual_error != cases[i].expected_error) { + char message[1024]; + + sprintf(message, + "Expected error %d (%s), got %d (%s) for case %lu\n", + cases[i].expected_error, + XML_ErrorString(cases[i].expected_error), + actual_error, + XML_ErrorString(actual_error), + i+1); + fail(message); + } + XML_ParserReset(parser, NULL); + } +} +END_TEST + +static const char *long_cdata_text = + ""; + +/* Test stopping the parser in cdata handler */ +START_TEST(test_stop_parser_between_cdata_calls) +{ + const char *text = long_cdata_text; + + XML_SetCharacterDataHandler(parser, + clearing_aborting_character_handler); + resumable = XML_FALSE; + expect_failure(text, XML_ERROR_ABORTED, + "Parse not aborted in CDATA handler"); +} +END_TEST + +/* Test suspending the parser in cdata handler */ +START_TEST(test_suspend_parser_between_cdata_calls) +{ + const char *text = long_cdata_text; + enum XML_Status result; + + XML_SetCharacterDataHandler(parser, + clearing_aborting_character_handler); + resumable = XML_TRUE; + result = _XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE); + if (result != XML_STATUS_SUSPENDED) { + if (result == XML_STATUS_ERROR) + xml_failure(parser); + fail("Parse not suspended in CDATA handler"); + } + if (XML_GetErrorCode(parser) != XML_ERROR_NONE) + xml_failure(parser); +} +END_TEST + +/* Test memory allocation functions */ +START_TEST(test_memory_allocation) +{ + char *buffer = (char *)XML_MemMalloc(parser, 256); + char *p; + + if (buffer == NULL) { + fail("Allocation failed"); + } else { + /* Try writing to memory; some OSes try to cheat! */ + buffer[0] = 'T'; + buffer[1] = 'E'; + buffer[2] = 'S'; + buffer[3] = 'T'; + buffer[4] = '\0'; + if (strcmp(buffer, "TEST") != 0) { + fail("Memory not writable"); + } else { + p = (char *)XML_MemRealloc(parser, buffer, 512); + if (p == NULL) { + fail("Reallocation failed"); + } else { + /* Write again, just to be sure */ + buffer = p; + buffer[0] = 'V'; + if (strcmp(buffer, "VEST") != 0) { + fail("Reallocated memory not writable"); + } + } + } + XML_MemFree(parser, buffer); + } +} +END_TEST + +static void XMLCALL +record_default_handler(void *userData, + const XML_Char *UNUSED_P(s), + int UNUSED_P(len)) +{ + CharData_AppendString((CharData *)userData, "D"); +} + +static void XMLCALL +record_cdata_handler(void *userData, + const XML_Char *UNUSED_P(s), + int UNUSED_P(len)) +{ + CharData_AppendString((CharData *)userData, "C"); + XML_DefaultCurrent(parser); +} + +static void XMLCALL +record_cdata_nodefault_handler(void *userData, + const XML_Char *UNUSED_P(s), + int UNUSED_P(len)) +{ + CharData_AppendString((CharData *)userData, "c"); +} + +static void XMLCALL +record_skip_handler(void *userData, + const XML_Char *UNUSED_P(entityName), + int is_parameter_entity) +{ + CharData_AppendString((CharData *)userData, + is_parameter_entity ? "E" : "e"); +} + +/* Test XML_DefaultCurrent() passes handling on correctly */ +START_TEST(test_default_current) +{ + const char *text = "hell]"; + const char *entity_text = + "\n" + "]>\n" + "&entity;"; + CharData storage; + + XML_SetDefaultHandler(parser, record_default_handler); + XML_SetCharacterDataHandler(parser, record_cdata_handler); + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckString(&storage, "DCDCDCDCDCDD"); + + /* Again, without the defaulting */ + XML_ParserReset(parser, NULL); + XML_SetDefaultHandler(parser, record_default_handler); + XML_SetCharacterDataHandler(parser, record_cdata_nodefault_handler); + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckString(&storage, "DcccccD"); + + /* Now with an internal entity to complicate matters */ + XML_ParserReset(parser, NULL); + XML_SetDefaultHandler(parser, record_default_handler); + XML_SetCharacterDataHandler(parser, record_cdata_handler); + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + if (_XML_Parse_SINGLE_BYTES(parser, entity_text, strlen(entity_text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + /* The default handler suppresses the entity */ + CharData_CheckString(&storage, "DDDDDDDDDDDDDDDDDDD"); + + /* Again, with a skip handler */ + XML_ParserReset(parser, NULL); + XML_SetDefaultHandler(parser, record_default_handler); + XML_SetCharacterDataHandler(parser, record_cdata_handler); + XML_SetSkippedEntityHandler(parser, record_skip_handler); + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + if (_XML_Parse_SINGLE_BYTES(parser, entity_text, strlen(entity_text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + /* The default handler suppresses the entity */ + CharData_CheckString(&storage, "DDDDDDDDDDDDDDDDDeD"); + + /* This time, allow the entity through */ + XML_ParserReset(parser, NULL); + XML_SetDefaultHandlerExpand(parser, record_default_handler); + XML_SetCharacterDataHandler(parser, record_cdata_handler); + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + if (_XML_Parse_SINGLE_BYTES(parser, entity_text, strlen(entity_text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckString(&storage, "DDDDDDDDDDDDDDDDDCDD"); + + /* Finally, without passing the cdata to the default handler */ + XML_ParserReset(parser, NULL); + XML_SetDefaultHandlerExpand(parser, record_default_handler); + XML_SetCharacterDataHandler(parser, record_cdata_nodefault_handler); + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + if (_XML_Parse_SINGLE_BYTES(parser, entity_text, strlen(entity_text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckString(&storage, "DDDDDDDDDDDDDDDDDcD"); +} +END_TEST + +/* Test DTD element parsing code paths */ +START_TEST(test_dtd_elements) +{ + const char *text = + "\n" + "\n" + "]>\n" + "Wombats are go"; + + XML_SetElementDeclHandler(parser, dummy_element_decl_handler); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test foreign DTD handling */ +START_TEST(test_set_foreign_dtd) +{ + const char *text1 = + "\n"; + const char *text2 = + "&entity;"; + char dtd_text[] = ""; + + /* Check hash salt is passed through too */ + XML_SetHashSalt(parser, 0x12345678); + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetUserData(parser, dtd_text); + XML_SetExternalEntityRefHandler(parser, external_entity_loader); + /* Add a default handler to exercise more code paths */ + XML_SetDefaultHandler(parser, dummy_default_handler); + if (XML_UseForeignDTD(parser, XML_TRUE) != XML_ERROR_NONE) + fail("Could not set foreign DTD"); + if (_XML_Parse_SINGLE_BYTES(parser, text1, strlen(text1), + XML_FALSE) == XML_STATUS_ERROR) + xml_failure(parser); + + /* Ensure that trying to set the DTD after parsing has started + * is faulted, even if it's the same setting. + */ + if (XML_UseForeignDTD(parser, XML_TRUE) != + XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING) + fail("Failed to reject late foreign DTD setting"); + /* Ditto for the hash salt */ + if (XML_SetHashSalt(parser, 0x23456789)) + fail("Failed to reject late hash salt change"); + + /* Now finish the parse */ + if (_XML_Parse_SINGLE_BYTES(parser, text2, strlen(text2), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test XML Base is set and unset appropriately */ +START_TEST(test_set_base) +{ + const XML_Char *old_base; + const XML_Char *new_base = "/local/file/name.xml"; + + old_base = XML_GetBase(parser); + if (XML_SetBase(parser, new_base) != XML_STATUS_OK) + fail("Unable to set base"); + if (strcmp(XML_GetBase(parser), new_base) != 0) + fail("Base setting not correct"); + if (XML_SetBase(parser, NULL) != XML_STATUS_OK) + fail("Unable to NULL base"); + if (XML_GetBase(parser) != NULL) + fail("Base setting not nulled"); + XML_SetBase(parser, old_base); +} +END_TEST + +/* Test attribute counts, indexing, etc */ +typedef struct attrInfo { + const char *name; + const char *value; +} AttrInfo; + +typedef struct elementInfo { + const char *name; + int attr_count; + const char *id_name; + AttrInfo *attributes; +} ElementInfo; + +static void XMLCALL +counting_start_element_handler(void *userData, + const XML_Char *name, + const XML_Char **atts) +{ + ElementInfo *info = (ElementInfo *)userData; + AttrInfo *attr; + int count, id, i; + + while (info->name != NULL) { + if (!strcmp(name, info->name)) + break; + info++; + } + if (info->name == NULL) + fail("Element not recognised"); + /* The attribute count is twice what you might expect. It is a + * count of items in atts, an array which contains alternating + * attribute names and attribute values. For the naive user this + * is possibly a little unexpected, but it is what the + * documentation in expat.h tells us to expect. + */ + count = XML_GetSpecifiedAttributeCount(parser); + if (info->attr_count * 2 != count) { + fail("Not got expected attribute count"); + return; + } + id = XML_GetIdAttributeIndex(parser); + if (id == -1 && info->id_name != NULL) { + fail("ID not present"); + return; + } + if (id != -1 && strcmp(atts[id], info->id_name)) { + fail("ID does not have the correct name"); + return; + } + for (i = 0; i < info->attr_count; i++) { + attr = info->attributes; + while (attr->name != NULL) { + if (!strcmp(atts[0], attr->name)) + break; + attr++; + } + if (attr->name == NULL) { + fail("Attribute not recognised"); + return; + } + if (strcmp(atts[1], attr->value)) { + fail("Attribute has wrong value"); + return; + } + /* Remember, two entries in atts per attribute (see above) */ + atts += 2; + } +} + +START_TEST(test_attributes) +{ + const char *text = + "\n" + "\n" + "]>" + "" + "" + ""; + AttrInfo doc_info[] = { + { "a", "1" }, + { "b", "2" }, + { "id", "one" }, + { NULL, NULL } + }; + AttrInfo tag_info[] = { + { "c", "3" }, + { NULL, NULL } + }; + ElementInfo info[] = { + { "doc", 3, "id", NULL }, + { "tag", 1, NULL, NULL }, + { NULL, 0, NULL, NULL } + }; + info[0].attributes = doc_info; + info[1].attributes = tag_info; + + XML_SetStartElementHandler(parser, counting_start_element_handler); + XML_SetUserData(parser, info); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test reset works correctly in the middle of processing an internal + * entity. Exercises some obscure code in XML_ParserReset(). + */ +START_TEST(test_reset_in_entity) +{ + const char *text = + "\n" + "\n" + "]>\n" + "&entity;"; + XML_ParsingStatus status; + + resumable = XML_TRUE; + XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR) + xml_failure(parser); + XML_GetParsingStatus(parser, &status); + if (status.parsing != XML_SUSPENDED) + fail("Parsing status not SUSPENDED"); + XML_ParserReset(parser, NULL); + XML_GetParsingStatus(parser, &status); + if (status.parsing != XML_INITIALIZED) + fail("Parsing status doesn't reset to INITIALIZED"); +} +END_TEST + +/* Test that resume correctly passes through parse errors */ +START_TEST(test_resume_invalid_parse) +{ + const char *text = "Hello\n" + "\n" + "&entity;"; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, external_entity_resetter); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + + +/* Test suspending a subordinate parser */ + +static void XMLCALL +entity_suspending_decl_handler(void *userData, + const XML_Char *UNUSED_P(name), + XML_Content *model) +{ + XML_Parser ext_parser = (XML_Parser)userData; + + if (XML_StopParser(ext_parser, XML_TRUE) != XML_STATUS_ERROR) + fail("Attempting to suspend a subordinate parser not faulted"); + if (XML_GetErrorCode(ext_parser) != XML_ERROR_SUSPEND_PE) + fail("Suspending subordinate parser get wrong code"); + XML_SetElementDeclHandler(ext_parser, NULL); + XML_FreeContentModel(parser, model); +} + +static int XMLCALL +external_entity_suspender(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + const char *text = ""; + XML_Parser ext_parser; + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + XML_SetElementDeclHandler(ext_parser, entity_suspending_decl_handler); + XML_SetUserData(ext_parser, ext_parser); + if (_XML_Parse_SINGLE_BYTES(ext_parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) { + xml_failure(ext_parser); + return XML_STATUS_ERROR; + } + XML_ParserFree(ext_parser); + return XML_STATUS_OK; +} + +START_TEST(test_subordinate_suspend) +{ + const char *text = + "\n" + "\n" + "&entity;"; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, external_entity_suspender); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test suspending a subordinate parser from an XML declaration */ +/* Increases code coverage of the tests */ +static void XMLCALL +entity_suspending_xdecl_handler(void *userData, + const XML_Char *UNUSED_P(version), + const XML_Char *UNUSED_P(encoding), + int UNUSED_P(standalone)) +{ + XML_Parser ext_parser = (XML_Parser)userData; + + XML_StopParser(ext_parser, resumable); + XML_SetXmlDeclHandler(ext_parser, NULL); +} + +static int XMLCALL +external_entity_suspend_xmldecl(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + const char *text = ""; + XML_Parser ext_parser; + XML_ParsingStatus status; + enum XML_Status rc; + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + XML_SetXmlDeclHandler(ext_parser, entity_suspending_xdecl_handler); + XML_SetUserData(ext_parser, ext_parser); + rc = _XML_Parse_SINGLE_BYTES(ext_parser, text, strlen(text), XML_TRUE); + XML_GetParsingStatus(ext_parser, &status); + if (resumable) { + if (rc == XML_STATUS_ERROR) + xml_failure(ext_parser); + if (status.parsing != XML_SUSPENDED) + fail("Ext Parsing status not SUSPENDED"); + } else { + if (rc != XML_STATUS_ERROR) + fail("Ext parsing not aborted"); + if (XML_GetErrorCode(ext_parser) != XML_ERROR_ABORTED) + xml_failure(ext_parser); + if (status.parsing != XML_FINISHED) + fail("Ext Parsing status not FINISHED"); + } + + XML_ParserFree(ext_parser); + return XML_STATUS_OK; +} + +START_TEST(test_subordinate_xdecl_suspend) +{ + const char *text = + "\n" + "]>\n" + "&entity;"; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, + external_entity_suspend_xmldecl); + resumable = XML_TRUE; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +START_TEST(test_subordinate_xdecl_abort) +{ + const char *text = + "\n" + "]>\n" + "&entity;"; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, + external_entity_suspend_xmldecl); + resumable = XML_FALSE; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test external entity fault handling with suspension */ +static int XMLCALL +external_entity_suspending_faulter(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + XML_Parser ext_parser; + ExtFaults *fault = (ExtFaults *)XML_GetUserData(parser); + void *buffer; + int parse_len = strlen(fault->parse_text); + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + XML_SetXmlDeclHandler(ext_parser, entity_suspending_xdecl_handler); + XML_SetUserData(ext_parser, ext_parser); + resumable = XML_TRUE; + buffer = XML_GetBuffer(ext_parser, parse_len); + if (buffer == NULL) + fail("Could not allocate parse buffer"); + memcpy(buffer, fault->parse_text, parse_len); + if (XML_ParseBuffer(ext_parser, parse_len, + XML_FALSE) != XML_STATUS_SUSPENDED) + fail("XML declaration did not suspend"); + if (XML_ResumeParser(ext_parser) != XML_STATUS_OK) + xml_failure(ext_parser); + if (XML_ParseBuffer(ext_parser, 0, XML_TRUE) != XML_STATUS_ERROR) + fail(fault->fail_text); + if (XML_GetErrorCode(ext_parser) != fault->error) + xml_failure(ext_parser); + + XML_ParserFree(ext_parser); + return XML_STATUS_ERROR; +} + +START_TEST(test_ext_entity_invalid_suspended_parse) +{ + const char *text = + "\n" + "]>\n" + "&en;"; + ExtFaults faults[] = { + { + "<", + "Incomplete element declaration not faulted", + XML_ERROR_UNCLOSED_TOKEN + }, + { + /* First two bytes of a three-byte char */ + "\xe2\x82", + "Incomplete character not faulted", + XML_ERROR_PARTIAL_CHAR + }, + { NULL, NULL, XML_ERROR_NONE } + }; + ExtFaults *fault; + + for (fault = &faults[0]; fault->parse_text != NULL; fault++) { + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, + external_entity_suspending_faulter); + XML_SetUserData(parser, fault); + expect_failure(text, + XML_ERROR_EXTERNAL_ENTITY_HANDLING, + "Parser did not report external entity error"); + XML_ParserReset(parser, NULL); + } +} +END_TEST + + + +/* Test setting an explicit encoding */ +START_TEST(test_explicit_encoding) +{ + const char *text1 = "Hello "; + const char *text2 = " World"; + + /* Just check that we can set the encoding to NULL before starting */ + if (XML_SetEncoding(parser, NULL) != XML_STATUS_OK) + fail("Failed to initialise encoding to NULL"); + /* Say we are UTF-8 */ + if (XML_SetEncoding(parser, "utf-8") != XML_STATUS_OK) + fail("Failed to set explicit encoding"); + if (_XML_Parse_SINGLE_BYTES(parser, text1, strlen(text1), + XML_FALSE) == XML_STATUS_ERROR) + xml_failure(parser); + /* Try to switch encodings mid-parse */ + if (XML_SetEncoding(parser, "us-ascii") != XML_STATUS_ERROR) + fail("Allowed encoding change"); + if (_XML_Parse_SINGLE_BYTES(parser, text2, strlen(text2), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + /* Try now the parse is over */ + if (XML_SetEncoding(parser, NULL) != XML_STATUS_OK) + fail("Failed to unset encoding"); +} +END_TEST + +/* Test handling of trailing CR (rather than newline) */ +static void XMLCALL +cr_cdata_handler(void *userData, const XML_Char *s, int len) +{ + int *pfound = (int *)userData; + + /* Internal processing turns the CR into a newline for the + * character data handler, but not for the default handler + */ + if (len == 1 && (*s == '\n' || *s == '\r')) + *pfound = 1; +} + +START_TEST(test_trailing_cr) +{ + const char *text = "\r"; + int found_cr; + + /* Try with a character handler, for code coverage */ + XML_SetCharacterDataHandler(parser, cr_cdata_handler); + XML_SetUserData(parser, &found_cr); + found_cr = 0; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_OK) + fail("Failed to fault unclosed doc"); + if (found_cr == 0) + fail("Did not catch the carriage return"); + XML_ParserReset(parser, NULL); + + /* Now with a default handler instead */ + XML_SetDefaultHandler(parser, cr_cdata_handler); + XML_SetUserData(parser, &found_cr); + found_cr = 0; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_OK) + fail("Failed to fault unclosed doc"); + if (found_cr == 0) + fail("Did not catch default carriage return"); +} +END_TEST + +/* Test trailing CR in an external entity parse */ +static int XMLCALL +external_entity_cr_catcher(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + const char *text = "\r"; + XML_Parser ext_parser; + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + XML_SetCharacterDataHandler(ext_parser, cr_cdata_handler); + if (_XML_Parse_SINGLE_BYTES(ext_parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(ext_parser); + XML_ParserFree(ext_parser); + return XML_STATUS_OK; +} + +static int XMLCALL +external_entity_bad_cr_catcher(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + const char *text = "\r"; + XML_Parser ext_parser; + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + XML_SetCharacterDataHandler(ext_parser, cr_cdata_handler); + if (_XML_Parse_SINGLE_BYTES(ext_parser, text, strlen(text), + XML_TRUE) == XML_STATUS_OK) + fail("Async entity error not caught"); + if (XML_GetErrorCode(ext_parser) != XML_ERROR_ASYNC_ENTITY) + xml_failure(ext_parser); + XML_ParserFree(ext_parser); + return XML_STATUS_OK; +} + +START_TEST(test_ext_entity_trailing_cr) +{ + const char *text = + "\n" + "]>\n" + "&en;"; + int found_cr; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, external_entity_cr_catcher); + XML_SetUserData(parser, &found_cr); + found_cr = 0; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_OK) + xml_failure(parser); + if (found_cr == 0) + fail("No carriage return found"); + XML_ParserReset(parser, NULL); + + /* Try again with a different trailing CR */ + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, external_entity_bad_cr_catcher); + XML_SetUserData(parser, &found_cr); + found_cr = 0; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_OK) + xml_failure(parser); + if (found_cr == 0) + fail("No carriage return found"); +} +END_TEST + +/* Test handling of trailing square bracket */ +static void XMLCALL +rsqb_handler(void *userData, const XML_Char *s, int len) +{ + int *pfound = (int *)userData; + + if (len == 1 && *s == ']') + *pfound = 1; +} + +START_TEST(test_trailing_rsqb) +{ + const char *text8 = "]"; + const char text16[] = "\xFF\xFE<\000d\000o\000c\000>\000]\000"; + int found_rsqb; + int text8_len = strlen(text8); + + XML_SetCharacterDataHandler(parser, rsqb_handler); + XML_SetUserData(parser, &found_rsqb); + found_rsqb = 0; + if (_XML_Parse_SINGLE_BYTES(parser, text8, text8_len, + XML_TRUE) == XML_STATUS_OK) + fail("Failed to fault unclosed doc"); + if (found_rsqb == 0) + fail("Did not catch the right square bracket"); + + /* Try again with a different encoding */ + XML_ParserReset(parser, NULL); + XML_SetCharacterDataHandler(parser, rsqb_handler); + XML_SetUserData(parser, &found_rsqb); + found_rsqb = 0; + if (_XML_Parse_SINGLE_BYTES(parser, text16, sizeof(text16)-1, + XML_TRUE) == XML_STATUS_OK) + fail("Failed to fault unclosed doc"); + if (found_rsqb == 0) + fail("Did not catch the right square bracket"); + + /* And finally with a default handler */ + XML_ParserReset(parser, NULL); + XML_SetDefaultHandler(parser, rsqb_handler); + XML_SetUserData(parser, &found_rsqb); + found_rsqb = 0; + if (_XML_Parse_SINGLE_BYTES(parser, text16, sizeof(text16)-1, + XML_TRUE) == XML_STATUS_OK) + fail("Failed to fault unclosed doc"); + if (found_rsqb == 0) + fail("Did not catch the right square bracket"); +} +END_TEST + +/* Test trailing right square bracket in an external entity parse */ +static int XMLCALL +external_entity_rsqb_catcher(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + const char *text = "]"; + XML_Parser ext_parser; + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + XML_SetCharacterDataHandler(ext_parser, rsqb_handler); + if (_XML_Parse_SINGLE_BYTES(ext_parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + fail("Async entity error not caught"); + if (XML_GetErrorCode(ext_parser) != XML_ERROR_ASYNC_ENTITY) + xml_failure(ext_parser); + XML_ParserFree(ext_parser); + return XML_STATUS_OK; +} + +START_TEST(test_ext_entity_trailing_rsqb) +{ + const char *text = + "\n" + "]>\n" + "&en;"; + int found_rsqb; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, external_entity_rsqb_catcher); + XML_SetUserData(parser, &found_rsqb); + found_rsqb = 0; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_OK) + xml_failure(parser); + if (found_rsqb == 0) + fail("No right square bracket found"); +} +END_TEST + +/* Test CDATA handling in an external entity */ +static int XMLCALL +external_entity_good_cdata_ascii(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + const char *text = + "Hello, world!]]>"; + const char *expected = "Hello, world!"; + CharData storage; + XML_Parser ext_parser; + + CharData_Init(&storage); + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + XML_SetUserData(ext_parser, &storage); + XML_SetCharacterDataHandler(ext_parser, accumulate_characters); + + if (_XML_Parse_SINGLE_BYTES(ext_parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(ext_parser); + CharData_CheckXMLChars(&storage, expected); + + XML_ParserFree(ext_parser); + return XML_STATUS_OK; +} + +START_TEST(test_ext_entity_good_cdata) +{ + const char *text = + "\n" + "]>\n" + "&en;"; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, + external_entity_good_cdata_ascii); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_OK) + xml_failure(parser); +} +END_TEST + +/* Test user parameter settings */ +/* Variable holding the expected handler userData */ +static void *handler_data = NULL; +/* Count of the number of times the comment handler has been invoked */ +static int comment_count = 0; +/* Count of the number of skipped entities */ +static int skip_count = 0; +/* Count of the number of times the XML declaration handler is invoked */ +static int xdecl_count = 0; + +static void XMLCALL +xml_decl_handler(void *userData, + const XML_Char *UNUSED_P(version), + const XML_Char *UNUSED_P(encoding), + int standalone) +{ + if (userData != handler_data) + fail("User data (xml decl) not correctly set"); + if (standalone != -1) + fail("Standalone not flagged as not present in XML decl"); + xdecl_count++; +} + +static void XMLCALL +param_check_skip_handler(void *userData, + const XML_Char *UNUSED_P(entityName), + int UNUSED_P(is_parameter_entity)) +{ + if (userData != handler_data) + fail("User data (skip) not correctly set"); + skip_count++; +} + +static void XMLCALL +data_check_comment_handler(void *userData, const XML_Char *UNUSED_P(data)) +{ + /* Check that the userData passed through is what we expect */ + if (userData != handler_data) + fail("User data (parser) not correctly set"); + /* Check that the user data in the parser is appropriate */ + if (XML_GetUserData(userData) != (void *)1) + fail("User data in parser not correctly set"); + comment_count++; +} + +static int XMLCALL +external_entity_param_checker(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + const char *text = + "\n" + ""; + XML_Parser ext_parser; + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + handler_data = ext_parser; + if (_XML_Parse_SINGLE_BYTES(ext_parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) { + xml_failure(parser); + return XML_STATUS_ERROR; + } + handler_data = parser; + XML_ParserFree(ext_parser); + return XML_STATUS_OK; +} + +START_TEST(test_user_parameters) +{ + const char *text = + "\n" + "\n" + "\n" + "&entity;"; + const char *epilog = + "\n" + ""; + + comment_count = 0; + skip_count = 0; + xdecl_count = 0; + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetXmlDeclHandler(parser, xml_decl_handler); + XML_SetExternalEntityRefHandler(parser, external_entity_param_checker); + XML_SetCommentHandler(parser, data_check_comment_handler); + XML_SetSkippedEntityHandler(parser, param_check_skip_handler); + XML_UseParserAsHandlerArg(parser); + XML_SetUserData(parser, (void *)1); + handler_data = parser; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_FALSE) == XML_STATUS_ERROR) + xml_failure(parser); + if (comment_count != 2) + fail("Comment handler not invoked enough times"); + /* Ensure we can't change policy mid-parse */ + if (XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_NEVER)) + fail("Changed param entity parsing policy while parsing"); + if (_XML_Parse_SINGLE_BYTES(parser, epilog, strlen(epilog), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + if (comment_count != 3) + fail("Comment handler not invoked enough times"); + if (skip_count != 1) + fail("Skip handler not invoked enough times"); + if (xdecl_count != 1) + fail("XML declaration handler not invoked"); +} +END_TEST + +/* Test that an explicit external entity handler argument replaces + * the parser as the first argument. + * + * We do not call the first parameter to the external entity handler + * 'parser' for once, since the first time the handler is called it + * will actually be a text string. We need to be able to access the + * global 'parser' variable to create our external entity parser from, + * since there are code paths we need to ensure get executed. + */ +static int XMLCALL +external_entity_ref_param_checker(XML_Parser parameter, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + const char *text = ""; + XML_Parser ext_parser; + + if ((void *)parameter != handler_data) + fail("External entity ref handler parameter not correct"); + + /* Here we use the global 'parser' variable */ + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + if (_XML_Parse_SINGLE_BYTES(ext_parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(ext_parser); + + XML_ParserFree(ext_parser); + return XML_STATUS_OK; +} + +START_TEST(test_ext_entity_ref_parameter) +{ + const char *text = + "\n" + "\n" + "&entity;"; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, + external_entity_ref_param_checker); + /* Set a handler arg that is not NULL and not parser (which is + * what NULL would cause to be passed. + */ + XML_SetExternalEntityRefHandlerArg(parser, (void *)text); + handler_data = (void *)text; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + + /* Now try again with unset args */ + XML_ParserReset(parser, NULL); + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, + external_entity_ref_param_checker); + XML_SetExternalEntityRefHandlerArg(parser, NULL); + handler_data = (void *)parser; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test the parsing of an empty string */ +START_TEST(test_empty_parse) +{ + const char *text = ""; + const char *partial = ""; + + if (XML_Parse(parser, NULL, 0, XML_FALSE) == XML_STATUS_ERROR) + fail("Parsing empty string faulted"); + if (XML_Parse(parser, NULL, 0, XML_TRUE) != XML_STATUS_ERROR) + fail("Parsing final empty string not faulted"); + if (XML_GetErrorCode(parser) != XML_ERROR_NO_ELEMENTS) + fail("Parsing final empty string faulted for wrong reason"); + + /* Now try with valid text before the empty end */ + XML_ParserReset(parser, NULL); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_FALSE) == XML_STATUS_ERROR) + xml_failure(parser); + if (XML_Parse(parser, NULL, 0, XML_TRUE) == XML_STATUS_ERROR) + fail("Parsing final empty string faulted"); + + /* Now try with invalid text before the empty end */ + XML_ParserReset(parser, NULL); + if (_XML_Parse_SINGLE_BYTES(parser, partial, strlen(partial), + XML_FALSE) == XML_STATUS_ERROR) + xml_failure(parser); + if (XML_Parse(parser, NULL, 0, XML_TRUE) != XML_STATUS_ERROR) + fail("Parsing final incomplete empty string not faulted"); +} +END_TEST + +/* Test odd corners of the XML_GetBuffer interface */ +static enum XML_Status +get_feature(enum XML_FeatureEnum feature_id, long *presult) +{ + const XML_Feature *feature = XML_GetFeatureList(); + + if (feature == NULL) + return XML_STATUS_ERROR; + for (; feature->feature != XML_FEATURE_END; feature++) { + if (feature->feature == feature_id) { + *presult = feature->value; + return XML_STATUS_OK; + } + } + return XML_STATUS_ERROR; +} + +/* Having an element name longer than 1024 characters exercises some + * of the pool allocation code in the parser that otherwise does not + * get executed. The count at the end of the line is the number of + * characters (bytes) in the element name by that point.x + */ +static const char *get_buffer_test_text = + "\n" is not one of them, so the parser should raise an + * error on encountering it. + */ +static int XMLCALL +external_entity_param(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *systemId, + const XML_Char *UNUSED_P(publicId)) +{ + const char *text1 = + "\n" + "\n" + "\n" + "%e1;\n"; + const char *text2 = + "\n" + "\n"; + XML_Parser ext_parser; + + if (systemId == NULL) + return XML_STATUS_OK; + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + + if (!strcmp(systemId, "004-1.ent")) { + if (_XML_Parse_SINGLE_BYTES(ext_parser, text1, strlen(text1), + XML_TRUE) != XML_STATUS_ERROR) + fail("Inner DTD with invalid tag not rejected"); + if (XML_GetErrorCode(ext_parser) != XML_ERROR_EXTERNAL_ENTITY_HANDLING) + xml_failure(ext_parser); + } + else if (!strcmp(systemId, "004-2.ent")) { + if (_XML_Parse_SINGLE_BYTES(ext_parser, text2, strlen(text2), + XML_TRUE) != XML_STATUS_ERROR) + fail("Invalid tag in external param not rejected"); + if (XML_GetErrorCode(ext_parser) != XML_ERROR_SYNTAX) + xml_failure(ext_parser); + } else { + fail("Unknown system ID"); + } + + XML_ParserFree(ext_parser); + return XML_STATUS_ERROR; +} + +START_TEST(test_invalid_tag_in_dtd) +{ + const char *text = + "\n" + "\n"; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, external_entity_param); + expect_failure(text, XML_ERROR_EXTERNAL_ENTITY_HANDLING, + "Invalid tag IN DTD external param not rejected"); +} +END_TEST + +/* Test conditional inclusion (IGNORE) */ +static int XMLCALL +external_entity_load_ignore(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + const char *text = "]]>"; + XML_Parser ext_parser; + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + if (_XML_Parse_SINGLE_BYTES(ext_parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + + XML_ParserFree(ext_parser); + return XML_STATUS_OK; +} + +START_TEST(test_ignore_section) +{ + const char *text = + "\n" + "&entity;"; + const char *expected = + "]]>\n&entity;"; + CharData storage; + + CharData_Init(&storage); + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetUserData(parser, &storage); + XML_SetExternalEntityRefHandler(parser, external_entity_load_ignore); + XML_SetDefaultHandler(parser, accumulate_characters); + XML_SetStartDoctypeDeclHandler(parser, dummy_start_doctype_handler); + XML_SetEndDoctypeDeclHandler(parser, dummy_end_doctype_handler); + XML_SetElementDeclHandler(parser, dummy_element_decl_handler); + XML_SetStartElementHandler(parser, dummy_start_element); + XML_SetEndElementHandler(parser, dummy_end_element); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + CharData_CheckXMLChars(&storage, expected); +} +END_TEST + +/* Test mis-formatted conditional exclusion */ +START_TEST(test_bad_ignore_section) +{ + const char *text = + "\n" + "&entity;"; + ExtFaults faults[] = { + { + "", + "Invalid XML character not faulted", + XML_ERROR_INVALID_TOKEN + }, + { NULL, NULL, XML_ERROR_NONE } + }; + ExtFaults *fault; + + for (fault = &faults[0]; fault->parse_text != NULL; fault++) { + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, external_entity_faulter); + XML_SetUserData(parser, fault); + expect_failure(text, XML_ERROR_EXTERNAL_ENTITY_HANDLING, + "Incomplete IGNORE section not failed"); + XML_ParserReset(parser, NULL); + } +} +END_TEST + /* * Namespaces tests. @@ -1268,6 +3603,9 @@ namespace_teardown(void) provided as the userData argument; the first is the expected element name, and the second is the expected attribute name. */ +static int triplet_start_flag = XML_FALSE; +static int triplet_end_flag = XML_FALSE; + static void XMLCALL triplet_start_checker(void *userData, const XML_Char *name, const XML_Char **atts) @@ -1282,6 +3620,7 @@ triplet_start_checker(void *userData, const XML_Char *name, sprintf(buffer, "unexpected attribute string: '%s'", atts[0]); fail(buffer); } + triplet_start_flag = XML_TRUE; } /* Check that the element name passed to the end-element handler matches @@ -1297,22 +3636,47 @@ triplet_end_checker(void *userData, const XML_Char *name) sprintf(buffer, "unexpected end string: '%s'", name); fail(buffer); } + triplet_end_flag = XML_TRUE; } START_TEST(test_return_ns_triplet) { const char *text = - ""; + ""; + const char *epilog = ""; const char *elemstr[] = { - "http://expat.sf.net/ e foo", - "http://expat.sf.net/ a bar" + "http://example.org/ e foo", + "http://example.org/ a bar" }; XML_SetReturnNSTriplet(parser, XML_TRUE); XML_SetUserData(parser, elemstr); - XML_SetElementHandler(parser, triplet_start_checker, triplet_end_checker); - if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) + XML_SetElementHandler(parser, triplet_start_checker, + triplet_end_checker); + XML_SetNamespaceDeclHandler(parser, + dummy_start_namespace_decl_handler, + dummy_end_namespace_decl_handler); + triplet_start_flag = XML_FALSE; + triplet_end_flag = XML_FALSE; + XML_SetNamespaceDeclHandler(parser, + dummy_start_namespace_decl_handler, + dummy_end_namespace_decl_handler); + dummy_handler_flags = 0; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_FALSE) == XML_STATUS_ERROR) xml_failure(parser); + if (!triplet_start_flag) + fail("triplet_start_checker not invoked"); + /* Check that unsetting "return triplets" fails while still parsing */ + XML_SetReturnNSTriplet(parser, XML_FALSE); + if (_XML_Parse_SINGLE_BYTES(parser, epilog, strlen(epilog), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + if (!triplet_end_flag) + fail("triplet_end_checker not invoked"); + if (dummy_handler_flags != (DUMMY_START_NS_DECL_HANDLER_FLAG | + DUMMY_END_NS_DECL_HANDLER_FLAG)) + fail("Namespace handlers not called"); } END_TEST @@ -1357,19 +3721,19 @@ run_ns_tagname_overwrite_test(const char *text, const char *result) START_TEST(test_ns_tagname_overwrite) { const char *text = - "\n" + "\n" " \n" " \n" ""; const char *result = - "start http://xml.libexpat.org/ e\n" - "start http://xml.libexpat.org/ f\n" - "attribute http://xml.libexpat.org/ attr\n" - "end http://xml.libexpat.org/ f\n" - "start http://xml.libexpat.org/ g\n" - "attribute http://xml.libexpat.org/ attr2\n" - "end http://xml.libexpat.org/ g\n" - "end http://xml.libexpat.org/ e\n"; + "start http://example.org/ e\n" + "start http://example.org/ f\n" + "attribute http://example.org/ attr\n" + "end http://example.org/ f\n" + "start http://example.org/ g\n" + "attribute http://example.org/ attr2\n" + "end http://example.org/ g\n" + "end http://example.org/ e\n"; run_ns_tagname_overwrite_test(text, result); } END_TEST @@ -1378,19 +3742,19 @@ END_TEST START_TEST(test_ns_tagname_overwrite_triplet) { const char *text = - "\n" + "\n" " \n" " \n" ""; const char *result = - "start http://xml.libexpat.org/ e n\n" - "start http://xml.libexpat.org/ f n\n" - "attribute http://xml.libexpat.org/ attr n\n" - "end http://xml.libexpat.org/ f n\n" - "start http://xml.libexpat.org/ g n\n" - "attribute http://xml.libexpat.org/ attr2 n\n" - "end http://xml.libexpat.org/ g n\n" - "end http://xml.libexpat.org/ e n\n"; + "start http://example.org/ e n\n" + "start http://example.org/ f n\n" + "attribute http://example.org/ attr n\n" + "end http://example.org/ f n\n" + "start http://example.org/ g n\n" + "attribute http://example.org/ attr2 n\n" + "end http://example.org/ g n\n" + "end http://example.org/ e n\n"; XML_SetReturnNSTriplet(parser, XML_TRUE); run_ns_tagname_overwrite_test(text, result); } @@ -1420,10 +3784,11 @@ START_TEST(test_start_ns_clears_start_element) syntax doesn't cause the problematic path through Expat to be taken. */ - const char *text = ""; + const char *text = ""; XML_SetStartElementHandler(parser, start_element_fail); XML_SetStartNamespaceDeclHandler(parser, start_ns_clearing_start_element); + XML_SetEndNamespaceDeclHandler(parser, dummy_end_namespace_decl_handler); XML_UseParserAsHandlerArg(parser); if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); @@ -1454,20 +3819,20 @@ external_entity_handler(XML_Parser parser, p2 = XML_ExternalEntityParserCreate(parser, context, NULL); if (_XML_Parse_SINGLE_BYTES(p2, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) { xml_failure(p2); - return 0; + return XML_STATUS_ERROR; } XML_ParserFree(p2); - return 1; + return XML_STATUS_OK; } START_TEST(test_default_ns_from_ext_subset_and_ext_ge) { const char *text = "\n" - "\n" + "\n" "]>\n" - "\n" + "\n" "&en;\n" ""; @@ -1485,7 +3850,7 @@ END_TEST START_TEST(test_ns_prefix_with_empty_uri_1) { const char *text = - "\n" + "\n" " \n" ""; @@ -1533,14 +3898,14 @@ START_TEST(test_ns_prefix_with_empty_uri_4) "\n" " \n" + " xmlns:prefix CDATA 'http://example.org/'>\n" "]>\n" ""; /* Packaged info expected by the end element handler; the weird structuring lets us re-use the triplet_end_checker() function also used for another test. */ const char *elemstr[] = { - "http://xml.libexpat.org/ doc prefix" + "http://example.org/ doc prefix" }; XML_SetReturnNSTriplet(parser, XML_TRUE); XML_SetUserData(parser, elemstr); @@ -1550,12 +3915,36 @@ START_TEST(test_ns_prefix_with_empty_uri_4) } END_TEST +/* Test with non-xmlns prefix */ +START_TEST(test_ns_unbound_prefix) +{ + const char *text = + "\n" + " \n" + "]>\n" + ""; + + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + fail("Unbound prefix incorrectly passed"); + if (XML_GetErrorCode(parser) != XML_ERROR_UNBOUND_PREFIX) + xml_failure(parser); +} +END_TEST + START_TEST(test_ns_default_with_empty_uri) { const char *text = - "\n" + "\n" " \n" ""; + /* Add some handlers to exercise extra code paths */ + XML_SetStartNamespaceDeclHandler(parser, + dummy_start_namespace_decl_handler); + XML_SetEndNamespaceDeclHandler(parser, + dummy_end_namespace_decl_handler); if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) xml_failure(parser); } @@ -1565,8 +3954,8 @@ END_TEST START_TEST(test_ns_duplicate_attrs_diff_prefixes) { const char *text = - ""; expect_failure(text, XML_ERROR_DUPLICATE_ATTRIBUTE, @@ -1574,6 +3963,33 @@ START_TEST(test_ns_duplicate_attrs_diff_prefixes) } END_TEST +START_TEST(test_ns_duplicate_hashes) +{ + /* The hash of an attribute is calculated as the hash of its URI + * concatenated with a space followed by its name (after the + * colon). We wish to generate attributes with the same hash + * value modulo the attribute table size so that we can check that + * the attribute hash table works correctly. The attribute hash + * table size will be the smallest power of two greater than the + * number of attributes, but at least eight. There is + * unfortunately no programmatic way of getting the hash or the + * table size at user level, but the test code coverage percentage + * will drop if the hashes cease to point to the same row. + * + * The cunning plan is to have few enough attributes to have a + * reliable table size of 8, and have the single letter attribute + * names be 8 characters apart, producing a hash which will be the + * same modulo 8. + */ + const char *text = + ""; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + /* Regression test for SF bug #695401: unbound prefix. */ START_TEST(test_ns_unbound_prefix_on_attribute) { @@ -1594,17 +4010,1700 @@ START_TEST(test_ns_unbound_prefix_on_element) } END_TEST +/* Test that the parsing status is correctly reset by XML_ParserReset(). + * We usE test_return_ns_triplet() for our example parse to improve + * coverage of tidying up code executed. + */ +START_TEST(test_ns_parser_reset) +{ + XML_ParsingStatus status; + + XML_GetParsingStatus(parser, &status); + if (status.parsing != XML_INITIALIZED) + fail("parsing status doesn't start INITIALIZED"); + test_return_ns_triplet(); + XML_GetParsingStatus(parser, &status); + if (status.parsing != XML_FINISHED) + fail("parsing status doesn't end FINISHED"); + XML_ParserReset(parser, NULL); + XML_GetParsingStatus(parser, &status); + if (status.parsing != XML_INITIALIZED) + fail("parsing status doesn't reset to INITIALIZED"); +} +END_TEST + +/* Test that long element names with namespaces are handled correctly */ +START_TEST(test_ns_long_element) +{ + const char *text = + "" + ""; + const char *elemstr[] = { + "http://example.org/" + " thisisalongenoughelementnametotriggerareallocation foo", + "http://example.org/ a bar" + }; + + XML_SetReturnNSTriplet(parser, XML_TRUE); + XML_SetUserData(parser, elemstr); + XML_SetElementHandler(parser, + triplet_start_checker, + triplet_end_checker); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test mixed population of prefixed and unprefixed attributes */ +START_TEST(test_ns_mixed_prefix_atts) +{ + const char *text = + "" + ""; + + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test having a long namespaced element name inside a short one. + * This exercises some internal buffer reallocation that is shared + * across elements with the same namespace URI. + */ +START_TEST(test_ns_extend_uri_buffer) +{ + const char *text = + "" + " " + ""; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test that xmlns is correctly rejected as an attribute in the xmlns + * namespace, but not in other namespaces + */ +START_TEST(test_ns_reserved_attributes) +{ + const char *text1 = + ""; + const char *text2 = + ""; + expect_failure(text1, XML_ERROR_RESERVED_PREFIX_XMLNS, + "xmlns not rejected as an attribute"); + XML_ParserReset(parser, NULL); + if (_XML_Parse_SINGLE_BYTES(parser, text2, strlen(text2), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + +/* Test more reserved attributes */ +START_TEST(test_ns_reserved_attributes_2) +{ + const char *text1 = + ""; + const char *text2 = + ""; + const char *text3 = + ""; + + expect_failure(text1, XML_ERROR_RESERVED_PREFIX_XML, + "xml not rejected as an attribute"); + XML_ParserReset(parser, NULL); + expect_failure(text2, XML_ERROR_RESERVED_NAMESPACE_URI, + "Use of w3.org URL not faulted"); + XML_ParserReset(parser, NULL); + expect_failure(text3, XML_ERROR_RESERVED_NAMESPACE_URI, + "Use of w3.org xmlns URL not faulted"); +} +END_TEST + +/* Control variable; the number of times duff_allocator() will successfully allocate */ +#define ALLOC_ALWAYS_SUCCEED (-1) +#define REALLOC_ALWAYS_SUCCEED (-1) + +static int allocation_count = ALLOC_ALWAYS_SUCCEED; +static int reallocation_count = REALLOC_ALWAYS_SUCCEED; + +/* Crocked allocator for allocation failure tests */ +static void *duff_allocator(size_t size) +{ + if (allocation_count == 0) + return NULL; + if (allocation_count != ALLOC_ALWAYS_SUCCEED) + allocation_count--; + return malloc(size); +} + +/* Crocked reallocator for allocation failure tests */ +static void *duff_reallocator(void *ptr, size_t size) +{ + if (reallocation_count == 0) + return NULL; + if (reallocation_count != REALLOC_ALWAYS_SUCCEED) + reallocation_count--; + return realloc(ptr, size); +} + +/* Test that a failure to allocate the parser structure fails gracefully */ +START_TEST(test_misc_alloc_create_parser) +{ + XML_Memory_Handling_Suite memsuite = { duff_allocator, realloc, free }; + unsigned int i; + + /* Something this simple shouldn't need more than 10 allocations */ + for (i = 0; i < 10; i++) + { + allocation_count = i; + parser = XML_ParserCreate_MM(NULL, &memsuite, NULL); + if (parser != NULL) + break; + } + if (i == 0) + fail("Parser unexpectedly ignored failing allocator"); + else if (i == 10) + fail("Parser not created with allocation count 10"); +} +END_TEST + +/* Test memory allocation failures for a parser with an encoding */ +START_TEST(test_misc_alloc_create_parser_with_encoding) +{ + XML_Memory_Handling_Suite memsuite = { duff_allocator, realloc, free }; + unsigned int i; + + /* Try several levels of allocation */ + for (i = 0; i < 10; i++) { + allocation_count = i; + parser = XML_ParserCreate_MM("us-ascii", &memsuite, NULL); + if (parser != NULL) + break; + } + if (i == 0) + fail("Parser ignored failing allocator"); + else if (i == 10) + fail("Parser not created with allocation count 10"); +} +END_TEST + +/* Test that freeing a NULL parser doesn't cause an explosion. + * (Not actually tested anywhere else) + */ +START_TEST(test_misc_null_parser) +{ + XML_ParserFree(NULL); +} +END_TEST + +/* Test that XML_ErrorString rejects out-of-range codes */ +START_TEST(test_misc_error_string) +{ + if (XML_ErrorString((enum XML_Error)-1) != NULL) + fail("Negative error code not rejected"); + if (XML_ErrorString((enum XML_Error)100) != NULL) + fail("Large error code not rejected"); +} +END_TEST + +/* Test the version information is consistent */ +START_TEST(test_misc_version) +{ + XML_Expat_Version version_struct = XML_ExpatVersionInfo(); + const XML_LChar *version_text = XML_ExpatVersion(); + long value; + const char *p; + char *endp; + + if (version_text == NULL) + fail("Could not obtain version text"); + for (p = version_text; *p != '\0'; p++) + if (isdigit(*p)) + break; + if (*p == '\0') + fail("No numbers in version text"); + value = strtoul(p, &endp, 10); + if (*endp != '.') + fail("Major version conversion from text failed"); + if (value != version_struct.major) + fail("Major version mismatch"); + p = endp + 1; + value = strtoul(p, &endp, 10); + if (*endp != '.') + fail("Minor version conversion from text failed"); + if (value != version_struct.minor) + fail("Minor version mismatch"); + p = endp + 1; + value = strtoul(p, &endp, 10); + if (*endp != '\0') + fail("Micro version conversion from text failed"); + if (value != version_struct.micro) + fail("Micro version mismatch"); +} +END_TEST + +/* Test feature information */ +START_TEST(test_misc_features) +{ + const XML_Feature *features = XML_GetFeatureList(); + + /* Prevent problems with double-freeing parsers */ + parser = NULL; + if (features == NULL) + fail("Failed to get feature information"); + /* Loop through the features checking what we can */ + while (features->feature != XML_FEATURE_END) { + switch(features->feature) { + case XML_FEATURE_SIZEOF_XML_CHAR: + if (features->value != sizeof(XML_Char)) + fail("Incorrect size of XML_Char"); + break; + case XML_FEATURE_SIZEOF_XML_LCHAR: + if (features->value != sizeof(XML_LChar)) + fail("Incorrect size of XML_LChar"); + break; + default: + break; + } + features++; + } +} +END_TEST + +/* Regression test for GitHub Issue #17: memory leak parsing attribute + * values with mixed bound and unbound namespaces. + */ +START_TEST(test_misc_attribute_leak) +{ + const char *text = ""; + XML_Memory_Handling_Suite memsuite = { + tracking_malloc, + tracking_realloc, + tracking_free + }; + + parser = XML_ParserCreate_MM("UTF-8", &memsuite, "\n"); + expect_failure(text, XML_ERROR_UNBOUND_PREFIX, + "Unbound prefixes not found"); + XML_ParserFree(parser); + /* Prevent the teardown trying to double free */ + parser = NULL; + + if (!tracking_report()) + fail("Memory leak found"); +} +END_TEST + + +static void +alloc_setup(void) +{ + XML_Memory_Handling_Suite memsuite = { + duff_allocator, + duff_reallocator, + free + }; + + /* Ensure the parser creation will go through */ + allocation_count = ALLOC_ALWAYS_SUCCEED; + reallocation_count = REALLOC_ALWAYS_SUCCEED; + parser = XML_ParserCreate_MM(NULL, &memsuite, NULL); + if (parser == NULL) + fail("Parser not created"); +} + +static void +alloc_teardown(void) +{ + basic_teardown(); +} + + +/* Test the effects of allocation failures on a straightforward parse */ +START_TEST(test_alloc_parse_pi) +{ + const char *text = + "\n" + "\n" + "" + "Hello, world" + ""; + int i; + int repeat = 0; +#define MAX_ALLOC_COUNT 10 + + for (i = 0; i < MAX_ALLOC_COUNT; i++) { + allocation_count = i; + /* Repeat some counts because of cached memory */ + if (i == 2 && repeat == 2) { + i -= 2; + repeat++; + } else if ((i == 1 && repeat < 2) || + (i == 1 && repeat > 2 && repeat < 5)) { + i--; + repeat++; + } + XML_SetProcessingInstructionHandler(parser, dummy_pi_handler); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parse succeeded despite failing allocator"); + if (i == MAX_ALLOC_COUNT) + fail("Parse failed with max allocations"); +#undef MAX_ALLOC_COUNT +} +END_TEST + +START_TEST(test_alloc_parse_pi_2) +{ + const char *text = + "\n" + "" + "Hello, world" + "\n" + ""; + int i; + int repeat = 0; +#define MAX_ALLOC_COUNT 10 + + for (i = 0; i < MAX_ALLOC_COUNT; i++) { + allocation_count = i; + /* Repeat some counts because of cached memory */ + if (i == 2 && repeat == 1) { + i -= 2; + repeat++; + } else if ((i == 1 && repeat < 1) || + (i == 1 && repeat > 1 && repeat < 4)) { + i--; + repeat++; + } + XML_SetProcessingInstructionHandler(parser, dummy_pi_handler); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parse succeeded despite failing allocator"); + if (i == MAX_ALLOC_COUNT) + fail("Parse failed with max allocations"); +#undef MAX_ALLOC_COUNT +} +END_TEST + +START_TEST(test_alloc_parse_comment) +{ + const char *text = + "\n" + "" + "Hi"; + int i; + int repeat = 0; +#define MAX_ALLOC_COUNT 10 + + for (i = 0; i < MAX_ALLOC_COUNT; i++) { + /* Repeat some counts because of cached memory */ + if (i == 2 && repeat == 2) { + i -= 2; + repeat++; + } else if ((i == 1 && repeat < 2) || + (i == 1 && repeat > 2 && repeat < 5)) { + i--; + repeat++; + } + allocation_count = i; + XML_SetCommentHandler(parser, dummy_comment_handler); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parse succeeded despite failing allocator"); + if (i == MAX_ALLOC_COUNT) + fail("Parse failed with max allocations"); +#undef MAX_ALLOC_COUNT +} +END_TEST + +START_TEST(test_alloc_parse_comment_2) +{ + const char *text = + "\n" + "" + "Hello, world" + "" + ""; + int i; + int repeat = 0; +#define MAX_ALLOC_COUNT 10 + + for (i = 0; i < MAX_ALLOC_COUNT; i++) { + allocation_count = i; + /* Repeat some counts because of cached memory */ + if (i == 2 && repeat == 1) { + i -= 2; + repeat++; + } else if ((i == 1 && repeat < 1) || + (i == 1 && repeat > 1 && repeat < 4)) { + i--; + repeat++; + } + XML_SetCommentHandler(parser, dummy_comment_handler); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parse succeeded despite failing allocator"); + if (i == MAX_ALLOC_COUNT) + fail("Parse failed with max allocations"); +#undef MAX_ALLOC_COUNT +} +END_TEST + +static int XMLCALL +external_entity_duff_loader(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + XML_Parser new_parser; + unsigned int i; + + /* Try a few different allocation levels */ + for (i = 0; i < 10; i++) + { + allocation_count = i; + new_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (new_parser != NULL) + { + XML_ParserFree(new_parser); + break; + } + } + if (i == 0) + fail("External parser creation ignored failing allocator"); + else if (i == 10) + fail("Extern parser not created with allocation count 10"); + + /* Make sure other random allocation doesn't now fail */ + allocation_count = ALLOC_ALWAYS_SUCCEED; + + /* Make sure the failure code path is executed too */ + return XML_STATUS_ERROR; +} + +/* Test that external parser creation running out of memory is + * correctly reported. Based on the external entity test cases. + */ +START_TEST(test_alloc_create_external_parser) +{ + const char *text = + "\n" + "\n" + "&entity;"; + char foo_text[] = + ""; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetUserData(parser, foo_text); + XML_SetExternalEntityRefHandler(parser, + external_entity_duff_loader); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) { + fail("External parser allocator returned success incorrectly"); + } +} +END_TEST + +static int XMLCALL +external_entity_null_loader(XML_Parser UNUSED_P(parser), + const XML_Char *UNUSED_P(context), + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + return XML_STATUS_OK; +} + +/* More external parser memory allocation testing */ +START_TEST(test_alloc_run_external_parser) +{ + const char *text = + "\n" + "\n" + "&entity;"; + char foo_text[] = + ""; + unsigned int i; + + for (i = 0; i < 10; i++) { + XML_SetParamEntityParsing(parser, + XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetUserData(parser, foo_text); + XML_SetExternalEntityRefHandler(parser, + external_entity_null_loader); + allocation_count = i; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) + break; + /* Re-use the parser */ + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parsing ignored failing allocator"); + else if (i == 10) + fail("Parsing failed with allocation count 10"); +} +END_TEST + + +static int XMLCALL +external_entity_dbl_handler(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + intptr_t callno = (intptr_t)XML_GetUserData(parser); + const char *text; + XML_Parser new_parser; + int i; + + if (callno == 0) { + /* First time through, check how many calls to malloc occur */ + text = ("\n" + "\n" + "\n"); + allocation_count = 10000; + new_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (new_parser == NULL) { + fail("Unable to allocate first external parser"); + return XML_STATUS_ERROR; + } + /* Stash the number of calls in the user data */ + XML_SetUserData(parser, (void *)(intptr_t)(10000 - allocation_count)); + } else { + text = ("" + ""); + /* Try at varying levels to exercise more code paths */ + for (i = 0; i < 20; i++) { + allocation_count = callno + i; + new_parser = XML_ExternalEntityParserCreate(parser, + context, + NULL); + if (new_parser != NULL) + break; + } + if (i == 0) { + fail("Second external parser unexpectedly created"); + XML_ParserFree(new_parser); + return XML_STATUS_ERROR; + } + else if (i == 20) { + fail("Second external parser not created"); + return XML_STATUS_ERROR; + } + } + + allocation_count = ALLOC_ALWAYS_SUCCEED; + if (_XML_Parse_SINGLE_BYTES(new_parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) { + xml_failure(new_parser); + return XML_STATUS_ERROR; + } + XML_ParserFree(new_parser); + return XML_STATUS_OK; +} + +/* Test that running out of memory in dtdCopy is correctly reported. + * Based on test_default_ns_from_ext_subset_and_ext_ge() + */ +START_TEST(test_alloc_dtd_copy_default_atts) +{ + const char *text = + "\n" + "\n" + "]>\n" + "\n" + "&en;\n" + ""; + + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, + external_entity_dbl_handler); + XML_SetUserData(parser, NULL); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); +} +END_TEST + + +static int XMLCALL +external_entity_dbl_handler_2(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + intptr_t callno = (intptr_t)XML_GetUserData(parser); + const char *text; + XML_Parser new_parser; + enum XML_Status rv; + + if (callno == 0) { + /* Try different allocation levels for whole exercise */ + text = ("\n" + "\n" + "\n"); + XML_SetUserData(parser, (void *)(intptr_t)1); + new_parser = XML_ExternalEntityParserCreate(parser, + context, + NULL); + if (new_parser == NULL) + return XML_STATUS_ERROR; + rv = _XML_Parse_SINGLE_BYTES(new_parser, text, strlen(text), + XML_TRUE); + } else { + /* Just run through once */ + text = ("" + ""); + new_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (new_parser == NULL) + return XML_STATUS_ERROR; + rv =_XML_Parse_SINGLE_BYTES(new_parser, text, strlen(text), + XML_TRUE); + } + XML_ParserFree(new_parser); + if (rv == XML_STATUS_ERROR) + return XML_STATUS_ERROR; + return XML_STATUS_OK; +} + +/* Test more external entity allocation failure paths */ +START_TEST(test_alloc_external_entity) +{ + const char *text = + "\n" + "\n" + "]>\n" + "\n" + "&en;\n" + ""; + int i; + int repeat = 0; +#define ALLOC_TEST_MAX_REPEATS 50 + + for (i = 0; i < ALLOC_TEST_MAX_REPEATS; i++) { + /* Some allocation counts need to be repeated to follow all + * the failure paths, given some allocations are cached. + */ + if (i == 11 && repeat == 7) { + i -= 2; + repeat++; + } else if ((i == 1 && repeat < 2) || + (i == 2 && repeat < 4) || + (repeat < 7 && i == repeat+2) || + (i == 10 && repeat == 8)) { + i--; + repeat++; + } + allocation_count = -1; + XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); + XML_SetExternalEntityRefHandler(parser, + external_entity_dbl_handler_2); + XML_SetUserData(parser, NULL); + allocation_count = i; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_OK) + break; + XML_ParserReset(parser, NULL); + } + allocation_count = -1; + if (i == 0) + fail("External entity parsed despite duff allocator"); + if (i == ALLOC_TEST_MAX_REPEATS) + fail("External entity not parsed at max allocation count"); +#undef ALLOC_TEST_MAX_REPEATS +} +END_TEST + +/* Test more allocation failure paths */ +static int XMLCALL +external_entity_alloc_set_encoding(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + /* As for external_entity_loader_set_encoding() */ + const char *text = + "" + "\xC3\xA9"; + XML_Parser ext_parser; + enum XML_Status status; + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + return XML_STATUS_ERROR; + if (!XML_SetEncoding(ext_parser, "utf-8")) { + XML_ParserFree(ext_parser); + return XML_STATUS_ERROR; + } + status = _XML_Parse_SINGLE_BYTES(ext_parser, text, strlen(text), + XML_TRUE); + XML_ParserFree(ext_parser); + if (status == XML_STATUS_ERROR) + return XML_STATUS_ERROR; + return XML_STATUS_OK; +} + +START_TEST(test_alloc_ext_entity_set_encoding) +{ + const char *text = + "\n" + "]>\n" + "&en;"; + int i; + int repeat = 0; +#define MAX_ALLOCATION_COUNT 20 + + for (i = 0; i < MAX_ALLOCATION_COUNT; i++) { + /* Repeat some counts to get round caching */ + if ((i == 2 && repeat < 3) || + (i == 3 && repeat < 6) || + (i == 4 && repeat == 6)) { + i--; + repeat++; + } + XML_SetExternalEntityRefHandler(parser, + external_entity_alloc_set_encoding); + allocation_count = i; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_OK) + break; + allocation_count = -1; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Encoding check succeeded despite failing allocator"); + if (i == MAX_ALLOCATION_COUNT) + fail("Encoding failed at max allocation count"); +#undef MAX_ALLOCATION_COUNT +} +END_TEST + +static int XMLCALL +unknown_released_encoding_handler(void *UNUSED_P(data), + const XML_Char *encoding, + XML_Encoding *info) +{ + if (!strcmp(encoding, "unsupported-encoding")) { + int i; + + for (i = 0; i < 256; i++) + info->map[i] = i; + info->data = NULL; + info->convert = NULL; + info->release = dummy_release; + return XML_STATUS_OK; + } + return XML_STATUS_ERROR; +} + +/* Test the effects of allocation failure in internal entities. + * Based on test_unknown_encoding_internal_entity + */ +START_TEST(test_alloc_internal_entity) +{ + const char *text = + "\n" + "]>\n" + ""; + unsigned int i; + int repeated = 0; + + for (i = 0; i < 10; i++) { + /* Again, repeat some counts to account for caching */ + if (repeated < 2 && i == 2) { + i--; + repeated++; + } + XML_SetUnknownEncodingHandler(parser, + unknown_released_encoding_handler, + NULL); + allocation_count = i; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Internal entity worked despite failing allocations"); + else if (i == 10) + fail("Internal entity failed at allocation count 10"); +} +END_TEST + + +/* Test the robustness against allocation failure of element handling + * Based on test_dtd_default_handling(). + */ +START_TEST(test_alloc_dtd_default_handling) +{ + const char *text = + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "]>\n" + ""; + const char *expected = "\n\n\n\n\n\n\n\n\ntext in doc"; + CharData storage; + int i; +#define MAX_ALLOC_COUNT 15 + int repeat = 0; + + for (i = 0; i < MAX_ALLOC_COUNT; i++) { + /* Repeat some counts to catch cached allocations */ + if ((repeat < 4 && i == 2) || + (repeat == 4 && i == 4) || + (repeat == 5 && i == 5) || + (repeat == 6 && i == 8)) { + i--; + repeat++; + } + allocation_count = i; + dummy_handler_flags = 0; + XML_SetDefaultHandler(parser, accumulate_characters); + XML_SetDoctypeDeclHandler(parser, + dummy_start_doctype_handler, + dummy_end_doctype_handler); + XML_SetEntityDeclHandler(parser, dummy_entity_decl_handler); + XML_SetNotationDeclHandler(parser, dummy_notation_decl_handler); + XML_SetElementDeclHandler(parser, dummy_element_decl_handler); + XML_SetAttlistDeclHandler(parser, dummy_attlist_decl_handler); + XML_SetProcessingInstructionHandler(parser, dummy_pi_handler); + XML_SetCommentHandler(parser, dummy_comment_handler); + XML_SetCdataSectionHandler(parser, + dummy_start_cdata_handler, + dummy_end_cdata_handler); + XML_SetUnparsedEntityDeclHandler( + parser, + dummy_unparsed_entity_decl_handler); + CharData_Init(&storage); + XML_SetUserData(parser, &storage); + XML_SetCharacterDataHandler(parser, accumulate_characters); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Default DTD parsed despite allocation failures"); + if (i == MAX_ALLOC_COUNT) + fail("Default DTD not parsed with maximum alloc count"); + CharData_CheckXMLChars(&storage, expected); + if (dummy_handler_flags != (DUMMY_START_DOCTYPE_HANDLER_FLAG | + DUMMY_END_DOCTYPE_HANDLER_FLAG | + DUMMY_ENTITY_DECL_HANDLER_FLAG | + DUMMY_NOTATION_DECL_HANDLER_FLAG | + DUMMY_ELEMENT_DECL_HANDLER_FLAG | + DUMMY_ATTLIST_DECL_HANDLER_FLAG | + DUMMY_COMMENT_HANDLER_FLAG | + DUMMY_PI_HANDLER_FLAG | + DUMMY_START_CDATA_HANDLER_FLAG | + DUMMY_END_CDATA_HANDLER_FLAG | + DUMMY_UNPARSED_ENTITY_DECL_HANDLER_FLAG)) + fail("Not all handlers were called"); +} +#undef MAX_ALLOC_COUNT +END_TEST + +/* Test robustness of XML_SetEncoding() with a failing allocator */ +START_TEST(test_alloc_explicit_encoding) +{ + int i; + + for (i = 0; i < 5; i++) { + allocation_count = i; + if (XML_SetEncoding(parser, "us-ascii") == XML_STATUS_OK) + break; + } + if (i == 0) + fail("Encoding set despite failing allocator"); + else if (i == 5) + fail("Encoding not set at allocation count 5"); +} +END_TEST + +/* Test robustness of XML_SetBase against a failing allocator */ +START_TEST(test_alloc_set_base) +{ + const XML_Char *new_base = "/local/file/name.xml"; + int i; + + for (i = 0; i < 5; i++) { + allocation_count = i; + if (XML_SetBase(parser, new_base) == XML_STATUS_OK) + break; + } + if (i == 0) + fail("Base set despite failing allocator"); + else if (i == 5) + fail("Base not set with allocation count 5"); +} +END_TEST + +/* Test buffer extension in the face of a duff reallocator */ +START_TEST(test_alloc_realloc_buffer) +{ + const char *text = get_buffer_test_text; + void *buffer; + int i; + int repeat = 0; + + /* Get a smallish buffer */ + for (i = 0; i < 10; i++) { + /* Repeat some indexes for cached allocations */ + if (repeat < 6 && i == 2) { + i--; + repeat++; + } + reallocation_count = i; + buffer = XML_GetBuffer(parser, 1536); + if (buffer == NULL) + fail("1.5K buffer reallocation failed"); + memcpy(buffer, text, strlen(text)); + if (XML_ParseBuffer(parser, strlen(text), + XML_FALSE) == XML_STATUS_OK) + break; + XML_ParserReset(parser, NULL); + } + reallocation_count = -1; + if (i == 0) + fail("Parse succeeded with no reallocation"); + else if (i == 10) + fail("Parse failed with reallocation count 10"); +} +END_TEST + +/* Same test for external entity parsers */ +static int XMLCALL +external_entity_reallocator(XML_Parser parser, + const XML_Char *context, + const XML_Char *UNUSED_P(base), + const XML_Char *UNUSED_P(systemId), + const XML_Char *UNUSED_P(publicId)) +{ + const char *text = get_buffer_test_text; + XML_Parser ext_parser; + void *buffer; + enum XML_Status status; + + ext_parser = XML_ExternalEntityParserCreate(parser, context, NULL); + if (ext_parser == NULL) + fail("Could not create external entity parser"); + + reallocation_count = (intptr_t)XML_GetUserData(parser); + buffer = XML_GetBuffer(ext_parser, 1536); + if (buffer == NULL) + fail("Buffer allocation failed"); + memcpy(buffer, text, strlen(text)); + status = XML_ParseBuffer(ext_parser, strlen(text), XML_FALSE); + reallocation_count = -1; + XML_ParserFree(ext_parser); + return (status == XML_STATUS_OK) ? XML_STATUS_OK : XML_STATUS_ERROR; +} + +START_TEST(test_alloc_ext_entity_realloc_buffer) +{ + const char *text = + "\n" + "]>\n" + "&en;"; + int i; + + for (i = 0; i < 10; i++) { + XML_SetExternalEntityRefHandler(parser, + external_entity_reallocator); + XML_SetUserData(parser, (void *)(intptr_t)i); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) == XML_STATUS_OK) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Succeeded with no reallocations"); + if (i == 10) + fail("Failed with 10 reallocations"); +} +END_TEST + +/* Test elements with many attributes are handled correctly */ +START_TEST(test_alloc_realloc_many_attributes) +{ + const char *text = + "\n" + "\n" + "\n" + "]>\n" + "" + ""; + int i; +#define MAX_REALLOC_COUNT 10 + + for (i = 0; i < MAX_REALLOC_COUNT; i++) { + reallocation_count = i; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parse succeeded despite no reallocations"); + if (i == MAX_REALLOC_COUNT) + fail("Parse failed at max reallocations"); +#undef MAX_REALLOC_COUNT +} +END_TEST + + +static void +nsalloc_setup(void) +{ + XML_Memory_Handling_Suite memsuite = { + duff_allocator, + duff_reallocator, + free + }; + XML_Char ns_sep[2] = { ' ', '\0' }; + + /* Ensure the parser creation will go through */ + allocation_count = ALLOC_ALWAYS_SUCCEED; + reallocation_count = REALLOC_ALWAYS_SUCCEED; + parser = XML_ParserCreate_MM(NULL, &memsuite, ns_sep); + if (parser == NULL) + fail("Parser not created"); +} + +static void +nsalloc_teardown(void) +{ + basic_teardown(); +} + + +/* Test the effects of allocation failure in simple namespace parsing. + * Based on test_ns_default_with_empty_uri() + */ +START_TEST(test_nsalloc_xmlns) +{ + const char *text = + "\n" + " \n" + ""; + unsigned int i; + int repeated = 0; + + for (i = 0; i < 10; i++) { + /* Repeat some tests with the same allocation count to + * catch cached allocations not freed by XML_ParserReset() + */ + if ((i == 4 && repeated == 3) || + (i == 7 && repeated == 8)) { + i -= 2; + repeated++; + } + else if ((i == 2 && repeated < 2) || + (i == 3 && repeated < 3) || + (i == 3 && repeated > 3 && repeated < 7) || + (i == 5 && repeated < 8)) { + i--; + repeated++; + } + allocation_count = i; + /* Exercise more code paths with a default handler */ + XML_SetDefaultHandler(parser, dummy_default_handler); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parsing worked despite failing allocations"); + else if (i == 10) + fail("Parsing failed even at allocation count 10"); +} +END_TEST + +/* Test XML_ParseBuffer interface with namespace and a dicky allocator */ +START_TEST(test_nsalloc_parse_buffer) +{ + const char *text = "Hello"; + void *buffer; + + /* Try a parse before the start of the world */ + /* (Exercises new code path) */ + allocation_count = 0; + if (XML_ParseBuffer(parser, 0, XML_FALSE) != XML_STATUS_ERROR) + fail("Pre-init XML_ParseBuffer not faulted"); + if (XML_GetErrorCode(parser) != XML_ERROR_NO_MEMORY) + fail("Pre-init XML_ParseBuffer faulted for wrong reason"); + + /* Now with actual memory allocation */ + allocation_count = ALLOC_ALWAYS_SUCCEED; + if (XML_ParseBuffer(parser, 0, XML_FALSE) != XML_STATUS_OK) + xml_failure(parser); + + /* Check that resuming an unsuspended parser is faulted */ + if (XML_ResumeParser(parser) != XML_STATUS_ERROR) + fail("Resuming unsuspended parser not faulted"); + if (XML_GetErrorCode(parser) != XML_ERROR_NOT_SUSPENDED) + xml_failure(parser); + + /* Get the parser into suspended state */ + XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler); + resumable = XML_TRUE; + buffer = XML_GetBuffer(parser, strlen(text)); + if (buffer == NULL) + fail("Could not acquire parse buffer"); + memcpy(buffer, text, strlen(text)); + if (XML_ParseBuffer(parser, strlen(text), + XML_TRUE) != XML_STATUS_SUSPENDED) + xml_failure(parser); + if (XML_GetErrorCode(parser) != XML_ERROR_NONE) + xml_failure(parser); + if (XML_ParseBuffer(parser, strlen(text), XML_TRUE) != XML_STATUS_ERROR) + fail("Suspended XML_ParseBuffer not faulted"); + if (XML_GetErrorCode(parser) != XML_ERROR_SUSPENDED) + xml_failure(parser); + if (XML_GetBuffer(parser, strlen(text)) != NULL) + fail("Suspended XML_GetBuffer not faulted"); + + /* Get it going again and complete the world */ + XML_SetCharacterDataHandler(parser, NULL); + if (XML_ResumeParser(parser) != XML_STATUS_OK) + xml_failure(parser); + if (XML_ParseBuffer(parser, strlen(text), XML_TRUE) != XML_STATUS_ERROR) + fail("Post-finishing XML_ParseBuffer not faulted"); + if (XML_GetErrorCode(parser) != XML_ERROR_FINISHED) + xml_failure(parser); + if (XML_GetBuffer(parser, strlen(text)) != NULL) + fail("Post-finishing XML_GetBuffer not faulted"); +} +END_TEST + +/* Check handling of long prefix names (pool growth) */ +START_TEST(test_nsalloc_long_prefix) +{ + const char *text = + "<" + /* 64 characters per line */ + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + ":foo xmlns:" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "='http://example.org/'>" + ""; + int i; +#define MAX_ALLOC_COUNT 10 + int repeated = 0; + + for (i = 0; i < MAX_ALLOC_COUNT; i++) { + /* Repeat some tests with the same allocation count to + * catch cached allocations not freed by XML_ParserReset() + */ + if ((i == 4 && repeated == 3) || + (i == 4 && repeated == 6)) { + i -= 2; + repeated++; + } + else if ((i == 2 && repeated < 2) || + (i == 3 && repeated < 3) || + (i == 3 && repeated > 3 && repeated < 6) || + (i == 3 && repeated > 6 && repeated < 9)) { + i--; + repeated++; + } + allocation_count = i; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parsing worked despite failing allocations"); + else if (i == MAX_ALLOC_COUNT) + fail("Parsing failed even at max allocation count"); +} +#undef MAX_ALLOC_COUNT +END_TEST + +/* Check handling of long uri names (pool growth) */ +START_TEST(test_nsalloc_long_uri) +{ + const char *text = + "" + ""; + int i; +#define MAX_ALLOC_COUNT 15 + int repeated = 0; + + for (i = 0; i < MAX_ALLOC_COUNT; i++) { + /* Repeat some tests with the same allocation count to + * catch cached allocations not freed by XML_ParserReset() + */ + if ((i == 3 && repeated == 1) || + (i == 6 && repeated == 4)) { + i -= 2; + repeated++; + } + else if ((i == 2 && (repeated == 0 || repeated == 2)) || + (i == 4 && repeated == 3) || + (i == 8 && repeated == 5)) { + i--; + repeated++; + } + allocation_count = i; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parsing worked despite failing allocations"); + else if (i == MAX_ALLOC_COUNT) + fail("Parsing failed even at max allocation count"); +} +#undef MAX_ALLOC_COUNT +END_TEST + +/* Test handling of long attribute names with prefixes */ +START_TEST(test_nsalloc_long_attr) +{ + const char *text = + "" + ""; + int i; +#define MAX_ALLOC_COUNT 20 + int repeated = 0; + + for (i = 0; i < MAX_ALLOC_COUNT; i++) { + /* Repeat some tests with the same allocation count to + * catch cached allocation not freed by XML_ParserReset() + */ + if ((i == 4 && repeated < 6) || + (i == 7 && repeated == 8) || + (i == 10 && repeated == 10)) { + i -= 2; + repeated++; + } + else if ((i == 2 && repeated < 2) || + (i == 3 && + (repeated == 2 || repeated == 4 || repeated == 6)) || + (i == 5 && repeated == 7) || + (i == 6 && repeated == 9)) { + i--; + repeated++; + } + allocation_count = i; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parsing worked despite failing allocations"); + else if (i == MAX_ALLOC_COUNT) + fail("Parsing failed even at max allocation count"); +} +#undef MAX_ALLOC_COUNT +END_TEST + +/* Test handling of an attribute name with a long namespace prefix */ +START_TEST(test_nsalloc_long_attr_prefix) +{ + const char *text = + "" + ""; + const char *elemstr[] = { + "http://example.org/ e foo", + "http://example.org/ a " + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789AZ" + }; + int i; +#define MAX_ALLOC_COUNT 15 + int repeated = 0; + + for (i = 0; i < MAX_ALLOC_COUNT; i++) { + /* Repeat some counts to flush out cached allocations */ + if ((i == 4 && (repeated == 3 || repeated == 6)) || + (i == 7 && repeated == 9) || + (i == 10 && repeated == 12)) { + i -= 2; + repeated++; + } + else if ((i == 2 && repeated < 2) || + (i == 3 && + (repeated == 2 || + repeated == 4 || + repeated == 5 || + repeated == 7)) || + (i == 5 && repeated == 8) || + (i == 6 && repeated == 10) || + (i == 8 && repeated == 11)) { + i--; + repeated++; + } + allocation_count = i; + XML_SetReturnNSTriplet(parser, XML_TRUE); + XML_SetUserData(parser, elemstr); + XML_SetElementHandler(parser, + triplet_start_checker, + triplet_end_checker); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parsing worked despite failing allocations"); + else if (i == MAX_ALLOC_COUNT) + fail("Parsing failed even at max allocation count"); +} +#undef MAX_ALLOC_COUNT +END_TEST + +/* Test attribute handling in the face of a dodgy reallocator */ +START_TEST(test_nsalloc_realloc_attributes) +{ + const char *text = + "" + ""; + int i; +#define MAX_REALLOC_COUNT 10 + + for (i = 0; i < MAX_REALLOC_COUNT; i++) { + reallocation_count = i; + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parsing worked despite failing reallocations"); + else if (i == MAX_REALLOC_COUNT) + fail("Parsing failed at max reallocation count"); +} +#undef MAX_REALLOC_COUNT +END_TEST + +/* Test long element names with namespaces under a failing allocator */ +START_TEST(test_nsalloc_long_element) +{ + const char *text = + "" + ""; + const char *elemstr[] = { + "http://example.org/" + " thisisalongenoughelementnametotriggerareallocation foo", + "http://example.org/ a bar" + }; + int i; +#define MAX_ALLOC_COUNT 15 + int repeated = 0; + + for (i = 0; i < MAX_ALLOC_COUNT; i++) { + /* Repeat some allocation counts because some allocations + * get cached across XML_ParserReset() called. + */ + if ((i == 4 && (repeated == 3 || repeated == 5)) || + (i == 7 && repeated == 8) || + (i == 10 && repeated == 9)) { + i -= 2; + repeated++; + } + else if ((i == 2 && repeated < 2) || + (i == 3 && + (repeated == 2 || repeated == 4 || repeated == 6)) || + (i == 5 && repeated == 7)) { + i--; + repeated++; + } + allocation_count = i; + XML_SetReturnNSTriplet(parser, XML_TRUE); + XML_SetUserData(parser, elemstr); + XML_SetElementHandler(parser, + triplet_start_checker, + triplet_end_checker); + if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), + XML_TRUE) != XML_STATUS_ERROR) + break; + XML_ParserReset(parser, NULL); + } + if (i == 0) + fail("Parsing worked despite failing reallocations"); + else if (i == MAX_ALLOC_COUNT) + fail("Parsing failed at max reallocation count"); +} +#undef MAX_ALLOC_COUNT +END_TEST + +/* Test the effects of reallocation failure when reassigning a + * binding. + * + * XML_ParserReset does not free the BINDING structures used by a + * parser, but instead adds them to an internal free list to be reused + * as necessary. Likewise the URI buffers allocated for the binding + * aren't freed, but kept attached to their existing binding. If the + * new binding has a longer URI, it will need reallocation. This test + * provokes that reallocation, and tests the control path if it fails. + */ +START_TEST(test_nsalloc_realloc_binding_uri) +{ + const char *first = + "\n" + " \n" + ""; + const char *second = + "\n" + " \n" + ""; + unsigned i; +#define MAX_REALLOC_COUNT 10 + + /* First, do a full parse that will leave bindings around */ + if (_XML_Parse_SINGLE_BYTES(parser, first, strlen(first), + XML_TRUE) == XML_STATUS_ERROR) + xml_failure(parser); + + /* Now repeat with a longer URI and a duff reallocator */ + for (i = 0; i < MAX_REALLOC_COUNT; i++) { + XML_ParserReset(parser, NULL); + reallocation_count = i; + if (_XML_Parse_SINGLE_BYTES(parser, second, strlen(second), + XML_TRUE) != XML_STATUS_ERROR) + break; + } + if (i == 0) + fail("Parsing worked despite failing reallocation"); + else if (i == MAX_REALLOC_COUNT) + fail("Parsing failed at max reallocation count"); +} +#undef MAX_REALLOC_COUNT +END_TEST + + static Suite * make_suite(void) { Suite *s = suite_create("basic"); TCase *tc_basic = tcase_create("basic tests"); TCase *tc_namespace = tcase_create("XML namespaces"); + TCase *tc_misc = tcase_create("miscellaneous tests"); + TCase *tc_alloc = tcase_create("allocation tests"); + TCase *tc_nsalloc = tcase_create("namespace allocattion tests"); suite_add_tcase(s, tc_basic); tcase_add_checked_fixture(tc_basic, basic_setup, basic_teardown); tcase_add_test(tc_basic, test_nul_byte); tcase_add_test(tc_basic, test_u0000_char); + tcase_add_test(tc_basic, test_siphash_self); + tcase_add_test(tc_basic, test_siphash_spec); tcase_add_test(tc_basic, test_bom_utf8); tcase_add_test(tc_basic, test_bom_utf16_be); tcase_add_test(tc_basic, test_bom_utf16_le); @@ -1627,27 +5726,74 @@ make_suite(void) tcase_add_test(tc_basic, test_line_number_after_error); tcase_add_test(tc_basic, test_column_number_after_error); tcase_add_test(tc_basic, test_really_long_lines); + tcase_add_test(tc_basic, test_really_long_encoded_lines); tcase_add_test(tc_basic, test_end_element_events); tcase_add_test(tc_basic, test_attr_whitespace_normalization); tcase_add_test(tc_basic, test_xmldecl_misplaced); tcase_add_test(tc_basic, test_unknown_encoding_internal_entity); + tcase_add_test(tc_basic, test_unrecognised_encoding_internal_entity); tcase_add_test(tc_basic, test_wfc_undeclared_entity_unread_external_subset); tcase_add_test(tc_basic, test_wfc_undeclared_entity_no_external_subset); tcase_add_test(tc_basic, test_wfc_undeclared_entity_standalone); tcase_add_test(tc_basic, test_wfc_undeclared_entity_with_external_subset); + tcase_add_test(tc_basic, test_not_standalone_handler_reject); + tcase_add_test(tc_basic, test_not_standalone_handler_accept); tcase_add_test(tc_basic, test_wfc_undeclared_entity_with_external_subset_standalone); tcase_add_test(tc_basic, test_wfc_no_recursive_entity_refs); tcase_add_test(tc_basic, test_ext_entity_set_encoding); + tcase_add_test(tc_basic, test_ext_entity_no_handler); + tcase_add_test(tc_basic, test_ext_entity_set_bom); + tcase_add_test(tc_basic, test_ext_entity_bad_encoding); + tcase_add_test(tc_basic, test_ext_entity_invalid_parse); + tcase_add_test(tc_basic, test_ext_entity_invalid_suspended_parse); tcase_add_test(tc_basic, test_dtd_default_handling); tcase_add_test(tc_basic, test_empty_ns_without_namespaces); tcase_add_test(tc_basic, test_ns_in_attribute_default_without_namespaces); tcase_add_test(tc_basic, test_stop_parser_between_char_data_calls); tcase_add_test(tc_basic, test_suspend_parser_between_char_data_calls); + tcase_add_test(tc_basic, test_repeated_stop_parser_between_char_data_calls); tcase_add_test(tc_basic, test_good_cdata_ascii); tcase_add_test(tc_basic, test_good_cdata_utf16); + tcase_add_test(tc_basic, test_long_cdata_utf16); + tcase_add_test(tc_basic, test_multichar_cdata_utf16); tcase_add_test(tc_basic, test_bad_cdata); + tcase_add_test(tc_basic, test_bad_cdata_utf16); + tcase_add_test(tc_basic, test_stop_parser_between_cdata_calls); + tcase_add_test(tc_basic, test_suspend_parser_between_cdata_calls); + tcase_add_test(tc_basic, test_memory_allocation); + tcase_add_test(tc_basic, test_default_current); + tcase_add_test(tc_basic, test_dtd_elements); + tcase_add_test(tc_basic, test_set_foreign_dtd); + tcase_add_test(tc_basic, test_set_base); + tcase_add_test(tc_basic, test_attributes); + tcase_add_test(tc_basic, test_reset_in_entity); + tcase_add_test(tc_basic, test_resume_invalid_parse); + tcase_add_test(tc_basic, test_resume_resuspended); + tcase_add_test(tc_basic, test_cdata_default); + tcase_add_test(tc_basic, test_subordinate_reset); + tcase_add_test(tc_basic, test_subordinate_suspend); + tcase_add_test(tc_basic, test_subordinate_xdecl_suspend); + tcase_add_test(tc_basic, test_subordinate_xdecl_abort); + tcase_add_test(tc_basic, test_explicit_encoding); + tcase_add_test(tc_basic, test_trailing_cr); + tcase_add_test(tc_basic, test_ext_entity_trailing_cr); + tcase_add_test(tc_basic, test_trailing_rsqb); + tcase_add_test(tc_basic, test_ext_entity_trailing_rsqb); + tcase_add_test(tc_basic, test_ext_entity_good_cdata); + tcase_add_test(tc_basic, test_user_parameters); + tcase_add_test(tc_basic, test_ext_entity_ref_parameter); + tcase_add_test(tc_basic, test_empty_parse); + tcase_add_test(tc_basic, test_get_buffer_1); + tcase_add_test(tc_basic, test_get_buffer_2); + tcase_add_test(tc_basic, test_byte_info_at_end); + tcase_add_test(tc_basic, test_byte_info_at_error); + tcase_add_test(tc_basic, test_byte_info_at_cdata); + tcase_add_test(tc_basic, test_predefined_entities); + tcase_add_test(tc_basic, test_invalid_tag_in_dtd); + tcase_add_test(tc_basic, test_ignore_section); + tcase_add_test(tc_basic, test_bad_ignore_section); suite_add_tcase(s, tc_namespace); tcase_add_checked_fixture(tc_namespace, @@ -1661,10 +5807,59 @@ make_suite(void) tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_2); tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_3); tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_4); + tcase_add_test(tc_namespace, test_ns_unbound_prefix); tcase_add_test(tc_namespace, test_ns_default_with_empty_uri); tcase_add_test(tc_namespace, test_ns_duplicate_attrs_diff_prefixes); + tcase_add_test(tc_namespace, test_ns_duplicate_hashes); tcase_add_test(tc_namespace, test_ns_unbound_prefix_on_attribute); tcase_add_test(tc_namespace, test_ns_unbound_prefix_on_element); + tcase_add_test(tc_namespace, test_ns_parser_reset); + tcase_add_test(tc_namespace, test_ns_long_element); + tcase_add_test(tc_namespace, test_ns_mixed_prefix_atts); + tcase_add_test(tc_namespace, test_ns_extend_uri_buffer); + tcase_add_test(tc_namespace, test_ns_reserved_attributes); + tcase_add_test(tc_namespace, test_ns_reserved_attributes_2); + + suite_add_tcase(s, tc_misc); + tcase_add_checked_fixture(tc_misc, NULL, basic_teardown); + tcase_add_test(tc_misc, test_misc_alloc_create_parser); + tcase_add_test(tc_misc, test_misc_alloc_create_parser_with_encoding); + tcase_add_test(tc_misc, test_misc_null_parser); + tcase_add_test(tc_misc, test_misc_error_string); + tcase_add_test(tc_misc, test_misc_version); + tcase_add_test(tc_misc, test_misc_features); + tcase_add_test(tc_misc, test_misc_attribute_leak); + + suite_add_tcase(s, tc_alloc); + tcase_add_checked_fixture(tc_alloc, alloc_setup, alloc_teardown); + tcase_add_test(tc_alloc, test_alloc_parse_pi); + tcase_add_test(tc_alloc, test_alloc_parse_pi_2); + tcase_add_test(tc_alloc, test_alloc_parse_comment); + tcase_add_test(tc_alloc, test_alloc_parse_comment_2); + tcase_add_test(tc_alloc, test_alloc_create_external_parser); + tcase_add_test(tc_alloc, test_alloc_run_external_parser); + tcase_add_test(tc_alloc, test_alloc_dtd_copy_default_atts); + tcase_add_test(tc_alloc, test_alloc_external_entity); + tcase_add_test(tc_alloc, test_alloc_ext_entity_set_encoding); + tcase_add_test(tc_alloc, test_alloc_internal_entity); + tcase_add_test(tc_alloc, test_alloc_dtd_default_handling); + tcase_add_test(tc_alloc, test_alloc_explicit_encoding); + tcase_add_test(tc_alloc, test_alloc_set_base); + tcase_add_test(tc_alloc, test_alloc_realloc_buffer); + tcase_add_test(tc_alloc, test_alloc_ext_entity_realloc_buffer); + tcase_add_test(tc_alloc, test_alloc_realloc_many_attributes); + + suite_add_tcase(s, tc_nsalloc); + tcase_add_checked_fixture(tc_nsalloc, nsalloc_setup, nsalloc_teardown); + tcase_add_test(tc_nsalloc, test_nsalloc_xmlns); + tcase_add_test(tc_nsalloc, test_nsalloc_parse_buffer); + tcase_add_test(tc_nsalloc, test_nsalloc_long_prefix); + tcase_add_test(tc_nsalloc, test_nsalloc_long_uri); + tcase_add_test(tc_nsalloc, test_nsalloc_long_attr); + tcase_add_test(tc_nsalloc, test_nsalloc_long_attr_prefix); + tcase_add_test(tc_nsalloc, test_nsalloc_realloc_attributes); + tcase_add_test(tc_nsalloc, test_nsalloc_long_element); + tcase_add_test(tc_nsalloc, test_nsalloc_realloc_binding_uri); return s; } diff --git a/src/expat/tests/xmltest.sh b/src/expat/tests/xmltest.sh index 64a17eec06..e50093285a 100755 --- a/src/expat/tests/xmltest.sh +++ b/src/expat/tests/xmltest.sh @@ -25,7 +25,7 @@ shopt -s nullglob MYDIR="`dirname \"$0\"`" cd "$MYDIR" MYDIR="`pwd`" -XMLWF="`dirname \"$MYDIR\"`/xmlwf/xmlwf" +XMLWF="${1:-`dirname \"$MYDIR\"`/xmlwf/xmlwf}" # XMLWF=/usr/local/bin/xmlwf TS="$MYDIR" # OUTPUT must terminate with the directory separator. @@ -98,7 +98,8 @@ for xmldir in ibm/valid/P* \ sun/invalid ; do cd "$TS/xmlconf/$xmldir" mkdir -p "$OUTPUT$xmldir" - for xmlfile in *.xml ; do + for xmlfile in $(ls -1 *.xml | sort -d) ; do + [[ -f "$xmlfile" ]] || continue RunXmlwfWF "$xmlfile" "$xmldir/" UpdateStatus $? done diff --git a/src/expat/vms/README.vms b/src/expat/vms/README.vms deleted file mode 100644 index 3dd2ca73fe..0000000000 --- a/src/expat/vms/README.vms +++ /dev/null @@ -1,23 +0,0 @@ -4-jun-2002 Craig A. Berry - Added rudimentary build procedures for - OpenVMS based on work by Martin Vorlaender. - - -You'll need MMS or its freeware equivalent MMK. Just go to the -top-level directory and type - -$ MMS/DESCRIPTION=[.vms] - - or - -$ MMK/DESCRIPTION=[.vms] - -You'll end up with the object library expat.olb. For now, installation -consists merely of copying the object library, include files, and -documentation to a suitable location. - -To-do list: - - -- create a shareable image - -- build and run the tests and build the xmlwf utility - -- create an install target diff --git a/src/expat/vms/descrip.mms b/src/expat/vms/descrip.mms deleted file mode 100644 index d9ee3d98e4..0000000000 --- a/src/expat/vms/descrip.mms +++ /dev/null @@ -1,70 +0,0 @@ -# Bare bones description file (Makefile) for OpenVMS - -PACKAGE = expat -VERSION = 1.95.8 -EXPAT_MAJOR_VERSION=1 -EXPAT_MINOR_VERSION=95 -EXPAT_EDIT=8 - -O = .obj -OLB = .olb - -LIBRARY = expat$(OLB) -LIBDIR = [.lib] -SOURCES = $(LIBDIR)xmlparse.c $(LIBDIR)xmltok.c $(LIBDIR)xmlrole.c -OBJECTS = xmlparse$(O) xmltok$(O) xmlrole$(O) - -TEMPLATES = xmltok_impl.c xmltok_ns.c -APIHEADER = $(LIBDIR)expat.h -HEADERS = $(LIBDIR)ascii.h $(LIBDIR)iasciitab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h \ - $(LIBDIR)asciitab.h $(LIBDIR)latin1tab.h \ - $(LIBDIR)nametab.h $(LIBDIR)xmldef.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok_impl.h - -CONFIG_HEADER = expat_config.h -INCLUDES = /INCLUDE=([],[.lib]) -DEFS = /DEFINE=(PACKAGE="""$(PACKAGE)""",VERSION="""$(PACKAGE)_$(VERSION)""",HAVE_EXPAT_CONFIG_H) -LIBREVISION = 0 -LIBCURRENT = 1 -LIBAGE = 0 -# -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -# -# DISTFILES = $(DIST_COMMON) $(SOURCES) $(TEMPLATES) $(APIHEADER) $(HEADERS) -# -# TAR = gtar -# GZIP_ENV = --best -# -.FIRST : - IF F$SEARCH("$(LIBRARY)") .EQS. "" THEN $(LIBR) /CREATE /OBJECT $(LIBRARY) - -all : $(LIBRARY) - @ write sys$output "All made." - -.SUFFIXES : -.SUFFIXES : $(OLB) $(O) .C .H - -.c$(O) : - $(COMPILE) $(MMS$SOURCE) - -$(O)$(OLB) : - @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" - - THEN LIBRARY/CREATE/LOG $(MMS$TARGET) - @ LIBRARY /REPLACE /LOG $(MMS$TARGET) $(MMS$SOURCE) - -clean : - DELETE $(LIBRARY);*,*$(O);* - -$(LIBRARY) : $(LIBRARY)( $(OBJECTS) ) - $(LIBR) /COMPRESS $(MMS$TARGET) - -$(CONFIG_HEADER) : [.vms]expat_config.h - COPY/LOG $(MMS$SOURCE) $(MMS$TARGET) - -xmlparse$(O) : $(LIBDIR)xmlparse.c $(LIBDIR)expat.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok.h $(CONFIG_HEADER) - -xmlrole$(O) : $(LIBDIR)xmlrole.c $(LIBDIR)ascii.h $(LIBDIR)xmlrole.h $(CONFIG_HEADER) - -xmltok$(O) : $(LIBDIR)xmltok.c $(LIBDIR)xmltok_impl.c $(LIBDIR)xmltok_ns.c \ - $(LIBDIR)ascii.h $(LIBDIR)asciitab.h $(LIBDIR)iasciitab.h $(LIBDIR)latin1tab.h \ - $(LIBDIR)nametab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h $(LIBDIR)xmltok_impl.h $(CONFIG_HEADER) - diff --git a/src/expat/vms/expat_config.h b/src/expat/vms/expat_config.h deleted file mode 100644 index d5db89e56c..0000000000 --- a/src/expat/vms/expat_config.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2000, Clark Cooper - All rights reserved. - - This is free software. You are permitted to copy, distribute, or modify - it under the terms of the MIT/X license (contained in the COPYING file - with this distribution.) -*/ - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define to `long' if doesn't define. */ -#undef off_t - -/* Define to `unsigned' if doesn't define. */ -#undef size_t - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -/* Define if you have the bcopy function. */ -#undef HAVE_BCOPY - -/* Define if you have the memmove function. */ -#define HAVE_MEMMOVE 1 - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 - -#define XML_NS -#define XML_DTD - -#ifdef WORDS_BIGENDIAN -#define XML_BYTE_ORDER 21 -#else -#define XML_BYTE_ORDER 12 -#endif - -#define XML_CONTEXT_BYTES 1024 - -#ifndef HAVE_MEMMOVE -#ifdef HAVE_BCOPY -#define memmove(d,s,l) bcopy((s),(d),(l)) -#else -#define memmove(d,s,l) ;punting on memmove; -#endif - -#endif diff --git a/src/expat/win32/MANIFEST.txt b/src/expat/win32/MANIFEST.txt index b7cd395438..22b61d198f 100644 --- a/src/expat/win32/MANIFEST.txt +++ b/src/expat/win32/MANIFEST.txt @@ -22,6 +22,4 @@ directory you specified to the installer. formedness checker, and a couple of small sample applications. - \Source\bcb5\ Project files for Borland C++ Builder 5 and BCC 5.5. - diff --git a/src/expat/win32/README.txt b/src/expat/win32/README.txt index c58d29ab74..462c49b751 100644 --- a/src/expat/win32/README.txt +++ b/src/expat/win32/README.txt @@ -1,27 +1,14 @@ -Expat can be built on Windows in three ways: - using MS Visual C++ (6.0 or .NET), Borland C++ Builder 5 or Cygwin. +Expat can be built on Windows in two ways: + using MS Visual Studio .NET or Cygwin. * Cygwin: This follows the Unix build procedures. -* C++ Builder 5: - Possible with make files in the BCB5 subdirectory. - Details can be found in the ReadMe file located there. - -* MS Visual C++ 6: - Based on the workspace file expat.dsw. The related project - files (.dsp) are located in the lib subdirectory. - -* MS Visual Studio .NET 2002, 2003, 2005, 2008, 2010: - The VC++ 6 workspace file (expat.dsw) and project files (.dsp) - can be opened and imported in VS.NET without problems. - Note: Tests have their own *.dsw files. - -* MS Visual Studio 2013 and 2015: +* MS Visual Studio 2013, 2015 and 2017: A solution file for Visual Studio 2013 is provided: expat.sln. The associated project files (*.vcxproj) reside in the appropriate - project directories. This solution file can be opened in VS 2015 + project directories. This solution file can be opened in VS 2015 or VS 2017 and should be upgraded automatically if VS 2013 is not also installed. Note: Tests have their own solution files. diff --git a/src/expat/win32/expat.iss b/src/expat/win32/expat.iss index add8445f15..ff2da9f6bb 100644 --- a/src/expat/win32/expat.iss +++ b/src/expat/win32/expat.iss @@ -7,17 +7,17 @@ [Setup] AppName=Expat AppId=expat -AppVersion=2.2.0 -AppVerName=Expat 2.2.0 -AppCopyright=Copyright © 1998-2016 Thai Open Source Software Center, Clark Cooper, and the Expat maintainers +AppVersion=2.2.2 +AppVerName=Expat 2.2.2 +AppCopyright=Copyright � 1998-2017 Thai Open Source Software Center, Clark Cooper, and the Expat maintainers AppPublisher=The Expat Developers AppPublisherURL=http://www.libexpat.org/ AppSupportURL=http://www.libexpat.org/ AppUpdatesURL=http://www.libexpat.org/ -UninstallDisplayName=Expat XML Parser 2.2.0 -VersionInfoVersion=2.2.0 +UninstallDisplayName=Expat XML Parser 2.2.2 +VersionInfoVersion=2.2.2 -DefaultDirName={pf}\Expat 2.2.0 +DefaultDirName={pf}\Expat 2.2.2 UninstallFilesDir={app}\Uninstall Compression=lzma @@ -32,6 +32,7 @@ DisableReadyPage=yes [Files] Flags: ignoreversion; Source: win32\bin\Release\xmlwf.exe; DestDir: "{app}\Bin" Flags: ignoreversion; Source: win32\MANIFEST.txt; DestDir: "{app}" +Flags: ignoreversion; Source: AUTHORS; DestDir: "{app}"; DestName: AUTHORS.txt Flags: ignoreversion; Source: Changes; DestDir: "{app}"; DestName: Changes.txt Flags: ignoreversion; Source: COPYING; DestDir: "{app}"; DestName: COPYING.txt Flags: ignoreversion; Source: README; DestDir: "{app}"; DestName: README.txt @@ -40,40 +41,29 @@ Flags: ignoreversion; Source: doc\*.css; DestDir: "{app}\Doc" Flags: ignoreversion; Source: doc\*.png; DestDir: "{app}\Doc" Flags: ignoreversion; Source: win32\bin\Release\*.dll; DestDir: "{app}\Bin" Flags: ignoreversion; Source: win32\bin\Release\*.lib; DestDir: "{app}\Bin" -Flags: ignoreversion; Source: expat.dsw; DestDir: "{app}\Source" Flags: ignoreversion; Source: expat.sln; DestDir: "{app}\Source" Flags: ignoreversion; Source: win32\README.txt; DestDir: "{app}\Source" -Flags: ignoreversion; Source: bcb5\*.bp*; DestDir: "{app}\Source\bcb5" -Flags: ignoreversion; Source: bcb5\*.mak; DestDir: "{app}\Source\bcb5" -Flags: ignoreversion; Source: bcb5\*.def; DestDir: "{app}\Source\bcb5" -Flags: ignoreversion; Source: bcb5\*.txt; DestDir: "{app}\Source\bcb5" -Flags: ignoreversion; Source: bcb5\*.bat; DestDir: "{app}\Source\bcb5" Flags: ignoreversion; Source: lib\*.c; DestDir: "{app}\Source\lib" Flags: ignoreversion; Source: lib\*.h; DestDir: "{app}\Source\lib" Flags: ignoreversion; Source: lib\*.def; DestDir: "{app}\Source\lib" -Flags: ignoreversion; Source: lib\*.dsp; DestDir: "{app}\Source\lib" Flags: ignoreversion; Source: lib\*.vcxproj; DestDir: "{app}\Source\lib" Flags: ignoreversion; Source: lib\*.vcxproj.filters; DestDir: "{app}\Source\lib" Flags: ignoreversion; Source: examples\*.c; DestDir: "{app}\Source\examples" -Flags: ignoreversion; Source: examples\*.dsp; DestDir: "{app}\Source\examples" Flags: ignoreversion; Source: examples\*.vcxproj; DestDir: "{app}\Source\examples" Flags: ignoreversion; Source: examples\*.vcxproj.filters; DestDir: "{app}\Source\examples" Flags: ignoreversion; Source: tests\*.c; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\*.cpp; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\*.h; DestDir: "{app}\Source\tests" -Flags: ignoreversion; Source: tests\*.ds*; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\*.sln; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\*.vcxproj; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\*.vcxproj.filters; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\README.txt; DestDir: "{app}\Source\tests" Flags: ignoreversion; Source: tests\benchmark\*.c; DestDir: "{app}\Source\tests\benchmark" -Flags: ignoreversion; Source: tests\benchmark\*.ds*; DestDir: "{app}\Source\tests\benchmark" Flags: ignoreversion; Source: tests\benchmark\*.sln; DestDir: "{app}\Source\tests\benchmark" Flags: ignoreversion; Source: tests\benchmark\*.vcxproj; DestDir: "{app}\Source\tests\benchmark" Flags: ignoreversion; Source: tests\benchmark\README.txt; DestDir: "{app}\Source\tests\benchmark" Flags: ignoreversion; Source: xmlwf\*.c*; DestDir: "{app}\Source\xmlwf" Flags: ignoreversion; Source: xmlwf\*.h; DestDir: "{app}\Source\xmlwf" -Flags: ignoreversion; Source: xmlwf\*.dsp; DestDir: "{app}\Source\xmlwf" Flags: ignoreversion; Source: xmlwf\*.vcxproj; DestDir: "{app}\Source\xmlwf" Flags: ignoreversion; Source: xmlwf\*.vcxproj.filters; DestDir: "{app}\Source\xmlwf" diff --git a/src/expat/xmlwf/codepage.c b/src/expat/xmlwf/codepage.c index 91bd15e96f..7d78f21e6a 100644 --- a/src/expat/xmlwf/codepage.c +++ b/src/expat/xmlwf/codepage.c @@ -5,7 +5,7 @@ #include "codepage.h" #include "internal.h" /* for UNUSED_P only */ -#if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__))) +#if defined(_WIN32) #define STRICT 1 #define WIN32_LEAN_AND_MEAN 1 @@ -52,7 +52,7 @@ codepageConvert(int cp, const char *p) return -1; } -#else /* not WIN32 */ +#else /* not _WIN32 */ int codepageMap(int UNUSED_P(cp), int *UNUSED_P(map)) @@ -66,4 +66,4 @@ codepageConvert(int UNUSED_P(cp), const char *UNUSED_P(p)) return -1; } -#endif /* not WIN32 */ +#endif /* not _WIN32 */ diff --git a/src/expat/xmlwf/filemap.h b/src/expat/xmlwf/filemap.h index 814edec252..db83d1a036 100644 --- a/src/expat/xmlwf/filemap.h +++ b/src/expat/xmlwf/filemap.h @@ -2,8 +2,20 @@ See the file COPYING for copying permission. */ +#include /* INT_MAX */ #include + +/* The following limit (for XML_Parse's int len) derives from + * this loop in xmparse.c: + * + * do { + * bufferSize = (int) (2U * (unsigned) bufferSize); + * } while (bufferSize < neededSize && bufferSize > 0); + */ +#define XML_MAX_CHUNK_LEN (INT_MAX / 2 + 1) + + #ifdef XML_UNICODE int filemap(const wchar_t *name, void (*processor)(const void *, size_t, diff --git a/src/expat/xmlwf/readfilemap.c b/src/expat/xmlwf/readfilemap.c index d816b263aa..fc540e56af 100644 --- a/src/expat/xmlwf/readfilemap.c +++ b/src/expat/xmlwf/readfilemap.c @@ -9,16 +9,8 @@ #include /* Functions close(2) and read(2) */ -#ifdef __WATCOMC__ -#ifndef __LINUX__ -#include -#else -#include -#endif -#else -# if !defined(WIN32) && !defined(_WIN32) && !defined(_WIN64) -# include -# endif +#if !defined(_WIN32) && !defined(_WIN64) +# include #endif #ifndef S_ISREG @@ -48,7 +40,7 @@ filemap(const char *name, { size_t nbytes; int fd; - int n; + ssize_t n; struct stat sb; void *p; @@ -67,6 +59,11 @@ filemap(const char *name, close(fd); return 0; } + if (sb.st_size > XML_MAX_CHUNK_LEN) { + close(fd); + return 2; /* Cannot be passed to XML_Parse in one go */ + } + nbytes = sb.st_size; /* malloc will return NULL with nbytes == 0, handle files with size 0 */ if (nbytes == 0) { @@ -88,7 +85,7 @@ filemap(const char *name, close(fd); return 0; } - if (n != nbytes) { + if (n != (ssize_t)nbytes) { fprintf(stderr, "%s: read unexpected number of bytes\n", name); free(p); close(fd); diff --git a/src/expat/xmlwf/unixfilemap.c b/src/expat/xmlwf/unixfilemap.c index e13299da05..8783134c64 100644 --- a/src/expat/xmlwf/unixfilemap.c +++ b/src/expat/xmlwf/unixfilemap.c @@ -42,6 +42,10 @@ filemap(const char *name, fprintf(stderr, "%s: not a regular file\n", name); return 0; } + if (sb.st_size > XML_MAX_CHUNK_LEN) { + close(fd); + return 2; /* Cannot be passed to XML_Parse in one go */ + } nbytes = sb.st_size; /* mmap fails for zero length files */ diff --git a/src/expat/xmlwf/win32filemap.c b/src/expat/xmlwf/win32filemap.c index d1fe3f0d3d..6be4596223 100644 --- a/src/expat/xmlwf/win32filemap.c +++ b/src/expat/xmlwf/win32filemap.c @@ -42,11 +42,12 @@ filemap(const TCHAR *name, size = GetFileSize(f, &sizeHi); if (size == (DWORD)-1) { win32perror(name); + CloseHandle(f); return 0; } - if (sizeHi) { - _ftprintf(stderr, wxT("%s: bigger than 2Gb\n"), name); - return 0; + if (sizeHi || (size > XML_MAX_CHUNK_LEN)) { + CloseHandle(f); + return 2; /* Cannot be passed to XML_Parse in one go */ } /* CreateFileMapping barfs on zero length files */ if (size == 0) { @@ -87,10 +88,10 @@ win32perror(const TCHAR *s) (LPTSTR) &buf, 0, NULL)) { - _ftprintf(stderr, wxT("%s: %s"), s, buf); + _ftprintf(stderr, _T("%s: %s"), s, buf); fflush(stderr); LocalFree(buf); } else - _ftprintf(stderr, wxT("%s: unknown Windows error\n"), s); + _ftprintf(stderr, _T("%s: unknown Windows error\n"), s); } diff --git a/src/expat/xmlwf/xmlfile.c b/src/expat/xmlwf/xmlfile.c index 2f769aa894..6473c6e190 100644 --- a/src/expat/xmlwf/xmlfile.c +++ b/src/expat/xmlwf/xmlfile.c @@ -8,17 +8,11 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" #elif defined(HAVE_EXPAT_CONFIG_H) #include -#endif /* ndef WIN32 */ +#endif /* ndef _WIN32 */ #include "expat.h" #include "internal.h" /* for UNUSED_P only */ @@ -26,14 +20,10 @@ #include "xmltchar.h" #include "filemap.h" -#if (defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__LINUX__))) +#if defined(_MSC_VER) #include #endif -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - #ifdef HAVE_UNISTD_H #include #endif @@ -58,6 +48,9 @@ typedef struct { int *retPtr; } PROCESS_ARGS; +static int +processStream(const XML_Char *filename, XML_Parser parser); + static void reportError(XML_Parser parser, const XML_Char *filename) { @@ -88,7 +81,7 @@ processFile(const void *data, size_t size, *retPtr = 1; } -#if (defined(WIN32) || defined(__WATCOMC__)) +#if defined(_WIN32) static int isAsciiLetter(XML_Char c) @@ -96,7 +89,7 @@ isAsciiLetter(XML_Char c) return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z')); } -#endif /* WIN32 */ +#endif /* _WIN32 */ static const XML_Char * resolveSystemId(const XML_Char *base, const XML_Char *systemId, @@ -106,7 +99,7 @@ resolveSystemId(const XML_Char *base, const XML_Char *systemId, *toFree = 0; if (!base || *systemId == T('/') -#if (defined(WIN32) || defined(__WATCOMC__)) +#if defined(_WIN32) || *systemId == T('\\') || (isAsciiLetter(systemId[0]) && systemId[1] == T(':')) #endif @@ -120,7 +113,7 @@ resolveSystemId(const XML_Char *base, const XML_Char *systemId, s = *toFree; if (tcsrchr(s, T('/'))) s = tcsrchr(s, T('/')) + 1; -#if (defined(WIN32) || defined(__WATCOMC__)) +#if defined(_WIN32) if (tcsrchr(s, T('\\'))) s = tcsrchr(s, T('\\')) + 1; #endif @@ -139,13 +132,23 @@ externalEntityRefFilemap(XML_Parser parser, XML_Char *s; const XML_Char *filename; XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); + int filemapRes; PROCESS_ARGS args; args.retPtr = &result; args.parser = entParser; filename = resolveSystemId(base, systemId, &s); XML_SetBase(entParser, filename); - if (!filemap(filename, processFile, &args)) + filemapRes = filemap(filename, processFile, &args); + switch (filemapRes) { + case 0: result = 0; + break; + case 2: + ftprintf(stderr, T("%s: file too large for memory-mapping") + T(", switching to streaming\n"), filename); + result = processStream(filename, entParser); + break; + } free(s); XML_ParserFree(entParser); return result; @@ -233,11 +236,21 @@ XML_ProcessFile(XML_Parser parser, ? externalEntityRefFilemap : externalEntityRefStream); if (flags & XML_MAP_FILE) { + int filemapRes; PROCESS_ARGS args; args.retPtr = &result; args.parser = parser; - if (!filemap(filename, processFile, &args)) + filemapRes = filemap(filename, processFile, &args); + switch (filemapRes) { + case 0: result = 0; + break; + case 2: + ftprintf(stderr, T("%s: file too large for memory-mapping") + T(", switching to streaming\n"), filename); + result = processStream(filename, parser); + break; + } } else result = processStream(filename, parser); diff --git a/src/expat/xmlwf/xmlwf.c b/src/expat/xmlwf/xmlwf.c index 66d6c9ef4b..7581c0780f 100644 --- a/src/expat/xmlwf/xmlwf.c +++ b/src/expat/xmlwf/xmlwf.c @@ -17,10 +17,6 @@ #include #endif -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - /* This ensures proper sorting. */ #define NSSEP T('\001') @@ -608,7 +604,7 @@ showVersion(XML_Char *prog) const XML_Feature *features = XML_GetFeatureList(); while ((ch = *s) != 0) { if (ch == '/' -#if (defined(WIN32) || defined(__WATCOMC__)) +#if defined(_WIN32) || ch == '\\' #endif ) @@ -785,7 +781,7 @@ tmain(int argc, XML_Char **argv) const XML_Char * lastDelim = tcsrchr(file, delim[0]); if (lastDelim) file = lastDelim + 1; -#if (defined(WIN32) || defined(__WATCOMC__)) +#if defined(_WIN32) else { const XML_Char * winDelim = T("\\"); lastDelim = tcsrchr(file, winDelim[0]); diff --git a/src/expat/xmlwf/xmlwin32url.cxx b/src/expat/xmlwf/xmlwin32url.cxx index b64c33d7e1..bbfcce22c9 100644 --- a/src/expat/xmlwf/xmlwin32url.cxx +++ b/src/expat/xmlwf/xmlwin32url.cxx @@ -127,13 +127,13 @@ reportError(XML_Parser parser) int code = XML_GetErrorCode(parser); const XML_Char *message = XML_ErrorString(code); if (message) - _ftprintf(stderr, wxT("%s:%d:%ld: %s\n"), + _ftprintf(stderr, _T("%s:%d:%ld: %s\n"), XML_GetBase(parser), XML_GetErrorLineNumber(parser), XML_GetErrorColumnNumber(parser), message); else - _ftprintf(stderr, wxT("%s: (unknown message %d)\n"), + _ftprintf(stderr, _T("%s: (unknown message %d)\n"), XML_GetBase(parser), code); } @@ -183,7 +183,7 @@ Callback::OnDataAvailable(DWORD grfBSCF, nToRead = READ_MAX; void *buf = XML_GetBuffer(parser_, nToRead); if (!buf) { - _ftprintf(stderr, wxT("out of memory\n")); + _ftprintf(stderr, _T("out of memory\n")); return E_ABORT; } DWORD nRead; @@ -329,12 +329,12 @@ winPerror(const XML_Char *url, HRESULT hr) 0, NULL)) { /* The system error messages seem to end with a newline. */ - _ftprintf(stderr, wxT("%s: %s"), url, buf); + _ftprintf(stderr, _T("%s: %s"), url, buf); fflush(stderr); LocalFree(buf); } else - _ftprintf(stderr, wxT("%s: error %x\n"), url, hr); + _ftprintf(stderr, _T("%s: error %x\n"), url, hr); } static void