[LIBXML2]

- Update to version 2.7.8. Patch by Carlo Bramini.
- Installed and booted successfully to the desktop. Tested
abiword 2.6.4 and FF 2.0.0.20.

See issue #4988 for more details.

svn path=/trunk/; revision=51577
This commit is contained in:
Gabriel Ilardi 2011-05-04 15:48:34 +00:00
parent 0c937e4c37
commit 0b6d767a29
35 changed files with 5547 additions and 11917 deletions

View file

@ -177,6 +177,7 @@ XMLPUBFUN void XMLCALL
*/ */
typedef enum { typedef enum {
HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */ HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */
HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */
HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */
HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */

View file

@ -51,7 +51,4 @@ xmlinc_HEADERS = \
xmlsave.h \ xmlsave.h \
schematron.h schematron.h
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(xmlincdir)
EXTRA_DIST = xmlversion.h.in EXTRA_DIST = xmlversion.h.in

View file

@ -14,7 +14,6 @@
# PARTICULAR PURPOSE. # PARTICULAR PURPOSE.
@SET_MAKE@ @SET_MAKE@
VPATH = @srcdir@ VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@ pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@
@ -34,9 +33,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = : POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
subdir = include/libxml subdir = include
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
$(srcdir)/xmlversion.h.in $(xmlinc_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@ -44,38 +42,53 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = xmlversion.h CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
SOURCES = SOURCES =
DIST_SOURCES = DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
am__vpath_adj = case $$p in \ html-recursive info-recursive install-data-recursive \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ install-dvi-recursive install-exec-recursive \
*) f=$$p;; \ install-html-recursive install-info-recursive \
esac; install-pdf-recursive install-ps-recursive install-recursive \
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; installcheck-recursive installdirs-recursive pdf-recursive \
am__install_max = 40 ps-recursive uninstall-recursive
am__nobase_strip_setup = \ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` distclean-recursive maintainer-clean-recursive
am__nobase_strip = \ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
am__nobase_list = $(am__nobase_strip_setup); \ distdir
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(xmlincdir)"
HEADERS = $(xmlinc_HEADERS)
ETAGS = etags ETAGS = etags
CTAGS = ctags CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AR = @AR@ AR = @AR@
@ -153,6 +166,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@ PERL = @PERL@
@ -201,6 +215,7 @@ VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@
WGET = @WGET@ WGET = @WGET@
WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@
WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@
WIN32_EXTRA_PYTHON_LIBADD = @WIN32_EXTRA_PYTHON_LIBADD@
WITH_C14N = @WITH_C14N@ WITH_C14N = @WITH_C14N@
WITH_CATALOG = @WITH_CATALOG@ WITH_CATALOG = @WITH_CATALOG@
WITH_DEBUG = @WITH_DEBUG@ WITH_DEBUG = @WITH_DEBUG@
@ -209,6 +224,7 @@ WITH_FTP = @WITH_FTP@
WITH_HTML = @WITH_HTML@ WITH_HTML = @WITH_HTML@
WITH_HTTP = @WITH_HTTP@ WITH_HTTP = @WITH_HTTP@
WITH_ICONV = @WITH_ICONV@ WITH_ICONV = @WITH_ICONV@
WITH_ICU = @WITH_ICU@
WITH_ISO8859X = @WITH_ISO8859X@ WITH_ISO8859X = @WITH_ISO8859X@
WITH_LEGACY = @WITH_LEGACY@ WITH_LEGACY = @WITH_LEGACY@
WITH_MEM_DEBUG = @WITH_MEM_DEBUG@ WITH_MEM_DEBUG = @WITH_MEM_DEBUG@
@ -279,7 +295,6 @@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
localedir = @localedir@ localedir = @localedir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@ mandir = @mandir@
mkdir_p = @mkdir_p@ mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@ oldincludedir = @oldincludedir@
@ -296,58 +311,9 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
xmlincdir = $(includedir)/libxml2/libxml SUBDIRS = libxml
xmlinc_HEADERS = \ EXTRA_DIST = win32config.h wsockcompat.h
SAX.h \ all: all-recursive
entities.h \
encoding.h \
parser.h \
parserInternals.h \
xmlerror.h \
HTMLparser.h \
HTMLtree.h \
debugXML.h \
tree.h \
list.h \
hash.h \
xpath.h \
xpathInternals.h \
xpointer.h \
xinclude.h \
xmlIO.h \
xmlmemory.h \
nanohttp.h \
nanoftp.h \
uri.h \
valid.h \
xlink.h \
xmlversion.h \
DOCBparser.h \
catalog.h \
threads.h \
globals.h \
c14n.h \
xmlautomata.h \
xmlregexp.h \
xmlmodule.h \
xmlschemas.h \
schemasInternals.h \
xmlschemastypes.h \
xmlstring.h \
xmlunicode.h \
xmlreader.h \
relaxng.h \
dict.h \
SAX2.h \
xmlexports.h \
xmlwriter.h \
chvalid.h \
pattern.h \
xmlsave.h \
schematron.h
EXTRA_DIST = xmlversion.h.in
all: all-am
.SUFFIXES: .SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@ -359,9 +325,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \ exit 1;; \
esac; \ esac; \
done; \ done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/libxml/Makefile'; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \
$(am__cd) $(top_srcdir) && \ $(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu include/libxml/Makefile $(AUTOMAKE) --gnu include/Makefile
.PRECIOUS: Makefile .PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \ @case '$?' in \
@ -380,34 +346,82 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps): $(am__aclocal_m4_deps):
xmlversion.h: $(top_builddir)/config.status $(srcdir)/xmlversion.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo
clean-libtool: clean-libtool:
-rm -rf .libs _libs -rm -rf .libs _libs
install-xmlincHEADERS: $(xmlinc_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(xmlincdir)" || $(MKDIR_P) "$(DESTDIR)$(xmlincdir)"
@list='$(xmlinc_HEADERS)'; test -n "$(xmlincdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(xmlincdir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(xmlincdir)" || exit $$?; \
done
uninstall-xmlincHEADERS: # This directory's subdirectories are mostly independent; you can cd
@$(NORMAL_UNINSTALL) # into them and run `make' without going through this Makefile.
@list='$(xmlinc_HEADERS)'; test -n "$(xmlincdir)" || list=; \ # To change the values of `make' variables: instead of editing Makefiles,
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ # (1) if the variable is set in `config.status', edit `config.status'
test -n "$$files" || exit 0; \ # (which will cause the Makefiles to be regenerated when you run `make');
echo " ( cd '$(DESTDIR)$(xmlincdir)' && rm -f" $$files ")"; \ # (2) otherwise, pass the desired values on the `make' command line.
cd "$(DESTDIR)$(xmlincdir)" && rm -f $$files $(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@ -419,10 +433,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
mkid -fID $$unique mkid -fID $$unique
tags: TAGS tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP) $(TAGS_FILES) $(LISP)
set x; \ set x; \
here=`pwd`; \ here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \ unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@ -441,7 +468,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
fi; \ fi; \
fi fi
ctags: CTAGS ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP) $(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \ unique=`for i in $$list; do \
@ -491,22 +518,48 @@ distdir: $(DISTFILES)
|| exit 1; \ || exit 1; \
fi; \ fi; \
done done
check-am: all-am @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
check: check-am if test "$$subdir" = .; then :; else \
all-am: Makefile $(HEADERS) test -d "$(distdir)/$$subdir" \
installdirs: || $(MKDIR_P) "$(distdir)/$$subdir" \
for dir in "$(DESTDIR)$(xmlincdir)"; do \ || exit 1; \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \ fi; \
done done
install: install-am @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
install-exec: install-exec-am if test "$$subdir" = .; then :; else \
install-data: install-data-am dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
uninstall: uninstall-am $(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am installcheck: installcheck-recursive
install-strip: install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@ -523,92 +576,90 @@ distclean-generic:
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
clean: clean-am clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am distclean: distclean-recursive
-rm -f Makefile -rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am dvi: dvi-recursive
dvi-am: dvi-am:
html: html-am html: html-recursive
html-am: html-am:
info: info-am info: info-recursive
info-am: info-am:
install-data-am: install-xmlincHEADERS install-data-am:
install-dvi: install-dvi-am install-dvi: install-dvi-recursive
install-dvi-am: install-dvi-am:
install-exec-am: install-exec-am:
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-recursive
install-html: install-html-am
install-html-am: install-html-am:
install-info: install-info-am install-info: install-info-recursive
install-info-am: install-info-am:
install-man: install-man:
install-pdf: install-pdf-am install-pdf: install-pdf-recursive
install-pdf-am: install-pdf-am:
install-ps: install-ps-am install-ps: install-ps-recursive
install-ps-am: install-ps-am:
installcheck-am: installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-recursive
-rm -f Makefile -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am pdf: pdf-recursive
pdf-am: pdf-am:
ps: ps-am ps: ps-recursive
ps-am: ps-am:
uninstall-am: uninstall-xmlincHEADERS uninstall-am:
.MAKE: install-am install-exec-am install-strip .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
install-am install-strip tags-recursive
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
clean-libtool ctags distclean distclean-generic \ all all-am check check-am clean clean-generic clean-libtool \
ctags ctags-recursive distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \ distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \ html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \ install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-exec-hook install-html install-html-am \ install-exec-am install-html install-html-am install-info \
install-info install-info-am install-man install-pdf \ install-info-am install-man install-pdf install-pdf-am \
install-pdf-am install-ps install-ps-am install-strip \ install-ps install-ps-am install-strip installcheck \
install-xmlincHEADERS installcheck installcheck-am installdirs \ installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean maintainer-clean-generic mostlyclean \ maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
tags uninstall uninstall-am uninstall-xmlincHEADERS uninstall uninstall-am
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(xmlincdir)
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:

View file

@ -27,6 +27,9 @@
#ifdef LIBXML_ICONV_ENABLED #ifdef LIBXML_ICONV_ENABLED
#include <iconv.h> #include <iconv.h>
#endif #endif
#ifdef LIBXML_ICU_ENABLED
#include <unicode/ucnv.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -125,6 +128,13 @@ typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
* Block defining the handlers for non UTF-8 encodings. * Block defining the handlers for non UTF-8 encodings.
* If iconv is supported, there are two extra fields. * If iconv is supported, there are two extra fields.
*/ */
#ifdef LIBXML_ICU_ENABLED
struct _uconv_t {
UConverter *uconv; /* for conversion between an encoding and UTF-16 */
UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */
};
typedef struct _uconv_t uconv_t;
#endif
typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
@ -136,6 +146,10 @@ struct _xmlCharEncodingHandler {
iconv_t iconv_in; iconv_t iconv_in;
iconv_t iconv_out; iconv_t iconv_out;
#endif /* LIBXML_ICONV_ENABLED */ #endif /* LIBXML_ICONV_ENABLED */
#ifdef LIBXML_ICU_ENABLED
uconv_t *uconv_in;
uconv_t *uconv_out;
#endif /* LIBXML_ICU_ENABLED */
}; };
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -7,7 +7,7 @@
* *
* Author: Daniel Veillard * Author: Daniel Veillard
*/ */
#ifndef __NANO_FTP_H__ #ifndef __NANO_FTP_H__
#define __NANO_FTP_H__ #define __NANO_FTP_H__
@ -15,12 +15,31 @@
#ifdef LIBXML_FTP_ENABLED #ifdef LIBXML_FTP_ENABLED
/* Needed for portability to Windows 64 bits */
#if defined(__MINGW32__) || defined(_WIN32_WCE)
#include <winsock2.h>
#else
/**
* SOCKET:
*
* macro used to provide portability of code to windows sockets
*/
#define SOCKET int
/**
* INVALID_SOCKET:
*
* macro used to provide portability of code to windows sockets
* the value to be used when the socket is not valid
*/
#define INVALID_SOCKET (-1)
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* ftpListCallback: * ftpListCallback:
* @userData: user provided data for the callback * @userData: user provided data for the callback
* @filename: the file name (including "->" when links are shown) * @filename: the file name (including "->" when links are shown)
* @attrib: the attribute string * @attrib: the attribute string
@ -44,7 +63,7 @@ typedef void (*ftpListCallback) (void *userData,
const char *month, int day, int hour, const char *month, int day, int hour,
int minute); int minute);
/** /**
* ftpDataCallback: * ftpDataCallback:
* @userData: the user provided context * @userData: the user provided context
* @data: the data received * @data: the data received
* @len: its size in bytes * @len: its size in bytes
@ -60,78 +79,78 @@ typedef void (*ftpDataCallback) (void *userData,
*/ */
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlNanoFTPInit (void); xmlNanoFTPInit (void);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlNanoFTPCleanup (void); xmlNanoFTPCleanup (void);
/* /*
* Creating/freeing contexts. * Creating/freeing contexts.
*/ */
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlNanoFTPNewCtxt (const char *URL); xmlNanoFTPNewCtxt (const char *URL);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlNanoFTPFreeCtxt (void * ctx); xmlNanoFTPFreeCtxt (void * ctx);
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlNanoFTPConnectTo (const char *server, xmlNanoFTPConnectTo (const char *server,
int port); int port);
/* /*
* Opening/closing session connections. * Opening/closing session connections.
*/ */
XMLPUBFUN void * XMLCALL XMLPUBFUN void * XMLCALL
xmlNanoFTPOpen (const char *URL); xmlNanoFTPOpen (const char *URL);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPConnect (void *ctx); xmlNanoFTPConnect (void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPClose (void *ctx); xmlNanoFTPClose (void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPQuit (void *ctx); xmlNanoFTPQuit (void *ctx);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlNanoFTPScanProxy (const char *URL); xmlNanoFTPScanProxy (const char *URL);
XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL
xmlNanoFTPProxy (const char *host, xmlNanoFTPProxy (const char *host,
int port, int port,
const char *user, const char *user,
const char *passwd, const char *passwd,
int type); int type);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPUpdateURL (void *ctx, xmlNanoFTPUpdateURL (void *ctx,
const char *URL); const char *URL);
/* /*
* Rather internal commands. * Rather internal commands.
*/ */
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPGetResponse (void *ctx); xmlNanoFTPGetResponse (void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPCheckResponse (void *ctx); xmlNanoFTPCheckResponse (void *ctx);
/* /*
* CD/DIR/GET handlers. * CD/DIR/GET handlers.
*/ */
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPCwd (void *ctx, xmlNanoFTPCwd (void *ctx,
const char *directory); const char *directory);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPDele (void *ctx, xmlNanoFTPDele (void *ctx,
const char *file); const char *file);
XMLPUBFUN int XMLCALL XMLPUBFUN SOCKET XMLCALL
xmlNanoFTPGetConnection (void *ctx); xmlNanoFTPGetConnection (void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPCloseConnection(void *ctx); xmlNanoFTPCloseConnection(void *ctx);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPList (void *ctx, xmlNanoFTPList (void *ctx,
ftpListCallback callback, ftpListCallback callback,
void *userData, void *userData,
const char *filename); const char *filename);
XMLPUBFUN int XMLCALL XMLPUBFUN SOCKET XMLCALL
xmlNanoFTPGetSocket (void *ctx, xmlNanoFTPGetSocket (void *ctx,
const char *filename); const char *filename);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPGet (void *ctx, xmlNanoFTPGet (void *ctx,
ftpDataCallback callback, ftpDataCallback callback,
void *userData, void *userData,
const char *filename); const char *filename);
XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL
xmlNanoFTPRead (void *ctx, xmlNanoFTPRead (void *ctx,
void *dest, void *dest,
int len); int len);

View file

@ -1222,6 +1222,7 @@ typedef enum {
XML_WITH_DEBUG_MEM = 29, XML_WITH_DEBUG_MEM = 29,
XML_WITH_DEBUG_RUN = 30, XML_WITH_DEBUG_RUN = 30,
XML_WITH_ZLIB = 31, XML_WITH_ZLIB = 31,
XML_WITH_ICU = 32,
XML_WITH_NONE = 99999 /* just to be sure of allocation size */ XML_WITH_NONE = 99999 /* just to be sure of allocation size */
} xmlFeature; } xmlFeature;
@ -1232,4 +1233,3 @@ XMLPUBFUN int XMLCALL
} }
#endif #endif
#endif /* __XML_PARSER_H__ */ #endif /* __XML_PARSER_H__ */

View file

@ -33,7 +33,8 @@ typedef enum {
XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */
XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */
XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */
XML_SAVE_AS_HTML = 1<<6 /* force HTML serialization on XML doc */ XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */
XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */
} xmlSaveOption; } xmlSaveOption;

View file

@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* *
* the version string like "1.2.3" * the version string like "1.2.3"
*/ */
#define LIBXML_DOTTED_VERSION "2.7.7" #define LIBXML_DOTTED_VERSION "2.7.8"
/** /**
* LIBXML_VERSION: * LIBXML_VERSION:
* *
* the version number: 1.2.3 value is 10203 * the version number: 1.2.3 value is 10203
*/ */
#define LIBXML_VERSION 20707 #define LIBXML_VERSION 20708
/** /**
* LIBXML_VERSION_STRING: * LIBXML_VERSION_STRING:
* *
* the version number string, 1.2.3 value is "10203" * the version number string, 1.2.3 value is "10203"
*/ */
#define LIBXML_VERSION_STRING "20707" #define LIBXML_VERSION_STRING "20708"
/** /**
* LIBXML_VERSION_EXTRA: * LIBXML_VERSION_EXTRA:
* *
* extra version information, used to show a CVS compilation * extra version information, used to show a CVS compilation
*/ */
#define LIBXML_VERSION_EXTRA "-GITv2.7.6-36-g06c93b7" #define LIBXML_VERSION_EXTRA "-GITv2.7.7-40-g82143f4"
/** /**
* LIBXML_TEST_VERSION: * LIBXML_TEST_VERSION:
@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* Macro to check that the libxml version in use is compatible with * Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against * the version the software has been compiled against
*/ */
#define LIBXML_TEST_VERSION xmlCheckVersion(20707); #define LIBXML_TEST_VERSION xmlCheckVersion(20708);
#ifndef VMS #ifndef VMS
#if 0 #if 0
@ -268,6 +268,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#define LIBXML_ICONV_ENABLED #define LIBXML_ICONV_ENABLED
#endif #endif
/**
* LIBXML_ICU_ENABLED:
*
* Whether icu support is available
*/
#if 0
#define LIBXML_ICU_ENABLED
#endif
/** /**
* LIBXML_ISO8859X_ENABLED: * LIBXML_ISO8859X_ENABLED:
* *

View file

@ -268,6 +268,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#define LIBXML_ICONV_ENABLED #define LIBXML_ICONV_ENABLED
#endif #endif
/**
* LIBXML_ICU_ENABLED:
*
* Whether icu support is available
*/
#if @WITH_ICU@
#define LIBXML_ICU_ENABLED
#endif
/** /**
* LIBXML_ISO8859X_ENABLED: * LIBXML_ISO8859X_ENABLED:
* *

View file

@ -2887,9 +2887,11 @@ htmlParseScript(htmlParserCtxtPtr ctxt) {
} }
if ((!(IS_CHAR_CH(cur))) && (!((cur == 0) && (ctxt->progressive)))) { if ((!(IS_CHAR_CH(cur))) && (!((cur == 0) && (ctxt->progressive)))) {
htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR,
"Invalid char in CDATA 0x%X\n", cur); "Invalid char in CDATA 0x%X\n", cur);
NEXT; if (ctxt->input->cur < ctxt->input->end) {
NEXT;
}
} }
if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) {
@ -3275,7 +3277,7 @@ htmlParseCharRef(htmlParserCtxtPtr ctxt) {
val = val * 16 + (CUR - 'A') + 10; val = val * 16 + (CUR - 'A') + 10;
else { else {
htmlParseErr(ctxt, XML_ERR_INVALID_HEX_CHARREF, htmlParseErr(ctxt, XML_ERR_INVALID_HEX_CHARREF,
"htmlParseCharRef: missing semicolumn\n", "htmlParseCharRef: missing semicolon\n",
NULL, NULL); NULL, NULL);
break; break;
} }
@ -3290,7 +3292,7 @@ htmlParseCharRef(htmlParserCtxtPtr ctxt) {
val = val * 10 + (CUR - '0'); val = val * 10 + (CUR - '0');
else { else {
htmlParseErr(ctxt, XML_ERR_INVALID_DEC_CHARREF, htmlParseErr(ctxt, XML_ERR_INVALID_DEC_CHARREF,
"htmlParseCharRef: missing semicolumn\n", "htmlParseCharRef: missing semicolon\n",
NULL, NULL); NULL, NULL);
break; break;
} }
@ -4670,7 +4672,7 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
ctxt->sax->endDocument(ctxt->userData); ctxt->sax->endDocument(ctxt->userData);
if (ctxt->myDoc != NULL) { if ((!(ctxt->options & HTML_PARSE_NODEFDTD)) && (ctxt->myDoc != NULL)) {
dtd = xmlGetIntSubset(ctxt->myDoc); dtd = xmlGetIntSubset(ctxt->myDoc);
if (dtd == NULL) if (dtd == NULL)
ctxt->myDoc->intSubset = ctxt->myDoc->intSubset =
@ -5609,7 +5611,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
int idx; int idx;
xmlChar val; xmlChar val;
idx = htmlParseLookupSequence(ctxt, '<', '/', 0, 0, 1); idx = htmlParseLookupSequence(ctxt, '<', '/', 0, 0, 0);
if (idx < 0) if (idx < 0)
goto done; goto done;
val = in->cur[idx + 2]; val = in->cur[idx + 2];
@ -6451,6 +6453,7 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt)
ctxt->wellFormed = 1; ctxt->wellFormed = 1;
ctxt->nsWellFormed = 1; ctxt->nsWellFormed = 1;
ctxt->disableSAX = 0;
ctxt->valid = 1; ctxt->valid = 1;
ctxt->vctxt.userData = ctxt; ctxt->vctxt.userData = ctxt;
ctxt->vctxt.error = xmlParserValidityError; ctxt->vctxt.error = xmlParserValidityError;
@ -6530,6 +6533,10 @@ htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options)
ctxt->options |= XML_PARSE_HUGE; ctxt->options |= XML_PARSE_HUGE;
options -= XML_PARSE_HUGE; options -= XML_PARSE_HUGE;
} }
if (options & HTML_PARSE_NODEFDTD) {
ctxt->options |= HTML_PARSE_NODEFDTD;
options -= HTML_PARSE_NODEFDTD;
}
ctxt->dictNames = 0; ctxt->dictNames = 0;
return (options); return (options);
} }

View file

@ -1213,9 +1213,9 @@ DOC_MODULE=libxml2-$(VERSION)
EXAMPLES_DIR=$(BASE_DIR)/$(DOC_MODULE)/examples EXAMPLES_DIR=$(BASE_DIR)/$(DOC_MODULE)/examples
install-data-local: install-data-local:
$(mkinstalldirs) $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE) @MKDIR_P@ $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
-@INSTALL@ -m 0644 $(srcdir)/Copyright $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE) -@INSTALL@ -m 0644 $(srcdir)/Copyright $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
$(mkinstalldirs) $(DESTDIR)$(EXAMPLES_DIR) @MKDIR_P@ $(DESTDIR)$(EXAMPLES_DIR)
-@INSTALL@ -m 0644 $(srcdir)/xmllint.c $(DESTDIR)$(EXAMPLES_DIR) -@INSTALL@ -m 0644 $(srcdir)/xmllint.c $(DESTDIR)$(EXAMPLES_DIR)
-@INSTALL@ -m 0644 $(srcdir)/testSAX.c $(DESTDIR)$(EXAMPLES_DIR) -@INSTALL@ -m 0644 $(srcdir)/testSAX.c $(DESTDIR)$(EXAMPLES_DIR)
-@INSTALL@ -m 0644 $(srcdir)/testHTML.c $(DESTDIR)$(EXAMPLES_DIR) -@INSTALL@ -m 0644 $(srcdir)/testHTML.c $(DESTDIR)$(EXAMPLES_DIR)

View file

@ -52,7 +52,7 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/libxml-2.0.pc.in $(srcdir)/libxml.spec.in \ $(srcdir)/libxml-2.0.pc.in $(srcdir)/libxml.spec.in \
$(srcdir)/xml2-config.in $(top_srcdir)/configure AUTHORS \ $(srcdir)/xml2-config.in $(top_srcdir)/configure AUTHORS \
COPYING ChangeLog INSTALL NEWS TODO acconfig.h config.guess \ COPYING ChangeLog INSTALL NEWS TODO acconfig.h config.guess \
config.sub depcomp install-sh ltmain.sh missing mkinstalldirs config.sub depcomp install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
@ -62,7 +62,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = libxml2.spec xml2-config libxml-2.0.pc \ CONFIG_CLEAN_FILES = libxml2.spec xml2-config libxml-2.0.pc \
libxml-2.0-uninstalled.pc libxml-2.0-uninstalled.pc
@ -418,6 +418,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@ PERL = @PERL@
@ -466,6 +467,7 @@ VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@
WGET = @WGET@ WGET = @WGET@
WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@
WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@
WIN32_EXTRA_PYTHON_LIBADD = @WIN32_EXTRA_PYTHON_LIBADD@
WITH_C14N = @WITH_C14N@ WITH_C14N = @WITH_C14N@
WITH_CATALOG = @WITH_CATALOG@ WITH_CATALOG = @WITH_CATALOG@
WITH_DEBUG = @WITH_DEBUG@ WITH_DEBUG = @WITH_DEBUG@
@ -474,6 +476,7 @@ WITH_FTP = @WITH_FTP@
WITH_HTML = @WITH_HTML@ WITH_HTML = @WITH_HTML@
WITH_HTTP = @WITH_HTTP@ WITH_HTTP = @WITH_HTTP@
WITH_ICONV = @WITH_ICONV@ WITH_ICONV = @WITH_ICONV@
WITH_ICU = @WITH_ICU@
WITH_ISO8859X = @WITH_ISO8859X@ WITH_ISO8859X = @WITH_ISO8859X@
WITH_LEGACY = @WITH_LEGACY@ WITH_LEGACY = @WITH_LEGACY@
WITH_MEM_DEBUG = @WITH_MEM_DEBUG@ WITH_MEM_DEBUG = @WITH_MEM_DEBUG@
@ -544,7 +547,6 @@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
localedir = @localedir@ localedir = @localedir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@ mandir = @mandir@
mkdir_p = @mkdir_p@ mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@ oldincludedir = @oldincludedir@
@ -2700,9 +2702,9 @@ xml2Conf.sh: xml2Conf.sh.in Makefile
&& mv xml2Conf.tmp xml2Conf.sh && mv xml2Conf.tmp xml2Conf.sh
install-data-local: install-data-local:
$(mkinstalldirs) $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE) @MKDIR_P@ $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
-@INSTALL@ -m 0644 $(srcdir)/Copyright $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE) -@INSTALL@ -m 0644 $(srcdir)/Copyright $(DESTDIR)$(BASE_DIR)/$(DOC_MODULE)
$(mkinstalldirs) $(DESTDIR)$(EXAMPLES_DIR) @MKDIR_P@ $(DESTDIR)$(EXAMPLES_DIR)
-@INSTALL@ -m 0644 $(srcdir)/xmllint.c $(DESTDIR)$(EXAMPLES_DIR) -@INSTALL@ -m 0644 $(srcdir)/xmllint.c $(DESTDIR)$(EXAMPLES_DIR)
-@INSTALL@ -m 0644 $(srcdir)/testSAX.c $(DESTDIR)$(EXAMPLES_DIR) -@INSTALL@ -m 0644 $(srcdir)/testSAX.c $(DESTDIR)$(EXAMPLES_DIR)
-@INSTALL@ -m 0644 $(srcdir)/testHTML.c $(DESTDIR)$(EXAMPLES_DIR) -@INSTALL@ -m 0644 $(srcdir)/testHTML.c $(DESTDIR)$(EXAMPLES_DIR)

View file

@ -2242,8 +2242,12 @@ xmlSAX2StartElementNs(void *ctx,
if ((URI != NULL) && (prefix == pref)) if ((URI != NULL) && (prefix == pref))
ret->ns = ns; ret->ns = ns;
} else { } else {
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); /*
return; * any out of memory error would already have been raised
* but we can't be garanteed it's the actual error due to the
* API, best is to skip in this case
*/
continue;
} }
#ifdef LIBXML_VALID_ENABLED #ifdef LIBXML_VALID_ENABLED
if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed && if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&

View file

@ -997,18 +997,15 @@ xmlLoadFileContent(const char *filename)
} }
#ifdef HAVE_STAT #ifdef HAVE_STAT
len = read(fd, content, size); len = read(fd, content, size);
close(fd);
#else #else
len = fread(content, 1, size, fd); len = fread(content, 1, size, fd);
fclose(fd);
#endif #endif
if (len < 0) { if (len < 0) {
xmlFree(content); xmlFree(content);
return (NULL); return (NULL);
} }
#ifdef HAVE_STAT
close(fd);
#else
fclose(fd);
#endif
content[len] = 0; content[len] = 0;
return(content); return(content);

View file

@ -274,6 +274,9 @@
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME #undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,5 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(entities.c) AC_INIT(entities.c)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
@ -6,7 +7,7 @@ AC_CANONICAL_HOST
LIBXML_MAJOR_VERSION=2 LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=7 LIBXML_MINOR_VERSION=7
LIBXML_MICRO_VERSION=7 LIBXML_MICRO_VERSION=8
LIBXML_MICRO_VERSION_SUFFIX= LIBXML_MICRO_VERSION_SUFFIX=
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
@ -52,6 +53,7 @@ AM_INIT_AUTOMAKE(libxml2, $VERSION)
dnl Checks for programs. dnl Checks for programs.
AC_PROG_CC AC_PROG_CC
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_PROG_CPP AC_PROG_CPP
AC_PATH_PROG(RM, rm, /bin/rm) AC_PATH_PROG(RM, rm, /bin/rm)
AC_PATH_PROG(MV, mv, /bin/mv) AC_PATH_PROG(MV, mv, /bin/mv)
@ -82,7 +84,7 @@ else
esac esac
fi fi
AC_SUBST(VERSION_SCRIPT_FLAGS) AC_SUBST(VERSION_SCRIPT_FLAGS)
AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"]) AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -z "$VERSION_SCRIPT_FLAGS"])
dnl dnl
dnl We process the AC_ARG_WITH first so that later we can modify dnl We process the AC_ARG_WITH first so that later we can modify
@ -126,6 +128,8 @@ AC_ARG_WITH(http,
[ --with-http add the HTTP support (on)]) [ --with-http add the HTTP support (on)])
AC_ARG_WITH(iconv, AC_ARG_WITH(iconv,
[ --with-iconv[[=DIR]] add ICONV support (on)]) [ --with-iconv[[=DIR]] add ICONV support (on)])
AC_ARG_WITH(icu,
[ --with-icu add ICU support (off)])
AC_ARG_WITH(iso8859x, AC_ARG_WITH(iso8859x,
[ --with-iso8859x add ISO8859X support if no iconv (on)]) [ --with-iso8859x add ISO8859X support if no iconv (on)])
AC_ARG_WITH(legacy, AC_ARG_WITH(legacy,
@ -702,17 +706,23 @@ if test "$with_python" != "no" ; then
echo Found python in $with_python/bin/python echo Found python in $with_python/bin/python
PYTHON="$with_python/bin/python" PYTHON="$with_python/bin/python"
else else
if test -x "$with_python" if test -x "$with_python/python.exe"
then then
echo Found python in $with_python echo Found python in $with_python/python.exe
PYTHON="$with_python" PYTHON="$with_python/python.exe"
else else
if test -x "$PYTHON" if test -x "$with_python"
then then
echo Found python in environment PYTHON=$PYTHON echo Found python in $with_python
with_python=`$PYTHON -c "import sys; print sys.exec_prefix"` PYTHON="$with_python"
else else
AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5) if test -x "$PYTHON"
then
echo Found python in environment PYTHON=$PYTHON
with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
else
AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
fi
fi fi
fi fi
fi fi
@ -739,7 +749,14 @@ if test "$with_python" != "no" ; then
PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else else
echo could not find python$PYTHON_VERSION/Python.h if test -r $with_python/include/Python.h -a \
-d $with_python/lib/site-packages
then
PYTHON_INCLUDES=$with_python/include
PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
else
echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
fi
fi fi
fi fi
if test ! -d "$PYTHON_SITE_PACKAGES" if test ! -d "$PYTHON_SITE_PACKAGES"
@ -1306,6 +1323,23 @@ XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
XML_LIBTOOLLIBS="libxml2.la" XML_LIBTOOLLIBS="libxml2.la"
AC_SUBST(WITH_ICONV) AC_SUBST(WITH_ICONV)
WITH_ICU=0
if test "$with_icu" != "yes" ; then
echo Disabling ICU support
else
ICU_CONFIG=icu-config
if ${ICU_CONFIG} --cflags >/dev/null 2>&1
then
ICU_LIBS=`icu-config --ldflags`
LDFLAGS="$LDFLAGS $ICU_LIBS"
WITH_ICU=1
echo Enabling ICU support
else
AC_MSG_ERROR([libicu config program icu-config not found])
fi
fi
AC_SUBST(WITH_ICU)
WITH_ISO8859X=1 WITH_ISO8859X=1
if test "$WITH_ICONV" != "1" ; then if test "$WITH_ICONV" != "1" ; then
if test "$with_iso8859x" = "no" ; then if test "$with_iso8859x" = "no" ; then
@ -1395,6 +1429,7 @@ WIN32_EXTRA_LIBADD=
WIN32_EXTRA_LDFLAGS= WIN32_EXTRA_LDFLAGS=
CYGWIN_EXTRA_LDFLAGS= CYGWIN_EXTRA_LDFLAGS=
CYGWIN_EXTRA_PYTHON_LIBADD= CYGWIN_EXTRA_PYTHON_LIBADD=
WIN32_EXTRA_PYTHON_LIBADD=
case "$host" in case "$host" in
*-*-mingw*) *-*-mingw*)
CPPFLAGS="$CPPFLAGS -DWIN32" CPPFLAGS="$CPPFLAGS -DWIN32"
@ -1403,6 +1438,10 @@ case "$host" in
AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation]) AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around]) AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around]) AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
if test "${PYTHON}" != ""
then
WIN32_EXTRA_PYTHON_LIBADD="-L${pythondir}/../../libs -lpython${PYTHON_VERSION//./}"
fi
;; ;;
*-*-cygwin*) *-*-cygwin*)
CYGWIN_EXTRA_LDFLAGS="-no-undefined" CYGWIN_EXTRA_LDFLAGS="-no-undefined"
@ -1414,6 +1453,7 @@ case "$host" in
esac esac
AC_SUBST(WIN32_EXTRA_LIBADD) AC_SUBST(WIN32_EXTRA_LIBADD)
AC_SUBST(WIN32_EXTRA_LDFLAGS) AC_SUBST(WIN32_EXTRA_LDFLAGS)
AC_SUBST(WIN32_EXTRA_PYTHON_LIBADD)
AC_SUBST(CYGWIN_EXTRA_LDFLAGS) AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD) AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)

View file

@ -2941,7 +2941,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Write command requires a filename argument\n"); "Write command requires a filename argument\n");
else else
xmlShellWrite(ctxt, arg, NULL, NULL); xmlShellWrite(ctxt, arg, ctxt->node, NULL);
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
} else if (!strcmp(command, "grep")) { } else if (!strcmp(command, "grep")) {
xmlShellGrep(ctxt, arg, ctxt->node, NULL); xmlShellGrep(ctxt, arg, ctxt->node, NULL);

File diff suppressed because it is too large Load diff

View file

@ -42,7 +42,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
@ -166,6 +166,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@ PERL = @PERL@
@ -214,6 +215,7 @@ VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@
WGET = @WGET@ WGET = @WGET@
WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@ WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@
WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@ WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@
WIN32_EXTRA_PYTHON_LIBADD = @WIN32_EXTRA_PYTHON_LIBADD@
WITH_C14N = @WITH_C14N@ WITH_C14N = @WITH_C14N@
WITH_CATALOG = @WITH_CATALOG@ WITH_CATALOG = @WITH_CATALOG@
WITH_DEBUG = @WITH_DEBUG@ WITH_DEBUG = @WITH_DEBUG@
@ -222,6 +224,7 @@ WITH_FTP = @WITH_FTP@
WITH_HTML = @WITH_HTML@ WITH_HTML = @WITH_HTML@
WITH_HTTP = @WITH_HTTP@ WITH_HTTP = @WITH_HTTP@
WITH_ICONV = @WITH_ICONV@ WITH_ICONV = @WITH_ICONV@
WITH_ICU = @WITH_ICU@
WITH_ISO8859X = @WITH_ISO8859X@ WITH_ISO8859X = @WITH_ISO8859X@
WITH_LEGACY = @WITH_LEGACY@ WITH_LEGACY = @WITH_LEGACY@
WITH_MEM_DEBUG = @WITH_MEM_DEBUG@ WITH_MEM_DEBUG = @WITH_MEM_DEBUG@
@ -292,7 +295,6 @@ libdir = @libdir@
libexecdir = @libexecdir@ libexecdir = @libexecdir@
localedir = @localedir@ localedir = @localedir@
localstatedir = @localstatedir@ localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@ mandir = @mandir@
mkdir_p = @mkdir_p@ mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@ oldincludedir = @oldincludedir@

View file

@ -1,6 +1,6 @@
Summary: Library providing XML and HTML support Summary: Library providing XML and HTML support
Name: libxml2 Name: libxml2
Version: 2.7.7 Version: 2.7.8
Release: 1 Release: 1
License: MIT License: MIT
Group: Development/Libraries Group: Development/Libraries
@ -127,6 +127,6 @@ rm -fr %{buildroot}
%doc doc/python.html %doc doc/python.html
%changelog %changelog
* Mon Mar 15 2010 Daniel Veillard <veillard@redhat.com> * Thu Nov 4 2010 Daniel Veillard <veillard@redhat.com>
- upstream release 2.7.7 see http://xmlsoft.org/news.html - upstream release 2.7.8 see http://xmlsoft.org/news.html

File diff suppressed because it is too large Load diff

View file

@ -78,7 +78,9 @@
#if defined(__MINGW32__) || defined(_WIN32_WCE) #if defined(__MINGW32__) || defined(_WIN32_WCE)
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_ #define _WINSOCKAPI_
#endif
#include <wsockcompat.h> #include <wsockcompat.h>
#include <winsock2.h> #include <winsock2.h>
#undef XML_SOCKLEN_T #undef XML_SOCKLEN_T
@ -92,7 +94,6 @@
#if !defined(__BEOS__) || defined(__HAIKU__) #if !defined(__BEOS__) || defined(__HAIKU__)
#define closesocket(s) close(s) #define closesocket(s) close(s)
#endif #endif
#define SOCKET int
#endif #endif
#ifdef __BEOS__ #ifdef __BEOS__
@ -484,7 +485,7 @@ xmlNanoFTPNewCtxt(const char *URL) {
ret->returnValue = 0; ret->returnValue = 0;
ret->controlBufIndex = 0; ret->controlBufIndex = 0;
ret->controlBufUsed = 0; ret->controlBufUsed = 0;
ret->controlFd = -1; ret->controlFd = INVALID_SOCKET;
unescaped = xmlURIUnescapeString(URL, 0, NULL); unescaped = xmlURIUnescapeString(URL, 0, NULL);
if (unescaped != NULL) { if (unescaped != NULL) {
@ -511,8 +512,8 @@ xmlNanoFTPFreeCtxt(void * ctx) {
if (ctxt->protocol != NULL) xmlFree(ctxt->protocol); if (ctxt->protocol != NULL) xmlFree(ctxt->protocol);
if (ctxt->path != NULL) xmlFree(ctxt->path); if (ctxt->path != NULL) xmlFree(ctxt->path);
ctxt->passive = 1; ctxt->passive = 1;
if (ctxt->controlFd >= 0) closesocket(ctxt->controlFd); if (ctxt->controlFd != INVALID_SOCKET) closesocket(ctxt->controlFd);
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
ctxt->controlBufIndex = -1; ctxt->controlBufIndex = -1;
ctxt->controlBufUsed = -1; ctxt->controlBufUsed = -1;
xmlFree(ctxt); xmlFree(ctxt);
@ -567,7 +568,7 @@ xmlNanoFTPGetMore(void *ctx) {
int len; int len;
int size; int size;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
if ((ctxt->controlBufIndex < 0) || (ctxt->controlBufIndex > FTP_BUF_SIZE)) { if ((ctxt->controlBufIndex < 0) || (ctxt->controlBufIndex > FTP_BUF_SIZE)) {
#ifdef DEBUG_FTP #ifdef DEBUG_FTP
@ -619,8 +620,8 @@ xmlNanoFTPGetMore(void *ctx) {
if ((len = recv(ctxt->controlFd, &ctxt->controlBuf[ctxt->controlBufIndex], if ((len = recv(ctxt->controlFd, &ctxt->controlBuf[ctxt->controlBufIndex],
size, 0)) < 0) { size, 0)) < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "recv failed"); __xmlIOErr(XML_FROM_FTP, 0, "recv failed");
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
#ifdef DEBUG_FTP #ifdef DEBUG_FTP
@ -648,7 +649,7 @@ xmlNanoFTPReadResponse(void *ctx) {
int len; int len;
int res = -1, cur = -1; int res = -1, cur = -1;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
get_more: get_more:
/* /*
@ -737,7 +738,7 @@ xmlNanoFTPCheckResponse(void *ctx) {
fd_set rfd; fd_set rfd;
struct timeval tv; struct timeval tv;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_usec = 0; tv.tv_usec = 0;
FD_ZERO(&rfd); FD_ZERO(&rfd);
@ -826,7 +827,7 @@ xmlNanoFTPQuit(void *ctx) {
char buf[200]; char buf[200];
int len, res; int len, res;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
snprintf(buf, sizeof(buf), "QUIT\r\n"); snprintf(buf, sizeof(buf), "QUIT\r\n");
len = strlen(buf); len = strlen(buf);
@ -951,7 +952,7 @@ xmlNanoFTPConnect(void *ctx) {
addrlen = sizeof (struct sockaddr_in); addrlen = sizeof (struct sockaddr_in);
} }
if (ctxt->controlFd < 0) { if (ctxt->controlFd == INVALID_SOCKET) {
__xmlIOErr(XML_FROM_FTP, 0, "socket failed"); __xmlIOErr(XML_FROM_FTP, 0, "socket failed");
return(-1); return(-1);
} }
@ -962,8 +963,8 @@ xmlNanoFTPConnect(void *ctx) {
if (connect(ctxt->controlFd, (struct sockaddr *) &ctxt->ftpAddr, if (connect(ctxt->controlFd, (struct sockaddr *) &ctxt->ftpAddr,
addrlen) < 0) { addrlen) < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "Failed to create a connection"); __xmlIOErr(XML_FROM_FTP, 0, "Failed to create a connection");
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
@ -972,8 +973,8 @@ xmlNanoFTPConnect(void *ctx) {
*/ */
res = xmlNanoFTPGetResponse(ctxt); res = xmlNanoFTPGetResponse(ctxt);
if (res != 2) { if (res != 2) {
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
@ -1030,7 +1031,7 @@ xmlNanoFTPConnect(void *ctx) {
if (res < 0) { if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed"); __xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->controlFd); closesocket(ctxt->controlFd);
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(res); return(res);
} }
res = xmlNanoFTPGetResponse(ctxt); res = xmlNanoFTPGetResponse(ctxt);
@ -1052,13 +1053,13 @@ xmlNanoFTPConnect(void *ctx) {
if (res < 0) { if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed"); __xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->controlFd); closesocket(ctxt->controlFd);
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(res); return(res);
} }
res = xmlNanoFTPGetResponse(ctxt); res = xmlNanoFTPGetResponse(ctxt);
if (res > 3) { if (res > 3) {
closesocket(ctxt->controlFd); closesocket(ctxt->controlFd);
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
break; break;
@ -1069,7 +1070,7 @@ xmlNanoFTPConnect(void *ctx) {
case -1: case -1:
default: default:
closesocket(ctxt->controlFd); closesocket(ctxt->controlFd);
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
} }
@ -1092,8 +1093,8 @@ xmlNanoFTPConnect(void *ctx) {
res = send(ctxt->controlFd, buf, len, 0); res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) { if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed"); __xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(res); return(res);
} }
res = xmlNanoFTPGetResponse(ctxt); res = xmlNanoFTPGetResponse(ctxt);
@ -1103,8 +1104,8 @@ xmlNanoFTPConnect(void *ctx) {
break; break;
} }
if (proxyType == 1) { if (proxyType == 1) {
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
case 2: case 2:
@ -1123,8 +1124,8 @@ xmlNanoFTPConnect(void *ctx) {
res = send(ctxt->controlFd, buf, len, 0); res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) { if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed"); __xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(res); return(res);
} }
res = xmlNanoFTPGetResponse(ctxt); res = xmlNanoFTPGetResponse(ctxt);
@ -1145,8 +1146,8 @@ xmlNanoFTPConnect(void *ctx) {
res = send(ctxt->controlFd, buf, len, 0); res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) { if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed"); __xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(res); return(res);
} }
res = xmlNanoFTPGetResponse(ctxt); res = xmlNanoFTPGetResponse(ctxt);
@ -1156,8 +1157,8 @@ xmlNanoFTPConnect(void *ctx) {
return(0); return(0);
} }
if (proxyType == 2) { if (proxyType == 2) {
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
case 3: case 3:
@ -1166,8 +1167,8 @@ xmlNanoFTPConnect(void *ctx) {
* send the code or at least the sequence in use. * send the code or at least the sequence in use.
*/ */
default: default:
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
} }
@ -1176,8 +1177,8 @@ xmlNanoFTPConnect(void *ctx) {
*/ */
res = xmlNanoFTPSendUser(ctxt); res = xmlNanoFTPSendUser(ctxt);
if (res < 0) { if (res < 0) {
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
res = xmlNanoFTPGetResponse(ctxt); res = xmlNanoFTPGetResponse(ctxt);
@ -1191,14 +1192,14 @@ xmlNanoFTPConnect(void *ctx) {
case 5: case 5:
case -1: case -1:
default: default:
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
res = xmlNanoFTPSendPasswd(ctxt); res = xmlNanoFTPSendPasswd(ctxt);
if (res < 0) { if (res < 0) {
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
res = xmlNanoFTPGetResponse(ctxt); res = xmlNanoFTPGetResponse(ctxt);
@ -1213,8 +1214,8 @@ xmlNanoFTPConnect(void *ctx) {
case 5: case 5:
case -1: case -1:
default: default:
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
@ -1270,7 +1271,7 @@ xmlNanoFTPCwd(void *ctx, const char *directory) {
int len; int len;
int res; int res;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
if (directory == NULL) return 0; if (directory == NULL) return 0;
/* /*
@ -1319,7 +1320,7 @@ xmlNanoFTPDele(void *ctx, const char *file) {
int len; int len;
int res; int res;
if ((ctxt == NULL) || (ctxt->controlFd < 0) || (file == NULL)) return(-1); if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET) || (file == NULL)) return(-1);
if (file == NULL) return (0); if (file == NULL) return (0);
/* /*
@ -1362,7 +1363,7 @@ xmlNanoFTPDele(void *ctx, const char *file) {
* Returns -1 incase of error, 0 otherwise * Returns -1 incase of error, 0 otherwise
*/ */
int SOCKET
xmlNanoFTPGetConnection(void *ctx) { xmlNanoFTPGetConnection(void *ctx) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
char buf[200], *cur; char buf[200], *cur;
@ -1377,7 +1378,7 @@ xmlNanoFTPGetConnection(void *ctx) {
#endif #endif
XML_SOCKLEN_T dataAddrLen; XML_SOCKLEN_T dataAddrLen;
if (ctxt == NULL) return(-1); if (ctxt == NULL) return INVALID_SOCKET;
memset (&dataAddr, 0, sizeof(dataAddr)); memset (&dataAddr, 0, sizeof(dataAddr));
#ifdef SUPPORT_IP6 #ifdef SUPPORT_IP6
@ -1393,9 +1394,9 @@ xmlNanoFTPGetConnection(void *ctx) {
dataAddrLen = sizeof (struct sockaddr_in); dataAddrLen = sizeof (struct sockaddr_in);
} }
if (ctxt->dataFd < 0) { if (ctxt->dataFd == INVALID_SOCKET) {
__xmlIOErr(XML_FROM_FTP, 0, "socket failed"); __xmlIOErr(XML_FROM_FTP, 0, "socket failed");
return (-1); return INVALID_SOCKET;
} }
if (ctxt->passive) { if (ctxt->passive) {
@ -1412,19 +1413,19 @@ xmlNanoFTPGetConnection(void *ctx) {
res = send(ctxt->controlFd, buf, len, 0); res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) { if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed"); __xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(res); return INVALID_SOCKET;
} }
res = xmlNanoFTPReadResponse(ctx); res = xmlNanoFTPReadResponse(ctx);
if (res != 2) { if (res != 2) {
if (res == 5) { if (res == 5) {
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(-1); return INVALID_SOCKET;
} else { } else {
/* /*
* retry with an active connection * retry with an active connection
*/ */
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
ctxt->passive = 0; ctxt->passive = 0;
} }
} }
@ -1435,10 +1436,10 @@ xmlNanoFTPGetConnection(void *ctx) {
if (sscanf (cur, "%u", &temp[0]) != 1) { if (sscanf (cur, "%u", &temp[0]) != 1) {
__xmlIOErr(XML_FROM_FTP, XML_FTP_EPSV_ANSWER, __xmlIOErr(XML_FROM_FTP, XML_FTP_EPSV_ANSWER,
"Invalid answer to EPSV\n"); "Invalid answer to EPSV\n");
if (ctxt->dataFd != -1) { if (ctxt->dataFd != INVALID_SOCKET) {
closesocket (ctxt->dataFd); ctxt->dataFd = -1; closesocket (ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
} }
return (-1); return INVALID_SOCKET;
} }
memcpy (&((struct sockaddr_in6 *)&dataAddr)->sin6_addr, &((struct sockaddr_in6 *)&ctxt->ftpAddr)->sin6_addr, sizeof(struct in6_addr)); memcpy (&((struct sockaddr_in6 *)&dataAddr)->sin6_addr, &((struct sockaddr_in6 *)&ctxt->ftpAddr)->sin6_addr, sizeof(struct in6_addr));
((struct sockaddr_in6 *)&dataAddr)->sin6_port = htons (temp[0]); ((struct sockaddr_in6 *)&dataAddr)->sin6_port = htons (temp[0]);
@ -1450,10 +1451,10 @@ xmlNanoFTPGetConnection(void *ctx) {
&temp[3], &temp[4], &temp[5]) != 6) { &temp[3], &temp[4], &temp[5]) != 6) {
__xmlIOErr(XML_FROM_FTP, XML_FTP_PASV_ANSWER, __xmlIOErr(XML_FROM_FTP, XML_FTP_PASV_ANSWER,
"Invalid answer to PASV\n"); "Invalid answer to PASV\n");
if (ctxt->dataFd != -1) { if (ctxt->dataFd != INVALID_SOCKET) {
closesocket (ctxt->dataFd); ctxt->dataFd = -1; closesocket (ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
} }
return (-1); return INVALID_SOCKET;
} }
for (i=0; i<6; i++) ad[i] = (unsigned char) (temp[i] & 0xff); for (i=0; i<6; i++) ad[i] = (unsigned char) (temp[i] & 0xff);
memcpy (&((struct sockaddr_in *)&dataAddr)->sin_addr, &ad[0], 4); memcpy (&((struct sockaddr_in *)&dataAddr)->sin_addr, &ad[0], 4);
@ -1462,8 +1463,8 @@ xmlNanoFTPGetConnection(void *ctx) {
if (connect(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) { if (connect(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "Failed to create a data connection"); __xmlIOErr(XML_FROM_FTP, 0, "Failed to create a data connection");
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return (-1); return INVALID_SOCKET;
} }
} else { } else {
getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen); getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen);
@ -1476,15 +1477,15 @@ xmlNanoFTPGetConnection(void *ctx) {
if (bind(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) { if (bind(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "bind failed"); __xmlIOErr(XML_FROM_FTP, 0, "bind failed");
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return (-1); return INVALID_SOCKET;
} }
getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen); getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen);
if (listen(ctxt->dataFd, 1) < 0) { if (listen(ctxt->dataFd, 1) < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "listen failed"); __xmlIOErr(XML_FROM_FTP, 0, "listen failed");
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return (-1); return INVALID_SOCKET;
} }
#ifdef SUPPORT_IP6 #ifdef SUPPORT_IP6
if ((ctxt->ftpAddr).ss_family == AF_INET6) { if ((ctxt->ftpAddr).ss_family == AF_INET6) {
@ -1513,13 +1514,13 @@ xmlNanoFTPGetConnection(void *ctx) {
res = send(ctxt->controlFd, buf, len, 0); res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) { if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed"); __xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(res); return INVALID_SOCKET;
} }
res = xmlNanoFTPGetResponse(ctxt); res = xmlNanoFTPGetResponse(ctxt);
if (res != 2) { if (res != 2) {
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(-1); return INVALID_SOCKET;
} }
} }
return(ctxt->dataFd); return(ctxt->dataFd);
@ -1542,9 +1543,9 @@ xmlNanoFTPCloseConnection(void *ctx) {
fd_set rfd, efd; fd_set rfd, efd;
struct timeval tv; struct timeval tv;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1);
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
tv.tv_sec = 15; tv.tv_sec = 15;
tv.tv_usec = 0; tv.tv_usec = 0;
FD_ZERO(&rfd); FD_ZERO(&rfd);
@ -1556,7 +1557,7 @@ xmlNanoFTPCloseConnection(void *ctx) {
#ifdef DEBUG_FTP #ifdef DEBUG_FTP
perror("select"); perror("select");
#endif #endif
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
if (res == 0) { if (res == 0) {
@ -1564,11 +1565,11 @@ xmlNanoFTPCloseConnection(void *ctx) {
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"xmlNanoFTPCloseConnection: timeout\n"); "xmlNanoFTPCloseConnection: timeout\n");
#endif #endif
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
} else { } else {
res = xmlNanoFTPGetResponse(ctxt); res = xmlNanoFTPGetResponse(ctxt);
if (res != 2) { if (res != 2) {
closesocket(ctxt->controlFd); ctxt->controlFd = -1; closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
return(-1); return(-1);
} }
} }
@ -1729,7 +1730,7 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
if (xmlNanoFTPCwd(ctxt, ctxt->path) < 1) if (xmlNanoFTPCwd(ctxt, ctxt->path) < 1)
return(-1); return(-1);
ctxt->dataFd = xmlNanoFTPGetConnection(ctxt); ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
if (ctxt->dataFd == -1) if (ctxt->dataFd == INVALID_SOCKET)
return(-1); return(-1);
snprintf(buf, sizeof(buf), "LIST -L\r\n"); snprintf(buf, sizeof(buf), "LIST -L\r\n");
} else { } else {
@ -1738,7 +1739,7 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
return(-1); return(-1);
} }
ctxt->dataFd = xmlNanoFTPGetConnection(ctxt); ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
if (ctxt->dataFd == -1) if (ctxt->dataFd == INVALID_SOCKET)
return(-1); return(-1);
snprintf(buf, sizeof(buf), "LIST -L %s\r\n", filename); snprintf(buf, sizeof(buf), "LIST -L %s\r\n", filename);
} }
@ -1750,12 +1751,12 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
res = send(ctxt->controlFd, buf, len, 0); res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) { if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed"); __xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(res); return(res);
} }
res = xmlNanoFTPReadResponse(ctxt); res = xmlNanoFTPReadResponse(ctxt);
if (res != 1) { if (res != 1) {
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(-res); return(-res);
} }
@ -1771,18 +1772,18 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
#ifdef DEBUG_FTP #ifdef DEBUG_FTP
perror("select"); perror("select");
#endif #endif
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(-1); return(-1);
} }
if (res == 0) { if (res == 0) {
res = xmlNanoFTPCheckResponse(ctxt); res = xmlNanoFTPCheckResponse(ctxt);
if (res < 0) { if (res < 0) {
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
ctxt->dataFd = -1; ctxt->dataFd = INVALID_SOCKET;
return(-1); return(-1);
} }
if (res == 2) { if (res == 2) {
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(0); return(0);
} }
@ -1791,8 +1792,8 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
if ((len = recv(ctxt->dataFd, &buf[indx], sizeof(buf) - (indx + 1), 0)) < 0) { if ((len = recv(ctxt->dataFd, &buf[indx], sizeof(buf) - (indx + 1), 0)) < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "recv"); __xmlIOErr(XML_FROM_FTP, 0, "recv");
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
ctxt->dataFd = -1; ctxt->dataFd = INVALID_SOCKET;
return(-1); return(-1);
} }
#ifdef DEBUG_FTP #ifdef DEBUG_FTP
@ -1824,18 +1825,18 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
*/ */
int SOCKET
xmlNanoFTPGetSocket(void *ctx, const char *filename) { xmlNanoFTPGetSocket(void *ctx, const char *filename) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
char buf[300]; char buf[300];
int res, len; int res, len;
if (ctx == NULL) if (ctx == NULL)
return(-1); return INVALID_SOCKET;
if ((filename == NULL) && (ctxt->path == NULL)) if ((filename == NULL) && (ctxt->path == NULL))
return(-1); return INVALID_SOCKET;
ctxt->dataFd = xmlNanoFTPGetConnection(ctxt); ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
if (ctxt->dataFd == -1) if (ctxt->dataFd == INVALID_SOCKET)
return(-1); return INVALID_SOCKET;
snprintf(buf, sizeof(buf), "TYPE I\r\n"); snprintf(buf, sizeof(buf), "TYPE I\r\n");
len = strlen(buf); len = strlen(buf);
@ -1845,13 +1846,13 @@ xmlNanoFTPGetSocket(void *ctx, const char *filename) {
res = send(ctxt->controlFd, buf, len, 0); res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) { if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed"); __xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(res); return INVALID_SOCKET;
} }
res = xmlNanoFTPReadResponse(ctxt); res = xmlNanoFTPReadResponse(ctxt);
if (res != 2) { if (res != 2) {
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(-res); return INVALID_SOCKET;
} }
if (filename == NULL) if (filename == NULL)
snprintf(buf, sizeof(buf), "RETR %s\r\n", ctxt->path); snprintf(buf, sizeof(buf), "RETR %s\r\n", ctxt->path);
@ -1865,13 +1866,13 @@ xmlNanoFTPGetSocket(void *ctx, const char *filename) {
res = send(ctxt->controlFd, buf, len, 0); res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) { if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed"); __xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(res); return INVALID_SOCKET;
} }
res = xmlNanoFTPReadResponse(ctxt); res = xmlNanoFTPReadResponse(ctxt);
if (res != 1) { if (res != 1) {
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(-res); return INVALID_SOCKET;
} }
return(ctxt->dataFd); return(ctxt->dataFd);
} }
@ -1903,7 +1904,7 @@ xmlNanoFTPGet(void *ctx, ftpDataCallback callback, void *userData,
return(-1); return(-1);
if (callback == NULL) if (callback == NULL)
return(-1); return(-1);
if (xmlNanoFTPGetSocket(ctxt, filename) < 0) if (xmlNanoFTPGetSocket(ctxt, filename) == INVALID_SOCKET)
return(-1); return(-1);
do { do {
@ -1916,18 +1917,18 @@ xmlNanoFTPGet(void *ctx, ftpDataCallback callback, void *userData,
#ifdef DEBUG_FTP #ifdef DEBUG_FTP
perror("select"); perror("select");
#endif #endif
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(-1); return(-1);
} }
if (res == 0) { if (res == 0) {
res = xmlNanoFTPCheckResponse(ctxt); res = xmlNanoFTPCheckResponse(ctxt);
if (res < 0) { if (res < 0) {
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
ctxt->dataFd = -1; ctxt->dataFd = INVALID_SOCKET;
return(-1); return(-1);
} }
if (res == 2) { if (res == 2) {
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(0); return(0);
} }
@ -1936,7 +1937,7 @@ xmlNanoFTPGet(void *ctx, ftpDataCallback callback, void *userData,
if ((len = recv(ctxt->dataFd, buf, sizeof(buf), 0)) < 0) { if ((len = recv(ctxt->dataFd, buf, sizeof(buf), 0)) < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "recv failed"); __xmlIOErr(XML_FROM_FTP, 0, "recv failed");
callback(userData, buf, len); callback(userData, buf, len);
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
return(-1); return(-1);
} }
callback(userData, buf, len); callback(userData, buf, len);
@ -1962,7 +1963,7 @@ xmlNanoFTPRead(void *ctx, void *dest, int len) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
if (ctx == NULL) return(-1); if (ctx == NULL) return(-1);
if (ctxt->dataFd < 0) return(0); if (ctxt->dataFd == INVALID_SOCKET) return(0);
if (dest == NULL) return(-1); if (dest == NULL) return(-1);
if (len <= 0) return(0); if (len <= 0) return(0);
@ -1990,7 +1991,7 @@ xmlNanoFTPRead(void *ctx, void *dest, int len) {
void* void*
xmlNanoFTPOpen(const char *URL) { xmlNanoFTPOpen(const char *URL) {
xmlNanoFTPCtxtPtr ctxt; xmlNanoFTPCtxtPtr ctxt;
int sock; SOCKET sock;
xmlNanoFTPInit(); xmlNanoFTPInit();
if (URL == NULL) return(NULL); if (URL == NULL) return(NULL);
@ -2003,7 +2004,7 @@ xmlNanoFTPOpen(const char *URL) {
return(NULL); return(NULL);
} }
sock = xmlNanoFTPGetSocket(ctxt, ctxt->path); sock = xmlNanoFTPGetSocket(ctxt, ctxt->path);
if (sock < 0) { if (sock == INVALID_SOCKET) {
xmlNanoFTPFreeCtxt(ctxt); xmlNanoFTPFreeCtxt(ctxt);
return(NULL); return(NULL);
} }
@ -2026,14 +2027,14 @@ xmlNanoFTPClose(void *ctx) {
if (ctxt == NULL) if (ctxt == NULL)
return(-1); return(-1);
if (ctxt->dataFd >= 0) { if (ctxt->dataFd != INVALID_SOCKET) {
closesocket(ctxt->dataFd); closesocket(ctxt->dataFd);
ctxt->dataFd = -1; ctxt->dataFd = INVALID_SOCKET;
} }
if (ctxt->controlFd >= 0) { if (ctxt->controlFd != INVALID_SOCKET) {
xmlNanoFTPQuit(ctxt); xmlNanoFTPQuit(ctxt);
closesocket(ctxt->controlFd); closesocket(ctxt->controlFd);
ctxt->controlFd = -1; ctxt->controlFd = INVALID_SOCKET;
} }
xmlNanoFTPFreeCtxt(ctxt); xmlNanoFTPFreeCtxt(ctxt);
return(0); return(0);

View file

@ -75,18 +75,18 @@
#ifdef VMS #ifdef VMS
#include <stropts> #include <stropts>
#define XML_SOCKLEN_T unsigned int #define XML_SOCKLEN_T unsigned int
#define SOCKET int
#endif #endif
#if defined(__MINGW32__) || defined(_WIN32_WCE) #if defined(__MINGW32__) || defined(_WIN32_WCE)
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_ #define _WINSOCKAPI_
#endif
#include <wsockcompat.h> #include <wsockcompat.h>
#include <winsock2.h> #include <winsock2.h>
#undef XML_SOCKLEN_T #undef XML_SOCKLEN_T
#define XML_SOCKLEN_T unsigned int #define XML_SOCKLEN_T unsigned int
#endif #endif
#include <libxml/globals.h> #include <libxml/globals.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
@ -103,6 +103,7 @@
#define closesocket(s) close(s) #define closesocket(s) close(s)
#endif #endif
#define SOCKET int #define SOCKET int
#define INVALID_SOCKET (-1)
#endif #endif
#ifdef __BEOS__ #ifdef __BEOS__
@ -114,9 +115,6 @@
#ifndef XML_SOCKLEN_T #ifndef XML_SOCKLEN_T
#define XML_SOCKLEN_T unsigned int #define XML_SOCKLEN_T unsigned int
#endif #endif
#ifndef SOCKET
#define SOCKET int
#endif
#ifdef STANDALONE #ifdef STANDALONE
#define DEBUG_HTTP #define DEBUG_HTTP
@ -196,10 +194,10 @@ static int socket_errno(void) {
#ifdef SUPPORT_IP6 #ifdef SUPPORT_IP6
static static
int have_ipv6(void) { int have_ipv6(void) {
int s; SOCKET s;
s = socket (AF_INET6, SOCK_STREAM, 0); s = socket (AF_INET6, SOCK_STREAM, 0);
if (s != -1) { if (s != INVALID_SOCKET) {
close (s); close (s);
return (1); return (1);
} }
@ -393,7 +391,7 @@ xmlNanoHTTPNewCtxt(const char *URL) {
memset(ret, 0, sizeof(xmlNanoHTTPCtxt)); memset(ret, 0, sizeof(xmlNanoHTTPCtxt));
ret->port = 80; ret->port = 80;
ret->returnValue = 0; ret->returnValue = 0;
ret->fd = -1; ret->fd = INVALID_SOCKET;
ret->ContentLength = -1; ret->ContentLength = -1;
xmlNanoHTTPScanURL(ret, URL); xmlNanoHTTPScanURL(ret, URL);
@ -430,8 +428,8 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) {
#endif #endif
ctxt->state = XML_NANO_HTTP_NONE; ctxt->state = XML_NANO_HTTP_NONE;
if (ctxt->fd >= 0) closesocket(ctxt->fd); if (ctxt->fd != INVALID_SOCKET) closesocket(ctxt->fd);
ctxt->fd = -1; ctxt->fd = INVALID_SOCKET;
xmlFree(ctxt); xmlFree(ctxt);
} }
@ -842,7 +840,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) {
* Returns -1 in case of failure, the file descriptor number otherwise * Returns -1 in case of failure, the file descriptor number otherwise
*/ */
static int static SOCKET
xmlNanoHTTPConnectAttempt(struct sockaddr *addr) xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
{ {
#ifndef HAVE_POLL_H #ifndef HAVE_POLL_H
@ -870,12 +868,12 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
addrlen = sizeof(struct sockaddr_in); addrlen = sizeof(struct sockaddr_in);
} }
if (s == -1) { if (s == INVALID_SOCKET) {
#ifdef DEBUG_HTTP #ifdef DEBUG_HTTP
perror("socket"); perror("socket");
#endif #endif
__xmlIOErr(XML_FROM_HTTP, 0, "socket failed\n"); __xmlIOErr(XML_FROM_HTTP, 0, "socket failed\n");
return (-1); return INVALID_SOCKET;
} }
#ifdef _WINSOCKAPI_ #ifdef _WINSOCKAPI_
{ {
@ -916,7 +914,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
#endif #endif
__xmlIOErr(XML_FROM_HTTP, 0, "error setting non-blocking IO\n"); __xmlIOErr(XML_FROM_HTTP, 0, "error setting non-blocking IO\n");
closesocket(s); closesocket(s);
return (-1); return INVALID_SOCKET;
} }
#endif /* !__BEOS__ */ #endif /* !__BEOS__ */
#endif /* !VMS */ #endif /* !VMS */
@ -931,7 +929,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
__xmlIOErr(XML_FROM_HTTP, 0, __xmlIOErr(XML_FROM_HTTP, 0,
"error connecting to HTTP server"); "error connecting to HTTP server");
closesocket(s); closesocket(s);
return (-1); return INVALID_SOCKET;
} }
} }
#ifndef HAVE_POLL_H #ifndef HAVE_POLL_H
@ -944,7 +942,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
#endif #endif
#ifndef _WINSOCKAPI_ #ifndef _WINSOCKAPI_
if (s > FD_SETSIZE) if (s > FD_SETSIZE)
return -1; return INVALID_SOCKET;
#endif #endif
FD_ZERO(&wfd); FD_ZERO(&wfd);
FD_SET(s, &wfd); FD_SET(s, &wfd);
@ -972,12 +970,12 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
/* Time out */ /* Time out */
__xmlIOErr(XML_FROM_HTTP, 0, "Connect attempt timed out"); __xmlIOErr(XML_FROM_HTTP, 0, "Connect attempt timed out");
closesocket(s); closesocket(s);
return (-1); return INVALID_SOCKET;
case -1: case -1:
/* Ermm.. ?? */ /* Ermm.. ?? */
__xmlIOErr(XML_FROM_HTTP, 0, "Connect failed"); __xmlIOErr(XML_FROM_HTTP, 0, "Connect failed");
closesocket(s); closesocket(s);
return (-1); return INVALID_SOCKET;
} }
#ifndef HAVE_POLL_H #ifndef HAVE_POLL_H
@ -998,7 +996,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
0) { 0) {
/* Solaris error code */ /* Solaris error code */
__xmlIOErr(XML_FROM_HTTP, 0, "getsockopt failed\n"); __xmlIOErr(XML_FROM_HTTP, 0, "getsockopt failed\n");
return (-1); return INVALID_SOCKET;
} }
#endif #endif
if (status) { if (status) {
@ -1006,13 +1004,13 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
"Error connecting to remote host"); "Error connecting to remote host");
closesocket(s); closesocket(s);
errno = status; errno = status;
return (-1); return INVALID_SOCKET;
} }
} else { } else {
/* pbm */ /* pbm */
__xmlIOErr(XML_FROM_HTTP, 0, "select failed\n"); __xmlIOErr(XML_FROM_HTTP, 0, "select failed\n");
closesocket(s); closesocket(s);
return (-1); return INVALID_SOCKET;
} }
return (s); return (s);
@ -1029,7 +1027,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
* Returns -1 in case of failure, the file descriptor number otherwise * Returns -1 in case of failure, the file descriptor number otherwise
*/ */
static int static SOCKET
xmlNanoHTTPConnectHost(const char *host, int port) xmlNanoHTTPConnectHost(const char *host, int port)
{ {
struct hostent *h; struct hostent *h;
@ -1042,7 +1040,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
struct sockaddr_in6 sockin6; struct sockaddr_in6 sockin6;
#endif #endif
int i; int i;
int s; SOCKET s;
memset (&sockin, 0, sizeof(sockin)); memset (&sockin, 0, sizeof(sockin));
#ifdef SUPPORT_IP6 #ifdef SUPPORT_IP6
@ -1073,7 +1071,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
status = getaddrinfo (host, NULL, &hints, &result); status = getaddrinfo (host, NULL, &hints, &result);
if (status) { if (status) {
__xmlIOErr(XML_FROM_HTTP, 0, "getaddrinfo failed\n"); __xmlIOErr(XML_FROM_HTTP, 0, "getaddrinfo failed\n");
return (-1); return INVALID_SOCKET;
} }
for (res = result; res; res = res->ai_next) { for (res = result; res; res = res->ai_next) {
@ -1081,7 +1079,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
if (res->ai_addrlen > sizeof(sockin)) { if (res->ai_addrlen > sizeof(sockin)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
freeaddrinfo (result); freeaddrinfo (result);
return (-1); return INVALID_SOCKET;
} }
memcpy (&sockin, res->ai_addr, res->ai_addrlen); memcpy (&sockin, res->ai_addr, res->ai_addrlen);
sockin.sin_port = htons (port); sockin.sin_port = htons (port);
@ -1091,7 +1089,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
if (res->ai_addrlen > sizeof(sockin6)) { if (res->ai_addrlen > sizeof(sockin6)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
freeaddrinfo (result); freeaddrinfo (result);
return (-1); return INVALID_SOCKET;
} }
memcpy (&sockin6, res->ai_addr, res->ai_addrlen); memcpy (&sockin6, res->ai_addr, res->ai_addrlen);
sockin6.sin6_port = htons (port); sockin6.sin6_port = htons (port);
@ -1101,7 +1099,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
continue; /* for */ continue; /* for */
s = xmlNanoHTTPConnectAttempt (addr); s = xmlNanoHTTPConnectAttempt (addr);
if (s != -1) { if (s != INVALID_SOCKET) {
freeaddrinfo (result); freeaddrinfo (result);
return (s); return (s);
} }
@ -1155,7 +1153,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
#else #else
__xmlIOErr(XML_FROM_HTTP, 0, "Failed to resolve host"); __xmlIOErr(XML_FROM_HTTP, 0, "Failed to resolve host");
#endif #endif
return (-1); return INVALID_SOCKET;
} }
for (i = 0; h->h_addr_list[i]; i++) { for (i = 0; h->h_addr_list[i]; i++) {
@ -1163,7 +1161,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
/* A records (IPv4) */ /* A records (IPv4) */
if ((unsigned int) h->h_length > sizeof(ia)) { if ((unsigned int) h->h_length > sizeof(ia)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
return (-1); return INVALID_SOCKET;
} }
memcpy (&ia, h->h_addr_list[i], h->h_length); memcpy (&ia, h->h_addr_list[i], h->h_length);
sockin.sin_family = h->h_addrtype; sockin.sin_family = h->h_addrtype;
@ -1175,7 +1173,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
/* AAAA records (IPv6) */ /* AAAA records (IPv6) */
if ((unsigned int) h->h_length > sizeof(ia6)) { if ((unsigned int) h->h_length > sizeof(ia6)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
return (-1); return INVALID_SOCKET;
} }
memcpy (&ia6, h->h_addr_list[i], h->h_length); memcpy (&ia6, h->h_addr_list[i], h->h_length);
sockin6.sin6_family = h->h_addrtype; sockin6.sin6_family = h->h_addrtype;
@ -1187,7 +1185,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
break; /* for */ break; /* for */
s = xmlNanoHTTPConnectAttempt (addr); s = xmlNanoHTTPConnectAttempt (addr);
if (s != -1) if (s != INVALID_SOCKET)
return (s); return (s);
} }
} }
@ -1198,7 +1196,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
"xmlNanoHTTPConnectHost: unable to connect to '%s'.\n", "xmlNanoHTTPConnectHost: unable to connect to '%s'.\n",
host); host);
#endif #endif
return (-1); return INVALID_SOCKET;
} }
@ -1342,7 +1340,8 @@ xmlNanoHTTPMethodRedir(const char *URL, const char *method, const char *input,
const char *headers, int ilen ) { const char *headers, int ilen ) {
xmlNanoHTTPCtxtPtr ctxt; xmlNanoHTTPCtxtPtr ctxt;
char *bp, *p; char *bp, *p;
int blen, ret; int blen;
SOCKET ret;
int nbRedirects = 0; int nbRedirects = 0;
char *redirURL = NULL; char *redirURL = NULL;
#ifdef DEBUG_HTTP #ifdef DEBUG_HTTP
@ -1386,7 +1385,7 @@ retry:
blen = strlen(ctxt->hostname); blen = strlen(ctxt->hostname);
ret = xmlNanoHTTPConnectHost(ctxt->hostname, ctxt->port); ret = xmlNanoHTTPConnectHost(ctxt->hostname, ctxt->port);
} }
if (ret < 0) { if (ret == INVALID_SOCKET) {
xmlNanoHTTPFreeCtxt(ctxt); xmlNanoHTTPFreeCtxt(ctxt);
if (redirURL != NULL) xmlFree(redirURL); if (redirURL != NULL) xmlFree(redirURL);
return(NULL); return(NULL);

View file

@ -953,6 +953,12 @@ xmlHasFeature(xmlFeature feature)
return(1); return(1);
#else #else
return(0); return(0);
#endif
case XML_WITH_ICU:
#ifdef LIBXML_ICU_ENABLED
return(1);
#else
return(0);
#endif #endif
default: default:
break; break;
@ -1297,60 +1303,182 @@ xmlCleanSpecialAttr(xmlParserCtxtPtr ctxt)
* [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+ * [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+
* [38] Subcode ::= ([a-z] | [A-Z])+ * [38] Subcode ::= ([a-z] | [A-Z])+
* *
* The current REC reference the sucessors of RFC 1766, currently 5646
*
* http://www.rfc-editor.org/rfc/rfc5646.txt
* langtag = language
* ["-" script]
* ["-" region]
* *("-" variant)
* *("-" extension)
* ["-" privateuse]
* language = 2*3ALPHA ; shortest ISO 639 code
* ["-" extlang] ; sometimes followed by
* ; extended language subtags
* / 4ALPHA ; or reserved for future use
* / 5*8ALPHA ; or registered language subtag
*
* extlang = 3ALPHA ; selected ISO 639 codes
* *2("-" 3ALPHA) ; permanently reserved
*
* script = 4ALPHA ; ISO 15924 code
*
* region = 2ALPHA ; ISO 3166-1 code
* / 3DIGIT ; UN M.49 code
*
* variant = 5*8alphanum ; registered variants
* / (DIGIT 3alphanum)
*
* extension = singleton 1*("-" (2*8alphanum))
*
* ; Single alphanumerics
* ; "x" reserved for private use
* singleton = DIGIT ; 0 - 9
* / %x41-57 ; A - W
* / %x59-5A ; Y - Z
* / %x61-77 ; a - w
* / %x79-7A ; y - z
*
* it sounds right to still allow Irregular i-xxx IANA and user codes too
* The parser below doesn't try to cope with extension or privateuse
* that could be added but that's not interoperable anyway
*
* Returns 1 if correct 0 otherwise * Returns 1 if correct 0 otherwise
**/ **/
int int
xmlCheckLanguageID(const xmlChar * lang) xmlCheckLanguageID(const xmlChar * lang)
{ {
const xmlChar *cur = lang; const xmlChar *cur = lang, *nxt;
if (cur == NULL) if (cur == NULL)
return (0); return (0);
if (((cur[0] == 'i') && (cur[1] == '-')) || if (((cur[0] == 'i') && (cur[1] == '-')) ||
((cur[0] == 'I') && (cur[1] == '-'))) { ((cur[0] == 'I') && (cur[1] == '-')) ||
((cur[0] == 'x') && (cur[1] == '-')) ||
((cur[0] == 'X') && (cur[1] == '-'))) {
/* /*
* IANA code * Still allow IANA code and user code which were coming
* from the previous version of the XML-1.0 specification
* it's deprecated but we should not fail
*/ */
cur += 2; cur += 2;
while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */ while (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
((cur[0] >= 'a') && (cur[0] <= 'z')))
cur++;
} else if (((cur[0] == 'x') && (cur[1] == '-')) ||
((cur[0] == 'X') && (cur[1] == '-'))) {
/*
* User code
*/
cur += 2;
while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
((cur[0] >= 'a') && (cur[0] <= 'z')))
cur++;
} else if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
((cur[0] >= 'a') && (cur[0] <= 'z'))) {
/*
* ISO639
*/
cur++;
if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
((cur[0] >= 'a') && (cur[0] <= 'z')))
cur++;
else
return (0);
} else
return (0);
while (cur[0] != 0) { /* non input consuming */
if (cur[0] != '-')
return (0);
cur++;
if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
((cur[0] >= 'a') && (cur[0] <= 'z')))
cur++;
else
return (0);
while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
((cur[0] >= 'a') && (cur[0] <= 'z'))) ((cur[0] >= 'a') && (cur[0] <= 'z')))
cur++; cur++;
return(cur[0] == 0);
} }
nxt = cur;
while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
((nxt[0] >= 'a') && (nxt[0] <= 'z')))
nxt++;
if (nxt - cur >= 4) {
/*
* Reserved
*/
if ((nxt - cur > 8) || (nxt[0] != 0))
return(0);
return(1);
}
if (nxt - cur < 2)
return(0);
/* we got an ISO 639 code */
if (nxt[0] == 0)
return(1);
if (nxt[0] != '-')
return(0);
nxt++;
cur = nxt;
/* now we can have extlang or script or region or variant */
if ((nxt[0] >= '0') && (nxt[0] <= '9'))
goto region_m49;
while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
((nxt[0] >= 'a') && (nxt[0] <= 'z')))
nxt++;
if (nxt - cur == 4)
goto script;
if (nxt - cur == 2)
goto region;
if ((nxt - cur >= 5) && (nxt - cur <= 8))
goto variant;
if (nxt - cur != 3)
return(0);
/* we parsed an extlang */
if (nxt[0] == 0)
return(1);
if (nxt[0] != '-')
return(0);
nxt++;
cur = nxt;
/* now we can have script or region or variant */
if ((nxt[0] >= '0') && (nxt[0] <= '9'))
goto region_m49;
while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
((nxt[0] >= 'a') && (nxt[0] <= 'z')))
nxt++;
if (nxt - cur == 2)
goto region;
if ((nxt - cur >= 5) && (nxt - cur <= 8))
goto variant;
if (nxt - cur != 4)
return(0);
/* we parsed a script */
script:
if (nxt[0] == 0)
return(1);
if (nxt[0] != '-')
return(0);
nxt++;
cur = nxt;
/* now we can have region or variant */
if ((nxt[0] >= '0') && (nxt[0] <= '9'))
goto region_m49;
while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
((nxt[0] >= 'a') && (nxt[0] <= 'z')))
nxt++;
if ((nxt - cur >= 5) && (nxt - cur <= 8))
goto variant;
if (nxt - cur != 2)
return(0);
/* we parsed a region */
region:
if (nxt[0] == 0)
return(1);
if (nxt[0] != '-')
return(0);
nxt++;
cur = nxt;
/* now we can just have a variant */
while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) ||
((nxt[0] >= 'a') && (nxt[0] <= 'z')))
nxt++;
if ((nxt - cur < 5) || (nxt - cur > 8))
return(0);
/* we parsed a variant */
variant:
if (nxt[0] == 0)
return(1);
if (nxt[0] != '-')
return(0);
/* extensions and private use subtags not checked */
return (1); return (1);
region_m49:
if (((nxt[1] >= '0') && (nxt[1] <= '9')) &&
((nxt[2] >= '0') && (nxt[2] <= '9'))) {
nxt += 3;
goto region;
}
return(0);
} }
/************************************************************************ /************************************************************************
@ -6609,7 +6737,7 @@ xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID,
xmlDetectSAX2(ctxt); xmlDetectSAX2(ctxt);
GROW; GROW;
if ((ctxt->encoding == (const xmlChar *)XML_CHAR_ENCODING_NONE) && if ((ctxt->encoding == NULL) &&
(ctxt->input->end - ctxt->input->cur >= 4)) { (ctxt->input->end - ctxt->input->cur >= 4)) {
xmlChar start[4]; xmlChar start[4];
xmlCharEncoding enc; xmlCharEncoding enc;
@ -10105,7 +10233,7 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator); ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
if ((ctxt->encoding == (const xmlChar *)XML_CHAR_ENCODING_NONE) && if ((ctxt->encoding == NULL) &&
((ctxt->input->end - ctxt->input->cur) >= 4)) { ((ctxt->input->end - ctxt->input->cur) >= 4)) {
/* /*
* Get the 4 first bytes and decode the charset * Get the 4 first bytes and decode the charset
@ -11567,7 +11695,7 @@ xmldecl_done:
* if size is greater than len. Otherwise, memmove in xmlBufferAdd * if size is greater than len. Otherwise, memmove in xmlBufferAdd
* will blindly copy extra bytes from memory. * will blindly copy extra bytes from memory.
*/ */
if (size > len) { if ((unsigned int) size > len) {
remain = size - len; remain = size - len;
size = len; size = len;
} else { } else {
@ -14004,8 +14132,8 @@ xmlInitParser(void) {
__xmlGlobalInitMutexLock(); __xmlGlobalInitMutexLock();
if (xmlParserInitialized == 0) { if (xmlParserInitialized == 0) {
#endif #endif
xmlInitGlobals();
xmlInitThreads(); xmlInitThreads();
xmlInitGlobals();
if ((xmlGenericError == xmlGenericErrorDefaultFunc) || if ((xmlGenericError == xmlGenericErrorDefaultFunc) ||
(xmlGenericError == NULL)) (xmlGenericError == NULL))
initGenericErrorDefaultFunc(NULL); initGenericErrorDefaultFunc(NULL);

View file

@ -11639,32 +11639,8 @@ static int
test_xmlNanoFTPGetConnection(void) { test_xmlNanoFTPGetConnection(void) {
int test_ret = 0; int test_ret = 0;
#if defined(LIBXML_FTP_ENABLED)
int mem_base;
int ret_val;
void * ctx; /* an FTP context */
int n_ctx;
for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
mem_base = xmlMemBlocks();
ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
ret_val = xmlNanoFTPGetConnection(ctx);
desret_int(ret_val);
call_tests++;
des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
xmlMemBlocks() - mem_base);
test_ret++;
printf(" %d", n_ctx);
printf("\n");
}
}
function_tests++;
#endif
/* missing type support */
return(test_ret); return(test_ret);
} }
@ -11707,39 +11683,8 @@ static int
test_xmlNanoFTPGetSocket(void) { test_xmlNanoFTPGetSocket(void) {
int test_ret = 0; int test_ret = 0;
#if defined(LIBXML_FTP_ENABLED)
int mem_base;
int ret_val;
void * ctx; /* an FTP context */
int n_ctx;
const char * filename; /* the file to retrieve (or NULL if path is in context). */
int n_filename;
for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
mem_base = xmlMemBlocks();
ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
filename = gen_filepath(n_filename, 1);
ret_val = xmlNanoFTPGetSocket(ctx, filename);
desret_int(ret_val);
call_tests++;
des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
des_filepath(n_filename, filename, 1);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
xmlMemBlocks() - mem_base);
test_ret++;
printf(" %d", n_ctx);
printf(" %d", n_filename);
printf("\n");
}
}
}
function_tests++;
#endif
/* missing type support */
return(test_ret); return(test_ret);
} }
@ -12043,7 +11988,7 @@ static int
test_nanoftp(void) { test_nanoftp(void) {
int test_ret = 0; int test_ret = 0;
if (quiet == 0) printf("Testing nanoftp : 16 of 22 functions ...\n"); if (quiet == 0) printf("Testing nanoftp : 14 of 22 functions ...\n");
test_ret += test_xmlNanoFTPCheckResponse(); test_ret += test_xmlNanoFTPCheckResponse();
test_ret += test_xmlNanoFTPCleanup(); test_ret += test_xmlNanoFTPCleanup();
test_ret += test_xmlNanoFTPCloseConnection(); test_ret += test_xmlNanoFTPCloseConnection();

View file

@ -439,7 +439,8 @@ __xmlGlobalInitMutexLock(void)
/* Make sure the global init lock is initialized and then lock it. */ /* Make sure the global init lock is initialized and then lock it. */
#ifdef HAVE_PTHREAD_H #ifdef HAVE_PTHREAD_H
/* The mutex is statically initialized, so we just lock it. */ /* The mutex is statically initialized, so we just lock it. */
pthread_mutex_lock(&global_init_lock); if (pthread_mutex_lock)
pthread_mutex_lock(&global_init_lock);
#elif defined HAVE_WIN32_THREADS #elif defined HAVE_WIN32_THREADS
LPCRITICAL_SECTION cs; LPCRITICAL_SECTION cs;
@ -508,7 +509,8 @@ void
__xmlGlobalInitMutexUnlock(void) __xmlGlobalInitMutexUnlock(void)
{ {
#ifdef HAVE_PTHREAD_H #ifdef HAVE_PTHREAD_H
pthread_mutex_unlock(&global_init_lock); if (pthread_mutex_unlock)
pthread_mutex_unlock(&global_init_lock);
#elif defined HAVE_WIN32_THREADS #elif defined HAVE_WIN32_THREADS
if (global_init_lock != NULL) { if (global_init_lock != NULL) {
LeaveCriticalSection(global_init_lock); LeaveCriticalSection(global_init_lock);

View file

@ -721,8 +721,19 @@ xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) {
if ((node != NULL) && (node->type != XML_ELEMENT_NODE)) if ((node != NULL) && (node->type != XML_ELEMENT_NODE))
return(NULL); return(NULL);
if ((prefix != NULL) && (xmlStrEqual(prefix, BAD_CAST "xml"))) if ((prefix != NULL) && (xmlStrEqual(prefix, BAD_CAST "xml"))) {
return(NULL); /* xml namespace is predefined, no need to add it */
if (xmlStrEqual(href, XML_XML_NAMESPACE))
return(NULL);
/*
* Problem, this is an attempt to bind xml prefix to a wrong
* namespace, which breaks
* Namespace constraint: Reserved Prefixes and Namespace Names
* from XML namespace. But documents authors may not care in
* their context so let's proceed.
*/
}
/* /*
* Allocate a new Namespace and fill the fields. * Allocate a new Namespace and fill the fields.

View file

@ -127,7 +127,7 @@ static void xmlCleanURI(xmlURIPtr uri);
(((*(p) == '!')) || ((*(p) == '$')) || ((*(p) == '&')) || \ (((*(p) == '!')) || ((*(p) == '$')) || ((*(p) == '&')) || \
((*(p) == '(')) || ((*(p) == ')')) || ((*(p) == '*')) || \ ((*(p) == '(')) || ((*(p) == ')')) || ((*(p) == '*')) || \
((*(p) == '+')) || ((*(p) == ',')) || ((*(p) == ';')) || \ ((*(p) == '+')) || ((*(p) == ',')) || ((*(p) == ';')) || \
((*(p) == '='))) ((*(p) == '=')) || ((*(p) == '\'')))
/* /*
* gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" * gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"

View file

@ -162,6 +162,9 @@ static int html = 0;
static int xmlout = 0; static int xmlout = 0;
#endif #endif
static int htmlout = 0; static int htmlout = 0;
#if defined(LIBXML_HTML_ENABLED)
static int nodefdtd = 0;
#endif
#ifdef LIBXML_PUSH_ENABLED #ifdef LIBXML_PUSH_ENABLED
static int push = 0; static int push = 0;
#endif /* LIBXML_PUSH_ENABLED */ #endif /* LIBXML_PUSH_ENABLED */
@ -2507,14 +2510,14 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
htmlSaveFile(output ? output : "-", doc); htmlSaveFile(output ? output : "-", doc);
} }
else if (encoding != NULL) { else if (encoding != NULL) {
if ( format ) { if (format == 1) {
htmlSaveFileFormat(output ? output : "-", doc, encoding, 1); htmlSaveFileFormat(output ? output : "-", doc, encoding, 1);
} }
else { else {
htmlSaveFileFormat(output ? output : "-", doc, encoding, 0); htmlSaveFileFormat(output ? output : "-", doc, encoding, 0);
} }
} }
else if (format) { else if (format == 1) {
htmlSaveFileFormat(output ? output : "-", doc, NULL, 1); htmlSaveFileFormat(output ? output : "-", doc, NULL, 1);
} }
else { else {
@ -2586,13 +2589,13 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
int len; int len;
if (encoding != NULL) { if (encoding != NULL) {
if ( format ) { if (format == 1) {
xmlDocDumpFormatMemoryEnc(doc, &result, &len, encoding, 1); xmlDocDumpFormatMemoryEnc(doc, &result, &len, encoding, 1);
} else { } else {
xmlDocDumpMemoryEnc(doc, &result, &len, encoding); xmlDocDumpMemoryEnc(doc, &result, &len, encoding);
} }
} else { } else {
if (format) if (format == 1)
xmlDocDumpFormatMemory(doc, &result, &len, 1); xmlDocDumpFormatMemory(doc, &result, &len, 1);
else else
xmlDocDumpMemory(doc, &result, &len); xmlDocDumpMemory(doc, &result, &len);
@ -2611,7 +2614,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
xmlSaveFile(output ? output : "-", doc); xmlSaveFile(output ? output : "-", doc);
} else if (oldout) { } else if (oldout) {
if (encoding != NULL) { if (encoding != NULL) {
if ( format ) { if (format == 1) {
ret = xmlSaveFormatFileEnc(output ? output : "-", doc, ret = xmlSaveFormatFileEnc(output ? output : "-", doc,
encoding, 1); encoding, 1);
} }
@ -2624,7 +2627,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
output ? output : "-"); output ? output : "-");
progresult = XMLLINT_ERR_OUT; progresult = XMLLINT_ERR_OUT;
} }
} else if (format) { } else if (format == 1) {
ret = xmlSaveFormatFile(output ? output : "-", doc, 1); ret = xmlSaveFormatFile(output ? output : "-", doc, 1);
if (ret < 0) { if (ret < 0) {
fprintf(stderr, "failed save to %s\n", fprintf(stderr, "failed save to %s\n",
@ -2653,8 +2656,10 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
xmlSaveCtxtPtr ctxt; xmlSaveCtxtPtr ctxt;
int saveOpts = 0; int saveOpts = 0;
if (format) if (format == 1)
saveOpts |= XML_SAVE_FORMAT; saveOpts |= XML_SAVE_FORMAT;
else if (format == 2)
saveOpts |= XML_SAVE_WSNONSIG;
#if defined(LIBXML_HTML_ENABLED) || defined(LIBXML_VALID_ENABLED) #if defined(LIBXML_HTML_ENABLED) || defined(LIBXML_VALID_ENABLED)
if (xmlout) if (xmlout)
@ -2995,6 +3000,7 @@ static void usage(const char *name) {
#ifdef LIBXML_HTML_ENABLED #ifdef LIBXML_HTML_ENABLED
printf("\t--html : use the HTML parser\n"); printf("\t--html : use the HTML parser\n");
printf("\t--xmlout : force to use the XML serializer when using --html\n"); printf("\t--xmlout : force to use the XML serializer when using --html\n");
printf("\t--nodefdtd : do not default HTML doctype\n");
#endif #endif
#ifdef LIBXML_PUSH_ENABLED #ifdef LIBXML_PUSH_ENABLED
printf("\t--push : use the push mode of the parser\n"); printf("\t--push : use the push mode of the parser\n");
@ -3010,6 +3016,10 @@ static void usage(const char *name) {
printf("\t--format : reformat/reindent the input\n"); printf("\t--format : reformat/reindent the input\n");
printf("\t--encode encoding : output in the given encoding\n"); printf("\t--encode encoding : output in the given encoding\n");
printf("\t--dropdtd : remove the DOCTYPE of the input docs\n"); printf("\t--dropdtd : remove the DOCTYPE of the input docs\n");
printf("\t--pretty STYLE : pretty-print in a particular style\n");
printf("\t 0 Do not pretty print\n");
printf("\t 1 Format the XML content, as --format\n");
printf("\t 2 Add whitespace inside tags, preserving content\n");
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
printf("\t--c14n : save in W3C canonical format v1.0 (with comments)\n"); printf("\t--c14n : save in W3C canonical format v1.0 (with comments)\n");
printf("\t--c14n11 : save in W3C canonical format v1.1 (with comments)\n"); printf("\t--c14n11 : save in W3C canonical format v1.1 (with comments)\n");
@ -3157,6 +3167,10 @@ main(int argc, char **argv) {
else if ((!strcmp(argv[i], "-xmlout")) || else if ((!strcmp(argv[i], "-xmlout")) ||
(!strcmp(argv[i], "--xmlout"))) { (!strcmp(argv[i], "--xmlout"))) {
xmlout++; xmlout++;
} else if ((!strcmp(argv[i], "-nodefdtd")) ||
(!strcmp(argv[i], "--nodefdtd"))) {
nodefdtd++;
options |= HTML_PARSE_NODEFDTD;
} }
#endif /* LIBXML_HTML_ENABLED */ #endif /* LIBXML_HTML_ENABLED */
else if ((!strcmp(argv[i], "-loaddtd")) || else if ((!strcmp(argv[i], "-loaddtd")) ||
@ -3326,10 +3340,21 @@ main(int argc, char **argv) {
(!strcmp(argv[i], "--format"))) { (!strcmp(argv[i], "--format"))) {
noblanks++; noblanks++;
#ifdef LIBXML_OUTPUT_ENABLED #ifdef LIBXML_OUTPUT_ENABLED
format++; format = 1;
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
xmlKeepBlanksDefault(0); xmlKeepBlanksDefault(0);
} }
else if ((!strcmp(argv[i], "-pretty")) ||
(!strcmp(argv[i], "--pretty"))) {
i++;
#ifdef LIBXML_OUTPUT_ENABLED
format = atoi(argv[i]);
#endif /* LIBXML_OUTPUT_ENABLED */
if (format == 1) {
noblanks++;
xmlKeepBlanksDefault(0);
}
}
#ifdef LIBXML_READER_ENABLED #ifdef LIBXML_READER_ENABLED
else if ((!strcmp(argv[i], "-stream")) || else if ((!strcmp(argv[i], "-stream")) ||
(!strcmp(argv[i], "--stream"))) { (!strcmp(argv[i], "--stream"))) {
@ -3616,6 +3641,11 @@ main(int argc, char **argv) {
i++; i++;
continue; continue;
} }
if ((!strcmp(argv[i], "-pretty")) ||
(!strcmp(argv[i], "--pretty"))) {
i++;
continue;
}
if ((!strcmp(argv[i], "-schema")) || if ((!strcmp(argv[i], "-schema")) ||
(!strcmp(argv[i], "--schema"))) { (!strcmp(argv[i], "--schema"))) {
i++; i++;

View file

@ -1709,9 +1709,9 @@ xmlTextReaderReadInnerXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
* *
* Reads the contents of the current node, including child nodes and markup. * Reads the contents of the current node, including child nodes and markup.
* *
* Returns a string containing the XML content, or NULL if the current node * Returns a string containing the node and any XML content, or NULL if the
* is neither an element nor attribute, or has no child nodes. The * current node cannot be serialized. The string must be deallocated
* string must be deallocated by the caller. * by the caller.
*/ */
xmlChar * xmlChar *
xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
@ -1726,7 +1726,11 @@ xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED)
if (xmlTextReaderExpand(reader) == NULL) { if (xmlTextReaderExpand(reader) == NULL) {
return NULL; return NULL;
} }
node = xmlDocCopyNode(node, doc, 1); if (node->type == XML_DTD_NODE) {
node = (xmlNodePtr) xmlCopyDtd((xmlDtdPtr) node);
} else {
node = xmlDocCopyNode(node, doc, 1);
}
buff = xmlBufferCreate(); buff = xmlBufferCreate();
if (xmlNodeDump(buff, doc, node, 0, 0) == -1) { if (xmlNodeDump(buff, doc, node, 0, 0) == -1) {
xmlFreeNode(node); xmlFreeNode(node);

View file

@ -408,6 +408,8 @@ xmlNewSaveCtxt(const char *encoding, int options)
ret->options = options; ret->options = options;
if (options & XML_SAVE_FORMAT) if (options & XML_SAVE_FORMAT)
ret->format = 1; ret->format = 1;
else if (options & XML_SAVE_WSNONSIG)
ret->format = 2;
return(ret); return(ret);
} }
@ -500,32 +502,90 @@ static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur);
void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur); void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
static int xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur); static int xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur);
/**
* xmlOutputBufferWriteWSNonSig:
* @ctxt: The save context
* @extra: Number of extra indents to apply to ctxt->level
*
* Write out formatting for non-significant whitespace output.
*/
static void
xmlOutputBufferWriteWSNonSig(xmlSaveCtxtPtr ctxt, int extra)
{
int i;
if ((ctxt == NULL) || (ctxt->buf == NULL))
return;
xmlOutputBufferWrite(ctxt->buf, 1, "\n");
for (i = 0; i < (ctxt->level + extra); i += ctxt->indent_nr) {
xmlOutputBufferWrite(ctxt->buf, ctxt->indent_size *
((ctxt->level + extra - i) > ctxt->indent_nr ?
ctxt->indent_nr : (ctxt->level + extra - i)),
ctxt->indent);
}
}
/** /**
* xmlNsDumpOutput: * xmlNsDumpOutput:
* @buf: the XML buffer output * @buf: the XML buffer output
* @cur: a namespace * @cur: a namespace
* @ctxt: the output save context. Optional.
* *
* Dump a local Namespace definition. * Dump a local Namespace definition.
* Should be called in the context of attributes dumps. * Should be called in the context of attributes dumps.
* If @ctxt is supplied, @buf should be its buffer.
*/ */
static void static void
xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) { xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur, xmlSaveCtxtPtr ctxt) {
if ((cur == NULL) || (buf == NULL)) return; if ((cur == NULL) || (buf == NULL)) return;
if ((cur->type == XML_LOCAL_NAMESPACE) && (cur->href != NULL)) { if ((cur->type == XML_LOCAL_NAMESPACE) && (cur->href != NULL)) {
if (xmlStrEqual(cur->prefix, BAD_CAST "xml")) if (xmlStrEqual(cur->prefix, BAD_CAST "xml"))
return; return;
if (ctxt != NULL && ctxt->format == 2)
xmlOutputBufferWriteWSNonSig(ctxt, 2);
else
xmlOutputBufferWrite(buf, 1, " ");
/* Within the context of an element attributes */ /* Within the context of an element attributes */
if (cur->prefix != NULL) { if (cur->prefix != NULL) {
xmlOutputBufferWrite(buf, 7, " xmlns:"); xmlOutputBufferWrite(buf, 6, "xmlns:");
xmlOutputBufferWriteString(buf, (const char *)cur->prefix); xmlOutputBufferWriteString(buf, (const char *)cur->prefix);
} else } else
xmlOutputBufferWrite(buf, 6, " xmlns"); xmlOutputBufferWrite(buf, 5, "xmlns");
xmlOutputBufferWrite(buf, 1, "="); xmlOutputBufferWrite(buf, 1, "=");
xmlBufferWriteQuotedString(buf->buffer, cur->href); xmlBufferWriteQuotedString(buf->buffer, cur->href);
} }
} }
/**
* xmlNsDumpOutputCtxt
* @ctxt: the save context
* @cur: a namespace
*
* Dump a local Namespace definition to a save context.
* Should be called in the context of attribute dumps.
*/
static void
xmlNsDumpOutputCtxt(xmlSaveCtxtPtr ctxt, xmlNsPtr cur) {
xmlNsDumpOutput(ctxt->buf, cur, ctxt);
}
/**
* xmlNsListDumpOutputCtxt
* @ctxt: the save context
* @cur: the first namespace
*
* Dump a list of local namespace definitions to a save context.
* Should be called in the context of attribute dumps.
*/
static void
xmlNsListDumpOutputCtxt(xmlSaveCtxtPtr ctxt, xmlNsPtr cur) {
while (cur != NULL) {
xmlNsDumpOutput(ctxt->buf, cur, ctxt);
cur = cur->next;
}
}
/** /**
* xmlNsListDumpOutput: * xmlNsListDumpOutput:
* @buf: the XML buffer output * @buf: the XML buffer output
@ -537,7 +597,7 @@ xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) {
void void
xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) { xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) {
while (cur != NULL) { while (cur != NULL) {
xmlNsDumpOutput(buf, cur); xmlNsDumpOutput(buf, cur, NULL);
cur = cur->next; cur = cur->next;
} }
} }
@ -612,7 +672,10 @@ xmlAttrDumpOutput(xmlSaveCtxtPtr ctxt, xmlAttrPtr cur) {
if (cur == NULL) return; if (cur == NULL) return;
buf = ctxt->buf; buf = ctxt->buf;
if (buf == NULL) return; if (buf == NULL) return;
xmlOutputBufferWrite(buf, 1, " "); if (ctxt->format == 2)
xmlOutputBufferWriteWSNonSig(ctxt, 2);
else
xmlOutputBufferWrite(buf, 1, " ");
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix); xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
xmlOutputBufferWrite(buf, 1, ":"); xmlOutputBufferWrite(buf, 1, ":");
@ -656,7 +719,7 @@ xmlNodeListDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
if (cur == NULL) return; if (cur == NULL) return;
buf = ctxt->buf; buf = ctxt->buf;
while (cur != NULL) { while (cur != NULL) {
if ((ctxt->format) && (xmlIndentTreeOutput) && if ((ctxt->format == 1) && (xmlIndentTreeOutput) &&
((cur->type == XML_ELEMENT_NODE) || ((cur->type == XML_ELEMENT_NODE) ||
(cur->type == XML_COMMENT_NODE) || (cur->type == XML_COMMENT_NODE) ||
(cur->type == XML_PI_NODE))) (cur->type == XML_PI_NODE)))
@ -665,7 +728,7 @@ xmlNodeListDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
ctxt->indent_nr : ctxt->level), ctxt->indent_nr : ctxt->level),
ctxt->indent); ctxt->indent);
xmlNodeDumpOutputInternal(ctxt, cur); xmlNodeDumpOutputInternal(ctxt, cur);
if (ctxt->format) { if (ctxt->format == 1) {
xmlOutputBufferWrite(buf, 1, "\n"); xmlOutputBufferWrite(buf, 1, "\n");
} }
cur = cur->next; cur = cur->next;
@ -808,13 +871,18 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
xmlOutputBufferWrite(buf, 2, "<?"); xmlOutputBufferWrite(buf, 2, "<?");
xmlOutputBufferWriteString(buf, (const char *)cur->name); xmlOutputBufferWriteString(buf, (const char *)cur->name);
if (cur->content != NULL) { if (cur->content != NULL) {
xmlOutputBufferWrite(buf, 1, " "); if (ctxt->format == 2)
xmlOutputBufferWriteWSNonSig(ctxt, 0);
else
xmlOutputBufferWrite(buf, 1, " ");
xmlOutputBufferWriteString(buf, (const char *)cur->content); xmlOutputBufferWriteString(buf, (const char *)cur->content);
} }
xmlOutputBufferWrite(buf, 2, "?>"); xmlOutputBufferWrite(buf, 2, "?>");
} else { } else {
xmlOutputBufferWrite(buf, 2, "<?"); xmlOutputBufferWrite(buf, 2, "<?");
xmlOutputBufferWriteString(buf, (const char *)cur->name); xmlOutputBufferWriteString(buf, (const char *)cur->name);
if (ctxt->format == 2)
xmlOutputBufferWriteWSNonSig(ctxt, 0);
xmlOutputBufferWrite(buf, 2, "?>"); xmlOutputBufferWrite(buf, 2, "?>");
} }
return; return;
@ -862,7 +930,7 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
return; return;
} }
if (cur->type == XML_NAMESPACE_DECL) { if (cur->type == XML_NAMESPACE_DECL) {
xmlNsDumpOutput(buf, (xmlNsPtr) cur); xmlNsDumpOutputCtxt(ctxt, (xmlNsPtr) cur);
return; return;
} }
@ -887,26 +955,30 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
xmlOutputBufferWriteString(buf, (const char *)cur->name); xmlOutputBufferWriteString(buf, (const char *)cur->name);
if (cur->nsDef) if (cur->nsDef)
xmlNsListDumpOutput(buf, cur->nsDef); xmlNsListDumpOutputCtxt(ctxt, cur->nsDef);
if (cur->properties != NULL) if (cur->properties != NULL)
xmlAttrListDumpOutput(ctxt, cur->properties); xmlAttrListDumpOutput(ctxt, cur->properties);
if (((cur->type == XML_ELEMENT_NODE) || (cur->content == NULL)) && if (((cur->type == XML_ELEMENT_NODE) || (cur->content == NULL)) &&
(cur->children == NULL) && ((ctxt->options & XML_SAVE_NO_EMPTY) == 0)) { (cur->children == NULL) && ((ctxt->options & XML_SAVE_NO_EMPTY) == 0)) {
if (ctxt->format == 2)
xmlOutputBufferWriteWSNonSig(ctxt, 0);
xmlOutputBufferWrite(buf, 2, "/>"); xmlOutputBufferWrite(buf, 2, "/>");
ctxt->format = format; ctxt->format = format;
return; return;
} }
if (ctxt->format == 2)
xmlOutputBufferWriteWSNonSig(ctxt, 1);
xmlOutputBufferWrite(buf, 1, ">"); xmlOutputBufferWrite(buf, 1, ">");
if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) { if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) {
xmlOutputBufferWriteEscape(buf, cur->content, ctxt->escape); xmlOutputBufferWriteEscape(buf, cur->content, ctxt->escape);
} }
if (cur->children != NULL) { if (cur->children != NULL) {
if (ctxt->format) xmlOutputBufferWrite(buf, 1, "\n"); if (ctxt->format == 1) xmlOutputBufferWrite(buf, 1, "\n");
if (ctxt->level >= 0) ctxt->level++; if (ctxt->level >= 0) ctxt->level++;
xmlNodeListDumpOutput(ctxt, cur->children); xmlNodeListDumpOutput(ctxt, cur->children);
if (ctxt->level > 0) ctxt->level--; if (ctxt->level > 0) ctxt->level--;
if ((xmlIndentTreeOutput) && (ctxt->format)) if ((xmlIndentTreeOutput) && (ctxt->format == 1))
xmlOutputBufferWrite(buf, ctxt->indent_size * xmlOutputBufferWrite(buf, ctxt->indent_size *
(ctxt->level > ctxt->indent_nr ? (ctxt->level > ctxt->indent_nr ?
ctxt->indent_nr : ctxt->level), ctxt->indent_nr : ctxt->level),
@ -919,6 +991,8 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
} }
xmlOutputBufferWriteString(buf, (const char *)cur->name); xmlOutputBufferWriteString(buf, (const char *)cur->name);
if (ctxt->format == 2)
xmlOutputBufferWriteWSNonSig(ctxt, 0);
xmlOutputBufferWrite(buf, 1, ">"); xmlOutputBufferWrite(buf, 1, ">");
ctxt->format = format; ctxt->format = format;
} }
@ -1254,14 +1328,14 @@ xhtmlNodeListDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
if (cur == NULL) return; if (cur == NULL) return;
buf = ctxt->buf; buf = ctxt->buf;
while (cur != NULL) { while (cur != NULL) {
if ((ctxt->format) && (xmlIndentTreeOutput) && if ((ctxt->format == 1) && (xmlIndentTreeOutput) &&
(cur->type == XML_ELEMENT_NODE)) (cur->type == XML_ELEMENT_NODE))
xmlOutputBufferWrite(buf, ctxt->indent_size * xmlOutputBufferWrite(buf, ctxt->indent_size *
(ctxt->level > ctxt->indent_nr ? (ctxt->level > ctxt->indent_nr ?
ctxt->indent_nr : ctxt->level), ctxt->indent_nr : ctxt->level),
ctxt->indent); ctxt->indent);
xhtmlNodeDumpOutput(ctxt, cur); xhtmlNodeDumpOutput(ctxt, cur);
if (ctxt->format) { if (ctxt->format == 1) {
xmlOutputBufferWrite(buf, 1, "\n"); xmlOutputBufferWrite(buf, 1, "\n");
} }
cur = cur->next; cur = cur->next;
@ -1410,7 +1484,7 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
xmlOutputBufferWriteString(buf, (const char *)cur->name); xmlOutputBufferWriteString(buf, (const char *)cur->name);
if (cur->nsDef) if (cur->nsDef)
xmlNsListDumpOutput(buf, cur->nsDef); xmlNsListDumpOutputCtxt(ctxt, cur->nsDef);
if ((xmlStrEqual(cur->name, BAD_CAST "html") && if ((xmlStrEqual(cur->name, BAD_CAST "html") &&
(cur->ns == NULL) && (cur->nsDef == NULL))) { (cur->ns == NULL) && (cur->nsDef == NULL))) {
/* /*
@ -1458,7 +1532,7 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
} else { } else {
if (addmeta == 1) { if (addmeta == 1) {
xmlOutputBufferWrite(buf, 1, ">"); xmlOutputBufferWrite(buf, 1, ">");
if (ctxt->format) { if (ctxt->format == 1) {
xmlOutputBufferWrite(buf, 1, "\n"); xmlOutputBufferWrite(buf, 1, "\n");
if (xmlIndentTreeOutput) if (xmlIndentTreeOutput)
xmlOutputBufferWrite(buf, ctxt->indent_size * xmlOutputBufferWrite(buf, ctxt->indent_size *
@ -1473,7 +1547,7 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
xmlOutputBufferWrite(buf, 5, "UTF-8"); xmlOutputBufferWrite(buf, 5, "UTF-8");
} }
xmlOutputBufferWrite(buf, 4, "\" />"); xmlOutputBufferWrite(buf, 4, "\" />");
if (ctxt->format) if (ctxt->format == 1)
xmlOutputBufferWrite(buf, 1, "\n"); xmlOutputBufferWrite(buf, 1, "\n");
} else { } else {
xmlOutputBufferWrite(buf, 1, ">"); xmlOutputBufferWrite(buf, 1, ">");
@ -1493,7 +1567,7 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
} }
xmlOutputBufferWrite(buf, 1, ">"); xmlOutputBufferWrite(buf, 1, ">");
if (addmeta == 1) { if (addmeta == 1) {
if (ctxt->format) { if (ctxt->format == 1) {
xmlOutputBufferWrite(buf, 1, "\n"); xmlOutputBufferWrite(buf, 1, "\n");
if (xmlIndentTreeOutput) if (xmlIndentTreeOutput)
xmlOutputBufferWrite(buf, ctxt->indent_size * xmlOutputBufferWrite(buf, ctxt->indent_size *
@ -1588,13 +1662,13 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
if (cur->children != NULL) { if (cur->children != NULL) {
int indent = ctxt->format; int indent = ctxt->format;
if (format) xmlOutputBufferWrite(buf, 1, "\n"); if (format == 1) xmlOutputBufferWrite(buf, 1, "\n");
if (ctxt->level >= 0) ctxt->level++; if (ctxt->level >= 0) ctxt->level++;
ctxt->format = format; ctxt->format = format;
xhtmlNodeListDumpOutput(ctxt, cur->children); xhtmlNodeListDumpOutput(ctxt, cur->children);
if (ctxt->level > 0) ctxt->level--; if (ctxt->level > 0) ctxt->level--;
ctxt->format = indent; ctxt->format = indent;
if ((xmlIndentTreeOutput) && (format)) if ((xmlIndentTreeOutput) && (format == 1))
xmlOutputBufferWrite(buf, ctxt->indent_size * xmlOutputBufferWrite(buf, ctxt->indent_size *
(ctxt->level > ctxt->indent_nr ? (ctxt->level > ctxt->indent_nr ?
ctxt->indent_nr : ctxt->level), ctxt->indent_nr : ctxt->level),
@ -2132,7 +2206,7 @@ xmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
ctxt.doc = doc; ctxt.doc = doc;
ctxt.buf = buf; ctxt.buf = buf;
ctxt.level = level; ctxt.level = level;
ctxt.format = format; ctxt.format = format ? 1 : 0;
ctxt.encoding = (const xmlChar *) encoding; ctxt.encoding = (const xmlChar *) encoding;
xmlSaveCtxtInit(&ctxt); xmlSaveCtxtInit(&ctxt);
ctxt.options |= XML_SAVE_AS_XML; ctxt.options |= XML_SAVE_AS_XML;
@ -2218,7 +2292,7 @@ xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr,
ctxt.doc = out_doc; ctxt.doc = out_doc;
ctxt.buf = out_buff; ctxt.buf = out_buff;
ctxt.level = 0; ctxt.level = 0;
ctxt.format = format; ctxt.format = format ? 1 : 0;
ctxt.encoding = (const xmlChar *) txt_encoding; ctxt.encoding = (const xmlChar *) txt_encoding;
xmlSaveCtxtInit(&ctxt); xmlSaveCtxtInit(&ctxt);
ctxt.options |= XML_SAVE_AS_XML; ctxt.options |= XML_SAVE_AS_XML;
@ -2337,7 +2411,7 @@ xmlDocFormatDump(FILE *f, xmlDocPtr cur, int format) {
ctxt.doc = cur; ctxt.doc = cur;
ctxt.buf = buf; ctxt.buf = buf;
ctxt.level = 0; ctxt.level = 0;
ctxt.format = format; ctxt.format = format ? 1 : 0;
ctxt.encoding = (const xmlChar *) encoding; ctxt.encoding = (const xmlChar *) encoding;
xmlSaveCtxtInit(&ctxt); xmlSaveCtxtInit(&ctxt);
ctxt.options |= XML_SAVE_AS_XML; ctxt.options |= XML_SAVE_AS_XML;
@ -2427,7 +2501,7 @@ xmlSaveFormatFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur,
ctxt.doc = cur; ctxt.doc = cur;
ctxt.buf = buf; ctxt.buf = buf;
ctxt.level = 0; ctxt.level = 0;
ctxt.format = format; ctxt.format = format ? 1 : 0;
ctxt.encoding = (const xmlChar *) encoding; ctxt.encoding = (const xmlChar *) encoding;
xmlSaveCtxtInit(&ctxt); xmlSaveCtxtInit(&ctxt);
ctxt.options |= XML_SAVE_AS_XML; ctxt.options |= XML_SAVE_AS_XML;
@ -2482,7 +2556,7 @@ xmlSaveFormatFileEnc( const char * filename, xmlDocPtr cur,
ctxt.doc = cur; ctxt.doc = cur;
ctxt.buf = buf; ctxt.buf = buf;
ctxt.level = 0; ctxt.level = 0;
ctxt.format = format; ctxt.format = format ? 1 : 0;
ctxt.encoding = (const xmlChar *) encoding; ctxt.encoding = (const xmlChar *) encoding;
xmlSaveCtxtInit(&ctxt); xmlSaveCtxtInit(&ctxt);
ctxt.options |= XML_SAVE_AS_XML; ctxt.options |= XML_SAVE_AS_XML;

View file

@ -26811,6 +26811,11 @@ xmlSchemaValidateElem(xmlSchemaValidCtxtPtr vctxt)
vctxt->skipDepth = 0; vctxt->skipDepth = 0;
return(ret); return(ret);
} }
/*
* Augment the IDC definitions for the main schema and all imported ones
* NOTE: main schema is the first in the imported list
*/
xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt);
} }
if (vctxt->depth > 0) { if (vctxt->depth > 0) {
/* /*

View file

@ -2389,9 +2389,11 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
normOnTheFly); normOnTheFly);
break; break;
case XML_SCHEMAS_FLOAT: case XML_SCHEMAS_FLOAT:
case XML_SCHEMAS_DOUBLE:{ case XML_SCHEMAS_DOUBLE: {
const xmlChar *cur = value; const xmlChar *cur = value;
int neg = 0; int neg = 0;
int digits_before = 0;
int digits_after = 0;
if (normOnTheFly) if (normOnTheFly)
while IS_WSP_BLANK_CH(*cur) cur++; while IS_WSP_BLANK_CH(*cur) cur++;
@ -2464,12 +2466,17 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
goto return1; goto return1;
while ((*cur >= '0') && (*cur <= '9')) { while ((*cur >= '0') && (*cur <= '9')) {
cur++; cur++;
digits_before++;
} }
if (*cur == '.') { if (*cur == '.') {
cur++; cur++;
while ((*cur >= '0') && (*cur <= '9')) while ((*cur >= '0') && (*cur <= '9')) {
cur++; cur++;
digits_after++;
}
} }
if ((digits_before == 0) && (digits_after == 0))
goto return1;
if ((*cur == 'e') || (*cur == 'E')) { if ((*cur == 'e') || (*cur == 'E')) {
cur++; cur++;
if ((*cur == '-') || (*cur == '+')) if ((*cur == '-') || (*cur == '+'))

View file

@ -8106,9 +8106,17 @@ xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
xmlNodePtr xmlNodePtr
xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur != NULL && cur->children != NULL) if ((cur != NULL) && (cur->type != XML_ATTRIBUTE_NODE) &&
return cur->children ; (cur->type != XML_NAMESPACE_DECL) && (cur->children != NULL))
if (cur == NULL) cur = ctxt->context->node; return(cur->children);
if (cur == NULL) {
cur = ctxt->context->node;
if (cur->type == XML_NAMESPACE_DECL)
return(NULL);
if (cur->type == XML_ATTRIBUTE_NODE)
cur = cur->parent;
}
if (cur == NULL) return(NULL) ; /* ERROR */ if (cur == NULL) return(NULL) ; /* ERROR */
if (cur->next != NULL) return(cur->next) ; if (cur->next != NULL) return(cur->next) ;
do { do {
@ -8162,8 +8170,13 @@ xmlNodePtr
xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur)
{ {
if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
if (cur == NULL) if (cur == NULL) {
cur = ctxt->context->node; cur = ctxt->context->node;
if (cur->type == XML_NAMESPACE_DECL)
return(NULL);
if (cur->type == XML_ATTRIBUTE_NODE)
return(cur->parent);
}
if (cur == NULL) if (cur == NULL)
return (NULL); return (NULL);
if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE)) if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
@ -8207,8 +8220,8 @@ xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt,
cur = ctxt->context->node; cur = ctxt->context->node;
if (cur == NULL) if (cur == NULL)
return (NULL); return (NULL);
if (cur->type == XML_NAMESPACE_DECL) if (cur->type == XML_NAMESPACE_DECL)
cur = (xmlNodePtr)((xmlNsPtr)cur)->next; return (NULL);
ctxt->ancestor = cur->parent; ctxt->ancestor = cur->parent;
} }
if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE)) if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
@ -10067,15 +10080,23 @@ xmlXPathCompNumber(xmlXPathParserContextPtr ctxt)
} }
#endif #endif
if (CUR == '.') { if (CUR == '.') {
int v, frac = 0;
double fraction = 0;
NEXT; NEXT;
if (((CUR < '0') || (CUR > '9')) && (!ok)) { if (((CUR < '0') || (CUR > '9')) && (!ok)) {
XP_ERROR(XPATH_NUMBER_ERROR); XP_ERROR(XPATH_NUMBER_ERROR);
} }
while ((CUR >= '0') && (CUR <= '9')) { while ((CUR >= '0') && (CUR <= '9') && (frac < MAX_FRAC)) {
mult /= 10; v = (CUR - '0');
ret = ret + (CUR - '0') * mult; fraction = fraction * 10 + v;
frac = frac + 1;
NEXT; NEXT;
} }
fraction /= my_pow10[frac];
ret = ret + fraction;
while ((CUR >= '0') && (CUR <= '9'))
NEXT;
} }
if ((CUR == 'e') || (CUR == 'E')) { if ((CUR == 'e') || (CUR == 'E')) {
NEXT; NEXT;
@ -11249,7 +11270,10 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
} }
} }
CHECK_ERROR; if (ctxt->error != XPATH_EXPRESSION_OK) {
xmlFree(name);
return;
}
name = xmlXPathCompNodeTest(ctxt, &test, &type, &prefix, name); name = xmlXPathCompNodeTest(ctxt, &test, &type, &prefix, name);
if (test == 0) if (test == 0)
@ -12655,7 +12679,7 @@ xmlXPathCompOpEvalFirst(xmlXPathParserContextPtr ctxt,
return (total); return (total);
#ifdef XP_OPTIMIZED_FILTER_FIRST #ifdef XP_OPTIMIZED_FILTER_FIRST
case XPATH_OP_FILTER: case XPATH_OP_FILTER:
total =+ xmlXPathCompOpEvalFilterFirst(ctxt, op, first); total += xmlXPathCompOpEvalFilterFirst(ctxt, op, first);
return (total); return (total);
#endif #endif
default: default: