[Pkg-javascript-commits] [node-expat] 13/34: ugprade libexpat version 2.2.0
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 10:46:48 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository node-expat.
commit 0184a2dbf4266890147c295767779dab34e58282
Author: Antonio Bustos <abustos at finametrix.com>
Date: Mon Jun 27 12:39:15 2016 +0200
ugprade libexpat version 2.2.0
---
deps/libexpat/CMake.README | 12 +-
deps/libexpat/CMakeLists.txt | 37 +-
deps/libexpat/COPYING | 5 +-
deps/libexpat/Changes | 66 +++-
deps/libexpat/MANIFEST | 4 +-
deps/libexpat/Makefile.in | 29 +-
deps/libexpat/README | 4 +-
deps/libexpat/bcb5/elements.bpr | 2 +-
deps/libexpat/bcb5/expat.bpr | 20 +-
deps/libexpat/bcb5/expat.mak | 2 +-
deps/libexpat/bcb5/expat_static.bpr | 18 +-
deps/libexpat/bcb5/expat_static.mak | 2 +-
deps/libexpat/bcb5/expatw.bpr | 22 +-
deps/libexpat/bcb5/expatw.mak | 2 +-
deps/libexpat/bcb5/expatw_static.bpr | 34 +-
deps/libexpat/bcb5/expatw_static.mak | 2 +-
deps/libexpat/bcb5/outline.bpr | 2 +-
deps/libexpat/bcb5/xmlwf.bpr | 16 +-
deps/libexpat/bcb5/xmlwf.mak | 2 +-
deps/libexpat/conftools/ac_c_bigendian_cross.m4 | 2 +-
deps/libexpat/conftools/mkinstalldirs | 2 +-
deps/libexpat/doc/expat.png | Bin 1027 -> 1029 bytes
deps/libexpat/doc/reference.html | 8 +-
deps/libexpat/doc/valid-xhtml10.png | Bin 2368 -> 2370 bytes
deps/libexpat/examples/elements.c | 9 +-
deps/libexpat/examples/outline.c | 7 +
deps/libexpat/lib/amigaconfig.h | 3 -
deps/libexpat/lib/expat.dsp | 4 +-
deps/libexpat/lib/expat.h | 13 +-
deps/libexpat/lib/expat_external.h | 14 +
deps/libexpat/lib/expat_static.dsp | 4 +-
deps/libexpat/lib/expatw.dsp | 4 +-
deps/libexpat/lib/expatw_static.dsp | 4 +-
deps/libexpat/lib/internal.h | 22 ++
deps/libexpat/lib/libexpat.def | 3 +
deps/libexpat/lib/libexpatw.def | 3 +
deps/libexpat/lib/xmlparse.c | 127 +++++--
deps/libexpat/lib/xmlrole.c | 224 +++++------
deps/libexpat/lib/xmltok.c | 230 ++++++++----
deps/libexpat/lib/xmltok.h | 10 +-
deps/libexpat/lib/xmltok_impl.c | 226 ++++++-----
deps/libexpat/tests/benchmark/README.txt | 2 +-
deps/libexpat/tests/chardata.c | 8 +-
deps/libexpat/tests/minicheck.c | 7 +-
deps/libexpat/tests/minicheck.h | 15 +-
deps/libexpat/tests/runtests.c | 479 ++++++++++++++++--------
deps/libexpat/tests/xmltest.sh | 8 +-
deps/libexpat/win32/README.txt | 8 +
deps/libexpat/win32/expat.iss | 25 +-
deps/libexpat/xmlwf/codepage.c | 5 +-
deps/libexpat/xmlwf/readfilemap.c | 9 +-
deps/libexpat/xmlwf/unixfilemap.c | 4 +-
deps/libexpat/xmlwf/xmlfile.c | 9 +-
deps/libexpat/xmlwf/xmlwf.c | 48 +--
deps/libexpat/xmlwf/xmlwf.dsp | 4 +-
55 files changed, 1186 insertions(+), 645 deletions(-)
diff --git a/deps/libexpat/CMake.README b/deps/libexpat/CMake.README
index 4db6399..8ea551f 100755
--- a/deps/libexpat/CMake.README
+++ b/deps/libexpat/CMake.README
@@ -3,25 +3,25 @@
The cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual
Studio) and should work on all other platform cmake supports.
-Assuming ~/expat-2.1.0 is the source directory of expat, add a subdirectory
+Assuming ~/expat-2.2.0 is the source directory of expat, add a subdirectory
build and change into that directory:
-~/expat-2.1.0$ mkdir build && cd build
-~/expat-2.1.0/build$
+~/expat-2.2.0$ mkdir build && cd build
+~/expat-2.2.0/build$
From that directory, call cmake first, then call make, make test and
make install in the usual way:
-~/expat-2.1.0/build$ cmake ..
+~/expat-2.2.0/build$ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
....
-- Configuring done
-- Generating done
--- Build files have been written to: /home/patrick/expat-2.1.0/build
+-- Build files have been written to: /home/patrick/expat-2.2.0/build
If you want to specify the install location for your files, append
-DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call.
-~/expat-2.1.0/build$ make && make test && make install
+~/expat-2.2.0/build$ make && make test && make install
Scanning dependencies of target expat
[ 5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o
[ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o
diff --git a/deps/libexpat/CMakeLists.txt b/deps/libexpat/CMakeLists.txt
index 0c923ba..349f7aa 100755
--- a/deps/libexpat/CMakeLists.txt
+++ b/deps/libexpat/CMakeLists.txt
@@ -6,7 +6,7 @@ project(expat)
cmake_minimum_required(VERSION 2.6)
set(PACKAGE_BUGREPORT "expat-bugs at libexpat.org")
set(PACKAGE_NAME "expat")
-set(PACKAGE_VERSION "2.1.0")
+set(PACKAGE_VERSION "2.2.0")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}")
@@ -41,6 +41,10 @@ include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996)
endif(MSVC)
+if(WIN32)
+ add_definitions(-DWIN32)
+ set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Add a suffix, usually d on Windows")
+endif(WIN32)
set(expat_SRCS
lib/xmlparse.c
@@ -50,18 +54,31 @@ set(expat_SRCS
lib/xmltok_ns.c
)
-if(WIN32 AND BUILD_shared)
- set(expat_SRCS ${expat_SRCS} lib/libexpat.def)
-endif(WIN32 AND BUILD_shared)
-
if(BUILD_shared)
set(_SHARED SHARED)
+ if(WIN32)
+ set(expat_SRCS ${expat_SRCS} lib/libexpat.def)
+ endif(WIN32)
else(BUILD_shared)
set(_SHARED STATIC)
+ if(WIN32)
+ add_definitions(-DXML_STATIC)
+ endif(WIN32)
endif(BUILD_shared)
add_library(expat ${_SHARED} ${expat_SRCS})
+set(LIBCURRENT 7) # sync
+set(LIBREVISION 2) # with
+set(LIBAGE 6) # configure.ac!
+math(EXPR LIBCURRENT_MINUS_AGE "${LIBCURRENT} - ${LIBAGE}")
+
+if(NOT WIN32)
+ set_property(TARGET expat PROPERTY VERSION ${LIBCURRENT_MINUS_AGE}.${LIBAGE}.${LIBREVISION})
+ set_property(TARGET expat PROPERTY SOVERSION ${LIBCURRENT_MINUS_AGE})
+ set_property(TARGET expat PROPERTY NO_SONAME ${NO_SONAME})
+endif(NOT WIN32)
+
install(TARGETS expat RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
@@ -76,6 +93,7 @@ install(FILES lib/expat.h lib/expat_external.h DESTINATION include)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig)
+add_custom_command(TARGET expat PRE_BUILD COMMAND $(MAKE) -C doc xmlwf.1)
if(BUILD_tools AND NOT WINCE)
set(xmlwf_SRCS
@@ -86,6 +104,7 @@ if(BUILD_tools AND NOT WINCE)
)
add_executable(xmlwf ${xmlwf_SRCS})
+ set_property(TARGET xmlwf PROPERTY RUNTIME_OUTPUT_DIRECTORY xmlwf)
target_link_libraries(xmlwf expat)
install(TARGETS xmlwf DESTINATION bin)
install(FILES doc/xmlwf.1 DESTINATION share/man/man1)
@@ -93,19 +112,23 @@ endif(BUILD_tools AND NOT WINCE)
if(BUILD_examples)
add_executable(elements examples/elements.c)
+ set_property(TARGET elements PROPERTY RUNTIME_OUTPUT_DIRECTORY examples)
target_link_libraries(elements expat)
add_executable(outline examples/outline.c)
+ set_property(TARGET outline PROPERTY RUNTIME_OUTPUT_DIRECTORY examples)
target_link_libraries(outline expat)
endif(BUILD_examples)
if(BUILD_tests)
## these are unittests that can be run on any platform
add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c)
+ set_property(TARGET runtests PROPERTY RUNTIME_OUTPUT_DIRECTORY tests)
target_link_libraries(runtests expat)
- add_test(runtests runtests)
+ add_test(runtests tests/runtests)
add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c)
+ set_property(TARGET runtestspp PROPERTY RUNTIME_OUTPUT_DIRECTORY tests)
target_link_libraries(runtestspp expat)
- add_test(runtestspp runtestspp)
+ add_test(runtestspp tests/runtestspp)
endif(BUILD_tests)
diff --git a/deps/libexpat/COPYING b/deps/libexpat/COPYING
index dcb4506..092c83b 100644
--- a/deps/libexpat/COPYING
+++ b/deps/libexpat/COPYING
@@ -1,6 +1,5 @@
-Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
- and Clark Cooper
-Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers.
+Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
+Copyright (c) 2001-2016 Expat maintainers
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/deps/libexpat/Changes b/deps/libexpat/Changes
index 08897b9..583c868 100644
--- a/deps/libexpat/Changes
+++ b/deps/libexpat/Changes
@@ -1,3 +1,67 @@
+Release 2.2.0 Tue June 21 2016
+ Security fixes:
+ #537 CVE-2016-0718 -- Fix crash on malformed input
+ CVE-2016-4472 -- Improve insufficient fix to CVE-2015-1283 /
+ CVE-2015-2716 introduced with Expat 2.1.1
+ #499 CVE-2016-5300 -- Use more entropy for hash initialization
+ than the original fix to CVE-2012-0876
+ #519 CVE-2012-6702 -- Resolve troublesome internal call to srand
+ that was introduced with Expat 2.1.0
+ when addressing CVE-2012-0876 (issue #496)
+
+ Bug fixes:
+ Fix uninitialized reads of size 1
+ (e.g. in little2_updatePosition)
+ Fix detection of UTF-8 character boundaries
+
+ Other changes:
+ #532 Fix compilation for Visual Studio 2010 (keyword "C99")
+ Autotools: Resolve use of "$<" to better support bmake
+ Autotools: Add QA script "qa.sh" (and make target "qa")
+ Autotools: Respect CXXFLAGS if given
+ Autotools: Fix "make run-xmltest"
+ Autotools: Have "make run-xmltest" check for expected output
+ p90 CMake: Fix static build (BUILD_shared=OFF) on Windows
+ #536 CMake: Add soversion, support -DNO_SONAME=yes to bypass
+ #323 CMake: Add suffix "d" to differentiate debug from release
+ CMake: Define WIN32 with CMake on Windows
+ Annotate memory allocators for GCC
+ Address all currently known compile warnings
+ Make sure that API symbols remain visible despite
+ -fvisibility=hidden
+ Remove executable flag from source files
+ Resolve COMPILED_FROM_DSP in favor of WIN32
+
+ Special thanks to:
+ Björn Lindahl
+ Christian Heimes
+ Cristian Rodríguez
+ Daniel Krügler
+ Gustavo Grieco
+ Karl Waclawek
+ László Böszörményi
+ Marco Grassi
+ Pascal Cuoq
+ Sergei Nikulov
+ Thomas Beutlich
+ Warren Young
+ Yann Droneaud
+
+Release 2.1.1 Sat March 12 2016
+ Security fixes:
+ #582: CVE-2015-1283 - Multiple integer overflows in XML_GetBuffer
+
+ Bug fixes:
+ #502: Fix potential null pointer dereference
+ #520: Symbol XML_SetHashSalt was not exported
+ Output of "xmlwf -h" was incomplete
+
+ Other changes:
+ #503: Document behavior of calling XML_SetHashSalt with salt 0
+ Minor improvements to man page xmlwf(1)
+ Improvements to the experimental CMake build system
+ libtool now invoked with --verbose
+
Release 2.1.0 Sat March 24 2012
- Bug Fixes:
#1742315: Harmful XML_ParserCreateNS suggestion.
@@ -23,7 +87,7 @@ Release 2.1.0 Sat March 24 2012
#3312568: CMake support.
#3446384: Report byte offsets for attr names and values.
- New Features / API changes:
- Added new API member XML_SetHashSalt() that allows setting an intial
+ Added new API member XML_SetHashSalt() that allows setting an initial
value (salt) for hash calculations. This is part of the fix for
bug #3496608 to randomize hash parameters.
When compiled with XML_ATTR_INFO defined, adds new API member
diff --git a/deps/libexpat/MANIFEST b/deps/libexpat/MANIFEST
index 7a020dc..afb9aca 100644
--- a/deps/libexpat/MANIFEST
+++ b/deps/libexpat/MANIFEST
@@ -44,7 +44,7 @@ doc/reference.html
doc/style.css
doc/valid-xhtml10.png
doc/xmlwf.1
-doc/xmlwf.sgml
+doc/xmlwf.xml
CMakeLists.txt
CMake.README
COPYING
@@ -54,7 +54,7 @@ MANIFEST
Makefile.in
README
configure
-configure.in
+configure.ac
expat_config.h.in
expat_config.h.cmake
expat.pc.in
diff --git a/deps/libexpat/Makefile.in b/deps/libexpat/Makefile.in
index 9c0f5d4..3310aa9 100644
--- a/deps/libexpat/Makefile.in
+++ b/deps/libexpat/Makefile.in
@@ -42,7 +42,7 @@ INSTALL_DATA = @INSTALL_DATA@
mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs
MANFILE = $(srcdir)/doc/xmlwf.1
-APIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h
+APIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h expat_config.h
LIBRARY = libexpat.la
DESTDIR = $(INSTALL_ROOT)
@@ -51,7 +51,7 @@ default: buildlib xmlwf/xmlwf at EXEEXT@
buildlib: $(LIBRARY) expat.pc
-all: $(LIBRARY) expat.pc xmlwf/xmlwf at EXEEXT@ examples/elements examples/outline
+all: $(LIBRARY) expat.pc xmlwf/xmlwf at EXEEXT@ examples/elements examples/outline $(MANFILE)
clean:
cd lib && rm -f $(LIBRARY) *. at OBJEXT@ *.lo && rm -rf .libs _libs
@@ -77,7 +77,10 @@ check: tests/runtests tests/runtestspp
tests/runtests
tests/runtestspp
-install: xmlwf/xmlwf at EXEEXT@ installlib
+$(MANFILE):
+ $(MAKE) -C doc xmlwf.1
+
+install: xmlwf/xmlwf at EXEEXT@ installlib $(MANFILE)
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf at EXEEXT@ $(DESTDIR)$(bindir)/xmlwf
$(INSTALL_DATA) $(MANFILE) $(DESTDIR)$(man1dir)
@@ -116,7 +119,7 @@ CXXFLAGS = @CXXFLAGS@
VSNFLAG = -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@
### autoconf this?
-LTFLAGS = --silent
+LTFLAGS = --verbose
COMPILE = $(CC) $(INCLUDES) $(CFLAGS) $(DEFS) $(CPPFLAGS)
CXXCOMPILE = $(CXX) $(INCLUDES) $(CXXFLAGS) $(DEFS) $(CPPFLAGS)
@@ -154,11 +157,11 @@ xmlwf/xmlwf at EXEEXT@: $(XMLWF_OBJS) $(LIBRARY)
examples/elements. at OBJEXT@: examples/elements.c
examples/elements: examples/elements. at OBJEXT@ $(LIBRARY)
- $(LINK_EXE) $< $(LIBRARY)
+ $(LINK_EXE) examples/elements. at OBJEXT@ $(LIBRARY)
examples/outline. at OBJEXT@: examples/outline.c
examples/outline: examples/outline. at OBJEXT@ $(LIBRARY)
- $(LINK_EXE) $< $(LIBRARY)
+ $(LINK_EXE) examples/outline. at OBJEXT@ $(LIBRARY)
tests/chardata. at OBJEXT@: tests/chardata.c tests/chardata.h
tests/minicheck. at OBJEXT@: tests/minicheck.c tests/minicheck.h
@@ -180,11 +183,19 @@ tests/xmlts.zip:
wget --output-document=tests/xmlts.zip \
http://www.w3.org/XML/Test/xmlts20080827.zip
-tests/XML-Test-Suite: tests/xmlts.zip
+tests/xmlconf: tests/xmlts.zip
cd tests && unzip -q xmlts.zip
-run-xmltest: xmlwf/xmlwf at EXEEXT@ tests/XML-Test-Suite
- tests/xmltest.sh
+run-xmltest: xmlwf/xmlwf at EXEEXT@ tests/xmlconf
+ tests/xmltest.sh 2>&1 | tee tests/xmltest.log
+ diff -u tests/xmltest.log.expected tests/xmltest.log
+
+.PHONY: qa
+qa:
+ ./qa.sh address
+ ./qa.sh memory
+ ./qa.sh undefined
+ ./qa.sh coverage
.SUFFIXES: .c .cpp .lo . at OBJEXT@
diff --git a/deps/libexpat/README b/deps/libexpat/README
index 1f88467..a7d2845 100644
--- a/deps/libexpat/README
+++ b/deps/libexpat/README
@@ -1,5 +1,5 @@
- Expat, Release 2.1.0
+ Expat, Release 2.2.0
This is Expat, a C library for parsing XML, written by James Clark.
Expat is a stream-oriented XML parser. This means that you register
@@ -114,7 +114,7 @@ Note for Solaris users: The "ar" command is usually located in
"/usr/ccs/bin", which is not in the default PATH. You will need to
add this to your path for the "make" command, and probably also switch
to GNU make (the "make" found in /usr/ccs/bin does not seem to work
-properly -- appearantly it does not understand .PHONY directives). If
+properly -- apparently it does not understand .PHONY directives). If
you're using ksh or bash, use this command to build:
PATH=/usr/ccs/bin:$PATH make
diff --git a/deps/libexpat/bcb5/elements.bpr b/deps/libexpat/bcb5/elements.bpr
index c21c0f5..e6e260f 100644
--- a/deps/libexpat/bcb5/elements.bpr
+++ b/deps/libexpat/bcb5/elements.bpr
@@ -146,4 +146,4 @@ ActiveLang=
ProjectLang=
RootDir=
</IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
+</PROJECT>@
diff --git a/deps/libexpat/bcb5/expat.bpr b/deps/libexpat/bcb5/expat.bpr
index 291b8ca..826f024 100644
--- a/deps/libexpat/bcb5/expat.bpr
+++ b/deps/libexpat/bcb5/expat.bpr
@@ -25,7 +25,7 @@
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="ilink32"/>
- <USERDEFINES value="_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS"/>
+ <USERDEFINES value="_WINDOWS;WIN32;NDEBUG;_USRDLL;EXPAT_EXPORTS"/>
<SYSDEFINES value="_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL"/>
<MAINSOURCE value="expat.bpf"/>
<INCLUDEPATH value="..\lib;$(BCB)\include"/>
@@ -94,14 +94,14 @@ Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=8
-Item0=_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS
-Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS
-Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS
-Item3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP
-Item4=NDEBUG;WIN32;_WINDOWS;_USRDLL;_DEBUG;EXPAT_EXPORTS;COMPILED_FROM_DSP
-Item5=NDEBUG;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;_DEBUG
-Item6=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;_DEBUG
-Item7=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP
+Item0=_WINDOWS;WIN32;NDEBUG;_USRDLL;EXPAT_EXPORTS
+Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS
+Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS
+Item3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS
+Item4=NDEBUG;WIN32;_WINDOWS;_USRDLL;_DEBUG;EXPAT_EXPORTS
+Item5=NDEBUG;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;_DEBUG
+Item6=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;_DEBUG
+Item7=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS
[HistoryLists\hlIntOutputDir]
Count=7
@@ -137,4 +137,4 @@ ActiveLang=
ProjectLang=
RootDir=
</IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
+</PROJECT>@
diff --git a/deps/libexpat/bcb5/expat.mak b/deps/libexpat/bcb5/expat.mak
index 7c9c23f..08b3f1b 100644
--- a/deps/libexpat/bcb5/expat.mak
+++ b/deps/libexpat/bcb5/expat.mak
@@ -36,7 +36,7 @@ PATHPAS = .;
PATHRC = .;
DEBUGLIBPATH = $(BCB)\lib\debug
RELEASELIBPATH = $(BCB)\lib\release
-USERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP
+USERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL
SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL
INCLUDEPATH = ..\lib;$(BCB)\include
LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH)
diff --git a/deps/libexpat/bcb5/expat_static.bpr b/deps/libexpat/bcb5/expat_static.bpr
index 2f6ec4d..26c2502 100644
--- a/deps/libexpat/bcb5/expat_static.bpr
+++ b/deps/libexpat/bcb5/expat_static.bpr
@@ -23,7 +23,7 @@
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="TLib"/>
- <USERDEFINES value="_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC"/>
+ <USERDEFINES value="_WINDOWS;WIN32;NDEBUG;_LIB;XML_STATIC"/>
<SYSDEFINES value="_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL"/>
<MAINSOURCE value="expat_static.bpf"/>
<INCLUDEPATH value="..\lib;$(BCB)\include"/>
@@ -93,13 +93,13 @@ Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=7
-Item0=_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC
-Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC
-Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC
-Item3=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_DEBUG
-Item4=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP
-Item5=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_MBCS
-Item6=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP
+Item0=_WINDOWS;WIN32;NDEBUG;_LIB;XML_STATIC
+Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;XML_STATIC
+Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;XML_STATIC
+Item3=WIN32;_WINDOWS;NDEBUG;_LIB;_DEBUG
+Item4=WIN32;_WINDOWS;NDEBUG;_LIB
+Item5=WIN32;_WINDOWS;NDEBUG;_LIB;_MBCS
+Item6=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB
[HistoryLists\hlIntOutputDir]
Count=6
@@ -140,4 +140,4 @@ ActiveLang=
ProjectLang=
RootDir=
</IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
+</PROJECT>@
diff --git a/deps/libexpat/bcb5/expat_static.mak b/deps/libexpat/bcb5/expat_static.mak
index 9137d3b..9322c49 100644
--- a/deps/libexpat/bcb5/expat_static.mak
+++ b/deps/libexpat/bcb5/expat_static.mak
@@ -35,7 +35,7 @@ PATHRC = .;
LINKER = TLib
DEBUGLIBPATH = $(BCB)\lib\debug
RELEASELIBPATH = $(BCB)\lib\release
-USERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC
+USERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;XML_STATIC
SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL
INCLUDEPATH = ..\lib;$(BCB)\include
LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH)
diff --git a/deps/libexpat/bcb5/expatw.bpr b/deps/libexpat/bcb5/expatw.bpr
index 9ec5001..1085933 100644
--- a/deps/libexpat/bcb5/expatw.bpr
+++ b/deps/libexpat/bcb5/expatw.bpr
@@ -25,7 +25,7 @@
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="ilink32"/>
- <USERDEFINES value="_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T"/>
+ <USERDEFINES value="_WINDOWS;WIN32;NDEBUG;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T"/>
<SYSDEFINES value="_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL"/>
<MAINSOURCE value="expatw.bpf"/>
<INCLUDEPATH value="..\lib;$(BCB)\include"/>
@@ -94,15 +94,15 @@ Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=9
-Item0=_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T
-Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T
-Item2=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T
-Item3=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;_DEBUG;XML_UNICODE_WCHAR_T
-Item4=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG
-Item5=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG
-Item6=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T
-Item7=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;XML_UNICODE
-Item8=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T
+Item0=_WINDOWS;WIN32;NDEBUG;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T
+Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T
+Item2=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T
+Item3=NDEBUG;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;_DEBUG;XML_UNICODE_WCHAR_T
+Item4=NDEBUG;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG
+Item5=NDEBUG;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG
+Item6=NDEBUG;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T
+Item7=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;XML_UNICODE
+Item8=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T
[HistoryLists\hlIntOutputDir]
Count=8
@@ -143,4 +143,4 @@ ActiveLang=
ProjectLang=
RootDir=
</IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
+</PROJECT>@
diff --git a/deps/libexpat/bcb5/expatw.mak b/deps/libexpat/bcb5/expatw.mak
index 08e17d0..848d814 100644
--- a/deps/libexpat/bcb5/expatw.mak
+++ b/deps/libexpat/bcb5/expatw.mak
@@ -36,7 +36,7 @@ PATHPAS = .;
PATHRC = .;
DEBUGLIBPATH = $(BCB)\lib\debug
RELEASELIBPATH = $(BCB)\lib\release
-USERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T
+USERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL;XML_UNICODE_WCHAR_T
SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL
INCLUDEPATH = ..\lib;$(BCB)\include
LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH)
diff --git a/deps/libexpat/bcb5/expatw_static.bpr b/deps/libexpat/bcb5/expatw_static.bpr
index 3f12644..f73dca2 100644
--- a/deps/libexpat/bcb5/expatw_static.bpr
+++ b/deps/libexpat/bcb5/expatw_static.bpr
@@ -23,7 +23,7 @@
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="TLib"/>
- <USERDEFINES value="_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T"/>
+ <USERDEFINES value="_WINDOWS;WIN32;NDEBUG;_LIB;XML_STATIC;XML_UNICODE_WCHAR_T"/>
<SYSDEFINES value="_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL"/>
<MAINSOURCE value="expatw_static.bpf"/>
<INCLUDEPATH value="..\lib;$(BCB)\include"/>
@@ -94,21 +94,21 @@ Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=15
-Item0=_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T
-Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T
-Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T
-Item3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;XML_STATIC;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T
-Item4=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T
-Item5=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG
-Item6=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;__cplusplus
-Item7=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG
-Item8=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG
-Item9=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;__WCHAR_T
-Item10=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;_UNICODE
-Item11=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG;_UNICODE
-Item12=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG
-Item13=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T
-Item14=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;XML_UNICODE
+Item0=_WINDOWS;WIN32;NDEBUG;_LIB;XML_STATIC;XML_UNICODE_WCHAR_T
+Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;XML_STATIC;XML_UNICODE_WCHAR_T
+Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;XML_STATIC;XML_UNICODE_WCHAR_T
+Item3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;XML_STATIC;XML_UNICODE_WCHAR_T
+Item4=WIN32;_WINDOWS;NDEBUG;_LIB;_DEBUG;XML_UNICODE_WCHAR_T
+Item5=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;XML_UNICODE_WCHAR_T;_DEBUG
+Item6=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;XML_UNICODE_WCHAR_T;_DEBUG;__cplusplus
+Item7=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;XML_UNICODE;_DEBUG
+Item8=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE;_DEBUG
+Item9=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE_WCHAR_T;_DEBUG;__WCHAR_T
+Item10=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE_WCHAR_T;_DEBUG;_UNICODE
+Item11=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE;_DEBUG;_UNICODE
+Item12=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE_WCHAR_T;_DEBUG
+Item13=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE_WCHAR_T
+Item14=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;XML_UNICODE_WCHAR_T;XML_UNICODE
[HistoryLists\hlIntOutputDir]
Count=6
@@ -149,4 +149,4 @@ ActiveLang=
ProjectLang=
RootDir=
</IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
+</PROJECT>@
diff --git a/deps/libexpat/bcb5/expatw_static.mak b/deps/libexpat/bcb5/expatw_static.mak
index 16b7e5b..49944c7 100644
--- a/deps/libexpat/bcb5/expatw_static.mak
+++ b/deps/libexpat/bcb5/expatw_static.mak
@@ -35,7 +35,7 @@ PATHRC = .;
LINKER = TLib
DEBUGLIBPATH = $(BCB)\lib\debug
RELEASELIBPATH = $(BCB)\lib\release
-USERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T
+USERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;XML_STATIC;XML_UNICODE_WCHAR_T
SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL
INCLUDEPATH = ..\lib;$(BCB)\include
LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH)
diff --git a/deps/libexpat/bcb5/outline.bpr b/deps/libexpat/bcb5/outline.bpr
index e0ae5cd..9ad8bed 100644
--- a/deps/libexpat/bcb5/outline.bpr
+++ b/deps/libexpat/bcb5/outline.bpr
@@ -129,4 +129,4 @@ ActiveLang=
ProjectLang=
RootDir=
</IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
+</PROJECT>@
diff --git a/deps/libexpat/bcb5/xmlwf.bpr b/deps/libexpat/bcb5/xmlwf.bpr
index d33a153..825878a 100644
--- a/deps/libexpat/bcb5/xmlwf.bpr
+++ b/deps/libexpat/bcb5/xmlwf.bpr
@@ -25,7 +25,7 @@
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="ilink32"/>
- <USERDEFINES value="NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP"/>
+ <USERDEFINES value="NDEBUG;WIN32;_CONSOLE"/>
<SYSDEFINES value="_NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL"/>
<MAINSOURCE value="xmlwf.bpf"/>
<INCLUDEPATH value="..\xmlwf;$(BCB)\include"/>
@@ -94,12 +94,12 @@ Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=6
-Item0=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP
-Item1=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE
-Item2=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T
-Item3=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG
-Item4=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;_UNICODE;XML_UNICODE_WCHAR_T
-Item5=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;_UNICODE
+Item0=NDEBUG;WIN32;_CONSOLE
+Item1=NDEBUG;WIN32;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE
+Item2=NDEBUG;WIN32;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T
+Item3=NDEBUG;WIN32;_CONSOLE;_DEBUG
+Item4=NDEBUG;WIN32;_CONSOLE;_DEBUG;_UNICODE;XML_UNICODE_WCHAR_T
+Item5=NDEBUG;WIN32;_CONSOLE;_DEBUG;_UNICODE
[HistoryLists\hlIntOutputDir]
Count=3
@@ -133,4 +133,4 @@ ActiveLang=
ProjectLang=
RootDir=
</IDEOPTIONS>
-</PROJECT>
\ No newline at end of file
+</PROJECT>@
diff --git a/deps/libexpat/bcb5/xmlwf.mak b/deps/libexpat/bcb5/xmlwf.mak
index f74126e..c72c9cc 100644
--- a/deps/libexpat/bcb5/xmlwf.mak
+++ b/deps/libexpat/bcb5/xmlwf.mak
@@ -36,7 +36,7 @@ PATHPAS = .;
PATHRC = .;
DEBUGLIBPATH = $(BCB)\lib\debug
RELEASELIBPATH = $(BCB)\lib\release
-USERDEFINES = NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP
+USERDEFINES = NDEBUG;WIN32;_CONSOLE
SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL
INCLUDEPATH = ..\xmlwf;$(BCB)\include
LIBPATH = ..\xmlwf;$(BCB)\lib;$(RELEASELIBPATH)
diff --git a/deps/libexpat/conftools/ac_c_bigendian_cross.m4 b/deps/libexpat/conftools/ac_c_bigendian_cross.m4
index 8ed3edb..e95ffb6 100644
--- a/deps/libexpat/conftools/ac_c_bigendian_cross.m4
+++ b/deps/libexpat/conftools/ac_c_bigendian_cross.m4
@@ -7,7 +7,7 @@ dnl The implementation will create a binary, and instead of running
dnl the binary it will be grep'ed for some symbols that will look
dnl different for different endianess of the binary.
dnl
-dnl @version $Id: ac_c_bigendian_cross.m4,v 1.2 2001/10/01 20:03:13 fdrake Exp $
+dnl @version $Id: ac_c_bigendian_cross.m4,v 1.1 2001/07/24 19:51:35 fdrake Exp $
dnl @author Guido Draheim <guidod at gmx.de>
dnl
AC_DEFUN([AC_C_BIGENDIAN_CROSS],
diff --git a/deps/libexpat/conftools/mkinstalldirs b/deps/libexpat/conftools/mkinstalldirs
index c5291db..4f58503 100755
--- a/deps/libexpat/conftools/mkinstalldirs
+++ b/deps/libexpat/conftools/mkinstalldirs
@@ -4,7 +4,7 @@
# Created: 1993-05-16
# Public domain
-# $Id: mkinstalldirs,v 1.1 2000/09/18 16:26:21 coopercc Exp $
+# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
errstatus=0
diff --git a/deps/libexpat/doc/expat.png b/deps/libexpat/doc/expat.png
index 5bc0726..3d88eac 100644
Binary files a/deps/libexpat/doc/expat.png and b/deps/libexpat/doc/expat.png differ
diff --git a/deps/libexpat/doc/reference.html b/deps/libexpat/doc/reference.html
index 8811a33..a4ab405 100644
--- a/deps/libexpat/doc/reference.html
+++ b/deps/libexpat/doc/reference.html
@@ -2151,8 +2151,12 @@ Helps in preventing DoS attacks based on predicting hash
function behavior. In order to have an effect this must be called
before parsing has started. Returns 1 if successful, 0 when called
after <code>XML_Parse</code> or <code>XML_ParseBuffer</code>.
-<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.</p>
+<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.
+<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
+that <code>XML_SetHashSalt</code> has <b>not</b> been called. Consequently
+such a call will have no effect, even if it returns 1.</p>
</div>
<pre class="fcndec" id="XML_UseForeignDTD">
diff --git a/deps/libexpat/doc/valid-xhtml10.png b/deps/libexpat/doc/valid-xhtml10.png
index 4c23f48..2f755c6 100644
Binary files a/deps/libexpat/doc/valid-xhtml10.png and b/deps/libexpat/doc/valid-xhtml10.png differ
diff --git a/deps/libexpat/examples/elements.c b/deps/libexpat/examples/elements.c
index 6b8f855..0ca1abd 100644
--- a/deps/libexpat/examples/elements.c
+++ b/deps/libexpat/examples/elements.c
@@ -27,6 +27,8 @@ startElement(void *userData, const char *name, const char **atts)
{
int i;
int *depthPtr = (int *)userData;
+ (void)atts;
+
for (i = 0; i < *depthPtr; i++)
putchar('\t');
puts(name);
@@ -37,6 +39,8 @@ static void XMLCALL
endElement(void *userData, const char *name)
{
int *depthPtr = (int *)userData;
+ (void)name;
+
*depthPtr -= 1;
}
@@ -47,10 +51,13 @@ main(int argc, char *argv[])
XML_Parser parser = XML_ParserCreate(NULL);
int done;
int depth = 0;
+ (void)argc;
+ (void)argv;
+
XML_SetUserData(parser, &depth);
XML_SetElementHandler(parser, startElement, endElement);
do {
- int len = (int)fread(buf, 1, sizeof(buf), stdin);
+ size_t len = fread(buf, 1, sizeof(buf), stdin);
done = len < sizeof(buf);
if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) {
fprintf(stderr,
diff --git a/deps/libexpat/examples/outline.c b/deps/libexpat/examples/outline.c
index 3a3c838..d9b0917 100644
--- a/deps/libexpat/examples/outline.c
+++ b/deps/libexpat/examples/outline.c
@@ -49,6 +49,7 @@ static void XMLCALL
start(void *data, const char *el, const char **attr)
{
int i;
+ (void)data;
for (i = 0; i < Depth; i++)
printf(" ");
@@ -66,6 +67,9 @@ start(void *data, const char *el, const char **attr)
static void XMLCALL
end(void *data, const char *el)
{
+ (void)data;
+ (void)el;
+
Depth--;
}
@@ -73,6 +77,9 @@ int
main(int argc, char *argv[])
{
XML_Parser p = XML_ParserCreate(NULL);
+ (void)argc;
+ (void)argv;
+
if (! p) {
fprintf(stderr, "Couldn't allocate memory for parser\n");
exit(-1);
diff --git a/deps/libexpat/lib/amigaconfig.h b/deps/libexpat/lib/amigaconfig.h
index 86c6115..49c92c7 100644
--- a/deps/libexpat/lib/amigaconfig.h
+++ b/deps/libexpat/lib/amigaconfig.h
@@ -7,9 +7,6 @@
/* Define to 1 if you have the `bcopy' function. */
#define HAVE_BCOPY 1
-/* Define to 1 if you have the <check.h> header file. */
-#undef HAVE_CHECK_H
-
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
diff --git a/deps/libexpat/lib/expat.dsp b/deps/libexpat/lib/expat.dsp
index 6440d37..34d03ef 100644
--- a/deps/libexpat/lib/expat.dsp
+++ b/deps/libexpat/lib/expat.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILED_FROM_DSP" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -70,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
diff --git a/deps/libexpat/lib/expat.h b/deps/libexpat/lib/expat.h
index 9a21680..086e24b 100644
--- a/deps/libexpat/lib/expat.h
+++ b/deps/libexpat/lib/expat.h
@@ -342,7 +342,7 @@ XML_SetEntityDeclHandler(XML_Parser parser,
XML_EntityDeclHandler handler);
/* OBSOLETE -- OBSOLETE -- OBSOLETE
- This handler has been superceded by the EntityDeclHandler above.
+ This handler has been superseded by the EntityDeclHandler above.
It is provided here for backward compatibility.
This is called for a declaration of an unparsed (NDATA) entity.
@@ -973,9 +973,12 @@ XML_FreeContentModel(XML_Parser parser, XML_Content *model);
/* Exposing the memory handling functions used in Expat */
XMLPARSEAPI(void *)
+XML_ATTR_MALLOC
+XML_ATTR_ALLOC_SIZE(2)
XML_MemMalloc(XML_Parser parser, size_t size);
XMLPARSEAPI(void *)
+XML_ATTR_ALLOC_SIZE(3)
XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
XMLPARSEAPI(void)
@@ -1031,13 +1034,11 @@ XMLPARSEAPI(const XML_Feature *)
XML_GetFeatureList(void);
-/* Expat follows the GNU/Linux convention of odd number minor version for
- beta/development releases and even number minor version for stable
- releases. Micro is bumped with each release, and set to 0 with each
- change to major or minor version.
+/* Expat follows the semantic versioning convention.
+ See http://semver.org.
*/
#define XML_MAJOR_VERSION 2
-#define XML_MINOR_VERSION 1
+#define XML_MINOR_VERSION 2
#define XML_MICRO_VERSION 0
#ifdef __cplusplus
diff --git a/deps/libexpat/lib/expat_external.h b/deps/libexpat/lib/expat_external.h
index 2c03284..aa08a2f 100644
--- a/deps/libexpat/lib/expat_external.h
+++ b/deps/libexpat/lib/expat_external.h
@@ -65,12 +65,26 @@
#endif
#endif /* not defined XML_STATIC */
+#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)
+#define XMLIMPORT __attribute__ ((visibility ("default")))
+#endif
/* If we didn't define it above, define it away: */
#ifndef XMLIMPORT
#define XMLIMPORT
#endif
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
+#define XML_ATTR_MALLOC __attribute__((__malloc__))
+#else
+#define XML_ATTR_MALLOC
+#endif
+
+#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+#define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
+#else
+#define XML_ATTR_ALLOC_SIZE(x)
+#endif
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
diff --git a/deps/libexpat/lib/expat_static.dsp b/deps/libexpat/lib/expat_static.dsp
index ca39bc0..73a13ca 100644
--- a/deps/libexpat/lib/expat_static.dsp
+++ b/deps/libexpat/lib/expat_static.dsp
@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "..\win32\tmp\Release_static"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
@@ -65,7 +65,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "..\win32\tmp\Debug_static"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "COMPILED_FROM_DSP" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
diff --git a/deps/libexpat/lib/expatw.dsp b/deps/libexpat/lib/expatw.dsp
index 77497b5..ca4da5c 100644
--- a/deps/libexpat/lib/expatw.dsp
+++ b/deps/libexpat/lib/expatw.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_UNICODE_WCHAR_T" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_UNICODE_WCHAR_T" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -70,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_UNICODE_WCHAR_T" /FR /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_UNICODE_WCHAR_T" /FR /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
diff --git a/deps/libexpat/lib/expatw_static.dsp b/deps/libexpat/lib/expatw_static.dsp
index f13dd72..cd936f8 100644
--- a/deps/libexpat/lib/expatw_static.dsp
+++ b/deps/libexpat/lib/expatw_static.dsp
@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "..\win32\tmp\Release-w_static"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /D "XML_UNICODE_WCHAR_T" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "XML_UNICODE_WCHAR_T" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x1009 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
@@ -65,7 +65,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "..\win32\tmp\Debug-w_static"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /D "XML_UNICODE_WCHAR_T" /FR /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /D "XML_UNICODE_WCHAR_T" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x1009 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
diff --git a/deps/libexpat/lib/internal.h b/deps/libexpat/lib/internal.h
index dd54548..94cb98e 100644
--- a/deps/libexpat/lib/internal.h
+++ b/deps/libexpat/lib/internal.h
@@ -71,3 +71,25 @@
#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
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void
+align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef);
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/deps/libexpat/lib/libexpat.def b/deps/libexpat/lib/libexpat.def
index 3920bbc..79b0491 100644
--- a/deps/libexpat/lib/libexpat.def
+++ b/deps/libexpat/lib/libexpat.def
@@ -71,3 +71,6 @@ EXPORTS
XML_StopParser @63
XML_ResumeParser @64
XML_GetParsingStatus @65
+; added with version 2.1.1
+; XML_GetAttributeInfo @66
+ XML_SetHashSalt @67@
diff --git a/deps/libexpat/lib/libexpatw.def b/deps/libexpat/lib/libexpatw.def
index 3920bbc..79b0491 100644
--- a/deps/libexpat/lib/libexpatw.def
+++ b/deps/libexpat/lib/libexpatw.def
@@ -71,3 +71,6 @@ EXPORTS
XML_StopParser @63
XML_ResumeParser @64
XML_GetParsingStatus @65
+; added with version 2.1.1
+; XML_GetAttributeInfo @66
+ XML_SetHashSalt @67@
diff --git a/deps/libexpat/lib/xmlparse.c b/deps/libexpat/lib/xmlparse.c
index f35aa36..b308e67 100644
--- a/deps/libexpat/lib/xmlparse.c
+++ b/deps/libexpat/lib/xmlparse.c
@@ -6,11 +6,18 @@
#include <string.h> /* memset(), memcpy() */
#include <assert.h>
#include <limits.h> /* UINT_MAX */
-#include <time.h> /* time() */
+
+#ifdef WIN32
+#define getpid GetCurrentProcessId
+#else
+#include <sys/time.h> /* gettimeofday() */
+#include <sys/types.h> /* getpid() */
+#include <unistd.h> /* getpid() */
+#endif
#define XML_BUILDING_EXPAT 1
-#ifdef COMPILED_FROM_DSP
+#ifdef WIN32
#include "winconfig.h"
#elif defined(MACOS_CLASSIC)
#include "macconfig.h"
@@ -20,7 +27,7 @@
#include "watcomconfig.h"
#elif defined(HAVE_EXPAT_CONFIG_H)
#include <expat_config.h>
-#endif /* ndef COMPILED_FROM_DSP */
+#endif /* ndef WIN32 */
#include "ascii.h"
#include "expat.h"
@@ -432,7 +439,7 @@ static ELEMENT_TYPE *
getElementType(XML_Parser parser, const ENCODING *enc,
const char *ptr, const char *end);
-static unsigned long generate_hash_secret_salt(void);
+static unsigned long generate_hash_secret_salt(XML_Parser parser);
static XML_Bool startParsing(XML_Parser parser);
static XML_Parser
@@ -691,11 +698,38 @@ static const XML_Char implicitContext[] = {
};
static unsigned long
-generate_hash_secret_salt(void)
+gather_time_entropy(void)
{
- unsigned int seed = time(NULL) % UINT_MAX;
- srand(seed);
- return rand();
+#ifdef WIN32
+ FILETIME ft;
+ GetSystemTimeAsFileTime(&ft); /* never fails */
+ return ft.dwHighDateTime ^ ft.dwLowDateTime;
+#else
+ struct timeval tv;
+ int gettimeofday_res;
+
+ gettimeofday_res = gettimeofday(&tv, NULL);
+ assert (gettimeofday_res == 0);
+
+ /* Microseconds time is <20 bits entropy */
+ return tv.tv_usec;
+#endif
+}
+
+static unsigned long
+generate_hash_secret_salt(XML_Parser parser)
+{
+ /* Process ID is 0 bits entropy if attacker has local access
+ * XML_Parser address is few bits of entropy if attacker has local access */
+ const unsigned long entropy =
+ gather_time_entropy() ^ getpid() ^ (unsigned long)parser;
+
+ /* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */
+ if (sizeof(unsigned long) == 4) {
+ return entropy * 2147483647;
+ } else {
+ return entropy * (unsigned long)2305843009213693951;
+ }
}
static XML_Bool /* only valid for root parser */
@@ -703,7 +737,7 @@ startParsing(XML_Parser parser)
{
/* hash functions must be initialized before setContext() is called */
if (hash_secret_salt == 0)
- hash_secret_salt = generate_hash_secret_salt();
+ hash_secret_salt = generate_hash_secret_salt(parser);
if (ns) {
/* implicit context only set for root parser, since child
parsers (i.e. external entity parsers) will inherit it
@@ -1550,7 +1584,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
else if (bufferPtr == bufferEnd) {
const char *end;
int nLeftOver;
- enum XML_Error result;
+ enum XML_Status result;
parseEndByteIndex += len;
positionPtr = s;
ps_finalBuffer = (XML_Bool)isFinal;
@@ -1678,6 +1712,10 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
void * XMLCALL
XML_GetBuffer(XML_Parser parser, int len)
{
+ if (len < 0) {
+ errorCode = XML_ERROR_NO_MEMORY;
+ return NULL;
+ }
switch (ps_parsing) {
case XML_SUSPENDED:
errorCode = XML_ERROR_SUSPENDED;
@@ -1689,11 +1727,17 @@ XML_GetBuffer(XML_Parser parser, int len)
}
if (len > bufferLim - bufferEnd) {
- /* FIXME avoid integer overflow */
- int neededSize = len + (int)(bufferEnd - bufferPtr);
#ifdef XML_CONTEXT_BYTES
- int keep = (int)(bufferPtr - buffer);
-
+ int keep;
+#endif /* defined XML_CONTEXT_BYTES */
+ /* Do not invoke signed arithmetic overflow: */
+ int neededSize = (int) ((unsigned)len + (unsigned)(bufferEnd - bufferPtr));
+ if (neededSize < 0) {
+ errorCode = XML_ERROR_NO_MEMORY;
+ return NULL;
+ }
+#ifdef XML_CONTEXT_BYTES
+ keep = (int)(bufferPtr - buffer);
if (keep > XML_CONTEXT_BYTES)
keep = XML_CONTEXT_BYTES;
neededSize += keep;
@@ -1718,8 +1762,13 @@ XML_GetBuffer(XML_Parser parser, int len)
if (bufferSize == 0)
bufferSize = INIT_BUFFER_SIZE;
do {
- bufferSize *= 2;
- } while (bufferSize < neededSize);
+ /* Do not invoke signed arithmetic overflow: */
+ bufferSize = (int) (2U * (unsigned) bufferSize);
+ } while (bufferSize < neededSize && bufferSize > 0);
+ if (bufferSize <= 0) {
+ errorCode = XML_ERROR_NO_MEMORY;
+ return NULL;
+ }
newBuf = (char *)MALLOC(bufferSize);
if (newBuf == 0) {
errorCode = XML_ERROR_NO_MEMORY;
@@ -1841,7 +1890,7 @@ XML_Index XMLCALL
XML_GetCurrentByteIndex(XML_Parser parser)
{
if (eventPtr)
- return parseEndByteIndex - (parseEndPtr - eventPtr);
+ return (XML_Index)(parseEndByteIndex - (parseEndPtr - eventPtr));
return -1;
}
@@ -2415,11 +2464,11 @@ doContent(XML_Parser parser,
for (;;) {
int bufSize;
int convLen;
- XmlConvert(enc,
+ const enum XML_Convert_Result convert_res = XmlConvert(enc,
&fromPtr, rawNameEnd,
(ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);
convLen = (int)(toPtr - (XML_Char *)tag->buf);
- if (fromPtr == rawNameEnd) {
+ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) {
tag->name.strLen = convLen;
break;
}
@@ -2640,11 +2689,11 @@ doContent(XML_Parser parser,
if (MUST_CONVERT(enc, s)) {
for (;;) {
ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
+ const enum XML_Convert_Result convert_res = XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = s;
charDataHandler(handlerArg, dataBuf,
(int)(dataPtr - (ICHAR *)dataBuf));
- if (s == next)
+ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE))
break;
*eventPP = s;
}
@@ -2911,6 +2960,8 @@ storeAtts(XML_Parser parser, const ENCODING *enc,
unsigned long uriHash = hash_secret_salt;
((XML_Char *)s)[-1] = 0; /* clear flag */
id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0);
+ if (!id || !id->prefix)
+ return XML_ERROR_NO_MEMORY;
b = id->prefix->binding;
if (!b)
return XML_ERROR_UNBOUND_PREFIX;
@@ -3248,11 +3299,11 @@ doCdataSection(XML_Parser parser,
if (MUST_CONVERT(enc, s)) {
for (;;) {
ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
+ const enum XML_Convert_Result convert_res = XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = next;
charDataHandler(handlerArg, dataBuf,
(int)(dataPtr - (ICHAR *)dataBuf));
- if (s == next)
+ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE))
break;
*eventPP = s;
}
@@ -4911,9 +4962,9 @@ internalEntityProcessor(XML_Parser parser,
static enum XML_Error PTRCALL
errorProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
+ const char *UNUSED_P(s),
+ const char *UNUSED_P(end),
+ const char **UNUSED_P(nextPtr))
{
return errorCode;
}
@@ -5329,6 +5380,7 @@ reportDefault(XML_Parser parser, const ENCODING *enc,
const char *s, const char *end)
{
if (MUST_CONVERT(enc, s)) {
+ enum XML_Convert_Result convert_res;
const char **eventPP;
const char **eventEndPP;
if (enc == encoding) {
@@ -5341,11 +5393,11 @@ reportDefault(XML_Parser parser, const ENCODING *enc,
}
do {
ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
+ convert_res = XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
*eventEndPP = s;
defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf));
*eventPP = s;
- } while (s != end);
+ } while ((convert_res != XML_CONVERT_COMPLETED) && (convert_res != XML_CONVERT_INPUT_INCOMPLETE));
}
else
defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s));
@@ -5475,6 +5527,8 @@ getAttributeId(XML_Parser parser, const ENCODING *enc,
return NULL;
id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool),
sizeof(PREFIX));
+ if (!id->prefix)
+ return NULL;
if (id->prefix->name == poolStart(&dtd->pool))
poolFinish(&dtd->pool);
else
@@ -6148,8 +6202,8 @@ poolAppend(STRING_POOL *pool, const ENCODING *enc,
if (!pool->ptr && !poolGrow(pool))
return NULL;
for (;;) {
- XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
- if (ptr == end)
+ const enum XML_Convert_Result convert_res = XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
+ if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE))
break;
if (!poolGrow(pool))
return NULL;
@@ -6233,8 +6287,13 @@ poolGrow(STRING_POOL *pool)
}
}
if (pool->blocks && pool->start == pool->blocks->s) {
- int blockSize = (int)(pool->end - pool->start)*2;
- BLOCK *temp = (BLOCK *)
+ BLOCK *temp;
+ int blockSize = (int)((unsigned)(pool->end - pool->start)*2U);
+
+ if (blockSize < 0)
+ return XML_FALSE;
+
+ temp = (BLOCK *)
pool->mem->realloc_fcn(pool->blocks,
(offsetof(BLOCK, s)
+ blockSize * sizeof(XML_Char)));
@@ -6249,6 +6308,10 @@ poolGrow(STRING_POOL *pool)
else {
BLOCK *tem;
int blockSize = (int)(pool->end - pool->start);
+
+ if (blockSize < 0)
+ return XML_FALSE;
+
if (blockSize < INIT_BLOCK_SIZE)
blockSize = INIT_BLOCK_SIZE;
else
diff --git a/deps/libexpat/lib/xmlrole.c b/deps/libexpat/lib/xmlrole.c
index 44772e2..fcd0dc6 100644
--- a/deps/libexpat/lib/xmlrole.c
+++ b/deps/libexpat/lib/xmlrole.c
@@ -4,7 +4,7 @@
#include <stddef.h>
-#ifdef COMPILED_FROM_DSP
+#ifdef WIN32
#include "winconfig.h"
#elif defined(MACOS_CLASSIC)
#include "macconfig.h"
@@ -16,7 +16,7 @@
#ifdef HAVE_EXPAT_CONFIG_H
#include <expat_config.h>
#endif
-#endif /* ndef COMPILED_FROM_DSP */
+#endif /* ndef WIN32 */
#include "expat_external.h"
#include "internal.h"
@@ -195,9 +195,9 @@ prolog1(PROLOG_STATE *state,
static int PTRCALL
prolog2(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -216,9 +216,9 @@ prolog2(PROLOG_STATE *state,
static int PTRCALL
doctype0(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -264,9 +264,9 @@ doctype1(PROLOG_STATE *state,
static int PTRCALL
doctype2(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -281,9 +281,9 @@ doctype2(PROLOG_STATE *state,
static int PTRCALL
doctype3(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -298,9 +298,9 @@ doctype3(PROLOG_STATE *state,
static int PTRCALL
doctype4(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -318,9 +318,9 @@ doctype4(PROLOG_STATE *state,
static int PTRCALL
doctype5(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -437,9 +437,9 @@ externalSubset1(PROLOG_STATE *state,
static int PTRCALL
entity0(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -457,9 +457,9 @@ entity0(PROLOG_STATE *state,
static int PTRCALL
entity1(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -502,9 +502,9 @@ entity2(PROLOG_STATE *state,
static int PTRCALL
entity3(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -519,9 +519,9 @@ entity3(PROLOG_STATE *state,
static int PTRCALL
entity4(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -559,9 +559,9 @@ entity5(PROLOG_STATE *state,
static int PTRCALL
entity6(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -605,9 +605,9 @@ entity7(PROLOG_STATE *state,
static int PTRCALL
entity8(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -622,9 +622,9 @@ entity8(PROLOG_STATE *state,
static int PTRCALL
entity9(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -639,9 +639,9 @@ entity9(PROLOG_STATE *state,
static int PTRCALL
entity10(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -656,9 +656,9 @@ entity10(PROLOG_STATE *state,
static int PTRCALL
notation0(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -697,9 +697,9 @@ notation1(PROLOG_STATE *state,
static int PTRCALL
notation2(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -714,9 +714,9 @@ notation2(PROLOG_STATE *state,
static int PTRCALL
notation3(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -732,9 +732,9 @@ notation3(PROLOG_STATE *state,
static int PTRCALL
notation4(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -753,9 +753,9 @@ notation4(PROLOG_STATE *state,
static int PTRCALL
attlist0(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -771,9 +771,9 @@ attlist0(PROLOG_STATE *state,
static int PTRCALL
attlist1(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -833,9 +833,9 @@ attlist2(PROLOG_STATE *state,
static int PTRCALL
attlist3(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -852,9 +852,9 @@ attlist3(PROLOG_STATE *state,
static int PTRCALL
attlist4(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -872,9 +872,9 @@ attlist4(PROLOG_STATE *state,
static int PTRCALL
attlist5(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -889,9 +889,9 @@ attlist5(PROLOG_STATE *state,
static int PTRCALL
attlist6(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -906,9 +906,9 @@ attlist6(PROLOG_STATE *state,
static int PTRCALL
attlist7(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -967,9 +967,9 @@ attlist8(PROLOG_STATE *state,
static int PTRCALL
attlist9(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -984,9 +984,9 @@ attlist9(PROLOG_STATE *state,
static int PTRCALL
element0(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1072,9 +1072,9 @@ element2(PROLOG_STATE *state,
static int PTRCALL
element3(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1097,9 +1097,9 @@ element3(PROLOG_STATE *state,
static int PTRCALL
element4(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1115,9 +1115,9 @@ element4(PROLOG_STATE *state,
static int PTRCALL
element5(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1136,9 +1136,9 @@ element5(PROLOG_STATE *state,
static int PTRCALL
element6(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1166,9 +1166,9 @@ element6(PROLOG_STATE *state,
static int PTRCALL
element7(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1240,9 +1240,9 @@ condSect0(PROLOG_STATE *state,
static int PTRCALL
condSect1(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1258,9 +1258,9 @@ condSect1(PROLOG_STATE *state,
static int PTRCALL
condSect2(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1277,9 +1277,9 @@ condSect2(PROLOG_STATE *state,
static int PTRCALL
declClose(PROLOG_STATE *state,
int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
switch (tok) {
case XML_TOK_PROLOG_S:
@@ -1292,11 +1292,11 @@ declClose(PROLOG_STATE *state,
}
static int PTRCALL
-error(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
+error(PROLOG_STATE *UNUSED_P(state),
+ int UNUSED_P(tok),
+ const char *UNUSED_P(ptr),
+ const char *UNUSED_P(end),
+ const ENCODING *UNUSED_P(enc))
{
return XML_ROLE_NONE;
}
diff --git a/deps/libexpat/lib/xmltok.c b/deps/libexpat/lib/xmltok.c
index bf09dfc..a29d9e2 100644
--- a/deps/libexpat/lib/xmltok.c
+++ b/deps/libexpat/lib/xmltok.c
@@ -4,7 +4,7 @@
#include <stddef.h>
-#ifdef COMPILED_FROM_DSP
+#ifdef WIN32
#include "winconfig.h"
#elif defined(MACOS_CLASSIC)
#include "macconfig.h"
@@ -16,7 +16,7 @@
#ifdef HAVE_EXPAT_CONFIG_H
#include <expat_config.h>
#endif
-#endif /* ndef COMPILED_FROM_DSP */
+#endif /* ndef WIN32 */
#include "expat_external.h"
#include "internal.h"
@@ -46,7 +46,7 @@
#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16)
#define UCS2_GET_NAMING(pages, hi, lo) \
- (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F)))
+ (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1u << ((lo) & 0x1F)))
/* A 2 byte UTF-8 representation splits the characters 11 bits between
the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
@@ -56,7 +56,7 @@
(namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \
+ ((((byte)[0]) & 3) << 1) \
+ ((((byte)[1]) >> 5) & 1)] \
- & (1 << (((byte)[1]) & 0x1F)))
+ & (1u << (((byte)[1]) & 0x1F)))
/* A 3 byte UTF-8 representation splits the characters 16 bits between
the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
@@ -69,7 +69,7 @@
<< 3) \
+ ((((byte)[1]) & 3) << 1) \
+ ((((byte)[2]) >> 5) & 1)] \
- & (1 << (((byte)[2]) & 0x1F)))
+ & (1u << (((byte)[2]) & 0x1F)))
#define UTF8_GET_NAMING(pages, p, n) \
((n) == 2 \
@@ -122,19 +122,19 @@
((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0)))
static int PTRFASTCALL
-isNever(const ENCODING *enc, const char *p)
+isNever(const ENCODING *UNUSED_P(enc), const char *UNUSED_P(p))
{
return 0;
}
static int PTRFASTCALL
-utf8_isName2(const ENCODING *enc, const char *p)
+utf8_isName2(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_GET_NAMING2(namePages, (const unsigned char *)p);
}
static int PTRFASTCALL
-utf8_isName3(const ENCODING *enc, const char *p)
+utf8_isName3(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_GET_NAMING3(namePages, (const unsigned char *)p);
}
@@ -142,13 +142,13 @@ utf8_isName3(const ENCODING *enc, const char *p)
#define utf8_isName4 isNever
static int PTRFASTCALL
-utf8_isNmstrt2(const ENCODING *enc, const char *p)
+utf8_isNmstrt2(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p);
}
static int PTRFASTCALL
-utf8_isNmstrt3(const ENCODING *enc, const char *p)
+utf8_isNmstrt3(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p);
}
@@ -156,19 +156,19 @@ utf8_isNmstrt3(const ENCODING *enc, const char *p)
#define utf8_isNmstrt4 isNever
static int PTRFASTCALL
-utf8_isInvalid2(const ENCODING *enc, const char *p)
+utf8_isInvalid2(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_INVALID2((const unsigned char *)p);
}
static int PTRFASTCALL
-utf8_isInvalid3(const ENCODING *enc, const char *p)
+utf8_isInvalid3(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_INVALID3((const unsigned char *)p);
}
static int PTRFASTCALL
-utf8_isInvalid4(const ENCODING *enc, const char *p)
+utf8_isInvalid4(const ENCODING *UNUSED_P(enc), const char *p)
{
return UTF8_INVALID4((const unsigned char *)p);
}
@@ -222,6 +222,17 @@ struct normal_encoding {
E ## isInvalid3, \
E ## isInvalid4
+#define NULL_VTABLE \
+ /* isName2 */ NULL, \
+ /* isName3 */ NULL, \
+ /* isName4 */ NULL, \
+ /* isNmstrt2 */ NULL, \
+ /* isNmstrt3 */ NULL, \
+ /* isNmstrt4 */ NULL, \
+ /* isInvalid2 */ NULL, \
+ /* isInvalid3 */ NULL, \
+ /* isInvalid4 */ NULL
+
static int FASTCALL checkCharRefNumber(int);
#include "xmltok_impl.h"
@@ -318,39 +329,89 @@ enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */
UTF8_cval4 = 0xf0
};
-static void PTRCALL
-utf8_toUtf8(const ENCODING *enc,
+void
+align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef)
+{
+ const char * fromLim = *fromLimRef;
+ size_t walked = 0;
+ for (; fromLim > from; fromLim--, walked++) {
+ const unsigned char prev = (unsigned char)fromLim[-1];
+ if ((prev & 0xf8u) == 0xf0u) { /* 4-byte character, lead by 0b11110xxx byte */
+ if (walked + 1 >= 4) {
+ fromLim += 4 - 1;
+ break;
+ } else {
+ walked = 0;
+ }
+ } else if ((prev & 0xf0u) == 0xe0u) { /* 3-byte character, lead by 0b1110xxxx byte */
+ if (walked + 1 >= 3) {
+ fromLim += 3 - 1;
+ break;
+ } else {
+ walked = 0;
+ }
+ } else if ((prev & 0xe0u) == 0xc0u) { /* 2-byte character, lead by 0b110xxxxx byte */
+ if (walked + 1 >= 2) {
+ fromLim += 2 - 1;
+ break;
+ } else {
+ walked = 0;
+ }
+ } else if ((prev & 0x80u) == 0x00u) { /* 1-byte character, matching 0b0xxxxxxx */
+ break;
+ }
+ }
+ *fromLimRef = fromLim;
+}
+
+static enum XML_Convert_Result PTRCALL
+utf8_toUtf8(const ENCODING *UNUSED_P(enc),
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
{
+ enum XML_Convert_Result res = XML_CONVERT_COMPLETED;
char *to;
const char *from;
if (fromLim - *fromP > toLim - *toP) {
/* Avoid copying partial characters. */
- for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--)
- if (((unsigned char)fromLim[-1] & 0xc0) != 0x80)
- break;
+ res = XML_CONVERT_OUTPUT_EXHAUSTED;
+ fromLim = *fromP + (toLim - *toP);
+ align_limit_to_full_utf8_characters(*fromP, &fromLim);
}
- for (to = *toP, from = *fromP; from != fromLim; from++, to++)
+ for (to = *toP, from = *fromP; (from < fromLim) && (to < toLim); from++, to++)
*to = *from;
*fromP = from;
*toP = to;
+
+ if ((to == toLim) && (from < fromLim))
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
+ else
+ return res;
}
-static void PTRCALL
+static enum XML_Convert_Result PTRCALL
utf8_toUtf16(const ENCODING *enc,
const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim)
{
+ enum XML_Convert_Result res = XML_CONVERT_COMPLETED;
unsigned short *to = *toP;
const char *from = *fromP;
- while (from != fromLim && to != toLim) {
+ while (from < fromLim && to < toLim) {
switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) {
case BT_LEAD2:
+ if (fromLim - from < 2) {
+ res = XML_CONVERT_INPUT_INCOMPLETE;
+ break;
+ }
*to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f));
from += 2;
break;
case BT_LEAD3:
+ if (fromLim - from < 3) {
+ res = XML_CONVERT_INPUT_INCOMPLETE;
+ break;
+ }
*to++ = (unsigned short)(((from[0] & 0xf) << 12)
| ((from[1] & 0x3f) << 6) | (from[2] & 0x3f));
from += 3;
@@ -358,8 +419,14 @@ utf8_toUtf16(const ENCODING *enc,
case BT_LEAD4:
{
unsigned long n;
- if (to + 1 == toLim)
+ if (toLim - to < 2) {
+ res = XML_CONVERT_OUTPUT_EXHAUSTED;
goto after;
+ }
+ if (fromLim - from < 4) {
+ res = XML_CONVERT_INPUT_INCOMPLETE;
+ goto after;
+ }
n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12)
| ((from[2] & 0x3f) << 6) | (from[3] & 0x3f);
n -= 0x10000;
@@ -377,6 +444,7 @@ utf8_toUtf16(const ENCODING *enc,
after:
*fromP = from;
*toP = to;
+ return res;
}
#ifdef XML_NS
@@ -425,38 +493,43 @@ static const struct normal_encoding internal_utf8_encoding = {
STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
};
-static void PTRCALL
-latin1_toUtf8(const ENCODING *enc,
+static enum XML_Convert_Result PTRCALL
+latin1_toUtf8(const ENCODING *UNUSED_P(enc),
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
{
for (;;) {
unsigned char c;
if (*fromP == fromLim)
- break;
+ return XML_CONVERT_COMPLETED;
c = (unsigned char)**fromP;
if (c & 0x80) {
if (toLim - *toP < 2)
- break;
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
*(*toP)++ = (char)((c >> 6) | UTF8_cval2);
*(*toP)++ = (char)((c & 0x3f) | 0x80);
(*fromP)++;
}
else {
if (*toP == toLim)
- break;
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
*(*toP)++ = *(*fromP)++;
}
}
}
-static void PTRCALL
-latin1_toUtf16(const ENCODING *enc,
+static enum XML_Convert_Result PTRCALL
+latin1_toUtf16(const ENCODING *UNUSED_P(enc),
const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim)
{
- while (*fromP != fromLim && *toP != toLim)
+ while (*fromP < fromLim && *toP < toLim)
*(*toP)++ = (unsigned char)*(*fromP)++;
+
+ if ((*toP == toLim) && (*fromP < fromLim))
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
+ else
+ return XML_CONVERT_COMPLETED;
}
#ifdef XML_NS
@@ -467,7 +540,7 @@ static const struct normal_encoding latin1_encoding_ns = {
#include "asciitab.h"
#include "latin1tab.h"
},
- STANDARD_VTABLE(sb_)
+ STANDARD_VTABLE(sb_) NULL_VTABLE
};
#endif
@@ -480,16 +553,21 @@ static const struct normal_encoding latin1_encoding = {
#undef BT_COLON
#include "latin1tab.h"
},
- STANDARD_VTABLE(sb_)
+ STANDARD_VTABLE(sb_) NULL_VTABLE
};
-static void PTRCALL
-ascii_toUtf8(const ENCODING *enc,
+static enum XML_Convert_Result PTRCALL
+ascii_toUtf8(const ENCODING *UNUSED_P(enc),
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
{
- while (*fromP != fromLim && *toP != toLim)
+ while (*fromP < fromLim && *toP < toLim)
*(*toP)++ = *(*fromP)++;
+
+ if ((*toP == toLim) && (*fromP < fromLim))
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
+ else
+ return XML_CONVERT_COMPLETED;
}
#ifdef XML_NS
@@ -500,7 +578,7 @@ static const struct normal_encoding ascii_encoding_ns = {
#include "asciitab.h"
/* BT_NONXML == 0 */
},
- STANDARD_VTABLE(sb_)
+ STANDARD_VTABLE(sb_) NULL_VTABLE
};
#endif
@@ -513,7 +591,7 @@ static const struct normal_encoding ascii_encoding = {
#undef BT_COLON
/* BT_NONXML == 0 */
},
- STANDARD_VTABLE(sb_)
+ STANDARD_VTABLE(sb_) NULL_VTABLE
};
static int PTRFASTCALL
@@ -536,13 +614,14 @@ unicode_byte_type(char hi, char lo)
}
#define DEFINE_UTF16_TO_UTF8(E) \
-static void PTRCALL \
-E ## toUtf8(const ENCODING *enc, \
+static enum XML_Convert_Result PTRCALL \
+E ## toUtf8(const ENCODING *UNUSED_P(enc), \
const char **fromP, const char *fromLim, \
char **toP, const char *toLim) \
{ \
- const char *from; \
- for (from = *fromP; from != fromLim; from += 2) { \
+ const char *from = *fromP; \
+ fromLim = from + (((fromLim - from) >> 1) << 1); /* shrink to even */ \
+ for (; from < fromLim; from += 2) { \
int plane; \
unsigned char lo2; \
unsigned char lo = GET_LO(from); \
@@ -552,7 +631,7 @@ E ## toUtf8(const ENCODING *enc, \
if (lo < 0x80) { \
if (*toP == toLim) { \
*fromP = from; \
- return; \
+ return XML_CONVERT_OUTPUT_EXHAUSTED; \
} \
*(*toP)++ = lo; \
break; \
@@ -562,7 +641,7 @@ E ## toUtf8(const ENCODING *enc, \
case 0x4: case 0x5: case 0x6: case 0x7: \
if (toLim - *toP < 2) { \
*fromP = from; \
- return; \
+ return XML_CONVERT_OUTPUT_EXHAUSTED; \
} \
*(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \
*(*toP)++ = ((lo & 0x3f) | 0x80); \
@@ -570,7 +649,7 @@ E ## toUtf8(const ENCODING *enc, \
default: \
if (toLim - *toP < 3) { \
*fromP = from; \
- return; \
+ return XML_CONVERT_OUTPUT_EXHAUSTED; \
} \
/* 16 bits divided 4, 6, 6 amongst 3 bytes */ \
*(*toP)++ = ((hi >> 4) | UTF8_cval3); \
@@ -580,7 +659,11 @@ E ## toUtf8(const ENCODING *enc, \
case 0xD8: case 0xD9: case 0xDA: case 0xDB: \
if (toLim - *toP < 4) { \
*fromP = from; \
- return; \
+ return XML_CONVERT_OUTPUT_EXHAUSTED; \
+ } \
+ if (fromLim - from < 4) { \
+ *fromP = from; \
+ return XML_CONVERT_INPUT_INCOMPLETE; \
} \
plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \
*(*toP)++ = ((plane >> 2) | UTF8_cval4); \
@@ -596,20 +679,32 @@ E ## toUtf8(const ENCODING *enc, \
} \
} \
*fromP = from; \
+ if (from < fromLim) \
+ return XML_CONVERT_INPUT_INCOMPLETE; \
+ else \
+ return XML_CONVERT_COMPLETED; \
}
#define DEFINE_UTF16_TO_UTF16(E) \
-static void PTRCALL \
-E ## toUtf16(const ENCODING *enc, \
+static enum XML_Convert_Result PTRCALL \
+E ## toUtf16(const ENCODING *UNUSED_P(enc), \
const char **fromP, const char *fromLim, \
unsigned short **toP, const unsigned short *toLim) \
{ \
+ enum XML_Convert_Result res = XML_CONVERT_COMPLETED; \
+ fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */ \
/* Avoid copying first half only of surrogate */ \
if (fromLim - *fromP > ((toLim - *toP) << 1) \
- && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \
+ && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) { \
fromLim -= 2; \
- for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \
+ res = XML_CONVERT_INPUT_INCOMPLETE; \
+ } \
+ for (; *fromP < fromLim && *toP < toLim; *fromP += 2) \
*(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \
+ if ((*toP == toLim) && (*fromP < fromLim)) \
+ return XML_CONVERT_OUTPUT_EXHAUSTED; \
+ else \
+ return res; \
}
#define SET2(ptr, ch) \
@@ -726,7 +821,7 @@ static const struct normal_encoding little2_encoding_ns = {
#include "asciitab.h"
#include "latin1tab.h"
},
- STANDARD_VTABLE(little2_)
+ STANDARD_VTABLE(little2_) NULL_VTABLE
};
#endif
@@ -745,7 +840,7 @@ static const struct normal_encoding little2_encoding = {
#undef BT_COLON
#include "latin1tab.h"
},
- STANDARD_VTABLE(little2_)
+ STANDARD_VTABLE(little2_) NULL_VTABLE
};
#if BYTEORDER != 4321
@@ -758,7 +853,7 @@ static const struct normal_encoding internal_little2_encoding_ns = {
#include "iasciitab.h"
#include "latin1tab.h"
},
- STANDARD_VTABLE(little2_)
+ STANDARD_VTABLE(little2_) NULL_VTABLE
};
#endif
@@ -771,7 +866,7 @@ static const struct normal_encoding internal_little2_encoding = {
#undef BT_COLON
#include "latin1tab.h"
},
- STANDARD_VTABLE(little2_)
+ STANDARD_VTABLE(little2_) NULL_VTABLE
};
#endif
@@ -867,7 +962,7 @@ static const struct normal_encoding big2_encoding_ns = {
#include "asciitab.h"
#include "latin1tab.h"
},
- STANDARD_VTABLE(big2_)
+ STANDARD_VTABLE(big2_) NULL_VTABLE
};
#endif
@@ -886,7 +981,7 @@ static const struct normal_encoding big2_encoding = {
#undef BT_COLON
#include "latin1tab.h"
},
- STANDARD_VTABLE(big2_)
+ STANDARD_VTABLE(big2_) NULL_VTABLE
};
#if BYTEORDER != 1234
@@ -899,7 +994,7 @@ static const struct normal_encoding internal_big2_encoding_ns = {
#include "iasciitab.h"
#include "latin1tab.h"
},
- STANDARD_VTABLE(big2_)
+ STANDARD_VTABLE(big2_) NULL_VTABLE
};
#endif
@@ -912,7 +1007,7 @@ static const struct normal_encoding internal_big2_encoding = {
#undef BT_COLON
#include "latin1tab.h"
},
- STANDARD_VTABLE(big2_)
+ STANDARD_VTABLE(big2_) NULL_VTABLE
};
#endif
@@ -938,7 +1033,7 @@ streqci(const char *s1, const char *s2)
}
static void PTRCALL
-initUpdatePosition(const ENCODING *enc, const char *ptr,
+initUpdatePosition(const ENCODING *UNUSED_P(enc), const char *ptr,
const char *end, POSITION *pos)
{
normal_updatePosition(&utf8_encoding.enc, ptr, end, pos);
@@ -1288,7 +1383,7 @@ unknown_isInvalid(const ENCODING *enc, const char *p)
return (c & ~0xFFFF) || checkCharRefNumber(c) < 0;
}
-static void PTRCALL
+static enum XML_Convert_Result PTRCALL
unknown_toUtf8(const ENCODING *enc,
const char **fromP, const char *fromLim,
char **toP, const char *toLim)
@@ -1299,21 +1394,21 @@ unknown_toUtf8(const ENCODING *enc,
const char *utf8;
int n;
if (*fromP == fromLim)
- break;
+ return XML_CONVERT_COMPLETED;
utf8 = uenc->utf8[(unsigned char)**fromP];
n = *utf8++;
if (n == 0) {
int c = uenc->convert(uenc->userData, *fromP);
n = XmlUtf8Encode(c, buf);
if (n > toLim - *toP)
- break;
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
utf8 = buf;
*fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP]
- (BT_LEAD2 - 2));
}
else {
if (n > toLim - *toP)
- break;
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
(*fromP)++;
}
do {
@@ -1322,13 +1417,13 @@ unknown_toUtf8(const ENCODING *enc,
}
}
-static void PTRCALL
+static enum XML_Convert_Result PTRCALL
unknown_toUtf16(const ENCODING *enc,
const char **fromP, const char *fromLim,
unsigned short **toP, const unsigned short *toLim)
{
const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc);
- while (*fromP != fromLim && *toP != toLim) {
+ while (*fromP < fromLim && *toP < toLim) {
unsigned short c = uenc->utf16[(unsigned char)**fromP];
if (c == 0) {
c = (unsigned short)
@@ -1340,6 +1435,11 @@ unknown_toUtf16(const ENCODING *enc,
(*fromP)++;
*(*toP)++ = c;
}
+
+ if ((*toP == toLim) && (*fromP < fromLim))
+ return XML_CONVERT_OUTPUT_EXHAUSTED;
+ else
+ return XML_CONVERT_COMPLETED;
}
ENCODING *
@@ -1503,7 +1603,7 @@ initScan(const ENCODING * const *encodingTable,
{
const ENCODING **encPtr;
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
encPtr = enc->encPtr;
if (ptr + 1 == end) {
diff --git a/deps/libexpat/lib/xmltok.h b/deps/libexpat/lib/xmltok.h
index ca867aa..752007e 100644
--- a/deps/libexpat/lib/xmltok.h
+++ b/deps/libexpat/lib/xmltok.h
@@ -130,6 +130,12 @@ typedef int (PTRCALL *SCANNER)(const ENCODING *,
const char *,
const char **);
+enum XML_Convert_Result {
+ XML_CONVERT_COMPLETED = 0,
+ XML_CONVERT_INPUT_INCOMPLETE = 1,
+ XML_CONVERT_OUTPUT_EXHAUSTED = 2 /* and therefore potentially input remaining as well */
+};
+
struct encoding {
SCANNER scanners[XML_N_STATES];
SCANNER literalScanners[XML_N_LITERAL_TYPES];
@@ -158,12 +164,12 @@ struct encoding {
const char *ptr,
const char *end,
const char **badPtr);
- void (PTRCALL *utf8Convert)(const ENCODING *enc,
+ enum XML_Convert_Result (PTRCALL *utf8Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
char **toP,
const char *toLim);
- void (PTRCALL *utf16Convert)(const ENCODING *enc,
+ enum XML_Convert_Result (PTRCALL *utf16Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
unsigned short **toP,
diff --git a/deps/libexpat/lib/xmltok_impl.c b/deps/libexpat/lib/xmltok_impl.c
index 9c2895b..5f779c0 100644
--- a/deps/libexpat/lib/xmltok_impl.c
+++ b/deps/libexpat/lib/xmltok_impl.c
@@ -87,27 +87,45 @@
#define PREFIX(ident) ident
#endif
+
+#define HAS_CHARS(enc, ptr, end, count) \
+ (end - ptr >= count * MINBPC(enc))
+
+#define HAS_CHAR(enc, ptr, end) \
+ HAS_CHARS(enc, ptr, end, 1)
+
+#define REQUIRE_CHARS(enc, ptr, end, count) \
+ { \
+ if (! HAS_CHARS(enc, ptr, end, count)) { \
+ return XML_TOK_PARTIAL; \
+ } \
+ }
+
+#define REQUIRE_CHAR(enc, ptr, end) \
+ REQUIRE_CHARS(enc, ptr, end, 1)
+
+
/* ptr points to character following "<!-" */
static int PTRCALL
PREFIX(scanComment)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr != end) {
+ if (HAS_CHAR(enc, ptr, end)) {
if (!CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
ptr += MINBPC(enc);
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
INVALID_CASES(ptr, nextTokPtr)
case BT_MINUS:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_MINUS)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
*nextTokPtr = ptr;
return XML_TOK_INVALID;
@@ -131,8 +149,7 @@ static int PTRCALL
PREFIX(scanDecl)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
case BT_MINUS:
return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);
@@ -147,11 +164,10 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_PERCNT:
- if (ptr + MINBPC(enc) == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHARS(enc, ptr, end, 2);
/* don't allow <!ENTITY% foo "whatever"> */
switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) {
case BT_S: case BT_CR: case BT_LF: case BT_PERCNT:
@@ -175,7 +191,7 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr,
}
static int PTRCALL
-PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr,
+PREFIX(checkPiTarget)(const ENCODING *UNUSED_P(enc), const char *ptr,
const char *end, int *tokPtr)
{
int upper = 0;
@@ -225,15 +241,14 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
{
int tok;
const char *target = ptr;
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
default:
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_S: case BT_CR: case BT_LF:
@@ -242,13 +257,12 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
return XML_TOK_INVALID;
}
ptr += MINBPC(enc);
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
INVALID_CASES(ptr, nextTokPtr)
case BT_QUEST:
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
*nextTokPtr = ptr + MINBPC(enc);
return tok;
@@ -266,8 +280,7 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
return XML_TOK_INVALID;
}
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
*nextTokPtr = ptr + MINBPC(enc);
return tok;
@@ -282,15 +295,14 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr,
}
static int PTRCALL
-PREFIX(scanCdataSection)(const ENCODING *enc, const char *ptr,
+PREFIX(scanCdataSection)(const ENCODING *UNUSED_P(enc), const char *ptr,
const char *end, const char **nextTokPtr)
{
static const char CDATA_LSQB[] = { ASCII_C, ASCII_D, ASCII_A,
ASCII_T, ASCII_A, ASCII_LSQB };
int i;
/* CDATA[ */
- if (end - ptr < 6 * MINBPC(enc))
- return XML_TOK_PARTIAL;
+ REQUIRE_CHARS(enc, ptr, end, 6);
for (i = 0; i < 6; i++, ptr += MINBPC(enc)) {
if (!CHAR_MATCHES(enc, ptr, CDATA_LSQB[i])) {
*nextTokPtr = ptr;
@@ -305,7 +317,7 @@ static int PTRCALL
PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
if (MINBPC(enc) > 1) {
size_t n = end - ptr;
@@ -319,13 +331,11 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
switch (BYTE_TYPE(enc, ptr)) {
case BT_RSQB:
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))
break;
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
ptr -= MINBPC(enc);
break;
@@ -334,8 +344,7 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
return XML_TOK_CDATA_SECT_CLOSE;
case BT_CR:
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
*nextTokPtr = ptr;
@@ -348,7 +357,7 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr,
ptr += MINBPC(enc);
break;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
#define LEAD_CASE(n) \
case BT_LEAD ## n: \
@@ -383,19 +392,18 @@ static int PTRCALL
PREFIX(scanEndTag)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
default:
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_S: case BT_CR: case BT_LF:
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
+ for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_S: case BT_CR: case BT_LF:
break;
@@ -432,7 +440,7 @@ static int PTRCALL
PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr != end) {
+ if (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_DIGIT:
case BT_HEX:
@@ -441,7 +449,7 @@ PREFIX(scanHexCharRef)(const ENCODING *enc, const char *ptr,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
+ for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_DIGIT:
case BT_HEX:
@@ -464,7 +472,7 @@ static int PTRCALL
PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
- if (ptr != end) {
+ if (HAS_CHAR(enc, ptr, end)) {
if (CHAR_MATCHES(enc, ptr, ASCII_x))
return PREFIX(scanHexCharRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
switch (BYTE_TYPE(enc, ptr)) {
@@ -474,7 +482,7 @@ PREFIX(scanCharRef)(const ENCODING *enc, const char *ptr,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- for (ptr += MINBPC(enc); ptr != end; ptr += MINBPC(enc)) {
+ for (ptr += MINBPC(enc); HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_DIGIT:
break;
@@ -496,8 +504,7 @@ static int PTRCALL
PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
case BT_NUM:
@@ -506,7 +513,7 @@ PREFIX(scanRef)(const ENCODING *enc, const char *ptr, const char *end,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_SEMI:
@@ -529,7 +536,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
#ifdef XML_NS
int hadColon = 0;
#endif
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
#ifdef XML_NS
@@ -540,8 +547,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
}
hadColon = 1;
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
default:
@@ -555,8 +561,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
int t;
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
t = BYTE_TYPE(enc, ptr);
if (t == BT_EQUALS)
break;
@@ -579,8 +584,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
#endif
for (;;) {
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
open = BYTE_TYPE(enc, ptr);
if (open == BT_QUOT || open == BT_APOS)
break;
@@ -598,8 +602,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
/* in attribute value */
for (;;) {
int t;
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
t = BYTE_TYPE(enc, ptr);
if (t == open)
break;
@@ -624,8 +627,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
}
}
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
case BT_S:
case BT_CR:
@@ -642,8 +644,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
/* ptr points to closing quote */
for (;;) {
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
case BT_S: case BT_CR: case BT_LF:
@@ -655,8 +656,7 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
case BT_SOL:
sol:
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
*nextTokPtr = ptr;
return XML_TOK_INVALID;
@@ -688,13 +688,12 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
#ifdef XML_NS
int hadColon;
#endif
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
case BT_EXCL:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
case BT_MINUS:
return PREFIX(scanComment)(enc, ptr + MINBPC(enc), end, nextTokPtr);
@@ -716,7 +715,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
hadColon = 0;
#endif
/* we have a start-tag */
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
#ifdef XML_NS
@@ -727,8 +726,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
}
hadColon = 1;
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
default:
@@ -740,7 +738,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
case BT_S: case BT_CR: case BT_LF:
{
ptr += MINBPC(enc);
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
case BT_GT:
@@ -765,8 +763,7 @@ PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
case BT_SOL:
sol:
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
*nextTokPtr = ptr;
return XML_TOK_INVALID;
@@ -785,7 +782,7 @@ static int PTRCALL
PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
if (MINBPC(enc) > 1) {
size_t n = end - ptr;
@@ -803,7 +800,7 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr);
case BT_CR:
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return XML_TOK_TRAILING_CR;
if (BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
@@ -814,12 +811,12 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
return XML_TOK_DATA_NEWLINE;
case BT_RSQB:
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return XML_TOK_TRAILING_RSQB;
if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB))
break;
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return XML_TOK_TRAILING_RSQB;
if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) {
ptr -= MINBPC(enc);
@@ -832,7 +829,7 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
ptr += MINBPC(enc);
break;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
#define LEAD_CASE(n) \
case BT_LEAD ## n: \
@@ -845,12 +842,12 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
#undef LEAD_CASE
case BT_RSQB:
- if (ptr + MINBPC(enc) != end) {
+ if (HAS_CHARS(enc, ptr, end, 2)) {
if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) {
ptr += MINBPC(enc);
break;
}
- if (ptr + 2*MINBPC(enc) != end) {
+ if (HAS_CHARS(enc, ptr, end, 3)) {
if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) {
ptr += MINBPC(enc);
break;
@@ -884,8 +881,7 @@ static int PTRCALL
PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
case BT_S: case BT_LF: case BT_CR: case BT_PERCNT:
@@ -895,7 +891,7 @@ PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_SEMI:
@@ -913,15 +909,14 @@ static int PTRCALL
PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr)
default:
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_CR: case BT_LF: case BT_S:
@@ -941,7 +936,7 @@ PREFIX(scanLit)(int open, const ENCODING *enc,
const char *ptr, const char *end,
const char **nextTokPtr)
{
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
int t = BYTE_TYPE(enc, ptr);
switch (t) {
INVALID_CASES(ptr, nextTokPtr)
@@ -950,7 +945,7 @@ PREFIX(scanLit)(int open, const ENCODING *enc,
ptr += MINBPC(enc);
if (t != open)
break;
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return -XML_TOK_LITERAL;
*nextTokPtr = ptr;
switch (BYTE_TYPE(enc, ptr)) {
@@ -973,7 +968,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
int tok;
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
if (MINBPC(enc) > 1) {
size_t n = end - ptr;
@@ -992,8 +987,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
case BT_LT:
{
ptr += MINBPC(enc);
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
switch (BYTE_TYPE(enc, ptr)) {
case BT_EXCL:
return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr);
@@ -1021,7 +1015,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
case BT_S: case BT_LF:
for (;;) {
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
break;
switch (BYTE_TYPE(enc, ptr)) {
case BT_S: case BT_LF:
@@ -1048,11 +1042,10 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
return XML_TOK_OPEN_BRACKET;
case BT_RSQB:
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return -XML_TOK_CLOSE_BRACKET;
if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {
- if (ptr + MINBPC(enc) == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHARS(enc, ptr, end, 2);
if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) {
*nextTokPtr = ptr + 2*MINBPC(enc);
return XML_TOK_COND_SECT_CLOSE;
@@ -1065,7 +1058,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
return XML_TOK_OPEN_PAREN;
case BT_RPAR:
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return -XML_TOK_CLOSE_PAREN;
switch (BYTE_TYPE(enc, ptr)) {
case BT_AST:
@@ -1141,7 +1134,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
case BT_GT: case BT_RPAR: case BT_COMMA:
@@ -1154,8 +1147,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
ptr += MINBPC(enc);
switch (tok) {
case XML_TOK_NAME:
- if (ptr == end)
- return XML_TOK_PARTIAL;
+ REQUIRE_CHAR(enc, ptr, end);
tok = XML_TOK_PREFIXED_NAME;
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
@@ -1204,10 +1196,12 @@ PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
const char *start;
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
+ else if (! HAS_CHAR(enc, ptr, end))
+ return XML_TOK_PARTIAL;
start = ptr;
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
#define LEAD_CASE(n) \
case BT_LEAD ## n: ptr += n; break;
@@ -1232,7 +1226,7 @@ PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr,
case BT_CR:
if (ptr == start) {
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return XML_TOK_TRAILING_CR;
if (BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
@@ -1262,10 +1256,12 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr,
const char *end, const char **nextTokPtr)
{
const char *start;
- if (ptr == end)
+ if (ptr >= end)
return XML_TOK_NONE;
+ else if (! HAS_CHAR(enc, ptr, end))
+ return XML_TOK_PARTIAL;
start = ptr;
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
#define LEAD_CASE(n) \
case BT_LEAD ## n: ptr += n; break;
@@ -1294,7 +1290,7 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr,
case BT_CR:
if (ptr == start) {
ptr += MINBPC(enc);
- if (ptr == end)
+ if (! HAS_CHAR(enc, ptr, end))
return XML_TOK_TRAILING_CR;
if (BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
@@ -1326,15 +1322,15 @@ PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr,
end = ptr + n;
}
}
- while (ptr != end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
INVALID_CASES(ptr, nextTokPtr)
case BT_LT:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) {
++level;
ptr += MINBPC(enc);
@@ -1342,11 +1338,11 @@ PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr,
}
break;
case BT_RSQB:
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) {
- if ((ptr += MINBPC(enc)) == end)
- return XML_TOK_PARTIAL;
+ ptr += MINBPC(enc);
+ REQUIRE_CHAR(enc, ptr, end);
if (CHAR_MATCHES(enc, ptr, ASCII_GT)) {
ptr += MINBPC(enc);
if (level == 0) {
@@ -1373,7 +1369,7 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
{
ptr += MINBPC(enc);
end -= MINBPC(enc);
- for (; ptr != end; ptr += MINBPC(enc)) {
+ for (; HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) {
switch (BYTE_TYPE(enc, ptr)) {
case BT_DIGIT:
case BT_HEX:
@@ -1521,7 +1517,7 @@ PREFIX(getAtts)(const ENCODING *enc, const char *ptr,
}
static int PTRFASTCALL
-PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
+PREFIX(charRefNumber)(const ENCODING *UNUSED_P(enc), const char *ptr)
{
int result = 0;
/* skip &# */
@@ -1565,7 +1561,7 @@ PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr)
}
static int PTRCALL
-PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr,
+PREFIX(predefinedEntityName)(const ENCODING *UNUSED_P(enc), const char *ptr,
const char *end)
{
switch ((end - ptr)/MINBPC(enc)) {
@@ -1683,11 +1679,11 @@ PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2)
}
static int PTRCALL
-PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1,
+PREFIX(nameMatchesAscii)(const ENCODING *UNUSED_P(enc), const char *ptr1,
const char *end1, const char *ptr2)
{
for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) {
- if (ptr1 == end1)
+ if (end1 - ptr1 < MINBPC(enc))
return 0;
if (!CHAR_MATCHES(enc, ptr1, *ptr2))
return 0;
@@ -1744,7 +1740,7 @@ PREFIX(updatePosition)(const ENCODING *enc,
const char *end,
POSITION *pos)
{
- while (ptr < end) {
+ while (HAS_CHAR(enc, ptr, end)) {
switch (BYTE_TYPE(enc, ptr)) {
#define LEAD_CASE(n) \
case BT_LEAD ## n: \
@@ -1760,7 +1756,7 @@ PREFIX(updatePosition)(const ENCODING *enc,
case BT_CR:
pos->lineNumber++;
ptr += MINBPC(enc);
- if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF)
+ if (HAS_CHAR(enc, ptr, end) && BYTE_TYPE(enc, ptr) == BT_LF)
ptr += MINBPC(enc);
pos->columnNumber = (XML_Size)-1;
break;
diff --git a/deps/libexpat/tests/benchmark/README.txt b/deps/libexpat/tests/benchmark/README.txt
index 7f9cca0..86414d5 100644
--- a/deps/libexpat/tests/benchmark/README.txt
+++ b/deps/libexpat/tests/benchmark/README.txt
@@ -13,4 +13,4 @@ The command line arguments are:
Returns:
The time (in seconds) it takes to parse the test file,
- averaged over the number of iterations.
\ No newline at end of file
+ averaged over the number of iterations.@
diff --git a/deps/libexpat/tests/chardata.c b/deps/libexpat/tests/chardata.c
index 5fb0299..012499b 100644
--- a/deps/libexpat/tests/chardata.c
+++ b/deps/libexpat/tests/chardata.c
@@ -7,11 +7,7 @@
#ifdef HAVE_EXPAT_CONFIG_H
#include <expat_config.h>
#endif
-#ifdef HAVE_CHECK_H
-#include <check.h>
-#else
#include "minicheck.h"
-#endif
#include <assert.h>
#include <stdio.h>
@@ -51,7 +47,7 @@ CharData_AppendString(CharData *storage, const char *s)
if ((len + storage->count) > maxchars) {
len = (maxchars - storage->count);
}
- if (len + storage->count < sizeof(storage->data)) {
+ if (len + storage->count < (int)sizeof(storage->data)) {
memcpy(storage->data + storage->count, s, len);
storage->count += len;
}
@@ -72,7 +68,7 @@ CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len)
if ((len + storage->count) > maxchars) {
len = (maxchars - storage->count);
}
- if (len + storage->count < sizeof(storage->data)) {
+ if (len + storage->count < (int)sizeof(storage->data)) {
memcpy(storage->data + storage->count, s,
len * sizeof(storage->data[0]));
storage->count += len;
diff --git a/deps/libexpat/tests/minicheck.c b/deps/libexpat/tests/minicheck.c
index d2f4295..5a1f5ed 100644
--- a/deps/libexpat/tests/minicheck.c
+++ b/deps/libexpat/tests/minicheck.c
@@ -10,10 +10,11 @@
#include <setjmp.h>
#include <assert.h>
+#include "internal.h" /* for UNUSED_P only */
#include "minicheck.h"
Suite *
-suite_create(char *name)
+suite_create(const char *name)
{
Suite *suite = (Suite *) calloc(1, sizeof(Suite));
if (suite != NULL) {
@@ -23,7 +24,7 @@ suite_create(char *name)
}
TCase *
-tcase_create(char *name)
+tcase_create(const char *name)
{
TCase *tc = (TCase *) calloc(1, sizeof(TCase));
if (tc != NULL) {
@@ -156,7 +157,7 @@ srunner_run_all(SRunner *runner, int verbosity)
}
void
-_fail_unless(int condition, const char *file, int line, char *msg)
+_fail_unless(int UNUSED_P(condition), const char *UNUSED_P(file), int UNUSED_P(line), const char *msg)
{
/* 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
diff --git a/deps/libexpat/tests/minicheck.h b/deps/libexpat/tests/minicheck.h
index c917c02..9b06f51 100644
--- a/deps/libexpat/tests/minicheck.h
+++ b/deps/libexpat/tests/minicheck.h
@@ -26,6 +26,11 @@ extern "C" {
#define __func__ __FUNCTION__
#endif
+/* ISO C90 does not support '__func__' predefined identifier */
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ < 199901)
+# define __func__ "(unknown)"
+#endif
+
#define START_TEST(testname) static void testname(void) { \
_check_set_test_info(__func__, __FILE__, __LINE__); \
{
@@ -48,12 +53,12 @@ struct SRunner {
};
struct Suite {
- char *name;
+ const char *name;
TCase *tests;
};
struct TCase {
- char *name;
+ const char *name;
tcase_setup_function setup;
tcase_teardown_function teardown;
tcase_test_function *tests;
@@ -72,9 +77,9 @@ void _check_set_test_info(char const *function,
* Prototypes for the actual implementation.
*/
-void _fail_unless(int condition, const char *file, int line, char *msg);
-Suite *suite_create(char *name);
-TCase *tcase_create(char *name);
+void _fail_unless(int condition, const char *file, int line, const char *msg);
+Suite *suite_create(const char *name);
+TCase *tcase_create(const char *name);
void suite_add_tcase(Suite *suite, TCase *tc);
void tcase_add_checked_fixture(TCase *,
tcase_setup_function,
diff --git a/deps/libexpat/tests/runtests.c b/deps/libexpat/tests/runtests.c
index 614d6b2..c0cdea9 100644
--- a/deps/libexpat/tests/runtests.c
+++ b/deps/libexpat/tests/runtests.c
@@ -13,9 +13,14 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
+#include <stddef.h> /* ptrdiff_t */
+#ifndef __cplusplus
+# include <stdbool.h>
+#endif
#include "expat.h"
#include "chardata.h"
+#include "internal.h" /* for UNUSED_P only */
#include "minicheck.h"
#if defined(__amigaos__) && defined(__USE_INLINE__)
@@ -66,13 +71,34 @@ _xml_failure(XML_Parser parser, const char *file, int line)
_fail_unless(0, file, line, buffer);
}
+static enum XML_Status
+_XML_Parse_SINGLE_BYTES(XML_Parser parser, const char *s, int len, int isFinal)
+{
+ enum XML_Status res = XML_STATUS_ERROR;
+ int offset = 0;
+
+ if (len == 0) {
+ return XML_Parse(parser, s, len, isFinal);
+ }
+
+ for (; offset < len; offset++) {
+ const int innerIsFinal = (offset == len - 1) && isFinal;
+ const char c = s[offset]; /* to help out-of-bounds detection */
+ res = XML_Parse(parser, &c, sizeof(char), innerIsFinal);
+ if (res != XML_STATUS_OK) {
+ return res;
+ }
+ }
+ return res;
+}
+
#define xml_failure(parser) _xml_failure((parser), __FILE__, __LINE__)
static void
-_expect_failure(char *text, enum XML_Error errorCode, char *errorMessage,
- char *file, int lineno)
+_expect_failure(const char *text, enum XML_Error errorCode, const char *errorMessage,
+ const char *file, int lineno)
{
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK)
/* Hackish use of _fail_unless() macro, but let's us report
the right filename and line number. */
_fail_unless(0, file, lineno, errorMessage);
@@ -89,63 +115,63 @@ _expect_failure(char *text, enum XML_Error errorCode, char *errorMessage,
*/
static void XMLCALL
-dummy_start_doctype_handler(void *userData,
- const XML_Char *doctypeName,
- const XML_Char *sysid,
- const XML_Char *pubid,
- int has_internal_subset)
+dummy_start_doctype_handler(void *UNUSED_P(userData),
+ const XML_Char *UNUSED_P(doctypeName),
+ const XML_Char *UNUSED_P(sysid),
+ const XML_Char *UNUSED_P(pubid),
+ int UNUSED_P(has_internal_subset))
{}
static void XMLCALL
-dummy_end_doctype_handler(void *userData)
+dummy_end_doctype_handler(void *UNUSED_P(userData))
{}
static void XMLCALL
-dummy_entity_decl_handler(void *userData,
- const XML_Char *entityName,
- int is_parameter_entity,
- const XML_Char *value,
- int value_length,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName)
+dummy_entity_decl_handler(void *UNUSED_P(userData),
+ const XML_Char *UNUSED_P(entityName),
+ int UNUSED_P(is_parameter_entity),
+ const XML_Char *UNUSED_P(value),
+ int UNUSED_P(value_length),
+ const XML_Char *UNUSED_P(base),
+ const XML_Char *UNUSED_P(systemId),
+ const XML_Char *UNUSED_P(publicId),
+ const XML_Char *UNUSED_P(notationName))
{}
static void XMLCALL
-dummy_notation_decl_handler(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
+dummy_notation_decl_handler(void *UNUSED_P(userData),
+ const XML_Char *UNUSED_P(notationName),
+ const XML_Char *UNUSED_P(base),
+ const XML_Char *UNUSED_P(systemId),
+ const XML_Char *UNUSED_P(publicId))
{}
static void XMLCALL
-dummy_element_decl_handler(void *userData,
- const XML_Char *name,
- XML_Content *model)
+dummy_element_decl_handler(void *UNUSED_P(userData),
+ const XML_Char *UNUSED_P(name),
+ XML_Content *UNUSED_P(model))
{}
static void XMLCALL
-dummy_attlist_decl_handler(void *userData,
- const XML_Char *elname,
- const XML_Char *attname,
- const XML_Char *att_type,
- const XML_Char *dflt,
- int isrequired)
+dummy_attlist_decl_handler(void *UNUSED_P(userData),
+ const XML_Char *UNUSED_P(elname),
+ const XML_Char *UNUSED_P(attname),
+ const XML_Char *UNUSED_P(att_type),
+ const XML_Char *UNUSED_P(dflt),
+ int UNUSED_P(isrequired))
{}
static void XMLCALL
-dummy_comment_handler(void *userData, const XML_Char *data)
+dummy_comment_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(data))
{}
static void XMLCALL
-dummy_pi_handler(void *userData, const XML_Char *target, const XML_Char *data)
+dummy_pi_handler(void *UNUSED_P(userData), const XML_Char *UNUSED_P(target), const XML_Char *UNUSED_P(data))
{}
static void XMLCALL
-dummy_start_element(void *userData,
- const XML_Char *name, const XML_Char **atts)
+dummy_start_element(void *UNUSED_P(userData),
+ const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts))
{}
@@ -158,7 +184,7 @@ START_TEST(test_nul_byte)
char text[] = "<doc>\0</doc>";
/* test that a NUL byte (in US-ASCII data) is an error */
- if (XML_Parse(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_OK)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_OK)
fail("Parser did not report error on NUL-byte.");
if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN)
xml_failure(parser);
@@ -178,9 +204,9 @@ END_TEST
START_TEST(test_bom_utf8)
{
/* This test is really just making sure we don't core on a UTF-8 BOM. */
- char *text = "\357\273\277<e/>";
+ const char *text = "\357\273\277<e/>";
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -189,7 +215,7 @@ START_TEST(test_bom_utf16_be)
{
char text[] = "\376\377\0<\0e\0/\0>";
- if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -198,7 +224,7 @@ START_TEST(test_bom_utf16_le)
{
char text[] = "\377\376<\0e\0/\0>\0";
- if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -210,7 +236,7 @@ accumulate_characters(void *userData, const XML_Char *s, int len)
}
static void XMLCALL
-accumulate_attribute(void *userData, const XML_Char *name,
+accumulate_attribute(void *userData, const XML_Char *UNUSED_P(name),
const XML_Char **atts)
{
CharData *storage = (CharData *)userData;
@@ -222,7 +248,7 @@ accumulate_attribute(void *userData, const XML_Char *name,
static void
-_run_character_check(XML_Char *text, XML_Char *expected,
+_run_character_check(const XML_Char *text, const XML_Char *expected,
const char *file, int line)
{
CharData storage;
@@ -230,7 +256,7 @@ _run_character_check(XML_Char *text, XML_Char *expected,
CharData_Init(&storage);
XML_SetUserData(parser, &storage);
XML_SetCharacterDataHandler(parser, accumulate_characters);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
_xml_failure(parser, file, line);
CharData_CheckXMLChars(&storage, expected);
}
@@ -239,7 +265,7 @@ _run_character_check(XML_Char *text, XML_Char *expected,
_run_character_check(text, expected, __FILE__, __LINE__)
static void
-_run_attribute_check(XML_Char *text, XML_Char *expected,
+_run_attribute_check(const XML_Char *text, const XML_Char *expected,
const char *file, int line)
{
CharData storage;
@@ -247,7 +273,7 @@ _run_attribute_check(XML_Char *text, XML_Char *expected,
CharData_Init(&storage);
XML_SetUserData(parser, &storage);
XML_SetStartElementHandler(parser, accumulate_attribute);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
_xml_failure(parser, file, line);
CharData_CheckXMLChars(&storage, expected);
}
@@ -258,7 +284,7 @@ _run_attribute_check(XML_Char *text, XML_Char *expected,
/* Regression test for SF bug #491986. */
START_TEST(test_danish_latin1)
{
- char *text =
+ const char *text =
"<?xml version='1.0' encoding='iso-8859-1'?>\n"
"<e>J\xF8rgen \xE6\xF8\xE5\xC6\xD8\xC5</e>";
run_character_check(text,
@@ -270,7 +296,7 @@ END_TEST
/* Regression test for SF bug #514281. */
START_TEST(test_french_charref_hexidecimal)
{
- char *text =
+ const char *text =
"<?xml version='1.0' encoding='iso-8859-1'?>\n"
"<doc>éèàçêÈ</doc>";
run_character_check(text,
@@ -280,7 +306,7 @@ END_TEST
START_TEST(test_french_charref_decimal)
{
- char *text =
+ const char *text =
"<?xml version='1.0' encoding='iso-8859-1'?>\n"
"<doc>éèàçêÈ</doc>";
run_character_check(text,
@@ -290,7 +316,7 @@ END_TEST
START_TEST(test_french_latin1)
{
- char *text =
+ const char *text =
"<?xml version='1.0' encoding='iso-8859-1'?>\n"
"<doc>\xE9\xE8\xE0\xE7\xEa\xC8</doc>";
run_character_check(text,
@@ -300,7 +326,7 @@ END_TEST
START_TEST(test_french_utf8)
{
- char *text =
+ const char *text =
"<?xml version='1.0' encoding='utf-8'?>\n"
"<doc>\xC3\xA9</doc>";
run_character_check(text, "\xC3\xA9");
@@ -314,7 +340,7 @@ END_TEST
*/
START_TEST(test_utf8_false_rejection)
{
- char *text = "<doc>\xEF\xBA\xBF</doc>";
+ const char *text = "<doc>\xEF\xBA\xBF</doc>";
run_character_check(text, "\xEF\xBA\xBF");
}
END_TEST
@@ -331,7 +357,7 @@ START_TEST(test_illegal_utf8)
for (i = 128; i <= 255; ++i) {
sprintf(text, "<e>%ccd</e>", i);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) {
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) {
sprintf(text,
"expected token error for '%c' (ordinal %d) in UTF-8 text",
i, i);
@@ -345,6 +371,68 @@ START_TEST(test_illegal_utf8)
}
END_TEST
+
+/* Examples, not masks: */
+#define UTF8_LEAD_1 "\x7f" /* 0b01111111 */
+#define UTF8_LEAD_2 "\xdf" /* 0b11011111 */
+#define UTF8_LEAD_3 "\xef" /* 0b11101111 */
+#define UTF8_LEAD_4 "\xf7" /* 0b11110111 */
+#define UTF8_FOLLOW "\xbf" /* 0b10111111 */
+
+START_TEST(test_utf8_auto_align)
+{
+ struct TestCase {
+ ptrdiff_t expectedMovementInChars;
+ const char * input;
+ };
+
+ struct TestCase cases[] = {
+ {00, ""},
+
+ {00, UTF8_LEAD_1},
+
+ {-1, UTF8_LEAD_2},
+ {00, UTF8_LEAD_2 UTF8_FOLLOW},
+
+ {-1, UTF8_LEAD_3},
+ {-2, UTF8_LEAD_3 UTF8_FOLLOW},
+ {00, UTF8_LEAD_3 UTF8_FOLLOW UTF8_FOLLOW},
+
+ {-1, UTF8_LEAD_4},
+ {-2, UTF8_LEAD_4 UTF8_FOLLOW},
+ {-3, UTF8_LEAD_4 UTF8_FOLLOW UTF8_FOLLOW},
+ {00, UTF8_LEAD_4 UTF8_FOLLOW UTF8_FOLLOW UTF8_FOLLOW},
+ };
+
+ size_t i = 0;
+ bool success = true;
+ for (; i < sizeof(cases) / sizeof(*cases); i++) {
+ const char * fromLim = cases[i].input + strlen(cases[i].input);
+ const char * const fromLimInitially = fromLim;
+ ptrdiff_t actualMovementInChars;
+
+ align_limit_to_full_utf8_characters(cases[i].input, &fromLim);
+
+ actualMovementInChars = (fromLim - fromLimInitially);
+ if (actualMovementInChars != cases[i].expectedMovementInChars) {
+ size_t j = 0;
+ success = false;
+ printf("[-] UTF-8 case %2lu: Expected movement by %2ld chars"
+ ", actually moved by %2ld chars: \"",
+ i + 1, cases[i].expectedMovementInChars, actualMovementInChars);
+ for (; j < strlen(cases[i].input); j++) {
+ printf("\\x%02x", (unsigned char)cases[i].input[j]);
+ }
+ printf("\"\n");
+ }
+ }
+
+ if (! success) {
+ fail("UTF-8 auto-alignment is not bullet-proof\n");
+ }
+}
+END_TEST
+
START_TEST(test_utf16)
{
/* <?xml version="1.0" encoding="UTF-16"?>
@@ -358,7 +446,7 @@ START_TEST(test_utf16)
"\000<\000d\000o\000c\000 \000a\000=\000'\0001\0002\0003\000'"
"\000>\000s\000o\000m\000e\000 \000t\000e\000x\000t\000<\000/"
"\000d\000o\000c\000>";
- if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -373,12 +461,12 @@ START_TEST(test_utf16_le_epilog_newline)
if (first_chunk_bytes >= sizeof(text) - 1)
fail("bad value of first_chunk_bytes");
- if ( XML_Parse(parser, text, first_chunk_bytes, XML_FALSE)
+ if ( _XML_Parse_SINGLE_BYTES(parser, text, first_chunk_bytes, XML_FALSE)
== XML_STATUS_ERROR)
xml_failure(parser);
else {
enum XML_Status rc;
- rc = XML_Parse(parser, text + first_chunk_bytes,
+ rc = _XML_Parse_SINGLE_BYTES(parser, text + first_chunk_bytes,
sizeof(text) - first_chunk_bytes - 1, XML_TRUE);
if (rc == XML_STATUS_ERROR)
xml_failure(parser);
@@ -389,11 +477,11 @@ END_TEST
/* Regression test for SF bug #481609, #774028. */
START_TEST(test_latin1_umlauts)
{
- char *text =
+ const char *text =
"<?xml version='1.0' encoding='iso-8859-1'?>\n"
"<e a='\xE4 \xF6 \xFC ä ö ü ä ö ü >'\n"
" >\xE4 \xF6 \xFC ä ö ü ä ö ü ></e>";
- char *utf8 =
+ const char *utf8 =
"\xC3\xA4 \xC3\xB6 \xC3\xBC "
"\xC3\xA4 \xC3\xB6 \xC3\xBC "
"\xC3\xA4 \xC3\xB6 \xC3\xBC >";
@@ -406,13 +494,13 @@ END_TEST
/* Regression test #1 for SF bug #653180. */
START_TEST(test_line_number_after_parse)
{
- char *text =
+ const char *text =
"<tag>\n"
"\n"
"\n</tag>";
XML_Size lineno;
- if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR)
xml_failure(parser);
lineno = XML_GetCurrentLineNumber(parser);
if (lineno != 4) {
@@ -427,10 +515,10 @@ END_TEST
/* Regression test #2 for SF bug #653180. */
START_TEST(test_column_number_after_parse)
{
- char *text = "<tag></tag>";
+ const char *text = "<tag></tag>";
XML_Size colno;
- if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR)
xml_failure(parser);
colno = XML_GetCurrentColumnNumber(parser);
if (colno != 11) {
@@ -444,7 +532,7 @@ END_TEST
static void XMLCALL
start_element_event_handler2(void *userData, const XML_Char *name,
- const XML_Char **attr)
+ const XML_Char **UNUSED_P(attr))
{
CharData *storage = (CharData *) userData;
char buffer[100];
@@ -474,7 +562,7 @@ end_element_event_handler2(void *userData, const XML_Char *name)
/* Regression test #3 for SF bug #653180. */
START_TEST(test_line_and_column_numbers_inside_handlers)
{
- char *text =
+ const char *text =
"<a>\n" /* Unix end-of-line */
" <b>\r\n" /* Windows end-of-line */
" <c/>\r" /* Mac OS end-of-line */
@@ -483,7 +571,7 @@ START_TEST(test_line_and_column_numbers_inside_handlers)
" <f/>\n"
" </d>\n"
"</a>";
- char *expected =
+ const char *expected =
"<a> at col:0 line:1\n"
"<b> at col:2 line:2\n"
"<c> at col:4 line:3\n"
@@ -500,7 +588,7 @@ START_TEST(test_line_and_column_numbers_inside_handlers)
XML_SetUserData(parser, &storage);
XML_SetStartElementHandler(parser, start_element_event_handler2);
XML_SetEndElementHandler(parser, end_element_event_handler2);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
CharData_CheckString(&storage, expected);
@@ -510,12 +598,12 @@ END_TEST
/* Regression test #4 for SF bug #653180. */
START_TEST(test_line_number_after_error)
{
- char *text =
+ const char *text =
"<a>\n"
" <b>\n"
" </a>"; /* missing </b> */
XML_Size lineno;
- if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR)
fail("Expected a parse error");
lineno = XML_GetCurrentLineNumber(parser);
@@ -530,12 +618,12 @@ END_TEST
/* Regression test #5 for SF bug #653180. */
START_TEST(test_column_number_after_error)
{
- char *text =
+ const char *text =
"<a>\n"
" <b>\n"
" </a>"; /* missing </b> */
XML_Size colno;
- if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR)
fail("Expected a parse error");
colno = XML_GetCurrentColumnNumber(parser);
@@ -556,7 +644,7 @@ START_TEST(test_really_long_lines)
really cheesy approach to building the input buffer, because
this avoids writing bugs in buffer-filling code.
*/
- char *text =
+ const char *text =
"<e>"
/* 64 chars */
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
@@ -578,7 +666,7 @@ START_TEST(test_really_long_lines)
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+"
"</e>";
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -598,14 +686,14 @@ end_element_event_handler(void *userData, const XML_Char *name)
START_TEST(test_end_element_events)
{
- char *text = "<a><b><c/></b><d><f/></d></a>";
- char *expected = "/c/b/f/d/a";
+ const char *text = "<a><b><c/></b><d><f/></d></a>";
+ const char *expected = "/c/b/f/d/a";
CharData storage;
CharData_Init(&storage);
XML_SetUserData(parser, &storage);
XML_SetEndElementHandler(parser, end_element_event_handler);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
CharData_CheckString(&storage, expected);
}
@@ -679,8 +767,8 @@ testhelper_is_whitespace_normalized(void)
}
static void XMLCALL
-check_attr_contains_normalized_whitespace(void *userData,
- const XML_Char *name,
+check_attr_contains_normalized_whitespace(void *UNUSED_P(userData),
+ const XML_Char *UNUSED_P(name),
const XML_Char **atts)
{
int i;
@@ -702,7 +790,7 @@ check_attr_contains_normalized_whitespace(void *userData,
START_TEST(test_attr_whitespace_normalization)
{
- char *text =
+ const char *text =
"<!DOCTYPE doc [\n"
" <!ATTLIST doc\n"
" attr NMTOKENS #REQUIRED\n"
@@ -718,7 +806,7 @@ START_TEST(test_attr_whitespace_normalization)
XML_SetStartElementHandler(parser,
check_attr_contains_normalized_whitespace);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -740,7 +828,7 @@ END_TEST
/* Regression test for SF bug #584832. */
static int XMLCALL
-UnknownEncodingHandler(void *data,const XML_Char *encoding,XML_Encoding *info)
+UnknownEncodingHandler(void *UNUSED_P(data),const XML_Char *encoding,XML_Encoding *info)
{
if (strcmp(encoding,"unsupported-encoding") == 0) {
int i;
@@ -756,13 +844,13 @@ UnknownEncodingHandler(void *data,const XML_Char *encoding,XML_Encoding *info)
START_TEST(test_unknown_encoding_internal_entity)
{
- char *text =
+ const char *text =
"<?xml version='1.0' encoding='unsupported-encoding'?>\n"
"<!DOCTYPE test [<!ENTITY foo 'bar'>]>\n"
"<test a='&foo;'/>";
XML_SetUnknownEncodingHandler(parser, UnknownEncodingHandler, NULL);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -771,14 +859,14 @@ END_TEST
static int XMLCALL
external_entity_loader_set_encoding(XML_Parser parser,
const XML_Char *context,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
+ const XML_Char *UNUSED_P(base),
+ const XML_Char *UNUSED_P(systemId),
+ const XML_Char *UNUSED_P(publicId))
{
/* This text says it's an unsupported encoding, but it's really
UTF-8, which we tell Expat using XML_SetEncoding().
*/
- char *text =
+ const char *text =
"<?xml encoding='iso-8859-3'?>"
"\xC3\xA9";
XML_Parser extparser;
@@ -788,7 +876,7 @@ external_entity_loader_set_encoding(XML_Parser parser,
fail("Could not create external entity parser.");
if (!XML_SetEncoding(extparser, "utf-8"))
fail("XML_SetEncoding() ignored for external entity");
- if ( XML_Parse(extparser, text, strlen(text), XML_TRUE)
+ if ( _XML_Parse_SINGLE_BYTES(extparser, text, strlen(text), XML_TRUE)
== XML_STATUS_ERROR) {
xml_failure(parser);
return 0;
@@ -798,7 +886,7 @@ external_entity_loader_set_encoding(XML_Parser parser,
START_TEST(test_ext_entity_set_encoding)
{
- char *text =
+ const char *text =
"<!DOCTYPE doc [\n"
" <!ENTITY en SYSTEM 'http://xml.libexpat.org/dummy.ent'>\n"
"]>\n"
@@ -814,11 +902,11 @@ END_TEST
read an external subset. This was fixed in Expat 1.95.5.
*/
START_TEST(test_wfc_undeclared_entity_unread_external_subset) {
- char *text =
+ const char *text =
"<!DOCTYPE doc SYSTEM 'foo'>\n"
"<doc>&entity;</doc>";
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -837,7 +925,7 @@ END_TEST
read an external subset, but have been declared standalone.
*/
START_TEST(test_wfc_undeclared_entity_standalone) {
- char *text =
+ const char *text =
"<?xml version='1.0' encoding='us-ascii' standalone='yes'?>\n"
"<!DOCTYPE doc SYSTEM 'foo'>\n"
"<doc>&entity;</doc>";
@@ -851,9 +939,9 @@ END_TEST
static int XMLCALL
external_entity_loader(XML_Parser parser,
const XML_Char *context,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
+ const XML_Char *UNUSED_P(base),
+ const XML_Char *UNUSED_P(systemId),
+ const XML_Char *UNUSED_P(publicId))
{
char *text = (char *)XML_GetUserData(parser);
XML_Parser extparser;
@@ -861,7 +949,7 @@ external_entity_loader(XML_Parser parser,
extparser = XML_ExternalEntityParserCreate(parser, context, NULL);
if (extparser == NULL)
fail("Could not create external entity parser.");
- if ( XML_Parse(extparser, text, strlen(text), XML_TRUE)
+ if ( _XML_Parse_SINGLE_BYTES(extparser, text, strlen(text), XML_TRUE)
== XML_STATUS_ERROR) {
xml_failure(parser);
return XML_STATUS_ERROR;
@@ -873,11 +961,11 @@ external_entity_loader(XML_Parser parser,
an external subset, and standalone is true.
*/
START_TEST(test_wfc_undeclared_entity_with_external_subset_standalone) {
- char *text =
+ const char *text =
"<?xml version='1.0' encoding='us-ascii' standalone='yes'?>\n"
"<!DOCTYPE doc SYSTEM 'foo'>\n"
"<doc>&entity;</doc>";
- char *foo_text =
+ char foo_text[] =
"<!ELEMENT doc (#PCDATA)*>";
XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
@@ -893,24 +981,24 @@ END_TEST
an external subset, and standalone is false.
*/
START_TEST(test_wfc_undeclared_entity_with_external_subset) {
- char *text =
+ const char *text =
"<?xml version='1.0' encoding='us-ascii'?>\n"
"<!DOCTYPE doc SYSTEM 'foo'>\n"
"<doc>&entity;</doc>";
- char *foo_text =
+ char foo_text[] =
"<!ELEMENT doc (#PCDATA)*>";
XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS);
XML_SetUserData(parser, foo_text);
XML_SetExternalEntityRefHandler(parser, external_entity_loader);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
START_TEST(test_wfc_no_recursive_entity_refs)
{
- char *text =
+ const char *text =
"<!DOCTYPE doc [\n"
" <!ENTITY entity '&entity;'>\n"
"]>\n"
@@ -925,7 +1013,7 @@ END_TEST
/* Regression test for SF bug #483514. */
START_TEST(test_dtd_default_handling)
{
- char *text =
+ const char *text =
"<!DOCTYPE doc [\n"
"<!ENTITY e SYSTEM 'http://xml.libexpat.org/e'>\n"
"<!NOTATION n SYSTEM 'http://xml.libexpat.org/n'>\n"
@@ -957,12 +1045,12 @@ END_TEST
*/
START_TEST(test_empty_ns_without_namespaces)
{
- char *text =
+ const char *text =
"<doc xmlns:prefix='http://www.example.com/'>\n"
" <e xmlns:prefix=''/>\n"
"</doc>";
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -973,19 +1061,19 @@ END_TEST
*/
START_TEST(test_ns_in_attribute_default_without_namespaces)
{
- char *text =
+ const char *text =
"<!DOCTYPE e:element [\n"
" <!ATTLIST e:element\n"
" xmlns:e CDATA 'http://example.com/'>\n"
" ]>\n"
"<e:element/>";
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
-static char *long_character_data_text =
+static const char *long_character_data_text =
"<?xml version='1.0' encoding='iso-8859-1'?><s>"
"012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789"
@@ -1012,8 +1100,8 @@ static char *long_character_data_text =
static XML_Bool resumable = XML_FALSE;
static void
-clearing_aborting_character_handler(void *userData,
- const XML_Char *s, int len)
+clearing_aborting_character_handler(void *UNUSED_P(userData),
+ const XML_Char *UNUSED_P(s), int UNUSED_P(len))
{
XML_StopParser(parser, resumable);
XML_SetCharacterDataHandler(parser, NULL);
@@ -1029,11 +1117,11 @@ START_TEST(test_stop_parser_between_char_data_calls)
handler must stop the parser and clear the character data
handler.
*/
- char *text = long_character_data_text;
+ const char *text = long_character_data_text;
XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler);
resumable = XML_FALSE;
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR)
xml_failure(parser);
if (XML_GetErrorCode(parser) != XML_ERROR_ABORTED)
xml_failure(parser);
@@ -1050,17 +1138,112 @@ START_TEST(test_suspend_parser_between_char_data_calls)
handler must stop the parser and clear the character data
handler.
*/
- char *text = long_character_data_text;
+ const char *text = long_character_data_text;
XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler);
resumable = XML_TRUE;
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_SUSPENDED)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_SUSPENDED)
xml_failure(parser);
if (XML_GetErrorCode(parser) != XML_ERROR_NONE)
xml_failure(parser);
}
END_TEST
+START_TEST(test_good_cdata_ascii)
+{
+ const char *text = "<a><![CDATA[<greeting>Hello, world!</greeting>]]></a>";
+ const char *expected = "<greeting>Hello, world!</greeting>";
+
+ CharData storage;
+ CharData_Init(&storage);
+ XML_SetUserData(parser, &storage);
+ XML_SetCharacterDataHandler(parser, accumulate_characters);
+
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ xml_failure(parser);
+ CharData_CheckXMLChars(&storage, expected);
+}
+END_TEST
+
+START_TEST(test_good_cdata_utf16)
+{
+ /* Test data is:
+ * <?xml version='1.0' encoding='utf-16'?>
+ * <a><![CDATA[hello]]></a>
+ */
+ const char text[] =
+ "\0<\0?\0x\0m\0l\0"
+ " \0v\0e\0r\0s\0i\0o\0n\0=\0'\0\x31\0.\0\x30\0'\0"
+ " \0e\0n\0c\0o\0d\0i\0n\0g\0=\0'\0u\0t\0f\0-\0""1\0""6\0'"
+ "\0?\0>\0\n"
+ "\0<\0a\0>\0<\0!\0[\0C\0D\0A\0T\0A\0[\0h\0e\0l\0l\0o\0]\0]\0>\0<\0/\0a\0>";
+ const char *expected = "hello";
+
+ CharData storage;
+ CharData_Init(&storage);
+ XML_SetUserData(parser, &storage);
+ XML_SetCharacterDataHandler(parser, accumulate_characters);
+
+ if (_XML_Parse_SINGLE_BYTES(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_ERROR)
+ xml_failure(parser);
+ CharData_CheckXMLChars(&storage, expected);
+}
+END_TEST
+
+START_TEST(test_bad_cdata)
+{
+ struct CaseData {
+ const char *text;
+ enum XML_Error expectedError;
+ };
+
+ struct CaseData cases[] = {
+ {"<a><", XML_ERROR_UNCLOSED_TOKEN},
+ {"<a><!", XML_ERROR_UNCLOSED_TOKEN},
+ {"<a><![", XML_ERROR_UNCLOSED_TOKEN},
+ {"<a><![C", XML_ERROR_UNCLOSED_TOKEN},
+ {"<a><![CD", XML_ERROR_UNCLOSED_TOKEN},
+ {"<a><![CDA", XML_ERROR_UNCLOSED_TOKEN},
+ {"<a><![CDAT", XML_ERROR_UNCLOSED_TOKEN},
+ {"<a><![CDATA", XML_ERROR_UNCLOSED_TOKEN},
+
+ {"<a><![CDATA[", XML_ERROR_UNCLOSED_CDATA_SECTION},
+ {"<a><![CDATA[]", XML_ERROR_UNCLOSED_CDATA_SECTION},
+ {"<a><![CDATA[]]", XML_ERROR_UNCLOSED_CDATA_SECTION},
+
+ {"<a><!<a/>", XML_ERROR_INVALID_TOKEN},
+ {"<a><![<a/>", XML_ERROR_UNCLOSED_TOKEN}, /* ?! */
+ {"<a><![C<a/>", XML_ERROR_UNCLOSED_TOKEN}, /* ?! */
+ {"<a><![CD<a/>", XML_ERROR_INVALID_TOKEN},
+ {"<a><![CDA<a/>", XML_ERROR_INVALID_TOKEN},
+ {"<a><![CDAT<a/>", XML_ERROR_INVALID_TOKEN},
+ {"<a><![CDATA<a/>", XML_ERROR_INVALID_TOKEN},
+
+ {"<a><![CDATA[<a/>", XML_ERROR_UNCLOSED_CDATA_SECTION},
+ {"<a><![CDATA[]<a/>", XML_ERROR_UNCLOSED_CDATA_SECTION},
+ {"<a><![CDATA[]]<a/>", XML_ERROR_UNCLOSED_CDATA_SECTION}
+ };
+
+ size_t i = 0;
+ for (; i < sizeof(cases) / sizeof(struct CaseData); i++) {
+ const enum XML_Status actualStatus = _XML_Parse_SINGLE_BYTES(
+ parser, cases[i].text, strlen(cases[i].text), XML_TRUE);
+ const enum XML_Error actualError = XML_GetErrorCode(parser);
+
+ assert(actualStatus == XML_STATUS_ERROR);
+
+ if (actualError != cases[i].expectedError) {
+ char message[100];
+ sprintf(message, "Expected error %d but got error %d for case %u: \"%s\"\n",
+ cases[i].expectedError, actualError, (unsigned int)i + 1, cases[i].text);
+ fail(message);
+ }
+
+ XML_ParserReset(parser, NULL);
+ }
+}
+END_TEST
+
/*
* Namespaces tests.
@@ -1118,17 +1301,17 @@ triplet_end_checker(void *userData, const XML_Char *name)
START_TEST(test_return_ns_triplet)
{
- char *text =
+ const char *text =
"<foo:e xmlns:foo='http://expat.sf.net/' bar:a='12'\n"
" xmlns:bar='http://expat.sf.net/'></foo:e>";
- char *elemstr[] = {
+ const char *elemstr[] = {
"http://expat.sf.net/ e foo",
"http://expat.sf.net/ a bar"
};
XML_SetReturnNSTriplet(parser, XML_TRUE);
XML_SetUserData(parser, elemstr);
XML_SetElementHandler(parser, triplet_start_checker, triplet_end_checker);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -1158,14 +1341,14 @@ overwrite_end_checker(void *userData, const XML_Char *name)
}
static void
-run_ns_tagname_overwrite_test(char *text, char *result)
+run_ns_tagname_overwrite_test(const char *text, const char *result)
{
CharData storage;
CharData_Init(&storage);
XML_SetUserData(parser, &storage);
XML_SetElementHandler(parser,
overwrite_start_checker, overwrite_end_checker);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
CharData_CheckString(&storage, result);
}
@@ -1173,12 +1356,12 @@ run_ns_tagname_overwrite_test(char *text, char *result)
/* Regression test for SF bug #566334. */
START_TEST(test_ns_tagname_overwrite)
{
- char *text =
+ const char *text =
"<n:e xmlns:n='http://xml.libexpat.org/'>\n"
" <n:f n:attr='foo'/>\n"
" <n:g n:attr2='bar'/>\n"
"</n:e>";
- char *result =
+ const char *result =
"start http://xml.libexpat.org/ e\n"
"start http://xml.libexpat.org/ f\n"
"attribute http://xml.libexpat.org/ attr\n"
@@ -1194,12 +1377,12 @@ END_TEST
/* Regression test for SF bug #566334. */
START_TEST(test_ns_tagname_overwrite_triplet)
{
- char *text =
+ const char *text =
"<n:e xmlns:n='http://xml.libexpat.org/'>\n"
" <n:f n:attr='foo'/>\n"
" <n:g n:attr2='bar'/>\n"
"</n:e>";
- char *result =
+ const char *result =
"start http://xml.libexpat.org/ e n\n"
"start http://xml.libexpat.org/ f n\n"
"attribute http://xml.libexpat.org/ attr n\n"
@@ -1216,8 +1399,8 @@ END_TEST
/* Regression test for SF bug #620343. */
static void XMLCALL
-start_element_fail(void *userData,
- const XML_Char *name, const XML_Char **atts)
+start_element_fail(void *UNUSED_P(userData),
+ const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts))
{
/* We should never get here. */
fail("should never reach start_element_fail()");
@@ -1225,8 +1408,8 @@ start_element_fail(void *userData,
static void XMLCALL
start_ns_clearing_start_element(void *userData,
- const XML_Char *prefix,
- const XML_Char *uri)
+ const XML_Char *UNUSED_P(prefix),
+ const XML_Char *UNUSED_P(uri))
{
XML_SetStartElementHandler((XML_Parser) userData, NULL);
}
@@ -1237,12 +1420,12 @@ START_TEST(test_start_ns_clears_start_element)
syntax doesn't cause the problematic path through Expat to be
taken.
*/
- char *text = "<e xmlns='http://xml.libexpat.org/'></e>";
+ const char *text = "<e xmlns='http://xml.libexpat.org/'></e>";
XML_SetStartElementHandler(parser, start_element_fail);
XML_SetStartNamespaceDeclHandler(parser, start_ns_clearing_start_element);
XML_UseParserAsHandlerArg(parser);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -1251,12 +1434,12 @@ END_TEST
static int XMLCALL
external_entity_handler(XML_Parser parser,
const XML_Char *context,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId)
+ const XML_Char *UNUSED_P(base),
+ const XML_Char *UNUSED_P(systemId),
+ const XML_Char *UNUSED_P(publicId))
{
intptr_t callno = 1 + (intptr_t)XML_GetUserData(parser);
- char *text;
+ const char *text;
XML_Parser p2;
if (callno == 1)
@@ -1269,7 +1452,7 @@ external_entity_handler(XML_Parser parser,
XML_SetUserData(parser, (void *) callno);
p2 = XML_ExternalEntityParserCreate(parser, context, NULL);
- if (XML_Parse(p2, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) {
+ if (_XML_Parse_SINGLE_BYTES(p2, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) {
xml_failure(p2);
return 0;
}
@@ -1279,7 +1462,7 @@ external_entity_handler(XML_Parser parser,
START_TEST(test_default_ns_from_ext_subset_and_ext_ge)
{
- char *text =
+ const char *text =
"<?xml version='1.0'?>\n"
"<!DOCTYPE doc SYSTEM 'http://xml.libexpat.org/doc.dtd' [\n"
" <!ENTITY en SYSTEM 'http://xml.libexpat.org/entity.ent'>\n"
@@ -1293,7 +1476,7 @@ START_TEST(test_default_ns_from_ext_subset_and_ext_ge)
/* We actually need to set this handler to tickle this bug. */
XML_SetStartElementHandler(parser, dummy_start_element);
XML_SetUserData(parser, NULL);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -1301,7 +1484,7 @@ END_TEST
/* Regression test #1 for SF bug #673791. */
START_TEST(test_ns_prefix_with_empty_uri_1)
{
- char *text =
+ const char *text =
"<doc xmlns:prefix='http://xml.libexpat.org/'>\n"
" <e xmlns:prefix=''/>\n"
"</doc>";
@@ -1316,7 +1499,7 @@ END_TEST
/* Regression test #2 for SF bug #673791. */
START_TEST(test_ns_prefix_with_empty_uri_2)
{
- char *text =
+ const char *text =
"<?xml version='1.0'?>\n"
"<docelem xmlns:pre=''/>";
@@ -1329,7 +1512,7 @@ END_TEST
/* Regression test #3 for SF bug #673791. */
START_TEST(test_ns_prefix_with_empty_uri_3)
{
- char *text =
+ const char *text =
"<!DOCTYPE doc [\n"
" <!ELEMENT doc EMPTY>\n"
" <!ATTLIST doc\n"
@@ -1346,7 +1529,7 @@ END_TEST
/* Regression test #4 for SF bug #673791. */
START_TEST(test_ns_prefix_with_empty_uri_4)
{
- char *text =
+ const char *text =
"<!DOCTYPE doc [\n"
" <!ELEMENT prefix:doc EMPTY>\n"
" <!ATTLIST prefix:doc\n"
@@ -1356,24 +1539,24 @@ START_TEST(test_ns_prefix_with_empty_uri_4)
/* Packaged info expected by the end element handler;
the weird structuring lets us re-use the triplet_end_checker()
function also used for another test. */
- char *elemstr[] = {
+ const char *elemstr[] = {
"http://xml.libexpat.org/ doc prefix"
};
XML_SetReturnNSTriplet(parser, XML_TRUE);
XML_SetUserData(parser, elemstr);
XML_SetEndElementHandler(parser, triplet_end_checker);
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
START_TEST(test_ns_default_with_empty_uri)
{
- char *text =
+ const char *text =
"<doc xmlns='http://xml.libexpat.org/'>\n"
" <e xmlns=''/>\n"
"</doc>";
- if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR)
xml_failure(parser);
}
END_TEST
@@ -1381,7 +1564,7 @@ END_TEST
/* Regression test for SF bug #692964: two prefixes for one namespace. */
START_TEST(test_ns_duplicate_attrs_diff_prefixes)
{
- char *text =
+ const char *text =
"<doc xmlns:a='http://xml.libexpat.org/a'\n"
" xmlns:b='http://xml.libexpat.org/a'\n"
" a:a='v' b:a='v' />";
@@ -1394,7 +1577,7 @@ END_TEST
/* Regression test for SF bug #695401: unbound prefix. */
START_TEST(test_ns_unbound_prefix_on_attribute)
{
- char *text = "<doc a:attr=''/>";
+ const char *text = "<doc a:attr=''/>";
expect_failure(text,
XML_ERROR_UNBOUND_PREFIX,
"did not report unbound prefix on attribute");
@@ -1404,7 +1587,7 @@ END_TEST
/* Regression test for SF bug #695401: unbound prefix. */
START_TEST(test_ns_unbound_prefix_on_element)
{
- char *text = "<a:doc/>";
+ const char *text = "<a:doc/>";
expect_failure(text,
XML_ERROR_UNBOUND_PREFIX,
"did not report unbound prefix on element");
@@ -1426,6 +1609,7 @@ make_suite(void)
tcase_add_test(tc_basic, test_bom_utf16_be);
tcase_add_test(tc_basic, test_bom_utf16_le);
tcase_add_test(tc_basic, test_illegal_utf8);
+ tcase_add_test(tc_basic, test_utf8_auto_align);
tcase_add_test(tc_basic, test_utf16);
tcase_add_test(tc_basic, test_utf16_le_epilog_newline);
tcase_add_test(tc_basic, test_latin1_umlauts);
@@ -1461,6 +1645,9 @@ make_suite(void)
tcase_add_test(tc_basic, test_ns_in_attribute_default_without_namespaces);
tcase_add_test(tc_basic, test_stop_parser_between_char_data_calls);
tcase_add_test(tc_basic, test_suspend_parser_between_char_data_calls);
+ tcase_add_test(tc_basic, test_good_cdata_ascii);
+ tcase_add_test(tc_basic, test_good_cdata_utf16);
+ tcase_add_test(tc_basic, test_bad_cdata);
suite_add_tcase(s, tc_namespace);
tcase_add_checked_fixture(tc_namespace,
diff --git a/deps/libexpat/tests/xmltest.sh b/deps/libexpat/tests/xmltest.sh
index 793a5cc..64a17ee 100755
--- a/deps/libexpat/tests/xmltest.sh
+++ b/deps/libexpat/tests/xmltest.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /usr/bin/env bash
# EXPAT TEST SCRIPT FOR W3C XML TEST SUITE
@@ -20,12 +20,14 @@
# produced by xmlwf conforms to an older definition of canonical XML
# and does not generate notation declarations.
+shopt -s nullglob
+
MYDIR="`dirname \"$0\"`"
cd "$MYDIR"
MYDIR="`pwd`"
XMLWF="`dirname \"$MYDIR\"`/xmlwf/xmlwf"
# XMLWF=/usr/local/bin/xmlwf
-TS="$MYDIR/XML-Test-Suite"
+TS="$MYDIR"
# OUTPUT must terminate with the directory separator.
OUTPUT="$TS/out/"
# OUTPUT=/home/tmp/xml-testsuite-out/
@@ -100,7 +102,7 @@ for xmldir in ibm/valid/P* \
RunXmlwfWF "$xmlfile" "$xmldir/"
UpdateStatus $?
done
- rm outfile
+ rm -f outfile
done
cd "$TS/xmlconf/oasis"
diff --git a/deps/libexpat/win32/README.txt b/deps/libexpat/win32/README.txt
index e3702ae..c58d29a 100644
--- a/deps/libexpat/win32/README.txt
+++ b/deps/libexpat/win32/README.txt
@@ -16,6 +16,14 @@ Expat can be built on Windows in three ways:
* MS Visual Studio .NET 2002, 2003, 2005, 2008, 2010:
The VC++ 6 workspace file (expat.dsw) and project files (.dsp)
can be opened and imported in VS.NET without problems.
+ Note: Tests have their own *.dsw files.
+
+* MS Visual Studio 2013 and 2015:
+ A solution file for Visual Studio 2013 is provided: expat.sln.
+ The associated project files (*.vcxproj) reside in the appropriate
+ project directories. This solution file can be opened in VS 2015
+ and should be upgraded automatically if VS 2013 is not also installed.
+ Note: Tests have their own solution files.
* All MS C/C++ compilers:
The output for all projects will be generated in the win32\bin
diff --git a/deps/libexpat/win32/expat.iss b/deps/libexpat/win32/expat.iss
index de5b6ef..add8445 100644
--- a/deps/libexpat/win32/expat.iss
+++ b/deps/libexpat/win32/expat.iss
@@ -7,17 +7,17 @@
[Setup]
AppName=Expat
AppId=expat
-AppVersion=2.1.0
-AppVerName=Expat 2.1.0
-AppCopyright=Copyright � 1998-2012 Thai Open Source Software Center, Clark Cooper, and the Expat maintainers
+AppVersion=2.2.0
+AppVerName=Expat 2.2.0
+AppCopyright=Copyright � 1998-2016 Thai Open Source Software Center, Clark Cooper, and the Expat maintainers
AppPublisher=The Expat Developers
AppPublisherURL=http://www.libexpat.org/
AppSupportURL=http://www.libexpat.org/
AppUpdatesURL=http://www.libexpat.org/
-UninstallDisplayName=Expat XML Parser 2.1.0
-VersionInfoVersion=2.1.0
+UninstallDisplayName=Expat XML Parser 2.2.0
+VersionInfoVersion=2.2.0
-DefaultDirName={pf}\Expat 2.1.0
+DefaultDirName={pf}\Expat 2.2.0
UninstallFilesDir={app}\Uninstall
Compression=lzma
@@ -41,6 +41,7 @@ Flags: ignoreversion; Source: doc\*.png; DestDir: "{app}\Doc"
Flags: ignoreversion; Source: win32\bin\Release\*.dll; DestDir: "{app}\Bin"
Flags: ignoreversion; Source: win32\bin\Release\*.lib; DestDir: "{app}\Bin"
Flags: ignoreversion; Source: expat.dsw; DestDir: "{app}\Source"
+Flags: ignoreversion; Source: expat.sln; DestDir: "{app}\Source"
Flags: ignoreversion; Source: win32\README.txt; DestDir: "{app}\Source"
Flags: ignoreversion; Source: bcb5\*.bp*; DestDir: "{app}\Source\bcb5"
Flags: ignoreversion; Source: bcb5\*.mak; DestDir: "{app}\Source\bcb5"
@@ -51,18 +52,30 @@ Flags: ignoreversion; Source: lib\*.c; DestDir: "{app}\Sour
Flags: ignoreversion; Source: lib\*.h; DestDir: "{app}\Source\lib"
Flags: ignoreversion; Source: lib\*.def; DestDir: "{app}\Source\lib"
Flags: ignoreversion; Source: lib\*.dsp; DestDir: "{app}\Source\lib"
+Flags: ignoreversion; Source: lib\*.vcxproj; DestDir: "{app}\Source\lib"
+Flags: ignoreversion; Source: lib\*.vcxproj.filters; DestDir: "{app}\Source\lib"
Flags: ignoreversion; Source: examples\*.c; DestDir: "{app}\Source\examples"
Flags: ignoreversion; Source: examples\*.dsp; DestDir: "{app}\Source\examples"
+Flags: ignoreversion; Source: examples\*.vcxproj; DestDir: "{app}\Source\examples"
+Flags: ignoreversion; Source: examples\*.vcxproj.filters; DestDir: "{app}\Source\examples"
Flags: ignoreversion; Source: tests\*.c; DestDir: "{app}\Source\tests"
Flags: ignoreversion; Source: tests\*.cpp; DestDir: "{app}\Source\tests"
Flags: ignoreversion; Source: tests\*.h; DestDir: "{app}\Source\tests"
+Flags: ignoreversion; Source: tests\*.ds*; DestDir: "{app}\Source\tests"
+Flags: ignoreversion; Source: tests\*.sln; DestDir: "{app}\Source\tests"
+Flags: ignoreversion; Source: tests\*.vcxproj; DestDir: "{app}\Source\tests"
+Flags: ignoreversion; Source: tests\*.vcxproj.filters; DestDir: "{app}\Source\tests"
Flags: ignoreversion; Source: tests\README.txt; DestDir: "{app}\Source\tests"
Flags: ignoreversion; Source: tests\benchmark\*.c; DestDir: "{app}\Source\tests\benchmark"
Flags: ignoreversion; Source: tests\benchmark\*.ds*; DestDir: "{app}\Source\tests\benchmark"
+Flags: ignoreversion; Source: tests\benchmark\*.sln; DestDir: "{app}\Source\tests\benchmark"
+Flags: ignoreversion; Source: tests\benchmark\*.vcxproj; DestDir: "{app}\Source\tests\benchmark"
Flags: ignoreversion; Source: tests\benchmark\README.txt; DestDir: "{app}\Source\tests\benchmark"
Flags: ignoreversion; Source: xmlwf\*.c*; DestDir: "{app}\Source\xmlwf"
Flags: ignoreversion; Source: xmlwf\*.h; DestDir: "{app}\Source\xmlwf"
Flags: ignoreversion; Source: xmlwf\*.dsp; DestDir: "{app}\Source\xmlwf"
+Flags: ignoreversion; Source: xmlwf\*.vcxproj; DestDir: "{app}\Source\xmlwf"
+Flags: ignoreversion; Source: xmlwf\*.vcxproj.filters; DestDir: "{app}\Source\xmlwf"
[Messages]
WelcomeLabel1=Welcome to the Expat XML Parser Setup Wizard
diff --git a/deps/libexpat/xmlwf/codepage.c b/deps/libexpat/xmlwf/codepage.c
index 57e48ff..91bd15e 100755
--- a/deps/libexpat/xmlwf/codepage.c
+++ b/deps/libexpat/xmlwf/codepage.c
@@ -3,6 +3,7 @@
*/
#include "codepage.h"
+#include "internal.h" /* for UNUSED_P only */
#if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__)))
#define STRICT 1
@@ -54,13 +55,13 @@ codepageConvert(int cp, const char *p)
#else /* not WIN32 */
int
-codepageMap(int cp, int *map)
+codepageMap(int UNUSED_P(cp), int *UNUSED_P(map))
{
return 0;
}
int
-codepageConvert(int cp, const char *p)
+codepageConvert(int UNUSED_P(cp), const char *UNUSED_P(p))
{
return -1;
}
diff --git a/deps/libexpat/xmlwf/readfilemap.c b/deps/libexpat/xmlwf/readfilemap.c
index bd32b93..d816b26 100755
--- a/deps/libexpat/xmlwf/readfilemap.c
+++ b/deps/libexpat/xmlwf/readfilemap.c
@@ -8,16 +8,17 @@
#include <stdlib.h>
#include <stdio.h>
+/* Functions close(2) and read(2) */
#ifdef __WATCOMC__
#ifndef __LINUX__
#include <io.h>
#else
#include <unistd.h>
#endif
-#endif
-
-#ifdef __BEOS__
-#include <unistd.h>
+#else
+# if !defined(WIN32) && !defined(_WIN32) && !defined(_WIN64)
+# include <unistd.h>
+# endif
#endif
#ifndef S_ISREG
diff --git a/deps/libexpat/xmlwf/unixfilemap.c b/deps/libexpat/xmlwf/unixfilemap.c
index 93adce3..e13299d 100755
--- a/deps/libexpat/xmlwf/unixfilemap.c
+++ b/deps/libexpat/xmlwf/unixfilemap.c
@@ -51,7 +51,7 @@ filemap(const char *name,
close(fd);
return 1;
}
- p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ,
+ p = (void *)mmap((void *)0, (size_t)nbytes, PROT_READ,
MAP_FILE|MAP_PRIVATE, fd, (off_t)0);
if (p == (void *)-1) {
perror(name);
@@ -59,7 +59,7 @@ filemap(const char *name,
return 0;
}
processor(p, nbytes, name, arg);
- munmap((caddr_t)p, nbytes);
+ munmap((void *)p, nbytes);
close(fd);
return 1;
}
diff --git a/deps/libexpat/xmlwf/xmlfile.c b/deps/libexpat/xmlwf/xmlfile.c
index 99eeeaa..2f769aa 100755
--- a/deps/libexpat/xmlwf/xmlfile.c
+++ b/deps/libexpat/xmlwf/xmlfile.c
@@ -8,7 +8,7 @@
#include <string.h>
#include <fcntl.h>
-#ifdef COMPILED_FROM_DSP
+#ifdef WIN32
#include "winconfig.h"
#elif defined(MACOS_CLASSIC)
#include "macconfig.h"
@@ -18,9 +18,10 @@
#include "watcomconfig.h"
#elif defined(HAVE_EXPAT_CONFIG_H)
#include <expat_config.h>
-#endif /* ndef COMPILED_FROM_DSP */
+#endif /* ndef WIN32 */
#include "expat.h"
+#include "internal.h" /* for UNUSED_P only */
#include "xmlfile.h"
#include "xmltchar.h"
#include "filemap.h"
@@ -132,7 +133,7 @@ externalEntityRefFilemap(XML_Parser parser,
const XML_Char *context,
const XML_Char *base,
const XML_Char *systemId,
- const XML_Char *publicId)
+ const XML_Char *UNUSED_P(publicId))
{
int result;
XML_Char *s;
@@ -200,7 +201,7 @@ externalEntityRefStream(XML_Parser parser,
const XML_Char *context,
const XML_Char *base,
const XML_Char *systemId,
- const XML_Char *publicId)
+ const XML_Char *UNUSED_P(publicId))
{
XML_Char *s;
const XML_Char *filename;
diff --git a/deps/libexpat/xmlwf/xmlwf.c b/deps/libexpat/xmlwf/xmlwf.c
index 4fc77da..66d6c9e 100755
--- a/deps/libexpat/xmlwf/xmlwf.c
+++ b/deps/libexpat/xmlwf/xmlwf.c
@@ -9,6 +9,7 @@
#include "expat.h"
#include "codepage.h"
+#include "internal.h" /* for UNUSED_P only */
#include "xmlfile.h"
#include "xmltchar.h"
@@ -248,49 +249,49 @@ processingInstruction(void *userData, const XML_Char *target,
#endif /* not W3C14N */
static void XMLCALL
-defaultCharacterData(void *userData, const XML_Char *s, int len)
+defaultCharacterData(void *userData, const XML_Char *UNUSED_P(s), int UNUSED_P(len))
{
XML_DefaultCurrent((XML_Parser) userData);
}
static void XMLCALL
-defaultStartElement(void *userData, const XML_Char *name,
- const XML_Char **atts)
+defaultStartElement(void *userData, const XML_Char *UNUSED_P(name),
+ const XML_Char **UNUSED_P(atts))
{
XML_DefaultCurrent((XML_Parser) userData);
}
static void XMLCALL
-defaultEndElement(void *userData, const XML_Char *name)
+defaultEndElement(void *userData, const XML_Char *UNUSED_P(name))
{
XML_DefaultCurrent((XML_Parser) userData);
}
static void XMLCALL
-defaultProcessingInstruction(void *userData, const XML_Char *target,
- const XML_Char *data)
+defaultProcessingInstruction(void *userData, const XML_Char *UNUSED_P(target),
+ const XML_Char *UNUSED_P(data))
{
XML_DefaultCurrent((XML_Parser) userData);
}
static void XMLCALL
-nopCharacterData(void *userData, const XML_Char *s, int len)
+nopCharacterData(void *UNUSED_P(userData), const XML_Char *UNUSED_P(s), int UNUSED_P(len))
{
}
static void XMLCALL
-nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts)
+nopStartElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name), const XML_Char **UNUSED_P(atts))
{
}
static void XMLCALL
-nopEndElement(void *userData, const XML_Char *name)
+nopEndElement(void *UNUSED_P(userData), const XML_Char *UNUSED_P(name))
{
}
static void XMLCALL
-nopProcessingInstruction(void *userData, const XML_Char *target,
- const XML_Char *data)
+nopProcessingInstruction(void *UNUSED_P(userData), const XML_Char *UNUSED_P(target),
+ const XML_Char *UNUSED_P(data))
{
}
@@ -434,9 +435,9 @@ metaCharacterData(void *userData, const XML_Char *s, int len)
static void XMLCALL
metaStartDoctypeDecl(void *userData,
const XML_Char *doctypeName,
- const XML_Char *sysid,
- const XML_Char *pubid,
- int has_internal_subset)
+ const XML_Char *UNUSED_P(sysid),
+ const XML_Char *UNUSED_P(pubid),
+ int UNUSED_P(has_internal_subset))
{
XML_Parser parser = (XML_Parser) userData;
FILE *fp = (FILE *)XML_GetUserData(parser);
@@ -458,7 +459,7 @@ metaEndDoctypeDecl(void *userData)
static void XMLCALL
metaNotationDecl(void *userData,
const XML_Char *notationName,
- const XML_Char *base,
+ const XML_Char *UNUSED_P(base),
const XML_Char *systemId,
const XML_Char *publicId)
{
@@ -480,10 +481,10 @@ metaNotationDecl(void *userData,
static void XMLCALL
metaEntityDecl(void *userData,
const XML_Char *entityName,
- int is_param,
+ int UNUSED_P(is_param),
const XML_Char *value,
int value_length,
- const XML_Char *base,
+ const XML_Char *UNUSED_P(base),
const XML_Char *systemId,
const XML_Char *publicId,
const XML_Char *notationName)
@@ -558,7 +559,7 @@ unknownEncodingConvert(void *data, const char *p)
}
static int XMLCALL
-unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info)
+unknownEncoding(void *UNUSED_P(userData), const XML_Char *name, XML_Encoding *info)
{
int cp;
static const XML_Char prefixL[] = T("windows-");
@@ -594,7 +595,7 @@ unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info)
}
static int XMLCALL
-notStandalone(void *userData)
+notStandalone(void *UNUSED_P(userData))
{
return 0;
}
@@ -634,8 +635,7 @@ static void
usage(const XML_Char *prog, int rc)
{
ftprintf(stderr,
- T("usage: %s [-n] [-p] [-r] [-s] [-w] [-x] [-d output-dir] "
- "[-e encoding] file ...\n"), prog);
+ T("usage: %s [-s] [-n] [-p] [-x] [-e encoding] [-w] [-d output-dir] [-c] [-m] [-r] [-t] [file ...]\n"), prog);
exit(rc);
}
@@ -760,6 +760,12 @@ tmain(int argc, XML_Char **argv)
parser = XML_ParserCreateNS(encoding, NSSEP);
else
parser = XML_ParserCreate(encoding);
+
+ if (! parser) {
+ tperror("Could not instantiate parser");
+ exit(1);
+ }
+
if (requireStandalone)
XML_SetNotStandaloneHandler(parser, notStandalone);
XML_SetParamEntityParsing(parser, paramEntityParsing);
diff --git a/deps/libexpat/xmlwf/xmlwf.dsp b/deps/libexpat/xmlwf/xmlwf.dsp
index 52f4eec..e4fa0ca 100755
--- a/deps/libexpat/xmlwf/xmlwf.dsp
+++ b/deps/libexpat/xmlwf/xmlwf.dsp
@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir "."
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\lib" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "COMPILED_FROM_DSP" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\lib" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
@@ -68,7 +68,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir "."
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\lib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "COMPILED_FROM_DSP" /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\lib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
# SUBTRACT CPP /Fr /YX
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-expat.git
More information about the Pkg-javascript-commits
mailing list