Vendor import of expat 2.2.9

This commit is contained in:
Xin LI
2019-11-24 23:46:29 +00:00
parent 77c85705a6
commit 987ba809b8
62 changed files with 13353 additions and 14394 deletions
+156
View File
@@ -2,6 +2,162 @@ NOTE: We are looking for help with a few things:
https://github.com/libexpat/libexpat/labels/help%20wanted https://github.com/libexpat/libexpat/labels/help%20wanted
If you can help, please get in touch. Thanks! If you can help, please get in touch. Thanks!
Release 2.2.9 Wed Septemper 25 2019
Other changes:
examples: Drop executable bits from elements.c
#349 Windows: Change the name of the Windows DLLs from expat*.dll
to libexpat*.dll once more (regression from 2.2.8, first
fixed in 1.95.3, issue #61 on SourceForge today,
was issue #432456 back then); needs a fix due
case-insensitive file systems on Windows and the fact that
Perl's XML::Parser::Expat compiles into Expat.dll.
#347 Windows: Only define _CRT_RAND_S if not defined
Version info bumped from 7:10:6 to 7:11:6
Special thanks to:
Ben Wagner
Release 2.2.8 Fri Septemper 13 2019
Security fixes:
#317 #318 CVE-2019-15903 -- Fix heap overflow triggered by
XML_GetCurrentLineNumber (or XML_GetCurrentColumnNumber),
and deny internal entities closing the doctype;
fixed in commit c20b758c332d9a13afbbb276d30db1d183a85d43
Bug fixes:
#240 Fix cases where XML_StopParser did not have any effect
when called from inside of an end element handler
#341 xmlwf: Fix exit code for operation without "-d DIRECTORY";
previously, only "-d DIRECTORY" would give you a proper
exit code:
# xmlwf -d . <<<'<not well-formed>' 2>/dev/null ; echo $?
2
# xmlwf <<<'<not well-formed>' 2>/dev/null ; echo $?
0
Now both cases return exit code 2.
Other changes:
#299 #302 Windows: Replace LoadLibrary hack to access
unofficial API function SystemFunction036 (RtlGenRandom)
by using official API function rand_s (needs WinXP+)
#325 Windows: Drop support for Visual Studio <=7.1/2003
and document supported compilers in README.md
#286 Windows: Remove COM code from xmlwf; in case it turns
out needed later, there will be a dedicated repository
below https://github.com/libexpat/ for that code
#322 Windows: Remove explicit MSVC solution and project files.
You can generate Visual Studio solution files through
CMake, e.g.: cmake -G"Visual Studio 15 2017" .
#338 xmlwf: Make "xmlwf -h" help output more friendly
#339 examples: Improve elements.c
#244 #264 Autotools: Add argument --enable-xml-attr-info
#239 #301 Autotools: Add arguments
--with-getrandom
--without-getrandom
--with-sys-getrandom
--without-sys-getrandom
#312 #343 Autotools: Fix linking issues with "./configure LD=clang"
Autotools: Fix "make run-xmltest" for out-of-source builds
#329 #336 CMake: Pull all options from Expat <=2.2.7 into namespace
prefix EXPAT_ with the exception of DOCBOOK_TO_MAN:
- BUILD_doc -> EXPAT_BUILD_DOCS (plural)
- BUILD_examples -> EXPAT_BUILD_EXAMPLES
- BUILD_shared -> EXPAT_SHARED_LIBS
- BUILD_tests -> EXPAT_BUILD_TESTS
- BUILD_tools -> EXPAT_BUILD_TOOLS
- DOCBOOK_TO_MAN -> DOCBOOK_TO_MAN (unchanged)
- INSTALL -> EXPAT_ENABLE_INSTALL
- MSVC_USE_STATIC_CRT -> EXPAT_MSVC_STATIC_CRT
- USE_libbsd -> EXPAT_WITH_LIBBSD
- WARNINGS_AS_ERRORS -> EXPAT_WARNINGS_AS_ERRORS
- XML_CONTEXT_BYTES -> EXPAT_CONTEXT_BYTES
- XML_DEV_URANDOM -> EXPAT_DEV_URANDOM
- XML_DTD -> EXPAT_DTD
- XML_NS -> EXPAT_NS
- XML_UNICODE -> EXPAT_CHAR_TYPE=ushort (!)
- XML_UNICODE_WCHAR_T -> EXPAT_CHAR_TYPE=wchar_t (!)
#244 #264 CMake: Add argument -DEXPAT_ATTR_INFO=(ON|OFF),
default OFF
#326 CMake: Add argument -DEXPAT_LARGE_SIZE=(ON|OFF),
default OFF
#328 CMake: Add argument -DEXPAT_MIN_SIZE=(ON|OFF),
default OFF
#239 #277 CMake: Add arguments
-DEXPAT_WITH_GETRANDOM=(ON|OFF|AUTO), default AUTO
-DEXPAT_WITH_SYS_GETRANDOM=(ON|OFF|AUTO), default AUTO
#326 CMake: Install expat_config.h to include directory
#326 CMake: Generate and install configuration files for
future find_package(expat [..] CONFIG [..])
CMake: Now produces a summary of applied configuration
CMake: Require C++ compiler only when tests are enabled
#330 CMake: Fix compilation for 16bit character types,
i.e. ex -DXML_UNICODE=ON (and ex -DXML_UNICODE_WCHAR_T=ON)
#265 CMake: Fix linking with MinGW
#330 CMake: Add full support for MinGW; to enable, use
-DCMAKE_TOOLCHAIN_FILE=[expat]/cmake/mingw-toolchain.cmake
#330 CMake: Port "make run-xmltest" from GNU Autotools to CMake
#316 CMake: Windows: Make binary postfix match MSVC
Old: expat[d].lib
New: expat[w][d][MD|MT].lib
CMake: Migrate files from Windows to Unix line endings
#308 CMake: Integrate OSS-Fuzz fuzzers, option
-DEXPAT_BUILD_FUZZERS=(ON|OFF), default OFF
#14 Drop an OpenVMS support leftover
#235 #268 ..
#270 #310 ..
#313 #331 #333 Address compiler warnings
#282 #283 ..
#284 #285 Address cppcheck warnings
#294 #295 Address Clang Static Analyzer warnings
#24 #293 Mass-apply clang-format 9 (and ensure conformance during CI)
Version info bumped from 7:9:6 to 7:10:6
Special thanks to:
David Loffredo
Joonun Jang
Khajapasha Mohammed
Kishore Kunche
Marco Maggi
Mitch Phillips
Rolf Ade
xantares
Zhongyuan Zhou
Release 2.2.7 Wed June 19 2019
Security fixes:
#186 #262 CVE-2018-20843 -- Fix extraction of namespace prefixes from
XML names; XML names with multiple colons could end up in
the wrong namespace, and take a high amount of RAM and CPU
resources while processing, opening the door to
use for denial-of-service attacks
Other changes:
#195 #197 Autotools/CMake: Utilize -fvisibility=hidden to stop
exporting non-API symbols
#227 Autotools: Add --without-examples and --without-tests
#228 Autotools: Modernize configure.ac
#245 #246 Autotools: Fix check for -fvisibility=hidden for Clang
#247 #248 Autotools: Fix compilation for lack of docbook2x-man
#236 #258 Autotools: Produce .tar.{gz,lz,xz} release archives
#212 CMake: Make libdir of pkgconfig expat.pc support multilib
#158 #263 CMake: Build man page in PROJECT_BINARY_DIR not _SOURCE_DIR
#219 Remove fallback to bcopy, assume that memmove(3) exists
#257 Use portable "/usr/bin/env bash" shebang (e.g. for OpenBSD)
#243 Windows: Fix syntax of .def module definition files
Version info bumped from 7:8:6 to 7:9:6
Special thanks to:
Benjamin Peterson
Caolán McNamara
Hanno Böck
KangLin
Kishore Kunche
Marco Maggi
Rhodri James
Sebastian Dröge
userwithuid
Yury Gribov
Release 2.2.6 Sun August 12 2018 Release 2.2.6 Sun August 12 2018
Bug fixes: Bug fixes:
#170 #206 Avoid doing arithmetic with NULL pointers in XML_GetBuffer #170 #206 Avoid doing arithmetic with NULL pointers in XML_GetBuffer
+1
View File
@@ -8,6 +8,7 @@
*.pc.in *.pc.in
*.vcxproj* *.vcxproj*
*config.h *config.h
cmake
CMake* CMake*
Configure* Configure*
amiga amiga
+39 -38
View File
@@ -30,14 +30,21 @@
AUTOMAKE_OPTIONS = \ AUTOMAKE_OPTIONS = \
dist-bzip2 \ dist-bzip2 \
dist-lzip \
dist-xz \
foreign \ foreign \
no-dist-gzip \
subdir-objects subdir-objects
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
LIBTOOLFLAGS = --verbose LIBTOOLFLAGS = --verbose
SUBDIRS = lib examples tests # lib goes first to build first SUBDIRS = lib # lib goes first to build first
if WITH_EXAMPLES
SUBDIRS += examples
endif
if WITH_TESTS
SUBDIRS += tests
endif
if WITH_XMLWF if WITH_XMLWF
SUBDIRS += xmlwf doc SUBDIRS += xmlwf doc
endif endif
@@ -47,41 +54,19 @@ pkgconfigdir = $(libdir)/pkgconfig
_EXTRA_DIST_CMAKE = \ _EXTRA_DIST_CMAKE = \
cmake/expat-config.cmake.in \
cmake/mingw-toolchain.cmake \
\
CMakeLists.txt \ CMakeLists.txt \
CMake.README \ CMake.README \
ConfigureChecks.cmake \ ConfigureChecks.cmake \
expat_config.h.cmake expat_config.h.cmake
_EXTRA_DIST_WINDOWS = \ _EXTRA_DIST_WINDOWS = \
examples/elements.vcxproj \ win32/build_expat_iss.bat \
examples/elements.vcxproj.filters \
examples/outline.vcxproj \
examples/outline.vcxproj.filters \
\
lib/expat_static.vcxproj \
lib/expat_static.vcxproj.filters \
lib/expat.vcxproj \
lib/expat.vcxproj.filters \
lib/expatw_static.vcxproj \
lib/expatw_static.vcxproj.filters \
lib/expatw.vcxproj \
lib/expatw.vcxproj.filters \
\
tests/benchmark/benchmark.sln \
tests/benchmark/benchmark.vcxproj \
\
tests/runtests.sln \
tests/runtests.vcxproj \
tests/runtests.vcxproj.filters \
\
win32/expat.iss \ win32/expat.iss \
win32/MANIFEST.txt \ win32/MANIFEST.txt \
win32/README.txt \ win32/README.txt
\
xmlwf/xmlwf.vcxproj \
xmlwf/xmlwf.vcxproj.filters \
\
expat.sln
EXTRA_DIST = \ EXTRA_DIST = \
$(_EXTRA_DIST_CMAKE) \ $(_EXTRA_DIST_CMAKE) \
@@ -91,8 +76,13 @@ EXTRA_DIST = \
conftools/get-version.sh \ conftools/get-version.sh \
conftools/PrintPath \ conftools/PrintPath \
\ \
xmlwf/xmlwf_helpgen.py \
xmlwf/xmlwf_helpgen.sh \
\
Changes \ Changes \
README.md \ README.md \
\
fix-xmltest-log.sh \
test-driver-wrapper.sh test-driver-wrapper.sh
@@ -121,7 +111,8 @@ run-benchmark:
$(MAKE) -C tests/benchmark $(MAKE) -C tests/benchmark
./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3 ./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3
tests/xmlts.zip: .PHONY: download-xmlts-zip
download-xmlts-zip:
if test "$(XMLTS_ZIP)" = ""; then \ if test "$(XMLTS_ZIP)" = ""; then \
wget --output-document=tests/xmlts.zip \ wget --output-document=tests/xmlts.zip \
https://www.w3.org/XML/Test/xmlts20080827.zip; \ https://www.w3.org/XML/Test/xmlts20080827.zip; \
@@ -129,16 +120,26 @@ tests/xmlts.zip:
cp $(XMLTS_ZIP) tests/xmlts.zip; \ cp $(XMLTS_ZIP) tests/xmlts.zip; \
fi fi
tests/xmlconf: tests/xmlts.zip tests/xmlts.zip:
$(MAKE) download-xmlts-zip
.PHONY: extract-xmlts-zip
extract-xmlts-zip: tests/xmlts.zip
[ -f $(builddir)/tests/xmlts.zip ] || $(MAKE) download-xmlts-zip # vpath workaround
cd tests && unzip -q xmlts.zip cd tests && unzip -q xmlts.zip
tests/xmlconf: tests/xmlts.zip
$(MAKE) extract-xmlts-zip
.PHONY: run-xmltest .PHONY: run-xmltest
run-xmltest: tests/xmlconf run-xmltest: tests/xmlconf
if WITH_XMLWF if WITH_XMLWF
[ -d $(builddir)/tests/xmlconf ] || $(MAKE) extract-xmlts-zip # vpath workaround
$(MAKE) -C lib
$(MAKE) -C xmlwf $(MAKE) -C xmlwf
tests/xmltest.sh "$(PWD)/run.sh $(PWD)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee tests/xmltest.log $(srcdir)/tests/xmltest.sh "$(abs_builddir)/run.sh $(abs_builddir)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee $(builddir)/tests/xmltest.log
dos2unix tests/xmltest.log $(srcdir)/fix-xmltest-log.sh $(builddir)/tests/xmltest.log
diff -u tests/xmltest.log.expected tests/xmltest.log diff -u $(srcdir)/tests/xmltest.log.expected $(builddir)/tests/xmltest.log
else else
@echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2 @echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2
@echo 'ERROR: Please re-configure without --without-xmlwf.' >&2 @echo 'ERROR: Please re-configure without --without-xmlwf.' >&2
@@ -147,7 +148,7 @@ endif
.PHONY: qa .PHONY: qa
qa: qa:
./qa.sh address QA_COMPILER=clang QA_SANITIZER=address ./qa.sh
./qa.sh memory QA_COMPILER=clang QA_SANITIZER=memory ./qa.sh
./qa.sh undefined QA_COMPILER=clang QA_SANITIZER=undefined ./qa.sh
./qa.sh coverage QA_COMPILER=gcc QA_PROCESSOR=gcov ./qa.sh
+60 -53
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am. # Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc. # Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@@ -118,13 +118,22 @@ PRE_UNINSTALL = :
POST_UNINSTALL = : POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
@WITH_XMLWF_TRUE@am__append_1 = xmlwf doc @WITH_EXAMPLES_TRUE@am__append_1 = examples
@WITH_TESTS_TRUE@am__append_2 = tests
@WITH_XMLWF_TRUE@am__append_3 = xmlwf doc
subdir = . subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \ $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
@@ -199,7 +208,7 @@ am__recursive_targets = \
$(RECURSIVE_CLEAN_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets) $(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck cscope distdir distdir-am dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)expat_config.h.in $(LISP)expat_config.h.in
# Read a list of newline-separated strings from the standard input, # Read a list of newline-separated strings from the standard input,
@@ -224,14 +233,15 @@ CSCOPE = cscope
DIST_SUBDIRS = lib examples tests xmlwf doc DIST_SUBDIRS = lib examples tests xmlwf doc
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/expat.pc.in \ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/expat.pc.in \
$(srcdir)/expat_config.h.in $(srcdir)/run.sh.in \ $(srcdir)/expat_config.h.in $(srcdir)/run.sh.in \
$(top_srcdir)/conftools/compile \ $(top_srcdir)/conftools/ar-lib $(top_srcdir)/conftools/compile \
$(top_srcdir)/conftools/config.guess \ $(top_srcdir)/conftools/config.guess \
$(top_srcdir)/conftools/config.sub \ $(top_srcdir)/conftools/config.sub \
$(top_srcdir)/conftools/install-sh \ $(top_srcdir)/conftools/install-sh \
$(top_srcdir)/conftools/ltmain.sh \ $(top_srcdir)/conftools/ltmain.sh \
$(top_srcdir)/conftools/missing AUTHORS COPYING \ $(top_srcdir)/conftools/missing AUTHORS COPYING \
conftools/compile conftools/config.guess conftools/config.sub \ conftools/ar-lib conftools/compile conftools/config.guess \
conftools/install-sh conftools/ltmain.sh conftools/missing conftools/config.sub conftools/depcomp conftools/install-sh \
conftools/ltmain.sh conftools/missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION) distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir) top_distdir = $(distdir)
@@ -267,9 +277,10 @@ am__relativize = \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \ done; \
reldir="$$dir2" reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).tar.lz \
$(distdir).tar.xz
GZIP_ENV = --best GZIP_ENV = --best
DIST_ARCHIVES = $(distdir).tar.bz2 DIST_TARGETS = dist-lzip dist-xz dist-bzip2 dist-gzip
DIST_TARGETS = dist-bzip2
distuninstallcheck_listfiles = find . -type f -print distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
@@ -402,51 +413,30 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = \ AUTOMAKE_OPTIONS = \
dist-bzip2 \ dist-bzip2 \
dist-lzip \
dist-xz \
foreign \ foreign \
no-dist-gzip \
subdir-objects subdir-objects
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
LIBTOOLFLAGS = --verbose LIBTOOLFLAGS = --verbose
SUBDIRS = lib examples tests $(am__append_1) SUBDIRS = lib $(am__append_1) $(am__append_2) $(am__append_3)
pkgconfig_DATA = expat.pc pkgconfig_DATA = expat.pc
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
_EXTRA_DIST_CMAKE = \ _EXTRA_DIST_CMAKE = \
cmake/expat-config.cmake.in \
cmake/mingw-toolchain.cmake \
\
CMakeLists.txt \ CMakeLists.txt \
CMake.README \ CMake.README \
ConfigureChecks.cmake \ ConfigureChecks.cmake \
expat_config.h.cmake expat_config.h.cmake
_EXTRA_DIST_WINDOWS = \ _EXTRA_DIST_WINDOWS = \
examples/elements.vcxproj \ win32/build_expat_iss.bat \
examples/elements.vcxproj.filters \
examples/outline.vcxproj \
examples/outline.vcxproj.filters \
\
lib/expat_static.vcxproj \
lib/expat_static.vcxproj.filters \
lib/expat.vcxproj \
lib/expat.vcxproj.filters \
lib/expatw_static.vcxproj \
lib/expatw_static.vcxproj.filters \
lib/expatw.vcxproj \
lib/expatw.vcxproj.filters \
\
tests/benchmark/benchmark.sln \
tests/benchmark/benchmark.vcxproj \
\
tests/runtests.sln \
tests/runtests.vcxproj \
tests/runtests.vcxproj.filters \
\
win32/expat.iss \ win32/expat.iss \
win32/MANIFEST.txt \ win32/MANIFEST.txt \
win32/README.txt \ win32/README.txt
\
xmlwf/xmlwf.vcxproj \
xmlwf/xmlwf.vcxproj.filters \
\
expat.sln
EXTRA_DIST = \ EXTRA_DIST = \
$(_EXTRA_DIST_CMAKE) \ $(_EXTRA_DIST_CMAKE) \
@@ -456,8 +446,13 @@ EXTRA_DIST = \
conftools/get-version.sh \ conftools/get-version.sh \
conftools/PrintPath \ conftools/PrintPath \
\ \
xmlwf/xmlwf_helpgen.py \
xmlwf/xmlwf_helpgen.sh \
\
Changes \ Changes \
README.md \ README.md \
\
fix-xmltest-log.sh \
test-driver-wrapper.sh test-driver-wrapper.sh
all: expat_config.h all: expat_config.h
@@ -485,8 +480,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' $(SHELL) ./config.status'; \ echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \ $(SHELL) ./config.status;; \
*) \ *) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
esac; esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -653,7 +648,10 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES) distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
$(am__remove_distdir) $(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)" test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -723,11 +721,9 @@ dist-gzip: distdir
dist-bzip2: distdir dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir) $(am__post_remove_distdir)
dist-lzip: distdir dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir) $(am__post_remove_distdir)
dist-xz: distdir dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir) $(am__post_remove_distdir)
@@ -994,7 +990,8 @@ run-benchmark:
$(MAKE) -C tests/benchmark $(MAKE) -C tests/benchmark
./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3 ./run.sh tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3
tests/xmlts.zip: .PHONY: download-xmlts-zip
download-xmlts-zip:
if test "$(XMLTS_ZIP)" = ""; then \ if test "$(XMLTS_ZIP)" = ""; then \
wget --output-document=tests/xmlts.zip \ wget --output-document=tests/xmlts.zip \
https://www.w3.org/XML/Test/xmlts20080827.zip; \ https://www.w3.org/XML/Test/xmlts20080827.zip; \
@@ -1002,25 +999,35 @@ tests/xmlts.zip:
cp $(XMLTS_ZIP) tests/xmlts.zip; \ cp $(XMLTS_ZIP) tests/xmlts.zip; \
fi fi
tests/xmlconf: tests/xmlts.zip tests/xmlts.zip:
$(MAKE) download-xmlts-zip
.PHONY: extract-xmlts-zip
extract-xmlts-zip: tests/xmlts.zip
[ -f $(builddir)/tests/xmlts.zip ] || $(MAKE) download-xmlts-zip # vpath workaround
cd tests && unzip -q xmlts.zip cd tests && unzip -q xmlts.zip
tests/xmlconf: tests/xmlts.zip
$(MAKE) extract-xmlts-zip
.PHONY: run-xmltest .PHONY: run-xmltest
run-xmltest: tests/xmlconf run-xmltest: tests/xmlconf
@WITH_XMLWF_TRUE@ [ -d $(builddir)/tests/xmlconf ] || $(MAKE) extract-xmlts-zip # vpath workaround
@WITH_XMLWF_TRUE@ $(MAKE) -C lib
@WITH_XMLWF_TRUE@ $(MAKE) -C xmlwf @WITH_XMLWF_TRUE@ $(MAKE) -C xmlwf
@WITH_XMLWF_TRUE@ tests/xmltest.sh "$(PWD)/run.sh $(PWD)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee tests/xmltest.log @WITH_XMLWF_TRUE@ $(srcdir)/tests/xmltest.sh "$(abs_builddir)/run.sh $(abs_builddir)/xmlwf/xmlwf@EXEEXT@" 2>&1 | tee $(builddir)/tests/xmltest.log
@WITH_XMLWF_TRUE@ dos2unix tests/xmltest.log @WITH_XMLWF_TRUE@ $(srcdir)/fix-xmltest-log.sh $(builddir)/tests/xmltest.log
@WITH_XMLWF_TRUE@ diff -u tests/xmltest.log.expected tests/xmltest.log @WITH_XMLWF_TRUE@ diff -u $(srcdir)/tests/xmltest.log.expected $(builddir)/tests/xmltest.log
@WITH_XMLWF_FALSE@ @echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2 @WITH_XMLWF_FALSE@ @echo 'ERROR: xmlwf is needed for "make run-xmltest".' >&2
@WITH_XMLWF_FALSE@ @echo 'ERROR: Please re-configure without --without-xmlwf.' >&2 @WITH_XMLWF_FALSE@ @echo 'ERROR: Please re-configure without --without-xmlwf.' >&2
@WITH_XMLWF_FALSE@ @false @WITH_XMLWF_FALSE@ @false
.PHONY: qa .PHONY: qa
qa: qa:
./qa.sh address QA_COMPILER=clang QA_SANITIZER=address ./qa.sh
./qa.sh memory QA_COMPILER=clang QA_SANITIZER=memory ./qa.sh
./qa.sh undefined QA_COMPILER=clang QA_SANITIZER=undefined ./qa.sh
./qa.sh coverage QA_COMPILER=gcc QA_PROCESSOR=gcov ./qa.sh
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.
+63 -1
View File
@@ -1,8 +1,9 @@
[![Travis CI Build Status](https://travis-ci.org/libexpat/libexpat.svg?branch=master)](https://travis-ci.org/libexpat/libexpat) [![Travis CI Build Status](https://travis-ci.org/libexpat/libexpat.svg?branch=master)](https://travis-ci.org/libexpat/libexpat)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/libexpat/libexpat?svg=true)](https://ci.appveyor.com/project/libexpat/libexpat) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/libexpat/libexpat?svg=true)](https://ci.appveyor.com/project/libexpat/libexpat)
[![Packaging status](https://repology.org/badge/tiny-repos/expat.svg)](https://repology.org/metapackage/expat/versions)
# Expat, Release 2.2.6 # Expat, Release 2.2.9
This is Expat, a C library for parsing XML, started by This is Expat, a C library for parsing XML, started by
[James Clark](https://en.wikipedia.org/wiki/James_Clark_(programmer)) in 1997. [James Clark](https://en.wikipedia.org/wiki/James_Clark_(programmer)) in 1997.
@@ -12,6 +13,11 @@ are called when the parser discovers the associated structures in the
document being parsed. A start tag is an example of the kind of document being parsed. A start tag is an example of the kind of
structures for which you may register handlers. structures for which you may register handlers.
Expat supports the following compilers:
- GNU GCC >=4.5
- LLVM Clang >=3.5
- Microsoft Visual Studio >=8.0/2005
Windows users should use the Windows users should use the
[`expat_win32` package](https://sourceforge.net/projects/expat/files/expat_win32/), [`expat_win32` package](https://sourceforge.net/projects/expat/files/expat_win32/),
which includes both precompiled libraries and executables, and source code for which includes both precompiled libraries and executables, and source code for
@@ -124,3 +130,59 @@ information.
A reference manual is available in the file `doc/reference.html` in this A reference manual is available in the file `doc/reference.html` in this
distribution. distribution.
The CMake build system is still *experimental* and will replace the primary
build system based on GNU Autotools at some point when it is ready.
For an idea of the available (non-advanced) options for building with CMake:
```console
# rm -f CMakeCache.txt ; cmake -D_EXPAT_HELP=ON -LH . | grep -B1 ':.*=' | sed 's,^--$,,'
// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...
CMAKE_BUILD_TYPE:STRING=
// Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/usr/local
// Path to a program.
DOCBOOK_TO_MAN:FILEPATH=/usr/bin/docbook2x-man
// build man page for xmlwf
EXPAT_BUILD_DOCS:BOOL=ON
// build the examples for expat library
EXPAT_BUILD_EXAMPLES:BOOL=ON
// build fuzzers for the expat library
EXPAT_BUILD_FUZZERS:BOOL=OFF
// build the tests for expat library
EXPAT_BUILD_TESTS:BOOL=ON
// build the xmlwf tool for expat library
EXPAT_BUILD_TOOLS:BOOL=ON
// Character type to use (char|ushort|wchar_t) [default=char]
EXPAT_CHAR_TYPE:STRING=char
// install expat files in cmake install target
EXPAT_ENABLE_INSTALL:BOOL=ON
// Use /MT flag (static CRT) when compiling in MSVC
EXPAT_MSVC_STATIC_CRT:BOOL=OFF
// build a shared expat library
EXPAT_SHARED_LIBS:BOOL=ON
// Treat all compiler warnings as errors
EXPAT_WARNINGS_AS_ERRORS:BOOL=OFF
// Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]
EXPAT_WITH_GETRANDOM:STRING=AUTO
// utilize libbsd (for arc4random_buf)
EXPAT_WITH_LIBBSD:BOOL=OFF
// Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]
EXPAT_WITH_SYS_GETRANDOM:STRING=AUTO
```
+160 -105
View File
@@ -10,8 +10,8 @@ dnl under the terms of the License (based on the MIT/X license) contained
dnl in the file COPYING that comes with this distribution. dnl in the file COPYING that comes with this distribution.
dnl dnl
dnl Ensure that Expat is configured with autoconf 2.58 or newer dnl Ensure that Expat is configured with autoconf 2.69 or newer.
AC_PREREQ(2.58) AC_PREREQ(2.69)
dnl Get the version number of Expat, using m4's esyscmd() command to run dnl Get the version number of Expat, using m4's esyscmd() command to run
dnl the command at m4-generation time. This allows us to create an m4 dnl the command at m4-generation time. This allows us to create an m4
@@ -23,16 +23,18 @@ dnl
dnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate dnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate
dnl test. I believe this test will work, but I don't have a place with non- dnl test. I believe this test will work, but I don't have a place with non-
dnl GNU M4 to test it right now. dnl GNU M4 to test it right now.
define([expat_version], ifdef([__gnu__], m4_define([expat_version],
m4_ifdef([__gnu__],
[esyscmd(conftools/get-version.sh lib/expat.h)], [esyscmd(conftools/get-version.sh lib/expat.h)],
[2.2.x])) [2.2.x]))
AC_INIT(expat, expat_version, expat-bugs@libexpat.org) AC_INIT(expat, expat_version, expat-bugs@libexpat.org)
undefine([expat_version]) m4_undefine([expat_version])
AC_CONFIG_SRCDIR(Makefile.in) AC_CONFIG_SRCDIR([Makefile.in])
AC_CONFIG_AUX_DIR(conftools) AC_CONFIG_AUX_DIR([conftools])
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
dnl dnl
@@ -47,79 +49,119 @@ dnl If the API changes incompatibly set LIBAGE back to 0
dnl dnl
LIBCURRENT=7 # sync LIBCURRENT=7 # sync
LIBREVISION=8 # with LIBREVISION=11 # with
LIBAGE=6 # CMakeLists.txt! LIBAGE=6 # CMakeLists.txt!
CPPFLAGS="${CPPFLAGS} -DHAVE_EXPAT_CONFIG_H" AX_APPEND_FLAG([-DHAVE_EXPAT_CONFIG_H], [CPPFLAGS])
AC_CONFIG_HEADER(expat_config.h) AC_CONFIG_HEADER([expat_config.h])
sinclude(conftools/ac_c_bigendian_cross.m4) AM_PROG_AR
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_LIBTOOL_WIN32_DLL LT_PREREQ([2.4])
AC_PROG_LIBTOOL LT_INIT([win32-dll])
AC_SUBST(LIBCURRENT) AC_SUBST(LIBCURRENT)
AC_SUBST(LIBREVISION) AC_SUBST(LIBREVISION)
AC_SUBST(LIBAGE) AC_SUBST(LIBAGE)
dnl Checks for programs. AC_LANG([C])
AC_PROG_CC_C99 AC_PROG_CC_C99
AC_PROG_CXX AS_IF([test "$GCC" = yes],
AC_PROG_INSTALL [AX_APPEND_COMPILE_FLAGS([-Wall -Wextra], [CFLAGS])
if test "$GCC" = yes ; then
dnl
dnl Be careful about adding the -fexceptions option; some versions of dnl Be careful about adding the -fexceptions option; some versions of
dnl GCC don't support it and it causes extra warnings that are only dnl GCC don't support it and it causes extra warnings that are only
dnl distracting; avoid. dnl distracting; avoid.
dnl AX_APPEND_COMPILE_FLAGS([-fexceptions], [CFLAGS])
OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing -Wmissing-prototypes -Wstrict-prototypes], [CFLAGS])
CFLAGS="$OLDCFLAGS -fexceptions" AX_APPEND_COMPILE_FLAGS([-pedantic -Wduplicated-cond -Wduplicated-branches -Wlogical-op], [CFLAGS])
AC_MSG_CHECKING(whether $CC accepts -fexceptions) AX_APPEND_COMPILE_FLAGS([-Wrestrict -Wnull-dereference -Wjump-misses-init -Wdouble-promotion], [CFLAGS])
AC_TRY_LINK( , , AX_APPEND_COMPILE_FLAGS([-Wshadow -Wformat=2 -Wmisleading-indentation], [CFLAGS])])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
if test "x$CXXFLAGS" = x ; then
CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
fi
CFLAGS="${CFLAGS} -fno-strict-aliasing" AC_LANG_PUSH([C++])
CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing" AC_PROG_CXX
LDFLAGS="${LDFLAGS} -fno-strict-aliasing" AS_IF([test "$GCC" = yes],
fi [AX_APPEND_COMPILE_FLAGS([-Wall -Wextra], [CXXFLAGS])
dnl Be careful about adding the -fexceptions option; some versions of
dnl GCC don't support it and it causes extra warnings that are only
dnl distracting; avoid.
AX_APPEND_COMPILE_FLAGS([-fexceptions], [CXXFLAGS])
AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing], [CXXFLAGS])])
AC_LANG_POP([C++])
AS_IF([test "$GCC" = yes],
[AX_APPEND_LINK_FLAGS([-fno-strict-aliasing],[LDFLAGS])])
dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang (issue #312)
AS_CASE(["$LD"],[*clang*],
[AS_CASE(["${host_os}"],
[*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
EXPATCFG_COMPILER_SUPPORTS_VISIBILITY([
AX_APPEND_FLAG([-fvisibility=hidden], [CFLAGS])
AX_APPEND_FLAG([-DXML_ENABLE_VISIBILITY=1], [CFLAGS])])
dnl Checks for header files. dnl Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
dnl Checks for typedefs, structures, and compiler characteristics. dnl Checks for typedefs, structures, and compiler characteristics.
dnl Note: Avoid using AC_C_BIGENDIAN because it does not dnl We define BYTEORDER to 1234 when the platform is little endian; it
dnl work in a cross compile. dnl defines it to 4321 when the platform is big endian. We also define
AC_C_BIGENDIAN_CROSS dnl WORDS_BIGENDIAN to 1 when the platform is big endian.
dnl
dnl A long time ago (early 2000 years) AC_C_BIGENDIAN was considered
dnl wrong when cross compiling, now (2018, GNU Autoconf 2.69) we assume
dnl it is fine.
AC_C_BIGENDIAN([AC_DEFINE([WORDS_BIGENDIAN], 1)
AS_VAR_SET([BYTEORDER], 4321)],
[AS_VAR_SET([BYTEORDER], 1234)])
AC_DEFINE_UNQUOTED([BYTEORDER], $BYTEORDER, [1234 = LILENDIAN, 4321 = BIGENDIAN])
AC_C_CONST AC_C_CONST
AC_TYPE_SIZE_T AC_TYPE_SIZE_T
AC_CHECK_FUNCS(memmove bcopy)
AC_ARG_WITH([xmlwf],
AC_ARG_WITH([xmlwf], [ [AS_HELP_STRING([--without-xmlwf], [do not build xmlwf])],
AS_HELP_STRING([--without-xmlwf], [do not build xmlwf])], [], [with_xmlwf=yes]) [],
[with_xmlwf=yes])
AM_CONDITIONAL([WITH_XMLWF], [test x${with_xmlwf} = xyes]) AM_CONDITIONAL([WITH_XMLWF], [test x${with_xmlwf} = xyes])
AM_CONDITIONAL([MINGW], [echo -- "${host}" | ${FGREP} mingw >/dev/null]) AC_ARG_WITH([examples],
[AS_HELP_STRING([--without-examples], [do not build examples @<:@default=included@:>@])],
[],
[with_examples=yes])
AM_CONDITIONAL([WITH_EXAMPLES], [test x${with_examples} = xyes])
AC_ARG_WITH([tests],
[AS_HELP_STRING([--without-tests], [do not build tests @<:@default=included@:>@])],
[],
[with_tests=yes])
AM_CONDITIONAL([WITH_TESTS], [test x${with_tests} = xyes])
AS_VAR_SET([EXPATCFG_ON_MINGW],[no])
AS_CASE("${host_os}",
[mingw*],
[AS_VAR_SET([EXPATCFG_ON_MINGW],[yes])
AC_MSG_NOTICE([detected OS: MinGW])])
AM_CONDITIONAL([MINGW], [test x${EXPATCFG_ON_MINGW} = xyes])
AM_CONDITIONAL([UNICODE], [echo -- "${CPPFLAGS}${CFLAGS}" | ${FGREP} XML_UNICODE >/dev/null]) AM_CONDITIONAL([UNICODE], [echo -- "${CPPFLAGS}${CFLAGS}" | ${FGREP} XML_UNICODE >/dev/null])
AC_ARG_WITH([libbsd], [ AC_ARG_WITH([libbsd],
AS_HELP_STRING([--with-libbsd], [utilize libbsd (for arc4random_buf)]) [AS_HELP_STRING([--with-libbsd], [utilize libbsd (for arc4random_buf)])],
], [], [with_libbsd=no]) [],
AS_IF([test "x${with_libbsd}" != xno], [ [with_libbsd=no])
AC_CHECK_LIB([bsd], [arc4random_buf], [], [ AS_IF([test "x${with_libbsd}" != xno],
AS_IF([test "x${with_libbsd}" = xyes], [ [AC_CHECK_LIB([bsd],
AC_MSG_ERROR([Enforced use of libbsd cannot be satisfied.]) [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_MSG_CHECKING([for arc4random_buf (BSD or libbsd)])
AC_LINK_IFELSE([AC_LANG_SOURCE([ AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h> /* for arc4random_buf on BSD, for NULL */ #include <stdlib.h> /* for arc4random_buf on BSD, for NULL */
@@ -130,12 +172,10 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([
arc4random_buf(NULL, 0U); arc4random_buf(NULL, 0U);
return 0; return 0;
} }
])], [ ])],
AC_DEFINE([HAVE_ARC4RANDOM_BUF], [1], [AC_DEFINE([HAVE_ARC4RANDOM_BUF], [1], [Define to 1 if you have the `arc4random_buf' function.])
[Define to 1 if you have the `arc4random_buf' function.]) AC_MSG_RESULT([yes])],
AC_MSG_RESULT([yes]) [AC_MSG_RESULT([no])
], [
AC_MSG_RESULT([no])
AC_MSG_CHECKING([for arc4random (BSD, macOS or libbsd)]) AC_MSG_CHECKING([for arc4random (BSD, macOS or libbsd)])
AC_LINK_IFELSE([AC_LANG_SOURCE([ AC_LINK_IFELSE([AC_LANG_SOURCE([
@@ -148,31 +188,44 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([
arc4random(); arc4random();
return 0; return 0;
} }
])], [ ])],
AC_DEFINE([HAVE_ARC4RANDOM], [1], [AC_DEFINE([HAVE_ARC4RANDOM], [1], [Define to 1 if you have the `arc4random' function.])
[Define to 1 if you have the `arc4random' function.]) AC_MSG_RESULT([yes])],
AC_MSG_RESULT([yes]) [AC_MSG_RESULT([no])])])
], [
AC_MSG_RESULT([no])
])
])
AC_ARG_WITH([getrandom],
[AS_HELP_STRING([--with-getrandom],
[enforce the use of getrandom function in the system @<:@default=check@:>@])
AS_HELP_STRING([--without-getrandom],
[skip auto detect of getrandom @<:@default=check@:>@])],
[],
[with_getrandom=check])
AC_MSG_CHECKING([for getrandom (Linux 3.17+, glibc 2.25+)]) AS_IF([test "x$with_getrandom" != xno],
AC_LINK_IFELSE([AC_LANG_SOURCE([ [AC_MSG_CHECKING([for getrandom (Linux 3.17+, glibc 2.25+)])
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h> /* for NULL */ #include <stdlib.h> /* for NULL */
#include <sys/random.h> #include <sys/random.h>
int main() { int main() {
return getrandom(NULL, 0U, 0U); return getrandom(NULL, 0U, 0U);
} }
])], [ ])],
AC_DEFINE([HAVE_GETRANDOM], [1], [AC_DEFINE([HAVE_GETRANDOM], [1], [Define to 1 if you have the `getrandom' function.])
[Define to 1 if you have the `getrandom' function.]) AC_MSG_RESULT([yes])],
AC_MSG_RESULT([yes]) [AC_MSG_RESULT([no])
], [ AS_IF([test "x$with_getrandom" = xyes],
AC_MSG_RESULT([no]) [AC_MSG_ERROR([enforced the use of getrandom --with-getrandom, but not detected])])])])
AC_MSG_CHECKING([for syscall SYS_getrandom (Linux 3.17+)]) AC_ARG_WITH([sys_getrandom],
[AS_HELP_STRING([--with-sys-getrandom],
[enforce the use of syscall SYS_getrandom function in the system @<:@default=check@:>@])
AS_HELP_STRING([--without-sys-getrandom],
[skip auto detect of syscall SYS_getrandom @<:@default=check@:>@])],
[],
[with_sys_getrandom=check])
AS_IF([test "x$with_sys_getrandom" != xno],
[AC_MSG_CHECKING([for syscall SYS_getrandom (Linux 3.17+)])
AC_LINK_IFELSE([AC_LANG_SOURCE([ AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <stdlib.h> /* for NULL */ #include <stdlib.h> /* for NULL */
#include <unistd.h> /* for syscall */ #include <unistd.h> /* for syscall */
@@ -181,26 +234,21 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([
syscall(SYS_getrandom, NULL, 0, 0); syscall(SYS_getrandom, NULL, 0, 0);
return 0; return 0;
} }
])], [ ])],
AC_DEFINE([HAVE_SYSCALL_GETRANDOM], [1], [AC_DEFINE([HAVE_SYSCALL_GETRANDOM], [1], [Define to 1 if you have `syscall' and `SYS_getrandom'.])
[Define to 1 if you have `syscall' and `SYS_getrandom'.]) AC_MSG_RESULT([yes])],
AC_MSG_RESULT([yes]) [AC_MSG_RESULT([no])
], [ AS_IF([test "x$with_sys_getrandom" = xyes],
AC_MSG_RESULT([no]) [AC_MSG_ERROR([enforced the use of syscall SYS_getrandom --with-sys-getrandom, but not detected])])])])
])
])
dnl Only needed for xmlwf: dnl Only needed for xmlwf:
AC_CHECK_HEADERS(fcntl.h unistd.h) AC_CHECK_HEADERS(fcntl.h unistd.h)
AC_TYPE_OFF_T AC_TYPE_OFF_T
AC_FUNC_MMAP AC_FUNC_MMAP
if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then AS_IF([test "$ac_cv_func_mmap_fixed_mapped" = "yes"],
FILEMAP=unixfilemap [AS_VAR_SET(FILEMAP,unixfilemap)],
else [AS_VAR_SET(FILEMAP,readfilemap)])
FILEMAP=readfilemap
fi
AC_SUBST(FILEMAP) AC_SUBST(FILEMAP)
@@ -212,6 +260,15 @@ AC_DEFINE([XML_DTD], 1,
AC_DEFINE([XML_DEV_URANDOM], 1, AC_DEFINE([XML_DEV_URANDOM], 1,
[Define to include code reading entropy from `/dev/urandom'.]) [Define to include code reading entropy from `/dev/urandom'.])
AC_ARG_ENABLE([xml-attr-info],
[AS_HELP_STRING([--enable-xml-attr-info],
[Enable retrieving the byte offsets for attribute names and values @<:@default=no@:>@])],
[],
[enable_xml_attr_info=no])
AS_IF([test "x${enable_xml_attr_info}" = "xyes"],
[AC_DEFINE([XML_ATTR_INFO], 1,
[Define to allow retrieving the byte offsets for attribute names and values.])])
AC_ARG_ENABLE([xml-context], AC_ARG_ENABLE([xml-context],
AS_HELP_STRING([--enable-xml-context @<:@COUNT@:>@], AS_HELP_STRING([--enable-xml-context @<:@COUNT@:>@],
[Retain context around the current parse point; [Retain context around the current parse point;
@@ -219,16 +276,15 @@ AC_ARG_ENABLE([xml-context],
AS_HELP_STRING([--disable-xml-context], AS_HELP_STRING([--disable-xml-context],
[Do not retain context around the current parse point]), [Do not retain context around the current parse point]),
[enable_xml_context=${enableval}]) [enable_xml_context=${enableval}])
AS_IF([test "x${enable_xml_context}" != "xno"], [ AS_IF([test "x${enable_xml_context}" != "xno"],
AS_IF([test "x${enable_xml_context}" = "xyes" \ [AS_IF([test "x${enable_xml_context}" = "xyes" \
-o "x${enable_xml_context}" = "x"], [ -o "x${enable_xml_context}" = "x"],
enable_xml_context=1024 [AS_VAR_SET(enable_xml_context,1024)])
])
AC_DEFINE_UNQUOTED([XML_CONTEXT_BYTES], [${enable_xml_context}], AC_DEFINE_UNQUOTED([XML_CONTEXT_BYTES], [${enable_xml_context}],
[Define to specify how much context to retain around the current parse point.]) [Define to specify how much context to retain around the current parse point.])])
])
AC_ARG_WITH([docbook], [AS_HELP_STRING([--with-docbook], AC_ARG_WITH([docbook],
[AS_HELP_STRING([--with-docbook],
[enforce XML to man page compilation @<:@default=check@:>@]) [enforce XML to man page compilation @<:@default=check@:>@])
AS_HELP_STRING([--without-docbook], AS_HELP_STRING([--without-docbook],
[skip XML to man page compilation @<:@default=check@:>@])], [skip XML to man page compilation @<:@default=check@:>@])],
@@ -251,14 +307,13 @@ AS_IF([test "x${DOCBOOK_TO_MAN}" != x -a "x$with_docbook" != xno],
AM_CONDITIONAL(WITH_DOCBOOK, [test "x${DOCBOOK_TO_MAN}" != x]) AM_CONDITIONAL(WITH_DOCBOOK, [test "x${DOCBOOK_TO_MAN}" != x])
AC_CONFIG_FILES([Makefile expat.pc]) AC_CONFIG_FILES([Makefile]
AC_CONFIG_FILES([ [expat.pc]
doc/Makefile [doc/Makefile]
examples/Makefile [examples/Makefile]
lib/Makefile [lib/Makefile]
tests/Makefile [tests/Makefile]
tests/benchmark/Makefile [tests/benchmark/Makefile]
xmlwf/Makefile [xmlwf/Makefile])
])
AC_CONFIG_FILES([run.sh], [chmod +x run.sh]) AC_CONFIG_FILES([run.sh], [chmod +x run.sh])
AC_OUTPUT AC_OUTPUT
+4 -1
View File
@@ -28,14 +28,17 @@
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE. # USE OR OTHER DEALINGS IN THE SOFTWARE.
.PHONY: dist-hook # not inside conditional to avoid automake warning
if WITH_DOCBOOK
dist_man_MANS = xmlwf.1 dist_man_MANS = xmlwf.1
xmlwf.1: xmlwf.xml xmlwf.1: xmlwf.xml
if WITH_DOCBOOK
-rm -f $@ -rm -f $@
$(DOCBOOK_TO_MAN) $< $(DOCBOOK_TO_MAN) $<
test -f $@ || mv XMLWF.1 $@ test -f $@ || mv XMLWF.1 $@
else else
dist-hook:
@echo 'ERROR: Configure with --with-docbook for "make dist".' 1>&2 @echo 'ERROR: Configure with --with-docbook for "make dist".' 1>&2
@false @false
endif endif
+36 -19
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am. # Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc. # Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@@ -122,7 +122,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \ $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
@@ -310,7 +317,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
dist_man_MANS = xmlwf.1 @WITH_DOCBOOK_TRUE@dist_man_MANS = xmlwf.1
EXTRA_DIST = \ EXTRA_DIST = \
expat.png \ expat.png \
reference.html \ reference.html \
@@ -338,8 +345,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \ *config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \ *) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac; esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -405,8 +412,12 @@ ctags CTAGS:
cscope cscopelist: cscope cscopelist:
@WITH_DOCBOOK_TRUE@dist-hook:
distdir: $(DISTFILES) distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \ list='$(DISTFILES)'; \
@@ -436,6 +447,9 @@ distdir: $(DISTFILES)
|| exit 1; \ || exit 1; \
fi; \ fi; \
done done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
check-am: all-am check-am: all-am
check: check-am check: check-am
all-am: Makefile $(MANS) all-am: Makefile $(MANS)
@@ -544,25 +558,28 @@ uninstall-man: uninstall-man1
.MAKE: install-am install-strip .MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \ .PHONY: all all-am check check-am clean clean-generic clean-libtool \
clean-local cscopelist-am ctags-am distclean distclean-generic \ clean-local cscopelist-am ctags-am dist-hook distclean \
distclean-libtool distdir dvi dvi-am html html-am info info-am \ distclean-generic distclean-libtool distdir dvi dvi-am html \
install install-am install-data install-data-am install-dvi \ html-am info info-am install install-am install-data \
install-dvi-am install-exec install-exec-am install-html \ install-data-am install-dvi install-dvi-am install-exec \
install-html-am install-info install-info-am install-man \ install-exec-am install-html install-html-am install-info \
install-man1 install-pdf install-pdf-am install-ps \ install-info-am install-man install-man1 install-pdf \
install-ps-am install-strip installcheck installcheck-am \ install-pdf-am install-ps install-ps-am install-strip \
installdirs maintainer-clean maintainer-clean-generic \ installcheck installcheck-am installdirs maintainer-clean \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ maintainer-clean-generic mostlyclean mostlyclean-generic \
ps ps-am tags-am uninstall uninstall-am uninstall-man \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
uninstall-man1 uninstall-am uninstall-man uninstall-man1
.PRECIOUS: Makefile .PRECIOUS: Makefile
xmlwf.1: xmlwf.xml .PHONY: dist-hook # not inside conditional to avoid automake warning
@WITH_DOCBOOK_TRUE@xmlwf.1: xmlwf.xml
@WITH_DOCBOOK_TRUE@ -rm -f $@ @WITH_DOCBOOK_TRUE@ -rm -f $@
@WITH_DOCBOOK_TRUE@ $(DOCBOOK_TO_MAN) $< @WITH_DOCBOOK_TRUE@ $(DOCBOOK_TO_MAN) $<
@WITH_DOCBOOK_TRUE@ test -f $@ || mv XMLWF.1 $@ @WITH_DOCBOOK_TRUE@ test -f $@ || mv XMLWF.1 $@
@WITH_DOCBOOK_FALSE@dist-hook:
@WITH_DOCBOOK_FALSE@ @echo 'ERROR: Configure with --with-docbook for "make dist".' 1>&2 @WITH_DOCBOOK_FALSE@ @echo 'ERROR: Configure with --with-docbook for "make dist".' 1>&2
@WITH_DOCBOOK_FALSE@ @false @WITH_DOCBOOK_FALSE@ @false
+6 -4
View File
@@ -276,9 +276,11 @@ directions or Unix directions below.</p>
<p>If you're using the GNU compiler under cygwin, follow the Unix <p>If you're using the GNU compiler under cygwin, follow the Unix
directions in the next section. Otherwise if you have Microsoft's directions in the next section. Otherwise if you have Microsoft's
Developer Studio installed, then from Windows Explorer double-click on Developer Studio installed,
"expat.vcxproj" in the lib directory and build and install in the usual you can use CMake to generate a <code>.sln</code> file, e.g.
manner.</p> <code>
cmake -G"Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=RelWithDebInfo .
</code>, and build Expat using <code>msbuild /m expat.sln</code> after.</p>
<p>Alternatively, you may download the Win32 binary package that <p>Alternatively, you may download the Win32 binary package that
contains the "expat.h" include file and a pre-built DLL.</p> contains the "expat.h" include file and a pre-built DLL.</p>
@@ -2152,7 +2154,7 @@ function behavior. In order to have an effect this must be called
before parsing has started. Returns 1 if successful, 0 when called before parsing has started. Returns 1 if successful, 0 when called
after <code>XML_Parse</code> or <code>XML_ParseBuffer</code>. after <code>XML_Parse</code> or <code>XML_ParseBuffer</code>.
<p><b>Note:</b>This call is optional, as the parser will auto-generate <p><b>Note:</b>This call is optional, as the parser will auto-generate
a new random salt value if no value has been set at the start of parsing. a new random salt value if no value has been set at the start of parsing.</p>
<p><b>Note:</b>One should not call <code>XML_SetHashSalt</code> with a <p><b>Note:</b>One should not call <code>XML_SetHashSalt</code> with a
hash salt value of 0, as this value is used as sentinel value to indicate hash salt value of 0, as this value is used as sentinel value to indicate
that <code>XML_SetHashSalt</code> has <b>not</b> been called. Consequently that <code>XML_SetHashSalt</code> has <b>not</b> been called. Consequently
+33 -14
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am. # Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc. # Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@@ -124,7 +124,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \ $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
@@ -158,7 +165,8 @@ am__v_at_0 = @
am__v_at_1 = am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
am__depfiles_maybe = depfiles am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/elements.Po ./$(DEPDIR)/outline.Po
am__mv = mv -f am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -359,8 +367,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \ *config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \ *) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac; esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -395,8 +403,14 @@ mostlyclean-compile:
distclean-compile: distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elements.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elements.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/outline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/outline.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o: .c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -477,7 +491,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags: distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES) distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \ list='$(DISTFILES)'; \
@@ -547,7 +564,8 @@ clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
mostlyclean-am mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -rf ./$(DEPDIR) -rm -f ./$(DEPDIR)/elements.Po
-rm -f ./$(DEPDIR)/outline.Po
-rm -f Makefile -rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \ distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags distclean-tags
@@ -593,7 +611,8 @@ install-ps-am:
installcheck-am: installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR) -rm -f ./$(DEPDIR)/elements.Po
-rm -f ./$(DEPDIR)/outline.Po
-rm -f Makefile -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -614,9 +633,9 @@ uninstall-am:
.MAKE: install-am install-strip .MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \
ctags-am distclean distclean-compile distclean-generic \ ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \ distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \ html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \ install-data-am install-dvi install-dvi-am install-exec \
+6 -13
View File
@@ -38,11 +38,7 @@
#include <expat.h> #include <expat.h>
#ifdef XML_LARGE_SIZE #ifdef XML_LARGE_SIZE
# if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
# define XML_FMT_INT_MOD "I64"
# else
# define XML_FMT_INT_MOD "ll" # define XML_FMT_INT_MOD "ll"
# endif
#else #else
# define XML_FMT_INT_MOD "l" # define XML_FMT_INT_MOD "l"
#endif #endif
@@ -55,8 +51,7 @@
#endif #endif
static void XMLCALL static void XMLCALL
startElement(void *userData, const XML_Char *name, const XML_Char **atts) startElement(void *userData, const XML_Char *name, const XML_Char **atts) {
{
int i; int i;
int *depthPtr = (int *)userData; int *depthPtr = (int *)userData;
(void)atts; (void)atts;
@@ -68,8 +63,7 @@ startElement(void *userData, const XML_Char *name, const XML_Char **atts)
} }
static void XMLCALL static void XMLCALL
endElement(void *userData, const XML_Char *name) endElement(void *userData, const XML_Char *name) {
{
int *depthPtr = (int *)userData; int *depthPtr = (int *)userData;
(void)name; (void)name;
@@ -77,8 +71,7 @@ endElement(void *userData, const XML_Char *name)
} }
int int
main(int argc, char *argv[]) main(int argc, char *argv[]) {
{
char buf[BUFSIZ]; char buf[BUFSIZ];
XML_Parser parser = XML_ParserCreate(NULL); XML_Parser parser = XML_ParserCreate(NULL);
int done; int done;
@@ -92,13 +85,13 @@ main(int argc, char *argv[])
size_t len = fread(buf, 1, sizeof(buf), stdin); size_t len = fread(buf, 1, sizeof(buf), stdin);
done = len < sizeof(buf); done = len < sizeof(buf);
if (XML_Parse(parser, buf, (int)len, done) == XML_STATUS_ERROR) { if (XML_Parse(parser, buf, (int)len, done) == XML_STATUS_ERROR) {
fprintf(stderr, fprintf(stderr, "%" XML_FMT_STR " at line %" XML_FMT_INT_MOD "u\n",
"%" XML_FMT_STR " at line %" XML_FMT_INT_MOD "u\n",
XML_ErrorString(XML_GetErrorCode(parser)), XML_ErrorString(XML_GetErrorCode(parser)),
XML_GetCurrentLineNumber(parser)); XML_GetCurrentLineNumber(parser));
XML_ParserFree(parser);
return 1; return 1;
} }
} while (!done); } while (! done);
XML_ParserFree(parser); XML_ParserFree(parser);
return 0; return 0;
} }
+3 -10
View File
@@ -36,11 +36,7 @@
#include <expat.h> #include <expat.h>
#ifdef XML_LARGE_SIZE #ifdef XML_LARGE_SIZE
# if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
# define XML_FMT_INT_MOD "I64"
# else
# define XML_FMT_INT_MOD "ll" # define XML_FMT_INT_MOD "ll"
# endif
#else #else
# define XML_FMT_INT_MOD "l" # define XML_FMT_INT_MOD "l"
#endif #endif
@@ -58,8 +54,7 @@ char Buff[BUFFSIZE];
int Depth; int Depth;
static void XMLCALL static void XMLCALL
start(void *data, const XML_Char *el, const XML_Char **attr) start(void *data, const XML_Char *el, const XML_Char **attr) {
{
int i; int i;
(void)data; (void)data;
@@ -77,8 +72,7 @@ start(void *data, const XML_Char *el, const XML_Char **attr)
} }
static void XMLCALL static void XMLCALL
end(void *data, const XML_Char *el) end(void *data, const XML_Char *el) {
{
(void)data; (void)data;
(void)el; (void)el;
@@ -86,8 +80,7 @@ end(void *data, const XML_Char *el)
} }
int int
main(int argc, char *argv[]) main(int argc, char *argv[]) {
{
XML_Parser p = XML_ParserCreate(NULL); XML_Parser p = XML_ParserCreate(NULL);
(void)argc; (void)argc;
(void)argv; (void)argv;
+19 -9
View File
@@ -1,6 +1,9 @@
/* expat_config.h.in. Generated from configure.ac by autoheader. */ /* expat_config.h.in. Generated from configure.ac by autoheader. */
/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ /* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* 1234 = LILENDIAN, 4321 = BIGENDIAN */
#undef BYTEORDER #undef BYTEORDER
/* Define to 1 if you have the `arc4random' function. */ /* Define to 1 if you have the `arc4random' function. */
@@ -9,9 +12,6 @@
/* Define to 1 if you have the `arc4random_buf' function. */ /* Define to 1 if you have the `arc4random_buf' function. */
#undef HAVE_ARC4RANDOM_BUF #undef HAVE_ARC4RANDOM_BUF
/* Define to 1 if you have the `bcopy' function. */
#undef HAVE_BCOPY
/* Define to 1 if you have the <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H #undef HAVE_DLFCN_H
@@ -30,9 +30,6 @@
/* Define to 1 if you have the `bsd' library (-lbsd). */ /* Define to 1 if you have the `bsd' library (-lbsd). */
#undef HAVE_LIBBSD #undef HAVE_LIBBSD
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #undef HAVE_MEMORY_H
@@ -96,8 +93,21 @@
/* Version number of package */ /* Version number of package */
#undef VERSION #undef VERSION
/* whether byteorder is bigendian */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
#undef WORDS_BIGENDIAN significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Define to allow retrieving the byte offsets for attribute names and values.
*/
#undef XML_ATTR_INFO
/* Define to specify how much context to retain around the current parse /* Define to specify how much context to retain around the current parse
point. */ point. */
+48
View File
@@ -0,0 +1,48 @@
#! /usr/bin/env bash
# __ __ _
# ___\ \/ /_ __ __ _| |_
# / _ \\ /| '_ \ / _` | __|
# | __// \| |_) | (_| | |_
# \___/_/\_\ .__/ \__,_|\__|
# |_| XML parser
#
# Copyright (c) 2019 Expat development team
# Licensed under the MIT license:
#
# 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.
set -e
filename="${1:-tests/xmltest.log}"
dos2unix "${filename}"
tempfile="$(mktemp)"
sed \
-e 's/^wine: Call .* msvcrt\.dll\._wperror, aborting$/ibm49i02.dtd: No such file or directory/' \
\
-e '/^wine: /d' \
-e '/^Application tried to create a window, but no driver could be loaded.$/d' \
-e '/^Make sure that your X server is running and that $DISPLAY is set correctly.$/d' \
-e '/^err:systray:initialize_systray Could not create tray window$/d' \
-e '/^In ibm\/invalid\/P49\/: Unhandled exception: unimplemented .\+/d' \
\
"${filename}" > "${tempfile}"
mv "${tempfile}" "${filename}"
-1
View File
@@ -40,7 +40,6 @@ libexpat_la_LDFLAGS = \
-version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@ -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@
libexpat_la_SOURCES = \ libexpat_la_SOURCES = \
loadlibrary.c \
xmlparse.c \ xmlparse.c \
xmltok.c \ xmltok.c \
xmlrole.c xmlrole.c
+38 -19
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am. # Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc. # Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@@ -125,7 +125,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \ $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
@@ -166,8 +173,7 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(docdir)" \
"$(DESTDIR)$(includedir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES) LTLIBRARIES = $(lib_LTLIBRARIES)
libexpat_la_LIBADD = libexpat_la_LIBADD =
am_libexpat_la_OBJECTS = loadlibrary.lo xmlparse.lo xmltok.lo \ am_libexpat_la_OBJECTS = xmlparse.lo xmltok.lo xmlrole.lo
xmlrole.lo
libexpat_la_OBJECTS = $(am_libexpat_la_OBJECTS) libexpat_la_OBJECTS = $(am_libexpat_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@) AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -190,7 +196,9 @@ am__v_at_0 = @
am__v_at_1 = am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
am__depfiles_maybe = depfiles am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/xmlparse.Plo ./$(DEPDIR)/xmlrole.Plo \
./$(DEPDIR)/xmltok.Plo
am__mv = mv -f am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -378,7 +386,6 @@ libexpat_la_LDFLAGS = \
-version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@ -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@
libexpat_la_SOURCES = \ libexpat_la_SOURCES = \
loadlibrary.c \
xmlparse.c \ xmlparse.c \
xmltok.c \ xmltok.c \
xmlrole.c xmlrole.c
@@ -428,8 +435,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \ *config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \ *) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac; esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -485,10 +492,15 @@ mostlyclean-compile:
distclean-compile: distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loadlibrary.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlparse.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlparse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrole.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlrole.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmltok.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmltok.Plo@am__quote@
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o: .c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -611,7 +623,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags: distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES) distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \ list='$(DISTFILES)'; \
@@ -684,7 +699,9 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -rf ./$(DEPDIR) -rm -f ./$(DEPDIR)/xmlparse.Plo
-rm -f ./$(DEPDIR)/xmlrole.Plo
-rm -f ./$(DEPDIR)/xmltok.Plo
-rm -f Makefile -rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \ distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags distclean-tags
@@ -731,7 +748,9 @@ install-ps-am:
installcheck-am: installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR) -rm -f ./$(DEPDIR)/xmlparse.Plo
-rm -f ./$(DEPDIR)/xmlrole.Plo
-rm -f ./$(DEPDIR)/xmltok.Plo
-rm -f Makefile -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -753,9 +772,9 @@ uninstall-am: uninstall-docDATA uninstall-includeHEADERS \
.MAKE: install-am install-data-am install-strip .MAKE: install-am install-data-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \
ctags-am distclean distclean-compile distclean-generic \ ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \ distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \ html-am info info-am install install-am install-data \
install-data-am install-data-hook install-docDATA install-dvi \ install-data-am install-data-hook install-docDATA install-dvi \
+31 -31
View File
@@ -31,34 +31,34 @@
*/ */
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, /* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
+55 -116
View File
@@ -33,15 +33,6 @@
#ifndef Expat_INCLUDED #ifndef Expat_INCLUDED
#define Expat_INCLUDED 1 #define Expat_INCLUDED 1
#ifdef __VMS
/* 0 1 2 3 0 1 2 3
1234567890123456789012345678901 1234567890123456789012345678901 */
#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler
#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler
#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler
#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg
#endif
#include <stdlib.h> #include <stdlib.h>
#include "expat_external.h" #include "expat_external.h"
@@ -53,8 +44,8 @@ struct XML_ParserStruct;
typedef struct XML_ParserStruct *XML_Parser; typedef struct XML_ParserStruct *XML_Parser;
typedef unsigned char XML_Bool; typedef unsigned char XML_Bool;
#define XML_TRUE ((XML_Bool) 1) #define XML_TRUE ((XML_Bool)1)
#define XML_FALSE ((XML_Bool) 0) #define XML_FALSE ((XML_Bool)0)
/* The XML_Status enum gives the possible return values for several /* The XML_Status enum gives the possible return values for several
API functions. The preprocessor #defines are included so this API functions. The preprocessor #defines are included so this
@@ -166,23 +157,21 @@ typedef struct XML_cp XML_Content;
struct XML_cp { struct XML_cp {
enum XML_Content_Type type; enum XML_Content_Type type;
enum XML_Content_Quant quant; enum XML_Content_Quant quant;
XML_Char * name; XML_Char *name;
unsigned int numchildren; unsigned int numchildren;
XML_Content * children; XML_Content *children;
}; };
/* This is called for an element declaration. See above for /* This is called for an element declaration. See above for
description of the model argument. It's the caller's responsibility description of the model argument. It's the caller's responsibility
to free model when finished with it. to free model when finished with it.
*/ */
typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData, typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData,
const XML_Char *name, const XML_Char *name,
XML_Content *model); XML_Content *model);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetElementDeclHandler(XML_Parser parser, XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl);
XML_ElementDeclHandler eldecl);
/* The Attlist declaration handler is called for *each* attribute. So /* The Attlist declaration handler is called for *each* attribute. So
a single Attlist declaration with multiple attributes declared will a single Attlist declaration with multiple attributes declared will
@@ -192,17 +181,12 @@ XML_SetElementDeclHandler(XML_Parser parser,
value will be NULL in the case of "#REQUIRED". If "isrequired" is value will be NULL in the case of "#REQUIRED". If "isrequired" is
true and default is non-NULL, then this is a "#FIXED" default. true and default is non-NULL, then this is a "#FIXED" default.
*/ */
typedef void (XMLCALL *XML_AttlistDeclHandler) ( typedef void(XMLCALL *XML_AttlistDeclHandler)(
void *userData, void *userData, const XML_Char *elname, const XML_Char *attname,
const XML_Char *elname, const XML_Char *att_type, const XML_Char *dflt, int isrequired);
const XML_Char *attname,
const XML_Char *att_type,
const XML_Char *dflt,
int isrequired);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetAttlistDeclHandler(XML_Parser parser, XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl);
XML_AttlistDeclHandler attdecl);
/* The XML declaration handler is called for *both* XML declarations /* The XML declaration handler is called for *both* XML declarations
and text declarations. The way to distinguish is that the version and text declarations. The way to distinguish is that the version
@@ -212,15 +196,13 @@ XML_SetAttlistDeclHandler(XML_Parser parser,
was no standalone parameter in the declaration, that it was given was no standalone parameter in the declaration, that it was given
as no, or that it was given as yes. as no, or that it was given as yes.
*/ */
typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, typedef void(XMLCALL *XML_XmlDeclHandler)(void *userData,
const XML_Char *version, const XML_Char *version,
const XML_Char *encoding, const XML_Char *encoding,
int standalone); int standalone);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetXmlDeclHandler(XML_Parser parser, XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl);
XML_XmlDeclHandler xmldecl);
typedef struct { typedef struct {
void *(*malloc_fcn)(size_t size); void *(*malloc_fcn)(size_t size);
@@ -248,7 +230,6 @@ XML_ParserCreate(const XML_Char *encoding);
XMLPARSEAPI(XML_Parser) XMLPARSEAPI(XML_Parser)
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
/* Constructs a new parser using the memory management suite referred to /* Constructs a new parser using the memory management suite referred to
by memsuite. If memsuite is NULL, then use the standard library memory by memsuite. If memsuite is NULL, then use the standard library memory
suite. If namespaceSeparator is non-NULL it creates a parser with suite. If namespaceSeparator is non-NULL it creates a parser with
@@ -278,31 +259,27 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encoding);
/* atts is array of name/value pairs, terminated by 0; /* atts is array of name/value pairs, terminated by 0;
names and values are 0 terminated. names and values are 0 terminated.
*/ */
typedef void (XMLCALL *XML_StartElementHandler) (void *userData, typedef void(XMLCALL *XML_StartElementHandler)(void *userData,
const XML_Char *name, const XML_Char *name,
const XML_Char **atts); const XML_Char **atts);
typedef void (XMLCALL *XML_EndElementHandler) (void *userData, typedef void(XMLCALL *XML_EndElementHandler)(void *userData,
const XML_Char *name); const XML_Char *name);
/* s is not 0 terminated. */ /* s is not 0 terminated. */
typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData, typedef void(XMLCALL *XML_CharacterDataHandler)(void *userData,
const XML_Char *s, const XML_Char *s, int len);
int len);
/* target and data are 0 terminated */ /* target and data are 0 terminated */
typedef void (XMLCALL *XML_ProcessingInstructionHandler) ( typedef void(XMLCALL *XML_ProcessingInstructionHandler)(void *userData,
void *userData,
const XML_Char *target, const XML_Char *target,
const XML_Char *data); const XML_Char *data);
/* data is 0 terminated */ /* data is 0 terminated */
typedef void (XMLCALL *XML_CommentHandler) (void *userData, typedef void(XMLCALL *XML_CommentHandler)(void *userData, const XML_Char *data);
const XML_Char *data);
typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData); typedef void(XMLCALL *XML_StartCdataSectionHandler)(void *userData);
typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); typedef void(XMLCALL *XML_EndCdataSectionHandler)(void *userData);
/* This is called for any characters in the XML document for which /* This is called for any characters in the XML document for which
there is no applicable handler. This includes both characters that there is no applicable handler. This includes both characters that
@@ -317,15 +294,13 @@ typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData);
default handler: for example, a comment might be split between default handler: for example, a comment might be split between
multiple calls. multiple calls.
*/ */
typedef void (XMLCALL *XML_DefaultHandler) (void *userData, typedef void(XMLCALL *XML_DefaultHandler)(void *userData, const XML_Char *s,
const XML_Char *s,
int len); int len);
/* This is called for the start of the DOCTYPE declaration, before /* This is called for the start of the DOCTYPE declaration, before
any DTD or internal subset is parsed. any DTD or internal subset is parsed.
*/ */
typedef void (XMLCALL *XML_StartDoctypeDeclHandler) ( typedef void(XMLCALL *XML_StartDoctypeDeclHandler)(void *userData,
void *userData,
const XML_Char *doctypeName, const XML_Char *doctypeName,
const XML_Char *sysid, const XML_Char *sysid,
const XML_Char *pubid, const XML_Char *pubid,
@@ -335,7 +310,7 @@ typedef void (XMLCALL *XML_StartDoctypeDeclHandler) (
closing > is encountered, but after processing any external closing > is encountered, but after processing any external
subset. subset.
*/ */
typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); typedef void(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
/* This is called for entity declarations. The is_parameter_entity /* This is called for entity declarations. The is_parameter_entity
argument will be non-zero if the entity is a parameter entity, zero argument will be non-zero if the entity is a parameter entity, zero
@@ -355,20 +330,14 @@ typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
Note that is_parameter_entity can't be changed to XML_Bool, since Note that is_parameter_entity can't be changed to XML_Bool, since
that would break binary compatibility. that would break binary compatibility.
*/ */
typedef void (XMLCALL *XML_EntityDeclHandler) ( typedef void(XMLCALL *XML_EntityDeclHandler)(
void *userData, void *userData, const XML_Char *entityName, int is_parameter_entity,
const XML_Char *entityName, const XML_Char *value, int value_length, const XML_Char *base,
int is_parameter_entity, const XML_Char *systemId, const XML_Char *publicId,
const XML_Char *value,
int value_length,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId,
const XML_Char *notationName); const XML_Char *notationName);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetEntityDeclHandler(XML_Parser parser, XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler);
XML_EntityDeclHandler handler);
/* OBSOLETE -- OBSOLETE -- OBSOLETE /* OBSOLETE -- OBSOLETE -- OBSOLETE
This handler has been superseded by the EntityDeclHandler above. This handler has been superseded by the EntityDeclHandler above.
@@ -379,20 +348,16 @@ XML_SetEntityDeclHandler(XML_Parser parser,
entityName, systemId and notationName arguments will never be entityName, systemId and notationName arguments will never be
NULL. The other arguments may be. NULL. The other arguments may be.
*/ */
typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) ( typedef void(XMLCALL *XML_UnparsedEntityDeclHandler)(
void *userData, void *userData, const XML_Char *entityName, const XML_Char *base,
const XML_Char *entityName, const XML_Char *systemId, const XML_Char *publicId,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId,
const XML_Char *notationName); const XML_Char *notationName);
/* This is called for a declaration of notation. The base argument is /* This is called for a declaration of notation. The base argument is
whatever was set by XML_SetBase. The notationName will never be whatever was set by XML_SetBase. The notationName will never be
NULL. The other arguments can be. NULL. The other arguments can be.
*/ */
typedef void (XMLCALL *XML_NotationDeclHandler) ( typedef void(XMLCALL *XML_NotationDeclHandler)(void *userData,
void *userData,
const XML_Char *notationName, const XML_Char *notationName,
const XML_Char *base, const XML_Char *base,
const XML_Char *systemId, const XML_Char *systemId,
@@ -404,13 +369,11 @@ typedef void (XMLCALL *XML_NotationDeclHandler) (
declaration handlers. For an xmlns attribute, prefix will be declaration handlers. For an xmlns attribute, prefix will be
NULL. For an xmlns="" attribute, uri will be NULL. NULL. For an xmlns="" attribute, uri will be NULL.
*/ */
typedef void (XMLCALL *XML_StartNamespaceDeclHandler) ( typedef void(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData,
void *userData,
const XML_Char *prefix, const XML_Char *prefix,
const XML_Char *uri); const XML_Char *uri);
typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( typedef void(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,
void *userData,
const XML_Char *prefix); const XML_Char *prefix);
/* This is called if the document is not standalone, that is, it has an /* This is called if the document is not standalone, that is, it has an
@@ -422,7 +385,7 @@ typedef void (XMLCALL *XML_EndNamespaceDeclHandler) (
conditions above this handler will only be called if the referenced conditions above this handler will only be called if the referenced
entity was actually read. entity was actually read.
*/ */
typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData);
/* This is called for a reference to an external parsed general /* This is called for a reference to an external parsed general
entity. The referenced entity is not automatically parsed. The entity. The referenced entity is not automatically parsed. The
@@ -458,8 +421,7 @@ typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData);
Note that unlike other handlers the first argument is the parser, Note that unlike other handlers the first argument is the parser,
not userData. not userData.
*/ */
typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( typedef int(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser parser,
XML_Parser parser,
const XML_Char *context, const XML_Char *context,
const XML_Char *base, const XML_Char *base,
const XML_Char *systemId, const XML_Char *systemId,
@@ -475,8 +437,7 @@ typedef int (XMLCALL *XML_ExternalEntityRefHandler) (
the event would be out of sync with the reporting of the the event would be out of sync with the reporting of the
declarations or attribute values declarations or attribute values
*/ */
typedef void (XMLCALL *XML_SkippedEntityHandler) ( typedef void(XMLCALL *XML_SkippedEntityHandler)(void *userData,
void *userData,
const XML_Char *entityName, const XML_Char *entityName,
int is_parameter_entity); int is_parameter_entity);
@@ -535,8 +496,8 @@ typedef void (XMLCALL *XML_SkippedEntityHandler) (
typedef struct { typedef struct {
int map[256]; int map[256];
void *data; void *data;
int (XMLCALL *convert)(void *data, const char *s); int(XMLCALL *convert)(void *data, const char *s);
void (XMLCALL *release)(void *data); void(XMLCALL *release)(void *data);
} XML_Encoding; } XML_Encoding;
/* This is called for an encoding that is unknown to the parser. /* This is called for an encoding that is unknown to the parser.
@@ -554,23 +515,19 @@ typedef struct {
If info does not describe a suitable encoding, then the parser will If info does not describe a suitable encoding, then the parser will
return an XML_UNKNOWN_ENCODING error. return an XML_UNKNOWN_ENCODING error.
*/ */
typedef int (XMLCALL *XML_UnknownEncodingHandler) ( typedef int(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,
void *encodingHandlerData,
const XML_Char *name, const XML_Char *name,
XML_Encoding *info); XML_Encoding *info);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetElementHandler(XML_Parser parser, XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start,
XML_StartElementHandler start,
XML_EndElementHandler end); XML_EndElementHandler end);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetStartElementHandler(XML_Parser parser, XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler handler);
XML_StartElementHandler handler);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetEndElementHandler(XML_Parser parser, XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler);
XML_EndElementHandler handler);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetCharacterDataHandler(XML_Parser parser, XML_SetCharacterDataHandler(XML_Parser parser,
@@ -580,8 +537,7 @@ XMLPARSEAPI(void)
XML_SetProcessingInstructionHandler(XML_Parser parser, XML_SetProcessingInstructionHandler(XML_Parser parser,
XML_ProcessingInstructionHandler handler); XML_ProcessingInstructionHandler handler);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetCommentHandler(XML_Parser parser, XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler);
XML_CommentHandler handler);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetCdataSectionHandler(XML_Parser parser, XML_SetCdataSectionHandler(XML_Parser parser,
@@ -601,20 +557,17 @@ XML_SetEndCdataSectionHandler(XML_Parser parser,
default handler, or to the skipped entity handler, if one is set. default handler, or to the skipped entity handler, if one is set.
*/ */
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetDefaultHandler(XML_Parser parser, XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler);
XML_DefaultHandler handler);
/* This sets the default handler but does not inhibit expansion of /* This sets the default handler but does not inhibit expansion of
internal entities. The entity reference will not be passed to the internal entities. The entity reference will not be passed to the
default handler. default handler.
*/ */
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetDefaultHandlerExpand(XML_Parser parser, XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler);
XML_DefaultHandler handler);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetDoctypeDeclHandler(XML_Parser parser, XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start,
XML_StartDoctypeDeclHandler start,
XML_EndDoctypeDeclHandler end); XML_EndDoctypeDeclHandler end);
XMLPARSEAPI(void) XMLPARSEAPI(void)
@@ -622,16 +575,14 @@ XML_SetStartDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start); XML_StartDoctypeDeclHandler start);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end);
XML_EndDoctypeDeclHandler end);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
XML_UnparsedEntityDeclHandler handler); XML_UnparsedEntityDeclHandler handler);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetNotationDeclHandler(XML_Parser parser, XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler);
XML_NotationDeclHandler handler);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetNamespaceDeclHandler(XML_Parser parser, XML_SetNamespaceDeclHandler(XML_Parser parser,
@@ -659,8 +610,7 @@ XML_SetExternalEntityRefHandler(XML_Parser parser,
instead of the parser object. instead of the parser object.
*/ */
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetExternalEntityRefHandlerArg(XML_Parser parser, XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg);
void *arg);
XMLPARSEAPI(void) XMLPARSEAPI(void)
XML_SetSkippedEntityHandler(XML_Parser parser, XML_SetSkippedEntityHandler(XML_Parser parser,
@@ -740,7 +690,6 @@ XML_UseParserAsHandlerArg(XML_Parser parser);
XMLPARSEAPI(enum XML_Error) XMLPARSEAPI(enum XML_Error)
XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
/* Sets the base to be used for resolving relative URIs in system /* Sets the base to be used for resolving relative URIs in system
identifiers in declarations. Resolving relative identifiers is identifiers in declarations. Resolving relative identifiers is
left to the application: this value will be passed through as the left to the application: this value will be passed through as the
@@ -863,12 +812,7 @@ XML_StopParser(XML_Parser parser, XML_Bool resumable);
XMLPARSEAPI(enum XML_Status) XMLPARSEAPI(enum XML_Status)
XML_ResumeParser(XML_Parser parser); XML_ResumeParser(XML_Parser parser);
enum XML_Parsing { enum XML_Parsing { XML_INITIALIZED, XML_PARSING, XML_FINISHED, XML_SUSPENDED };
XML_INITIALIZED,
XML_PARSING,
XML_FINISHED,
XML_SUSPENDED
};
typedef struct { typedef struct {
enum XML_Parsing parsing; enum XML_Parsing parsing;
@@ -900,8 +844,7 @@ XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);
Otherwise returns a new XML_Parser object. Otherwise returns a new XML_Parser object.
*/ */
XMLPARSEAPI(XML_Parser) XMLPARSEAPI(XML_Parser)
XML_ExternalEntityParserCreate(XML_Parser parser, XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context,
const XML_Char *context,
const XML_Char *encoding); const XML_Char *encoding);
enum XML_ParamEntityParsing { enum XML_ParamEntityParsing {
@@ -945,8 +888,7 @@ XML_SetParamEntityParsing(XML_Parser parser,
Note: If parser == NULL, the function will do nothing and return 0. Note: If parser == NULL, the function will do nothing and return 0.
*/ */
XMLPARSEAPI(int) XMLPARSEAPI(int)
XML_SetHashSalt(XML_Parser parser, XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt);
unsigned long hash_salt);
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
XML_GetErrorCode returns information about the error. XML_GetErrorCode returns information about the error.
@@ -995,9 +937,7 @@ XML_GetCurrentByteCount(XML_Parser parser);
the handler that makes the call. the handler that makes the call.
*/ */
XMLPARSEAPI(const char *) XMLPARSEAPI(const char *)
XML_GetInputContext(XML_Parser parser, XML_GetInputContext(XML_Parser parser, int *offset, int *size);
int *offset,
int *size);
/* For backwards compatibility with previous versions. */ /* For backwards compatibility with previous versions. */
#define XML_GetErrorLineNumber XML_GetCurrentLineNumber #define XML_GetErrorLineNumber XML_GetCurrentLineNumber
@@ -1070,13 +1010,12 @@ typedef struct {
XMLPARSEAPI(const XML_Feature *) XMLPARSEAPI(const XML_Feature *)
XML_GetFeatureList(void); XML_GetFeatureList(void);
/* Expat follows the semantic versioning convention. /* Expat follows the semantic versioning convention.
See http://semver.org. See http://semver.org.
*/ */
#define XML_MAJOR_VERSION 2 #define XML_MAJOR_VERSION 2
#define XML_MINOR_VERSION 2 #define XML_MINOR_VERSION 2
#define XML_MICRO_VERSION 6 #define XML_MICRO_VERSION 9
#ifdef __cplusplus #ifdef __cplusplus
} }
+13 -17
View File
@@ -35,10 +35,6 @@
/* External API definitions */ /* External API definitions */
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
# define XML_USE_MSC_EXTENSIONS 1
#endif
/* Expat tries very hard to make the API boundary very specifically /* Expat tries very hard to make the API boundary very specifically
defined. There are two macros defined to control this boundary; defined. There are two macros defined to control this boundary;
each of these can be defined before including this header to each of these can be defined before including this header to
@@ -64,7 +60,7 @@
#ifndef XMLCALL #ifndef XMLCALL
# if defined(_MSC_VER) # if defined(_MSC_VER)
# define XMLCALL __cdecl # define XMLCALL __cdecl
# elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) # elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
# define XMLCALL __attribute__((cdecl)) # define XMLCALL __attribute__((cdecl))
# else # else
/* For any platform which uses this definition and supports more than /* For any platform which uses this definition and supports more than
@@ -81,20 +77,23 @@
# endif # endif
#endif /* not defined XMLCALL */ #endif /* not defined XMLCALL */
#if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
# ifndef XML_BUILDING_EXPAT # ifndef XML_BUILDING_EXPAT
/* using Expat from an application */ /* using Expat from an application */
# ifdef XML_USE_MSC_EXTENSIONS # if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
# define XMLIMPORT __declspec(dllimport) # define XMLIMPORT __declspec(dllimport)
# endif # endif
# endif # endif
#endif /* not defined XML_STATIC */ #endif /* not defined XML_STATIC */
#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4) #ifndef XML_ENABLE_VISIBILITY
# define XMLIMPORT __attribute__ ((visibility ("default"))) # define XML_ENABLE_VISIBILITY 0
#endif
#if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
# define XMLIMPORT __attribute__((visibility("default")))
#endif #endif
/* If we didn't define it above, define it away: */ /* If we didn't define it above, define it away: */
@@ -102,13 +101,15 @@
# define XMLIMPORT # define XMLIMPORT
#endif #endif
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) #if defined(__GNUC__) \
&& (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
# define XML_ATTR_MALLOC __attribute__((__malloc__)) # define XML_ATTR_MALLOC __attribute__((__malloc__))
#else #else
# define XML_ATTR_MALLOC # define XML_ATTR_MALLOC
#endif #endif
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #if defined(__GNUC__) \
&& ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) # define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
#else #else
# define XML_ATTR_ALLOC_SIZE(x) # define XML_ATTR_ALLOC_SIZE(x)
@@ -143,13 +144,8 @@ typedef char XML_LChar;
#endif /* XML_UNICODE */ #endif /* XML_UNICODE */
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
# if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
typedef __int64 XML_Index;
typedef unsigned __int64 XML_Size;
# else
typedef long long XML_Index; typedef long long XML_Index;
typedef unsigned long long XML_Size; typedef unsigned long long XML_Size;
# endif
#else #else
typedef long XML_Index; typedef long XML_Index;
typedef unsigned long XML_Size; typedef unsigned long XML_Size;
+31 -31
View File
@@ -32,34 +32,34 @@
/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, /* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
+24 -25
View File
@@ -49,7 +49,7 @@
USE OR OTHER DEALINGS IN THE SOFTWARE. USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) #if defined(__GNUC__) && defined(__i386__) && ! defined(__MINGW32__)
/* We'll use this version by default only where we know it helps. /* We'll use this version by default only where we know it helps.
regparm() generates warnings on Solaris boxes. See SF bug #692878. regparm() generates warnings on Solaris boxes. See SF bug #692878.
@@ -59,8 +59,8 @@
#define FASTCALL __attribute__((stdcall, regparm(3))) #define FASTCALL __attribute__((stdcall, regparm(3)))
and let's try this: and let's try this:
*/ */
#define FASTCALL __attribute__((regparm(3))) # define FASTCALL __attribute__((regparm(3)))
#define PTRFASTCALL __attribute__((regparm(3))) # define PTRFASTCALL __attribute__((regparm(3)))
#endif #endif
/* Using __fastcall seems to have an unexpected negative effect under /* Using __fastcall seems to have an unexpected negative effect under
@@ -74,50 +74,49 @@
/* Make sure all of these are defined if they aren't already. */ /* Make sure all of these are defined if they aren't already. */
#ifndef FASTCALL #ifndef FASTCALL
#define FASTCALL # define FASTCALL
#endif #endif
#ifndef PTRCALL #ifndef PTRCALL
#define PTRCALL # define PTRCALL
#endif #endif
#ifndef PTRFASTCALL #ifndef PTRFASTCALL
#define PTRFASTCALL # define PTRFASTCALL
#endif #endif
#ifndef XML_MIN_SIZE #ifndef XML_MIN_SIZE
#if !defined(__cplusplus) && !defined(inline) # if ! defined(__cplusplus) && ! defined(inline)
#ifdef __GNUC__ # ifdef __GNUC__
#define inline __inline # define inline __inline
#endif /* __GNUC__ */ # endif /* __GNUC__ */
#endif # endif
#endif /* XML_MIN_SIZE */ #endif /* XML_MIN_SIZE */
#ifdef __cplusplus #ifdef __cplusplus
#define inline inline # define inline inline
#else #else
#ifndef inline # ifndef inline
#define inline # define inline
#endif
#endif
#ifndef UNUSED_P
# ifdef __GNUC__
# define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__))
# else
# define UNUSED_P(p) UNUSED_ ## p
# endif # endif
#endif #endif
#ifndef UNUSED_P
# define UNUSED_P(p) (void)p
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifdef XML_ENABLE_VISIBILITY
# if XML_ENABLE_VISIBILITY
__attribute__((visibility("default")))
# endif
#endif
void void
_INTERNAL_trim_to_complete_utf8_characters(const char * from, const char ** fromLimRef); _INTERNAL_trim_to_complete_utf8_characters(const char *from,
const char **fromLimRef);
#ifdef __cplusplus #ifdef __cplusplus
} }
+31 -31
View File
@@ -31,34 +31,34 @@
*/ */
/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, /* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, /* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,
/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, /* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, /* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, /* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, /* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
+98 -144
View File
@@ -31,152 +31,106 @@
*/ */
static const unsigned namingBitmap[] = { static const unsigned namingBitmap[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x04000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x87FFFFFE, 0x07FFFFFE, 0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, 0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, 0xFFFFE00F, 0xFC31FFFF, 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, 0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, 0x00000000, 0x00000000, 0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, 0xFFFF0003, 0xFFFFFFFF,
0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, 0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, 0x00000000, 0x07FFFFFE,
0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, 0x000007FE, 0xFFFE0000, 0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, 0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, 0xFFF99FE0, 0x03C5FDFF,
0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, 0xB0000000, 0x00030003, 0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, 0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, 0xFFF99FE0, 0x23CDFDFF,
0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, 0xB0000000, 0x00000003, 0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, 0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, 0xFFFDDFE0, 0x03EFFDFF,
0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, 0x40000000, 0x00000003, 0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFE, 0x000D7FFF,
0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, 0x0000003F, 0x00000000, 0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, 0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, 0x00000000, 0x00000000,
0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, 0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, 0x0007DAED, 0x50000000,
0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, 0x82315001, 0x002C62AB, 0x40000000, 0xF580C900, 0x00000007, 0x02010800,
0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0FFFFFFF, 0xFFFFFFFF,
0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, 0xFFFFFFFF, 0x03FFFFFF, 0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, 0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, 0x00000000, 0x00004C40,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, 0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, 0x001FFFFF, 0xFFFFFFFE,
0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, 0xFFFFFFFF, 0x07FFFFFF, 0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000000F,
0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, 0x00000000, 0x00000000, 0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, 0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, 0x00FFFFFF, 0x00000000,
0x40000000, 0xF580C900, 0x00000007, 0x02010800, 0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, 0xFFFFD7C0, 0xFFFFFFFB,
0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, 0x547F7FFF, 0x000FFFFD, 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, 0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000,
0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, 0x027FFFFF, 0xFFFFFFFE, 0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
0x00000000, 0x00004C40, 0x00000000, 0x00000000, 0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, 0xFFFFFFFF, 0x7CFFFFFF,
0x00000007, 0x00000000, 0x00000000, 0x00000000, 0xFFEF7FFF, 0x03FF3DFF, 0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, 0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, 0xFFF987E4, 0xD36DFDFF,
0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, 0x5E003987, 0x001FFFC0, 0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, 0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, 0xD63DC7EC, 0xC3BFC718,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00803DC7, 0x0000FF80, 0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, 0xFFFDDFEC, 0xC3FFFDFF,
0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, 0x00803DCF, 0x0000FFC3, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, 0xFEF02596, 0x3BFF6CAE,
0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, 0x03FF3F5F, 0x00000000, 0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, 0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, 0x661FFFFF, 0xFFFFFFFE,
0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, 0xFFFFFFFF, 0x77FFFFFF,
0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,
}; };
static const unsigned char nmstrtPages[] = { static const unsigned char nmstrtPages[] = {
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x09, 0x0A, 0x0B,
0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x00, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
static const unsigned char namePages[] = { static const unsigned char namePages[] = {
0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, 0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, 0x00, 0x1F, 0x20, 0x21,
0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x22, 0x23, 0x24, 0x25, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x26, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
+62 -55
View File
@@ -11,6 +11,10 @@
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* HISTORY: * HISTORY:
* *
* 2019-08-03 (Sebastian Pipping)
* - Mark part of sip24_valid as to be excluded from clang-format
* - Re-format code using clang-format 9
*
* 2018-07-08 (Anton Maklakov) * 2018-07-08 (Anton Maklakov)
* - Add "fall through" markers for GCC's -Wimplicit-fallthrough * - Add "fall through" markers for GCC's -Wimplicit-fallthrough
* *
@@ -94,15 +98,14 @@
#include <stddef.h> /* size_t */ #include <stddef.h> /* size_t */
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1600) #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 */ /* For vs2003/7.1 up to vs2008/9.0; _MSC_VER 1600 is vs2010/10.0 */
typedef unsigned __int8 uint8_t; typedef unsigned __int8 uint8_t;
typedef unsigned __int32 uint32_t; typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t; typedef unsigned __int64 uint64_t;
#else #else
#include <stdint.h> /* uint64_t uint32_t uint8_t */ # include <stdint.h> /* uint64_t uint32_t uint8_t */
#endif #endif
/* /*
* Workaround to not require a C++11 compiler for using ULL suffix * 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: * if this code is included and compiled as C++; related GCC warning is:
@@ -110,29 +113,26 @@
*/ */
#define _SIP_ULL(high, low) (((uint64_t)high << 32) | low) #define _SIP_ULL(high, low) (((uint64_t)high << 32) | low)
#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b))))
#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ( (x) >> (64 - (b))))
#define SIP_U32TO8_LE(p, v) \ #define SIP_U32TO8_LE(p, v) \
(p)[0] = (uint8_t)((v) >> 0); (p)[1] = (uint8_t)((v) >> 8); \ (p)[0] = (uint8_t)((v) >> 0); \
(p)[2] = (uint8_t)((v) >> 16); (p)[3] = (uint8_t)((v) >> 24); (p)[1] = (uint8_t)((v) >> 8); \
(p)[2] = (uint8_t)((v) >> 16); \
(p)[3] = (uint8_t)((v) >> 24);
#define SIP_U64TO8_LE(p, v) \ #define SIP_U64TO8_LE(p, v) \
SIP_U32TO8_LE((p) + 0, (uint32_t)((v) >> 0)); \ SIP_U32TO8_LE((p) + 0, (uint32_t)((v) >> 0)); \
SIP_U32TO8_LE((p) + 4, (uint32_t)((v) >> 32)); SIP_U32TO8_LE((p) + 4, (uint32_t)((v) >> 32));
#define SIP_U8TO64_LE(p) \ #define SIP_U8TO64_LE(p) \
(((uint64_t)((p)[0]) << 0) | \ (((uint64_t)((p)[0]) << 0) | ((uint64_t)((p)[1]) << 8) \
((uint64_t)((p)[1]) << 8) | \ | ((uint64_t)((p)[2]) << 16) | ((uint64_t)((p)[3]) << 24) \
((uint64_t)((p)[2]) << 16) | \ | ((uint64_t)((p)[4]) << 32) | ((uint64_t)((p)[5]) << 40) \
((uint64_t)((p)[3]) << 24) | \ | ((uint64_t)((p)[6]) << 48) | ((uint64_t)((p)[7]) << 56))
((uint64_t)((p)[4]) << 32) | \
((uint64_t)((p)[5]) << 40) | \
((uint64_t)((p)[6]) << 48) | \
((uint64_t)((p)[7]) << 56))
#define SIPHASH_INITIALIZER \
#define SIPHASH_INITIALIZER { 0, 0, 0, 0, { 0 }, 0, 0 } { 0, 0, 0, 0, {0}, 0, 0 }
struct siphash { struct siphash {
uint64_t v0, v1, v2, v3; uint64_t v0, v1, v2, v3;
@@ -141,35 +141,35 @@ struct siphash {
uint64_t c; uint64_t c;
}; /* struct siphash */ }; /* struct siphash */
#define SIP_KEYLEN 16 #define SIP_KEYLEN 16
struct sipkey { struct sipkey {
uint64_t k[2]; uint64_t k[2];
}; /* struct sipkey */ }; /* struct sipkey */
#define sip_keyof(k) sip_tokey(&(struct sipkey){ { 0 } }, (k)) #define sip_keyof(k) sip_tokey(&(struct sipkey){{0}}, (k))
static struct sipkey *sip_tokey(struct sipkey *key, const void *src) { static struct sipkey *
sip_tokey(struct sipkey *key, const void *src) {
key->k[0] = SIP_U8TO64_LE((const unsigned char *)src); key->k[0] = SIP_U8TO64_LE((const unsigned char *)src);
key->k[1] = SIP_U8TO64_LE((const unsigned char *)src + 8); key->k[1] = SIP_U8TO64_LE((const unsigned char *)src + 8);
return key; return key;
} /* sip_tokey() */ } /* sip_tokey() */
#ifdef SIPHASH_TOBIN #ifdef SIPHASH_TOBIN
#define sip_binof(v) sip_tobin((unsigned char[8]){ 0 }, (v)) # define sip_binof(v) sip_tobin((unsigned char[8]){0}, (v))
static void *sip_tobin(void *dst, uint64_t u64) { static void *
sip_tobin(void *dst, uint64_t u64) {
SIP_U64TO8_LE((unsigned char *)dst, u64); SIP_U64TO8_LE((unsigned char *)dst, u64);
return dst; return dst;
} /* sip_tobin() */ } /* sip_tobin() */
#endif /* SIPHASH_TOBIN */ #endif /* SIPHASH_TOBIN */
static void
static void sip_round(struct siphash *H, const int rounds) { sip_round(struct siphash *H, const int rounds) {
int i; int i;
for (i = 0; i < rounds; i++) { for (i = 0; i < rounds; i++) {
@@ -193,9 +193,8 @@ static void sip_round(struct siphash *H, const int rounds) {
} }
} /* sip_round() */ } /* sip_round() */
static struct siphash *
static struct siphash *sip24_init(struct siphash *H, sip24_init(struct siphash *H, const struct sipkey *key) {
const struct sipkey *key) {
H->v0 = _SIP_ULL(0x736f6d65U, 0x70736575U) ^ key->k[0]; H->v0 = _SIP_ULL(0x736f6d65U, 0x70736575U) ^ key->k[0];
H->v1 = _SIP_ULL(0x646f7261U, 0x6e646f6dU) ^ key->k[1]; H->v1 = _SIP_ULL(0x646f7261U, 0x6e646f6dU) ^ key->k[1];
H->v2 = _SIP_ULL(0x6c796765U, 0x6e657261U) ^ key->k[0]; H->v2 = _SIP_ULL(0x6c796765U, 0x6e657261U) ^ key->k[0];
@@ -207,11 +206,10 @@ static struct siphash *sip24_init(struct siphash *H,
return H; return H;
} /* sip24_init() */ } /* sip24_init() */
#define sip_endof(a) (&(a)[sizeof(a) / sizeof *(a)])
#define sip_endof(a) (&(a)[sizeof (a) / sizeof *(a)]) static struct siphash *
sip24_update(struct siphash *H, const void *src, size_t len) {
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; const unsigned char *p = (const unsigned char *)src, *pe = p + len;
uint64_t m; uint64_t m;
@@ -234,27 +232,35 @@ static struct siphash *sip24_update(struct siphash *H, const void *src,
return H; return H;
} /* sip24_update() */ } /* sip24_update() */
static uint64_t
static uint64_t sip24_final(struct siphash *H) { sip24_final(struct siphash *H) {
const char left = (char)(H->p - H->buf); const char left = (char)(H->p - H->buf);
uint64_t b = (H->c + left) << 56; uint64_t b = (H->c + left) << 56;
switch (left) { switch (left) {
case 7: b |= (uint64_t)H->buf[6] << 48; case 7:
b |= (uint64_t)H->buf[6] << 48;
/* fall through */ /* fall through */
case 6: b |= (uint64_t)H->buf[5] << 40; case 6:
b |= (uint64_t)H->buf[5] << 40;
/* fall through */ /* fall through */
case 5: b |= (uint64_t)H->buf[4] << 32; case 5:
b |= (uint64_t)H->buf[4] << 32;
/* fall through */ /* fall through */
case 4: b |= (uint64_t)H->buf[3] << 24; case 4:
b |= (uint64_t)H->buf[3] << 24;
/* fall through */ /* fall through */
case 3: b |= (uint64_t)H->buf[2] << 16; case 3:
b |= (uint64_t)H->buf[2] << 16;
/* fall through */ /* fall through */
case 2: b |= (uint64_t)H->buf[1] << 8; case 2:
b |= (uint64_t)H->buf[1] << 8;
/* fall through */ /* fall through */
case 1: b |= (uint64_t)H->buf[0] << 0; case 1:
b |= (uint64_t)H->buf[0] << 0;
/* fall through */ /* fall through */
case 0: break; case 0:
break;
} }
H->v3 ^= b; H->v3 ^= b;
@@ -266,14 +272,12 @@ static uint64_t sip24_final(struct siphash *H) {
return H->v0 ^ H->v1 ^ H->v2 ^ H->v3; return H->v0 ^ H->v1 ^ H->v2 ^ H->v3;
} /* sip24_final() */ } /* sip24_final() */
static uint64_t
static uint64_t siphash24(const void *src, size_t len, siphash24(const void *src, size_t len, const struct sipkey *key) {
const struct sipkey *key) {
struct siphash state = SIPHASH_INITIALIZER; struct siphash state = SIPHASH_INITIALIZER;
return sip24_final(sip24_update(sip24_init(&state, key), src, len)); return sip24_final(sip24_update(sip24_init(&state, key), src, len));
} /* siphash24() */ } /* siphash24() */
/* /*
* SipHash-2-4 output with * SipHash-2-4 output with
* k = 00 01 02 ... * k = 00 01 02 ...
@@ -285,7 +289,9 @@ static uint64_t siphash24(const void *src, size_t len,
* ... * ...
* in = 00 01 02 ... 3e (63 bytes) * in = 00 01 02 ... 3e (63 bytes)
*/ */
static int sip24_valid(void) { static int
sip24_valid(void) {
/* clang-format off */
static const unsigned char vectors[64][8] = { static const unsigned char vectors[64][8] = {
{ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, }, { 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, },
{ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, }, { 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, },
@@ -352,6 +358,8 @@ static int sip24_valid(void) {
{ 0x57, 0x5f, 0xf2, 0x8e, 0x60, 0x38, 0x1b, 0xe5, }, { 0x57, 0x5f, 0xf2, 0x8e, 0x60, 0x38, 0x1b, 0xe5, },
{ 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, } { 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, }
}; };
/* clang-format on */
unsigned char in[64]; unsigned char in[64];
struct sipkey k; struct sipkey k;
size_t i; size_t i;
@@ -369,12 +377,12 @@ static int sip24_valid(void) {
return 1; return 1;
} /* sip24_valid() */ } /* sip24_valid() */
#ifdef SIPHASH_MAIN #ifdef SIPHASH_MAIN
#include <stdio.h> # include <stdio.h>
int main(void) { int
main(void) {
const int ok = sip24_valid(); const int ok = sip24_valid();
if (ok) if (ok)
@@ -382,10 +390,9 @@ int main(void) {
else else
puts("FAIL"); puts("FAIL");
return !ok; return ! ok;
} /* main() */ } /* main() */
#endif /* SIPHASH_MAIN */ #endif /* SIPHASH_MAIN */
#endif /* SIPHASH_H */ #endif /* SIPHASH_H */
+31 -31
View File
@@ -31,34 +31,34 @@
*/ */
/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, /* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, /* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, /* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, /* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,
/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, /* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, /* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, /* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,
+1244 -1566
View File
File diff suppressed because it is too large Load Diff
+295 -434
View File
File diff suppressed because it is too large Load Diff
+3 -6
View File
@@ -36,7 +36,7 @@
#ifdef __VMS #ifdef __VMS
/* 0 1 2 3 0 1 2 3 /* 0 1 2 3 0 1 2 3
1234567890123456789012345678901 1234567890123456789012345678901 */ 1234567890123456789012345678901 1234567890123456789012345678901 */
#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt # define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt
#endif #endif
#include "xmltok.h" #include "xmltok.h"
@@ -113,11 +113,8 @@ enum {
}; };
typedef struct prolog_state { typedef struct prolog_state {
int (PTRCALL *handler) (struct prolog_state *state, int(PTRCALL *handler)(struct prolog_state *state, int tok, const char *ptr,
int tok, const char *end, const ENCODING *enc);
const char *ptr,
const char *end,
const ENCODING *enc);
unsigned level; unsigned level;
int role_none; int role_none;
#ifdef XML_DTD #ifdef XML_DTD
+446 -580
View File
File diff suppressed because it is too large Load Diff
+38 -68
View File
@@ -38,13 +38,15 @@ extern "C" {
#endif #endif
/* The following token may be returned by XmlContentTok */ /* The following token may be returned by XmlContentTok */
#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be #define XML_TOK_TRAILING_RSQB \
-5 /* ] or ]] at the end of the scan; might be \
start of illegal ]]> sequence */ start of illegal ]]> sequence */
/* The following tokens may be returned by both XmlPrologTok and /* The following tokens may be returned by both XmlPrologTok and
XmlContentTok. XmlContentTok.
*/ */
#define XML_TOK_NONE -4 /* The string to be scanned is empty */ #define XML_TOK_NONE -4 /* The string to be scanned is empty */
#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; #define XML_TOK_TRAILING_CR \
-3 /* A CR at the end of the scan; \
might be part of CRLF sequence */ might be part of CRLF sequence */
#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ #define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */
#define XML_TOK_PARTIAL -1 /* only part of a token */ #define XML_TOK_PARTIAL -1 /* only part of a token */
@@ -112,20 +114,20 @@ extern "C" {
#define XML_TOK_PREFIXED_NAME 41 #define XML_TOK_PREFIXED_NAME 41
#ifdef XML_DTD #ifdef XML_DTD
#define XML_TOK_IGNORE_SECT 42 # define XML_TOK_IGNORE_SECT 42
#endif /* XML_DTD */ #endif /* XML_DTD */
#ifdef XML_DTD #ifdef XML_DTD
#define XML_N_STATES 4 # define XML_N_STATES 4
#else /* not XML_DTD */ #else /* not XML_DTD */
#define XML_N_STATES 3 # define XML_N_STATES 3
#endif /* not XML_DTD */ #endif /* not XML_DTD */
#define XML_PROLOG_STATE 0 #define XML_PROLOG_STATE 0
#define XML_CONTENT_STATE 1 #define XML_CONTENT_STATE 1
#define XML_CDATA_SECTION_STATE 2 #define XML_CDATA_SECTION_STATE 2
#ifdef XML_DTD #ifdef XML_DTD
#define XML_IGNORE_SECTION_STATE 3 # define XML_IGNORE_SECTION_STATE 3
#endif /* XML_DTD */ #endif /* XML_DTD */
#define XML_N_LITERAL_TYPES 2 #define XML_N_LITERAL_TYPES 2
@@ -153,48 +155,37 @@ typedef struct {
struct encoding; struct encoding;
typedef struct encoding ENCODING; typedef struct encoding ENCODING;
typedef int (PTRCALL *SCANNER)(const ENCODING *, typedef int(PTRCALL *SCANNER)(const ENCODING *, const char *, const char *,
const char *,
const char *,
const char **); const char **);
enum XML_Convert_Result { enum XML_Convert_Result {
XML_CONVERT_COMPLETED = 0, XML_CONVERT_COMPLETED = 0,
XML_CONVERT_INPUT_INCOMPLETE = 1, XML_CONVERT_INPUT_INCOMPLETE = 1,
XML_CONVERT_OUTPUT_EXHAUSTED = 2 /* and therefore potentially input remaining as well */ XML_CONVERT_OUTPUT_EXHAUSTED
= 2 /* and therefore potentially input remaining as well */
}; };
struct encoding { struct encoding {
SCANNER scanners[XML_N_STATES]; SCANNER scanners[XML_N_STATES];
SCANNER literalScanners[XML_N_LITERAL_TYPES]; SCANNER literalScanners[XML_N_LITERAL_TYPES];
int (PTRCALL *nameMatchesAscii)(const ENCODING *, int(PTRCALL *nameMatchesAscii)(const ENCODING *, const char *, const char *,
const char *,
const char *,
const char *); const char *);
int (PTRFASTCALL *nameLength)(const ENCODING *, const char *); int(PTRFASTCALL *nameLength)(const ENCODING *, const char *);
const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *); const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *);
int (PTRCALL *getAtts)(const ENCODING *enc, int(PTRCALL *getAtts)(const ENCODING *enc, const char *ptr, int attsMax,
const char *ptr,
int attsMax,
ATTRIBUTE *atts); ATTRIBUTE *atts);
int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); int(PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);
int (PTRCALL *predefinedEntityName)(const ENCODING *, int(PTRCALL *predefinedEntityName)(const ENCODING *, const char *,
const char *,
const char *); const char *);
void (PTRCALL *updatePosition)(const ENCODING *, void(PTRCALL *updatePosition)(const ENCODING *, const char *ptr,
const char *ptr, const char *end, POSITION *);
const char *end, int(PTRCALL *isPublicId)(const ENCODING *enc, const char *ptr,
POSITION *); const char *end, const char **badPtr);
int (PTRCALL *isPublicId)(const ENCODING *enc, enum XML_Convert_Result(PTRCALL *utf8Convert)(const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr);
enum XML_Convert_Result (PTRCALL *utf8Convert)(const ENCODING *enc,
const char **fromP, const char **fromP,
const char *fromLim, const char *fromLim, char **toP,
char **toP,
const char *toLim); const char *toLim);
enum XML_Convert_Result (PTRCALL *utf16Convert)(const ENCODING *enc, enum XML_Convert_Result(PTRCALL *utf16Convert)(const ENCODING *enc,
const char **fromP, const char **fromP,
const char *fromLim, const char *fromLim,
unsigned short **toP, unsigned short **toP,
@@ -225,7 +216,6 @@ struct encoding {
the prolog outside literals, comments and processing instructions. the prolog outside literals, comments and processing instructions.
*/ */
#define XmlTok(enc, state, ptr, end, nextTokPtr) \ #define XmlTok(enc, state, ptr, end, nextTokPtr) \
(((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) (((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
@@ -240,7 +230,7 @@ struct encoding {
#ifdef XML_DTD #ifdef XML_DTD
#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ # define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
#endif /* XML_DTD */ #endif /* XML_DTD */
@@ -260,17 +250,14 @@ struct encoding {
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ #define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
(((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
#define XmlNameLength(enc, ptr) \ #define XmlNameLength(enc, ptr) (((enc)->nameLength)(enc, ptr))
(((enc)->nameLength)(enc, ptr))
#define XmlSkipS(enc, ptr) \ #define XmlSkipS(enc, ptr) (((enc)->skipS)(enc, ptr))
(((enc)->skipS)(enc, ptr))
#define XmlGetAttributes(enc, ptr, attsMax, atts) \ #define XmlGetAttributes(enc, ptr, attsMax, atts) \
(((enc)->getAtts)(enc, ptr, attsMax, atts)) (((enc)->getAtts)(enc, ptr, attsMax, atts))
#define XmlCharRefNumber(enc, ptr) \ #define XmlCharRefNumber(enc, ptr) (((enc)->charRefNumber)(enc, ptr))
(((enc)->charRefNumber)(enc, ptr))
#define XmlPredefinedEntityName(enc, ptr, end) \ #define XmlPredefinedEntityName(enc, ptr, end) \
(((enc)->predefinedEntityName)(enc, ptr, end)) (((enc)->predefinedEntityName)(enc, ptr, end))
@@ -292,16 +279,11 @@ typedef struct {
const ENCODING **encPtr; const ENCODING **encPtr;
} INIT_ENCODING; } INIT_ENCODING;
int XmlParseXmlDecl(int isGeneralTextEntity, int XmlParseXmlDecl(int isGeneralTextEntity, const ENCODING *enc,
const ENCODING *enc, const char *ptr, const char *end, const char **badPtr,
const char *ptr, const char **versionPtr, const char **versionEndPtr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **versionEndPtr,
const char **encodingNamePtr, const char **encodingNamePtr,
const ENCODING **namedEncodingPtr, const ENCODING **namedEncodingPtr, int *standalonePtr);
int *standalonePtr);
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
const ENCODING *XmlGetUtf8InternalEncoding(void); const ENCODING *XmlGetUtf8InternalEncoding(void);
@@ -310,33 +292,21 @@ int FASTCALL XmlUtf8Encode(int charNumber, char *buf);
int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf); int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf);
int XmlSizeOfUnknownEncoding(void); int XmlSizeOfUnknownEncoding(void);
typedef int(XMLCALL *CONVERTER)(void *userData, const char *p);
typedef int (XMLCALL *CONVERTER) (void *userData, const char *p); ENCODING *XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert,
ENCODING *
XmlInitUnknownEncoding(void *mem,
int *table,
CONVERTER convert,
void *userData); void *userData);
int XmlParseXmlDeclNS(int isGeneralTextEntity, int XmlParseXmlDeclNS(int isGeneralTextEntity, const ENCODING *enc,
const ENCODING *enc, const char *ptr, const char *end, const char **badPtr,
const char *ptr, const char **versionPtr, const char **versionEndPtr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **versionEndPtr,
const char **encodingNamePtr, const char **encodingNamePtr,
const ENCODING **namedEncodingPtr, const ENCODING **namedEncodingPtr, int *standalonePtr);
int *standalonePtr);
int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
const ENCODING *XmlGetUtf8InternalEncodingNS(void); const ENCODING *XmlGetUtf8InternalEncodingNS(void);
const ENCODING *XmlGetUtf16InternalEncodingNS(void); const ENCODING *XmlGetUtf16InternalEncodingNS(void);
ENCODING * ENCODING *XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert,
XmlInitUnknownEncodingNS(void *mem,
int *table,
CONVERTER convert,
void *userData); void *userData);
#ifdef __cplusplus #ifdef __cplusplus
} }
+284 -243
View File
File diff suppressed because it is too large Load Diff
+35 -35
View File
@@ -31,43 +31,43 @@
*/ */
enum { enum {
BT_NONXML, BT_NONXML, /* e.g. noncharacter-FFFF */
BT_MALFORM, BT_MALFORM, /* illegal, with regard to encoding */
BT_LT, BT_LT, /* less than = "<" */
BT_AMP, BT_AMP, /* ampersand = "&" */
BT_RSQB, BT_RSQB, /* right square bracket = "[" */
BT_LEAD2, BT_LEAD2, /* lead byte of a 2-byte UTF-8 character */
BT_LEAD3, BT_LEAD3, /* lead byte of a 3-byte UTF-8 character */
BT_LEAD4, BT_LEAD4, /* lead byte of a 4-byte UTF-8 character */
BT_TRAIL, BT_TRAIL, /* trailing unit, e.g. second 16-bit unit of a 4-byte char. */
BT_CR, BT_CR, /* carriage return = "\r" */
BT_LF, BT_LF, /* line feed = "\n" */
BT_GT, BT_GT, /* greater than = ">" */
BT_QUOT, BT_QUOT, /* quotation character = "\"" */
BT_APOS, BT_APOS, /* aposthrophe = "'" */
BT_EQUALS, BT_EQUALS, /* equal sign = "=" */
BT_QUEST, BT_QUEST, /* question mark = "?" */
BT_EXCL, BT_EXCL, /* exclamation mark = "!" */
BT_SOL, BT_SOL, /* solidus, slash = "/" */
BT_SEMI, BT_SEMI, /* semicolon = ";" */
BT_NUM, BT_NUM, /* number sign = "#" */
BT_LSQB, BT_LSQB, /* left square bracket = "[" */
BT_S, BT_S, /* white space, e.g. "\t", " "[, "\r"] */
BT_NMSTRT, BT_NMSTRT, /* non-hex name start letter = "G".."Z" + "g".."z" + "_" */
BT_COLON, BT_COLON, /* colon = ":" */
BT_HEX, BT_HEX, /* hex letter = "A".."F" + "a".."f" */
BT_DIGIT, BT_DIGIT, /* digit = "0".."9" */
BT_NAME, BT_NAME, /* dot and middle dot = "." + chr(0xb7) */
BT_MINUS, BT_MINUS, /* minus = "-" */
BT_OTHER, /* known not to be a name or name start character */ BT_OTHER, /* known not to be a name or name start character */
BT_NONASCII, /* might be a name or name start character */ BT_NONASCII, /* might be a name or name start character */
BT_PERCNT, BT_PERCNT, /* percent sign = "%" */
BT_LPAR, BT_LPAR, /* left parenthesis = "(" */
BT_RPAR, BT_RPAR, /* right parenthesis = "(" */
BT_AST, BT_AST, /* asterisk = "*" */
BT_PLUS, BT_PLUS, /* plus sign = "+" */
BT_COMMA, BT_COMMA, /* comma = "," */
BT_VERBAR BT_VERBAR /* vertical bar = "|" */
}; };
#include <stddef.h> #include <stddef.h>
+28 -52
View File
@@ -33,56 +33,47 @@
#ifdef XML_TOK_NS_C #ifdef XML_TOK_NS_C
const ENCODING * const ENCODING *
NS(XmlGetUtf8InternalEncoding)(void) NS(XmlGetUtf8InternalEncoding)(void) {
{
return &ns(internal_utf8_encoding).enc; return &ns(internal_utf8_encoding).enc;
} }
const ENCODING * const ENCODING *
NS(XmlGetUtf16InternalEncoding)(void) NS(XmlGetUtf16InternalEncoding)(void) {
{ # if BYTEORDER == 1234
#if BYTEORDER == 1234
return &ns(internal_little2_encoding).enc; return &ns(internal_little2_encoding).enc;
#elif BYTEORDER == 4321 # elif BYTEORDER == 4321
return &ns(internal_big2_encoding).enc; return &ns(internal_big2_encoding).enc;
#else # else
const short n = 1; const short n = 1;
return (*(const char *)&n return (*(const char *)&n ? &ns(internal_little2_encoding).enc
? &ns(internal_little2_encoding).enc
: &ns(internal_big2_encoding).enc); : &ns(internal_big2_encoding).enc);
#endif # endif
} }
static const ENCODING * const NS(encodings)[] = { static const ENCODING *const NS(encodings)[] = {
&ns(latin1_encoding).enc, &ns(latin1_encoding).enc, &ns(ascii_encoding).enc,
&ns(ascii_encoding).enc, &ns(utf8_encoding).enc, &ns(big2_encoding).enc,
&ns(utf8_encoding).enc, &ns(big2_encoding).enc, &ns(little2_encoding).enc,
&ns(big2_encoding).enc,
&ns(big2_encoding).enc,
&ns(little2_encoding).enc,
&ns(utf8_encoding).enc /* NO_ENC */ &ns(utf8_encoding).enc /* NO_ENC */
}; };
static int PTRCALL static int PTRCALL
NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr) const char **nextTokPtr) {
{ return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE,
return initScan(NS(encodings), (const INIT_ENCODING *)enc, ptr, end, nextTokPtr);
XML_PROLOG_STATE, ptr, end, nextTokPtr);
} }
static int PTRCALL static int PTRCALL
NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr) const char **nextTokPtr) {
{ return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE,
return initScan(NS(encodings), (const INIT_ENCODING *)enc, ptr, end, nextTokPtr);
XML_CONTENT_STATE, ptr, end, nextTokPtr);
} }
int int
NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr,
const char *name) const char *name) {
{
int i = getEncodingIndex(name); int i = getEncodingIndex(name);
if (i == UNKNOWN_ENC) if (i == UNKNOWN_ENC)
return 0; return 0;
@@ -96,9 +87,8 @@ NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr,
} }
static const ENCODING * static const ENCODING *
NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) {
{ # define ENCODING_MAX 128
#define ENCODING_MAX 128
char buf[ENCODING_MAX]; char buf[ENCODING_MAX];
char *p = buf; char *p = buf;
int i; int i;
@@ -115,28 +105,14 @@ NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
} }
int int
NS(XmlParseXmlDecl)(int isGeneralTextEntity, NS(XmlParseXmlDecl)(int isGeneralTextEntity, const ENCODING *enc,
const ENCODING *enc, const char *ptr, const char *end, const char **badPtr,
const char *ptr, const char **versionPtr, const char **versionEndPtr,
const char *end, const char **encodingName, const ENCODING **encoding,
const char **badPtr, int *standalone) {
const char **versionPtr, return doParseXmlDecl(NS(findEncoding), isGeneralTextEntity, enc, ptr, end,
const char **versionEndPtr, badPtr, versionPtr, versionEndPtr, encodingName,
const char **encodingName, encoding, standalone);
const ENCODING **encoding,
int *standalone)
{
return doParseXmlDecl(NS(findEncoding),
isGeneralTextEntity,
enc,
ptr,
end,
badPtr,
versionPtr,
versionEndPtr,
encodingName,
encoding,
standalone);
} }
#endif /* XML_TOK_NS_C */ #endif /* XML_TOK_NS_C */
+1 -1
View File
@@ -1,4 +1,4 @@
#! /bin/bash #! /usr/bin/env bash
# __ __ _ # __ __ _
# ___\ \/ /_ __ __ _| |_ # ___\ \/ /_ __ __ _| |_
# / _ \\ /| '_ \ / _` | __| # / _ \\ /| '_ \ / _` | __|
+69 -39
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am. # Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc. # Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@@ -125,7 +125,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \ $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
@@ -169,7 +176,10 @@ am__v_at_0 = @
am__v_at_1 = am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
am__depfiles_maybe = depfiles am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/chardata.Po ./$(DEPDIR)/memcheck.Po \
./$(DEPDIR)/minicheck.Po ./$(DEPDIR)/runtests.Po \
./$(DEPDIR)/runtestspp.Po ./$(DEPDIR)/structdata.Po
am__mv = mv -f am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -231,7 +241,7 @@ am__recursive_targets = \
$(RECURSIVE_CLEAN_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets) $(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
check recheck distdir check recheck distdir distdir-am
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input, # Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is # and print each of them once, without duplicates. Input order is
@@ -660,8 +670,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \ *config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \ *) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac; esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -673,14 +683,6 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps): $(am__aclocal_m4_deps):
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libruntests.a: $(libruntests_a_OBJECTS) $(libruntests_a_DEPENDENCIES) $(EXTRA_libruntests_a_DEPENDENCIES)
$(AM_V_at)-rm -f libruntests.a
$(AM_V_AR)$(libruntests_a_AR) libruntests.a $(libruntests_a_OBJECTS) $(libruntests_a_LIBADD)
$(AM_V_at)$(RANLIB) libruntests.a
clean-checkPROGRAMS: clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \ echo " rm -f" $$list; \
@@ -690,6 +692,14 @@ clean-checkPROGRAMS:
echo " rm -f" $$list; \ echo " rm -f" $$list; \
rm -f $$list rm -f $$list
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libruntests.a: $(libruntests_a_OBJECTS) $(libruntests_a_DEPENDENCIES) $(EXTRA_libruntests_a_DEPENDENCIES)
$(AM_V_at)-rm -f libruntests.a
$(AM_V_AR)$(libruntests_a_AR) libruntests.a $(libruntests_a_OBJECTS) $(libruntests_a_LIBADD)
$(AM_V_at)$(RANLIB) libruntests.a
runtests$(EXEEXT): $(runtests_OBJECTS) $(runtests_DEPENDENCIES) $(EXTRA_runtests_DEPENDENCIES) runtests$(EXEEXT): $(runtests_OBJECTS) $(runtests_DEPENDENCIES) $(EXTRA_runtests_DEPENDENCIES)
@rm -f runtests$(EXEEXT) @rm -f runtests$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(runtests_OBJECTS) $(runtests_LDADD) $(LIBS) $(AM_V_CCLD)$(LINK) $(runtests_OBJECTS) $(runtests_LDADD) $(LIBS)
@@ -704,12 +714,18 @@ mostlyclean-compile:
distclean-compile: distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chardata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chardata.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcheck.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcheck.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minicheck.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minicheck.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtests.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtests.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtestspp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtestspp.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/structdata.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/structdata.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o: .c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -978,7 +994,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
fi; \ fi; \
$$success || exit 1 $$success || exit 1
check-TESTS: check-TESTS: $(check_PROGRAMS)
@list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@@ -1028,7 +1044,10 @@ runtestspp.log: runtestspp$(EXEEXT)
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
distdir: $(DISTFILES) distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \ list='$(DISTFILES)'; \
@@ -1129,7 +1148,12 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
clean-noinstLIBRARIES mostlyclean-am clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-recursive distclean: distclean-recursive
-rm -rf ./$(DEPDIR) -rm -f ./$(DEPDIR)/chardata.Po
-rm -f ./$(DEPDIR)/memcheck.Po
-rm -f ./$(DEPDIR)/minicheck.Po
-rm -f ./$(DEPDIR)/runtests.Po
-rm -f ./$(DEPDIR)/runtestspp.Po
-rm -f ./$(DEPDIR)/structdata.Po
-rm -f Makefile -rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \ distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags distclean-tags
@@ -1175,7 +1199,12 @@ install-ps-am:
installcheck-am: installcheck-am:
maintainer-clean: maintainer-clean-recursive maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR) -rm -f ./$(DEPDIR)/chardata.Po
-rm -f ./$(DEPDIR)/memcheck.Po
-rm -f ./$(DEPDIR)/minicheck.Po
-rm -f ./$(DEPDIR)/runtests.Po
-rm -f ./$(DEPDIR)/runtestspp.Po
-rm -f ./$(DEPDIR)/structdata.Po
-rm -f Makefile -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -1196,20 +1225,21 @@ uninstall-am:
.MAKE: $(am__recursive_targets) check-am install-am install-strip .MAKE: $(am__recursive_targets) check-am install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
check-TESTS check-am clean clean-checkPROGRAMS clean-generic \ am--depfiles check check-TESTS check-am clean \
clean-libtool clean-noinstLIBRARIES cscopelist-am ctags \ clean-checkPROGRAMS clean-generic clean-libtool \
ctags-am distclean distclean-compile distclean-generic \ clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \
distclean-libtool distclean-tags distdir dvi dvi-am html \ distclean-compile distclean-generic distclean-libtool \
html-am info info-am install install-am install-data \ distclean-tags distdir dvi dvi-am html html-am info info-am \
install-data-am install-dvi install-dvi-am install-exec \ install install-am install-data install-data-am install-dvi \
install-exec-am install-html install-html-am install-info \ install-dvi-am install-exec install-exec-am install-html \
install-info-am install-man install-pdf install-pdf-am \ install-html-am install-info install-info-am install-man \
install-ps install-ps-am install-strip installcheck \ install-pdf install-pdf-am install-ps install-ps-am \
installcheck-am installdirs installdirs-am maintainer-clean \ install-strip installcheck installcheck-am installdirs \
maintainer-clean-generic mostlyclean mostlyclean-compile \ installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ mostlyclean mostlyclean-compile mostlyclean-generic \
recheck tags tags-am uninstall uninstall-am mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \
uninstall uninstall-am
.PRECIOUS: Makefile .PRECIOUS: Makefile
+30 -13
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am. # Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc. # Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@@ -124,7 +124,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \ $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
@@ -155,7 +162,8 @@ am__v_at_0 = @
am__v_at_1 = am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
am__depfiles_maybe = depfiles am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/benchmark.Po
am__mv = mv -f am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -357,8 +365,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \ *config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \ *) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac; esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -389,7 +397,13 @@ mostlyclean-compile:
distclean-compile: distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o: .c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -470,7 +484,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags: distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES) distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \ list='$(DISTFILES)'; \
@@ -540,7 +557,7 @@ clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
mostlyclean-am mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -rf ./$(DEPDIR) -rm -f ./$(DEPDIR)/benchmark.Po
-rm -f Makefile -rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \ distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags distclean-tags
@@ -586,7 +603,7 @@ install-ps-am:
installcheck-am: installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR) -rm -f ./$(DEPDIR)/benchmark.Po
-rm -f Makefile -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -607,9 +624,9 @@ uninstall-am:
.MAKE: install-am install-strip .MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \
ctags-am distclean distclean-compile distclean-generic \ ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \ distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \ html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \ install-data-am install-dvi install-dvi-am install-exec \
+31 -35
View File
@@ -49,15 +49,13 @@
#endif #endif
static void static void
usage(const char *prog, int rc) usage(const char *prog, int rc) {
{ fprintf(stderr, "usage: %s [-n] filename bufferSize nr_of_loops\n", prog);
fprintf(stderr,
"usage: %s [-n] filename bufferSize nr_of_loops\n", prog);
exit(rc); exit(rc);
} }
int main (int argc, char *argv[]) int
{ main(int argc, char *argv[]) {
XML_Parser parser; XML_Parser parser;
char *XMLBuf, *XMLBufEnd, *XMLBufPtr; char *XMLBuf, *XMLBufEnd, *XMLBufPtr;
FILE *fd; FILE *fd;
@@ -72,8 +70,7 @@ int main (int argc, char *argv[])
if (argv[1][1] == 'n' && argv[1][2] == '\0') { if (argv[1][1] == 'n' && argv[1][2] == '\0') {
ns = 1; ns = 1;
j = 1; j = 1;
} } else
else
usage(argv[0], 1); usage(argv[0], 1);
} }
} }
@@ -81,28 +78,27 @@ int main (int argc, char *argv[])
if (argc != j + 4) if (argc != j + 4)
usage(argv[0], 1); usage(argv[0], 1);
if (stat (argv[j + 1], &fileAttr) != 0) { if (stat(argv[j + 1], &fileAttr) != 0) {
fprintf (stderr, "could not access file '%s'\n", argv[j + 1]); fprintf(stderr, "could not access file '%s'\n", argv[j + 1]);
return 2; return 2;
} }
fd = fopen (argv[j + 1], "r"); fd = fopen(argv[j + 1], "r");
if (!fd) { if (! fd) {
fprintf (stderr, "could not open file '%s'\n", argv[j + 1]); fprintf(stderr, "could not open file '%s'\n", argv[j + 1]);
exit(2); exit(2);
} }
bufferSize = atoi (argv[j + 2]); bufferSize = atoi(argv[j + 2]);
nrOfLoops = atoi (argv[j + 3]); nrOfLoops = atoi(argv[j + 3]);
if (bufferSize <= 0 || nrOfLoops <= 0) { if (bufferSize <= 0 || nrOfLoops <= 0) {
fprintf (stderr, fprintf(stderr, "buffer size and nr of loops must be greater than zero.\n");
"buffer size and nr of loops must be greater than zero.\n");
exit(3); exit(3);
} }
XMLBuf = malloc (fileAttr.st_size); XMLBuf = malloc(fileAttr.st_size);
fileSize = fread (XMLBuf, sizeof (char), fileAttr.st_size, fd); fileSize = fread(XMLBuf, sizeof(char), fileAttr.st_size, fd);
fclose (fd); fclose(fd);
if (ns) if (ns)
parser = XML_ParserCreateNS(NULL, '!'); parser = XML_ParserCreateNS(NULL, '!');
@@ -121,29 +117,29 @@ int main (int argc, char *argv[])
isFinal = 1; isFinal = 1;
else else
parseBufferSize = bufferSize; parseBufferSize = bufferSize;
if (!XML_Parse (parser, XMLBufPtr, parseBufferSize, isFinal)) { if (! XML_Parse(parser, XMLBufPtr, parseBufferSize, isFinal)) {
fprintf (stderr, fprintf(stderr,
"error '%" XML_FMT_STR "' at line %" XML_FMT_INT_MOD \ "error '%" XML_FMT_STR "' at line %" XML_FMT_INT_MOD
"u character %" XML_FMT_INT_MOD "u\n", "u character %" XML_FMT_INT_MOD "u\n",
XML_ErrorString (XML_GetErrorCode (parser)), XML_ErrorString(XML_GetErrorCode(parser)),
XML_GetCurrentLineNumber (parser), XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber (parser)); XML_GetCurrentColumnNumber(parser));
free (XMLBuf); free(XMLBuf);
XML_ParserFree (parser); XML_ParserFree(parser);
exit (4); exit(4);
} }
XMLBufPtr += bufferSize; XMLBufPtr += bufferSize;
} while (!isFinal); } while (! isFinal);
tend = clock(); tend = clock();
cpuTime += ((double) (tend - tstart)) / CLOCKS_PER_SEC; cpuTime += ((double)(tend - tstart)) / CLOCKS_PER_SEC;
XML_ParserReset(parser, NULL); XML_ParserReset(parser, NULL);
i++; i++;
} }
XML_ParserFree (parser); XML_ParserFree(parser);
free (XMLBuf); free(XMLBuf);
printf ("%d loops, with buffer size %d. Average time per loop: %f\n", printf("%d loops, with buffer size %d. Average time per loop: %f\n",
nrOfLoops, bufferSize, cpuTime / (double) nrOfLoops); nrOfLoops, bufferSize, cpuTime / (double)nrOfLoops);
return 0; return 0;
} }
+5 -12
View File
@@ -41,10 +41,8 @@
#include "chardata.h" #include "chardata.h"
static int static int
xmlstrlen(const XML_Char *s) xmlstrlen(const XML_Char *s) {
{
int len = 0; int len = 0;
assert(s != NULL); assert(s != NULL);
while (s[len] != 0) while (s[len] != 0)
@@ -52,17 +50,14 @@ xmlstrlen(const XML_Char *s)
return len; return len;
} }
void void
CharData_Init(CharData *storage) CharData_Init(CharData *storage) {
{
assert(storage != NULL); assert(storage != NULL);
storage->count = -1; storage->count = -1;
} }
void void
CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len) CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len) {
{
int maxchars; int maxchars;
assert(storage != NULL); assert(storage != NULL);
@@ -76,15 +71,13 @@ CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len)
len = (maxchars - storage->count); len = (maxchars - storage->count);
} }
if (len + storage->count < (int)sizeof(storage->data)) { if (len + storage->count < (int)sizeof(storage->data)) {
memcpy(storage->data + storage->count, s, memcpy(storage->data + storage->count, s, len * sizeof(storage->data[0]));
len * sizeof(storage->data[0]));
storage->count += len; storage->count += len;
} }
} }
int int
CharData_CheckXMLChars(CharData *storage, const XML_Char *expected) CharData_CheckXMLChars(CharData *storage, const XML_Char *expected) {
{
char buffer[1024]; char buffer[1024];
int len = xmlstrlen(expected); int len = xmlstrlen(expected);
int count; int count;
+4 -7
View File
@@ -36,26 +36,23 @@ extern "C" {
#endif #endif
#ifndef XML_CHARDATA_H #ifndef XML_CHARDATA_H
#define XML_CHARDATA_H 1 # define XML_CHARDATA_H 1
#ifndef XML_VERSION
#include "expat.h" /* need XML_Char */
#endif
# ifndef XML_VERSION
# include "expat.h" /* need XML_Char */
# endif
typedef struct { typedef struct {
int count; /* # of chars, < 0 if not set */ int count; /* # of chars, < 0 if not set */
XML_Char data[2048]; XML_Char data[2048];
} CharData; } CharData;
void CharData_Init(CharData *storage); void CharData_Init(CharData *storage);
void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len); void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len);
int CharData_CheckXMLChars(CharData *storage, const XML_Char *s); int CharData_CheckXMLChars(CharData *storage, const XML_Char *s);
#endif /* XML_CHARDATA_H */ #endif /* XML_CHARDATA_H */
#ifdef __cplusplus #ifdef __cplusplus
+11 -19
View File
@@ -34,16 +34,15 @@
#include <stdlib.h> #include <stdlib.h>
#include "memcheck.h" #include "memcheck.h"
/* Structures to keep track of what has been allocated. Speed isn't a /* 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 * big issue for the tests this is required for, so we will use a
* doubly-linked list to make deletion easier. * doubly-linked list to make deletion easier.
*/ */
typedef struct allocation_entry { typedef struct allocation_entry {
struct allocation_entry * next; struct allocation_entry *next;
struct allocation_entry * prev; struct allocation_entry *prev;
void * allocation; void *allocation;
size_t num_bytes; size_t num_bytes;
} AllocationEntry; } AllocationEntry;
@@ -52,11 +51,9 @@ static AllocationEntry *alloc_tail = NULL;
static AllocationEntry *find_allocation(void *ptr); static AllocationEntry *find_allocation(void *ptr);
/* Allocate some memory and keep track of it. */ /* Allocate some memory and keep track of it. */
void * void *
tracking_malloc(size_t size) tracking_malloc(size_t size) {
{
AllocationEntry *entry = malloc(sizeof(AllocationEntry)); AllocationEntry *entry = malloc(sizeof(AllocationEntry));
if (entry == NULL) { if (entry == NULL) {
@@ -85,8 +82,7 @@ tracking_malloc(size_t size)
} }
static AllocationEntry * static AllocationEntry *
find_allocation(void *ptr) find_allocation(void *ptr) {
{
AllocationEntry *entry; AllocationEntry *entry;
for (entry = alloc_head; entry != NULL; entry = entry->next) { for (entry = alloc_head; entry != NULL; entry = entry->next) {
@@ -99,8 +95,7 @@ find_allocation(void *ptr)
/* Free some memory and remove the tracking for it */ /* Free some memory and remove the tracking for it */
void void
tracking_free(void *ptr) tracking_free(void *ptr) {
{
AllocationEntry *entry; AllocationEntry *entry;
if (ptr == NULL) { if (ptr == NULL) {
@@ -128,8 +123,7 @@ tracking_free(void *ptr)
/* Reallocate some memory and keep track of it */ /* Reallocate some memory and keep track of it */
void * void *
tracking_realloc(void *ptr, size_t size) tracking_realloc(void *ptr, size_t size) {
{
AllocationEntry *entry; AllocationEntry *entry;
if (ptr == NULL) { if (ptr == NULL) {
@@ -181,18 +175,16 @@ tracking_realloc(void *ptr, size_t size)
} }
int int
tracking_report(void) tracking_report(void) {
{
AllocationEntry *entry; AllocationEntry *entry;
if (alloc_head == NULL) if (alloc_head == NULL)
return 1; return 1;
/* Otherwise we have allocations that haven't been freed */ /* Otherwise we have allocations that haven't been freed */
for (entry = alloc_head; entry != NULL; entry = entry->next) for (entry = alloc_head; entry != NULL; entry = entry->next) {
{ printf("Allocated %lu bytes at %p\n", (long unsigned)entry->num_bytes,
printf("Allocated %lu bytes at %p\n", entry->allocation);
(long unsigned)entry->num_bytes, entry->allocation);
} }
return 0; return 0;
} }
+1 -1
View File
@@ -36,7 +36,7 @@ extern "C" {
#endif #endif
#ifndef XML_MEMCHECK_H #ifndef XML_MEMCHECK_H
#define XML_MEMCHECK_H 1 # define XML_MEMCHECK_H 1
/* Allocation declarations */ /* Allocation declarations */
+28 -41
View File
@@ -44,9 +44,8 @@
#include "minicheck.h" #include "minicheck.h"
Suite * Suite *
suite_create(const char *name) suite_create(const char *name) {
{ Suite *suite = (Suite *)calloc(1, sizeof(Suite));
Suite *suite = (Suite *) calloc(1, sizeof(Suite));
if (suite != NULL) { if (suite != NULL) {
suite->name = name; suite->name = name;
} }
@@ -54,9 +53,8 @@ suite_create(const char *name)
} }
TCase * TCase *
tcase_create(const char *name) tcase_create(const char *name) {
{ TCase *tc = (TCase *)calloc(1, sizeof(TCase));
TCase *tc = (TCase *) calloc(1, sizeof(TCase));
if (tc != NULL) { if (tc != NULL) {
tc->name = name; tc->name = name;
} }
@@ -64,8 +62,7 @@ tcase_create(const char *name)
} }
void void
suite_add_tcase(Suite *suite, TCase *tc) suite_add_tcase(Suite *suite, TCase *tc) {
{
assert(suite != NULL); assert(suite != NULL);
assert(tc != NULL); assert(tc != NULL);
assert(tc->next_tcase == NULL); assert(tc->next_tcase == NULL);
@@ -75,18 +72,15 @@ suite_add_tcase(Suite *suite, TCase *tc)
} }
void void
tcase_add_checked_fixture(TCase *tc, tcase_add_checked_fixture(TCase *tc, tcase_setup_function setup,
tcase_setup_function setup, tcase_teardown_function teardown) {
tcase_teardown_function teardown)
{
assert(tc != NULL); assert(tc != NULL);
tc->setup = setup; tc->setup = setup;
tc->teardown = teardown; tc->teardown = teardown;
} }
void void
tcase_add_test(TCase *tc, tcase_test_function test) tcase_add_test(TCase *tc, tcase_test_function test) {
{
assert(tc != NULL); assert(tc != NULL);
if (tc->allocated == tc->ntests) { if (tc->allocated == tc->ntests) {
int nalloc = tc->allocated + 100; int nalloc = tc->allocated + 100;
@@ -101,8 +95,7 @@ tcase_add_test(TCase *tc, tcase_test_function test)
} }
static void static void
tcase_free(TCase *tc) tcase_free(TCase *tc) {
{
if (! tc) { if (! tc) {
return; return;
} }
@@ -112,8 +105,7 @@ tcase_free(TCase *tc)
} }
static void static void
suite_free(Suite *suite) suite_free(Suite *suite) {
{
if (! suite) { if (! suite) {
return; return;
} }
@@ -127,8 +119,7 @@ suite_free(Suite *suite)
} }
SRunner * SRunner *
srunner_create(Suite *suite) srunner_create(Suite *suite) {
{
SRunner *runner = calloc(1, sizeof(SRunner)); SRunner *runner = calloc(1, sizeof(SRunner));
if (runner != NULL) { if (runner != NULL) {
runner->suite = suite; runner->suite = suite;
@@ -143,34 +134,30 @@ static int _check_current_lineno = -1;
static char const *_check_current_filename = NULL; static char const *_check_current_filename = NULL;
void void
_check_set_test_info(char const *function, char const *filename, int lineno) _check_set_test_info(char const *function, char const *filename, int lineno) {
{
_check_current_function = function; _check_current_function = function;
_check_current_lineno = lineno; _check_current_lineno = lineno;
_check_current_filename = filename; _check_current_filename = filename;
} }
static void static void
add_failure(SRunner *runner, int verbosity) add_failure(SRunner *runner, int verbosity) {
{
runner->nfailures++; runner->nfailures++;
if (verbosity >= CK_VERBOSE) { if (verbosity >= CK_VERBOSE) {
printf("%s:%d: %s\n", _check_current_filename, printf("%s:%d: %s\n", _check_current_filename, _check_current_lineno,
_check_current_lineno, _check_current_function); _check_current_function);
} }
} }
void void
srunner_run_all(SRunner *runner, int verbosity) srunner_run_all(SRunner *runner, int verbosity) {
{
Suite *suite; Suite *suite;
TCase *tc; TCase *volatile tc;
assert(runner != NULL); assert(runner != NULL);
suite = runner->suite; suite = runner->suite;
tc = suite->tests; tc = suite->tests;
while (tc != NULL) { while (tc != NULL) {
int i; volatile int i;
for (i = 0; i < tc->ntests; ++i) { for (i = 0; i < tc->ntests; ++i) {
runner->nchecks++; runner->nchecks++;
@@ -202,20 +189,22 @@ srunner_run_all(SRunner *runner, int verbosity)
} }
if (verbosity) { if (verbosity) {
int passed = runner->nchecks - runner->nfailures; int passed = runner->nchecks - runner->nfailures;
double percentage = ((double) passed) / runner->nchecks; double percentage = ((double)passed) / runner->nchecks;
int display = (int) (percentage * 100); int display = (int)(percentage * 100);
printf("%d%%: Checks: %d, Failed: %d\n", printf("%d%%: Checks: %d, Failed: %d\n", display, runner->nchecks,
display, runner->nchecks, runner->nfailures); runner->nfailures);
} }
} }
void void
_fail_unless(int UNUSED_P(condition), const char *UNUSED_P(file), int UNUSED_P(line), const char *msg) _fail_unless(int condition, const char *file, int line, const char *msg) {
{
/* Always print the error message so it isn't lost. In this case, /* Always print the error message so it isn't lost. In this case,
we have a failure, so there's no reason to be quiet about what we have a failure, so there's no reason to be quiet about what
it is. it is.
*/ */
UNUSED_P(condition);
UNUSED_P(file);
UNUSED_P(line);
if (msg != NULL) { if (msg != NULL) {
const int has_newline = (msg[strlen(msg) - 1] == '\n'); const int has_newline = (msg[strlen(msg) - 1] == '\n');
fprintf(stderr, "ERROR: %s%s", msg, has_newline ? "" : "\n"); fprintf(stderr, "ERROR: %s%s", msg, has_newline ? "" : "\n");
@@ -224,15 +213,13 @@ _fail_unless(int UNUSED_P(condition), const char *UNUSED_P(file), int UNUSED_P(l
} }
int int
srunner_ntests_failed(SRunner *runner) srunner_ntests_failed(SRunner *runner) {
{
assert(runner != NULL); assert(runner != NULL);
return runner->nfailures; return runner->nfailures;
} }
void void
srunner_free(SRunner *runner) srunner_free(SRunner *runner) {
{
if (! runner) { if (! runner) {
return; return;
} }
+10 -10
View File
@@ -51,14 +51,17 @@ extern "C" {
C compiler has a working __func__, but the C++ compiler only has a C compiler has a working __func__, but the C++ compiler only has a
working __FUNCTION__. This could be fixed in configure.in, but it's working __FUNCTION__. This could be fixed in configure.in, but it's
not worth it right now. */ not worth it right now. */
#if defined (_MSC_VER) || (defined(__osf__) && defined(__cplusplus)) #if defined(_MSC_VER) || (defined(__osf__) && defined(__cplusplus))
#define __func__ __FUNCTION__ # define __func__ __FUNCTION__
#endif #endif
#define START_TEST(testname) static void testname(void) { \ #define START_TEST(testname) \
static void testname(void) { \
_check_set_test_info(__func__, __FILE__, __LINE__); \ _check_set_test_info(__func__, __FILE__, __LINE__); \
{ {
#define END_TEST } } #define END_TEST \
} \
}
#define fail(msg) _fail_unless(0, __FILE__, __LINE__, msg) #define fail(msg) _fail_unless(0, __FILE__, __LINE__, msg)
@@ -91,11 +94,9 @@ struct TCase {
TCase *next_tcase; TCase *next_tcase;
}; };
/* Internal helper. */ /* Internal helper. */
void _check_set_test_info(char const *function, void _check_set_test_info(char const *function, char const *filename,
char const *filename, int lineno); int lineno);
/* /*
* Prototypes for the actual implementation. * Prototypes for the actual implementation.
@@ -105,8 +106,7 @@ void _fail_unless(int condition, const char *file, int line, const char *msg);
Suite *suite_create(const char *name); Suite *suite_create(const char *name);
TCase *tcase_create(const char *name); TCase *tcase_create(const char *name);
void suite_add_tcase(Suite *suite, TCase *tc); void suite_add_tcase(Suite *suite, TCase *tc);
void tcase_add_checked_fixture(TCase *, void tcase_add_checked_fixture(TCase *, tcase_setup_function,
tcase_setup_function,
tcase_teardown_function); tcase_teardown_function);
void tcase_add_test(TCase *tc, tcase_test_function test); void tcase_add_test(TCase *tc, tcase_test_function test);
SRunner *srunner_create(Suite *suite); SRunner *srunner_create(Suite *suite);
+3215 -3989
View File
File diff suppressed because it is too large Load Diff
+22 -29
View File
@@ -34,7 +34,6 @@
# include "expat_config.h" # include "expat_config.h"
#endif #endif
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@@ -56,10 +55,8 @@
# define xcstrcmp(s, t) strcmp((s), (t)) # define xcstrcmp(s, t) strcmp((s), (t))
#endif #endif
static XML_Char * static XML_Char *
xmlstrdup(const XML_Char *s) xmlstrdup(const XML_Char *s) {
{
size_t byte_count = (xcstrlen(s) + 1) * sizeof(XML_Char); size_t byte_count = (xcstrlen(s) + 1) * sizeof(XML_Char);
XML_Char *dup = malloc(byte_count); XML_Char *dup = malloc(byte_count);
@@ -68,10 +65,8 @@ xmlstrdup(const XML_Char *s)
return dup; return dup;
} }
void void
StructData_Init(StructData *storage) StructData_Init(StructData *storage) {
{
assert(storage != NULL); assert(storage != NULL);
storage->count = 0; storage->count = 0;
storage->max_count = 0; storage->max_count = 0;
@@ -79,12 +74,8 @@ StructData_Init(StructData *storage)
} }
void void
StructData_AddItem(StructData *storage, StructData_AddItem(StructData *storage, const XML_Char *s, int data0, int data1,
const XML_Char *s, int data2) {
int data0,
int data1,
int data2)
{
StructDataEntry *entry; StructDataEntry *entry;
assert(storage != NULL); assert(storage != NULL);
@@ -111,10 +102,8 @@ StructData_AddItem(StructData *storage,
* in returning a value from this function. * in returning a value from this function.
*/ */
void void
StructData_CheckItems(StructData *storage, StructData_CheckItems(StructData *storage, const StructDataEntry *expected,
const StructDataEntry *expected, int count) {
int count)
{
char buffer[1024]; char buffer[1024];
int i; int i;
@@ -125,38 +114,42 @@ StructData_CheckItems(StructData *storage,
storage->count, count); storage->count, count);
StructData_Dispose(storage); StructData_Dispose(storage);
fail(buffer); fail(buffer);
} } else {
for (i = 0; i < count; i++) for (i = 0; i < count; i++) {
{
const StructDataEntry *got = &storage->entries[i]; const StructDataEntry *got = &storage->entries[i];
const StructDataEntry *want = &expected[i]; const StructDataEntry *want = &expected[i];
assert(got != NULL);
assert(want != NULL);
if (xcstrcmp(got->str, want->str) != 0) { if (xcstrcmp(got->str, want->str) != 0) {
StructData_Dispose(storage); StructData_Dispose(storage);
fail("structure got bad string"); fail("structure got bad string");
} } else {
if (got->data0 != want->data0 || if (got->data0 != want->data0 || got->data1 != want->data1
got->data1 != want->data1 || || got->data2 != want->data2) {
got->data2 != want->data2) {
sprintf(buffer, sprintf(buffer,
"struct '%" XML_FMT_STR "struct '%" XML_FMT_STR
"' expected (%d,%d,%d), got (%d,%d,%d)", "' expected (%d,%d,%d), got (%d,%d,%d)",
got->str, got->str, want->data0, want->data1, want->data2, got->data0,
want->data0, want->data1, want->data2, got->data1, got->data2);
got->data0, got->data1, got->data2);
StructData_Dispose(storage); StructData_Dispose(storage);
fail(buffer); fail(buffer);
} }
} }
}
}
} }
void void
StructData_Dispose(StructData *storage) StructData_Dispose(StructData *storage) {
{
int i; int i;
assert(storage != NULL); assert(storage != NULL);
for (i = 0; i < storage->count; i++) for (i = 0; i < storage->count; i++)
free((void *)storage->entries[i].str); free((void *)storage->entries[i].str);
free(storage->entries); free(storage->entries);
storage->count = 0;
storage->entries = NULL;
} }
+5 -11
View File
@@ -36,9 +36,9 @@ extern "C" {
#endif #endif
#ifndef XML_STRUCTDATA_H #ifndef XML_STRUCTDATA_H
#define XML_STRUCTDATA_H 1 # define XML_STRUCTDATA_H 1
#include "expat.h" # include "expat.h"
typedef struct { typedef struct {
const XML_Char *str; const XML_Char *str;
@@ -53,22 +53,16 @@ typedef struct {
StructDataEntry *entries; StructDataEntry *entries;
} StructData; } StructData;
void StructData_Init(StructData *storage); void StructData_Init(StructData *storage);
void StructData_AddItem(StructData *storage, void StructData_AddItem(StructData *storage, const XML_Char *s, int data0,
const XML_Char *s, int data1, int data2);
int data0,
int data1,
int data2);
void StructData_CheckItems(StructData *storage, void StructData_CheckItems(StructData *storage, const StructDataEntry *expected,
const StructDataEntry *expected,
int count); int count);
void StructData_Dispose(StructData *storage); void StructData_Dispose(StructData *storage);
#endif /* XML_STRUCTDATA_H */ #endif /* XML_STRUCTDATA_H */
#ifdef __cplusplus #ifdef __cplusplus
+6 -11
View File
@@ -22,17 +22,16 @@
shopt -s nullglob shopt -s nullglob
# Note: OUTPUT must terminate with the directory separator.
OUTPUT="$PWD/tests/out/"
TS="$PWD/tests/"
MYDIR="`dirname \"$0\"`" MYDIR="`dirname \"$0\"`"
cd "$MYDIR" cd "$MYDIR"
MYDIR="`pwd`" MYDIR="`pwd`"
XMLWF="${1:-`dirname \"$MYDIR\"`/xmlwf/xmlwf}" XMLWF="${1:-`dirname \"$MYDIR\"`/xmlwf/xmlwf}"
# XMLWF=/usr/local/bin/xmlwf
TS="$MYDIR"
# OUTPUT must terminate with the directory separator.
OUTPUT="$TS/out/"
# OUTPUT=/home/tmp/xml-testsuite-out/
# Unicode-aware diff utility # Unicode-aware diff utility
DIFF="$TS/udiffer.py" DIFF="${MYDIR}/udiffer.py"
# RunXmlwfNotWF file reldir # RunXmlwfNotWF file reldir
@@ -40,9 +39,7 @@ DIFF="$TS/udiffer.py"
RunXmlwfNotWF() { RunXmlwfNotWF() {
file="$1" file="$1"
reldir="$2" reldir="$2"
$XMLWF -p "$file" > outfile || return $? if $XMLWF -p "$file" > /dev/null; then
read outdata < outfile
if test "$outdata" = "" ; then
echo "Expected not well-formed: $reldir$file" echo "Expected not well-formed: $reldir$file"
return 1 return 1
else else
@@ -133,7 +130,6 @@ for xmldir in ibm/not-wf/P* \
RunXmlwfNotWF "$xmlfile" "$xmldir/" RunXmlwfNotWF "$xmlfile" "$xmldir/"
UpdateStatus $? UpdateStatus $?
done done
rm outfile
done done
cd "$TS/xmlconf/oasis" cd "$TS/xmlconf/oasis"
@@ -141,7 +137,6 @@ for xmlfile in *fail*.xml ; do
RunXmlwfNotWF "$xmlfile" "oasis/" RunXmlwfNotWF "$xmlfile" "oasis/"
UpdateStatus $? UpdateStatus $?
done done
rm outfile
echo "Passed: $SUCCESS" echo "Passed: $SUCCESS"
echo "Failed: $ERROR" echo "Failed: $ERROR"
+1 -3
View File
@@ -56,6 +56,4 @@ EXTRA_DIST = \
xmlfile.h \ xmlfile.h \
xmlmime.c \ xmlmime.c \
xmlmime.h \ xmlmime.h \
xmltchar.h \ xmltchar.h
xmlurl.h \
xmlwin32url.cxx
+40 -17
View File
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15.1 from Makefile.am. # Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2017 Free Software Foundation, Inc. # Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@@ -125,7 +125,14 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/conftools/ac_c_bigendian_cross.m4 \ $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/conftools/ax-require-defined.m4 \
$(top_srcdir)/conftools/ax-check-compile-flag.m4 \
$(top_srcdir)/conftools/ax-check-link-flag.m4 \
$(top_srcdir)/conftools/ax-append-flag.m4 \
$(top_srcdir)/conftools/ax-append-compile-flags.m4 \
$(top_srcdir)/conftools/ax-append-link-flags.m4 \
$(top_srcdir)/conftools/expatcfg-compiler-supports-visibility.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
@@ -161,7 +168,10 @@ am__v_at_0 = @
am__v_at_1 = am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp depcomp = $(SHELL) $(top_srcdir)/conftools/depcomp
am__depfiles_maybe = depfiles am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/xmlwf-@FILEMAP@.Po \
./$(DEPDIR)/xmlwf-codepage.Po ./$(DEPDIR)/xmlwf-xmlfile.Po \
./$(DEPDIR)/xmlwf-xmlwf.Po
am__mv = mv -f am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -355,9 +365,7 @@ EXTRA_DIST = \
xmlfile.h \ xmlfile.h \
xmlmime.c \ xmlmime.c \
xmlmime.h \ xmlmime.h \
xmltchar.h \ xmltchar.h
xmlurl.h \
xmlwin32url.cxx
all: all-am all: all-am
@@ -380,8 +388,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \ *config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \ *) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac; esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -452,10 +460,16 @@ mostlyclean-compile:
distclean-compile: distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-@FILEMAP@.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-@FILEMAP@.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-codepage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-codepage.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlfile.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlwf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlwf-xmlwf.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o: .c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -592,7 +606,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags: distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES) distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \ list='$(DISTFILES)'; \
@@ -664,7 +681,10 @@ clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -rf ./$(DEPDIR) -rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po
-rm -f ./$(DEPDIR)/xmlwf-codepage.Po
-rm -f ./$(DEPDIR)/xmlwf-xmlfile.Po
-rm -f ./$(DEPDIR)/xmlwf-xmlwf.Po
-rm -f Makefile -rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \ distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags distclean-tags
@@ -710,7 +730,10 @@ install-ps-am:
installcheck-am: installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR) -rm -f ./$(DEPDIR)/xmlwf-@FILEMAP@.Po
-rm -f ./$(DEPDIR)/xmlwf-codepage.Po
-rm -f ./$(DEPDIR)/xmlwf-xmlfile.Po
-rm -f ./$(DEPDIR)/xmlwf-xmlwf.Po
-rm -f Makefile -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -731,7 +754,7 @@ uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip .MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
ctags ctags-am distclean distclean-compile distclean-generic \ ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \ distclean-libtool distclean-tags distdir dvi dvi-am html \
+19 -17
View File
@@ -34,22 +34,21 @@
#include "internal.h" /* for UNUSED_P only */ #include "internal.h" /* for UNUSED_P only */
#if defined(_WIN32) #if defined(_WIN32)
#define STRICT 1 # define STRICT 1
#define WIN32_LEAN_AND_MEAN 1 # define WIN32_LEAN_AND_MEAN 1
#include <windows.h> # include <windows.h>
int int
codepageMap(int cp, int *map) codepageMap(int cp, int *map) {
{
int i; int i;
CPINFO info; CPINFO info;
if (!GetCPInfo(cp, &info) || info.MaxCharSize > 2) if (! GetCPInfo(cp, &info) || info.MaxCharSize > 2)
return 0; return 0;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
map[i] = -1; map[i] = -1;
if (info.MaxCharSize > 1) { if (info.MaxCharSize > 1) {
for (i = 0; i < MAX_LEADBYTES; i+=2) { for (i = 0; i < MAX_LEADBYTES; i += 2) {
int j, lim; int j, lim;
if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0) if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0)
break; break;
@@ -62,8 +61,9 @@ codepageMap(int cp, int *map)
if (map[i] == -1) { if (map[i] == -1) {
char c = (char)i; char c = (char)i;
unsigned short n; unsigned short n;
if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, if (MultiByteToWideChar(cp, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, &c, 1,
&c, 1, &n, 1) == 1) &n, 1)
== 1)
map[i] = n; map[i] = n;
} }
} }
@@ -71,11 +71,11 @@ codepageMap(int cp, int *map)
} }
int int
codepageConvert(int cp, const char *p) codepageConvert(int cp, const char *p) {
{
unsigned short c; unsigned short c;
if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, if (MultiByteToWideChar(cp, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS, p, 2, &c,
p, 2, &c, 1) == 1) 1)
== 1)
return c; return c;
return -1; return -1;
} }
@@ -83,14 +83,16 @@ codepageConvert(int cp, const char *p)
#else /* not _WIN32 */ #else /* not _WIN32 */
int int
codepageMap(int UNUSED_P(cp), int *UNUSED_P(map)) codepageMap(int cp, int *map) {
{ UNUSED_P(cp);
UNUSED_P(map);
return 0; return 0;
} }
int int
codepageConvert(int UNUSED_P(cp), const char *UNUSED_P(p)) codepageConvert(int cp, const char *p) {
{ UNUSED_P(cp);
UNUSED_P(p);
return -1; return -1;
} }
+9 -15
View File
@@ -33,8 +33,7 @@
#define CHARSET_MAX 41 #define CHARSET_MAX 41
static const char * static const char *
getTok(const char **pp) getTok(const char **pp) {
{
enum { inAtom, inString, init, inComment }; enum { inAtom, inString, init, inComment };
int state = init; int state = init;
const char *tokStart = 0; const char *tokStart = 0;
@@ -102,9 +101,8 @@ getTok(const char **pp)
/* key must be lowercase ASCII */ /* key must be lowercase ASCII */
static int static int
matchkey(const char *start, const char *end, const char *key) matchkey(const char *start, const char *end, const char *key) {
{ if (! start)
if (!start)
return 0; return 0;
for (; start != end; start++, key++) for (; start != end; start++, key++)
if (*start != *key && *start != 'A' + (*key - 'a')) if (*start != *key && *start != 'A' + (*key - 'a'))
@@ -113,8 +111,7 @@ matchkey(const char *start, const char *end, const char *key)
} }
void void
getXMLCharset(const char *buf, char *charset) getXMLCharset(const char *buf, char *charset) {
{
const char *next, *p; const char *next, *p;
charset[0] = '\0'; charset[0] = '\0';
@@ -122,10 +119,10 @@ getXMLCharset(const char *buf, char *charset)
p = getTok(&next); p = getTok(&next);
if (matchkey(p, next, "text")) if (matchkey(p, next, "text"))
strcpy(charset, "us-ascii"); strcpy(charset, "us-ascii");
else if (!matchkey(p, next, "application")) else if (! matchkey(p, next, "application"))
return; return;
p = getTok(&next); p = getTok(&next);
if (!p || *p != '/') if (! p || *p != '/')
return; return;
p = getTok(&next); p = getTok(&next);
if (matchkey(p, next, "xml")) if (matchkey(p, next, "xml"))
@@ -151,8 +148,7 @@ getXMLCharset(const char *buf, char *charset)
*s++ = *p; *s++ = *p;
} }
*s++ = '\0'; *s++ = '\0';
} } else {
else {
if (next - p > CHARSET_MAX - 1) if (next - p > CHARSET_MAX - 1)
break; break;
while (p != next) while (p != next)
@@ -163,15 +159,13 @@ getXMLCharset(const char *buf, char *charset)
} }
} }
} }
} } else
else
p = getTok(&next); p = getTok(&next);
} }
} }
int int
main(int argc, char **argv) main(int argc, char **argv) {
{
char buf[CHARSET_MAX]; char buf[CHARSET_MAX];
getXMLCharset(argv[1], buf); getXMLCharset(argv[1], buf);
printf("charset = \"%s\"\n", buf); printf("charset = \"%s\"\n", buf);
+2 -6
View File
@@ -33,7 +33,6 @@
#include <limits.h> /* INT_MAX */ #include <limits.h> /* INT_MAX */
#include <stddef.h> #include <stddef.h>
/* The following limit (for XML_Parse's int len) derives from /* The following limit (for XML_Parse's int len) derives from
* this loop in xmparse.c: * this loop in xmparse.c:
* *
@@ -43,15 +42,12 @@
*/ */
#define XML_MAX_CHUNK_LEN (INT_MAX / 2 + 1) #define XML_MAX_CHUNK_LEN (INT_MAX / 2 + 1)
#ifdef XML_UNICODE #ifdef XML_UNICODE
int filemap(const wchar_t *name, int filemap(const wchar_t *name,
void (*processor)(const void *, size_t, void (*processor)(const void *, size_t, const wchar_t *, void *arg),
const wchar_t *, void *arg),
void *arg); void *arg);
#else #else
int filemap(const char *name, int filemap(const char *name,
void (*processor)(const void *, size_t, void (*processor)(const void *, size_t, const char *, void *arg),
const char *, void *arg),
void *arg); void *arg);
#endif #endif
+8 -9
View File
@@ -37,19 +37,19 @@
#include <stdio.h> #include <stdio.h>
/* Functions close(2) and read(2) */ /* Functions close(2) and read(2) */
#if !defined(_WIN32) && !defined(_WIN64) #if ! defined(_WIN32) && ! defined(_WIN64)
# include <unistd.h> # include <unistd.h>
#endif #endif
/* Function "read": */ /* Function "read": */
#if defined(_MSC_VER) #if defined(_MSC_VER)
# include <io.h> # include <io.h>
/* https://msdn.microsoft.com/en-us/library/wyssk1bs(v=vs.100).aspx */ /* https://msdn.microsoft.com/en-us/library/wyssk1bs(v=vs.100).aspx */
# define _EXPAT_read _read # define _EXPAT_read _read
# define _EXPAT_read_count_t int # define _EXPAT_read_count_t int
# define _EXPAT_read_req_t unsigned int # define _EXPAT_read_req_t unsigned int
#else /* POSIX */ #else /* POSIX */
/* http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html */ /* http://pubs.opengroup.org/onlinepubs/009695399/functions/read.html */
# define _EXPAT_read read # define _EXPAT_read read
# define _EXPAT_read_count_t ssize_t # define _EXPAT_read_count_t ssize_t
# define _EXPAT_read_req_t size_t # define _EXPAT_read_req_t size_t
@@ -62,7 +62,7 @@
# ifndef S_IFMT # ifndef S_IFMT
# define S_IFMT _S_IFMT # define S_IFMT _S_IFMT
# endif # endif
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) # define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
#endif /* not S_ISREG */ #endif /* not S_ISREG */
#ifndef O_BINARY #ifndef O_BINARY
@@ -79,15 +79,14 @@
int int
filemap(const tchar *name, filemap(const tchar *name,
void (*processor)(const void *, size_t, const tchar *, void *arg), void (*processor)(const void *, size_t, const tchar *, void *arg),
void *arg) void *arg) {
{
size_t nbytes; size_t nbytes;
int fd; int fd;
_EXPAT_read_count_t n; _EXPAT_read_count_t n;
struct stat sb; struct stat sb;
void *p; void *p;
fd = topen(name, O_RDONLY|O_BINARY); fd = topen(name, O_RDONLY | O_BINARY);
if (fd < 0) { if (fd < 0) {
tperror(name); tperror(name);
return 0; return 0;
@@ -97,7 +96,7 @@ filemap(const tchar *name,
close(fd); close(fd);
return 0; return 0;
} }
if (!S_ISREG(sb.st_mode)) { if (! S_ISREG(sb.st_mode)) {
ftprintf(stderr, T("%s: not a regular file\n"), name); ftprintf(stderr, T("%s: not a regular file\n"), name);
close(fd); close(fd);
return 0; return 0;
@@ -116,7 +115,7 @@ filemap(const tchar *name,
return 1; return 1;
} }
p = malloc(nbytes); p = malloc(nbytes);
if (!p) { if (! p) {
ftprintf(stderr, T("%s: out of memory\n"), name); ftprintf(stderr, T("%s: out of memory\n"), name);
close(fd); close(fd);
return 0; return 0;
+5 -6
View File
@@ -40,7 +40,7 @@
#include <unistd.h> #include <unistd.h>
#ifndef MAP_FILE #ifndef MAP_FILE
#define MAP_FILE 0 # define MAP_FILE 0
#endif #endif
#include "xmltchar.h" #include "xmltchar.h"
@@ -55,8 +55,7 @@
int int
filemap(const tchar *name, filemap(const tchar *name,
void (*processor)(const void *, size_t, const tchar *, void *arg), void (*processor)(const void *, size_t, const tchar *, void *arg),
void *arg) void *arg) {
{
int fd; int fd;
size_t nbytes; size_t nbytes;
struct stat sb; struct stat sb;
@@ -72,7 +71,7 @@ filemap(const tchar *name,
close(fd); close(fd);
return 0; return 0;
} }
if (!S_ISREG(sb.st_mode)) { if (! S_ISREG(sb.st_mode)) {
close(fd); close(fd);
fprintf(stderr, "%" XML_FMT_STR ": not a regular file\n", name); fprintf(stderr, "%" XML_FMT_STR ": not a regular file\n", name);
return 0; return 0;
@@ -90,8 +89,8 @@ filemap(const tchar *name,
close(fd); close(fd);
return 1; return 1;
} }
p = (void *)mmap((void *)0, (size_t)nbytes, PROT_READ, p = (void *)mmap((void *)0, (size_t)nbytes, PROT_READ, MAP_FILE | MAP_PRIVATE,
MAP_FILE|MAP_PRIVATE, fd, (off_t)0); fd, (off_t)0);
if (p == (void *)-1) { if (p == (void *)-1) {
tperror(name); tperror(name);
close(fd); close(fd);
+6 -13
View File
@@ -53,8 +53,7 @@ static void win32perror(const TCHAR *);
int int
filemap(const TCHAR *name, filemap(const TCHAR *name,
void (*processor)(const void *, size_t, const TCHAR *, void *arg), void (*processor)(const void *, size_t, const TCHAR *, void *arg),
void *arg) void *arg) {
{
HANDLE f; HANDLE f;
HANDLE m; HANDLE m;
DWORD size; DWORD size;
@@ -105,21 +104,15 @@ filemap(const TCHAR *name,
} }
static void static void
win32perror(const TCHAR *s) win32perror(const TCHAR *s) {
{
LPVOID buf; LPVOID buf;
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
| FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
NULL, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buf, 0,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &buf,
0,
NULL)) { NULL)) {
_ftprintf(stderr, _T("%s: %s"), s, buf); _ftprintf(stderr, _T("%s: %s"), s, buf);
fflush(stderr); fflush(stderr);
LocalFree(buf); LocalFree(buf);
} } else
else
_ftprintf(stderr, _T("%s: unknown Windows error\n"), s); _ftprintf(stderr, _T("%s: unknown Windows error\n"), s);
} }
+49 -66
View File
@@ -37,9 +37,9 @@
#include <fcntl.h> #include <fcntl.h>
#ifdef _WIN32 #ifdef _WIN32
#include "winconfig.h" # include "winconfig.h"
#elif defined(HAVE_EXPAT_CONFIG_H) #elif defined(HAVE_EXPAT_CONFIG_H)
#include <expat_config.h> # include <expat_config.h>
#endif /* ndef _WIN32 */ #endif /* ndef _WIN32 */
#include "expat.h" #include "expat.h"
@@ -49,75 +49,65 @@
#include "filemap.h" #include "filemap.h"
#if defined(_MSC_VER) #if defined(_MSC_VER)
#include <io.h> # include <io.h>
#endif #endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> # include <unistd.h>
#endif #endif
#ifndef O_BINARY #ifndef O_BINARY
#ifdef _O_BINARY # ifdef _O_BINARY
#define O_BINARY _O_BINARY # define O_BINARY _O_BINARY
#else # else
#define O_BINARY 0 # define O_BINARY 0
#endif # endif
#endif #endif
#ifdef _DEBUG #ifdef _DEBUG
#define READ_SIZE 16 # define READ_SIZE 16
#else #else
#define READ_SIZE (1024*8) # define READ_SIZE (1024 * 8)
#endif #endif
typedef struct { typedef struct {
XML_Parser parser; XML_Parser parser;
int *retPtr; int *retPtr;
} PROCESS_ARGS; } PROCESS_ARGS;
static int static int processStream(const XML_Char *filename, XML_Parser parser);
processStream(const XML_Char *filename, XML_Parser parser);
static void static void
reportError(XML_Parser parser, const XML_Char *filename) reportError(XML_Parser parser, const XML_Char *filename) {
{
enum XML_Error code = XML_GetErrorCode(parser); enum XML_Error code = XML_GetErrorCode(parser);
const XML_Char *message = XML_ErrorString(code); const XML_Char *message = XML_ErrorString(code);
if (message) if (message)
ftprintf(stdout, ftprintf(stdout,
T("%s") T("%s") T(":%") T(XML_FMT_INT_MOD) T("u") T(":%")
T(":%") T(XML_FMT_INT_MOD) T("u") T(XML_FMT_INT_MOD) T("u") T(": %s\n"),
T(":%") T(XML_FMT_INT_MOD) T("u") filename, XML_GetErrorLineNumber(parser),
T(": %s\n"), XML_GetErrorColumnNumber(parser), message);
filename,
XML_GetErrorLineNumber(parser),
XML_GetErrorColumnNumber(parser),
message);
else else
ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code); ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code);
} }
/* This implementation will give problems on files larger than INT_MAX. */ /* This implementation will give problems on files larger than INT_MAX. */
static void static void
processFile(const void *data, size_t size, processFile(const void *data, size_t size, const XML_Char *filename,
const XML_Char *filename, void *args) void *args) {
{
XML_Parser parser = ((PROCESS_ARGS *)args)->parser; XML_Parser parser = ((PROCESS_ARGS *)args)->parser;
int *retPtr = ((PROCESS_ARGS *)args)->retPtr; int *retPtr = ((PROCESS_ARGS *)args)->retPtr;
if (XML_Parse(parser, (const char *)data, (int)size, 1) == XML_STATUS_ERROR) { if (XML_Parse(parser, (const char *)data, (int)size, 1) == XML_STATUS_ERROR) {
reportError(parser, filename); reportError(parser, filename);
*retPtr = 0; *retPtr = 0;
} } else
else
*retPtr = 1; *retPtr = 1;
} }
#if defined(_WIN32) #if defined(_WIN32)
static int static int
isAsciiLetter(XML_Char c) isAsciiLetter(XML_Char c) {
{
return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z')); return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z'));
} }
@@ -125,12 +115,10 @@ isAsciiLetter(XML_Char c)
static const XML_Char * static const XML_Char *
resolveSystemId(const XML_Char *base, const XML_Char *systemId, resolveSystemId(const XML_Char *base, const XML_Char *systemId,
XML_Char **toFree) XML_Char **toFree) {
{
XML_Char *s; XML_Char *s;
*toFree = 0; *toFree = 0;
if (!base if (! base || *systemId == T('/')
|| *systemId == T('/')
#if defined(_WIN32) #if defined(_WIN32)
|| *systemId == T('\\') || *systemId == T('\\')
|| (isAsciiLetter(systemId[0]) && systemId[1] == T(':')) || (isAsciiLetter(systemId[0]) && systemId[1] == T(':'))
@@ -139,7 +127,7 @@ resolveSystemId(const XML_Char *base, const XML_Char *systemId,
return systemId; return systemId;
*toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2) *toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2)
* sizeof(XML_Char)); * sizeof(XML_Char));
if (!*toFree) if (! *toFree)
return systemId; return systemId;
tcscpy(*toFree, base); tcscpy(*toFree, base);
s = *toFree; s = *toFree;
@@ -154,18 +142,16 @@ resolveSystemId(const XML_Char *base, const XML_Char *systemId,
} }
static int static int
externalEntityRefFilemap(XML_Parser parser, externalEntityRefFilemap(XML_Parser parser, const XML_Char *context,
const XML_Char *context, const XML_Char *base, const XML_Char *systemId,
const XML_Char *base, const XML_Char *publicId) {
const XML_Char *systemId,
const XML_Char *UNUSED_P(publicId))
{
int result; int result;
XML_Char *s; XML_Char *s;
const XML_Char *filename; const XML_Char *filename;
XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0);
int filemapRes; int filemapRes;
PROCESS_ARGS args; PROCESS_ARGS args;
UNUSED_P(publicId);
args.retPtr = &result; args.retPtr = &result;
args.parser = entParser; args.parser = entParser;
filename = resolveSystemId(base, systemId, &s); filename = resolveSystemId(base, systemId, &s);
@@ -176,8 +162,10 @@ externalEntityRefFilemap(XML_Parser parser,
result = 0; result = 0;
break; break;
case 2: case 2:
ftprintf(stderr, T("%s: file too large for memory-mapping") ftprintf(stderr,
T(", switching to streaming\n"), filename); T("%s: file too large for memory-mapping")
T(", switching to streaming\n"),
filename);
result = processStream(filename, entParser); result = processStream(filename, entParser);
break; break;
} }
@@ -187,13 +175,12 @@ externalEntityRefFilemap(XML_Parser parser,
} }
static int static int
processStream(const XML_Char *filename, XML_Parser parser) processStream(const XML_Char *filename, XML_Parser parser) {
{
/* passing NULL for filename means read intput from stdin */ /* passing NULL for filename means read intput from stdin */
int fd = 0; /* 0 is the fileno for stdin */ int fd = 0; /* 0 is the fileno for stdin */
if (filename != NULL) { if (filename != NULL) {
fd = topen(filename, O_BINARY|O_RDONLY); fd = topen(filename, O_BINARY | O_RDONLY);
if (fd < 0) { if (fd < 0) {
tperror(filename); tperror(filename);
return 0; return 0;
@@ -202,7 +189,7 @@ processStream(const XML_Char *filename, XML_Parser parser)
for (;;) { for (;;) {
int nread; int nread;
char *buf = (char *)XML_GetBuffer(parser, READ_SIZE); char *buf = (char *)XML_GetBuffer(parser, READ_SIZE);
if (!buf) { if (! buf) {
if (filename != NULL) if (filename != NULL)
close(fd); close(fd);
ftprintf(stderr, T("%s: out of memory\n"), ftprintf(stderr, T("%s: out of memory\n"),
@@ -225,23 +212,22 @@ processStream(const XML_Char *filename, XML_Parser parser)
if (nread == 0) { if (nread == 0) {
if (filename != NULL) if (filename != NULL)
close(fd); close(fd);
break;; break;
;
} }
} }
return 1; return 1;
} }
static int static int
externalEntityRefStream(XML_Parser parser, externalEntityRefStream(XML_Parser parser, const XML_Char *context,
const XML_Char *context, const XML_Char *base, const XML_Char *systemId,
const XML_Char *base, const XML_Char *publicId) {
const XML_Char *systemId,
const XML_Char *UNUSED_P(publicId))
{
XML_Char *s; XML_Char *s;
const XML_Char *filename; const XML_Char *filename;
int ret; int ret;
XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0);
UNUSED_P(publicId);
filename = resolveSystemId(base, systemId, &s); filename = resolveSystemId(base, systemId, &s);
XML_SetBase(entParser, filename); XML_SetBase(entParser, filename);
ret = processStream(filename, entParser); ret = processStream(filename, entParser);
@@ -251,20 +237,16 @@ externalEntityRefStream(XML_Parser parser,
} }
int int
XML_ProcessFile(XML_Parser parser, XML_ProcessFile(XML_Parser parser, const XML_Char *filename, unsigned flags) {
const XML_Char *filename,
unsigned flags)
{
int result; int result;
if (!XML_SetBase(parser, filename)) { if (! XML_SetBase(parser, filename)) {
ftprintf(stderr, T("%s: out of memory"), filename); ftprintf(stderr, T("%s: out of memory"), filename);
exit(1); exit(1);
} }
if (flags & XML_EXTERNAL_ENTITIES) if (flags & XML_EXTERNAL_ENTITIES)
XML_SetExternalEntityRefHandler(parser, XML_SetExternalEntityRefHandler(parser, (flags & XML_MAP_FILE)
(flags & XML_MAP_FILE)
? externalEntityRefFilemap ? externalEntityRefFilemap
: externalEntityRefStream); : externalEntityRefStream);
if (flags & XML_MAP_FILE) { if (flags & XML_MAP_FILE) {
@@ -278,13 +260,14 @@ XML_ProcessFile(XML_Parser parser,
result = 0; result = 0;
break; break;
case 2: case 2:
ftprintf(stderr, T("%s: file too large for memory-mapping") ftprintf(stderr,
T(", switching to streaming\n"), filename); T("%s: file too large for memory-mapping")
T(", switching to streaming\n"),
filename);
result = processStream(filename, parser); result = processStream(filename, parser);
break; break;
} }
} } else
else
result = processStream(filename, parser); result = processStream(filename, parser);
return result; return result;
} }
+3 -8
View File
@@ -34,15 +34,10 @@
#define XML_EXTERNAL_ENTITIES 02 #define XML_EXTERNAL_ENTITIES 02
#ifdef XML_LARGE_SIZE #ifdef XML_LARGE_SIZE
#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 # define XML_FMT_INT_MOD "ll"
#define XML_FMT_INT_MOD "I64"
#else #else
#define XML_FMT_INT_MOD "ll" # define XML_FMT_INT_MOD "l"
#endif
#else
#define XML_FMT_INT_MOD "l"
#endif #endif
extern int XML_ProcessFile(XML_Parser parser, extern int XML_ProcessFile(XML_Parser parser, const XML_Char *filename,
const XML_Char *filename,
unsigned flags); unsigned flags);
+15 -19
View File
@@ -34,8 +34,7 @@
#include "xmlmime.h" #include "xmlmime.h"
static const char * static const char *
getTok(const char **pp) getTok(const char **pp) {
{
/* inComment means one level of nesting; inComment+1 means two levels etc */ /* inComment means one level of nesting; inComment+1 means two levels etc */
enum { inAtom, inString, init, inComment }; enum { inAtom, inString, init, inComment };
int state = init; int state = init;
@@ -106,9 +105,8 @@ getTok(const char **pp)
/* key must be lowercase ASCII */ /* key must be lowercase ASCII */
static int static int
matchkey(const char *start, const char *end, const char *key) matchkey(const char *start, const char *end, const char *key) {
{ if (! start)
if (!start)
return 0; return 0;
for (; start != end; start++, key++) for (; start != end; start++, key++)
if (*start != *key && *start != 'A' + (*key - 'a')) if (*start != *key && *start != 'A' + (*key - 'a'))
@@ -117,8 +115,7 @@ matchkey(const char *start, const char *end, const char *key)
} }
void void
getXMLCharset(const char *buf, char *charset) getXMLCharset(const char *buf, char *charset) {
{
const char *next, *p; const char *next, *p;
charset[0] = '\0'; charset[0] = '\0';
@@ -126,16 +123,18 @@ getXMLCharset(const char *buf, char *charset)
p = getTok(&next); p = getTok(&next);
if (matchkey(p, next, "text")) if (matchkey(p, next, "text"))
strcpy(charset, "us-ascii"); strcpy(charset, "us-ascii");
else if (!matchkey(p, next, "application")) else if (! matchkey(p, next, "application"))
return; return;
p = getTok(&next); p = getTok(&next);
if (!p || *p != '/') if (! p || *p != '/')
return; return;
p = getTok(&next); p = getTok(&next);
#if 0 /* BEGIN disabled code */
if (!matchkey(p, next, "xml") && charset[0] == '\0') if (0) {
if (! matchkey(p, next, "xml") && charset[0] == '\0')
return; return;
#endif }
/* END disabled code */
p = getTok(&next); p = getTok(&next);
while (p) { while (p) {
if (*p == ';') { if (*p == ';') {
@@ -157,8 +156,7 @@ getXMLCharset(const char *buf, char *charset)
*s++ = *p; *s++ = *p;
} }
*s++ = '\0'; *s++ = '\0';
} } else {
else {
if (next - p > CHARSET_MAX - 1) if (next - p > CHARSET_MAX - 1)
break; break;
while (p != next) while (p != next)
@@ -170,19 +168,17 @@ getXMLCharset(const char *buf, char *charset)
} }
break; break;
} }
} } else
else
p = getTok(&next); p = getTok(&next);
} }
} }
#ifdef TEST #ifdef TEST
#include <stdio.h> # include <stdio.h>
int int
main(int argc, char *argv[]) main(int argc, char *argv[]) {
{
char buf[CHARSET_MAX]; char buf[CHARSET_MAX];
if (argc <= 1) if (argc <= 1)
return 1; return 1;
+1 -1
View File
@@ -37,7 +37,7 @@
# ifndef XML_UNICODE_WCHAR_T # ifndef XML_UNICODE_WCHAR_T
# error xmlwf requires a 16-bit Unicode-compatible wchar_t # error xmlwf requires a 16-bit Unicode-compatible wchar_t
# endif # endif
# define _PREPEND_BIG_L(x) L ## x # define _PREPEND_BIG_L(x) L##x
# define T(x) _PREPEND_BIG_L(x) # define T(x) _PREPEND_BIG_L(x)
# define ftprintf fwprintf # define ftprintf fwprintf
# define tfopen _wfopen # define tfopen _wfopen
+189 -201
View File
@@ -64,14 +64,12 @@ typedef struct xmlwfUserData {
const XML_Char *currentDoctypeName; const XML_Char *currentDoctypeName;
} XmlwfUserData; } XmlwfUserData;
/* This ensures proper sorting. */ /* This ensures proper sorting. */
#define NSSEP T('\001') #define NSSEP T('\001')
static void XMLCALL static void XMLCALL
characterData(void *userData, const XML_Char *s, int len) characterData(void *userData, const XML_Char *s, int len) {
{
FILE *fp = ((XmlwfUserData *)userData)->fp; FILE *fp = ((XmlwfUserData *)userData)->fp;
for (; len > 0; --len, ++s) { for (; len > 0; --len, ++s) {
switch (*s) { switch (*s) {
@@ -106,8 +104,7 @@ characterData(void *userData, const XML_Char *s, int len)
} }
static void static void
attributeValue(FILE *fp, const XML_Char *s) attributeValue(FILE *fp, const XML_Char *s) {
{
puttc(T('='), fp); puttc(T('='), fp);
puttc(T('"'), fp); puttc(T('"'), fp);
assert(s); assert(s);
@@ -158,14 +155,12 @@ attributeValue(FILE *fp, const XML_Char *s)
is equivalent to lexicographically comparing based on the character number. */ is equivalent to lexicographically comparing based on the character number. */
static int static int
attcmp(const void *att1, const void *att2) attcmp(const void *att1, const void *att2) {
{
return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2); return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2);
} }
static void XMLCALL static void XMLCALL
startElement(void *userData, const XML_Char *name, const XML_Char **atts) startElement(void *userData, const XML_Char *name, const XML_Char **atts) {
{
int nAtts; int nAtts;
const XML_Char **p; const XML_Char **p;
FILE *fp = ((XmlwfUserData *)userData)->fp; FILE *fp = ((XmlwfUserData *)userData)->fp;
@@ -188,8 +183,7 @@ startElement(void *userData, const XML_Char *name, const XML_Char **atts)
} }
static void XMLCALL static void XMLCALL
endElement(void *userData, const XML_Char *name) endElement(void *userData, const XML_Char *name) {
{
FILE *fp = ((XmlwfUserData *)userData)->fp; FILE *fp = ((XmlwfUserData *)userData)->fp;
puttc(T('<'), fp); puttc(T('<'), fp);
puttc(T('/'), fp); puttc(T('/'), fp);
@@ -198,8 +192,7 @@ endElement(void *userData, const XML_Char *name)
} }
static int static int
nsattcmp(const void *p1, const void *p2) nsattcmp(const void *p1, const void *p2) {
{
const XML_Char *att1 = *(const XML_Char **)p1; const XML_Char *att1 = *(const XML_Char **)p1;
const XML_Char *att2 = *(const XML_Char **)p2; const XML_Char *att2 = *(const XML_Char **)p2;
int sep1 = (tcsrchr(att1, NSSEP) != 0); int sep1 = (tcsrchr(att1, NSSEP) != 0);
@@ -210,8 +203,7 @@ nsattcmp(const void *p1, const void *p2)
} }
static void XMLCALL static void XMLCALL
startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) {
{
int nAtts; int nAtts;
int nsi; int nsi;
const XML_Char **p; const XML_Char **p;
@@ -226,8 +218,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
fputts(T(" xmlns:n1"), fp); fputts(T(" xmlns:n1"), fp);
attributeValue(fp, name); attributeValue(fp, name);
nsi = 2; nsi = 2;
} } else {
else {
fputts(name, fp); fputts(name, fp);
nsi = 1; nsi = 1;
} }
@@ -245,8 +236,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
if (sep) { if (sep) {
ftprintf(fp, T("n%d:"), nsi); ftprintf(fp, T("n%d:"), nsi);
fputts(sep + 1, fp); fputts(sep + 1, fp);
} } else
else
fputts(name, fp); fputts(name, fp);
attributeValue(fp, *atts); attributeValue(fp, *atts);
if (sep) { if (sep) {
@@ -259,8 +249,7 @@ startElementNS(void *userData, const XML_Char *name, const XML_Char **atts)
} }
static void XMLCALL static void XMLCALL
endElementNS(void *userData, const XML_Char *name) endElementNS(void *userData, const XML_Char *name) {
{
FILE *fp = ((XmlwfUserData *)userData)->fp; FILE *fp = ((XmlwfUserData *)userData)->fp;
const XML_Char *sep; const XML_Char *sep;
puttc(T('<'), fp); puttc(T('<'), fp);
@@ -269,8 +258,7 @@ endElementNS(void *userData, const XML_Char *name)
if (sep) { if (sep) {
fputts(T("n1:"), fp); fputts(T("n1:"), fp);
fputts(sep + 1, fp); fputts(sep + 1, fp);
} } else
else
fputts(name, fp); fputts(name, fp);
puttc(T('>'), fp); puttc(T('>'), fp);
} }
@@ -279,8 +267,7 @@ endElementNS(void *userData, const XML_Char *name)
static void XMLCALL static void XMLCALL
processingInstruction(void *userData, const XML_Char *target, processingInstruction(void *userData, const XML_Char *target,
const XML_Char *data) const XML_Char *data) {
{
FILE *fp = ((XmlwfUserData *)userData)->fp; FILE *fp = ((XmlwfUserData *)userData)->fp;
puttc(T('<'), fp); puttc(T('<'), fp);
puttc(T('?'), fp); puttc(T('?'), fp);
@@ -291,9 +278,8 @@ processingInstruction(void *userData, const XML_Char *target,
puttc(T('>'), fp); puttc(T('>'), fp);
} }
static XML_Char *
static XML_Char *xcsdup(const XML_Char *s) xcsdup(const XML_Char *s) {
{
XML_Char *result; XML_Char *result;
int count = 0; int count = 0;
int numBytes; int numBytes;
@@ -311,19 +297,18 @@ static XML_Char *xcsdup(const XML_Char *s)
} }
static void XMLCALL static void XMLCALL
startDoctypeDecl(void *userData, startDoctypeDecl(void *userData, const XML_Char *doctypeName,
const XML_Char *doctypeName, const XML_Char *sysid, const XML_Char *publid,
const XML_Char *UNUSED_P(sysid), int has_internal_subset) {
const XML_Char *UNUSED_P(publid),
int UNUSED_P(has_internal_subset))
{
XmlwfUserData *data = (XmlwfUserData *)userData; XmlwfUserData *data = (XmlwfUserData *)userData;
UNUSED_P(sysid);
UNUSED_P(publid);
UNUSED_P(has_internal_subset);
data->currentDoctypeName = xcsdup(doctypeName); data->currentDoctypeName = xcsdup(doctypeName);
} }
static void static void
freeNotations(XmlwfUserData *data) freeNotations(XmlwfUserData *data) {
{
NotationList *notationListHead = data->notationListHead; NotationList *notationListHead = data->notationListHead;
while (notationListHead != NULL) { while (notationListHead != NULL) {
@@ -337,8 +322,8 @@ freeNotations(XmlwfUserData *data)
data->notationListHead = NULL; data->notationListHead = NULL;
} }
static int xcscmp(const XML_Char *xs, const XML_Char *xt) static int
{ xcscmp(const XML_Char *xs, const XML_Char *xt) {
while (*xs != 0 && *xt != 0) { while (*xs != 0 && *xt != 0) {
if (*xs < *xt) if (*xs < *xt)
return -1; return -1;
@@ -355,17 +340,15 @@ static int xcscmp(const XML_Char *xs, const XML_Char *xt)
} }
static int static int
notationCmp(const void *a, const void *b) notationCmp(const void *a, const void *b) {
{ const NotationList *const n1 = *(NotationList **)a;
const NotationList * const n1 = *(NotationList **)a; const NotationList *const n2 = *(NotationList **)b;
const NotationList * const n2 = *(NotationList **)b;
return xcscmp(n1->notationName, n2->notationName); return xcscmp(n1->notationName, n2->notationName);
} }
static void XMLCALL static void XMLCALL
endDoctypeDecl(void *userData) endDoctypeDecl(void *userData) {
{
XmlwfUserData *data = (XmlwfUserData *)userData; XmlwfUserData *data = (XmlwfUserData *)userData;
NotationList **notations; NotationList **notations;
int notationCount = 0; int notationCount = 0;
@@ -389,9 +372,7 @@ endDoctypeDecl(void *userData)
return; return;
} }
for (p = data->notationListHead, i = 0; for (p = data->notationListHead, i = 0; i < notationCount; p = p->next, i++) {
i < notationCount;
p = p->next, i++) {
notations[i] = p; notations[i] = p;
} }
qsort(notations, notationCount, sizeof(NotationList *), notationCmp); qsort(notations, notationCount, sizeof(NotationList *), notationCmp);
@@ -415,8 +396,7 @@ endDoctypeDecl(void *userData)
fputts(notations[i]->systemId, data->fp); fputts(notations[i]->systemId, data->fp);
puttc(T('\''), data->fp); puttc(T('\''), data->fp);
} }
} } else if (notations[i]->systemId != NULL) {
else if (notations[i]->systemId != NULL) {
fputts(T(" SYSTEM '"), data->fp); fputts(T(" SYSTEM '"), data->fp);
fputts(notations[i]->systemId, data->fp); fputts(notations[i]->systemId, data->fp);
puttc(T('\''), data->fp); puttc(T('\''), data->fp);
@@ -435,16 +415,13 @@ endDoctypeDecl(void *userData)
} }
static void XMLCALL static void XMLCALL
notationDecl(void *userData, notationDecl(void *userData, const XML_Char *notationName, const XML_Char *base,
const XML_Char *notationName, const XML_Char *systemId, const XML_Char *publicId) {
const XML_Char *UNUSED_P(base),
const XML_Char *systemId,
const XML_Char *publicId)
{
XmlwfUserData *data = (XmlwfUserData *)userData; XmlwfUserData *data = (XmlwfUserData *)userData;
NotationList *entry = malloc(sizeof(NotationList)); NotationList *entry = malloc(sizeof(NotationList));
const char *errorMessage = "Unable to store NOTATION for output\n"; const char *errorMessage = "Unable to store NOTATION for output\n";
UNUSED_P(base);
if (entry == NULL) { if (entry == NULL) {
fputs(errorMessage, stderr); fputs(errorMessage, stderr);
return; /* Nothing we can really do about this */ return; /* Nothing we can really do about this */
@@ -463,8 +440,7 @@ notationDecl(void *userData,
free(entry); free(entry);
return; return;
} }
} } else {
else {
entry->systemId = NULL; entry->systemId = NULL;
} }
if (publicId != NULL) { if (publicId != NULL) {
@@ -476,8 +452,7 @@ notationDecl(void *userData,
free(entry); free(entry);
return; return;
} }
} } else {
else {
entry->publicId = NULL; entry->publicId = NULL;
} }
@@ -488,97 +463,99 @@ notationDecl(void *userData,
#endif /* not W3C14N */ #endif /* not W3C14N */
static void XMLCALL static void XMLCALL
defaultCharacterData(void *userData, const XML_Char *UNUSED_P(s), int UNUSED_P(len)) defaultCharacterData(void *userData, const XML_Char *s, int len) {
{ UNUSED_P(s);
XML_DefaultCurrent((XML_Parser) userData); UNUSED_P(len);
XML_DefaultCurrent((XML_Parser)userData);
} }
static void XMLCALL static void XMLCALL
defaultStartElement(void *userData, const XML_Char *UNUSED_P(name), defaultStartElement(void *userData, const XML_Char *name,
const XML_Char **UNUSED_P(atts)) const XML_Char **atts) {
{ UNUSED_P(name);
XML_DefaultCurrent((XML_Parser) userData); UNUSED_P(atts);
XML_DefaultCurrent((XML_Parser)userData);
} }
static void XMLCALL static void XMLCALL
defaultEndElement(void *userData, const XML_Char *UNUSED_P(name)) defaultEndElement(void *userData, const XML_Char *name) {
{ UNUSED_P(name);
XML_DefaultCurrent((XML_Parser) userData); XML_DefaultCurrent((XML_Parser)userData);
} }
static void XMLCALL static void XMLCALL
defaultProcessingInstruction(void *userData, const XML_Char *UNUSED_P(target), defaultProcessingInstruction(void *userData, const XML_Char *target,
const XML_Char *UNUSED_P(data)) const XML_Char *data) {
{ UNUSED_P(target);
XML_DefaultCurrent((XML_Parser) userData); UNUSED_P(data);
XML_DefaultCurrent((XML_Parser)userData);
} }
static void XMLCALL static void XMLCALL
nopCharacterData(void *UNUSED_P(userData), const XML_Char *UNUSED_P(s), int UNUSED_P(len)) nopCharacterData(void *userData, const XML_Char *s, int len) {
{ UNUSED_P(userData);
UNUSED_P(s);
UNUSED_P(len);
} }
static void XMLCALL static void XMLCALL
nopStartElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts)) nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts) {
{ UNUSED_P(userData);
UNUSED_P(name);
UNUSED_P(atts);
} }
static void XMLCALL static void XMLCALL
nopEndElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name)) nopEndElement(void *userData, const XML_Char *name) {
{ UNUSED_P(userData);
UNUSED_P(name);
} }
static void XMLCALL static void XMLCALL
nopProcessingInstruction(void *UNUSED_P(userData), const XML_Char *UNUSED_P(target), nopProcessingInstruction(void *userData, const XML_Char *target,
const XML_Char *UNUSED_P(data)) const XML_Char *data) {
{ UNUSED_P(userData);
UNUSED_P(target);
UNUSED_P(data);
} }
static void XMLCALL static void XMLCALL
markup(void *userData, const XML_Char *s, int len) markup(void *userData, const XML_Char *s, int len) {
{ FILE *fp = ((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp;
FILE *fp = ((XmlwfUserData *)XML_GetUserData((XML_Parser) userData))->fp;
for (; len > 0; --len, ++s) for (; len > 0; --len, ++s)
puttc(*s, fp); puttc(*s, fp);
} }
static void static void
metaLocation(XML_Parser parser) metaLocation(XML_Parser parser) {
{
const XML_Char *uri = XML_GetBase(parser); const XML_Char *uri = XML_GetBase(parser);
FILE *fp = ((XmlwfUserData *)XML_GetUserData(parser))->fp; FILE *fp = ((XmlwfUserData *)XML_GetUserData(parser))->fp;
if (uri) if (uri)
ftprintf(fp, T(" uri=\"%s\""), uri); ftprintf(fp, T(" uri=\"%s\""), uri);
ftprintf(fp, ftprintf(fp,
T(" byte=\"%") T(XML_FMT_INT_MOD) T("d\"") T(" byte=\"%") T(XML_FMT_INT_MOD) T("d\"") T(" nbytes=\"%d\"")
T(" nbytes=\"%d\"") T(" line=\"%") T(XML_FMT_INT_MOD) T("u\"") T(" col=\"%")
T(" line=\"%") T(XML_FMT_INT_MOD) T("u\"") T(XML_FMT_INT_MOD) T("u\""),
T(" col=\"%") T(XML_FMT_INT_MOD) T("u\""), XML_GetCurrentByteIndex(parser), XML_GetCurrentByteCount(parser),
XML_GetCurrentByteIndex(parser),
XML_GetCurrentByteCount(parser),
XML_GetCurrentLineNumber(parser), XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser)); XML_GetCurrentColumnNumber(parser));
} }
static void static void
metaStartDocument(void *userData) metaStartDocument(void *userData) {
{
fputts(T("<document>\n"), fputts(T("<document>\n"),
((XmlwfUserData *)XML_GetUserData((XML_Parser) userData))->fp); ((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp);
} }
static void static void
metaEndDocument(void *userData) metaEndDocument(void *userData) {
{
fputts(T("</document>\n"), fputts(T("</document>\n"),
((XmlwfUserData *)XML_GetUserData((XML_Parser) userData))->fp); ((XmlwfUserData *)XML_GetUserData((XML_Parser)userData))->fp);
} }
static void XMLCALL static void XMLCALL
metaStartElement(void *userData, const XML_Char *name, metaStartElement(void *userData, const XML_Char *name, const XML_Char **atts) {
const XML_Char **atts) XML_Parser parser = (XML_Parser)userData;
{
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp; FILE *fp = data->fp;
const XML_Char **specifiedAttsEnd const XML_Char **specifiedAttsEnd
@@ -605,15 +582,13 @@ metaStartElement(void *userData, const XML_Char *name,
fputts(T("\"/>\n"), fp); fputts(T("\"/>\n"), fp);
} while (*(atts += 2)); } while (*(atts += 2));
fputts(T("</starttag>\n"), fp); fputts(T("</starttag>\n"), fp);
} } else
else
fputts(T("/>\n"), fp); fputts(T("/>\n"), fp);
} }
static void XMLCALL static void XMLCALL
metaEndElement(void *userData, const XML_Char *name) metaEndElement(void *userData, const XML_Char *name) {
{ XML_Parser parser = (XML_Parser)userData;
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp; FILE *fp = data->fp;
ftprintf(fp, T("<endtag name=\"%s\""), name); ftprintf(fp, T("<endtag name=\"%s\""), name);
@@ -623,9 +598,8 @@ metaEndElement(void *userData, const XML_Char *name)
static void XMLCALL static void XMLCALL
metaProcessingInstruction(void *userData, const XML_Char *target, metaProcessingInstruction(void *userData, const XML_Char *target,
const XML_Char *data) const XML_Char *data) {
{ XML_Parser parser = (XML_Parser)userData;
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *usrData = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *usrData = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = usrData->fp; FILE *fp = usrData->fp;
ftprintf(fp, T("<pi target=\"%s\" data=\""), target); ftprintf(fp, T("<pi target=\"%s\" data=\""), target);
@@ -636,9 +610,8 @@ metaProcessingInstruction(void *userData, const XML_Char *target,
} }
static void XMLCALL static void XMLCALL
metaComment(void *userData, const XML_Char *data) metaComment(void *userData, const XML_Char *data) {
{ XML_Parser parser = (XML_Parser)userData;
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *usrData = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *usrData = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = usrData->fp; FILE *fp = usrData->fp;
fputts(T("<comment data=\""), fp); fputts(T("<comment data=\""), fp);
@@ -649,9 +622,8 @@ metaComment(void *userData, const XML_Char *data)
} }
static void XMLCALL static void XMLCALL
metaStartCdataSection(void *userData) metaStartCdataSection(void *userData) {
{ XML_Parser parser = (XML_Parser)userData;
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp; FILE *fp = data->fp;
fputts(T("<startcdata"), fp); fputts(T("<startcdata"), fp);
@@ -660,9 +632,8 @@ metaStartCdataSection(void *userData)
} }
static void XMLCALL static void XMLCALL
metaEndCdataSection(void *userData) metaEndCdataSection(void *userData) {
{ XML_Parser parser = (XML_Parser)userData;
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp; FILE *fp = data->fp;
fputts(T("<endcdata"), fp); fputts(T("<endcdata"), fp);
@@ -671,9 +642,8 @@ metaEndCdataSection(void *userData)
} }
static void XMLCALL static void XMLCALL
metaCharacterData(void *userData, const XML_Char *s, int len) metaCharacterData(void *userData, const XML_Char *s, int len) {
{ XML_Parser parser = (XML_Parser)userData;
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp; FILE *fp = data->fp;
fputts(T("<chars str=\""), fp); fputts(T("<chars str=\""), fp);
@@ -684,24 +654,23 @@ metaCharacterData(void *userData, const XML_Char *s, int len)
} }
static void XMLCALL static void XMLCALL
metaStartDoctypeDecl(void *userData, metaStartDoctypeDecl(void *userData, const XML_Char *doctypeName,
const XML_Char *doctypeName, const XML_Char *sysid, const XML_Char *pubid,
const XML_Char *UNUSED_P(sysid), int has_internal_subset) {
const XML_Char *UNUSED_P(pubid), XML_Parser parser = (XML_Parser)userData;
int UNUSED_P(has_internal_subset))
{
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp; FILE *fp = data->fp;
UNUSED_P(sysid);
UNUSED_P(pubid);
UNUSED_P(has_internal_subset);
ftprintf(fp, T("<startdoctype name=\"%s\""), doctypeName); ftprintf(fp, T("<startdoctype name=\"%s\""), doctypeName);
metaLocation(parser); metaLocation(parser);
fputts(T("/>\n"), fp); fputts(T("/>\n"), fp);
} }
static void XMLCALL static void XMLCALL
metaEndDoctypeDecl(void *userData) metaEndDoctypeDecl(void *userData) {
{ XML_Parser parser = (XML_Parser)userData;
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp; FILE *fp = data->fp;
fputts(T("<enddoctype"), fp); fputts(T("<enddoctype"), fp);
@@ -710,15 +679,13 @@ metaEndDoctypeDecl(void *userData)
} }
static void XMLCALL static void XMLCALL
metaNotationDecl(void *userData, metaNotationDecl(void *userData, const XML_Char *notationName,
const XML_Char *notationName, const XML_Char *base, const XML_Char *systemId,
const XML_Char *UNUSED_P(base), const XML_Char *publicId) {
const XML_Char *systemId, XML_Parser parser = (XML_Parser)userData;
const XML_Char *publicId)
{
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp; FILE *fp = data->fp;
UNUSED_P(base);
ftprintf(fp, T("<notation name=\"%s\""), notationName); ftprintf(fp, T("<notation name=\"%s\""), notationName);
if (publicId) if (publicId)
ftprintf(fp, T(" public=\"%s\""), publicId); ftprintf(fp, T(" public=\"%s\""), publicId);
@@ -731,30 +698,24 @@ metaNotationDecl(void *userData,
fputts(T("/>\n"), fp); fputts(T("/>\n"), fp);
} }
static void XMLCALL static void XMLCALL
metaEntityDecl(void *userData, metaEntityDecl(void *userData, const XML_Char *entityName, int is_param,
const XML_Char *entityName, const XML_Char *value, int value_length, const XML_Char *base,
int UNUSED_P(is_param), const XML_Char *systemId, const XML_Char *publicId,
const XML_Char *value, const XML_Char *notationName) {
int value_length, XML_Parser parser = (XML_Parser)userData;
const XML_Char *UNUSED_P(base),
const XML_Char *systemId,
const XML_Char *publicId,
const XML_Char *notationName)
{
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp; FILE *fp = data->fp;
UNUSED_P(is_param);
UNUSED_P(base);
if (value) { if (value) {
ftprintf(fp, T("<entity name=\"%s\""), entityName); ftprintf(fp, T("<entity name=\"%s\""), entityName);
metaLocation(parser); metaLocation(parser);
puttc(T('>'), fp); puttc(T('>'), fp);
characterData(data, value, value_length); characterData(data, value, value_length);
fputts(T("</entity/>\n"), fp); fputts(T("</entity/>\n"), fp);
} } else if (notationName) {
else if (notationName) {
ftprintf(fp, T("<entity name=\"%s\""), entityName); ftprintf(fp, T("<entity name=\"%s\""), entityName);
if (publicId) if (publicId)
ftprintf(fp, T(" public=\"%s\""), publicId); ftprintf(fp, T(" public=\"%s\""), publicId);
@@ -764,8 +725,7 @@ metaEntityDecl(void *userData,
ftprintf(fp, T(" notation=\"%s\""), notationName); ftprintf(fp, T(" notation=\"%s\""), notationName);
metaLocation(parser); metaLocation(parser);
fputts(T("/>\n"), fp); fputts(T("/>\n"), fp);
} } else {
else {
ftprintf(fp, T("<entity name=\"%s\""), entityName); ftprintf(fp, T("<entity name=\"%s\""), entityName);
if (publicId) if (publicId)
ftprintf(fp, T(" public=\"%s\""), publicId); ftprintf(fp, T(" public=\"%s\""), publicId);
@@ -778,11 +738,9 @@ metaEntityDecl(void *userData,
} }
static void XMLCALL static void XMLCALL
metaStartNamespaceDecl(void *userData, metaStartNamespaceDecl(void *userData, const XML_Char *prefix,
const XML_Char *prefix, const XML_Char *uri) {
const XML_Char *uri) XML_Parser parser = (XML_Parser)userData;
{
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp; FILE *fp = data->fp;
fputts(T("<startns"), fp); fputts(T("<startns"), fp);
@@ -792,37 +750,34 @@ metaStartNamespaceDecl(void *userData,
fputts(T(" ns=\""), fp); fputts(T(" ns=\""), fp);
characterData(data, uri, (int)tcslen(uri)); characterData(data, uri, (int)tcslen(uri));
fputts(T("\"/>\n"), fp); fputts(T("\"/>\n"), fp);
} } else
else
fputts(T("/>\n"), fp); fputts(T("/>\n"), fp);
} }
static void XMLCALL static void XMLCALL
metaEndNamespaceDecl(void *userData, const XML_Char *prefix) metaEndNamespaceDecl(void *userData, const XML_Char *prefix) {
{ XML_Parser parser = (XML_Parser)userData;
XML_Parser parser = (XML_Parser) userData;
XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser); XmlwfUserData *data = (XmlwfUserData *)XML_GetUserData(parser);
FILE *fp = data->fp; FILE *fp = data->fp;
if (!prefix) if (! prefix)
fputts(T("<endns/>\n"), fp); fputts(T("<endns/>\n"), fp);
else else
ftprintf(fp, T("<endns prefix=\"%s\"/>\n"), prefix); ftprintf(fp, T("<endns prefix=\"%s\"/>\n"), prefix);
} }
static int XMLCALL static int XMLCALL
unknownEncodingConvert(void *data, const char *p) unknownEncodingConvert(void *data, const char *p) {
{
return codepageConvert(*(int *)data, p); return codepageConvert(*(int *)data, p);
} }
static int XMLCALL static int XMLCALL
unknownEncoding(void *UNUSED_P(userData), const XML_Char *name, XML_Encoding *info) unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info) {
{
int cp; int cp;
static const XML_Char prefixL[] = T("windows-"); static const XML_Char prefixL[] = T("windows-");
static const XML_Char prefixU[] = T("WINDOWS-"); static const XML_Char prefixU[] = T("WINDOWS-");
int i; int i;
UNUSED_P(userData);
for (i = 0; prefixU[i]; i++) for (i = 0; prefixU[i]; i++)
if (name[i] != prefixU[i] && name[i] != prefixL[i]) if (name[i] != prefixU[i] && name[i] != prefixL[i])
return 0; return 0;
@@ -831,35 +786,34 @@ unknownEncoding(void *UNUSED_P(userData), const XML_Char *name, XML_Encoding *in
for (; name[i]; i++) { for (; name[i]; i++) {
static const XML_Char digits[] = T("0123456789"); static const XML_Char digits[] = T("0123456789");
const XML_Char *s = tcschr(digits, name[i]); const XML_Char *s = tcschr(digits, name[i]);
if (!s) if (! s)
return 0; return 0;
cp *= 10; cp *= 10;
cp += (int)(s - digits); cp += (int)(s - digits);
if (cp >= 0x10000) if (cp >= 0x10000)
return 0; return 0;
} }
if (!codepageMap(cp, info->map)) if (! codepageMap(cp, info->map))
return 0; return 0;
info->convert = unknownEncodingConvert; info->convert = unknownEncodingConvert;
/* We could just cast the code page integer to a void *, /* We could just cast the code page integer to a void *,
and avoid the use of release. */ and avoid the use of release. */
info->release = free; info->release = free;
info->data = malloc(sizeof(int)); info->data = malloc(sizeof(int));
if (!info->data) if (! info->data)
return 0; return 0;
*(int *)info->data = cp; *(int *)info->data = cp;
return 1; return 1;
} }
static int XMLCALL static int XMLCALL
notStandalone(void *UNUSED_P(userData)) notStandalone(void *userData) {
{ UNUSED_P(userData);
return 0; return 0;
} }
static void static void
showVersion(XML_Char *prog) showVersion(XML_Char *prog) {
{
XML_Char *s = prog; XML_Char *s = prog;
XML_Char ch; XML_Char ch;
const XML_Feature *features = XML_GetFeatureList(); const XML_Feature *features = XML_GetFeatureList();
@@ -889,10 +843,46 @@ showVersion(XML_Char *prog)
} }
static void static void
usage(const XML_Char *prog, int rc) usage(const XML_Char *prog, int rc) {
{ ftprintf(
ftprintf(stderr, stderr,
T("usage: %s [-s] [-n] [-p] [-x] [-e encoding] [-w] [-d output-dir] [-c] [-m] [-r] [-t] [-N] [file ...]\n"), prog); /* Generated with:
* $ xmlwf/xmlwf_helpgen.sh
*/
/* clang-format off */
T("usage: %s [-s] [-n] [-p] [-x] [-e ENCODING] [-w] [-r] [-d DIRECTORY]\n")
T(" [-c | -m | -t] [-N]\n")
T(" [FILE [FILE ...]]\n")
T("\n")
T("xmlwf - Determines if an XML document is well-formed\n")
T("\n")
T("positional arguments:\n")
T(" FILE files to process (default: STDIN)\n")
T("\n")
T("input control arguments:\n")
T(" -s print an error if the document is not [s]tandalone\n")
T(" -n enable [n]amespace processing\n")
T(" -p enable processing external DTDs and [p]arameter entities\n")
T(" -x enable processing of e[x]ternal entities\n")
T(" -e ENCODING override any in-document [e]ncoding declaration\n")
T(" -w enable support for [W]indows code pages\n")
T(" -r disable memory-mapping and use normal file [r]ead IO calls instead\n")
T("\n")
T("output control arguments:\n")
T(" -d DIRECTORY output [d]estination directory\n")
T(" -c write a [c]opy of input XML, not canonical XML\n")
T(" -m write [m]eta XML, not canonical XML\n")
T(" -t write no XML output for [t]iming of plain parsing\n")
T(" -N enable adding doctype and [n]otation declarations\n")
T("\n")
T("info arguments:\n")
T(" -h show this [h]elp message and exit\n")
T(" -v show program's [v]ersion number and exit\n")
T("\n")
T("libexpat is software libre, licensed under the MIT license.\n")
T("Please report bugs at https://github.com/libexpat/libexpat/issues. Thank you!\n")
, /* clang-format on */
prog);
exit(rc); exit(rc);
} }
@@ -902,8 +892,7 @@ int wmain(int argc, XML_Char **argv);
#endif #endif
int int
tmain(int argc, XML_Char **argv) tmain(int argc, XML_Char **argv) {
{
int i, j; int i, j;
const XML_Char *outputDir = NULL; const XML_Char *outputDir = NULL;
const XML_Char *encoding = NULL; const XML_Char *encoding = NULL;
@@ -913,13 +902,13 @@ tmain(int argc, XML_Char **argv)
int useNamespaces = 0; int useNamespaces = 0;
int requireStandalone = 0; int requireStandalone = 0;
int requiresNotations = 0; int requiresNotations = 0;
enum XML_ParamEntityParsing paramEntityParsing = enum XML_ParamEntityParsing paramEntityParsing
XML_PARAM_ENTITY_PARSING_NEVER; = XML_PARAM_ENTITY_PARSING_NEVER;
int useStdin = 0; int useStdin = 0;
XmlwfUserData userData = { NULL, NULL, NULL }; XmlwfUserData userData = {NULL, NULL, NULL};
#ifdef _MSC_VER #ifdef _MSC_VER
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF); _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif #endif
i = 1; i = 1;
@@ -980,8 +969,7 @@ tmain(int argc, XML_Char **argv)
if (++i == argc) if (++i == argc)
usage(argv[0], 2); usage(argv[0], 2);
outputDir = argv[i]; outputDir = argv[i];
} } else
else
outputDir = argv[i] + j + 1; outputDir = argv[i] + j + 1;
i++; i++;
j = 0; j = 0;
@@ -991,8 +979,7 @@ tmain(int argc, XML_Char **argv)
if (++i == argc) if (++i == argc)
usage(argv[0], 2); usage(argv[0], 2);
encoding = argv[i]; encoding = argv[i];
} } else
else
encoding = argv[i] + j + 1; encoding = argv[i] + j + 1;
i++; i++;
j = 0; j = 0;
@@ -1043,18 +1030,17 @@ tmain(int argc, XML_Char **argv)
XML_SetElementHandler(parser, nopStartElement, nopEndElement); XML_SetElementHandler(parser, nopStartElement, nopEndElement);
XML_SetCharacterDataHandler(parser, nopCharacterData); XML_SetCharacterDataHandler(parser, nopCharacterData);
XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction); XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction);
} } else if (outputDir) {
else if (outputDir) { const XML_Char *delim = T("/");
const XML_Char * delim = T("/");
const XML_Char *file = useStdin ? T("STDIN") : argv[i]; const XML_Char *file = useStdin ? T("STDIN") : argv[i];
if (!useStdin) { if (! useStdin) {
/* Jump after last (back)slash */ /* Jump after last (back)slash */
const XML_Char * lastDelim = tcsrchr(file, delim[0]); const XML_Char *lastDelim = tcsrchr(file, delim[0]);
if (lastDelim) if (lastDelim)
file = lastDelim + 1; file = lastDelim + 1;
#if defined(_WIN32) #if defined(_WIN32)
else { else {
const XML_Char * winDelim = T("\\"); const XML_Char *winDelim = T("\\");
lastDelim = tcsrchr(file, winDelim[0]); lastDelim = tcsrchr(file, winDelim[0]);
if (lastDelim) { if (lastDelim) {
file = lastDelim + 1; file = lastDelim + 1;
@@ -1069,7 +1055,7 @@ tmain(int argc, XML_Char **argv)
tcscat(outName, delim); tcscat(outName, delim);
tcscat(outName, file); tcscat(outName, file);
userData.fp = tfopen(outName, T("wb")); userData.fp = tfopen(outName, T("wb"));
if (!userData.fp) { if (! userData.fp) {
tperror(outName); tperror(outName);
exit(1); exit(1);
} }
@@ -1126,13 +1112,15 @@ tmain(int argc, XML_Char **argv)
if (outputType == 'm') if (outputType == 'm')
metaEndDocument(parser); metaEndDocument(parser);
fclose(userData.fp); fclose(userData.fp);
if (!result) { if (! result) {
tremove(outName); tremove(outName);
exit(2);
} }
free(outName); free(outName);
} }
XML_ParserFree(parser); XML_ParserFree(parser);
if (! result) {
exit(2);
}
} }
return 0; return 0;
} }
+69
View File
@@ -0,0 +1,69 @@
#! /usr/bin/env python3
# __ __ _
# ___\ \/ /_ __ __ _| |_
# / _ \\ /| '_ \ / _` | __|
# | __// \| |_) | (_| | |_
# \___/_/\_\ .__/ \__,_|\__|
# |_| XML parser
#
# Copyright (c) 2019 Expat development team
# Licensed under the MIT license:
#
# 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.
import argparse
epilog = """
libexpat is software libre, licensed under the MIT license.
Please report bugs at https://github.com/libexpat/libexpat/issues. Thank you!
"""
parser = argparse.ArgumentParser(prog='xmlwf', add_help=False,
description='xmlwf - Determines if an XML document is well-formed',
formatter_class=argparse.RawTextHelpFormatter,
epilog=epilog)
input_related = parser.add_argument_group('input control arguments')
input_related.add_argument('-s', action='store_true', help='print an error if the document is not [s]tandalone')
input_related.add_argument('-n', action='store_true', help='enable [n]amespace processing')
input_related.add_argument('-p', action='store_true', help='enable processing external DTDs and [p]arameter entities')
input_related.add_argument('-x', action='store_true', help='enable processing of e[x]ternal entities')
input_related.add_argument('-e', action='store', metavar='ENCODING', help='override any in-document [e]ncoding declaration')
input_related.add_argument('-w', action='store_true', help='enable support for [W]indows code pages')
input_related.add_argument('-r', action='store_true', help='disable memory-mapping and use normal file [r]ead IO calls instead')
output_related = parser.add_argument_group('output control arguments')
output_related.add_argument('-d', action='store', metavar='DIRECTORY', help='output [d]estination directory')
output_mode = output_related.add_mutually_exclusive_group()
output_mode.add_argument('-c', action='store_true', help='write a [c]opy of input XML, not canonical XML')
output_mode.add_argument('-m', action='store_true', help='write [m]eta XML, not canonical XML')
output_mode.add_argument('-t', action='store_true', help='write no XML output for [t]iming of plain parsing')
output_related.add_argument('-N', action='store_true', help='enable adding doctype and [n]otation declarations')
parser.add_argument('files', metavar='FILE', nargs='*', help='files to process (default: STDIN)')
info = parser.add_argument_group('info arguments')
info = info.add_mutually_exclusive_group()
info.add_argument('-h', action='store_true', help='show this [h]elp message and exit')
info.add_argument('-v', action='store_true', help='show program\'s [v]ersion number and exit')
if __name__ == '__main__':
parser.print_help()
+35
View File
@@ -0,0 +1,35 @@
#! /usr/bin/env bash
# __ __ _
# ___\ \/ /_ __ __ _| |_
# / _ \\ /| '_ \ / _` | __|
# | __// \| |_) | (_| | |_
# \___/_/\_\ .__/ \__,_|\__|
# |_| XML parser
#
# Copyright (c) 2019 Expat development team
# Licensed under the MIT license:
#
# 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.
./xmlwf/xmlwf_helpgen.py | sed \
-e 's,usage: xmlwf,usage: %s,' \
-e 's, \[-h | -v\],,' \
-e 's,^, T(",' \
-e 's,$,\\n"),'