From 6eb5949dd99d174393465069c2fd0bab32deddcc Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Mon, 28 Dec 2015 00:06:36 +0000 Subject: gettext-0.19.7 --- gnulib-local/lib/ChangeLog.0 | 1821 --- gnulib-local/lib/ChangeLog.1 | 1796 --- gnulib-local/lib/addext.c | 3 +- gnulib-local/lib/alloca.in.h | 3 +- gnulib-local/lib/backupfile.c | 3 +- gnulib-local/lib/backupfile.h | 3 +- gnulib-local/lib/basename.c | 3 +- gnulib-local/lib/basename.h | 2 +- gnulib-local/lib/closeout.c | 2 +- gnulib-local/lib/closeout.h | 2 +- gnulib-local/lib/error-progname.c | 2 +- gnulib-local/lib/error-progname.h | 2 +- gnulib-local/lib/fd-ostream.oo.c | 2 +- gnulib-local/lib/fd-ostream.oo.h | 2 +- gnulib-local/lib/file-ostream.oo.c | 2 +- gnulib-local/lib/file-ostream.oo.h | 2 +- gnulib-local/lib/gettext.h | 3 +- gnulib-local/lib/glib/gstrfuncs.c | 4 +- gnulib-local/lib/hash.c | 3 +- gnulib-local/lib/hash.h | 3 +- gnulib-local/lib/html-ostream.oo.c | 2 +- gnulib-local/lib/html-ostream.oo.h | 2 +- gnulib-local/lib/html-styled-ostream.oo.c | 2 +- gnulib-local/lib/html-styled-ostream.oo.h | 2 +- gnulib-local/lib/iconv-ostream.oo.c | 2 +- gnulib-local/lib/iconv-ostream.oo.h | 2 +- gnulib-local/lib/libxml/COPYING | 14 +- gnulib-local/lib/libxml/DOCBparser.c | 12 +- gnulib-local/lib/libxml/DOCBparser.in.h | 18 +- gnulib-local/lib/libxml/HTMLparser.c | 1609 ++- gnulib-local/lib/libxml/HTMLparser.in.h | 49 +- gnulib-local/lib/libxml/HTMLtree.c | 258 +- gnulib-local/lib/libxml/HTMLtree.in.h | 38 +- gnulib-local/lib/libxml/README | 40 +- gnulib-local/lib/libxml/SAX.c | 2 +- gnulib-local/lib/libxml/SAX.in.h | 74 +- gnulib-local/lib/libxml/SAX2.c | 404 +- gnulib-local/lib/libxml/SAX2.in.h | 74 +- gnulib-local/lib/libxml/c14n.c | 942 +- gnulib-local/lib/libxml/c14n.in.h | 65 +- gnulib-local/lib/libxml/catalog.c | 171 +- gnulib-local/lib/libxml/catalog.in.h | 70 +- gnulib-local/lib/libxml/chvalid.c | 164 +- gnulib-local/lib/libxml/debugXML.c | 224 +- gnulib-local/lib/libxml/debugXML.in.h | 52 +- gnulib-local/lib/libxml/dict.c | 625 +- gnulib-local/lib/libxml/dict.in.h | 21 +- gnulib-local/lib/libxml/elfgcchack.h | 17808 ++++++++++++++++++++++++ gnulib-local/lib/libxml/encoding.c | 1500 +- gnulib-local/lib/libxml/encoding.in.h | 42 +- gnulib-local/lib/libxml/entities.c | 279 +- gnulib-local/lib/libxml/entities.in.h | 45 +- gnulib-local/lib/libxml/error.c | 126 +- gnulib-local/lib/libxml/globals.c | 54 +- gnulib-local/lib/libxml/globals.in.h | 74 +- gnulib-local/lib/libxml/hash.c | 97 +- gnulib-local/lib/libxml/hash.in.h | 48 +- gnulib-local/lib/libxml/legacy.c | 32 +- gnulib-local/lib/libxml/libxml.h | 33 + gnulib-local/lib/libxml/list.c | 80 +- gnulib-local/lib/libxml/list.in.h | 52 +- gnulib-local/lib/libxml/nanoftp.c | 332 +- gnulib-local/lib/libxml/nanoftp.in.h | 68 +- gnulib-local/lib/libxml/nanohttp.c | 609 +- gnulib-local/lib/libxml/nanohttp.in.h | 26 +- gnulib-local/lib/libxml/parser.c | 5589 +++++--- gnulib-local/lib/libxml/parser.in.h | 175 +- gnulib-local/lib/libxml/parserInternals.c | 378 +- gnulib-local/lib/libxml/parserInternals.in.h | 206 +- gnulib-local/lib/libxml/pattern.c | 196 +- gnulib-local/lib/libxml/relaxng.c | 428 +- gnulib-local/lib/libxml/relaxng.in.h | 67 +- gnulib-local/lib/libxml/schemasInternals.in.h | 4 +- gnulib-local/lib/libxml/schematron.c | 119 +- gnulib-local/lib/libxml/schematron.in.h | 44 +- gnulib-local/lib/libxml/threads.c | 584 +- gnulib-local/lib/libxml/threads.in.h | 34 +- gnulib-local/lib/libxml/tree.c | 1668 ++- gnulib-local/lib/libxml/tree.in.h | 489 +- gnulib-local/lib/libxml/uri.c | 3199 ++--- gnulib-local/lib/libxml/uri.in.h | 43 +- gnulib-local/lib/libxml/valid.c | 649 +- gnulib-local/lib/libxml/valid.in.h | 148 +- gnulib-local/lib/libxml/xinclude.c | 255 +- gnulib-local/lib/libxml/xinclude.in.h | 14 +- gnulib-local/lib/libxml/xlink.c | 12 +- gnulib-local/lib/libxml/xlink.in.h | 14 +- gnulib-local/lib/libxml/xmlIO.c | 666 +- gnulib-local/lib/libxml/xmlIO.in.h | 138 +- gnulib-local/lib/libxml/xmlautomata.in.h | 44 +- gnulib-local/lib/libxml/xmlerror.in.h | 85 +- gnulib-local/lib/libxml/xmlexports.in.h | 9 +- gnulib-local/lib/libxml/xmlmemory.c | 192 +- gnulib-local/lib/libxml/xmlmemory.in.h | 62 +- gnulib-local/lib/libxml/xmlmodule.c | 25 +- gnulib-local/lib/libxml/xmlmodule.in.h | 2 +- gnulib-local/lib/libxml/xmlreader.c | 1241 +- gnulib-local/lib/libxml/xmlreader.in.h | 226 +- gnulib-local/lib/libxml/xmlregexp.c | 750 +- gnulib-local/lib/libxml/xmlregexp.in.h | 42 +- gnulib-local/lib/libxml/xmlsave.c | 782 +- gnulib-local/lib/libxml/xmlsave.in.h | 6 +- gnulib-local/lib/libxml/xmlschemas.c | 3147 +++-- gnulib-local/lib/libxml/xmlschemas.in.h | 80 +- gnulib-local/lib/libxml/xmlschemastypes.c | 394 +- gnulib-local/lib/libxml/xmlschemastypes.in.h | 40 +- gnulib-local/lib/libxml/xmlstring.c | 36 +- gnulib-local/lib/libxml/xmlstring.in.h | 8 +- gnulib-local/lib/libxml/xmlunicode.c | 1270 +- gnulib-local/lib/libxml/xmlversion.in.h | 108 +- gnulib-local/lib/libxml/xmlwriter.c | 436 +- gnulib-local/lib/libxml/xmlwriter.in.h | 83 +- gnulib-local/lib/libxml/xpath.c | 2987 ++-- gnulib-local/lib/libxml/xpath.in.h | 108 +- gnulib-local/lib/libxml/xpathInternals.in.h | 160 +- gnulib-local/lib/libxml/xpointer.c | 170 +- gnulib-local/lib/libxml/xpointer.in.h | 46 +- gnulib-local/lib/memory-ostream.oo.c | 2 +- gnulib-local/lib/memory-ostream.oo.h | 2 +- gnulib-local/lib/moo.h | 2 +- gnulib-local/lib/ostream.oo.c | 2 +- gnulib-local/lib/ostream.oo.h | 2 +- gnulib-local/lib/styled-ostream.oo.c | 2 +- gnulib-local/lib/styled-ostream.oo.h | 2 +- gnulib-local/lib/term-ostream.oo.c | 2 +- gnulib-local/lib/term-ostream.oo.h | 2 +- gnulib-local/lib/term-styled-ostream.oo.c | 2 +- gnulib-local/lib/term-styled-ostream.oo.h | 2 +- gnulib-local/lib/termcap.h | 2 +- gnulib-local/lib/terminfo.h | 2 +- gnulib-local/lib/tparm.c | 2 +- gnulib-local/lib/tputs.c | 2 +- gnulib-local/lib/unistd.in.h.diff | 11 +- gnulib-local/lib/xalloc.h | 2 +- gnulib-local/lib/xerror.c | 2 +- gnulib-local/lib/xerror.h | 2 +- gnulib-local/lib/xgetcwd.c | 3 +- gnulib-local/lib/xgetcwd.h | 2 +- gnulib-local/lib/xmalloc.c | 3 +- gnulib-local/lib/xstrdup.c | 3 +- 140 files changed, 40578 insertions(+), 17044 deletions(-) delete mode 100644 gnulib-local/lib/ChangeLog.0 delete mode 100644 gnulib-local/lib/ChangeLog.1 (limited to 'gnulib-local/lib') diff --git a/gnulib-local/lib/ChangeLog.0 b/gnulib-local/lib/ChangeLog.0 deleted file mode 100644 index 44c6c34..0000000 --- a/gnulib-local/lib/ChangeLog.0 +++ /dev/null @@ -1,1821 +0,0 @@ -2003-01-12 Bruno Haible - - * linebreak.c (mbs_possible_linebreaks): Return immediately if n = 0. - (mbs_width_linebreaks): Likewise. - -2003-01-12 Bruno Haible - - * mkdtemp.c: Use the simpler macro names HAVE_STDINT_H, - HAVE_INTTYPES_H. (Including or even when not - necessary doesn't hurt.) - -2002-12-11 Bruno Haible - - * setenv.c (alloca): Fall back to malloc. - (freea): New macro. - (setenv): Use freea() to free memory allocated with alloca(). - -2003-01-12 Bruno Haible - - * classpath.h: New file. - * classpath.c: Turn into an independent source file. - (new_classpath, set_classpath, reset_classpath): Make non-static. - * javacomp.c: Include classpath.h instead of classpath.c. - * javaexec.c: Likewise. - * Makefile.am (libgettextlib_la_SOURCES): Add classpath.h, classpath.c. - (EXTRA_DIST): Remove classpath.c. - -2003-01-12 Bruno Haible - - * localcharset.h: New file. - * localcharset.c: Include it. - * Makefile.am (libgettextlib_la_SOURCES): Add localcharset.h. - -2003-01-12 Bruno Haible - - * alloca_.h: New file, from gnulib. - * liballoca.h: Remove file. - * Makefile.am: Add snippet from gnulib module alloca. - (LIBADD_SOURCE): Remove liballoca.h. - * javacomp.c: Include alloca.h instead of liballoca.h. - * javaexec.c: Likewise. - * setenv.c: Likewise. - -2003-01-12 Bruno Haible - - * Makefile.am: Make use of += for variables. - (install-exec-local): Avoid creating $(libdir) if it would be empty. - -2003-01-12 Bruno Haible - - * linebreak.c (iconv_string_keeping_offsets): Add an assertion, to - protect against Solaris 2.9 iconv() bug. - -2003-01-10 Bruno Haible - - * linebreak.c (mbs_possible_linebreaks, mbs_width_linebreaks): - Work around Solaris 2.9 iconv() bug. - -2003-01-08 Bruno Haible - - * safe-read.h: Update from current gnulib version. - * safe-read.c: Update from current gnulib version. - * safe-write.h: Update from current gnulib version. - * safe-write.c: Update from current gnulib version. - * full-write.h: Update from current gnulib version. - * full-write.c: Update from current gnulib version. - -2002-12-16 Bruno Haible - - * copy-file.c: Include if doesn't exist. - Needed for mingw32. - Reported by Steven Edwards . - -2002-11-22 Bruno Haible - - * safe-write.h: New file, from current gnulib version. - * safe-write.c: New file, from current gnulib version. - * full-write.h: Update from current gnulib version. - * full-write.c: Update from current gnulib version. - * copy-file.c (copy_file): Change test of full_write return value. - * Makefile.am (libgettextlib_la_SOURCES): Add safe-write.h, - safe-write.c. - - * safe-read.h: Update from current gnulib version. - * safe-read.c: Update from current gnulib version. - - * argmatch.h: Update from current gnulib version. - * argmatch.c: Update from current gnulib version, with simplifications. - -2002-11-19 Bruno Haible - - * pathmax.h: Update from current gnulib version. - * obstack.h: Update from current gnulib version. - * obstack.c: Update from current gnulib version. - -2002-11-06 Bruno Haible - - * gcd.h (gcd): Change argument type to 'unsigned long'. - * gcd.c (gcd): Likewise. - -2002-11-15 Bruno Haible - - * alloca.c: Update from current gnulib version. - * memset.c: Update from current gnulib version. - -2002-11-13 Bruno Haible - - Assume ANSI C. - * libstdarg.h: Remove file. - * Makefile.am (LIBADD_SOURCE): Remove libstdarg.h. - * addext.c (addext): Use ANSI C function declarations. - * alloca.c (alloca): Likewise. - * argmatch.h (PARAMS): Remove macro. - (argmatch, argmatch_exit_fn, argmatch_invalid, argmatch_valid, - __xargmatch_internal, argmatch_to_argument): Use ANSI C function - declarations. - * argmatch.c (argmatch, argmatch_invalid, argmatch_valid, - __xargmatch_internal, argmatch_to_argument): Likewise. - * backupfile.h (PARAMS): Remove macro. - (find_backup_file_name, get_version, xget_version, addext): Use ANSI C - function declarations. - * backupfile.c (find_backup_file_name, max_backup_version, - version_number, get_version, xget_version): Likewise. - * basename.h (gnu_basename): Likewise. - * basename.c (basename): Likewise. - * c-ctype.h (PARAMS): Remove macro. - (c_isascii, c_isalnum, c_isalpha, c_isblank, c_iscntrl, c_isdigit, - c_islower, c_isgraph, c_isprint, c_ispunct, c_isspace, c_isupper, - c_isxdigit, c_tolower, c_toupper): Use ANSI C function declarations. - * c-ctype.c (c_isascii, c_isalnum, c_isalpha, c_isblank, c_iscntrl, - c_isdigit, c_islower, c_isgraph, c_isprint, c_ispunct, c_isspace, - c_isupper, c_isxdigit, c_tolower, c_toupper): Likewise. - * classpath.c (new_classpath, set_classpath, reset_classpath): - Likewise. - * concatpath.c (concatenated_pathname): Likewise. - * copy-file.h (copy_file): Likewise. - * copy-file.c (copy_file): Likewise. - * execute.h (execute): Likewise. - * execute.c (nonintr_close, nonintr_open, execute): Likewise. - * findprog.h (find_in_path): Likewise. - * findprog.c (find_in_path): Likewise. - * fstrcmp.h (fstrcmp): Likewise. - * fstrcmp.c (diag, compareseq, fstrcmp): Likewise. - * full-write.h (full_write): Likewise. - * full-write.c (full_write): Likewise. - * gcd.h (PARAMS): Remove macro. - (gcd): Use ANSI C function declarations. - * gcd.c (gcd): Likewise. - * getline.h (PARAMS): Remove macro. - (getline, getdelim): Use ANSI C function declarations. - * getline.c (getstr, getline, getdelim): Likewise. - * hash.h (PARAMS): Remove macro. - (init_hash, delete_hash, insert_entry, find_entry, iterate_table, - next_prime): Use ANSI C function declarations. - * hash.c (init_hash, delete_hash, insert_entry, insert_entry_2, - find_entry, iterate_table, lookup, compute_hashval, next_prime, - is_prime): Likewise. - * javacomp.h (compile_java_class): Likewise. - * javacomp.c (compile_java_class): Likewise. - * javaexec.h (execute_fn, execute_java_class): Likewise. - * javaexec.c (execute_java_class): Likewise. - * linebreak.h (PARAMS): Remove macro. - (locale_charset, uc_width, u8_width, u16_width, u32_width, - u8_possible_linebreaks, u16_possible_linebreaks, - u32_possible_linebreaks, mbs_possible_linebreaks, u8_width_linebreaks, - u16_width_linebreaks, u32_width_linebreaks, mbs_width_linebreaks): Use - ANSI C function declarations. - * linebreak.c (u32_mbtouc, is_cjk_encoding, is_utf8_encoding, - uc_width, u8_width, u16_width, u32_width, lbrkprop_lookup, - u8_possible_linebreaks, u16_possible_linebreaks, - u32_possible_linebreaks, u8_width_linebreaks, u16_width_linebreaks, - u32_width_linebreaks, read_file, main, iconv_string_length, - iconv_string_keeping_offsets, is_all_ascii, mbs_possible_linebreaks, - mbs_width_linebreaks, read_file, main): Likewise. - * mbswidth.h (PARAMS): Remove macro. - (mbswidth, mbsnwidth): Use ANSI C function declarations. - * mbswidth.c (mbswidth, mbsnwidth): Likewise. - * memmove.c (memmove): Likewise. - * memset.c (memset): Likewise. - * mkdtemp.h (PARAMS): Remove macro. - (mkdtemp): Use ANSI C function declarations. - * mkdtemp.c (gen_tempname, mkdtemp): Likewise. - * pathname.h (PARAMS): Remove macro. - (concatenated_pathname): Use ANSI C function declarations. - * pfnmatch.h (PARAMS): Remove macro. - (fnmatch): Use ANSI C function declarations. - * pfnmatch.c (fnmatch): Likewise. - * pipe.h (create_pipe_out, create_pipe_in, create_pipe_bidi): - Likewise. - * pipe-bidi.c (nonintr_close, create_pipe_bidi): Likewise. - * pipe-in.c (nonintr_close, nonintr_open, create_pipe_in): Likewise. - * pipe-out.c (nonintr_close, nonintr_open, create_pipe_out): Likewise. - * progname.h (set_program_name, maybe_print_progname): Likewise. - * progname.c (set_program_name): Likewise. - * safe-read.h (safe_read): Likewise. - * safe-read.c (safe_read): Likewise. - * setenv.h (PARAMS): Remove macro. - (setenv, unsetenv): Use ANSI C function declarations. - * setenv.c (compar_fn_t, __add_to_environ, setenv): Likewise. - * sh-quote.h (shell_quote_length, shell_quote_copy, shell_quote, - shell_quote_argv): Likewise. - * sh-quote.c (shell_quote_length, shell_quote_copy, shell_quote, - shell_quote_argv): Likewise. - * stpcpy.h (PARAMS): Remove macro. - (stpcpy): Use ANSI C function declarations. - * stpcpy.c (__stpcpy): Likewise. - * stpncpy.h (PARAMS): Remove macro. - (gnu_stpncpy): Use ANSI C function declarations. - * stpncpy.c (__stpncpy): Likewise. - * strcase.h (PARAMS): Remove macro. - (strcasecmp, strncasecmp): Use ANSI C function declarations. - * strcasecmp.c (__strcasecmp): Likewise. - * strncasecmp.c (__strncasecmp): Likewise. - * strcspn.c (strcspn): Likewise. - * strpbrk.h (PARAMS): Remove macro. - (strpbrk): Use ANSI C function declarations. - * strpbrk.c (strpbrk): Likewise. - * strstr.h (PARAMS): Remove macro. - (strstr): Use ANSI C function declarations. - * strstr.c (strstr): Likewise. - * tmpdir.h (PARAMS): Remove macro. - (path_search): Use ANSI C function declarations. - * tmpdir.c (direxists, path_search): Likewise. - * ucs4-utf8.h (u8_uctomb_aux, u8_uctomb): Likewise. - * ucs4-utf16.h (u16_uctomb_aux, u16_uctomb): Likewise. - * unsetenv.c (unsetenv): Likewise. - * utf8-ucs4.h (u8_mbtouc_aux, u8_mbtouc): Likewise. - * utf16-ucs4.h (u16_mbtouc_aux, u16_mbtouc): Likewise. - * vasprintf.h (PARAMS): Remove macro. - Include instead of libstdarg.h. - (asprintf, vasprintf): Use ANSI C function declarations. - * vasprintf.c: Include instead of libstdarg.h. - (int_vasprintf, asprintf, checkit): Use ANSI C function declarations. - Use va_start instead of VA_START. - * wait-process.h (wait_subprocess): Likewise. - * wait-process.c (wait_subprocess): Likewise. - * xerror.h (xasprintf, multiline_warning, multiline_error): Likewise. - * xerror.c: Include instead of libstdarg.h. - (xasprintf, multiline_warning, multiline_error): Use ANSI C function - declarations. Use va_start instead of VA_START. - * xgetcwd.h (PARAMS): Remove macro. - (xgetcwd): Use ANSI C function declarations. - * xmalloc.h (xmalloc, xcalloc, xrealloc, xstrdup): Likewise. - * xmalloc.c (fixup_null_alloc, xmalloc, xcalloc, xrealloc): Likewise. - * xsetenv.h (xsetenv): Likewise. - * xsetenv.c (xsetenv): Likewise. - * xstrdup.c (xstrdup): Likewise. - -2002-11-05 Bruno Haible - - * argmatch.c: Include gettext.h instead of and . - * error.c [!_LIBC]: Include gettext.h instead of . - * getopt.c [!_LIBC]: Include gettext.h instead of . - * obstack.c [!_LIBC]: Include gettext.h instead of . - -2002-11-04 Bruno Haible - - * getopt.c: Don't test HAVE_LIBINTL_H. - - * getopt.h: Update from current gnulib version. - * getopt.c: Likewise. - * getopt1.c: Likewise. - -2002-10-29 Bruno Haible - - * libstdarg.h: Treat SunPro C like ANSI C; it defines __STDC__ to 0. - -2002-10-27 Bruno Haible - - * liballoca.h: Put under LGPL. - * libstdarg.h: Likewise. - -2002-10-26 Bruno Haible - - * vasprintf.c (int_vasprintf): Treat 'F' like 'f'. - -2002-08-25 Bruno Haible - - * Makefile.am (MOSTLYCLEANFILES): Add stdbool.h unconditionally. - -2002-08-06 Bruno Haible - - * gettext-0.11.5 released. - -2002-07-25 Bruno Haible - - * gettext-0.11.4 released. - -2002-07-21 Bruno Haible - - * mkdtemp.c: Test HAVE_STDINT_H_WITH_UINTMAX instead of HAVE_STDINT_H. - Test HAVE_INTTYPES_H_WITH_UINTMAX instead of HAVE_INTTYPES_H. - -2002-07-17 Bruno Haible - - * gettext-0.11.3 released. - -2002-07-16 Bruno Haible - - * javaexec.h (execute_java_class): Add argument exe_dir. - * javaexec.c (execute_java_class): Add argument exe_dir. If given, - attempt to run a native executable. - * Makefile.am (DEFS): Define EXEEXT. - * javacomp.sh.in: Use HAVE_GCJ_C instead of HAVE_GCJ. - -2002-06-15 Bruno Haible - - * javacomp.c (compile_java_class): Ignore gcj versions that start with - "3.0" or "3.1". (gcj 3.0.4 compiles GetURL.java to invalid bytecode, - that crashes with an IllegalAccessError when executed by gij 3.0.4 or - with a VerifyError when executed by Sun Java. Likewise for gcj 3.1.) - -2002-05-29 Bruno Haible - - * linebreak.c (nonspacing_table_data, uc_width): Upgrade to - Unicode 3.2.0. - -2002-05-18 Bruno Haible - - * basename.h: Use __GLIBC__ >= 2, because BeOS (which defines __GLIBC__ - to -2) doesn't declare basename() properly. - * basename.c: Likewise. - -2002-05-18 Bruno Haible - - * Makefile.am (RM): New variable. - (install-exec-am): Depend on install-exec-clean. - (install-exec-clean): New rule. - -2002-05-09 Bruno Haible - - * config.charset: Update for newest glibc. Add canonical names - ISO-8859-14, KOI8-T, TCVN5712-1, GEORGIAN-PS. - -2002-05-09 Bruno Haible - - * localcharset.c (get_charset_aliases): Add more Windows specific - aliases. - -2002-05-08 Owen Taylor - - * config.charset: A few additions for Solaris. - -2001-12-05 Bruno Haible - - * localcharset.c (locale_charset): Don't return an empty string. - -2001-10-23 Bruno Haible - - * config.charset: msdos in uk_UA uses CP1125. - -2001-08-05 Bruno Haible - - Make it possible to build libcharset with CC=gcc CFLAGS="-x c++". - * localcharset.c (locale_charset): Declare as extern "C". - (get_charset_aliases): Cast malloc and realloc results to 'char *'. - -2002-05-10 Bruno Haible - - * gettext.h: On Solaris, include . - -2002-05-04 Bruno Haible - - * javacomp.c (compile_java_class): Ignore non-digits in the first - line of the output of "gcj --version". Needed for gcj 3.1. - -2002-04-30 Bruno Haible - - * stdbool.h.in (_Bool): Omit the definition if _Bool is already known - as a builtin primitive type. Needed for cc on OSF/1 5.1. - * Makefile.am (stdbool.h): Substitute the value of HAVE__BOOL. - -2002-04-26 Bruno Haible - - * basename.h: Use __GLIBC__ instead of __GNU_LIBRARY__, because - Linux libc5 doesn't declare basename() properly. - * basename.c: Likewise. - -2002-04-24 Bruno Haible - - * gettext-0.11.2 released. - -2002-03-12 Bruno Haible - - * gettext-0.11.1 released. - -2002-03-10 Bruno Haible - - Upgrade to Unicode-3.1. - * Combining.txt: New file, extracted from Unicode-3.0 PropList.txt. - * gen-lbrkprop.c: Replace 0x10000 with 0x110000 everywhere. - (fill_width): Adapt to changed format of EastAsianWidth.txt in - Unicode-3.1. - (get_lbp): Make more compatible to Unicode-3.1 LineBreak.txt. - (debug_output_lbp): Avoid gcc-3.0 warning. - (unicode_org_lbp): New variable. - (fill_org_lbp): New function. - (debug_output_org_lbp): New function. - (debug_output_org_tables): New function. - (output_lbp): Handle new negative entries in level1[] correctly. - Pretty-print level1 contents. - (main): Expect one more argument. - * lbrkprop.h: Regenerated with Unicode-3.1 tables. - * linebreak.c (nonspacing_table_data): Add one more block. - (nonspacing_table_ind): Extend up to 0x1dfff. - (uc_width): Update for Unicode-3.1. - * Makefile.am (EXTRA_DIST): Add Combining.txt. - -2001-08-07 Andreas Jaeger - Andreas Schwab - Bruno Haible - - * 3level.h (EMPTY): New macro. - (*_get, *_add, *_iterate, *_finalize): Use it instead of ~(uint32_t) 0. - -2002-03-09 Bruno Haible - - Portability to AIX 4.3.3. - * stpncpy.h (gnu_stpncpy): Renamed from stpncpy. - (stpncpy): Define as an alias. - * stpncpy.c: Compile nothing on glibc systems is set. Otherwise name - the function gnu_stpncpy. - * Makefile.am (LIBADD_SOURCE): Remove stpncpy.h, stpncpy.c. - (libgettextlib_la_SOURCES): Add stpncpy.h, stpncpy.c. - -2002-03-04 Bruno Haible - - Portability to AIX 4.3.3. - * unsetenv.c: New file, extracted from setenv.c. - * setenv.c: Move the unsetenv() function to unsetenv.c. - * setenv.h: Cope with systems that have setenv() but not unsetenv(). - * Makefile.am (LIBADD_SOURCE): Add unsetenv.c. - (c-ctype.lo, tmpdir.lo): Depend on stdbool.h. - -2002-02-21 Bruno Haible - - * strncasecmp.c (__strncasecmp): Trivial simplification. - -2002-02-24 Bruno Haible - - * libstdarg.h: New file. - * vasprintf.c: Include it. - (asprintf): Modernize varargs handling. - (checkit): Likewise. - * xerror.c: Include libstdarg.h. - (xasprintf): Modernize varargs handling. - * Makefile.am (LIBADD_SOURCE): Add libstdarg.h. - -2002-02-24 Bruno Haible - - * vasprintf.h: New file. - * vasprintf.c: Include it. - * xerror.c: Likewise. - * Makefile.am (LIBADD_SOURCE): Add vasprintf.h. - -2002-02-17 Bruno Haible - - * utf8-ucs4.h (u8_mbtouc_aux): Stricter range checking. - -2002-02-15 Bruno Haible - - * config.charset [msdosdjgpp]: For Russian, use CP866. - -2002-02-09 Bruno Haible - - * c-ctype.h (c_is*): Change return type to bool. - * c-ctype.c (c_is*): Likewise. - - * tmpdir.h (path_search): Change last argument's type to bool. - * tmpdir.c (path_search): Likewise. - (direxists): Change return type to bool. - - * vasprintf.c (int_vasprintf): Change total_width to size_t. - -2002-02-11 Bruno Haible - - * config.charset: Add support for NetBSD. - -2002-02-02 Bruno Haible - - * ucs4-utf8.h: New file. - * ucs4-utf16.h: New file. - * Makefile.am (libgettextlib_la_SOURCES): Add them. - -2002-02-03 Bruno Haible - - * xerror.c (multiline_warning): Remove temporary hack. - -2002-01-31 Bruno Haible - - * gettext-0.11 released. - -2002-01-30 Bruno Haible - - * error.c: Compile nothing if HAVE_ERROR_AT_LINE is set. - * strtoul.c: Compile nothing if HAVE_STRTOUL is set. - * Makefile.am (libgettextlib_la_SOURCES): Add error.h, error.c, - strtoul.c. - (LIBADD_SOURCE): Remove error.h, error.c, strtoul.c. - -2002-01-24 Bruno Haible - - * getline.c: Remove NDEBUG. It killed the effect of assert(). - -2002-01-24 Bruno Haible - - * Makefile.am (libgettextlib_la_LDFLAGS): Use @LTLIBINTL@ instead of - @INTLLIBS@, and @LTLIBICONV@ instead of @LIBICONV@. - -2002-01-19 Bruno Haible - - * xerror.c (multiline_warning): Add a newline if the message doesn't - terminate with a newline. - -2002-01-12 Bruno Haible - - * gettext.h (gettext_noop): Remove the parentheses around the - expansion. - -2002-01-10 Bruno Haible - - * liballoca.h: Fix typo. - -2002-01-10 Andrew Zabolotny - Bruno Haible - - * localcharset.c: Rework OS/2 support. - * config.charset: Add OS/2 support. - -2002-01-09 Bruno Haible - - * setenv.h: Make it possible to include this file from C++. - * xsetenv.h: Likewise. - -2002-01-05 Bruno Haible - - * Makefile.am (libgettextlib_la_LDFLAGS): Add -lc. Needed on AIX. - -2002-01-05 Bruno Haible - - * wait-process.c (WIFSIGNALED): Make it return false when WIFSTOPPED - returns true. - (wait_subprocess): Use WIFSIGNALED instead of WCOREDUMP || WTERMSIG. - On AIX and OSF/1, WTERMSIG has a negative value if !WIFSIGNALED. And - WCOREDUMP is a BSDism, not POSIX. - -2001-12-23 Bruno Haible - - * xsetenv.h: New file. - * xsetenv.c: New file. - * Makefile.am (libgettextlib_la_SOURCES): Add them. - * classpath.c (set_classpath): Use xsetenv instead of setenv. - (reset_classpath): Likewise. - * javacomp.c (compile_java_class): Likewise. - * javaexec.c (execute_java_class): Likewise. - -2001-12-23 Bruno Haible - - * Makefile.am (libgettextlib_la_SOURCES): Add the contents of - libgettextlib_la_HEADER, except liballoca.h. - (LIBADD_SOURCE): Add the contents of LIBADD_HEADER, plus liballoca.h. - (UNUSED_SOURCE): Add the contents of UNUSED_HEADER. - (libgettextlib_la_HEADER, LIBADD_HEADER, UNUSED_HEADER): Remove - variables. - (noinst_HEADERS): Update. - -2001-12-21 Bruno Haible - - * localcharset.c (ISSLASH): Provide definition for DOS-like systems. - * basename.c (FILESYSTEM_PREFIX_LEN, ISSLASH): Likewise. - -2001-12-22 Bruno Haible - - * binary-io.h: New file, extracted from system.h. - * exit.h: New file, extracted from system.h. - * liballoca.h: New file, extracted from system.h. - * pathname.h: New file, extracted from system.h. - * stpcpy.h: New file, extracted from system.h. - * stpncpy.h: New file, extracted from system.h. - * strcase.h: New file, extracted from system.h. - * xgetcwd.h: New file, extracted from system.h. - * system.h: Remove file. - * Makefile.am (libgettextlib_la_SOURCES): Remove xgetcwd.c. - (libgettextlib_la_HEADER): Add binary-io.h, exit.h, liballoca.h, - pathname.h. Remove system.h. - (LIBADD_HEADER): Add stpcpy.h, stpncpy.h, strcase.h. - (UNUSED_SOURCE): Add xgetcwd.c. - (UNUSED_HEADER): Add xgetcwd.h. - * argmatch.c: Include exit.h instead of . - (EXIT_FAILURE): Remove fallback definition. - * concatpath.c: Include pathname.h, , stpcpy.h instead of - system.h. - * copy-file.c: Include , binary-io.h, exit.h instead of - system.h. - (O_BINARY): Remove fallback definition. - * execute.c: Include exit.h. - (EXIT_FAILURE): Remove fallback definition. - * findprog.c: Include pathname.h instead of system.h. - * javacomp.c: Include liballoca.h. Remove alloca() declaration stuff. - * javaexec.c: Likewise. - * setenv.c: Likewise. - * linebreak.h: Include instead of . - * linebreak.c: Include instead of . - * pipe-bidi.c: Include exit.h. - (EXIT_FAILURE): Remove fallback definition. - * pipe-in.c: Include exit.h. - (EXIT_FAILURE): Remove fallback definition. - * pipe-out.c: Include exit.h. - (EXIT_FAILURE): Remove fallback definition. - * wait-process.c: Include exit.h. - (EXIT_FAILURE): Remove fallback definition. - * xerror.c: Include exit.h. - (EXIT_FAILURE): Remove fallback definition. - * xmalloc.c: Include exit.h. - (EXIT_FAILURE): Remove fallback definition. - -2001-12-21 Bruno Haible - - * minmax.h: New file, extracted from system.h. - * system.h (MIN, MAX): Remove macros. - * Makefile.am (libgettextlib_la_HEADER): Add minmax.h. - -2001-12-21 Bruno Haible - - * gettext.h: Moved here from ../intl/libgettext.h. - * Makefile.am (noinst_HEADERS): Add it. - (gettextsrcdir, gettextsrc_DATA): New variables. - * copy-file.c: Include gettext.h instead of libgettext.h. - * execute.c: Likewise. - * javacomp.c: Likewise. - * javaexec.c: Likewise. - * pipe-bidi.c: Likewise. - * pipe-in.c: Likewise. - * pipe-out.c: Likewise. - * wait-process.c: Likewise. - * xerror.c: Likewise. - * xmalloc.c: Likewise. - -2001-12-20 Bruno Haible - - * execute.c (nonintr_open): Omit prototype. On some platforms mode_t - promotes to int, not mode_t. - * pipe-in.c (nonintr_open): Likewise. - * pipe-out.c (nonintr_open): Likewise. - -2001-12-20 Bruno Haible - - * setenv.c (__add_to_environ): Don't call realloc(NULL,...), use - malloc instead. For SunOS4. - -2001-12-17 Bruno Haible - - * pfnmatch.h: New file, from fileutils-4.1/lib/fnmatch.h with - modifications. - * pfnmatch.c: New file, from fileutils-4.1/lib/fnmatch.c with - modifications. - * Makefile.am (LIBADD_SOURCE): Add pfnmatch.c. - (LIBADD_HEADER): Add pfnmatch.h. - (DISTCLEANFILES): New variable. - -2001-12-18 Bruno Haible - - * getline.h: Include , for size_t. - -2001-12-15 Bruno Haible - - * localcharset.c: Add OS/2 support. - -2001-12-11 Bruno Haible - - * argmatch.c: Include , to declare exit(). - * copy-file.c: Include , for struct stat. - * gcd.c: Include , to declare abort(). - * setenv.c: Declare alloca. - (compar_fn_t): New typedef. - (KNOWN_VALUE, STORE_VALUE): Use it. - -2001-12-08 Bruno Haible - - * pipe-in.c (create_pipe_in): Don't redirect stdin if prog_stdin - is NULL. - * pipe-out.c (create_pipe_out): Don't redirect stdout if prog_stdout - is NULL. - -2001-11-24 Bruno Haible - - * javaexec.h (execute_java_class): New argument 'quiet'. - * javaexec.c (execute_java_class): Likewise. - -2001-11-17 Bruno Haible - - * hash.c (lookup_2): Remove function, identical to 'lookup'. - (init_hash): Remove test for NULL that can never succeed. - (insert_entry_2): Resize at 75%, not 90%. Call 'lookup' instead of - 'lookup_2'. - (compute_hashval): Shift by 9 bits, not by 4 bits. This drastically - improves the quality of the hash function, especially for short - strings. - -2001-11-11 Bruno Haible - - * javaexec.sh.in: Use HAVE_JAVA instead of HAVE_JAVA_JVM. - The problem seen with automake-1.4 is gone with automake-1.5. - -2001-11-10 Bruno Haible - - * argmatch.h (PARAMS): Also test for __SUNPRO_C, because 64-bit Solaris - cc needs prototypes although it defines __STDC__ to 0 by default. - Also test for __cplusplus and __PROTOTYPES, just for consistency with - libgnuintl.h. - * c-ctype.h (PARAMS): Likewise. - * gcd.h (PARAMS): Likewise. - * getline.h (PARAMS): Likewise. - * hash.h (PARAMS): Likewise. - * linebreak.h (PARAMS): Likewise. - * mbswidth.h (PARAMS): Likewise. - * mkdtemp.h (PARAMS): Likewise. - * setenv.h (PARAMS): Likewise. - * strpbrk.h (PARAMS): Likewise. - * strstr.h (PARAMS): Likewise. - * system.h (PARAMS): Likewise. - * tmpdir.h (PARAMS): Likewise. - -2001-11-05 Bruno Haible - - * tmpdir.c: Include string.h. - -2001-11-01 Bruno Haible - - * execute.c (execute): If the subprocess fails, exit with return code - 127, not -1 (which becomes 255). - * pipe-bidi.c (create_pipe_bidi): Likewise. - * pipe-in.c (create_pipe_in): Likewise. - * pipe-out.c (create_pipe_out): Likewise. - -2001-10-31 Bruno Haible - - * Makefile.am (execute.lo, javacomp.lo, javaexec.lo, pipe-bidi.lo, - pipe-in.lo, pipe-out.lo, progname.lo, wait-process.lo, xerror.lo): - Depend on @STDBOOL_H@. - * execute.c (EXIT_FAILURE): Provide a fallback definition, for SunOS 4. - * pipe-bidi.c (EXIT_FAILURE): Likewise. - * pipe-in.c (EXIT_FAILURE): Likewise. - * pipe-out.c (EXIT_FAILURE): Likewise. - * wait-process.c (EXIT_FAILURE): Likewise. - * xerror.c (EXIT_FAILURE): Likewise. - (xasprintf): Use VA_START instead of va_start. - * javacomp.c: Include alloca() declaration stuff. - * javaexec.c: Likewise. - -2001-10-28 Bruno Haible - - * progname.c (set_program_name) [BeOS]: Make program_name absolute - before removing "lt-". - -2001-10-21 Bruno Haible - - Create a libgettextlib shared library. - * Makefile.am (noinst_LIBRARIES): Remove variable. - (lib_LTLIBRARIES): New variable. - (libgettextlib_la_SOURCES): Renamed from libnlsut_a_SOURCES. - (libgettextlib_la_HEADER): Renamed from libnlsut_a_HEADER. - (libgettextlib_la_LIBADD): Renamed from libnlsut_a_LIBADD. - (libgettextlib_la_LDFLAGS): New variable. - -2001-10-21 Bruno Haible - - * mkdtemp.c: Include if it exists. Needed on platforms - which have but not , like BeOS. - -2001-10-21 Bruno Haible - - * stdbool.h.in: Avoid syntax error on BeOS if has - already been included. - -2001-10-21 Bruno Haible - - * basename.c: #undef basename before defining it. This avoids a - warning on non-glibc platforms. - -2001-10-09 Bruno Haible - - * localcharset.c (getc): Define as getc_unlocked if available. - -2001-10-10 Bruno Haible - - * wait-process.h (wait_subprocess): New argument 'exit_on_error'. - * wait-process.c (wait_subprocess): Implement 'exit_on_error' handling. - Treat exitcode 127 like a failure to create the subprocess. - * execute.h (execute): New argument 'exit_on_error'. - * execute.c (execute): Implement 'exit_on_error' handling. - * pipe.h (create_pipe_out, create_pipe_in, create_pipe_bidi): New - arguments 'null_stderr' and 'exit_on_error'. - * pipe-in.c (create_pipe_in): Implement 'null_stderr' and - 'exit_on_error' handling. - * pipe-out.c (create_pipe_out): Likewise. - * pipe-bidi.c (create_pipe_bidi): Likewise. - * javacomp.c: Include pipe.h, wait-process.h, safe-read.h. - (compile_java_class): Update for changed execute(). When testing for - gcj, ignore gcj version 2.xx, require at least gcj 3.0. - * javaexec.c (execute_java_class): Update for changed execute(). - * Makefile.am (libnlsut_a_SOURCES): Add safe-read.c. - (libnlsut_a_HEADER): Add safe-read.h. - (UNUSED_SOURCE): Remove safe-read.c. - (UNUSED_HEADER): Remove safe-read.h. - -2001-09-25 Bruno Haible - - Upgrade to automake-1.5. - * Makefile.am (AUTOMAKE_OPTIONS): Add 'no-dependencies'. - -2001-10-20 Bruno Haible - - Assume strchr() exists. - * system.h (strchr): Remove fallback definition. - -2001-09-17 Bruno Haible - - * backupfile.h: New file, from fileutils-4.1 with modifications. - * backupfile.c: New file, from fileutils-4.1 with modifications. - * addext.c: New file, from fileutils-4.1 with modifications. - * Makefile.am (libnlsut_a_SOURCES): Add backupfile.c, addext.c. - (libnlsut_a_HEADER): Add backupfile.h. - -2001-09-17 Bruno Haible - - * argmatch.h: New file, from fileutils-4.1 with simplifications. - * argmatch.c: New file, from fileutils-4.1 with simplifications. - * Makefile.am (libnlsut_a_SOURCES): Add argmatch.c. - (libnlsut_a_HEADER): Add argmatch.h. - -2001-09-17 Bruno Haible - - * copy-file.h: New file. - * copy-file.c: New file. - * Makefile.am (libnlsut_a_SOURCES): Add copy-file.c. - (libnlsut_a_HEADER): Add copy-file.h. - -2001-09-17 Bruno Haible - - * basename.h: New file. - * basename.c: Include it. Don't compile the function if already - present in the GNU C library. - * Makefile.am (libnlsut_a_HEADER): Add basename.h. - * system.h (gnu_basename, basename): Remove. - -2001-09-09 Bruno Haible - - * xmalloc.h: New file. - * strstr.h: New file. - * system.h (xmalloc, xrealloc, xstrdup): Remove declarations, now in - xmalloc.h. - (parse_printf_format, asprintf): Remove declarations. - (strstr): Remove declaration, now in strstr.h. - * xmalloc.c: Include xmalloc.h. Modernize. Assume exists. - * xstrdup.c: Include xmalloc.h. Modernize. Assume exists. - * concatpath.c: Include xmalloc.h. - * findprog.c: Likewise. - * fstrcmp.c: Include xmalloc.h instead of system.h. - * javacomp.c: Likewise. - * javaexec.c: Likewise. - * sh-quote.c: Likewise. - * hash.c: Include xmalloc.h. Don't declare xmalloc, xcalloc. - * xgetcwd.c: Include stdlib.h and xmalloc.h. Don't declare xmalloc, - xstrdup, free. - * Makefile.am (libnlsut_a_HEADER): Add xmalloc.h. - (LIBADD_HEADER): Add strstr.h. - - * Makefile.am (INCLUDES): Add -I$(top_srcdir)/intl. Needed because - some files include "libgettext.h", in the case $builddir != $srcdir. - -2001-09-25 Bruno Haible - - * javacomp.c (compile_java_class): Recognize javac exit code 2. - -2001-09-16 Bruno Haible - - * Makefile.am (libnlsut_a_SOURCES): Remove safe-read.c. - (libnlsut_a_HEADER, LIBADD_SOURCE, LIBADD_HEADER, UNUSED_SOURCE, - UNUSED_HEADER): New variables. - (noinst_HEADERS, EXTRA_DIST): Use them. - -2001-09-08 Bruno Haible - - * pipe-bidi.c (nonintr_close): Add function prototypes. - * pipe-in.c (nonintr_close, nonintr_open): Likewise. - * pipe-out.c (nonintr_close, nonintr_open): Likewise. - -2001-09-08 Bruno Haible - - * findprog.c: Include specification header before all other headers. - * fstrcmp.c: Likewise. - * full-write.c: Likewise. - * hash.c: Likewise. - * linebreak.c: Likewise. - * mbswidth.c: Likewise. - * progname.c: Likewise. - * safe-read.c: Likewise. - * wait-process.c: Likewise. - * xerror.c: Likewise. - * getline.c: Include getline.h. - * mbswidth.h: Include , for size_t. - * wait-process.h: Include and , for pid_t. - -2001-09-08 Bruno Haible - - * javacomp.sh.in: New file. - * javaexec.sh.in: New file. - -2001-09-06 Bruno Haible - - * javacomp.h: New file. - * javacomp.c: New file. - * javaexec.h: New file. - * javaexec.c: New file. - * classpath.c: New file. - * Makefile.am (EXTRA_DIST): Add classpath.c. - (libnlsut_a_SOURCES): Add javacomp.c, javaexec.c. - (noinst_HEADERS): Add javacomp.h, javaexec.h. - -2001-09-06 Bruno Haible - - * sh-quote.h: New file. - * sh-quote.c: New file. - * Makefile.am (libnlsut_a_SOURCES): Add sh-quote.c. - (noinst_HEADERS): Add sh-quote.h. - -2001-09-06 Bruno Haible - - * strpbrk.h: New file. - * strpbrk.c: New file, from glibc-2.2.4. - * Makefile.am (EXTRA_DIST): Add strpbrk.c. - (noinst_HEADERS): Add strpbrk.h. - -2001-09-06 Bruno Haible - - * setenv.h: New file. - * setenv.c: New file, from glibc-2.2.4. - * Makefile.am (EXTRA_DIST): Add setenv.c. - (noinst_HEADERS): Add setenv.h. - -2001-09-02 Bruno Haible - - * mkdtemp.h: New file. - * mkdtemp.c: New file, mostly taken from glibc-2.2.4. - * tmpdir.h: New file. - * tmpdir.c: New file, mostly taken from glibc-2.2.4. - * Makefile.am (EXTRA_DIST): Add mkdtemp.c. - (libnlsut_a_SOURCES): Add tmpdir.c. - (noinst_HEADERS): Add mkdtemp.h, tmpdir.h. - -2001-09-02 Bruno Haible - - * execute.h: New file. - * execute.c: New file. - * Makefile.am (libnlsut_a_SOURCES): Add execute.c. - (noinst_HEADERS): Add execute.h. - -2001-09-02 Bruno Haible - - * gcd.h: New file. - * gcd.c: New file. - * Makefile.am (libnlsut_a_SOURCES): Add gcd.c. - (noinst_HEADERS): Add gcd.h. - -2001-09-02 Bruno Haible - - * pipe.h: Ensure pid_t gets declared. - * pipe-bidi.c: Include pipe.h. - * pipe-in.c: Likewise. - * pipe-out.c: Likewise. - -2001-08-26 Bruno Haible - - * printf-parse.h: Remove file. - * printf.h: Remove file. - * printf-prs.c: Remove file. - * Makefile.am (EXTRA_DIST): Remove printf-prs.c. - (noinst_HEADERS): Remove printf-parse.h, printf.h. - * system.h (MIN): New macro. - -2001-07-28 Bruno Haible - - * printf-parse.h: Don't include . - (ISDIGIT): New macro. - (read_int, parse_one_spec): Use ISDIGIT instead of isdigit. - -2001-08-05 Bruno Haible - - * stdbool.h.in (_Bool): Define differently in C++ mode. - -2001-07-23 Bruno Haible - - * system.h: Assume exists. - * fstrcmp.c: Likewise. - -2001-07-01 Bruno Haible - - * utf8-ucs4.h: New file, extracted from linebreak.c. - * utf16-ucs4.h: New file, extracted from linebreak.c. - * linebreak.c (u8_mbtouc_aux, u8_mbtouc): Moved to utf8-ucs4.h. - (u16_mbtouc_aux, u16_mbtouc): Moved to utf16-ucs4.h. - * Makefile.am (noinst_HEADERS): Add utf8-ucs4.h, utf16-ucs4.h. - -2001-06-30 Bruno Haible - - * stdbool.h.in: New file. - * Makefile.am (EXTRA_DIST): Add stdbool.h.in. - (all-local): Depend on @STDBOOL_H@. - (stdbool.h): New rule. - (MOSTLYCLEANFILES): New variable. - * progname.h: Include stdbool.h. - (error_with_progname): Change type to bool. - * progname.c (error_with_progname): Likewise. - -2001-06-10 Bruno Haible - - * findprog.h: New file. - * findprog.c: New file. - * full-write.h: New file. - * full-write.c: New file. - * pipe.h: New file. - * pipe-bidi.c: New file. - * pipe-in.c: New file. - * pipe-out.c: New file. - * safe-read.h: New file. - * safe-read.c: New file. - * wait-process.h: New file. - * wait-process.c: New file. - * Makefile.am (libnlsut_a_SOURCES): Add findprog.c, full-write.c, - pipe-bidi.c, pipe-in.c, pipe-out.c, safe-read.c, wait-process.c. - (noinst_HEADERS): Add findprog.h, full-write.h, pipe.h, safe-read.h, - wait-process.h. - -2001-05-15 Bruno Haible - - * progname.h (set_program_name): New declaration. - * progname.c: Include . - (set_program_name): New function. - -2001-05-02 Bruno Haible - - * xerror.h: New file. - * xerror.c: New file. - * Makefile.am (libnlsut_a_SOURCES): Add xerror.c. - (noinst_HEADERS): Add xerror.h. - -2001-05-01 Bruno Haible - - Prefix most error messages with the program name, except those - starting with "filename:lineno:". - * progname.h: New file. - * progname.c: New file. - * Makefile.am (libnlsut_a_SOURCES): Add progname.c. - (noinst_HEADERS): Add progname.h. - -2001-05-01 Bruno Haible - - * vasprintf.c (int_vasprintf): Upon allocation failure, return -1, - not 0, to be consistent with glibc documentation. - -2001-09-13 Bruno Haible - - * gettext-0.10.40 released. - -2001-09-13 Bruno Haible - - * alloca.c (alloca): Replace 'REGISTER' with 'register'. - Reported by Len Makin . - -2001-07-24 Bruno Haible - - * gettext-0.10.39 released. - -2001-06-24 Bruno Haible - - * config.charset: Change canonical name of BIG5HKSCS to BIG5-HKSCS. - Change canonical name of SJIS to SHIFT_JIS. - -2001-06-25 Bruno Haible - - * mbswidth.c (mbsinit): Define to 1 if not defined. For SCO 3.2v5.0.2. - -2001-04-30 Bruno Haible - - Silence "gcc -Wall -Wwrite-strings" warnings. - * localcharset.c (charset_aliases): Change type to 'const char *'. - (get_charset_aliases): Change type of 'cp' to 'const char *'. - -2001-05-23 Bruno Haible - - * gettext-0.10.38 released. - -2001-05-23 Bruno Haible - - * linebreak.c (mbs_possible_linebreaks): Avoid broken EUC-KR - conversion in glibc-2.1. - (mbs_width_linebreaks): Likewise. - -2001-05-02 Bruno Haible - - * linebreak.c (iconv_string_keeping_offsets): Work around a glibc-2.1 - bug. - -2001-04-19 Bruno Haible - - * gettext-0.10.37 released. - -2001-04-04 Bruno Haible - - * mbswidth.h: New file, from textutils-2.0.13 with modifications. - * mbswidth.c: Likewise. - * Makefile.am (noinst_HEADERS): Add mbswidth.h. - (libnlsut_a_SOURCES): Add mbswidth.c. - -2001-04-04 Bruno Haible - - * linebreak.h (UC_BREAK_UNDEFINED): New enum value. - (u8_width_linebreaks, u16_width_linebreaks, u32_width_linebreaks, - mbs_width_linebreaks): Add overrides argument. - * linebreak.c (u8_width_linebreaks, u16_width_linebreaks, - u32_width_linebreaks, mbs_width_linebreaks): Add overrides argument. - -2001-03-29 Bruno Haible - - * gettext-0.10.36 released. - -2001-03-21 Bruno Haible - - * linebreak.c: Include string.h, needed for memset() declaration. - -2001-03-11 Bruno Haible - - * xmalloc.c (fixup_null_alloc): Unify messages. - -2001-03-10 Bruno Haible - - * linebreak.c (iconv_string_length): Don't call - iconv(cd,NULL,NULL,NULL,NULL) on glibc-2.1; it crashes. - - * localcharset.c (locale_charset): Allow wildcard syntax. Resolve - alias also if codeset is empty. - * config.charset (BeOS): Use wildcard syntax. - -2001-03-09 Bruno Haible - - * config.charset: Update from libiconv-1.6. - * localcharset.c: Likewise. - -2001-03-04 Bruno Haible - - * system.h (ISSLASH, HAS_DEVICE, IS_ABSOLUTE_PATH, IS_PATH_WITH_DIR, - FILESYSTEM_PREFIX_LEN): New macros. - (concatenated_pathname): New declaration. - (SET_BINARY): New macro. - * concatpath.c: New file. - * Makefile.am (libnlsut_a_SOURCES): Add concatpath.c. - -2001-03-03 Bruno Haible - - * gen-lbrkprop.c: New file. - * 3level.h: New file. - * lbrkprop.h: New file, generated by gen-lbrkprop. - * linebreak.h: New file. - * linebreak.c: New file. - * Makefile.am (EXTRA_DIST): Add gen-lbrkprop.c, 3level.h. - (libnlsut_a_SOURCES): Add linebreak.c. - (noinst_HEADERS): Add linebreak.h, lbrkprop.h. - - * c-ctype.h: New file. - * c-ctype.c: New file. - * Makefile.am (libnlsut_a_SOURCES): Add c-ctype.c. - (noinst_HEADERS): Add c-ctype.h. - - Allow the use of locale_charset() in src. - * config.charset: New file, from ../intl/. - * localcharset.c: New file, from ../intl/. - * ref-add.sin: New file, from ../intl/. - * ref-del.sin: New file, from ../intl/. - * Makefile.am (EXTRA_DIST): Add config.charset, ref-{add,del}.sin. - (libnlsut_a_SOURCES): Add localcharset.c. - (DEFS): Define to set LIBDIR. - (INCLUDES): Add -I. -I$(srcdir) -I.. to compensate for automake's - default DEFS setting. - (all-local, install-exec-local, uninstall-local, charset.alias): New - targets. - (SUFFIXES): New variable. - (.sin.sed): New rule. - (CLEANFILES): New variable. - -2001-03-03 Bruno Haible - - * printf.h (PARAMS): GNU C always supports prototypes. - * system.h (PARAMS): Likewise. - -2001-03-05 Bruno Haible - - * vasprintf.c (int_vasprintf): Cast second arg of strtoul, to avoid - warning. - -2001-02-04 Bruno Haible - - * system.h (O_BINARY, O_TEXT, setmode, fileno): New macros for systems - that distinguish between text and binary I/O. - -2001-02-04 Bruno Haible - - * error.c: Include only if ENABLE_NLS || _LIBC. - * getopt.c: Test ENABLE_NLS instead of 'defined HAVE_LIBINTL_H'. - * obstack.c: Likewise. - -2001-01-07 Bruno Haible - - * system.h: Assume , exist. - * fstrcmp.c: Likewise. - * vasprintf.c: Likewise. - -2001-01-05 Bruno Haible - - * basename.c: Include , needed by assert on SunOS4. - (basename): Convert to K&R C syntax. - * vasprintf.c (int_vasprintf): Don't use fabs, it needs -lm on some - platforms. - -2000-12-31 Bruno Haible - - * hash.c (insert_entry): Use obstack_copy instead of obstack_copy0. - -2000-12-30 Bruno Haible - - * system.h (open_po_file): Remove declaration. - -2000-12-30 Bruno Haible - - * printf.h (printf_info): New fields is_char, is_longlong. - (PA_FLAG_CHAR): New macro. - * printf-parse.h: Include inttypes.h. - (long_long_int): Define depending on HAVE_UNSIGNED_LONG_LONG. - (ptrdiff_t): Define depending on HAVE_PTRDIFF_T. - (parse_one_spec): Handle new ISO C99 length modifiers 'j', 't', 'z'. - -2000-12-30 Bruno Haible - - * basename.c: Update from current fileutils version, keeping the - function name as `basename' or `gnu_basename'. - - * error.c: Update from glibc-2.2 version. - - * fstrcmp.h: extern declaration. - - * getline.h: Comment out declarations on glibc2 systems. - * getline.c: Make getstr() static, to avoid conflict with libncurses. - - * getopt.h: Update from glibc-2.2 version. - * getopt.c: Likewise. - - * hash.h: Update from glibc-2.2 version. Don't assume keys are NUL - terminated. - (insert_entry, find_entry): Change argument type from 'const char*' to - 'const void*'. - (iterate_table): Add keylen argument. - * hash.c: Update from glibc-2.2 version. Don't assume keys are NUL - terminated. - (xcalloc): New declaration. - (struct hash_entry): Add keylen field. - (init_hash): Use xcalloc instead of xmalloc. - (insert_entry_2): Add keylen argument. Use xcalloc instead of xmalloc. - (iterate_table): Add keylen argument. - (lookup): Compare using memcmp, not strncmp. - (lookup_2): Add keylen argument. Compare using memcmp, not strcmp. - - * memmove.c: Revert to gettext-0.10.35 version, independent of glibc. - * memset.c: Likewise. - - * obstack.h: Update from glibc-2.2 version. Add a few consts. - * obstack.c: Update from glibc-2.2 version. - - * pathmax.h: Update from current fileutils version. - - * printf-prs.c: Revert to old, not multibyte aware version. Since the - messages in the catalog can be in any encoding, use of the current - locale's encoding is wrong here. - * printf-parse.h (find_spec): Likewise. - - * strtol.c: Update from glibc-2.2 version. - - * strstr.c (strstr): Add an empty statement after 'shloop' label. - - * vasprintf.c: Include stdlib.h if it exists. - (int_vasprintf): Increase buffer size for float/double values with - positive exponent only. Recognize new ISO C99 length modifiers 'j', - 't', 'z'. - (main): Add more tests. - - * xgetcwd.c (xgetcwd): If the required pathname length is smaller - than 1024, return a memory chunk of least possible size, instead - of size PATH_MAX + 2. In the loop, increment the size proportionally. - Use free/xmalloc instead of xrealloc to avoid copying for very long - paths. - - * xmalloc.c: Use NULL where appropriate. - - * xstrdup.c (xstrdup): Change argument type to 'const char *'. - -1999-12-27 Geoff Keating - - * vasprintf.c (int_vasprintf): Don't re-read the format character - as this mishandles strings like '%%s'. - -1998-01-18 Michael Snyder - - * vasprintf.c (int_vasprintf): Increase buffer size for float/double - values. - -2000-05-06 Ulrich Drepper - - * Makefile.am (EXTRA_DIST): Add basename.c. - (libnlsut_a_SOURCES): Add basename.c. - -1998-06-01 Ulrich Drepper - - * printf-parse.h: Change back from using `unsigned char' to `char'. - -1998-05-01 08:47 Ulrich Drepper - - * gettext-0.10.35 released. - -1998-04-29 Ulrich Drepper - - * printf-parse.h: Use unsigned char for parameters to read_int and - parse_one_spec (for losing Solaris systems). - Patch by Jim Meyering. - -1998-04-28 11:42 Ulrich Drepper - - * hash.c: Include malloc.h if stdlib.h is not available. - Include either string.h or strings.h. - - * system.h: Include limits.h before defining MAX to prevent - redefinitions. - - * Makefile.am: Move basename.c from EXTRA_DIST to libnlsut_a_SOURCES. - -1998-04-27 20:51 Ulrich Drepper - - * Makefile (EXTRA_DIST): Remove obstack.c here. - (libnlsut_a_SOURCES): Add obstack.c here. - - * alloca.c: Include string.h and stdlib.h if available. Fix typos. - - * getopt.c: Update from glibc version. - - * hash.c: Include stdlib.h. Use #if instead of #ifdef while testing - HAVE_* macros. Don't include system.h. - - * printf-parse.h: Use #if instead of #ifdef. - -1997-08-18 13:47 Philippe De Muyter - - * xstrdup.c (sys/types.h): File included. - * system.h (strstr): Function prototype added. - -1997-08-15 03:01 Ulrich Drepper - - * stpcpy.c, stpncpy.c: Copy version from glibc to fix severe bugs. - -1997-08-01 15:47 Ulrich Drepper - - * Makefile.am (AUTOMAKE_OPTIONS): Require version 1.2. - -Mon Mar 10 06:52:59 1997 Ulrich Drepper - - * xstrdup.c: Add more compatibility handling. Pretty-print - preprocessor directives. - - * printf-parse.h: Define _GNU_SOURCE not __USE_GNU. - - * Makefile.am: Change for use with automake-1.1. - -1997-02-08 04:26 Ulrich Drepper - - * stpncpy.c: Update from version in GNU libc 2.0. This corrects - a long standing bug in xgettext. - -Fri Dec 6 04:20:56 1996 Ulrich Drepper - - * system.h: Use PARAMS not __P for basename prototype. - Reported by Kaveh R. Ghazi . - -Tue Dec 3 17:50:34 1996 Ulrich Drepper - - * system.h: Add prototype for basename. - - * Makefile.am (EXTRA_DIST): Add basename.c. - -Fri Nov 22 03:32:34 1996 Ulrich Drepper - - * Makefile.am (EXTRA_DIST): Rename strncase.c to strncasecmp.c. - -Sat Aug 31 04:52:56 1996 Ulrich Drepper - - * Makefile.am (nlsut_SOURCES): Move error.c to EXTRA_DIST. - -Wed Jun 19 02:45:02 1996 Ulrich Drepper - - * system.h: Add prototypes for stpncpy, strcasecmp, and - strncasecmp. - - * Makefile.am (EXTRA_DIST): Add strncase and stpncpy. - -Fri Jun 14 03:56:23 1996 Ulrich Drepper - - * getline.c (_GNU_SOURCE): Define this macro, not __USE_GNU. - - * Makefile.am (nlsut_SOURCES): Move getline.c and printf-prs.c to - EXTRA_DIST. Reported by Kaveh R. Ghazi. - -Tue Jun 11 15:28:17 1996 Ulrich Drepper - - * printf-prs.c: Add some casts for `n'. - - * printf-parse.h: Add prototypes and __USE_GNU definition. - - * getline.c: Define __USE_GNU to get prototype. - - * Makefile.am (AUTOMAKE_OPTIONS): Add variable. Must be defined - in all subdirs. - -Wed Jun 5 16:54:43 1996 Ulrich Drepper - - * Makefile.am (INCLUDES): Define include paths to intl/ dir for - file. - -Mon Jun 3 19:13:36 1996 Ulrich Drepper - - * getopt.c: Update from latest GNU libc source. We don't need - the AC_REPLACE_GNU_GETOPT anymore. - - * Makefile.am (EXTRA_DIST): Remove files mentioned in - nlsut_SOURCES from EXTRA_DIST. - (nlsut_SOURCES): Add getopt.c and getopt1.c. - -Wed Apr 24 23:48:42 1996 Ulrich Drepper - - * Makefile.in (GETOPT): Remove variable. - (OBJECTS): Don't use $(GETOPT). If not present the getopt are now - listed in @LIBOBJS@. - -Fri Apr 5 12:00:51 1996 Ulrich Drepper - - * Makefile.in (SOURCES): Remove whoami.c. - (OBJECTS): Remove whoami.o. - - * system.h: Remove prototype for `get_submitter'. - -Thu Apr 4 21:14:51 1996 Ulrich Drepper - - * system.h: Add prototype for asprintf. - -Tue Apr 2 18:53:38 1996 Ulrich Drepper - - * Makefile.in (all-gettext): New goal. Same as all. - -Tue Apr 2 12:57:44 1996 Ulrich Drepper - - * error.c, error.h: Update from version in GNU libc. - -Tue Mar 26 12:35:56 1996 Ulrich Drepper - - * error.c, error.h: Applied François' patches for more - portability. - -Mon Mar 25 01:21:31 1996 Ulrich Drepper - - * Makefile.in (SOURCES): Add strstr.c. - -Sun Mar 24 18:41:42 1996 Ulrich Drepper - - * error.c (error_with_loc): In `one error per line' mode check for - old_file_name to be NULL first. Reported by François Pinard. - -Fri Mar 1 13:38:26 1996 Ulrich Drepper - - * getopt.c: Update from latest version in GNU C Library. - * getopt1.c: Ditto. - * getopt.h: Ditto. - - * error.c (error_with_loc): Not simply compare string pointers to - test for same file name. - (error_with_loc): file_name parameter is really const. - - * error.c (error_one_per_line): New variable. - (error_with_loc): If error_one_per_line != 0, print at most one - error per line. - - * error.h: Declare new variable error_one_per_line. - -Mon Jan 1 03:12:08 1996 Ulrich Drepper - - * Makefile.in (GETOPTSRC): Remove this variable. - -Sat Dec 30 16:26:07 1995 Ulrich Drepper - - * Makefile.in (ERROR, ERRORSRC): New variables. error.c is now - part of GNU libc and will not be needed on systems running this - lib. - (SOURCES): Replace error.c with $(ERRORSRC). - (OBJECTS): Replace error.o with $(ERROR). - -Tue Dec 19 22:08:10 1995 Ulrich Drepper - - * Makefile.in (Makefile): Explicitly use $(SHELL) for running - shell scripts. - -Sat Dec 9 16:40:49 1995 Ulrich Drepper - - * whoami.c, system.h, printf.h, printf-parse.h, hash.h, hash.c, - getline.h, fstrcmp.h, fstrcmp.c, error.h, error.c: - Use PARAMS instead of __P. Suggested by Roland McGrath. - -Wed Dec 6 16:07:27 1995 ghazi@caip.rutgers.edu - - * system.h: Fix alloca declaration so that it matches the one - generated by bison on HPUX. - -Sat Nov 25 16:13:50 1995 Ulrich Drepper - - * whoami.c: Don't use #ifdef, prefer #if. - - * error.c: Capitalize arguments of macros. Patch by François Pinard. - -Thu Nov 16 22:41:32 1995 Ulrich Drepper - - * whoami.c: Correct prototype declarations. - - * xmalloc.c: Include "error.h" instead of defining error ourself. - - * system.h: Include to get FILE definition. - - * hash.c: Peter Miller suggested not to use `div' as a variable name. - - * error.c (error_print_progname): For ANSI C provide complete type. - Include error.h. Patches by Peter Miller. - -Sun Nov 12 12:34:12 1995 Ulrich Drepper - - * whoami.c: Add prototypes. - (get_submitter): Use stpcpy if available. - -Sat Nov 11 00:26:31 1995 Ulrich Drepper - - * Makefile.in (HEADERS): - Add missing pathmax.h file. Reported by François Pinard. - -Fri Nov 10 09:59:06 1995 Ulrich Drepper - - * error.h (error_print_progname): - Provide real prototype, i.e. with argument types. - Patch by Peter Miller. - -Wed Nov 8 23:25:00 1995 Ulrich Drepper - - * system.h: Add prototype for xgetcwd. - - * Makefile.in (SOURCES): Add xgetcwd.c. - (OBJECTS): Add xgetcwd.o. - -Tue Nov 7 11:44:32 1995 Ulrich Drepper - - * Makefile.in (intldir): - New variable. Use its value instead of ../intl. - -Sun Nov 5 19:40:03 1995 Ulrich Drepper - - * Makefile.in (dist-gettext): Make synonym for dist. - -Sun Nov 5 18:04:11 1995 Ulrich Drepper - - * hash.c (find_entry): Remove unused variable retval. - -Sun Nov 5 11:38:19 1995 Ulrich Drepper - - * Makefile.in (dist): Suppress error message when ln failed. - Get files from $(srcdir) explicitly. - -Sat Oct 28 14:25:13 1995 Ulrich Drepper - - * fstrcmp.c: - Revised version by Peter Miller. Now based on GNU diff's version - of this algorithm. - -Wed Sep 27 20:18:44 1995 Ulrich Drepper - - * system.h: Include sys/types.h for those old SysV systems out there. - Reported by Francesco Potorti`. - -Mon Sep 25 22:26:28 1995 Ulrich Drepper - - * obstack.h (ptrdiff_t): - Don't define unless HAVE_PTRDIFF_T is not defined. This - solves problems with Sun's compiler. Reported by Marcus Daniels. - -Mon Sep 18 10:45:48 1995 Ulrich Drepper - - * fstrcmp.h, fstrcmp.c: Initial revision - -Sun Sep 17 23:37:15 1995 Ulrich Drepper - - * Makefile.in: Add fstrcmp.[ch] to libgettext. - - * system.h (open_po_file): Remove unused `use_path' parameter. - - * hash.c: - Rewrite for uniform return values: < 0 for error cases, else >= 0. - - * Makefile.in: hash.[ch] moved from src/ to lib/ subdirectory. - -Mon Aug 28 10:05:31 1995 Ulrich Drepper - - * Makefile.in: Remove Emacs hints. - - * Makefile.in (libnlsut.a): Use $@ instead of full name. - -Sat Aug 19 17:37:24 1995 Ulrich Drepper - - * Makefile.in (install-src): Make depend on `all'. - -Tue Aug 15 05:51:25 1995 Ulrich Drepper - - * system.h (xgetcwd): Remove prototype. - -Mon Aug 14 23:52:41 1995 Ulrich Drepper - - * Makefile.in (install-src): New no-op goal. - -Wed Aug 9 10:05:09 1995 Ulrich Drepper - - * system.h (MAX): - Mark GCC variant with __extension__ and change typeof to __typeof__. - -Tue Aug 8 21:02:28 1995 Ulrich Drepper - - * strcasecmp.c: Initial revision. - - * Makefile.in (SOURCES): Add strcasecmp.c. - -Mon Aug 7 21:17:51 1995 Ulrich Drepper - - * strcspn.c: Initial revision. - - * Makefile.in (SOURCES): Add strcspn.c. - -Fri Aug 4 15:44:00 1995 Ulrich Drepper - - * Makefile.in (dist): Remove `copying instead' message. - -Wed Aug 2 18:51:33 1995 Ulrich Drepper - - * Makefile.in (ID, TAGS): Do not use $^. - -Tue Aug 1 20:07:40 1995 Ulrich Drepper - - * Makefile.in (distclean): Remove ID file. - - * Makefile.in (TAGS, ID): Use $^ as command argument. - (TAGS): Give etags -o option t write to current directory, - not $(srcdir). - (ID): Use $(srcdir) instead os $(top_srcdir)/src. - -Wed Jul 19 23:54:32 1995 Ulrich Drepper - - * strtol.c: Change copyright from LGPL to GPL. - -Tue Jul 18 20:09:04 1995 Ulrich Drepper - - * strtol.c (ULONG_MAX): Define if not defined in system header. - Reported by Francesco Potorti`. - - * printf-parse.h (parse_one_spec): Define prototype. - - * obstack.h: Put stddef.h include statement back in. - -Tue Jul 18 00:19:54 1995 Ulrich Drepper - - * vasprintf.c, strtol.c, obstack.c, getopt1.c, getopt.c, system.h, - printf.h, obstack.h, getline.h: Uniform test for __STDC__. - -Mon Jul 17 01:13:09 1995 Ulrich Drepper - - * system.h (HAVE_MALLOC_H): - Remove obsolete #else case. Was needed when we tried - to define free ourself. - - * system.h, error.h, strtoul.c, printf-parse.h, memmove.c, - getline.h: Add `Free' to Software Foundation. - - * getline.h: - Remove unneeded comment after #endif. We now use indentation. - - * getline.c: Indent preprocessor directives. - - * strtol.c (NULL): Define manualy if not defined in any included file. - -Sat Jul 15 23:59:26 1995 Ulrich Drepper - - * obstack.h: Add accidentally removed #endif. - -Sat Jul 15 23:31:45 1995 Ulrich Drepper - - * vasprintf.c, printf-prs.c, obstack.h, obstack.c, memmove.c, - printf.h, printf-parse.h: - Exchange old LGPL against new GPL (no LGPL code in normal packages). - - * getline.h: Add copyright. - - * strtoul.c, strtol.c: Initial revision - - * obstack.h (ptrdiff_t): - Don't include stddef.h. Try to get it with sys/types.h and - if _PTRDIFF_T and ptrdiff_t are not defined, define it to off_t - (which is at least defined in config.h). - - * system.h (HAVE_STDLIB_H): - Is not useful if STDC_HEADERS is not also defined. - -Sat Jul 15 00:49:22 1995 Ulrich Drepper - - * error.h: Correct definition of size_t: don't try to include - stddef.h, but instead use sys/types. If it is not found here, - the config.h file will define it. - - * system.h: Load before defining prototypes. This - avoids problems with size_t not defined in the prototypes. - - * printf-parse.h (find_spec): Handle missing mblen function. - -Thu Jul 13 22:28:38 1995 Ulrich Drepper - - * system.h (MAX): - Move definition to end to reduce possibility of redefinition. - - * whoami.c (get_username, get_hostname, get_submitter): - Use K&R prototypes. - - * vasprintf.c: Include config.h. - - * printf.h (printf_info): - Use `char' and `unsigned' instead of `unsigned char' and - `unsigned int' resp. to help these dumb K&R compilers. - - * printf-parse.h: - Compilers other than GCC don't have `long long', K&R compiler - even don't have `long double'. - -Thu Jul 13 01:41:41 1995 Ulrich Drepper - - * Makefile.in (check): New goal. - -Tue Jul 11 21:37:19 1995 Ulrich Drepper - - * vasprintf.c (HAVE_STRTOUL): - Not needed anymore because we substitute strtoul if not present. - -Tue Jul 11 01:34:06 1995 Ulrich Drepper - - * whoami.c: Define NULL is necessary. - - * obstack.h: Protect inclusion of stddef and define ptrdiff_t if - necessary. - - * memmove.c: Include sys/types.h and perhaps stdlib.h instead of - stddef.h for getting size_t defined. - - * system.h: Don't define free, qsort, and strtol when no header - file is available. - Define EXIT_{FAILURE,SUCCESS} after stdlib.h is included. - - * printf.h: Protect non-ANSI header inclusion. - Protect __P definition. - Don't use __const in prototypes. - - * printf-prs.c: Include config.h. - Protect stdlib.h inclusion. - - * printf-parse.h: Protect header inclusion for non-ANSI environments. - Protect and de-GCC-ify MAX/MIN definition. - - * Makefile.in (SOURCES): New files: strtol.c and strtoul.c. - Depend $(OBJECT) on config.h,, instead of $(LIBOBJS). - Better dependency for printf-prs.o. - -Tue Jul 4 22:09:00 1995 Ulrich Drepper - - * Makefile.in (SOURCES): add memmove.c. - - * memmove.c: Initial revision. - - * error.h: Make size_t definition correct for !__STDC__. - Include for getting size_t defined. - - * vasprintf.c: Don't use strtoul if !HAVE_STRTOUL. - - * system.h: Include also if defined HAVE_STDLIB_H. - Make sure that qsort, free and strtoul are prototyped. - -Mon Jul 3 15:02:50 1995 Ulrich Drepper - - * system.h: system.h (MAX): don't use GCC feature if !__STDC__. - Fix typo in EXIT_FAILURE defintion. - - * xmalloc.c: Include prototype for calloc.c. - - * Makefile.in (INCLUDES): even better path list. - (INCLUDES): remove unnecessary paths. - Correct path to original version. - -Sun Jul 2 02:01:43 1995 Ulrich Drepper - - * First official release. This directory contains supplementary - code taken from GNU C Library and other package's lib/ - directories. diff --git a/gnulib-local/lib/ChangeLog.1 b/gnulib-local/lib/ChangeLog.1 deleted file mode 100644 index 418b094..0000000 --- a/gnulib-local/lib/ChangeLog.1 +++ /dev/null @@ -1,1796 +0,0 @@ -2006-07-30 Bruno Haible - - * propername.c: Temporarily use c_strstr always. - -2006-07-30 Bruno Haible - - * c-strstr.h: Renamed from strstr.h. Don't test HAVE_STRSTR. - (c_strstr): Renamed from strstr. - * c-strstr.c: Renamed from strstr.c. - (c_strstr): Renamed from strstr. - * javacomp.c: Include c-strstr.h instead of strstr.h. - (is_envjavac_gcj): Use c_strstr instead of strstr. - * propername.c: Include c-strstr.h. - (proper_name_utf8): Use c_strstr instead of strstr. - -2006-07-29 Bruno Haible - - * xreadlink.c: Assume exists. - -2006-07-29 Bruno Haible - - * localcharset.c: Assume , , exist. - -2006-07-23 Bruno Haible - - Make fstrcmp multithread-safe. - * lock.h: New file, from gnulib. - * lock.c: New file, from gnulib. - * tls.h: New file, from gnulib. - * tls.c: New file, from gnulib. - * Makefile.am (libgettextlib_la_SOURCES): Add them. - * fstrcmp.c: Include lock.h, tls.h. - (uintptr_t): New macro. - (struct context): New structure, grouping all variables. - (diag, compareseq): Add context argument. - (buffer_key, bufmax_key): New variables. - (keys_init): New functions. - (keys_init_once): New variable. - (fstrcmp): Establish a struct context. Allocate memory per-thread. - -2006-07-22 Bruno Haible - - * gl_anyhash_list1.h: New file, from gnulib. - * gl_anyhash_list2.h: New file, from gnulib. - * gl_anylinked_list1.h: New file, from gnulib. - * gl_anylinked_list2.h: New file, from gnulib. - * gl_linkedhash_list.h: New file, from gnulib. - * gl_linkedhash_list.c: New file, from gnulib. - * gl_list.h: New file, from gnulib. - * gl_list.c: New file, from gnulib. - * size_max.h: New file, from gnulib. - * Makefile.am (libgettextlib_la_SOURCES): Add them. - (DEFS): Also define SIGNAL_SAFE_LIST. - * clean-temp.c: Include limits.h, gl_linkedhash_list.h. - (struct tempdir): Use gl_list_t instead of a self-made array-list. - (string_equals, string_hash): New functions. - (SIZE_BITS): New macro. - (cleanup): Use gl_list_iterator_t to walk through the list. No need - tp ignore NULLs any more. - (create_temp_dir, register_temp_file, unregister_temp_file, - register_temp_subdir, unregister_temp_subdir, - cleanup_temp_dir_contents): Update. - -2006-07-18 Bruno Haible - - * xalloc.h (xzalloc): New declaration. - * xmalloc.c (xzalloc): New function. - -2006-07-25 Bruno Haible - - * Makefile.msvc: Remove file. - * Makefile.am (EXTRA_DIST): Remove Makefile.msvc. - -2006-07-25 Bruno Haible - - * Makefile.vms: Remove file. - * Makefile.am (EXTRA_DIST): Remove Makefile.vms. - -2006-07-22 Bruno Haible - - * stdbool_.h: Update from gnulib. - - * quotearg.c: Update from gnulib. - - * pathmax.h: Update from gnulib. - - * obstack.h: Update from gnulib, keeping DLL_VARIABLE annotation. - * obstack.c: Update from gnulib. - - * minmax.h: Update from gnulib. - - * mbswidth.c: Update from gnulib. - - * wcwidth.h: New file, from gnulib. - * Makefile.am (libgettextlib_la_SOURCES): Add it. - - * getopt.c: Update from gnulib. - * getopt1.c: Likewise. - - * gcd.c: Update from gnulib. - - * fwriteerror.c: Update from gnulib. - - * fnmatch_.h: Update from gnulib. - * fnmatch.c: Likewise. - * fnmatch_loop.c: Likewise. - - * fatal-signal.c: Include , not "config.h". - * findprog.c: Likewise. - * pipe.c: Likewise. - * progname.c: Likewise. - * progreloc.c: Likewise. - * wait-process.c: Likewise. - - * c-strcasecmp.c: Update from gnulib. Don't assume that - UCHAR_MAX <= INT_MAX. - * c-strncasecmp.c: Likewise. - - * copy-file.c: Update from gnulib. - - * atexit.c: Update from gnulib. - - * verify.h: New file, from gnulib. - * argmatch.h: Update from gnulib, keeping DLL_VARIABLE annotation. - * Makefile.am (libgettextlib_la_SOURCES): Add verify.h. - -2006-07-21 Bruno Haible - - * gettext-0.15 released. - -2006-07-14 Bruno Haible - - * Makefile.am (MOSTLYCLEANFILES): Add core and *.stackdump. - -2006-07-13 Bruno Haible - - Fix construction of temporary directory names on mingw. - * tmpdir.c (ISSLASH): New macro. - (path_search): Use it, and remove also the first character if it is - a slash. - Reported by Steffen Macke . - -2006-07-13 Bruno Haible - - * Makefile.am (EXTRA_DIST): Add javaversion.class. - -2006-07-11 Bruno Haible - - * javacomp.c: Fix a comment. - Reported by Jim Meyering. - -2006-07-02 Bruno Haible - - * clean-temp.h (register_temp_file): Renamed from enqueue_temp_file. - (unregister_temp_file): Renamed from dequeue_temp_file. - (register_temp_subdir): Renamed from enqueue_temp_subdir. - (unregister_temp_subdir): Renamed from dequeue_temp_subdir. - * clean-temp.c (register_temp_file): Renamed from enqueue_temp_file. - (unregister_temp_file): Renamed from dequeue_temp_file. - (register_temp_subdir): Renamed from enqueue_temp_subdir. - (unregister_temp_subdir): Renamed from dequeue_temp_subdir. - (cleanup_temp_file, cleanup_temp_subdir): Update. - * javacomp.c (write_temp_file, is_envjavac_gcj_14_14_usable, - is_envjavac_gcj_14_13_usable, is_envjavac_nongcj_usable, - is_gcj_present, is_gcj_14_14_usable, is_gcj_14_13_usable, - is_javac_usable): Update. - -2006-06-29 Bruno Haible - - * clean-temp.h: Include . - (struct temp_dir): Add cleanup_verbose field. - (create_temp_dir): Add parentdir, cleanup_verbose arguments. - * clean-temp.c (struct tempdir): Add cleanup_verbose field. - (create_temp_dir): Add parentdir, cleanup_verbose arguments. - (do_unlink. do_rmdir): New functions. - (cleanup_temp_file, cleanup_temp_subdir, cleanup_temp_dir_contents, - cleanup_temp_dir): Use them. - * javacomp.c (is_envjavac_gcj_14_14_usable, - is_envjavac_gcj_14_13_usable, is_envjavac_nongcj_usable, - is_gcj_present, is_gcj_14_14_usable, is_gcj_14_13_usable, - is_javac_usable): Update. - -2006-06-28 Bruno Haible - - Assume on all Unix platforms. Assume closedir works. - * backupfile.c: Don't include , , . - (NLENGTH): Remove macro. - (max_backup_version): Use closedir directly. - -2006-06-27 Bruno Haible - - Assume correct S_ISDIR macro. - * mkdtemp.c: Remove test of STAT_MACROS_BROKEN. - * tmpdir.c: Remove test of STAT_MACROS_BROKEN. - -2006-06-27 Bruno Haible - - Assume ANSI C header files and functions. - * fnmatch.c (ISASCII): Remove macro. - (isblank): Renamed from ISBLANK. - (isgraph): Renamed from isgraph. - (ISPRINT, ISDIGIT, ISALNUM, ISALPHA, ISCNTRL, ISLOWER, ISPUNCT, - ISSPACE, ISUPPER, ISXDIGIT): Remove macros. - (FOLD): Update. - * fnmatch_loop.c (FCT): Update. - * getndelim2.c: Include always. - * mbswidth.c (IN_CTYPE_DOMAIN, ISPRINT, ISCNTRL): Remove macros. - (mbsnwidth): Use isprint, iscntrl instead. - * strtol.c (IN_CTYPE_DOMAIN): Remove macro. - (ISSPACE, ISALPHA, TOUPPER): Use isspace, isalpha, toupper directly. - -2006-06-28 Bruno Haible - - * xvasprintf.h: Update from gnulib. - -2006-04-14 Bruno Haible - - Assume autoconf >= 2.60. - * Makefile.am (docdir): Remove variable. - -2006-06-21 Bruno Haible - - Avoid warnings from recent versions of mcs. - * csharpcomp.sh.in (options_mcs): Don't use options -o, -L, -r any - more. Use options documented since mcs-1.0 instead. Similarly for -g. - * csharpcomp.c (compile_csharp_using_mono): Likewise. - -2006-06-17 Bruno Haible - - * iconvstring.c (UNSAFE_ICONV): New macro. - (iconv_string): Add slower but safer code for UNSAFE_ICONV. - Needed for IRIX iconv() and NetBSD's iconv(). - -2006-06-17 Bruno Haible - - * iconvstring.c (iconv_string): Recognize conversion failures also - from NetBSD's iconv(). - -2006-06-17 Bruno Haible - - * config.charset: Update for NetBSD 3.0. - -2006-06-17 Bruno Haible - - * xgetcwd.c: Assume errno.h declares errno. - * xreadlink.c: Likewise. - -2006-06-16 Eric Blake - - * unsetenv.c [!defined errno]: Assume errno.h declares errno. - * strtol.c [!defined errno]: Likewise. - -2006-06-04 Bruno Haible - - * gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS): Parenthesize. - Include stdlib.h. - -2006-05-17 Bruno Haible - - Cygwin portability. - * classpath.c (PATH_SEPARATOR) [CYGWIN]: Define as ':'. - * javaexec.c (execute_java_class): Test for jview program also on - Cygwin. - * localcharset.c (WIN32_NATIVE): Renamed from WIN32. - * progreloc.c (WIN32_NATIVE): Renamed from WIN32. - -2006-05-16 Bruno Haible - - * localcharset.c [CYGWIN]: Include . - (get_charset_aliases): For Cygwin, return the same CPxxx aliases list - as under WIN32. - (locale_charset) [CYGWIN]: Try to retrieve the encoding from the - environment variables. Fall back to GetACP(). - -2006-05-16 Bruno Haible - - * javacomp.c (is_envjavac_gcj_14_14_usable, - is_envjavac_gcj_14_13_usable, is_envjavac_nongcj_usable, - is_gcj_present, is_gcj_14_14_usable, is_gcj_14_13_usable, - is_javac_usable): Remove unused variable. - -2006-05-15 Bruno Haible - - * Makefile.am: Test flag WOE32DLL instead of CYGWINDLL. - -2006-04-30 Bruno Haible - - * progreloc.c: Include if available. - (find_executable): Use _NSGetExecutablePath when possible. - -2006-05-12 Bruno Haible - - * mkdtemp.c [MINGW]: Include . - (mkdir): Define using _mkdir. - -2006-05-11 Bruno Haible - - * Makefile.am (libgettextlib_la_SOURCES, libgettextlib_la_LDFLAGS): - Modify for Cygwin. - -2006-05-09 Bruno Haible - - * xvasprintf.c (xstrcat): Handle overflow. Suggested by Paul Eggert. - Optimize away a va_copy call. Suggested by Eric Blake. Add missing - va_end call. - -2006-05-06 Charles Wilson - - * progreloc.c (maybe_executable) [CYGWIN]: Use the access() function. - -2006-04-30 Bruno Haible - - * javacomp.h (compile_java_class): Add source_version, target_version - arguments. - * javacomp.c: Rewritten to choose only a compiler that respects the - specified source_version and target_version. - -2006-04-30 Bruno Haible - - * xvasprintf.c: Include limits.h, string.h, xsize.h. - (EOVERFLOW): Define fallback value. - (xstrcat): New function. - (xvasprintf): Recognize the special case of a string concatenation. - -2006-03-13 Bruno Haible - - * javaversion.h: New file. - * javaversion.c: New file. - * javaversion.java: New file. - * javaversion.class: New file, generated from javaversion.java. - * Makefile.am (libgettextlib_la_SOURCES): Add javaversion.h, - javaversion.c. - (pkgdatadir, pkgdata_DATA): New variables. - (EXTRA_DIST): Add javaversion.java. - (DEFS): Also define PKGDATADIR. - * Makefile.msvc (pkgdatadir, IIpkgdatadir): New variables. - (CFLAGS): Also define PKGDATADIR. - (OBJECTS): Add javaversion.obj. - (javaversion.obj): New rule. - * Makefile.vms (pkgdatadir): New variable. - (CFLAGS): Also define PKGDATADIR. - (OBJECTS): Add javaversion.obj. - (javaversion.obj): New rule. - -2006-04-30 Bruno Haible - - * xvasprintf.h: New file, from gnulib. - * xvasprintf.c: New file, from gnulib. - * xasprintf.c: New file, from gnulib. - * xerror.h (xasprintf): Remove declaration. - * xerror.c: Don't include stdarg.h, error.h, exit.h, vasprintf.h, - gettext.h. - (_): Remove macro. - (xasprintf): Remove function. - * Makefile.am (libgettextlib_la_SOURCES): Add xvasprintf.h, - xvasprintf.c, xasprintf.c. - * Makefile.msvc (OBJECTS): Add xvasprintf.obj, xasprintf.obj. - (xvasprintf.obj, xasprintf.obj): New rules. - * Makefile.vms (OBJECTS): Add xvasprintf.obj, xasprintf.obj. - (xvasprintf.obj, xasprintf.obj): New rules. - -2006-05-01 Bruno Haible - - * javacomp.sh.in: Update for changed javacomp.m4. - -2006-04-23 Bruno Haible - - * addext.c: Include unconditionally. - * clean-temp.c: Likewise. - * copy-file.c: Likewise. - * execute.c: Likewise. - * fatal-signal.c: Likewise. - * findprog.c: Likewise. - * getopt_.h: Likewise. - * mkdtemp.c: Likewise. - * pathmax.h: Likewise. - * pipe.h: Likewise. - * pipe.c: Likewise. - * safe-read.c: Likewise. - * unsetenv.c: Likewise. - * wait-process.h: Likewise. - * xgetcwd.c: Likewise. - * Makefile.am (BUILT_SOURCES): Conditionally add unistd.h. - (unistd.h): New rule. - (MOSTLYCLEANFILES): Add unistd.h. - -2006-04-17 Bruno Haible - - * Makefile.am: Use $(mkdir_p) instead of $(mkinstalldirs). - -2006-04-17 Bruno Haible - - * Makefile.am (byteswap.h): Don't use $(srcdir)/$<, for portability. - -2006-04-09 Bruno Haible - - * clean-temp.h: New file. - * clean-temp.c: New file. - * Makefile.am (libgettextlib_la_SOURCES): Add them. - * Makefile.msvc (OBJECTS): Add clean-temp.obj. - (clean-temp.obj): New rule. - * Makefile.vms (OBJECTS): Add clean-temp.obj. - (clean-temp.obj): New rule. - -2006-04-09 Bruno Haible - - * fatal-signal.c: Don't include string.h. - (at_fatal_signal): Use a copying loop instead of memcpy. - -2006-04-05 Bruno Haible - - * config.charset: Update Juan Manuel Guerrero's address. - -2006-04-02 Bruno Haible - - * gettext.h (_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS, pgettext_expr, - dpgettext_expr, npgettext_expr, dnpgettext_expr): New macros. - (dcpgettext_expr, dcnpgettext_expr): New inline functions. - Reported by Chusslove Illich . - -2006-04-02 Bruno Haible - - Support for non-ASCII author names. - * propername.h: New file. - * propername.c: New file. - * Makefile.am (libgettextlib_la_SOURCES): Add propername.h, - propername.c. - * Makefile.msvc (OBJECTS): Add propername.obj. - (propername.obj): New rule. - * Makefile.vms (OBJECTS): Add propername.obj. - (propername.obj): New rule. - -2006-03-28 Bruno Haible - - * iconvstring.h: New file. - * iconvstring.c: New file, mostly extracted from ../src/msgl-iconv.c. - * Makefile.am (libgettextlib_la_SOURCES): Add them. - * Makefile.msvc (OBJECTS): Add iconvstring.obj. - (iconvstring.obj): New rule. - * Makefile.vms (OBJECTS): Add iconvstring.obj. - (iconvstring.obj): New rule. - -2006-03-12 Bruno Haible - - * javaexec.sh.in: Update for changed javaexec.m4. - -2006-03-11 Bruno Haible - - Avoid gcc-4.x warnings. - * hash.h (struct hash_entry): New declaration. - (struct hash_table): Use it, instead of 'void *'. - * hash.c (hash_init): Update. - (lookup, hash_find_entry, insert_entry_2): Remove casts. - (resize): Update. - (hash_insert_entry, hash_set_value): Remove casts. - (hash_iterate, hash_iterate_modify): Likewise. - -2006-03-11 Bruno Haible - - * hash.h (hash_iterate_modify): New declaration. - * hash.c (hash_iterate_modify): New function. - -2006-01-10 Bruno Haible - - * localcharset.c: Assume ANSI C. Fixes a gcc warning. - Reported by Werner Lemberg . - -2005-12-29 Bruno Haible - - * progreloc.c (set_program_name_and_installdir): Fix compilation error. - -2005-12-04 Bruno Haible - - * csharpexec.sh.in: Add support for 'clix' launcher (untested). - * csharpexec.c: Likewise. - (execute_csharp_using_sscli): New function. - (execute_csharp_program): Call it. - -2005-12-04 Bruno Haible - - * csharpcomp.sh.in: Suffix for resources is .resources, not .resource. - -2005-12-04 Bruno Haible - - Cygwin portability. - * progreloc.c: Include also on Cygwin. - (find_executable): Add support for Cygwin. - (set_program_name_and_installdir): Handle also platforms with nonempty - EXEEXT. - * relocatable.c: Include also on Cygwin. - (DllMain): Add support for Cygwin. - (get_shared_library_fullname): Update. - * relocwrapper.c (add_dotbin): Handle also platforms with nonempty - EXEEXT. - Patches partially from Charles Wilson . - -2005-10-09 Bruno Haible - - * c-strcasestr.h: New file. - * c-strcasestr.c: New file, based on gnulib's strcasestr.c. - * Makefile.am (libgettextlib_la_SOURCES): Add them. - -2005-10-06 Bruno Haible - - * addext.c: Test HAVE_CONFIG_H using #ifdef. - * argmatch.c: Likewise. - * backupfile.c: Likewise. - * c-strcasecmp.c: Likewise. - * c-strncasecmp.c: Likewise. - * canonicalize.c: Likewise. - * closeout.c: Likewise. - * exitfail.c: Likewise. - * fnmatch.c: Likewise. - * full-write.c: Likewise. - * fwriteerror.c: Likewise. - * getline.c: Likewise. - * getndelim2.c: Likewise. - * getopt_.h: Likewise. - * hash.c: Likewise. - * memmove.c: Likewise. - * quote.c: Likewise. - * quotearg.c: Likewise. - * readlink.c: Likewise. - * safe-read.c: Likewise. - * setenv.c: Likewise. - * strcspn.c: Likewise. - * strerror.c: Likewise. - * strstr.c: Likewise. - * strtol.c: Likewise. - * unsetenv.c: Likewise. - * xgetcwd.c: Likewise. - * xmalloc.c: Likewise. - * xreadlink.c: Likewise. - * xsetenv.c: Likewise. - * xstrdup.c: Likewise. - Reported by Ralf Wildenhues on bug-gnulib. - -2005-10-03 Bruno Haible - - * hash.h (hash_insert_entry): Return a pointer instead of int. - * hash.c (hash_insert_entry): Return a pointer to the copy of the key. - -2005-10-03 Bruno Haible - - * hash.h: Add comments everywhere. - (hash_init): Renamed from init_hash. - (hash_destroy): Renamed from delete_hash. - (hash_find_entry): Renamed from find_entry. - (hash_insert_entry): Renamed from insert_entry. - (hash_set_value): New declaration. - (hash_iterate): Renamed from iterate_table. - * hash.c: Add comments everywhere. Reorder. - (hash_init): Renamed from init_hash. - (hash_destroy): Renamed from delete_hash. - (hash_find_entry): Renamed from find_entry. - (hash_insert_entry): Renamed from insert_entry. - (hash_set_value): New function. - (hash_iterate): Renamed from iterate_table. - -2005-10-01 Bruno Haible - - Support for context dependent translations in PO files. - * gettext.h (GETTEXT_CONTEXT_GLUE): New macro. - (pgettext, dpgettext, dcpgettext, npgettext, dnpgettext, dcnpgettext): - New macros. - (pgettext_aux, npgettext_aux): New inline functions. - -2005-08-23 Bruno Haible - - * byteswap_.h: New file, from gnulib. - * Makefile.am (BUILT_SOURCES, EXTRA_DIST, MOSTLYCLEANFILES): Adjust - for byteswap.h. - (byteswap.h): New rule. - -2005-08-16 Bruno Haible - - * strcase.h: Remove file. - * strcasecmp.c: Remove file. - * strncasecmp.c: Remove file. - * Makefile.am (LIBADD_SOURCE): Remove them. - * Makefile.msvc (OBJECTS): Remove strcasecmp.obj, strncasecmp.obj. - (strcasecmp.obj, strncasecmp.obj): Remove rules. - -2005-07-31 Bruno Haible - - * hash.c (resize): New function, extracted from insert_entry_2. - (insert_entry): Invoke resize here. - (insert_entry_2): ... not here. - -2005-07-24 Bruno Haible - - Tidy up exported symbols. - * relocatable.h (RELOCATABLE_DLL_EXPORTED) [HAVE_VISIBILITY]: Define - to the gcc visibility attribute. - -2005-07-22 Bruno Haible - - * Makefile.am: Remove rules depending on @STDBOOL_H@, @ALLOCA_H@, - @FNMATCH_H@, @GETOPT_H@. - (BUILT_SOURCES): Add $(STDBOOL_H), $(ALLOCA_H). - Reported by Alexandre Duret-Lutz . - -2005-07-09 Bruno Haible - - * csharpcomp.sh.in (options_csc): For -l option, add a .dll suffix. - * csharpcomp.c (compile_csharp_using_sscli): Likewise. - Reported by Mark Junker . - -2005-07-05 Bruno Haible - - * Makefile.am (libgettextlib_la_LDFLAGS): Use LTNOUNDEF. - -2005-07-02 Bruno Haible - - * localcharset.c (get_charset_aliases) [WIN32]: Add CP65001 and others. - Reported by via Alain Bench . - -2005-06-08 Bruno Haible - - * canonicalize.c (__realpath): Avoid gcc warnings on platforms that - don't support symbolic links. - -2005-06-08 Bruno Haible - - * binary-io.h (fileno): Undefine before defining it. Avoids a gcc - warning on mingw. - -2006-06-21 Bruno Haible - - * gettext-0.14.6 released. - -2005-05-23 Bruno Haible - - * gettext-0.14.5 released. - -2005-04-11 Bruno Haible - - * gettext-0.14.4 released. - -2005-03-22 Bruno Haible - - * Makefile.am (examplesbuildauxdir): Renamed from examplesconfigdir. - (examplesbuildaux_DATA): Renamed from examplesconfig_DATA. - -2005-03-14 Bruno Haible - - * gettext-0.14.3 released. - -2004-09-12 Bruno Haible - - * hash.c: Include instead of . - Assume an ANSI C implementation with stdlib.h, string.h. - (BITSPERBYTE, LONGBITS, bcopy): Remove macros. - -2005-02-24 Bruno Haible - - * gettext-0.14.2 released. - -2005-02-12 Bruno Haible - - * Makefile.msvc (OBJECTS): Remove strtoul.obj. - (strtoul.obj): Remove target. - * Makefile.vms (OBJECTS): Remove strtoul.obj. - (strtoul.obj): Remove target. - -2005-02-12 Bruno Haible - - * allocsa.h: Add extern "C" for C++. - * xallocsa.h: Likewise. - -2005-02-12 Bruno Haible - - * exitfail.h (exit_failure): Add DLL_VARIABLE attribute. - -2005-02-12 Bruno Haible - - * obstack.c: Update from current gnulib version. - -2005-02-10 Bruno Haible - - * allocsa.h (sa_alignof): Define differently with AIX xlc, to avoid - a bug of this compiler on AIX 3.2.5 dealing with enums. - -2005-02-07 Bruno Haible - - * c-strcase.h: New file, based on strcase.h. - * c-strcasecmp.c: New file, based on strcasecmp.c. - * c-strncasecmp.c: New file, based on strcasecmp.c. - * Makefile.am (libgettextlib_la_SOURCES): Add c-strcase.h, - c-strcasecmp.c, c-strncasecmp.c. - * Makefile.msvc (OBJECTS): Add c-strcasecmp.obj, c-strncasecmp.obj. - (c-strcasecmp.obj, c-strncasecmp.obj): New rules. - * Makefile.vms (OBJECTS): Add c-strcasecmp.obj, c-strncasecmp.obj. - (c-strcasecmp.obj, c-strncasecmp.obj): New rules. - -2005-01-29 Bruno Haible - - * progname.c (program_name): Initialize. - Needed when linking statically on MacOS X. - -2005-01-27 Bruno Haible - - * Makefile.am (libgettextlib_la_SOURCES): Remove strtoul.c. - (LIBADD_SOURCE): Add strtoul.c here. - -2005-01-28 Bruno Haible - - * stpncpy.h (stpncpy): Define as a macro without arguments, so that - stpncpy.c uses it. - -2005-01-09 Bruno Haible - - * csharpcomp.sh.in (func_tmpdir): New function. - (mcs invocation): Use it. Fix exit code. - -2005-01-07 Bruno Haible - - * csharpcomp.c: Include safe-read.h. - -2005-01-06 Bruno Haible - - * fwriteerror.h (fwriteerror): Change specification to include fclose. - * fwriteerror.c: Include . - (fwriteerror): At the end, close the file stream. Record whether - stdout was already closed. - * closeout.c: Update comments. - -2005-01-06 Bruno Haible - - * strerror.c: Update from gnulib, with HAVE_STRERROR modifications. - -2005-01-06 Bruno Haible - - * strtol.c: Update from gnulib. - * strtoul.c: Update from gnulib. - -2005-01-06 Bruno Haible - - * strstr.c: Update from gnulib. - -2005-01-06 Bruno Haible - - * strpbrk.c: Update from gnulib. - -2005-01-06 Bruno Haible - - * strcspn.c: Update from gnulib. - -2005-01-06 Bruno Haible - - * strcasecmp.c: Update from gnulib. - * strncasecmp.c: Update from gnulib. - -2005-01-06 Bruno Haible - - * stpncpy.h: Update from gnulib. - * stpncpy.c: Update from gnulib with simplifications. - * Makefile.am (libgettextlib_la_SOURCES): Remove stpncpy.h, stpncpy.c. - (LIBADD_SOURCE): Add stpncpy.h, stpncpy.c. - * Makefile.msvc: Update. - * Makefie.vms: Update. - -2005-01-06 Bruno Haible - - * error.h: Update from gnulib. - * error.c: Update from gnulib. - * Makefile.am (libgettextlib_la_SOURCES): Remove error.h, error.c. - (LIBADD_SOURCE): Add error.h, error.c here. - * Makefile.msvc: Update. - * Makefile.vms: Update. - -2005-01-06 Bruno Haible - - * argmatch.h: Update from gnulib, with DLL_VARIABLE modifications. - * argmatch.c: Update from gnulib. - -2005-01-06 Bruno Haible - - * quote.h: New file, from gnulib. - * quote.c: New file, from gnulib. - * Makefile.am (libgettextlib_la_SOURCES): Add quote.h, quote.c. - * Makefile.msvc (OBJECTS): Add quote.obj. - (quote.obj): New rule. - * Makefile.vms (OBJECTS): Add quote.obj. - (quote.obj): New rule. - -2005-01-06 Bruno Haible - - * exitfail.h: New file, from gnulib. - * exitfail.c: New file, from gnulib. - * Makefile.am (libgettextlib_la_SOURCES): Add exitfail.h, exitfail.c. - * Makefile.msvc (OBJECTS): Add exitfail.obj. - (exitfail.obj): New rule. - * Makefile.vms (OBJECTS): Add exitfail.obj. - (exitfail.obj): New rule. - -2005-01-06 Bruno Haible - - * Makefile.am (libgettextlib_la_SOURCES): Remove getopt files. - (LIBADD_SOURCE): Add getopt files here, except getopt.h. - (BUILT_SOURCES, EXTRA_DIST, all-local, getopt.h): Support for getopt - module. - * getopt.h: Remove file. - * getopt_.h: New file, from gnulib, with DLL_VARIABLE modifications. - * getopt.c: Update from gnulib. - * getopt1.c: Update from gnulib. - * getopt_int.h: New file, from gnulib. - -2005-01-06 Bruno Haible - - * fnmatch_.h: Upgrade from gnulib. - * fnmatch.c: Upgrade from gnulib. - * fnmatch_loop.c: New file, from gnulib. - * Makefile.am (DISTCLEANFILES): Remove fnmatch.h. - (BUILT_SOURCES): New variable. - (EXTRA_DIST): Add fnmatch_loop.c. - * Makefile.vms (fnmatch.obj): Depend also on fnmatch_loop.c. - -2004-12-19 Paul Eggert - - * alloca_.h: Conditionalize on _GNULIB_ALLOCA_H, not _ALLOCA_H. - -2004-12-18 Bruno Haible - - * fatal-signal.c (fatal_signals): Make non-const. - (init_fatal_signals): New function. - (uninstall_handlers, install_handlers): Ignore signals that were set to - SIG_IGN. - (at_fatal_signal): Call init_fatal_signals. - (init_fatal_signal_set): Likewise. Ignore signals that were set to - SIG_IGN. - Reported by Paul Eggert. - -2004-11-11 Jim Meyering - - * linebreak.c: Remove trailing blanks. - -2004-11-10 Paul Eggert - - * quotearg.c (struct quoting_options): Use unsigned int for - quote_these_too, so that right shifts are well defined. All uses - changed. - -2004-11-05 Bruno Haible - - * readlink.c: Include stddef.h, needed for size_t on Woe32. - Reported by Mark D. Baushke . - -2004-11-02 Bruno Haible - - * setenv.h (unsetenv): Define as a macro if the system's unsetenv() - function returns void. - -2004-10-04 Paul Eggert - - * unlocked-io.h: Don't worry about USE_UNLOCKED_IO; that's now - the includer's responsibility. - -2004-08-06 Paul Eggert - - * full-write.c: Import changes from coreutils. - -2004-08-06 Paul Eggert - - * safe-read.c: Import changes from coreutils. - -2004-08-06 Paul Eggert - - * quotearg.c, quotearg.h: Import changes from coreutils. - -2004-08-06 Paul Eggert - - * setenv.c: Import changes from coreutils. - -2004-08-03 Simon Josefsson - - * progname.h: Don't include stdbool.h. - -2004-07-16 Bruno Haible - - * mbswidth.h: Add extern "C" for C++. - Reported by Albert Chin-A-Young . - -2003-09-09 Paul Eggert - - * memmove.c, memset.c: Include . - Use types required by C89 in prototype. - -2003-09-08 Paul Eggert - - * atexit.c (atexit): Define using a prototype. - -2004-12-10 Bruno Haible - - * obstack.h: Update from current gnulib version. - * obstack.c: Update from current gnulib version. - Reported by Raphaël Zhou . - -2004-11-23 Bruno Haible - - * gettext.h [!ENABLE_NLS]: When using GNU libstdc++, include - early. - Reported by Peter Breitenlohner . - -2004-10-07 Bruno Haible - - * gen-lbrkprop.c (output_tables): Emit a GPL copyright notice. - * lbrkprop.h: Update. - -2004-09-11 Bruno Haible - - * allocsa.valgrind: New file. - * Makefile.am (EXTRA_DIST): Add it. - -2004-09-01 Bruno Haible - - * config.charset: Add support for Darwin 7. - -2004-08-08 Bruno Haible - - * pathname.h (FILE_SYSTEM_PREFIX_LEN): Renamed from - FILESYSTEM_PREFIX_LEN. - * progreloc.c: Likewise. - * concatpath.c (concatenated_pathname): Use FILE_SYSTEM_PREFIX_LEN. - * basename.c (FILE_SYSTEM_PREFIX_LEN): Renamed from - FILESYSTEM_PREFIX_LEN. - (basename): Update. - * relocatable.c (FILE_SYSTEM_PREFIX_LEN): Renamed from - FILESYSTEM_PREFIX_LEN. - (compute_curr_prefix): Update. - -2004-05-27 Bruno Haible - - * execute.c (environ): Declare if needed. - * pipe.c (environ): Likewise. - Reported by Michael Schloh von Bennewitz . - -2004-04-28 Bruno Haible - - * basename.c (FILESYSTEM_PREFIX_LEN, ISSLASH): Treat Cygwin like - Windows, since it now accepts Windows pathnames. - * findprog.c (find_in_path): Treat Cygwin like Windows, since it also - implicitly appends .exe to executables. - * localcharset.c (ISSLASH): Treat Cygwin like Windows, since it now - accepts Windows pathnames. - * pathname.h (ISSLASH, IS_PATH_WITH_DIR, FILESYSTEM_PREFIX_LEN): Treat - Cygwin like Windows, since it now accepts Windows pathnames. - * relocatable.c (ISSLASH, IS_PATH_WITH_DIR, FILESYSTEM_PREFIX_LEN): - Treat Cygwin like Windows, since it now accepts Windows pathnames. - (compute_curr_prefix): Likewise. - * progreloc.c (ISSLASH, IS_PATH_WITH_DIR, FILESYSTEM_PREFIX_LEN): Treat - Cygwin like Windows, since it now accepts Windows pathnames. - Reported by Derek Robert Price . - -2004-04-23 Bruno Haible - - * localcharset.c (get_charset_aliases): Allow the CHARSETALIASDIR - environment variable to override LIBDIR. - Suggested by Matthias Clasen . - -2004-04-20 Jim Meyering - Bruno Haible - - * localcharset.c (get_charset_aliases) [!VMS && !WIN32]: Don't leak - memory when realloc fails. - -2004-03-18 Paul Eggert - Bruno Haible - - * mbswidth.h: Include only if HAVE_DECL_MBSWIDTH_IN_WCHAR_H, - not on all platforms that have . - * mbswidth.c: Include and before . - -2004-03-19 Bruno Haible - - * Makefile.am (install-exec-clean): Don't remove libgettextlib.a on - AIX. - Reported by Kouichi Hashikawa . - -2004-03-08 Bruno Haible - - * csharpcomp.c (compile_csharp_using_sscli): Test whether csc is not - the chicken scheme's 'csc' compiler. - Reported by Colin Marquardt . - -2004-02-07 Bruno Haible - - * xalloc.h (xalloc_oversized): New macro, from gnulib. - * quotearg.h: New file, from gnulib. - * quotearg.c: New file, from gnulib. - * sh-quote.c: Include quotearg.h. - (sh_quoting_options): New variable. - (init_sh_quoting_options): New function. - (shell_quote_length, shell_quote_copy, shell_quote): Rewrite to use - quotearg. - * Makefile.am (libgettextlib_la_SOURCES): Add quotearg.h, quotearg.c. - * Makefile.msvc (OBJECTS): Add quotearg.obj. - (quotearg.obj): New rule. - * Makefile.vms (OBJECTS): Add quotearg.obj. - (quotearg.obj): New rule. - -2004-02-06 Bruno Haible - - * allocsa.h (sa_alignof): Define differently with HP-UX cc, to avoid - a bug of this cc on HP-UX 10.20 dealing with enums. - Reported by Christopher Seip . - -2004-02-03 Bruno Haible - - * pipe.c: New file, synthesis of pipe-in.c, pipe-out.c, pipe-bidi.c. - * pipe-in.c: Remove file. - * pipe-out.c: Remove file. - * pipe-bidi.c: Remove file. - * Makefile.am (libgettextlib_la_SOURCES): Add pipe.c, Remove pipe-in.c, - pipe-out.c, pipe-bidi.c. - * Makefile.msvc (OBJECTS): Add pipe.obj. Remove pipe-in.obj, - pipe-out.obj, pipe-bidi.obj. - (pipe.obj): New rule. - (pipe-in.obj, pipe-out.obj, pipe-bidi.obj): Remove rules. - * Makefile.vms (OBJECTS): Add pipe.obj. Remove pipe-in.obj, - pipe-out.obj, pipe-bidi.obj. - (pipe.obj): New rule. - (pipe-in.obj, pipe-out.obj, pipe-bidi.obj): Remove rules. - -2004-01-29 Bruno Haible - - * gettext-0.14.1 released. - -2004-01-28 Bruno Haible - - * gettext-0.14 released. - -2004-01-24 Bruno Haible - - * progreloc.c (xstrdup): Define as strdup if no xmalloc should be used. - -2004-01-21 Bruno Haible - - * config.charset: Add support for MacOS X (Darwin). - -2004-01-10 Bruno Haible - - * csharpcomp.c (compile_csharp_using_pnet, compile_csharp_using_mono, - compile_csharp_using_sscli): New functions. - (compile_csharp_class): Call them. Respect the CSHARP_CHOICE_* macros. - * csharpexec.c (execute_csharp_using_pnet, execute_csharp_using_mono): - New functions. - (execute_csharp_program): Call them. Respect the CSHARP_CHOICE_* - macros. - -2004-01-10 Bruno Haible - - * csharpcomp.sh.in: Copy the mcs output to stderr, dropping the - "Compilation succeeded" message. - * csharpcomp.c: Include errno.h, pipe.h, wait-process.h, getline.h. - (compile_csharp_class): Copy the mcs output to stderr, dropping the - "Compilation succeeded" message. - -2003-12-26 Bruno Haible - - Support for C#. - * csharpcomp.sh.in: New file. - * csharpcomp.h: New file. - * csharpcomp.c: New file. - * csharpexec.sh.in: New file. - * csharpexec.h: New file. - * csharpexec.c: New file. - * classpath.c (CLASSPATHVAR): New variable. - (new_classpath, set_classpath, reset_classpath): Use it instead of - hardcoding "CLASSPATH". - * Makefile.am (libgettextlib_la_SOURCES): Add csharpcomp.h, - csharpcomp.c, csharpexec.h, csharpexec.c. - (examplesconfig_DATA): Add csharpcomp.sh.in, csharpexec.sh.in. - * Makefile.msvc (OBJECTS): Add csharpcomp.obj, csharpexec.obj. - (csharpcomp.obj, csharpexec.obj): New rules. - * Makefile.vms (OBJECTS): Add csharpcomp.obj, csharpexec.obj. - (csharpcomp.obj, csharpexec.obj): New rules. - -2003-12-28 Bruno Haible - - * wait-process.c (wait_subprocess): Add ignore_sigpipe argument. - * wait-process.c (wait_subprocess): Likewise. Handle SIGPIPE specially. - * execute.h (execute): Add ignore_sigpipe argument. - * execute.c (execute): Likewise. - * javacomp.c (compile_java_class): Always pass ignore_sigpipe = false. - * javaexec.c (execute_java_class): Likewise. - -2003-09-12 Paul Eggert - - * setenv.c (clearenv): Define via prototype. - -2003-09-10 Bruno Haible - - * setenv.c: Include and unconditionally. - * unsetenv.c: Likewise. - -2003-12-12 Bruno Haible - - Assume automake-1.8. - * Makefile.am (install-exec-local): Renamed from install-exec-am. - -2003-11-30 Bruno Haible - - * alloca.c: Remove file. - * Makefile.am (LIBADD_SOURCE): Remove alloca.c. - (libgettextlib_la_LIBADD): Drop @LTALLOCA@. - -2003-11-30 Bruno Haible - - Safer stack allocation. - * allocsa.h: New file. - * allocsa.c: New file. - * xallocsa.h: New file. - * xallocsa.c: New file. - * canonicalize.c: Include allocsa.h. - (__realpath): Use allocsa instead of alloca. Don't clobber errno right - before returning NULL. - * javacomp.c: Include xallocsa.h. - (compile_java_class): Use allocsa instead of alloca. - * javaexec.c: Include xallocsa.h. - (execute_java_class): Use allocsa instead of alloca. - * relocwrapper.c: Indirectly depends on allocsa. - * setenv.c: Include allocsa.h. - (alloca): Remove fallback definition. - (freea): Remove macro. - (__add_to_environ) [!_LIBC]: Use allocsa instead of alloca. Use freesa - instead of freea. - * Makefile.am (libgettextlib_la_SOURCES): Add allocsa.h, allocsa.c, - xallocsa.h, xallocsa.c. - * Makefile.msvc (OBJECTS): Add allocsa.obj, xallocsa.obj. - (allocsa.obj, xallocsa.obj): New rules. - * Makefile.vms (OBJECTS): Add allocsa.obj, xallocsa.obj. - (allocsa.obj, xallocsa.obj): New rules. - -2003-12-17 Bruno Haible - - * gettext-0.13.1 released. - -2003-12-02 Bruno Haible - - * config.charset: Treat the new country name CS like the old country - name YU. - -2003-11-30 Bruno Haible - - * gettext-0.13 released. - -2003-11-28 Bruno Haible - - * Makefile.msvc (OBJECTS): Fix typo. - * wait-process.c (cleanup_slaves): Use ANSI C declaration. - -2003-11-27 Bruno Haible - - * wait-process.c: On Windows, include windows.h. Needed on mingw. - -2003-11-17 Bruno Haible - - * canonicalize.c: #undef realpath after but before the - system includes, so as to avoid a prototype clash on Solaris 2.5.1. - Reported by Warren L. Dodge . - -2003-11-17 Bruno Haible - - * wait-process.c (wait_process): Disable the 2003-10-31 waitid() patch. - -2003-11-16 Bruno Haible - - * xsize.h (xmax): New function. - (xsum, xsum3, xsum4): Declare as "pure" functions. - -2003-11-15 Bruno Haible - - * Makefile.am (AM_CPPFLAGS): Renamed from INCLUDES. - -2003-11-15 Bruno Haible - - * Makefile.am (docdir, examplesconfigdir, examplesconfig_DATA): New - variables. - -2003-11-11 Bruno Haible - - * xsize.h (SIZE_MAX): Remove fallback definition. - -2003-11-05 Bruno Haible - - * xsize.h: Include limits.h, to avoid a possible collision with - SIZE_MAX defined in on Solaris. - -2003-11-04 Bruno Haible - - * xsize.h: New file. - * linebreak.c: Include xsize.h. - (mbs_possible_linebreaks, mbs_width_linebreaks): Check malloc() - argument for overflow. - * Makefile.am (libgettextlib_la_SOURCES): Add xsize.h. - -2003-10-31 Bruno Haible - - * wait-process.c (wait_process): Use waitid with WNOWAIT if available, - to avoid (extremely rare) race condition. - -2003-10-27 Bruno Haible - - * stdbool_.h: Better support for BeOS. - -2003-10-14 Bruno Haible - - * hash.h: Make it includable in C++ mode. - -2003-10-21 Bruno Haible - - * canonicalize.c (lstat): Define as an alias to 'stat' on systems - without symbolic links. - -2003-10-21 Bruno Haible - - * wait-process.c (kill): Define appropriately for native Woe32 API. - -2003-10-21 Bruno Haible - - * mkdtemp.c (mkdir): Redefine on mingw. - -2003-10-17 Bruno Haible - - * binary-io.h: Avoid warnings on Cygwin. - -2003-10-09 Bruno Haible - - * xalloc.h: Renamed from xmalloc.h. - * classpath.c: Include xalloc.h instead of xmalloc.h. - * concatpath.c: Likewise. - * fatal-signal.c: Likewise. - * findprog.c: Likewise. - * fstrcmp.c: Likewise. - * hash.c: Likewise. - * javacomp.c: Likewise. - * javaexec.c: Likewise. - * progreloc.c: Likewise. - * relocatable.c: Likewise. - * sh-quote.c: Likewise. - * w32spawn.h: Likewise. - * wait-process.c: Likewise. - * xgetcwd.c: Likewise. - * xmalloc.c: Likewise. - * xreadlink.c: Likewise. - * xstrdup.c: Likewise. - * Makefile.am (libgettextlib_la_SOURCES): Use xalloc.h instead of - xmalloc.h. - * Makefile.msvc: Reorder accordingly. - * Makefile.vms: Likewise. - -2003-10-07 Bruno Haible - - More reliable subprocess cleanup. - * javacomp.c (compile_java_class): Pass slave_process = true to - execute(). create_pipe_in(), wait_subprocess(). - * javaexec.c (execute_java_class): Pass slave_process = true to - execute(). - - * wait-process.h (wait_subprocess): Add slave_process argument. - (register_slave_subprocess): New declaration. - * wait-process.c: Include string.h, signal.h, fatal-signal.h, - xmalloc.h. - (slaves_entry_t): New type. - (static_slaves, slaves, slaves_count, slaves_allocated): New variables. - (TERMINATOR): New macro. - (cleanup_slaves, register_slave_subprocess, - unregister_slave_subprocess): New functions. - (wait_subprocess): Add slave_process argument. - * execute.h (execute): Add slave_process argument. - * execute.c: Include signal.h, fatal-signal.h. - (execute): Add slave_process argument. - * pipe.h (create_pipe_in, create_pipe_out, create_pipe_bidi): Add - slave_process argument. - * pipe-in.c: Include signal.h, fatal-signal.h, wait-process.h. - (create_pipe_in): Add slave_process argument. - * pipe-out.c: Include signal.h, fatal-signal.h, wait-process.h. - (create_pipe_out): Add slave_process argument. - * pipe-bidi.c: Include signal.h, fatal-signal.h, wait-process.h. - (create_pipe_bidi): Add slave_process argument. - -2003-10-08 Bruno Haible - - * fatal-signal.h: New file. - * fatal-signal.c: New file. - * Makefile.am (libgettextlib_la_SOURCES): Add them. - * Makefile.msvc (OBJECTS): Add fatal-signal.obj. - (fatal-signal.obj): New rule. - * Makefile.vms (OBJECTS): Add fatal-signal.obj. - (fatal-signal.obj): New rule. - -2003-09-21 Bruno Haible - - * vasprintf.c (int_vasprintf): Assume ANSI C when copying a structure. - -2003-09-16 Bruno Haible - - Portability to SunOS 4. - * atexit.c: New file, from gnulib with modifications. - * Makefile.am (LIBADD_SOURCE): Add atexit.c. - -2003-09-14 Bruno Haible - - * closeout.c: Include fwriteerror.h. - (close_stdout_status): Use improved errno value from fwriteerror(). - Don't call fclose; it is be done implicitly during exit(). - -2003-09-14 Bruno Haible - - * fwriteerror.h: New file. - * fwriteerror.c: New file. - * Makefile.am (libgettextlib_la_SOURCES): Add fwriteerror.h, - fwriteerror.c. - * Makefile.msvc (OBJECTS): Add fwriteerror.obj. - (fwriteerror.obj): New rule. - * Makefile.vms (OBJECTS): Add fwriteerror.obj. - (fwriteerror.obj): New rule. - -2003-09-13 Bruno Haible - - * closeout.h: New file, from gnulib with modifications. - * closeout.c: New file, from gnulib with modifications. - * Makefile.am (libgettextlib_la_SOURCES): Add closeout.h, closeout.c. - * Makefile.msvc (OBJECTS): Add closeout.obj. - (closeout.obj): New rule. - * Makefile.vms (OBJECTS): Add closeout.obj. - (closeout.obj): New rule. - -2003-09-12 Paul Eggert - - * progreloc.c (get_full_program_name): Define via prototype. - -2003-08-28 Bruno Haible - - * binary-io.h: Undefine O_BINARY before defining it. This avoids a - warning on QNX, which defines O_BINARY to 000000. - -2003-08-27 Bruno Haible - - * getopt.h: Include config.h. Needed for DLL_VARIABLE on OSF/1 4.0. - -2003-08-24 Bruno Haible - - * binary-io.h: Include , to avoid a compilation error when - MSVC7 is included later. - -2003-08-24 Bruno Haible - - * error.h: Use ANSI C "..." declarations when compiling with MSVC, even - though it doesn't define __STDC__ by default. - * error.c: Use when compiling with MSVC, even though it - doesn't define __STDC__ by default. - -2003-08-24 Bruno Haible - - Support for building DLLs on Windows. - * argmatch.h (argmatch_die): Add DLL_VARIABLE attribute. - * backupfile.h (simple_backup_suffix): Likewise. - * error.h (error_print_progname, error_message_count, - error_one_per_line): Likewise. - * error-progname.h (error_with_progname): Likewise. - * getopt.h (optarg, optind, opterr, optopt): Likewise. - * obstack.h (obstack_alloc_failed_handler, obstack_exit_failure): - Likewise. - * progname.h (program_name): Likewise. - -2003-08-24 Bruno Haible - - * backupfile.h: Make this file includable in C++ mode: add extern "C". - * basename.h: Likewise. - * copy-file.h: Likewise. - * error-progname.h: Likewise. - * findprog.h: Likewise. - * full-write.h: Likewise. - * pathname.h: Likewise. - * pipe.h: Likewise. - * progname.h: Likewise. - * relocatable.h: Likewise. - * stpcpy.h: Likewise. - * stpncpy.h: Likewise, - * strcase.h: Likewise. - * strstr.h: Likewise. - * wait-process.h: Likewise. - * xerror.h: Likewise. - * xmalloc.h: Likewise. - -2003-08-23 Bruno Haible - - * getline.h: Update from gnulib. - * getline.c: Update from gnulib. - * getndelim2.h: New file, from gnulib. - * getndelim2.c: New file, from gnulib. - * Makefile.am (LIBADD_SOURCE): Add getndelim2.h, getndelim2.c. - * Makefile.msvc (OBJECTS): Add getndelim2.obj. - (getndelim2.obj): New rule. - * Makefile.vms (OBJECTS): Add getndelim2.obj. - (getndelim2.obj): New rule. - -2003-08-23 Bruno Haible - - * fnmatch_.h: Renamed from pfnmatch.h. - * fnmatch.c: Renamed from pfnmatch.c. - * Makefile.am (LIBADD_SOURCE): Remove pfnmatch.h, pfnmatch.c, add - fnmatch.c. - (EXTRA_DIST): Add fnmatch_.h. - (all-local): Depend on fnmatch.h. - (fnmatch.h): New rule. - (MOSTLYCLEANFILES): Add fnmatch.h. - * Makefile.msvc (OBJECTS): Remove pfnmatch.obj, add fnmatch.obj. - (fnmatch.obj): Renamed from pfnmatch.obj. - * Makefile.vms (OBJECTS): Remove pfnmatch.obj, add fnmatch.obj. - (fnmatch.h): Update rule. - (fnmatch.obj): Renamed from pfnmatch.obj. - -2003-07-01 Paul Eggert - - * xreadlink.c: Include unconditionally, instead of - having it depend on HAVE_SYS_TYPES_H. - -2003-06-27 Bruno Haible - - Avoid use of *_unlocked functions on Solaris 2.5.1. - * localcharset.c: Test HAVE_DECL_GETC_UNLOCKED, not HAVE_GETC_UNLOCKED. - Reported by Eric Botcazou . - -2003-08-22 Bruno Haible - - * error-progname.h: New file, extracted from progname.h. - * error-progname.c: New file, extracted from progname.c. - * progname.h (error_with_progname, maybe_print_progname): Remove - declarations. - * progname.c (error_with_progname): Remove variable. - (maybe_print_progname): Remove function. - * xerror.c: Include error-progname.h. - * Makefile.am (libgettextlib_la_SOURCES): Add error-progname.h and - error-progname.c. - * Makefile.msvc (OBJECTS): Add error-progname.obj. - (error-progname.obj): New rule. - * Makefile.vms (OBJECTS): Add error-progname.obj. - (error-progname.obj): New rule. - -2003-08-20 Bruno Haible - - * config.charset (linux-gnulibc1*): Change hr_HR, ro_RO to ISO-8859-2. - Reported by Alain Guibert . - -2003-08-11 Bruno Haible - - * stdbool_.h: Update from gnulib. - 2003-08-11 Bruno Haible - * stdbool_.h (_Bool): Undo last change; instead use a negative - enum value to ensure that _Bool promotes to int. Use #define - for _Bool when using the Solaris C compiler. Adds comments - suggested by Paul Eggert. - 2003-08-03 Paul Eggert - * stdbool_.h (_Bool): Make it signed char, instead of - an enum type, so that it's guaranteed to promote to int. See: - - -2003-05-28 Paul Eggert - - * safe-read.c (CHAR_BIT): Don't define, since is guaranteed - to do that. - * safe-read.c (INT_MAX): Don't define, since does that. - * safe-read.c (TYPE_MINIMUM, TYPE_MAXIMUM): Remove; no longer needed. - * safe-read.c: Remove TYPE_SIGNED; no longer needed. - -2003-04-25 Bruno Haible - - * copy-file.c: Include , for size_t. - -2003-03-03 Paul Eggert - Bruno Haible - - * mbswidth.h: Include . Needed for UnixWare 7.1.1. - Reported by John Hughes, see - http://mail.gnu.org/archive/html/bug-bison/2003-02/msg00030.html - -2003-01-28 Bruno Haible - - * c-ctype.h: Assume C_CTYPE_CONSECUTIVE_DIGITS. - (c_isascii, c_isalnum, c_isalpha, c_isxdigit): Optimize. - * c-ctype.c (c_isascii, c_isalnum, c_isalpha, c_ispunct, c_isxdigit): - Optimize. - Suggested by Paul Eggert. - -2003-01-23 Bruno Haible - - * minmax.h: Add comments from Paul Eggert. - -2002-11-15 Bruno Haible - - * strcspn.c: Include . - * strpbrk.c: Minimize diffs to glibc. Include . - -2003-08-14 Bruno Haible - - * config.charset: Add support for Linux libc5. Based on data from - Alain Guibert . - -2003-08-01 Bruno Haible - - * relocatable.c (find_shared_library_fullname): Disable the code on - Linux/libc5. Reported by Alain Guibert . - -2003-07-09 Paul Eggert - - * alloca_.h: Switch from LGPL to GPL. - -2003-07-01 Bruno Haible - - * readlink.c: New file, from gnulib. - * Makefile.am (LIBADD_SOURCE): Add it. - -2003-07-01 Bruno Haible - - * Makefile.am (EXTRA_DIST, stdbool.h): Use stdbool_.h instead of - stdbool.h.in. - -2003-05-28 Paul Eggert - - * pathmax.h: Include without checking for HAVE_LIMITS_H. - * addext.c: Likewise. - * backupfile.c: Likewise. - * xreadlink.c: Likewise. - -2003-06-23 Bruno Haible - - Avoid compilation units that are empty after preprocessing. - * canonicalize.c: Add dummy declaration. - * strerror.c: Likewise. - * strtoul.c: Likewise. - * error.c: Include even if there's nothing to be compiled. - -2003-06-22 Bruno Haible - - Portability to mingw32. - * relocatable.c [WIN32]: Include . - Reported by Jeff Bonggren . - -2003-06-22 Bruno Haible - - * relocatable.c (compute_curr_prefix): Comment out this function in - the case when it is not used. - Reported by Pavel Roskin . - -2003-06-13 Bruno Haible - - * wait-process.h (wait_subprocess): Add null_stderr argument. - * wait-process.c (wait_subprocess): Add null_stderr argument. - When !exit_on_error && !null_stderr, still emit error messages, but - don't exit. - * execute.c (execute): When !exit_on_error && !null_stderr, still - emit error messages, but don't exit. Update wait_subprocess call. - * pipe-in.c (create_pipe_in): When !exit_on_error && !null_stderr, - still emit error messages, but don't exit. - * pipe-out.c (create_pipe_out): Likewise. - * pipe-bidi.c (create_pipe_bidi): Likewise. - * javacomp.c (compile_java_class): Update wait_subprocess call. - -2003-06-08 Bruno Haible - - * Makefile.vms (alloca.h): New rule. - (all, javacomp.obj, javaexec.obj): Depend on it. - (getopt.obj): Compile with ELIDE_CODE. - * canonicalize.c (__getcwd) [VMS]: Pass 3 arguments to getcwd. - * xgetcwd.c (getcwd) [VMS]: Pass 3 arguments. - Reported by Jouk Jansen . - -2003-05-22 Bruno Haible - - * gettext-0.12.1 released. - -2003-05-18 Bruno Haible - - * Makefile.msvc (DEBUGFLAGS): New variable. - (gettextlib.lib): Use it. - -2003-05-17 Bruno Haible - - * gettext-0.12 released. - -2003-05-17 Bruno Haible - - * Makefile.msvc (OBJECTS): Remove strpbrk.obj. - (strpbrk.obj): Remove rule. - - * w32spawn.h (dup_noinherit): Cast _get_osfhandle result and - _open_osfhandle argument, to avoid warnings. - (prepare_spawn): Add a cast. - * execute.c (execute) [WIN32]: Don't call wait_subprocess; the - return value from spawnvp is already the exit code. - -2003-05-10 Bruno Haible - - * linebreak.c (iconv_string_length): Don't return -1 just because the - string is longer than 4 KB. - -2003-05-09 Bruno Haible - - * error.c: Update from gnulib with modifications. - * unlocked-io.h: New file, from gnulib. - * Makefile.am (libgettextlib_la_SOURCES): Add it. - -2003-05-09 Bruno Haible - - * canonicalize.c: Add #ifdef around versioned_symbol. Avoids an - "extraneous semicolon" warning from Tru64 cc. - -2003-05-06 Bruno Haible - - * Makefile.am (DEFS): Fix spelling of DEPENDS_ON_LIBICONV. - * Makefile.msvc (CFLAGS): Likewise. - -2003-05-03 Bruno Haible - - Upgrade to Unicode-4.0. - * linebreak.c (nonspacing_table_data): Change width of U+00AD, - U+0350..U+0357, U+035D..U+035F, U+0600..U+0603, U+0610..U+0615, - U+0656..U+0658, U+0A01, U+0AE2..U+0AE3, U+0CBC, U+17B4..U+17B5, - U+17DD, U+1920..U+1922, U+1927..U+192B, U+1932, U+1939..U+193B - from 1 to 0. Change width of U+0CBF, U+0CC6, U+180E from 0 to 1. - (uc_width): Change width of U+4DC0..U+4DFF from 2 to 1. Change width - of U+2A6D7..U+2F7FF, U+2FA1E..U+2FFFD, U+30000..U+3FFFD from 1 to 2. - Change width of U+E0100..U+E01EF from 1 to 0. - -2003-05-02 Bruno Haible - - Support for libtool-1.5. - * progname.c (set_program_name): Remove a leading "/.libs/lt-" - or "/.libs/", not only "lt-". - -2003-04-12 Bruno Haible - - * Makefile.vms: New variables ABIFLAGS, DEFS. Avoid rules with no - lines. Update library creation rule. Don't use the force target. - Correct wildcard syntax. Create fnmatch.h. - Suggested by Jouk Jansen . - -2003-04-12 Bruno Haible - - * localcharset.c (get_charset_aliases): Add special case for VMS. - -2003-04-10 Bruno Haible - - * findprog.c (find_in_path): Use 'bool' and eaccess(). - Suggested by Paul Eggert. - -2003-04-06 Bruno Haible - - * progname.c: Move out all methods depending on ENABLE_RELOCATABLE... - * progreloc.c: ... to here. New file. - * Makefile.am (libgettextlib_la_SOURCES): Add progreloc.c. - * Makefile.msvc (OBJECTS): Add progreloc.obj. - (progreloc.obj): New rule. - * Makefile.vms (OBJECTS): Add progreloc.obj. - (progreloc.obj): New rule. - -2003-04-05 Bruno Haible - - * relocatable.c: Rely on DEPENDS_ON_LIBCHARSET, DEPENDS_ON_LIBICONV, - DEPENDS_ON_LIBINTL, not on NO_LIBRARIES. - * Makefile.am (DEFS): Define DEPENDS_ON_LIBINTL and DEPENDS_ON_LIBICONV, - for relocatable.c. - * Makefile.msvc (CFLAGS): Also define DEPENDS_ON_LIBINTL and - DEPENDS_ON_LIBCONV. - -2003-04-05 Bruno Haible - - * relocatable.c (_GNU_SOURCE): Define, to ensure getline() gets - declared by . - -2003-03-30 Bruno Haible - - * xgetcwd.c: Include . - -2003-04-03 Bruno Haible - - * w32spawn.h (dup_noinherit): Signal an error instead of returning -1. - * execute.c: Reorder includes. - * pipe-bidi.c: Likewise. - * pipe-in.c: Likewise. - * pipe-out.c: Likewise. - -2003-04-02 Bruno Haible - - * binary-io.h: Cosmetics. Suggested by Jim Meyering. - -2003-03-30 Bruno Haible - - * Makefile.vms: New file. - * Makefile.am (EXTRA_DIST): Add Makefile.vms. - * execute.c (open): #undef before redefining it. Needed for VMS. - * pipe-in.c (open): Likewise. - * pipe-out.c (open): Likewise. - -2003-03-31 Bruno Haible - - * sh-quote.c (shell_quote_length, shell_quote_copy): Handle empty - argument string correctly. - -2003-03-30 Bruno Haible - - * progname.c (ISSLASH, HAS_DEVICE, IS_PATH_WITH_DIR, - FILESYSTEM_PREFIX_LEN): New macros. - (maybe_executable): Make a nop on Woe32. - (find_executable) [WIN32]: Fix compilation. - - * relocatable.h (RELOCATABLE_DLL_EXPORTED): New macro. - - * w32spawn.h: New file. - * execute.c: Add alternative implementation using native Woe32 API. - * pipe-bidi.c: Likewise. - * pipe-in.c: Likewise. - * pipe-out.c: Likewise. - * wait-process.c: Likewise. - * Makefile.am (libgettextlib_la_SOURCES): Add w32spawn.h. - - * pipe.h (DEV_NULL): New macro. - * javacomp.c (compile_java_class): Use DEV_NULL instead of "/dev/null". - - * pipe-bidi.c (STDERR_FILENO): Provide a fallback value. - * pipe-in.c (STDERR_FILENO): Likewise. - * pipe-out.c (STDERR_FILENO): Likewise. - - * copy-file.c (copy_file_preserving): Don't set owner if the function - chown() doesn't exist. - -2003-03-17 Bruno Haible - - Native Woe32/MSVC support. - * Makefile.msvc: New file. - * Makefile.am (EXTRA_DIST): Add it. - -2003-03-28 Bruno Haible - - * copy-file.h (copy_file_preserving): Renamed from copy_file. - * copy-file.c (copy_file_preserving): Renamed from copy_file. - Preserve the owner and group as well. - -2003-02-28 Bruno Haible - - Support for relocatable installation. - * canonicalize.h: New file. - * canonicalize.c: New file, from glibc 2.3.1 with modifications. - * relocatable.h: New file. - * relocatable.c: New file. - * relocwrapper.c: New file. - * strerror.c: New file, from gnulib with modifications. - * xreadlink.h: New file, from gnulib with modifications. - * xreadlink.c: New file, from gnulib with modifications. - * progname.h (set_program_name_and_installdir): New declaration. - (set_program_name) [ENABLE_RELOCATABLE]: Define as macro. - (get_full_program_name): New declaration. - * progname.c: Include xreadlink.h, canonicalize.h, relocatable.h. - (executable_fd): New variable. - (maybe_executable): New function. - (find_executable): New function. - (executable_fullname): New variable. - (prepare_relocate): New function. - (set_program_name_and_installdir): New function. - (get_full_program_name): New function. - * localcharset.c: Include relocatable.h. - (get_charset_aliases): Relocate LIBDIR value. - * xmalloc.h (xalloc_die): New declaration. - * xmalloc.c (xalloc_die): New function. - (fixup_null_alloc): Use it. - * Makefile.am (libgettextlib_la_SOURCES): Add xreadlink.h, xreadlink.c. - (LIBADD_SOURCE): Add canonicalize.h, canonicalize.c, memmove.c, - relocatable.h, relocatable.c, strerror.c. - (UNUSED_SOURCE): Remove memmove.c. - (EXTRA_DIST): Add relocwrapper.c. - -2003-02-28 Bruno Haible - - * localcharset.h: Change copyright to LGPL. Enclose declaration in - extern "C", for C++ compilers. - * localcharset.c: Drop C linkage declaration. - -2003-01-29 Bruno Haible - - * config.charset: Add an alias for CP1251 on Solaris. - Reported by Hidetoshi Tajima . - -2003-02-18 Bruno Haible - - * copy-file.c: Include safe-read.h. - (copy_file): Simplify code by using safe_read() instead of read(). - -2003-02-12 Bruno Haible - - * Makefile.am (EXTRA_DIST): Add ChangeLog.0. - - -See ChangeLog.0 for earlier changes. diff --git a/gnulib-local/lib/addext.c b/gnulib-local/lib/addext.c index fef2b9b..bea586f 100644 --- a/gnulib-local/lib/addext.c +++ b/gnulib-local/lib/addext.c @@ -1,5 +1,6 @@ /* addext.c -- add an extension to a file name - Copyright (C) 1990, 1997-1999, 2001-2003, 2005-2006 Free Software Foundation, Inc. + Copyright (C) 1990, 1997-1999, 2001-2003, 2005-2006, 2015 Free + Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gnulib-local/lib/alloca.in.h b/gnulib-local/lib/alloca.in.h index 964cb8d..b334262 100644 --- a/gnulib-local/lib/alloca.in.h +++ b/gnulib-local/lib/alloca.in.h @@ -1,5 +1,6 @@ /* Memory allocation on the stack. - Copyright (C) 1995, 1999, 2001-2007 Free Software Foundation, Inc. + Copyright (C) 1995, 1999, 2001-2007, 2015 Free Software Foundation, + Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gnulib-local/lib/backupfile.c b/gnulib-local/lib/backupfile.c index 9d75b02..5ec0228 100644 --- a/gnulib-local/lib/backupfile.c +++ b/gnulib-local/lib/backupfile.c @@ -1,5 +1,6 @@ /* backupfile.c -- make Emacs style backup file names - Copyright (C) 1990-1999, 2000-2003, 2005-2006, 2012 Free Software Foundation, Inc. + Copyright (C) 1990-2003, 2005-2006, 2012, 2015 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gnulib-local/lib/backupfile.h b/gnulib-local/lib/backupfile.h index e2c8743..91c37fa 100644 --- a/gnulib-local/lib/backupfile.h +++ b/gnulib-local/lib/backupfile.h @@ -1,5 +1,6 @@ /* backupfile.h -- declarations for making Emacs style backup file names - Copyright (C) 1990-1992, 1997-1999, 2001-2003 Free Software Foundation, Inc. + Copyright (C) 1990-1992, 1997-1999, 2001-2003, 2015 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gnulib-local/lib/basename.c b/gnulib-local/lib/basename.c index 5874420..56421aa 100644 --- a/gnulib-local/lib/basename.c +++ b/gnulib-local/lib/basename.c @@ -1,5 +1,6 @@ /* Return the name-within-directory of a file name. - Copyright (C) 1996-1999, 2000-2002, 2004, 2006, 2010, 2012 Free Software Foundation, Inc. + Copyright (C) 1996-2002, 2004, 2006, 2010, 2012, 2015 Free Software + Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. diff --git a/gnulib-local/lib/basename.h b/gnulib-local/lib/basename.h index 908cc3e..489cc67 100644 --- a/gnulib-local/lib/basename.h +++ b/gnulib-local/lib/basename.h @@ -1,5 +1,5 @@ /* Pathname hacking. - Copyright (C) 2001-2003, 2010 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2010, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/closeout.c b/gnulib-local/lib/closeout.c index 20b021d..a790176 100644 --- a/gnulib-local/lib/closeout.c +++ b/gnulib-local/lib/closeout.c @@ -1,5 +1,5 @@ /* closeout.c - close standard output and standard error - Copyright (C) 1998-2007, 2012 Free Software Foundation, Inc. + Copyright (C) 1998-2007, 2012, 2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gnulib-local/lib/closeout.h b/gnulib-local/lib/closeout.h index 33e309e..896e22f 100644 --- a/gnulib-local/lib/closeout.h +++ b/gnulib-local/lib/closeout.h @@ -1,5 +1,5 @@ /* Close standard output and standard error. - Copyright (C) 1998-2003, 2006 Free Software Foundation, Inc. + Copyright (C) 1998-2003, 2006, 2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gnulib-local/lib/error-progname.c b/gnulib-local/lib/error-progname.c index 189bbd5..525d11f 100644 --- a/gnulib-local/lib/error-progname.c +++ b/gnulib-local/lib/error-progname.c @@ -1,5 +1,5 @@ /* Use of program name in error-reporting functions. - Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/error-progname.h b/gnulib-local/lib/error-progname.h index 77ae822..f16107a 100644 --- a/gnulib-local/lib/error-progname.h +++ b/gnulib-local/lib/error-progname.h @@ -1,5 +1,5 @@ /* Use of program name in error-reporting functions. - Copyright (C) 2001-2003 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/fd-ostream.oo.c b/gnulib-local/lib/fd-ostream.oo.c index 0c8978f..64b9597 100644 --- a/gnulib-local/lib/fd-ostream.oo.c +++ b/gnulib-local/lib/fd-ostream.oo.c @@ -1,5 +1,5 @@ /* Output stream referring to a file descriptor. - Copyright (C) 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/fd-ostream.oo.h b/gnulib-local/lib/fd-ostream.oo.h index bd1f0b4..155b627 100644 --- a/gnulib-local/lib/fd-ostream.oo.h +++ b/gnulib-local/lib/fd-ostream.oo.h @@ -1,5 +1,5 @@ /* Output stream referring to a file descriptor. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/file-ostream.oo.c b/gnulib-local/lib/file-ostream.oo.c index e5884bc..a500825 100644 --- a/gnulib-local/lib/file-ostream.oo.c +++ b/gnulib-local/lib/file-ostream.oo.c @@ -1,5 +1,5 @@ /* Output stream referring to an stdio FILE. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/file-ostream.oo.h b/gnulib-local/lib/file-ostream.oo.h index 6da1dbd..395cef7 100644 --- a/gnulib-local/lib/file-ostream.oo.h +++ b/gnulib-local/lib/file-ostream.oo.h @@ -1,5 +1,5 @@ /* Output stream referring to an stdio FILE. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/gettext.h b/gnulib-local/lib/gettext.h index 9d4055d..7d96228 100644 --- a/gnulib-local/lib/gettext.h +++ b/gnulib-local/lib/gettext.h @@ -1,5 +1,6 @@ /* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011, 2015 Free + Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/gnulib-local/lib/glib/gstrfuncs.c b/gnulib-local/lib/glib/gstrfuncs.c index 7e0cedd..8796226 100644 --- a/gnulib-local/lib/glib/gstrfuncs.c +++ b/gnulib-local/lib/glib/gstrfuncs.c @@ -621,8 +621,8 @@ g_parse_long_long (const gchar *nptr, /* this code is based on on the strtol(3) code from GNU libc released under * the GNU Lesser General Public License. * - * Copyright (C) 1991,92,94,95,96,97,98,99,2000,01,02 - * Free Software Foundation, Inc. + * Copyright (C) 1991-1992, 1994-2000, 1901-1902, 2015 Free Software + * Foundation, Inc. */ #define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \ (c) == '\r' || (c) == '\t' || (c) == '\v') diff --git a/gnulib-local/lib/hash.c b/gnulib-local/lib/hash.c index 1844724..89fa5ec 100644 --- a/gnulib-local/lib/hash.c +++ b/gnulib-local/lib/hash.c @@ -1,5 +1,6 @@ /* hash - implement simple hashing table with string based keys. - Copyright (C) 1994-1995, 2000-2006 Free Software Foundation, Inc. + Copyright (C) 1994-1995, 2000-2006, 2015 Free Software Foundation, + Inc. Written by Ulrich Drepper , October 1994. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/hash.h b/gnulib-local/lib/hash.h index 3d22149..0cf972f 100644 --- a/gnulib-local/lib/hash.h +++ b/gnulib-local/lib/hash.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1995, 2000-2003, 2005-2006 Free Software Foundation, Inc. +/* Copyright (C) 1995, 2000-2003, 2005-2006, 2015 Free Software + * Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/gnulib-local/lib/html-ostream.oo.c b/gnulib-local/lib/html-ostream.oo.c index bf5c130..afa84d3 100644 --- a/gnulib-local/lib/html-ostream.oo.c +++ b/gnulib-local/lib/html-ostream.oo.c @@ -1,5 +1,5 @@ /* Output stream that produces HTML output. - Copyright (C) 2006-2009 Free Software Foundation, Inc. + Copyright (C) 2006-2009, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/html-ostream.oo.h b/gnulib-local/lib/html-ostream.oo.h index 5ee26de..87c6f3d 100644 --- a/gnulib-local/lib/html-ostream.oo.h +++ b/gnulib-local/lib/html-ostream.oo.h @@ -1,5 +1,5 @@ /* Output stream that produces HTML output. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/html-styled-ostream.oo.c b/gnulib-local/lib/html-styled-ostream.oo.c index 2766ab0..ef187dd 100644 --- a/gnulib-local/lib/html-styled-ostream.oo.c +++ b/gnulib-local/lib/html-styled-ostream.oo.c @@ -1,5 +1,5 @@ /* Output stream for CSS styled text, producing HTML output. - Copyright (C) 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/html-styled-ostream.oo.h b/gnulib-local/lib/html-styled-ostream.oo.h index c28e0b9..d66bb2e 100644 --- a/gnulib-local/lib/html-styled-ostream.oo.h +++ b/gnulib-local/lib/html-styled-ostream.oo.h @@ -1,5 +1,5 @@ /* Output stream for CSS styled text, producing HTML output. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/iconv-ostream.oo.c b/gnulib-local/lib/iconv-ostream.oo.c index c33c53a..a7314fa 100644 --- a/gnulib-local/lib/iconv-ostream.oo.c +++ b/gnulib-local/lib/iconv-ostream.oo.c @@ -1,5 +1,5 @@ /* Output stream that converts the output to another encoding. - Copyright (C) 2006-2007, 2010 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2010, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/iconv-ostream.oo.h b/gnulib-local/lib/iconv-ostream.oo.h index de3c3b8..961ad06 100644 --- a/gnulib-local/lib/iconv-ostream.oo.h +++ b/gnulib-local/lib/iconv-ostream.oo.h @@ -1,5 +1,5 @@ /* Output stream that converts the output to another encoding. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/libxml/COPYING b/gnulib-local/lib/libxml/COPYING index 417e955..d613185 100644 --- a/gnulib-local/lib/libxml/COPYING +++ b/gnulib-local/lib/libxml/COPYING @@ -2,7 +2,7 @@ Except where otherwise noted in the source code (e.g. the files hash.c, list.c and the trio files, which are covered by a similar licence but with different Copyright notices) all the files are: - Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved. + Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -17,11 +17,7 @@ all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- -NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Daniel Veillard shall not -be used in advertising or otherwise to promote the sale, use or other deal- -ings in this Software without prior written authorization from him. - +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/gnulib-local/lib/libxml/DOCBparser.c b/gnulib-local/lib/libxml/DOCBparser.c index 3573743..f12511b 100644 --- a/gnulib-local/lib/libxml/DOCBparser.c +++ b/gnulib-local/lib/libxml/DOCBparser.c @@ -53,7 +53,7 @@ docbEncodeEntities(unsigned char *out ATTRIBUTE_UNUSED, /** * docbParseDocument: * @ctxt: an SGML parser context - * + * * parse an SGML document (and build a tree if using the standard SAX * interface). * @@ -163,12 +163,12 @@ docbCreatePushParserCtxt(docbSAXHandlerPtr sax ATTRIBUTE_UNUSED, * @cur: a pointer to an array of xmlChar * @encoding: a free form C string describing the SGML document encoding, or NULL * @sax: the SAX handler block - * @userData: if using SAX, this pointer will be provided on callbacks. + * @userData: if using SAX, this pointer will be provided on callbacks. * * parse an SGML in-memory document and build a tree. * It use the given SAX function block to handle the parsing callback. * If sax is NULL, fallback to the default DOM tree building routines. - * + * * Returns the resulting document tree */ @@ -196,7 +196,7 @@ docbSAXParseDoc(xmlChar * cur ATTRIBUTE_UNUSED, * @encoding: a free form C string describing the SGML document encoding, or NULL * * parse an SGML in-memory document and build a tree. - * + * * Returns the resulting document tree */ @@ -221,7 +221,7 @@ docbParseDoc(xmlChar * cur ATTRIBUTE_UNUSED, * @filename: the filename * @encoding: the SGML document encoding, or NULL * - * Create a parser context for a file content. + * Create a parser context for a file content. * Automatic support for ZLIB/Compress compressed document is provided * by default if found at compile-time. * @@ -247,7 +247,7 @@ docbCreateFileParserCtxt(const char *filename ATTRIBUTE_UNUSED, * @filename: the filename * @encoding: a free form C string describing the SGML document encoding, or NULL * @sax: the SAX handler block - * @userData: if using SAX, this pointer will be provided on callbacks. + * @userData: if using SAX, this pointer will be provided on callbacks. * * parse an SGML file and build a tree. Automatic support for ZLIB/Compress * compressed document is provided by default if found at compile-time. diff --git a/gnulib-local/lib/libxml/DOCBparser.in.h b/gnulib-local/lib/libxml/DOCBparser.in.h index 461d4ee..9394fa7 100644 --- a/gnulib-local/lib/libxml/DOCBparser.in.h +++ b/gnulib-local/lib/libxml/DOCBparser.in.h @@ -47,44 +47,44 @@ XMLPUBFUN int XMLCALL const unsigned char *in, int *inlen, int quoteChar); -XMLPUBFUN docbDocPtr XMLCALL +XMLPUBFUN docbDocPtr XMLCALL docbSAXParseDoc (xmlChar *cur, const char *encoding, docbSAXHandlerPtr sax, void *userData); -XMLPUBFUN docbDocPtr XMLCALL +XMLPUBFUN docbDocPtr XMLCALL docbParseDoc (xmlChar *cur, const char *encoding); -XMLPUBFUN docbDocPtr XMLCALL +XMLPUBFUN docbDocPtr XMLCALL docbSAXParseFile (const char *filename, const char *encoding, docbSAXHandlerPtr sax, void *userData); -XMLPUBFUN docbDocPtr XMLCALL +XMLPUBFUN docbDocPtr XMLCALL docbParseFile (const char *filename, const char *encoding); /** * Interfaces for the Push mode. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL docbFreeParserCtxt (docbParserCtxtPtr ctxt); -XMLPUBFUN docbParserCtxtPtr XMLCALL +XMLPUBFUN docbParserCtxtPtr XMLCALL docbCreatePushParserCtxt(docbSAXHandlerPtr sax, void *user_data, const char *chunk, int size, const char *filename, xmlCharEncoding enc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL docbParseChunk (docbParserCtxtPtr ctxt, const char *chunk, int size, int terminate); -XMLPUBFUN docbParserCtxtPtr XMLCALL +XMLPUBFUN docbParserCtxtPtr XMLCALL docbCreateFileParserCtxt(const char *filename, const char *encoding); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL docbParseDocument (docbParserCtxtPtr ctxt); #ifdef __cplusplus diff --git a/gnulib-local/lib/libxml/HTMLparser.c b/gnulib-local/lib/libxml/HTMLparser.c index 5e23ad7..b729197 100644 --- a/gnulib-local/lib/libxml/HTMLparser.c +++ b/gnulib-local/lib/libxml/HTMLparser.c @@ -44,6 +44,9 @@ #include #include +#include "buf.h" +#include "enc.h" + #define HTML_MAX_NAMELEN 1000 #define HTML_PARSER_BIG_BUFFER_SIZE 1000 #define HTML_PARSER_BUFFER_SIZE 100 @@ -59,7 +62,7 @@ static void htmlParseComment(htmlParserCtxtPtr ctxt); /************************************************************************ * * - * Some factorized error routines * + * Some factorized error routines * * * ************************************************************************/ @@ -147,7 +150,7 @@ htmlParseErrInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, /************************************************************************ * * - * Parser stacks related functions and macros * + * Parser stacks related functions and macros * * * ************************************************************************/ @@ -163,6 +166,10 @@ htmlParseErrInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, static int htmlnamePush(htmlParserCtxtPtr ctxt, const xmlChar * value) { + if ((ctxt->html < 3) && (xmlStrEqual(value, BAD_CAST "head"))) + ctxt->html = 3; + if ((ctxt->html < 10) && (xmlStrEqual(value, BAD_CAST "body"))) + ctxt->html = 10; if (ctxt->nameNr >= ctxt->nameMax) { ctxt->nameMax *= 2; ctxt->nameTab = (const xmlChar * *) @@ -205,6 +212,59 @@ htmlnamePop(htmlParserCtxtPtr ctxt) return (ret); } +/** + * htmlNodeInfoPush: + * @ctxt: an HTML parser context + * @value: the node info + * + * Pushes a new element name on top of the node info stack + * + * Returns 0 in case of error, the index in the stack otherwise + */ +static int +htmlNodeInfoPush(htmlParserCtxtPtr ctxt, htmlParserNodeInfo *value) +{ + if (ctxt->nodeInfoNr >= ctxt->nodeInfoMax) { + if (ctxt->nodeInfoMax == 0) + ctxt->nodeInfoMax = 5; + ctxt->nodeInfoMax *= 2; + ctxt->nodeInfoTab = (htmlParserNodeInfo *) + xmlRealloc((htmlParserNodeInfo *)ctxt->nodeInfoTab, + ctxt->nodeInfoMax * + sizeof(ctxt->nodeInfoTab[0])); + if (ctxt->nodeInfoTab == NULL) { + htmlErrMemory(ctxt, NULL); + return (0); + } + } + ctxt->nodeInfoTab[ctxt->nodeInfoNr] = *value; + ctxt->nodeInfo = &ctxt->nodeInfoTab[ctxt->nodeInfoNr]; + return (ctxt->nodeInfoNr++); +} + +/** + * htmlNodeInfoPop: + * @ctxt: an HTML parser context + * + * Pops the top element name from the node info stack + * + * Returns 0 in case of error, the pointer to NodeInfo otherwise + */ +static htmlParserNodeInfo * +htmlNodeInfoPop(htmlParserCtxtPtr ctxt) +{ + if (ctxt->nodeInfoNr <= 0) + return (NULL); + ctxt->nodeInfoNr--; + if (ctxt->nodeInfoNr < 0) + return (NULL); + if (ctxt->nodeInfoNr > 0) + ctxt->nodeInfo = &ctxt->nodeInfoTab[ctxt->nodeInfoNr - 1]; + else + ctxt->nodeInfo = NULL; + return &ctxt->nodeInfoTab[ctxt->nodeInfoNr]; +} + /* * Macros for accessing the content. Those should be used only by the parser, * and not exported. @@ -263,8 +323,6 @@ htmlnamePop(htmlParserCtxtPtr ctxt) #define NEXT xmlNextChar(ctxt) #define RAW (ctxt->token ? -1 : (*ctxt->input->cur)) -#define NXT(val) ctxt->input->cur[(val)] -#define CUR_PTR ctxt->input->cur #define NEXTL(l) do { \ @@ -273,7 +331,7 @@ htmlnamePop(htmlParserCtxtPtr ctxt) } else ctxt->input->col++; \ ctxt->token = 0; ctxt->input->cur += l; ctxt->nbChars++; \ } while (0) - + /************ \ if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \ @@ -287,6 +345,58 @@ htmlnamePop(htmlParserCtxtPtr ctxt) if (l == 1) b[i++] = (xmlChar) v; \ else i += xmlCopyChar(l,&b[i],v) +/** + * htmlFindEncoding: + * @the HTML parser context + * + * Ty to find and encoding in the current data available in the input + * buffer this is needed to try to switch to the proper encoding when + * one face a character error. + * That's an heuristic, since it's operating outside of parsing it could + * try to use a meta which had been commented out, that's the reason it + * should only be used in case of error, not as a default. + * + * Returns an encoding string or NULL if not found, the string need to + * be freed + */ +static xmlChar * +htmlFindEncoding(xmlParserCtxtPtr ctxt) { + const xmlChar *start, *cur, *end; + + if ((ctxt == NULL) || (ctxt->input == NULL) || + (ctxt->input->encoding != NULL) || (ctxt->input->buf == NULL) || + (ctxt->input->buf->encoder != NULL)) + return(NULL); + if ((ctxt->input->cur == NULL) || (ctxt->input->end == NULL)) + return(NULL); + + start = ctxt->input->cur; + end = ctxt->input->end; + /* we also expect the input buffer to be zero terminated */ + if (*end != 0) + return(NULL); + + cur = xmlStrcasestr(start, BAD_CAST "HTTP-EQUIV"); + if (cur == NULL) + return(NULL); + cur = xmlStrcasestr(cur, BAD_CAST "CONTENT"); + if (cur == NULL) + return(NULL); + cur = xmlStrcasestr(cur, BAD_CAST "CHARSET="); + if (cur == NULL) + return(NULL); + cur += 8; + start = cur; + while (((*cur >= 'A') && (*cur <= 'Z')) || + ((*cur >= 'a') && (*cur <= 'z')) || + ((*cur >= '0') && (*cur <= '9')) || + (*cur == '-') || (*cur == '_') || (*cur == ':') || (*cur == '/')) + cur++; + if (cur == start) + return(NULL); + return(xmlStrndup(start, cur - start)); +} + /** * htmlCurrentChar: * @ctxt: the HTML parser context @@ -309,7 +419,7 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { if (ctxt->token != 0) { *len = 0; return(ctxt->token); - } + } if (ctxt->charset == XML_CHAR_ENCODING_UTF8) { /* * We are supposed to handle UTF8, check it's valid @@ -318,7 +428,7 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { * UCS-4 range (hex.) UTF-8 octet sequence (binary) * 0000 0000-0000 007F 0xxxxxxx * 0000 0080-0000 07FF 110xxxxx 10xxxxxx - * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx + * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx * * Check for the 0x110000 limit too */ @@ -328,19 +438,25 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { c = *cur; if (c & 0x80) { - if (cur[1] == 0) + if (cur[1] == 0) { xmlParserInputGrow(ctxt->input, INPUT_CHUNK); + cur = ctxt->input->cur; + } if ((cur[1] & 0xc0) != 0x80) goto encoding_error; if ((c & 0xe0) == 0xe0) { - if (cur[2] == 0) + if (cur[2] == 0) { xmlParserInputGrow(ctxt->input, INPUT_CHUNK); + cur = ctxt->input->cur; + } if ((cur[2] & 0xc0) != 0x80) goto encoding_error; if ((c & 0xf0) == 0xf0) { - if (cur[3] == 0) + if (cur[3] == 0) { xmlParserInputGrow(ctxt->input, INPUT_CHUNK); + cur = ctxt->input->cur; + } if (((c & 0xf8) != 0xf0) || ((cur[3] & 0xc0) != 0x80)) goto encoding_error; @@ -366,9 +482,16 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { if (!IS_CHAR(val)) { htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, "Char 0x%X out of allowed range\n", val); - } + } return(val); } else { + if ((*ctxt->input->cur == 0) && + (ctxt->input->cur < ctxt->input->end)) { + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Char 0x%X out of allowed range\n", 0); + *len = 1; + return(' '); + } /* 1-byte code */ *len = 1; return((int) *ctxt->input->cur); @@ -386,8 +509,28 @@ htmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { /* * Humm this is bad, do an automatic flow conversion */ - xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1); - ctxt->charset = XML_CHAR_ENCODING_UTF8; + { + xmlChar * guess; + xmlCharEncodingHandlerPtr handler; + + guess = htmlFindEncoding(ctxt); + if (guess == NULL) { + xmlSwitchEncoding(ctxt, XML_CHAR_ENCODING_8859_1); + } else { + if (ctxt->input->encoding != NULL) + xmlFree((xmlChar *) ctxt->input->encoding); + ctxt->input->encoding = guess; + handler = xmlFindCharEncodingHandler((const char *) guess); + if (handler != NULL) { + xmlSwitchToEncoding(ctxt, handler); + } else { + htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, + "Unsupported encoding %s", guess, NULL); + } + } + ctxt->charset = XML_CHAR_ENCODING_UTF8; + } + return(xmlCurrentChar(ctxt, len)); encoding_error: @@ -401,15 +544,19 @@ encoding_error: { char buffer[150]; - snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", - ctxt->input->cur[0], ctxt->input->cur[1], - ctxt->input->cur[2], ctxt->input->cur[3]); + if (ctxt->input->end - ctxt->input->cur >= 4) { + snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", + ctxt->input->cur[0], ctxt->input->cur[1], + ctxt->input->cur[2], ctxt->input->cur[3]); + } else { + snprintf(buffer, 149, "Bytes: 0x%02X\n", ctxt->input->cur[0]); + } htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, "Input is not proper UTF-8, indicate encoding !\n", BAD_CAST buffer, NULL); } - ctxt->charset = XML_CHAR_ENCODING_8859_1; + ctxt->charset = XML_CHAR_ENCODING_8859_1; *len = 1; return((int) *ctxt->input->cur); } @@ -449,7 +596,7 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) { /************************************************************************ * * - * The list of HTML elements and their properties * + * The list of HTML elements and their properties * * * ************************************************************************/ @@ -472,11 +619,11 @@ htmlSkipBlankChars(xmlParserCtxtPtr ctxt) { #define NB_FONTSTYLE 8 #define PHRASE "em", "strong", "dfn", "code", "samp", "kbd", "var", "cite", "abbr", "acronym" #define NB_PHRASE 10 -#define SPECIAL "a", "img", "applet", "object", "font", "basefont", "br", "script", "map", "q", "sub", "sup", "span", "bdo", "iframe" -#define NB_SPECIAL 15 -#define INLINE PCDATA FONTSTYLE PHRASE SPECIAL FORMCTRL +#define SPECIAL "a", "img", "applet", "embed", "object", "font", "basefont", "br", "script", "map", "q", "sub", "sup", "span", "bdo", "iframe" +#define NB_SPECIAL 16 +#define INLINE FONTSTYLE, PHRASE, SPECIAL, FORMCTRL #define NB_INLINE NB_PCDATA + NB_FONTSTYLE + NB_PHRASE + NB_SPECIAL + NB_FORMCTRL -#define BLOCK HEADING, LIST "pre", "p", "dl", "div", "center", "noscript", "noframes", "blockquote", "form", "isindex", "hr", "table", "fieldset", "address" +#define BLOCK HEADING, LIST, "pre", "p", "dl", "div", "center", "noscript", "noframes", "blockquote", "form", "isindex", "hr", "table", "fieldset", "address" #define NB_BLOCK NB_HEADING + NB_LIST + 14 #define FORMCTRL "input", "select", "textarea", "label", "button" #define NB_FORMCTRL 5 @@ -572,6 +719,7 @@ static const char* const version_attr[] = { "version", NULL } ; static const char* const html_content[] = { "head", "body", "frameset", NULL } ; static const char* const iframe_attrs[] = { COREATTRS, "longdesc", "name", "src", "frameborder", "marginwidth", "marginheight", "scrolling", "align", "height", "width", NULL } ; static const char* const img_attrs[] = { ATTRS, "longdesc", "name", "height", "width", "usemap", "ismap", NULL } ; +static const char* const embed_attrs[] = { COREATTRS, "align", "alt", "border", "code", "codebase", "frameborder", "height", "hidden", "hspace", "name", "palette", "pluginspace", "pluginurl", "src", "type", "units", "vspace", "width", NULL } ; static const char* const input_attrs[] = { ATTRS, "type", "name", "value", "checked", "disabled", "readonly", "size", "maxlength", "src", "alt", "usemap", "ismap", "tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange", "accept", NULL } ; static const char* const prompt_attrs[] = { COREATTRS, I18N, "prompt", NULL } ; static const char* const label_attrs[] = { ATTRS, "for", "accesskey", "onfocus", "onblur", NULL } ; @@ -582,7 +730,7 @@ static const char* const map_contents[] = { BLOCK, "area", NULL } ; static const char* const name_attr[] = { "name", NULL } ; static const char* const action_attr[] = { "action", NULL } ; static const char* const blockli_elt[] = { BLOCK, "li", NULL } ; -static const char* const meta_attrs[] = { I18N, "http-equiv", "name", "scheme", NULL } ; +static const char* const meta_attrs[] = { I18N, "http-equiv", "name", "scheme", "charset", NULL } ; static const char* const content_attr[] = { "content", NULL } ; static const char* const type_attr[] = { "type", NULL } ; static const char* const noframes_content[] = { "body", FLOW MODIFIER, NULL } ; @@ -601,7 +749,7 @@ static const char* const language_attr[] = { "language", NULL } ; static const char* const select_content[] = { "optgroup", "option", NULL } ; static const char* const select_attrs[] = { ATTRS, "name", "size", "multiple", "disabled", "tabindex", "onfocus", "onblur", "onchange", NULL } ; static const char* const style_attrs[] = { I18N, "media", "title", NULL } ; -static const char* const table_attrs[] = { ATTRS "summary", "width", "border", "frame", "rules", "cellspacing", "cellpadding", "datapagesize", NULL } ; +static const char* const table_attrs[] = { ATTRS, "summary", "width", "border", "frame", "rules", "cellspacing", "cellpadding", "datapagesize", NULL } ; static const char* const table_depr[] = { "align", "bgcolor", NULL } ; static const char* const table_contents[] = { "caption", "col", "colgroup", "thead", "tfoot", "tbody", "tr", NULL} ; static const char* const tr_elt[] = { "tr", NULL } ; @@ -698,7 +846,7 @@ html40ElementTable[] = { DECL html_flow, NULL, DECL html_attrs, DECL align_attr, NULL }, { "dl", 0, 0, 0, 0, 0, 0, 0, "definition list ", - DECL dl_contents , "dd" , html_attrs, DECL compact_attr, NULL + DECL dl_contents , "dd" , DECL html_attrs, DECL compact_attr, NULL }, { "dt", 0, 1, 0, 0, 0, 0, 0, "definition term ", DECL html_inline, NULL, DECL html_attrs, NULL, NULL @@ -706,6 +854,9 @@ html40ElementTable[] = { { "em", 0, 3, 0, 0, 0, 0, 1, "emphasis", DECL html_inline, NULL, DECL html_attrs, NULL, NULL }, +{ "embed", 0, 1, 0, 0, 1, 1, 1, "generic embedded object ", + EMPTY, NULL, DECL embed_attrs, NULL, NULL +}, { "fieldset", 0, 0, 0, 0, 0, 0, 0, "form control group ", DECL fieldset_contents , NULL, DECL html_attrs, NULL, NULL }, @@ -755,7 +906,7 @@ html40ElementTable[] = { DECL html_flow, NULL, NULL, DECL iframe_attrs, NULL }, { "img", 0, 2, 2, 1, 0, 0, 1, "embedded image ", - EMPTY, NULL, DECL img_attrs, DECL align_attr, src_alt_attrs + EMPTY, NULL, DECL img_attrs, DECL align_attr, DECL src_alt_attrs }, { "input", 0, 2, 2, 1, 0, 0, 1, "form control ", EMPTY, NULL, DECL input_attrs , DECL align_attr, NULL @@ -782,7 +933,7 @@ html40ElementTable[] = { EMPTY, NULL, DECL link_attrs, DECL target_attr, NULL }, { "map", 0, 0, 0, 0, 0, 0, 2, "client-side image map ", - DECL map_contents , NULL, DECL html_attrs , NULL, name_attr + DECL map_contents , NULL, DECL html_attrs , NULL, DECL name_attr }, { "menu", 0, 0, 0, 0, 1, 1, 0, "menu list ", DECL blockli_elt , NULL, NULL, DECL compact_attrs, NULL @@ -803,7 +954,7 @@ html40ElementTable[] = { DECL li_elt , "li" , DECL html_attrs, DECL ol_attrs, NULL }, { "optgroup", 0, 0, 0, 0, 0, 0, 0, "option group ", - option_elt , "option", DECL optgroup_attrs, NULL, DECL label_attr + DECL option_elt , "option", DECL optgroup_attrs, NULL, DECL label_attr }, { "option", 0, 1, 0, 0, 0, 0, 0, "selectable choice " , DECL html_pcdata, NULL, DECL option_attrs, NULL, NULL @@ -812,7 +963,7 @@ html40ElementTable[] = { DECL html_inline, NULL, DECL html_attrs, DECL align_attr, NULL }, { "param", 0, 2, 2, 1, 0, 0, 0, "named property value ", - EMPTY, NULL, DECL param_attrs, NULL, name_attr + EMPTY, NULL, DECL param_attrs, NULL, DECL name_attr }, { "pre", 0, 0, 0, 0, 0, 0, 0, "preformatted text ", DECL pre_content, NULL, DECL html_attrs, DECL width_attr, NULL @@ -930,18 +1081,18 @@ static const char * const htmlStartClose[] = { "listing", "xmp", NULL, "ol", "p", "head", "ul", NULL, "menu", "p", "head", "ul", NULL, -"p", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", NULL, +"p", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", FONTSTYLE, NULL, "div", "p", "head", NULL, -"noscript", "p", "head", NULL, +"noscript", "p", NULL, "center", "font", "b", "i", "p", "head", NULL, -"a", "a", NULL, +"a", "a", "head", NULL, "caption", "p", NULL, "colgroup", "caption", "colgroup", "col", "p", NULL, "col", "caption", "col", "p", NULL, "table", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", "pre", "listing", "xmp", "a", NULL, "th", "th", "td", "p", "span", "font", "a", "b", "i", "u", NULL, -"td", "th", "td", "p", "span", "font", "a", "b", "i", "u", NULL, +"td", "th", "td", "p", "span", "font", "a", "b", "i", "u", NULL, "tr", "th", "td", "tr", "caption", "col", "colgroup", "p", NULL, "thead", "caption", "col", "colgroup", NULL, "tfoot", "th", "td", "tr", "caption", "col", "colgroup", "thead", @@ -952,6 +1103,43 @@ static const char * const htmlStartClose[] = { "option", "option", NULL, "fieldset", "legend", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", "pre", "listing", "xmp", "a", NULL, +/* most tags in in FONTSTYLE, PHRASE and SPECIAL should close */ +"tt", "head", NULL, +"i", "head", NULL, +"b", "head", NULL, +"u", "head", NULL, +"s", "head", NULL, +"strike", "head", NULL, +"big", "head", NULL, +"small", "head", NULL, + +"em", "head", NULL, +"strong", "head", NULL, +"dfn", "head", NULL, +"code", "head", NULL, +"samp", "head", NULL, +"kbd", "head", NULL, +"var", "head", NULL, +"cite", "head", NULL, +"abbr", "head", NULL, +"acronym", "head", NULL, + +/* "a" */ +"img", "head", NULL, +/* "applet" */ +/* "embed" */ +/* "object" */ +"font", "head", NULL, +/* "basefont" */ +"br", "head", NULL, +/* "script" */ +"map", "head", NULL, +"q", "head", NULL, +"sub", "head", NULL, +"sup", "head", NULL, +"span", "head", NULL, +"bdo", "head", NULL, +"iframe", "head", NULL, NULL }; @@ -989,7 +1177,7 @@ static const char *const htmlScriptAttributes[] = { "onfocus", "onblur", "onsubmit", - "onrest", + "onreset", "onchange", "onselect" }; @@ -1000,7 +1188,7 @@ static const char *const htmlScriptAttributes[] = { * elements the parser can decide how to handle extra endtags. * Endtags are only allowed to close elements with lower or equal * priority. - */ + */ typedef struct { const char *name; @@ -1027,7 +1215,7 @@ static int htmlStartCloseIndexinitialized = 0; /************************************************************************ * * - * functions to handle HTML specific data * + * functions to handle HTML specific data * * * ************************************************************************/ @@ -1077,7 +1265,7 @@ htmlTagLookup(const xmlChar *tag) { /** * htmlGetEndPriority: * @name: The name of the element to look up the priority for. - * + * * Return value: The "endtag" priority. **/ static int @@ -1156,7 +1344,7 @@ htmlAutoCloseOnClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag) * A missplaced endtag can only close elements with lower * or equal priority, so if we find an element with higher * priority before we find an element with - * matching name, we just ignore this endtag + * matching name, we just ignore this endtag */ if (htmlGetEndPriority(ctxt->nameTab[i]) > priority) return; @@ -1207,7 +1395,7 @@ htmlAutoCloseOnEnd(htmlParserCtxtPtr ctxt) * called when a new tag has been detected and generates the * appropriates closes if possible/needed. * If newtag is NULL this mean we are at the end of the resource - * and we should check + * and we should check */ static void htmlAutoClose(htmlParserCtxtPtr ctxt, const xmlChar * newtag) @@ -1295,6 +1483,10 @@ htmlIsAutoClosed(htmlDocPtr doc, htmlNodePtr elem) { */ static void htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) { + int i; + + if (ctxt->options & HTML_PARSE_NOIMPLIED) + return; if (!htmlOmittedDefaultValue) return; if (xmlStrEqual(newtag, BAD_CAST"html")) @@ -1306,24 +1498,31 @@ htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) { } if ((xmlStrEqual(newtag, BAD_CAST"body")) || (xmlStrEqual(newtag, BAD_CAST"head"))) return; - if ((ctxt->nameNr <= 1) && + if ((ctxt->nameNr <= 1) && ((xmlStrEqual(newtag, BAD_CAST"script")) || (xmlStrEqual(newtag, BAD_CAST"style")) || (xmlStrEqual(newtag, BAD_CAST"meta")) || (xmlStrEqual(newtag, BAD_CAST"link")) || (xmlStrEqual(newtag, BAD_CAST"title")) || (xmlStrEqual(newtag, BAD_CAST"base")))) { - /* - * dropped OBJECT ... i you put it first BODY will be - * assumed ! - */ - htmlnamePush(ctxt, BAD_CAST"head"); - if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) - ctxt->sax->startElement(ctxt->userData, BAD_CAST"head", NULL); + if (ctxt->html >= 3) { + /* we already saw or generated an before */ + return; + } + /* + * dropped OBJECT ... i you put it first BODY will be + * assumed ! + */ + htmlnamePush(ctxt, BAD_CAST"head"); + if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) + ctxt->sax->startElement(ctxt->userData, BAD_CAST"head", NULL); } else if ((!xmlStrEqual(newtag, BAD_CAST"noframes")) && (!xmlStrEqual(newtag, BAD_CAST"frame")) && (!xmlStrEqual(newtag, BAD_CAST"frameset"))) { - int i; + if (ctxt->html >= 10) { + /* we already saw or generated a before */ + return; + } for (i = 0;i < ctxt->nameNr;i++) { if (xmlStrEqual(ctxt->nameTab[i], BAD_CAST"body")) { return; @@ -1332,7 +1531,7 @@ htmlCheckImplied(htmlParserCtxtPtr ctxt, const xmlChar *newtag) { return; } } - + htmlnamePush(ctxt, BAD_CAST"body"); if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) ctxt->sax->startElement(ctxt->userData, BAD_CAST"body", NULL); @@ -1394,12 +1593,12 @@ htmlIsScriptAttribute(const xmlChar *name) { unsigned int i; if (name == NULL) - return(0); + return(0); /* * all script attributes start with 'on' */ if ((name[0] != 'o') || (name[1] != 'n')) - return(0); + return(0); for (i = 0; i < sizeof(htmlScriptAttributes)/sizeof(htmlScriptAttributes[0]); i++) { @@ -1411,7 +1610,7 @@ htmlIsScriptAttribute(const xmlChar *name) { /************************************************************************ * * - * The list of HTML predefined entities * + * The list of HTML predefined entities * * * ************************************************************************/ @@ -1825,7 +2024,7 @@ UTF8ToHtml(unsigned char* out, int *outlen, if (inend - in < trailing) { break; - } + } for ( ; trailing; trailing--) { if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80)) @@ -1842,6 +2041,8 @@ UTF8ToHtml(unsigned char* out, int *outlen, } else { int len; const htmlEntityDesc * ent; + const char *cp; + char nbuf[16]; /* * Try to lookup a predefined HTML entity for it @@ -1849,16 +2050,16 @@ UTF8ToHtml(unsigned char* out, int *outlen, ent = htmlEntityValueLookup(c); if (ent == NULL) { - /* no chance for this in Ascii */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); + snprintf(nbuf, sizeof(nbuf), "#%u", c); + cp = nbuf; } - len = strlen(ent->name); + else + cp = ent->name; + len = strlen(cp); if (out + 2 + len >= outend) break; *out++ = '&'; - memcpy(out, ent->name, len); + memcpy(out, cp, len); out += len; *out++ = ';'; } @@ -2013,7 +2214,7 @@ htmlNewInputStream(htmlParserCtxtPtr ctxt) { * * ************************************************************************/ /* - * all tags allowing pc data from the html 4.01 loose dtd + * all tags allowing pc data from the html 4.01 loose dtd * NOTE: it might be more apropriate to integrate this information * into the html40ElementTable array but I don't want to risk any * binary incomptibility @@ -2073,7 +2274,7 @@ static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) { if (lastChild == NULL) { if ((ctxt->node->type != XML_ELEMENT_NODE) && (ctxt->node->content != NULL)) return(0); - /* keep ws in constructs like ... ... + /* keep ws in constructs like ... ... for all tags "b" allowing PCDATA */ for ( i = 0; i < sizeof(allowPCData)/sizeof(allowPCData[0]); i++ ) { if ( xmlStrEqual(ctxt->name, BAD_CAST allowPCData[i]) ) { @@ -2083,7 +2284,7 @@ static int areBlanks(htmlParserCtxtPtr ctxt, const xmlChar *str, int len) { } else if (xmlNodeIsText(lastChild)) { return(0); } else { - /* keep ws in constructs like

xy z

+ /* keep ws in constructs like

xy z

for all tags "p" allowing PCDATA */ for ( i = 0; i < sizeof(allowPCData)/sizeof(allowPCData[0]); i++ ) { if ( xmlStrEqual(lastChild->name, BAD_CAST allowPCData[i]) ) { @@ -2123,7 +2324,7 @@ htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *ExternalID) { cur->intSubset = NULL; cur->doc = cur; cur->name = NULL; - cur->children = NULL; + cur->children = NULL; cur->extSubset = NULL; cur->oldNs = NULL; cur->encoding = NULL; @@ -2133,6 +2334,7 @@ htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *ExternalID) { cur->refs = NULL; cur->_private = NULL; cur->charset = XML_CHAR_ENCODING_UTF8; + cur->properties = XML_DOC_HTML | XML_DOC_USERBUILT; if ((ExternalID != NULL) || (URI != NULL)) xmlCreateIntSubset(cur, BAD_CAST "html", ExternalID, URI); @@ -2190,21 +2392,54 @@ htmlParseHTMLName(htmlParserCtxtPtr ctxt) { xmlChar loc[HTML_PARSER_BUFFER_SIZE]; if (!IS_ASCII_LETTER(CUR) && (CUR != '_') && - (CUR != ':')) return(NULL); + (CUR != ':') && (CUR != '.')) return(NULL); while ((i < HTML_PARSER_BUFFER_SIZE) && ((IS_ASCII_LETTER(CUR)) || (IS_ASCII_DIGIT(CUR)) || - (CUR == ':') || (CUR == '-') || (CUR == '_'))) { + (CUR == ':') || (CUR == '-') || (CUR == '_') || + (CUR == '.'))) { if ((CUR >= 'A') && (CUR <= 'Z')) loc[i] = CUR + 0x20; else loc[i] = CUR; i++; - + NEXT; } - + + return(xmlDictLookup(ctxt->dict, loc, i)); +} + + +/** + * htmlParseHTMLName_nonInvasive: + * @ctxt: an HTML parser context + * + * parse an HTML tag or attribute name, note that we convert it to lowercase + * since HTML names are not case-sensitive, this doesn't consume the data + * from the stream, it's a look-ahead + * + * Returns the Tag Name parsed or NULL + */ + +static const xmlChar * +htmlParseHTMLName_nonInvasive(htmlParserCtxtPtr ctxt) { + int i = 0; + xmlChar loc[HTML_PARSER_BUFFER_SIZE]; + + if (!IS_ASCII_LETTER(NXT(1)) && (NXT(1) != '_') && + (NXT(1) != ':')) return(NULL); + + while ((i < HTML_PARSER_BUFFER_SIZE) && + ((IS_ASCII_LETTER(NXT(1+i))) || (IS_ASCII_DIGIT(NXT(1+i))) || + (NXT(1+i) == ':') || (NXT(1+i) == '-') || (NXT(1+i) == '_'))) { + if ((NXT(1+i) >= 'A') && (NXT(1+i) <= 'Z')) loc[i] = NXT(1+i) + 0x20; + else loc[i] = NXT(1+i); + i++; + } + return(xmlDictLookup(ctxt->dict, loc, i)); } + /** * htmlParseName: * @ctxt: an HTML parser context @@ -2268,7 +2503,7 @@ htmlParseNameComplex(xmlParserCtxtPtr ctxt) { while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ ((IS_LETTER(c)) || (IS_DIGIT(c)) || (c == '.') || (c == '-') || - (c == '_') || (c == ':') || + (c == '_') || (c == ':') || (IS_COMBINING(c)) || (IS_EXTENDER(c)))) { if (count++ > 100) { @@ -2287,7 +2522,7 @@ htmlParseNameComplex(xmlParserCtxtPtr ctxt) { * htmlParseHTMLAttribute: * @ctxt: an HTML parser context * @stop: a char stop value - * + * * parse an HTML attribute value till the stop (quote), if * stop is 0 then it stops at the first space * @@ -2332,13 +2567,13 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) { { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; } else if (c < 0x10000) { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; } - else + else { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; } - + for ( ; bits >= 0; bits-= 6) { *out++ = ((c >> bits) & 0x3F) | 0x80; } - + if (out - buffer > buffer_size - 100) { int indx = out - buffer; @@ -2384,9 +2619,9 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) { { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; } else if (c < 0x10000) { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; } - else + else { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; } - + for ( ; bits >= 0; bits-= 6) { *out++ = ((c >> bits) & 0x3F) | 0x80; } @@ -2409,16 +2644,16 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt, const xmlChar stop) { { *out++ =((c >> 6) & 0x1F) | 0xC0; bits= 0; } else if (c < 0x10000) { *out++ =((c >> 12) & 0x0F) | 0xE0; bits= 6; } - else + else { *out++ =((c >> 18) & 0x07) | 0xF0; bits= 12; } - + for ( ; bits >= 0; bits-= 6) { *out++ = ((c >> bits) & 0x3F) | 0x80; } NEXT; } } - *out++ = 0; + *out = 0; return(buffer); } @@ -2479,7 +2714,7 @@ htmlParseEntityRef(htmlParserCtxtPtr ctxt, const xmlChar **str) { * parse a value for an attribute * Note: the parser won't do substitution of entities here, this * will be handled later in xmlStringGetNodeList, unless it was - * asked for ctxt->replaceEntities != 0 + * asked for ctxt->replaceEntities != 0 * * Returns the AttValue parsed or NULL. */ @@ -2520,7 +2755,7 @@ htmlParseAttValue(htmlParserCtxtPtr ctxt) { /** * htmlParseSystemLiteral: * @ctxt: an HTML parser context - * + * * parse an HTML Literal * * [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") @@ -2561,7 +2796,7 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, " or ' expected\n", NULL, NULL); } - + return(ret); } @@ -2610,7 +2845,7 @@ htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) { htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, "PubidLiteral \" or ' expected\n", NULL, NULL); } - + return(ret); } @@ -2644,23 +2879,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { SHRINK; cur = CUR_CHAR(l); while (IS_CHAR_CH(cur)) { - if ((cur == '<') && (NXT(1) == '!') && (NXT(2) == '-') && - (NXT(3) == '-')) { - if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { - if (ctxt->sax->cdataBlock!= NULL) { - /* - * Insert as CDATA, which is the same as HTML_PRESERVE_NODE - */ - ctxt->sax->cdataBlock(ctxt->userData, buf, nbchar); - } else if (ctxt->sax->characters != NULL) { - ctxt->sax->characters(ctxt->userData, buf, nbchar); - } - } - nbchar = 0; - htmlParseComment(ctxt); - cur = CUR_CHAR(l); - continue; - } else if ((cur == '<') && (NXT(1) == '/')) { + if ((cur == '<') && (NXT(1) == '/')) { /* * One should break here, the specification is clear: * Authors should therefore escape "recovery) { - if (xmlStrncasecmp(ctxt->name, ctxt->input->cur+2, - xmlStrlen(ctxt->name)) == 0) + if (xmlStrncasecmp(ctxt->name, ctxt->input->cur+2, + xmlStrlen(ctxt->name)) == 0) { break; /* while */ } else { @@ -2684,7 +2903,7 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { } } else { if (((NXT(2) >= 'A') && (NXT(2) <= 'Z')) || - ((NXT(2) >= 'a') && (NXT(2) <= 'z'))) + ((NXT(2) >= 'a') && (NXT(2) <= 'z'))) { break; /* while */ } @@ -2708,9 +2927,11 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { } if ((!(IS_CHAR_CH(cur))) && (!((cur == 0) && (ctxt->progressive)))) { - htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, - "Invalid char in CDATA 0x%X\n", cur); - NEXT; + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Invalid char in CDATA 0x%X\n", cur); + if (ctxt->input->cur < ctxt->input->end) { + NEXT; + } } if ((nbchar != 0) && (ctxt->sax != NULL) && (!ctxt->disableSAX)) { @@ -2727,8 +2948,9 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { /** - * htmlParseCharData: + * htmlParseCharDataInternal: * @ctxt: an HTML parser context + * @readahead: optional read ahead character in ascii range * * parse a CharData section. * if we are within a CDATA section ']]>' marks an end of section. @@ -2737,26 +2959,40 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { */ static void -htmlParseCharData(htmlParserCtxtPtr ctxt) { - xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 5]; +htmlParseCharDataInternal(htmlParserCtxtPtr ctxt, int readahead) { + xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 6]; int nbchar = 0; int cur, l; + int chunk = 0; + + if (readahead) + buf[nbchar++] = readahead; SHRINK; cur = CUR_CHAR(l); while (((cur != '<') || (ctxt->token == '<')) && - ((cur != '&') || (ctxt->token == '&')) && - (IS_CHAR(cur))) { - COPY_BUF(l,buf,nbchar,cur); + ((cur != '&') || (ctxt->token == '&')) && + (cur != 0)) { + if (!(IS_CHAR(cur))) { + htmlParseErrInt(ctxt, XML_ERR_INVALID_CHAR, + "Invalid char in CDATA 0x%X\n", cur); + } else { + COPY_BUF(l,buf,nbchar,cur); + } if (nbchar >= HTML_PARSER_BIG_BUFFER_SIZE) { /* * Ok the segment is to be consumed as chars. */ if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { if (areBlanks(ctxt, buf, nbchar)) { - if (ctxt->sax->ignorableWhitespace != NULL) - ctxt->sax->ignorableWhitespace(ctxt->userData, - buf, nbchar); + if (ctxt->keepBlanks) { + if (ctxt->sax->characters != NULL) + ctxt->sax->characters(ctxt->userData, buf, nbchar); + } else { + if (ctxt->sax->ignorableWhitespace != NULL) + ctxt->sax->ignorableWhitespace(ctxt->userData, + buf, nbchar); + } } else { htmlCheckParagraph(ctxt); if (ctxt->sax->characters != NULL) @@ -2766,6 +3002,12 @@ htmlParseCharData(htmlParserCtxtPtr ctxt) { nbchar = 0; } NEXTL(l); + chunk++; + if (chunk > HTML_PARSER_BUFFER_SIZE) { + chunk = 0; + SHRINK; + GROW; + } cur = CUR_CHAR(l); if (cur == 0) { SHRINK; @@ -2781,8 +3023,14 @@ htmlParseCharData(htmlParserCtxtPtr ctxt) { */ if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { if (areBlanks(ctxt, buf, nbchar)) { - if (ctxt->sax->ignorableWhitespace != NULL) - ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar); + if (ctxt->keepBlanks) { + if (ctxt->sax->characters != NULL) + ctxt->sax->characters(ctxt->userData, buf, nbchar); + } else { + if (ctxt->sax->ignorableWhitespace != NULL) + ctxt->sax->ignorableWhitespace(ctxt->userData, + buf, nbchar); + } } else { htmlCheckParagraph(ctxt); if (ctxt->sax->characters != NULL) @@ -2798,6 +3046,21 @@ htmlParseCharData(htmlParserCtxtPtr ctxt) { } } +/** + * htmlParseCharData: + * @ctxt: an HTML parser context + * + * parse a CharData section. + * if we are within a CDATA section ']]>' marks an end of section. + * + * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) + */ + +static void +htmlParseCharData(htmlParserCtxtPtr ctxt) { + htmlParseCharDataInternal(ctxt, 0); +} + /** * htmlParseExternalID: * @ctxt: an HTML parser context @@ -2960,7 +3223,7 @@ htmlParsePI(htmlParserCtxtPtr ctxt) { } xmlFree(buf); } else { - htmlParseErr(ctxt, XML_ERR_PI_NOT_STARTED, + htmlParseErr(ctxt, XML_ERR_PI_NOT_STARTED, "PI is not started correctly", NULL, NULL); } ctxt->instate = state; @@ -3001,12 +3264,17 @@ htmlParseComment(htmlParserCtxtPtr ctxt) { ctxt->instate = state; return; } + len = 0; + buf[len] = 0; q = CUR_CHAR(ql); + if (!IS_CHAR(q)) + goto unfinished; NEXTL(ql); r = CUR_CHAR(rl); + if (!IS_CHAR(r)) + goto unfinished; NEXTL(rl); cur = CUR_CHAR(l); - len = 0; while (IS_CHAR(cur) && ((cur != '>') || (r != '-') || (q != '-'))) { @@ -3037,18 +3305,20 @@ htmlParseComment(htmlParserCtxtPtr ctxt) { } } buf[len] = 0; - if (!IS_CHAR(cur)) { - htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, - "Comment not terminated \n */ - base += 2; - } - } - if (incomment) { - if (base + 3 > len) - return(-1); - if ((buf[base] == '-') && (buf[base + 1] == '-') && - (buf[base + 2] == '>')) { - incomment = 0; - base += 2; - } - continue; - } + if (third) + len -= 2; + else if (next) + len--; + for (; base < len; base++) { + if ((!incomment) && (base + 4 < len) && (!iscomment)) { + if ((buf[base] == '<') && (buf[base + 1] == '!') && + (buf[base + 2] == '-') && (buf[base + 3] == '-')) { + incomment = 1; + /* do not increment past */ + base += 2; + } + } + if (ignoreattrval) { + if (buf[base] == '"' || buf[base] == '\'') { + if (invalue) { + if (buf[base] == valdellim) { + invalue = 0; + continue; + } + } else { + valdellim = buf[base]; + invalue = 1; + continue; + } + } else if (invalue) { + continue; + } + } + if (incomment) { + if (base + 3 > len) + return (-1); + if ((buf[base] == '-') && (buf[base + 1] == '-') && + (buf[base + 2] == '>')) { + incomment = 0; + base += 2; + } + continue; + } if (buf[base] == first) { - if (third != 0) { - if ((buf[base + 1] != next) || - (buf[base + 2] != third)) continue; - } else if (next != 0) { - if (buf[base + 1] != next) continue; - } - ctxt->checkIndex = 0; + if (third != 0) { + if ((buf[base + 1] != next) || (buf[base + 2] != third)) + continue; + } else if (next != 0) { + if (buf[base + 1] != next) + continue; + } + ctxt->checkIndex = 0; #ifdef DEBUG_PUSH - if (next == 0) - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c' found at %d\n", - first, base); - else if (third == 0) - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c%c' found at %d\n", - first, next, base); - else - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c%c%c' found at %d\n", - first, next, third, base); + if (next == 0) + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c' found at %d\n", + first, base); + else if (third == 0) + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c%c' found at %d\n", + first, next, base); + else + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c%c%c' found at %d\n", + first, next, third, base); #endif - return(base - (in->cur - in->base)); - } + return (base - (in->cur - in->base)); + } } - ctxt->checkIndex = base; + if ((!incomment) && (!invalue)) + ctxt->checkIndex = base; #ifdef DEBUG_PUSH if (next == 0) - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c' failed\n", first); + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c' failed\n", first); else if (third == 0) - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c%c' failed\n", first, next); - else - xmlGenericError(xmlGenericErrorContext, - "HPP: lookup '%c%c%c' failed\n", first, next, third); + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c%c' failed\n", first, next); + else + xmlGenericError(xmlGenericErrorContext, + "HPP: lookup '%c%c%c' failed\n", first, next, + third); #endif - return(-1); + return (-1); +} + +/** + * htmlParseLookupChars: + * @ctxt: an HTML parser context + * @stop: Array of chars, which stop the lookup. + * @stopLen: Length of stop-Array + * + * Try to find if any char of the stop-Array is available in the input + * stream. + * This function has a side effect of (possibly) incrementing ctxt->checkIndex + * to avoid rescanning sequences of bytes, it DOES change the state of the + * parser, do not use liberally. + * + * Returns the index to the current parsing point if a stopChar + * is available, -1 otherwise. + */ +static int +htmlParseLookupChars(htmlParserCtxtPtr ctxt, const xmlChar * stop, + int stopLen) +{ + int base, len; + htmlParserInputPtr in; + const xmlChar *buf; + int incomment = 0; + int i; + + in = ctxt->input; + if (in == NULL) + return (-1); + + base = in->cur - in->base; + if (base < 0) + return (-1); + + if (ctxt->checkIndex > base) + base = ctxt->checkIndex; + + if (in->buf == NULL) { + buf = in->base; + len = in->length; + } else { + buf = xmlBufContent(in->buf->buffer); + len = xmlBufUse(in->buf->buffer); + } + + for (; base < len; base++) { + if (!incomment && (base + 4 < len)) { + if ((buf[base] == '<') && (buf[base + 1] == '!') && + (buf[base + 2] == '-') && (buf[base + 3] == '-')) { + incomment = 1; + /* do not increment past */ + base += 2; + } + } + if (incomment) { + if (base + 3 > len) + return (-1); + if ((buf[base] == '-') && (buf[base + 1] == '-') && + (buf[base + 2] == '>')) { + incomment = 0; + base += 2; + } + continue; + } + for (i = 0; i < stopLen; ++i) { + if (buf[base] == stop[i]) { + ctxt->checkIndex = 0; + return (base - (in->cur - in->base)); + } + } + } + ctxt->checkIndex = base; + return (-1); } /** @@ -4517,6 +5280,8 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { int avail = 0; xmlChar cur, next; + htmlParserNodeInfo node_info; + #ifdef DEBUG_PUSH switch (ctxt->instate) { case XML_PARSER_EOF: @@ -4577,10 +5342,10 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (in->buf == NULL) avail = in->length - (in->cur - in->base); else - avail = in->buf->buffer->use - (in->cur - in->base); + avail = xmlBufUse(in->buf->buffer) - (in->cur - in->base); if ((avail == 0) && (terminate)) { htmlAutoCloseOnEnd(ctxt); - if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { + if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { /* * SAX: end of the document processing. */ @@ -4613,7 +5378,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (in->buf == NULL) avail = in->length - (in->cur - in->base); else - avail = in->buf->buffer->use - (in->cur - in->base); + avail = xmlBufUse(in->buf->buffer) - (in->cur - in->base); } if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) ctxt->sax->setDocumentLocator(ctxt->userData, @@ -4630,7 +5395,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { (UPP(6) == 'Y') && (UPP(7) == 'P') && (UPP(8) == 'E')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -4655,15 +5420,28 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (in->buf == NULL) avail = in->length - (in->cur - in->base); else - avail = in->buf->buffer->use - (in->cur - in->base); - if (avail < 2) + avail = xmlBufUse(in->buf->buffer) - (in->cur - in->base); + /* + * no chars in buffer + */ + if (avail < 1) goto done; + /* + * not enouth chars in buffer + */ + if (avail < 2) { + if (!terminate) + goto done; + else + next = ' '; + } else { + next = in->cur[1]; + } cur = in->cur[0]; - next = in->cur[1]; if ((cur == '<') && (next == '!') && (in->cur[2] == '-') && (in->cur[3] == '-')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '-', '-', '>', 1) < 0)) + (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -4673,7 +5451,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ctxt->instate = XML_PARSER_MISC; } else if ((cur == '<') && (next == '?')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -4687,7 +5465,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { (UPP(6) == 'Y') && (UPP(7) == 'P') && (UPP(8) == 'E')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -4715,15 +5493,15 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (in->buf == NULL) avail = in->length - (in->cur - in->base); else - avail = in->buf->buffer->use - (in->cur - in->base); - if (avail < 2) + avail = xmlBufUse(in->buf->buffer) - (in->cur - in->base); + if (avail < 2) goto done; cur = in->cur[0]; next = in->cur[1]; if ((cur == '<') && (next == '!') && (in->cur[2] == '-') && (in->cur[3] == '-')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '-', '-', '>', 1) < 0)) + (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -4733,7 +5511,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ctxt->instate = XML_PARSER_PROLOG; } else if ((cur == '<') && (next == '?')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -4756,7 +5534,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (in->buf == NULL) avail = in->length - (in->cur - in->base); else - avail = in->buf->buffer->use - (in->cur - in->base); + avail = xmlBufUse(in->buf->buffer) - (in->cur - in->base); if (avail < 1) goto done; cur = in->cur[0]; @@ -4770,7 +5548,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if ((cur == '<') && (next == '!') && (in->cur[2] == '-') && (in->cur[3] == '-')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '-', '-', '>', 1) < 0)) + (htmlParseLookupSequence(ctxt, '-', '-', '>', 1, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -4780,7 +5558,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ctxt->instate = XML_PARSER_EPILOG; } else if ((cur == '<') && (next == '?')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -4809,8 +5587,22 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { int failed; const htmlElemDesc * info; - if (avail < 2) + /* + * no chars in buffer + */ + if (avail < 1) goto done; + /* + * not enouth chars in buffer + */ + if (avail < 2) { + if (!terminate) + goto done; + else + next = ' '; + } else { + next = in->cur[1]; + } cur = in->cur[0]; if (cur != '<') { ctxt->instate = XML_PARSER_CONTENT; @@ -4820,7 +5612,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { #endif break; } - if (in->cur[1] == '/') { + if (next == '/') { ctxt->instate = XML_PARSER_END_TAG; ctxt->checkIndex = 0; #ifdef DEBUG_PUSH @@ -4830,12 +5622,20 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { break; } if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) goto done; + /* Capture start position */ + if (ctxt->record_info) { + node_info.begin_pos = ctxt->input->consumed + + (CUR_PTR - ctxt->input->base); + node_info.begin_line = ctxt->input->line; + } + + failed = htmlParseStartTag(ctxt); name = ctxt->name; - if (failed || + if ((failed == -1) || (name == NULL)) { if (CUR == '>') NEXT; @@ -4877,10 +5677,13 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { /* * end of parsing of this node. */ - if (xmlStrEqual(name, ctxt->name)) { + if (xmlStrEqual(name, ctxt->name)) { nodePop(ctxt); htmlnamePop(ctxt); - } + } + + if (ctxt->record_info) + htmlNodeInfoPush(ctxt, &node_info); ctxt->instate = XML_PARSER_CONTENT; #ifdef DEBUG_PUSH @@ -4898,6 +5701,10 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ctxt->sax->endElement(ctxt->userData, name); htmlnamePop(ctxt); } + + if (ctxt->record_info) + htmlNodeInfoPush(ctxt, &node_info); + ctxt->instate = XML_PARSER_CONTENT; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -4925,14 +5732,20 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if ((cur != '<') && (cur != '&')) { if (ctxt->sax != NULL) { if (IS_BLANK_CH(cur)) { - if (ctxt->sax->ignorableWhitespace != NULL) - ctxt->sax->ignorableWhitespace( - ctxt->userData, &cur, 1); + if (ctxt->keepBlanks) { + if (ctxt->sax->characters != NULL) + ctxt->sax->characters( + ctxt->userData, &in->cur[0], 1); + } else { + if (ctxt->sax->ignorableWhitespace != NULL) + ctxt->sax->ignorableWhitespace( + ctxt->userData, &in->cur[0], 1); + } } else { htmlCheckParagraph(ctxt); if (ctxt->sax->characters != NULL) ctxt->sax->characters( - ctxt->userData, &cur, 1); + ctxt->userData, &in->cur[0], 1); } } ctxt->token = 0; @@ -4955,7 +5768,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { int idx; xmlChar val; - idx = htmlParseLookupSequence(ctxt, '<', '/', 0, 0); + idx = htmlParseLookupSequence(ctxt, '<', '/', 0, 0, 0); if (idx < 0) goto done; val = in->cur[idx + 2]; @@ -4982,7 +5795,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { (UPP(6) == 'Y') && (UPP(7) == 'P') && (UPP(8) == 'E')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) goto done; htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, "Misplaced DOCTYPE declaration\n", @@ -4992,7 +5805,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { (in->cur[2] == '-') && (in->cur[3] == '-')) { if ((!terminate) && (htmlParseLookupSequence( - ctxt, '-', '-', '>', 1) < 0)) + ctxt, '-', '-', '>', 1, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5002,7 +5815,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { ctxt->instate = XML_PARSER_CONTENT; } else if ((cur == '<') && (next == '?')) { if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5030,7 +5843,8 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { break; } else if (cur == '&') { if ((!terminate) && - (htmlParseLookupSequence(ctxt, ';', 0, 0, 0) < 0)) + (htmlParseLookupChars(ctxt, + BAD_CAST "; >/", 4) < 0)) goto done; #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, @@ -5046,7 +5860,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { * data detection. */ if ((!terminate) && - (htmlParseLookupSequence(ctxt, '<', 0, 0, 0) < 0)) + (htmlParseLookupChars(ctxt, BAD_CAST "<&", 2) < 0)) goto done; ctxt->checkIndex = 0; #ifdef DEBUG_PUSH @@ -5072,7 +5886,7 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { if (avail < 2) goto done; if ((!terminate) && - (htmlParseLookupSequence(ctxt, '>', 0, 0, 0) < 0)) + (htmlParseLookupSequence(ctxt, '>', 0, 0, 0, 1) < 0)) goto done; htmlParseEndTag(ctxt); if (ctxt->nameNr == 0) { @@ -5199,10 +6013,10 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) { } } -done: +done: if ((avail == 0) && (terminate)) { htmlAutoCloseOnEnd(ctxt); - if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { + if ((ctxt->nameNr == 0) && (ctxt->instate != XML_PARSER_EOF)) { /* * SAX: end of the document processing. */ @@ -5211,14 +6025,14 @@ done: ctxt->sax->endDocument(ctxt->userData); } } - if ((ctxt->myDoc != NULL) && + if ((!(ctxt->options & HTML_PARSE_NODEFDTD)) && (ctxt->myDoc != NULL) && ((terminate) || (ctxt->instate == XML_PARSER_EOF) || (ctxt->instate == XML_PARSER_EPILOG))) { xmlDtdPtr dtd; dtd = xmlGetIntSubset(ctxt->myDoc); if (dtd == NULL) - ctxt->myDoc->intSubset = - xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "html", + ctxt->myDoc->intSubset = + xmlCreateIntSubset(ctxt->myDoc, BAD_CAST "html", BAD_CAST "-//W3C//DTD HTML 4.0 Transitional//EN", BAD_CAST "http://www.w3.org/TR/REC-html40/loose.dtd"); } @@ -5249,20 +6063,17 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, } if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) { - int base = ctxt->input->base - ctxt->input->buf->buffer->content; - int cur = ctxt->input->cur - ctxt->input->base; + size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input); + size_t cur = ctxt->input->cur - ctxt->input->base; int res; - - res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk); + + res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk); if (res < 0) { ctxt->errNo = XML_PARSER_EOF; ctxt->disableSAX = 1; return (XML_PARSER_EOF); } - ctxt->input->base = ctxt->input->buf->buffer->content + base; - ctxt->input->cur = ctxt->input->base + cur; - ctxt->input->end = - &ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use]; + xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, cur); #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size); #endif @@ -5277,13 +6088,16 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, if ((in->encoder != NULL) && (in->buffer != NULL) && (in->raw != NULL)) { int nbchars; - - nbchars = xmlCharEncInFunc(in->encoder, in->buffer, in->raw); + size_t base = xmlBufGetInputBase(in->buffer, ctxt->input); + size_t current = ctxt->input->cur - ctxt->input->base; + + nbchars = xmlCharEncInput(in, terminate); if (nbchars < 0) { htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, "encoder error\n", NULL, NULL); return(XML_ERR_INVALID_ENCODING); } + xmlBufSetInputBaseCur(in->buffer, ctxt->input, base, current); } } } @@ -5294,14 +6108,14 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, (ctxt->instate != XML_PARSER_MISC)) { ctxt->errNo = XML_ERR_DOCUMENT_END; ctxt->wellFormed = 0; - } + } if (ctxt->instate != XML_PARSER_EOF) { if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) ctxt->sax->endDocument(ctxt->userData); } ctxt->instate = XML_PARSER_EOF; } - return((xmlParserErrors) ctxt->errNo); + return((xmlParserErrors) ctxt->errNo); } /************************************************************************ @@ -5326,7 +6140,7 @@ htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, * Returns the new parser context or NULL */ htmlParserCtxtPtr -htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, +htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, const char *chunk, int size, const char *filename, xmlCharEncoding enc) { htmlParserCtxtPtr ctxt; @@ -5357,7 +6171,7 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, memcpy(ctxt->sax, sax, sizeof(htmlSAXHandler)); if (user_data != NULL) ctxt->userData = user_data; - } + } if (filename == NULL) { ctxt->directory = NULL; } else { @@ -5377,24 +6191,18 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, inputStream->filename = (char *) xmlCanonicPath((const xmlChar *) filename); inputStream->buf = buf; - inputStream->base = inputStream->buf->buffer->content; - inputStream->cur = inputStream->buf->buffer->content; - inputStream->end = - &inputStream->buf->buffer->content[inputStream->buf->buffer->use]; + xmlBufResetInput(buf->buffer, inputStream); inputPush(ctxt, inputStream); if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && - (ctxt->input->buf != NULL)) { - int base = ctxt->input->base - ctxt->input->buf->buffer->content; - int cur = ctxt->input->cur - ctxt->input->base; + (ctxt->input->buf != NULL)) { + size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input); + size_t cur = ctxt->input->cur - ctxt->input->base; - xmlParserInputBufferPush(ctxt->input->buf, size, chunk); + xmlParserInputBufferPush(ctxt->input->buf, size, chunk); - ctxt->input->base = ctxt->input->buf->buffer->content + base; - ctxt->input->cur = ctxt->input->base + cur; - ctxt->input->end = - &ctxt->input->buf->buffer->content[ctxt->input->buf->buffer->use]; + xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, cur); #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, "HPP: pushed %d\n", size); #endif @@ -5410,12 +6218,12 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, * @cur: a pointer to an array of xmlChar * @encoding: a free form C string describing the HTML document encoding, or NULL * @sax: the SAX handler block - * @userData: if using SAX, this pointer will be provided on callbacks. + * @userData: if using SAX, this pointer will be provided on callbacks. * * Parse an HTML in-memory document. If sax is not NULL, use the SAX callbacks * to handle parse events. If sax is NULL, fallback to the default DOM * behavior and return a tree. - * + * * Returns the resulting document tree unless SAX is NULL or the document is * not well formed. */ @@ -5432,7 +6240,7 @@ htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void ctxt = htmlCreateDocParserCtxt(cur, encoding); if (ctxt == NULL) return(NULL); - if (sax != NULL) { + if (sax != NULL) { if (ctxt->sax != NULL) xmlFree (ctxt->sax); ctxt->sax = sax; ctxt->userData = userData; @@ -5445,7 +6253,7 @@ htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void ctxt->userData = NULL; } htmlFreeParserCtxt(ctxt); - + return(ret); } @@ -5455,7 +6263,7 @@ htmlSAXParseDoc(xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void * @encoding: a free form C string describing the HTML document encoding, or NULL * * parse an HTML in-memory document and build a tree. - * + * * Returns the resulting document tree */ @@ -5470,7 +6278,7 @@ htmlParseDoc(xmlChar *cur, const char *encoding) { * @filename: the filename * @encoding: a free form C string describing the HTML document encoding, or NULL * - * Create a parser context for a file content. + * Create a parser context for a file content. * Automatic support for ZLIB/Compress compressed document is provided * by default if found at compile-time. * @@ -5502,7 +6310,7 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding) xmlFreeParserCtxt(ctxt); return(NULL); } - + inputStream = xmlLoadExternalEntity(canonicFilename, NULL, ctxt); xmlFree(canonicFilename); if (inputStream == NULL) { @@ -5514,15 +6322,19 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding) /* set encoding */ if (encoding) { - content = xmlMallocAtomic (xmlStrlen(content_line) + strlen(encoding) + 1); - if (content) { - strcpy ((char *)content, (char *)content_line); - strcat ((char *)content, (char *)encoding); - htmlCheckEncoding (ctxt, content); - xmlFree (content); + size_t l = strlen(encoding); + + if (l < 1000) { + content = xmlMallocAtomic (xmlStrlen(content_line) + l + 1); + if (content) { + strcpy ((char *)content, (char *)content_line); + strcat ((char *)content, (char *)encoding); + htmlCheckEncoding (ctxt, content); + xmlFree (content); + } } } - + return(ctxt); } @@ -5531,7 +6343,7 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding) * @filename: the filename * @encoding: a free form C string describing the HTML document encoding, or NULL * @sax: the SAX handler block - * @userData: if using SAX, this pointer will be provided on callbacks. + * @userData: if using SAX, this pointer will be provided on callbacks. * * parse an HTML file and build a tree. Automatic support for ZLIB/Compress * compressed document is provided by default if found at compile-time. @@ -5543,7 +6355,7 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding) */ htmlDocPtr -htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr sax, +htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr sax, void *userData) { htmlDocPtr ret; htmlParserCtxtPtr ctxt; @@ -5567,7 +6379,7 @@ htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr s ctxt->userData = NULL; } htmlFreeParserCtxt(ctxt); - + return(ret); } @@ -5589,7 +6401,7 @@ htmlParseFile(const char *filename, const char *encoding) { /** * htmlHandleOmittedElem: - * @val: int 0 or 1 + * @val: int 0 or 1 * * Set and return the previous value for handling HTML omitted tags. * @@ -5729,7 +6541,7 @@ htmlNodeStatus(const htmlNodePtr node, int legacy) { * current scope */ #define DICT_FREE(str) \ - if ((str) && ((!dict) || \ + if ((str) && ((!dict) || \ (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \ xmlFree((char *)(str)); @@ -5744,7 +6556,7 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt) { xmlParserInputPtr input; xmlDictPtr dict; - + if (ctxt == NULL) return; @@ -5796,6 +6608,7 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt) ctxt->wellFormed = 1; ctxt->nsWellFormed = 1; + ctxt->disableSAX = 0; ctxt->valid = 1; ctxt->vctxt.userData = ctxt; ctxt->vctxt.error = xmlParserValidityError; @@ -5806,7 +6619,7 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt) ctxt->inSubset = 0; ctxt->errNo = XML_ERR_OK; ctxt->depth = 0; - ctxt->charset = XML_CHAR_ENCODING_UTF8; + ctxt->charset = XML_CHAR_ENCODING_NONE; ctxt->catalogs = NULL; xmlInitNodeInfoSeq(&ctxt->node_seq); @@ -5871,6 +6684,22 @@ htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options) ctxt->options |= HTML_PARSE_COMPACT; options -= HTML_PARSE_COMPACT; } + if (options & XML_PARSE_HUGE) { + ctxt->options |= XML_PARSE_HUGE; + options -= XML_PARSE_HUGE; + } + if (options & HTML_PARSE_NODEFDTD) { + ctxt->options |= HTML_PARSE_NODEFDTD; + options -= HTML_PARSE_NODEFDTD; + } + if (options & HTML_PARSE_IGNORE_ENC) { + ctxt->options |= HTML_PARSE_IGNORE_ENC; + options -= HTML_PARSE_IGNORE_ENC; + } + if (options & HTML_PARSE_NOIMPLIED) { + ctxt->options |= HTML_PARSE_NOIMPLIED; + options -= HTML_PARSE_NOIMPLIED; + } ctxt->dictNames = 0; return (options); } @@ -5884,7 +6713,7 @@ htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options) * @reuse: keep the context for reuse * * Common front-end for the htmlRead functions - * + * * Returns the resulting document tree or NULL */ static htmlDocPtr @@ -5892,15 +6721,19 @@ htmlDoRead(htmlParserCtxtPtr ctxt, const char *URL, const char *encoding, int options, int reuse) { htmlDocPtr ret; - + htmlCtxtUseOptions(ctxt, options); ctxt->html = 1; if (encoding != NULL) { xmlCharEncodingHandlerPtr hdlr; hdlr = xmlFindCharEncodingHandler(encoding); - if (hdlr != NULL) + if (hdlr != NULL) { xmlSwitchToEncoding(ctxt, hdlr); + if (ctxt->input->encoding != NULL) + xmlFree((xmlChar *) ctxt->input->encoding); + ctxt->input->encoding = xmlStrdup((xmlChar *)encoding); + } } if ((URL != NULL) && (ctxt->input != NULL) && (ctxt->input->filename == NULL)) @@ -5926,7 +6759,7 @@ htmlDoRead(htmlParserCtxtPtr ctxt, const char *URL, const char *encoding, * @options: a combination of htmlParserOption(s) * * parse an XML in-memory document and build a tree. - * + * * Returns the resulting document tree */ htmlDocPtr @@ -5951,7 +6784,7 @@ htmlReadDoc(const xmlChar * cur, const char *URL, const char *encoding, int opti * @options: a combination of htmlParserOption(s) * * parse an XML file from the filesystem or the network. - * + * * Returns the resulting document tree */ htmlDocPtr @@ -5975,7 +6808,7 @@ htmlReadFile(const char *filename, const char *encoding, int options) * @options: a combination of htmlParserOption(s) * * parse an XML in-memory document and build a tree. - * + * * Returns the resulting document tree */ htmlDocPtr @@ -6001,7 +6834,7 @@ htmlReadMemory(const char *buffer, int size, const char *URL, const char *encodi * @options: a combination of htmlParserOption(s) * * parse an XML from a file descriptor and build a tree. - * + * * Returns the resulting document tree */ htmlDocPtr @@ -6013,6 +6846,7 @@ htmlReadFd(int fd, const char *URL, const char *encoding, int options) if (fd < 0) return (NULL); + xmlInitParser(); xmlInitParser(); input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); @@ -6043,7 +6877,7 @@ htmlReadFd(int fd, const char *URL, const char *encoding, int options) * @options: a combination of htmlParserOption(s) * * parse an HTML document from I/O functions and source and build a tree. - * + * * Returns the resulting document tree */ htmlDocPtr @@ -6060,8 +6894,11 @@ htmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, XML_CHAR_ENCODING_NONE); - if (input == NULL) + if (input == NULL) { + if (ioclose != NULL) + ioclose(ioctx); return (NULL); + } ctxt = htmlNewParserCtxt(); if (ctxt == NULL) { xmlFreeParserInputBuffer(input); @@ -6087,7 +6924,7 @@ htmlReadIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, * * parse an XML in-memory document and build a tree. * This reuses the existing @ctxt parser context - * + * * Returns the resulting document tree */ htmlDocPtr @@ -6100,6 +6937,7 @@ htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar * cur, return (NULL); if (ctxt == NULL) return (NULL); + xmlInitParser(); htmlCtxtReset(ctxt); @@ -6120,7 +6958,7 @@ htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar * cur, * * parse an XML file from the filesystem or the network. * This reuses the existing @ctxt parser context - * + * * Returns the resulting document tree */ htmlDocPtr @@ -6133,6 +6971,7 @@ htmlCtxtReadFile(htmlParserCtxtPtr ctxt, const char *filename, return (NULL); if (ctxt == NULL) return (NULL); + xmlInitParser(); htmlCtxtReset(ctxt); @@ -6155,7 +6994,7 @@ htmlCtxtReadFile(htmlParserCtxtPtr ctxt, const char *filename, * * parse an XML in-memory document and build a tree. * This reuses the existing @ctxt parser context - * + * * Returns the resulting document tree */ htmlDocPtr @@ -6169,6 +7008,7 @@ htmlCtxtReadMemory(htmlParserCtxtPtr ctxt, const char *buffer, int size, return (NULL); if (buffer == NULL) return (NULL); + xmlInitParser(); htmlCtxtReset(ctxt); @@ -6197,7 +7037,7 @@ htmlCtxtReadMemory(htmlParserCtxtPtr ctxt, const char *buffer, int size, * * parse an XML from a file descriptor and build a tree. * This reuses the existing @ctxt parser context - * + * * Returns the resulting document tree */ htmlDocPtr @@ -6211,6 +7051,7 @@ htmlCtxtReadFd(htmlParserCtxtPtr ctxt, int fd, return (NULL); if (ctxt == NULL) return (NULL); + xmlInitParser(); htmlCtxtReset(ctxt); @@ -6239,7 +7080,7 @@ htmlCtxtReadFd(htmlParserCtxtPtr ctxt, int fd, * * parse an HTML document from I/O functions and source and build a tree. * This reuses the existing @ctxt parser context - * + * * Returns the resulting document tree */ htmlDocPtr @@ -6255,13 +7096,17 @@ htmlCtxtReadIO(htmlParserCtxtPtr ctxt, xmlInputReadCallback ioread, return (NULL); if (ctxt == NULL) return (NULL); + xmlInitParser(); htmlCtxtReset(ctxt); input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, XML_CHAR_ENCODING_NONE); - if (input == NULL) + if (input == NULL) { + if (ioclose != NULL) + ioclose(ioctx); return (NULL); + } stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); if (stream == NULL) { xmlFreeParserInputBuffer(input); diff --git a/gnulib-local/lib/libxml/HTMLparser.in.h b/gnulib-local/lib/libxml/HTMLparser.in.h index 05905e4..551186c 100644 --- a/gnulib-local/lib/libxml/HTMLparser.in.h +++ b/gnulib-local/lib/libxml/HTMLparser.in.h @@ -83,87 +83,87 @@ struct _htmlEntityDesc { /* * There is only few public functions. */ -XMLPUBFUN const htmlElemDesc * XMLCALL +XMLPUBFUN const htmlElemDesc * XMLCALL htmlTagLookup (const xmlChar *tag); -XMLPUBFUN const htmlEntityDesc * XMLCALL +XMLPUBFUN const htmlEntityDesc * XMLCALL htmlEntityLookup(const xmlChar *name); -XMLPUBFUN const htmlEntityDesc * XMLCALL +XMLPUBFUN const htmlEntityDesc * XMLCALL htmlEntityValueLookup(unsigned int value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlIsAutoClosed(htmlDocPtr doc, htmlNodePtr elem); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlAutoCloseTag(htmlDocPtr doc, const xmlChar *name, htmlNodePtr elem); -XMLPUBFUN const htmlEntityDesc * XMLCALL +XMLPUBFUN const htmlEntityDesc * XMLCALL htmlParseEntityRef(htmlParserCtxtPtr ctxt, const xmlChar **str); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlParseCharRef(htmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlParseElement(htmlParserCtxtPtr ctxt); -XMLPUBFUN htmlParserCtxtPtr XMLCALL +XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlNewParserCtxt(void); -XMLPUBFUN htmlParserCtxtPtr XMLCALL +XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateMemoryParserCtxt(const char *buffer, int size); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlParseDocument(htmlParserCtxtPtr ctxt); -XMLPUBFUN htmlDocPtr XMLCALL +XMLPUBFUN htmlDocPtr XMLCALL htmlSAXParseDoc (xmlChar *cur, const char *encoding, htmlSAXHandlerPtr sax, void *userData); -XMLPUBFUN htmlDocPtr XMLCALL +XMLPUBFUN htmlDocPtr XMLCALL htmlParseDoc (xmlChar *cur, const char *encoding); -XMLPUBFUN htmlDocPtr XMLCALL +XMLPUBFUN htmlDocPtr XMLCALL htmlSAXParseFile(const char *filename, const char *encoding, htmlSAXHandlerPtr sax, void *userData); -XMLPUBFUN htmlDocPtr XMLCALL +XMLPUBFUN htmlDocPtr XMLCALL htmlParseFile (const char *filename, const char *encoding); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL UTF8ToHtml (unsigned char *out, int *outlen, const unsigned char *in, int *inlen); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlEncodeEntities(unsigned char *out, int *outlen, const unsigned char *in, int *inlen, int quoteChar); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlIsScriptAttribute(const xmlChar *name); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlHandleOmittedElem(int val); #ifdef LIBXML_PUSH_ENABLED /** * Interfaces for the Push mode. */ -XMLPUBFUN htmlParserCtxtPtr XMLCALL +XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data, const char *chunk, int size, const char *filename, xmlCharEncoding enc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlParseChunk (htmlParserCtxtPtr ctxt, const char *chunk, int size, int terminate); #endif /* LIBXML_PUSH_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); /* @@ -177,12 +177,15 @@ XMLPUBFUN void XMLCALL */ typedef enum { 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_NOWARNING= 1<<6, /* suppress warning reports */ HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ HTML_PARSE_NONET = 1<<11,/* Forbid network access */ - HTML_PARSE_COMPACT = 1<<16 /* compact small text nodes */ + HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */ + HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */ + HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */ } htmlParserOption; XMLPUBFUN void XMLCALL diff --git a/gnulib-local/lib/libxml/HTMLtree.c b/gnulib-local/lib/libxml/HTMLtree.c index c1e5a0a..2fd0c9c 100644 --- a/gnulib-local/lib/libxml/HTMLtree.c +++ b/gnulib-local/lib/libxml/HTMLtree.c @@ -30,16 +30,18 @@ #include #include +#include "buf.h" + /************************************************************************ * * - * Getting/Setting encoding meta tags * + * Getting/Setting encoding meta tags * * * ************************************************************************/ /** * htmlGetMetaEncoding: * @doc: the document - * + * * Encoding definition lookup in the Meta tags * * Returns the current encoding as flagged in the HTML source @@ -126,17 +128,17 @@ found_meta: found_content: encoding = xmlStrstr(content, BAD_CAST"charset="); - if (encoding == NULL) + if (encoding == NULL) encoding = xmlStrstr(content, BAD_CAST"Charset="); - if (encoding == NULL) + if (encoding == NULL) encoding = xmlStrstr(content, BAD_CAST"CHARSET="); if (encoding != NULL) { encoding += 8; } else { encoding = xmlStrstr(content, BAD_CAST"charset ="); - if (encoding == NULL) + if (encoding == NULL) encoding = xmlStrstr(content, BAD_CAST"Charset ="); - if (encoding == NULL) + if (encoding == NULL) encoding = xmlStrstr(content, BAD_CAST"CHARSET ="); if (encoding != NULL) encoding += 9; @@ -151,7 +153,7 @@ found_content: * htmlSetMetaEncoding: * @doc: the document * @encoding: the encoding string - * + * * Sets the current encoding in the Meta tags * NOTE: this will not change the document content encoding, just * the META flag associated. @@ -160,14 +162,19 @@ found_content: */ int htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) { - htmlNodePtr cur, meta; - const xmlChar *content; + htmlNodePtr cur, meta = NULL, head = NULL; + const xmlChar *content = NULL; char newcontent[100]; + newcontent[0] = 0; if (doc == NULL) return(-1); + /* html isn't a real encoding it's just libxml2 way to get entities */ + if (!xmlStrcasecmp(encoding, BAD_CAST "html")) + return(-1); + if (encoding != NULL) { snprintf(newcontent, sizeof(newcontent), "text/html; charset=%s", (char *)encoding); @@ -201,39 +208,24 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) { if ((cur->type == XML_ELEMENT_NODE) && (cur->name != NULL)) { if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0) break; - if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) + if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) { + head = cur->parent; goto found_meta; + } } cur = cur->next; } if (cur == NULL) return(-1); found_head: - if (cur->children == NULL) { - if (encoding == NULL) - return(0); - meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL); - xmlAddChild(cur, meta); - xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type"); - xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent); - return(0); - } + head = cur; + if (cur->children == NULL) + goto create; cur = cur->children; found_meta: - if (encoding != NULL) { - /* - * Create a new Meta element with the right attributes - */ - - meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL); - xmlAddPrevSibling(cur, meta); - xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type"); - xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent); - } - /* - * Search and destroy all the remaining the meta elements carrying + * Search and update all the remaining the meta elements carrying * encoding informations */ while (cur != NULL) { @@ -253,11 +245,11 @@ found_meta: if ((!xmlStrcasecmp(attr->name, BAD_CAST"http-equiv")) && (!xmlStrcasecmp(value, BAD_CAST"Content-Type"))) http = 1; - else + else { - if ((value != NULL) && - (!xmlStrcasecmp(attr->name, BAD_CAST"content"))) - content = value; + if ((value != NULL) && + (!xmlStrcasecmp(attr->name, BAD_CAST"content"))) + content = value; } if ((http != 0) && (content != NULL)) break; @@ -266,16 +258,41 @@ found_meta: } if ((http != 0) && (content != NULL)) { meta = cur; - cur = cur->next; - xmlUnlinkNode(meta); - xmlFreeNode(meta); - continue; + break; } } } cur = cur->next; } +create: + if (meta == NULL) { + if ((encoding != NULL) && (head != NULL)) { + /* + * Create a new Meta element with the right attributes + */ + + meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL); + if (head->children == NULL) + xmlAddChild(head, meta); + else + xmlAddPrevSibling(head->children, meta); + xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type"); + xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent); + } + } else { + /* remove the meta tag if NULL is passed */ + if (encoding == NULL) { + xmlUnlinkNode(meta); + xmlFreeNode(meta); + } + /* change the document only if there is a real encoding change */ + else if (xmlStrcasestr(content, encoding) == NULL) { + xmlSetProp(meta, BAD_CAST"content", BAD_CAST newcontent); + } + } + + return(0); } @@ -299,7 +316,7 @@ static const char* htmlBooleanAttrs[] = { * @name: the name of the attribute to check * * Determine if a given attribute is a boolean attribute. - * + * * returns: false if the attribute is not boolean, true otherwise. */ int @@ -316,9 +333,14 @@ htmlIsBooleanAttr(const xmlChar *name) } #ifdef LIBXML_OUTPUT_ENABLED +/* + * private routine exported from xmlIO.c + */ +xmlOutputBufferPtr +xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder); /************************************************************************ * * - * Output error handlers * + * Output error handlers * * * ************************************************************************/ /** @@ -367,17 +389,13 @@ htmlSaveErr(int code, xmlNodePtr node, const char *extra) /************************************************************************ * * - * Dumping HTML tree content to a simple buffer * + * Dumping HTML tree content to a simple buffer * * * ************************************************************************/ -static int -htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, - int format); - /** - * htmlNodeDumpFormat: - * @buf: the HTML buffer output + * htmlBufNodeDumpFormat: + * @buf: the xmlBufPtr output * @doc: the document * @cur: the current node * @format: should formatting spaces been added @@ -386,10 +404,10 @@ htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, * * Returns the number of byte written or -1 in case of error */ -static int -htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, +static size_t +htmlBufNodeDumpFormat(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int format) { - unsigned int use; + size_t use; int ret; xmlOutputBufferPtr outbuf; @@ -412,10 +430,10 @@ htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, outbuf->context = NULL; outbuf->written = 0; - use = buf->use; + use = xmlBufUse(buf); htmlNodeDumpFormatOutput(outbuf, doc, cur, NULL, format); xmlFree(outbuf); - ret = buf->use - use; + ret = xmlBufUse(buf) - use; return (ret); } @@ -432,9 +450,24 @@ htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, */ int htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) { + xmlBufPtr buffer; + size_t ret; + + if ((buf == NULL) || (cur == NULL)) + return(-1); + xmlInitParser(); + buffer = xmlBufFromBuffer(buf); + if (buffer == NULL) + return(-1); + + ret = htmlBufNodeDumpFormat(buffer, doc, cur, 1); - return(htmlNodeDumpFormat(buf, doc, cur, 1)); + xmlBufBackToBuffer(buffer); + + if (ret > INT_MAX) + return(-1); + return((int) ret); } /** @@ -467,7 +500,7 @@ htmlNodeDumpFileFormat(FILE *out, xmlDocPtr doc, if (enc != XML_CHAR_ENCODING_UTF8) { handler = xmlFindCharEncodingHandler(encoding); if (handler == NULL) - return(-1); + htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding); } } @@ -479,7 +512,7 @@ htmlNodeDumpFileFormat(FILE *out, xmlDocPtr doc, if (handler == NULL) handler = xmlFindCharEncodingHandler("ascii"); - /* + /* * save the content to a temp buffer. */ buf = xmlOutputBufferCreateFile(out, handler); @@ -548,11 +581,9 @@ htmlDocDumpMemoryFormat(xmlDocPtr cur, xmlChar**mem, int *size, int format) { } handler = xmlFindCharEncodingHandler(encoding); - if (handler == NULL) { - *mem = NULL; - *size = 0; - return; - } + if (handler == NULL) + htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding); + } else { handler = xmlFindCharEncodingHandler(encoding); } @@ -566,22 +597,22 @@ htmlDocDumpMemoryFormat(xmlDocPtr cur, xmlChar**mem, int *size, int format) { if (handler == NULL) handler = xmlFindCharEncodingHandler("ascii"); - buf = xmlAllocOutputBuffer(handler); + buf = xmlAllocOutputBufferInternal(handler); if (buf == NULL) { *mem = NULL; *size = 0; return; } - htmlDocContentDumpFormatOutput(buf, cur, NULL, format); + htmlDocContentDumpFormatOutput(buf, cur, NULL, format); xmlOutputBufferFlush(buf); if (buf->conv != NULL) { - *size = buf->conv->use; - *mem = xmlStrndup(buf->conv->content, *size); + *size = xmlBufUse(buf->conv); + *mem = xmlStrndup(xmlBufContent(buf->conv), *size); } else { - *size = buf->buffer->use; - *mem = xmlStrndup(buf->buffer->content, *size); + *size = xmlBufUse(buf->buffer); + *mem = xmlStrndup(xmlBufContent(buf->buffer), *size); } (void)xmlOutputBufferClose(buf); } @@ -603,7 +634,7 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) { /************************************************************************ * * - * Dumping HTML tree content to an I/O output buffer * + * Dumping HTML tree content to an I/O output buffer * * * ************************************************************************/ @@ -614,7 +645,7 @@ void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur); * @buf: the HTML buffer output * @doc: the document * @encoding: the encoding string - * + * * TODO: check whether encoding is needed * * Dump the HTML document DTD, if any. @@ -632,14 +663,15 @@ htmlDtdDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlOutputBufferWriteString(buf, (const char *)cur->name); if (cur->ExternalID != NULL) { xmlOutputBufferWriteString(buf, " PUBLIC "); - xmlBufferWriteQuotedString(buf->buffer, cur->ExternalID); + xmlBufWriteQuotedString(buf->buffer, cur->ExternalID); if (cur->SystemID != NULL) { xmlOutputBufferWriteString(buf, " "); - xmlBufferWriteQuotedString(buf->buffer, cur->SystemID); - } - } else if (cur->SystemID != NULL) { + xmlBufWriteQuotedString(buf->buffer, cur->SystemID); + } + } else if (cur->SystemID != NULL && + xmlStrcmp(cur->SystemID, BAD_CAST "about:legacy-compat")) { xmlOutputBufferWriteString(buf, " SYSTEM "); - xmlBufferWriteQuotedString(buf->buffer, cur->SystemID); + xmlBufWriteQuotedString(buf->buffer, cur->SystemID); } xmlOutputBufferWriteString(buf, ">\n"); } @@ -659,9 +691,10 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, xmlChar *value; /* - * TODO: The html output method should not escape a & character - * occurring in an attribute value immediately followed by - * a { character (see Section B.7.1 of the HTML 4.0 Recommendation). + * The html output method should not escape a & character + * occurring in an attribute value immediately followed by + * a { character (see Section B.7.1 of the HTML 4.0 Recommendation). + * This is implemented in xmlEncodeEntitiesReentrant */ if (cur == NULL) { @@ -684,20 +717,51 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur, (!xmlStrcasecmp(cur->name, BAD_CAST "src")) || ((!xmlStrcasecmp(cur->name, BAD_CAST "name")) && (!xmlStrcasecmp(cur->parent->name, BAD_CAST "a"))))) { - xmlChar *escaped; xmlChar *tmp = value; + /* xmlURIEscapeStr() escapes '"' so it can be safely used. */ + xmlBufCCat(buf->buffer, "\""); while (IS_BLANK_CH(*tmp)) tmp++; - escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+"); - if (escaped != NULL) { - xmlBufferWriteQuotedString(buf->buffer, escaped); - xmlFree(escaped); - } else { - xmlBufferWriteQuotedString(buf->buffer, value); + /* URI Escape everything, except server side includes. */ + for ( ; ; ) { + xmlChar *escaped; + xmlChar endChar; + xmlChar *end = NULL; + xmlChar *start = (xmlChar *)xmlStrstr(tmp, BAD_CAST ""); + if (end != NULL) { + *start = '\0'; + } + } + + /* Escape the whole string, or until start (set to '\0'). */ + escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+"); + if (escaped != NULL) { + xmlBufCat(buf->buffer, escaped); + xmlFree(escaped); + } else { + xmlBufCat(buf->buffer, tmp); + } + + if (end == NULL) { /* Everything has been written. */ + break; + } + + /* Do not escape anything within server side includes. */ + *start = '<'; /* Restore the first character of "") */ + endChar = *end; + *end = '\0'; + xmlBufCat(buf->buffer, start); + *end = endChar; + tmp = end; } + + xmlBufCCat(buf->buffer, "\""); } else { - xmlBufferWriteQuotedString(buf->buffer, value); + xmlBufWriteQuotedString(buf->buffer, value); } xmlFree(value); } else { @@ -780,6 +844,10 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, htmlDocContentDumpOutput(buf, (xmlDocPtr) cur, encoding); return; } + if (cur->type == XML_ATTRIBUTE_NODE) { + htmlAttrDumpOutput(buf, doc, (xmlAttrPtr) cur, encoding); + return; + } if (cur->type == HTML_TEXT_NODE) { if (cur->content != NULL) { if (((cur->name == (const xmlChar *)xmlStringText) || @@ -1043,7 +1111,7 @@ htmlDocDump(FILE *f, xmlDocPtr cur) { handler = xmlFindCharEncodingHandler(encoding); if (handler == NULL) - return(-1); + htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding); } else { handler = xmlFindCharEncodingHandler(encoding); } @@ -1083,7 +1151,7 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) { if ((cur == NULL) || (filename == NULL)) return(-1); - + xmlInitParser(); encoding = (const char *) htmlGetMetaEncoding(cur); @@ -1102,7 +1170,7 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) { handler = xmlFindCharEncodingHandler(encoding); if (handler == NULL) - return(-1); + htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding); } } @@ -1114,7 +1182,7 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) { if (handler == NULL) handler = xmlFindCharEncodingHandler("ascii"); - /* + /* * save the content to a temp buffer. */ buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression); @@ -1134,7 +1202,7 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) { * @encoding: the document encoding * * Dump an HTML document to a file using a given encoding. - * + * * returns: the number of byte written or -1 in case of failure. */ int @@ -1146,7 +1214,7 @@ htmlSaveFileFormat(const char *filename, xmlDocPtr cur, if ((cur == NULL) || (filename == NULL)) return(-1); - + xmlInitParser(); if (encoding != NULL) { @@ -1163,9 +1231,9 @@ htmlSaveFileFormat(const char *filename, xmlDocPtr cur, handler = xmlFindCharEncodingHandler(encoding); if (handler == NULL) - return(-1); - htmlSetMetaEncoding(cur, (const xmlChar *) encoding); + htmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding); } + htmlSetMetaEncoding(cur, (const xmlChar *) encoding); } else { htmlSetMetaEncoding(cur, (const xmlChar *) "UTF-8"); } @@ -1178,7 +1246,7 @@ htmlSaveFileFormat(const char *filename, xmlDocPtr cur, if (handler == NULL) handler = xmlFindCharEncodingHandler("ascii"); - /* + /* * save the content to a temp buffer. */ buf = xmlOutputBufferCreateFilename(filename, handler, 0); @@ -1198,7 +1266,7 @@ htmlSaveFileFormat(const char *filename, xmlDocPtr cur, * * Dump an HTML document to a file using a given encoding * and formatting returns/spaces are added. - * + * * returns: the number of byte written or -1 in case of failure. */ int diff --git a/gnulib-local/lib/libxml/HTMLtree.in.h b/gnulib-local/lib/libxml/HTMLtree.in.h index 6ea8207..c0e1103 100644 --- a/gnulib-local/lib/libxml/HTMLtree.in.h +++ b/gnulib-local/lib/libxml/HTMLtree.in.h @@ -62,78 +62,78 @@ extern "C" { XMLPUBFUN htmlDocPtr XMLCALL htmlNewDoc (const xmlChar *URI, const xmlChar *ExternalID); -XMLPUBFUN htmlDocPtr XMLCALL +XMLPUBFUN htmlDocPtr XMLCALL htmlNewDocNoDtD (const xmlChar *URI, const xmlChar *ExternalID); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL htmlGetMetaEncoding (htmlDocPtr doc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlSetMetaEncoding (htmlDocPtr doc, const xmlChar *encoding); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlDocDumpMemory (xmlDocPtr cur, xmlChar **mem, int *size); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlDocDumpMemoryFormat (xmlDocPtr cur, xmlChar **mem, int *size, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlDocDump (FILE *f, xmlDocPtr cur); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlSaveFile (const char *filename, xmlDocPtr cur); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlNodeDump (xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlNodeDumpFile (FILE *out, xmlDocPtr doc, xmlNodePtr cur); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlNodeDumpFileFormat (FILE *out, xmlDocPtr doc, xmlNodePtr cur, const char *encoding, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlSaveFileEnc (const char *filename, xmlDocPtr cur, const char *encoding); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlSaveFileFormat (const char *filename, xmlDocPtr cur, const char *encoding, int format); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, const char *encoding, int format); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlDocContentDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding, int format); -XMLPUBFUN void XMLCALL - htmlNodeDumpOutput (xmlOutputBufferPtr buf, +XMLPUBFUN void XMLCALL + htmlNodeDumpOutput (xmlOutputBufferPtr buf, xmlDocPtr doc, - xmlNodePtr cur, + xmlNodePtr cur, const char *encoding); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL htmlIsBooleanAttr (const xmlChar *name); diff --git a/gnulib-local/lib/libxml/README b/gnulib-local/lib/libxml/README index dfcc32f..749e671 100644 --- a/gnulib-local/lib/libxml/README +++ b/gnulib-local/lib/libxml/README @@ -1 +1,39 @@ -This is not part of the GNU gettext program, but is used with GNU gettext. + + XML toolkit from the GNOME project + +Full documentation is available on-line at + http://xmlsoft.org/ + +This code is released under the MIT Licence see the Copyright file. + +To build on an Unixised setup: + ./configure ; make ; make install +To build on Windows: + see instructions on win32/Readme.txt + +To assert build quality: + on an Unixised setup: + run make tests + otherwise: + There is 3 standalone tools runtest.c runsuite.c testapi.c, which + should compile as part of the build or as any application would. + Launch them from this directory to get results, runtest checks + the proper functionning of libxml2 main APIs while testapi does + a full coverage check. Report failures to the list. + +To report bugs, follow the instructions at: + http://xmlsoft.org/bugs.html + +A mailing-list xml@gnome.org is available, to subscribe: + http://mail.gnome.org/mailman/listinfo/xml + +The list archive is at: + http://mail.gnome.org/archives/xml/ + +All technical answers asked privately will be automatically answered on +the list and archived for public access unless privacy is explicitly +required and justified. + +Daniel Veillard + +$Id$ diff --git a/gnulib-local/lib/libxml/SAX.c b/gnulib-local/lib/libxml/SAX.c index 8e5d460..292af57 100644 --- a/gnulib-local/lib/libxml/SAX.c +++ b/gnulib-local/lib/libxml/SAX.c @@ -41,7 +41,7 @@ void initxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning) { - + if(hdlr->initialized == 1) return; diff --git a/gnulib-local/lib/libxml/SAX.in.h b/gnulib-local/lib/libxml/SAX.in.h index 0ca161b..20093ce 100644 --- a/gnulib-local/lib/libxml/SAX.in.h +++ b/gnulib-local/lib/libxml/SAX.in.h @@ -25,53 +25,53 @@ extern "C" { #endif XMLPUBFUN const xmlChar * XMLCALL getPublicId (void *ctx); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL getSystemId (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL setDocumentLocator (void *ctx, xmlSAXLocatorPtr loc); - -XMLPUBFUN int XMLCALL + +XMLPUBFUN int XMLCALL getLineNumber (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL getColumnNumber (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL isStandalone (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL hasInternalSubset (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL hasExternalSubset (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL internalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL externalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL getEntity (void *ctx, const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL getParameterEntity (void *ctx, const xmlChar *name); -XMLPUBFUN xmlParserInputPtr XMLCALL +XMLPUBFUN xmlParserInputPtr XMLCALL resolveEntity (void *ctx, const xmlChar *publicId, const xmlChar *systemId); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL entityDecl (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL attributeDecl (void *ctx, const xmlChar *elem, const xmlChar *fullname, @@ -79,87 +79,87 @@ XMLPUBFUN void XMLCALL int def, const xmlChar *defaultValue, xmlEnumerationPtr tree); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL elementDecl (void *ctx, const xmlChar *name, int type, xmlElementContentPtr content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL notationDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL unparsedEntityDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL startDocument (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL endDocument (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL attribute (void *ctx, const xmlChar *fullname, const xmlChar *value); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL startElement (void *ctx, const xmlChar *fullname, const xmlChar **atts); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL endElement (void *ctx, const xmlChar *name); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL reference (void *ctx, const xmlChar *name); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL characters (void *ctx, const xmlChar *ch, int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL ignorableWhitespace (void *ctx, const xmlChar *ch, int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL processingInstruction (void *ctx, const xmlChar *target, const xmlChar *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL globalNamespace (void *ctx, const xmlChar *href, const xmlChar *prefix); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL setNamespace (void *ctx, const xmlChar *name); -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL getNamespace (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL checkNamespace (void *ctx, xmlChar *nameSpace); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL namespaceDecl (void *ctx, const xmlChar *href, const xmlChar *prefix); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL comment (void *ctx, const xmlChar *value); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL cdataBlock (void *ctx, const xmlChar *value, int len); #ifdef LIBXML_SAX1_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr, int warning); #ifdef LIBXML_HTML_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); #endif #ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); #endif #endif /* LIBXML_SAX1_ENABLED */ diff --git a/gnulib-local/lib/libxml/SAX2.c b/gnulib-local/lib/libxml/SAX2.c index 7d4ab64..ffef3e1 100644 --- a/gnulib-local/lib/libxml/SAX2.c +++ b/gnulib-local/lib/libxml/SAX2.c @@ -11,6 +11,7 @@ #include "libxml.h" #include #include +#include #include #include #include @@ -26,6 +27,11 @@ #include #include +/* Define SIZE_T_MAX unless defined through . */ +#ifndef SIZE_T_MAX +# define SIZE_T_MAX ((size_t)-1) +#endif /* !SIZE_T_MAX */ + /* #define DEBUG_SAX2 */ /* #define DEBUG_SAX2_TREE */ @@ -39,7 +45,7 @@ *> values "system" and "public". I have made the default be "system" to *> match yours. */ -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); @@ -51,12 +57,29 @@ */ static void xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt, const char *msg) { + xmlStructuredErrorFunc schannel = NULL; + const char *str1 = "out of memory\n"; + if (ctxt != NULL) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "%s: out of memory\n", msg); + ctxt->errNo = XML_ERR_NO_MEMORY; + if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) + schannel = ctxt->sax->serror; + __xmlRaiseError(schannel, + ctxt->vctxt.error, ctxt->vctxt.userData, + ctxt, NULL, XML_FROM_PARSER, XML_ERR_NO_MEMORY, + XML_ERR_ERROR, NULL, 0, (const char *) str1, + NULL, NULL, 0, 0, + msg, (const char *) str1, NULL); ctxt->errNo = XML_ERR_NO_MEMORY; ctxt->instate = XML_PARSER_EOF; ctxt->disableSAX = 1; + } else { + __xmlRaiseError(schannel, + NULL, NULL, + ctxt, NULL, XML_FROM_PARSER, XML_ERR_NO_MEMORY, + XML_ERR_ERROR, NULL, 0, (const char *) str1, + NULL, NULL, 0, 0, + msg, (const char *) str1, NULL); } } @@ -120,7 +143,7 @@ xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, if (ctxt != NULL) ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, - XML_ERR_FATAL, NULL, 0, + XML_ERR_FATAL, NULL, 0, (const char *) str1, (const char *) str2, NULL, 0, 0, msg, str1, str2); if (ctxt != NULL) { @@ -151,7 +174,7 @@ xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, if (ctxt != NULL) ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, - XML_ERR_WARNING, NULL, 0, + XML_ERR_WARNING, NULL, 0, (const char *) str1, NULL, NULL, 0, 0, msg, str1); } @@ -176,7 +199,7 @@ xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, if (ctxt != NULL) ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, - XML_ERR_ERROR, NULL, 0, + XML_ERR_ERROR, NULL, 0, (const char *) str1, (const char *) str2, NULL, 0, 0, msg, str1, str2); } @@ -200,7 +223,7 @@ xmlNsWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, if (ctxt != NULL) ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, - XML_ERR_WARNING, NULL, 0, + XML_ERR_WARNING, NULL, 0, (const char *) str1, (const char *) str2, NULL, 0, 0, msg, str1, str2); } @@ -234,7 +257,7 @@ xmlSAX2GetSystemId(void *ctx) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; if ((ctx == NULL) || (ctxt->input == NULL)) return(NULL); - return((const xmlChar *) ctxt->input->filename); + return((const xmlChar *) ctxt->input->filename); } /** @@ -349,7 +372,7 @@ xmlSAX2InternalSubset(void *ctx, const xmlChar *name, xmlFreeDtd(dtd); ctxt->myDoc->intSubset = NULL; } - ctxt->myDoc->intSubset = + ctxt->myDoc->intSubset = xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID); if (ctxt->myDoc->intSubset == NULL) xmlSAX2ErrMemory(ctxt, "xmlSAX2InternalSubset"); @@ -388,6 +411,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, xmlParserInputPtr input = NULL; xmlCharEncoding enc; int oldcharset; + const xmlChar *oldencoding; /* * Ask the Entity resolver to load the damn thing @@ -409,6 +433,8 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, oldinputMax = ctxt->inputMax; oldinputTab = ctxt->inputTab; oldcharset = ctxt->charset; + oldencoding = ctxt->encoding; + ctxt->encoding = NULL; ctxt->inputTab = (xmlParserInputPtr *) xmlMalloc(5 * sizeof(xmlParserInputPtr)); @@ -419,6 +445,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, ctxt->inputMax = oldinputMax; ctxt->inputTab = oldinputTab; ctxt->charset = oldcharset; + ctxt->encoding = oldencoding; return; } ctxt->inputNr = 0; @@ -464,6 +491,11 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, ctxt->inputMax = oldinputMax; ctxt->inputTab = oldinputTab; ctxt->charset = oldcharset; + if ((ctxt->encoding != NULL) && + ((ctxt->dict == NULL) || + (!xmlDictOwns(ctxt->dict, ctxt->encoding)))) + xmlFree((xmlChar *) ctxt->encoding); + ctxt->encoding = oldencoding; /* ctxt->wellFormed = oldwellFormed; */ } } @@ -568,6 +600,7 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name) * parse the external entity */ xmlNodePtr children; + unsigned long oldnbent = ctxt->nbentities; val = xmlParseCtxtExternalEntity(ctxt, ret->URI, ret->ExternalID, &children); @@ -580,7 +613,11 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name) return(NULL); } ret->owner = 1; - ret->checked = 1; + if (ret->checked == 0) { + ret->checked = (ctxt->nbentities - oldnbent + 1) * 2; + if ((ret->content != NULL) && (xmlStrchr(ret->content, '<'))) + ret->checked |= 1; + } } return(ret); } @@ -614,8 +651,8 @@ xmlSAX2GetParameterEntity(void *ctx, const xmlChar *name) /** * xmlSAX2EntityDecl: * @ctx: the user data (XML parser context) - * @name: the entity name - * @type: the entity type + * @name: the entity name + * @type: the entity type * @publicId: The public ID of the entity * @systemId: The system ID of the entity * @content: the entity value (without processing). @@ -650,7 +687,7 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, base = ctxt->input->filename; if (base == NULL) base = ctxt->directory; - + URI = xmlBuildURI(systemId, (const xmlChar *) base); ent->URI = URI; } @@ -659,7 +696,7 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, systemId, content); if ((ent == NULL) && (ctxt->pedantic) && (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) - ctxt->sax->warning(ctxt->userData, + ctxt->sax->warning(ctxt->userData, "Entity(%s) already defined in the external subset\n", name); if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) { xmlChar *URI; @@ -669,7 +706,7 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, base = ctxt->input->filename; if (base == NULL) base = ctxt->directory; - + URI = xmlBuildURI(systemId, (const xmlChar *) base); ent->URI = URI; } @@ -684,8 +721,8 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, * xmlSAX2AttributeDecl: * @ctx: the user data (XML parser context) * @elem: the name of the element - * @fullname: the attribute name - * @type: the attribute type + * @fullname: the attribute name + * @type: the attribute type * @def: the type of default value * @defaultValue: the attribute default value * @tree: the tree of enumerated value set @@ -728,7 +765,7 @@ xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname, (xmlAttributeDefault) def, defaultValue, tree); else if (ctxt->inSubset == 2) attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, elem, - name, prefix, (xmlAttributeType) type, + name, prefix, (xmlAttributeType) type, (xmlAttributeDefault) def, defaultValue, tree); else { xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, @@ -754,8 +791,8 @@ xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname, /** * xmlSAX2ElementDecl: * @ctx: the user data (XML parser context) - * @name: the element name - * @type: the element type + * @name: the element name + * @type: the element type * @content: the element value tree * * An element definition has been parsed @@ -876,7 +913,7 @@ xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name, publicId, systemId, notationName); if ((ent == NULL) && (ctxt->pedantic) && (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) - ctxt->sax->warning(ctxt->userData, + ctxt->sax->warning(ctxt->userData, "Entity(%s) already defined in the internal subset\n", name); if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) { xmlChar *URI; @@ -886,7 +923,7 @@ xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name, base = ctxt->input->filename; if (base == NULL) base = ctxt->directory; - + URI = xmlBuildURI(systemId, (const xmlChar *) base); ent->URI = URI; } @@ -896,7 +933,7 @@ xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name, publicId, systemId, notationName); if ((ent == NULL) && (ctxt->pedantic) && (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) - ctxt->sax->warning(ctxt->userData, + ctxt->sax->warning(ctxt->userData, "Entity(%s) already defined in the external subset\n", name); if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) { xmlChar *URI; @@ -906,7 +943,7 @@ xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name, base = ctxt->input->filename; if (base == NULL) base = ctxt->directory; - + URI = xmlBuildURI(systemId, (const xmlChar *) base); ent->URI = URI; } @@ -961,6 +998,8 @@ xmlSAX2StartDocument(void *ctx) xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); return; } + ctxt->myDoc->properties = XML_DOC_HTML; + ctxt->myDoc->parseFlags = ctxt->options; #else xmlGenericError(xmlGenericErrorContext, "libxml2 built without HTML support\n"); @@ -972,6 +1011,10 @@ xmlSAX2StartDocument(void *ctx) } else { doc = ctxt->myDoc = xmlNewDoc(ctxt->version); if (doc != NULL) { + doc->properties = 0; + if (ctxt->options & XML_PARSE_OLD10) + doc->properties |= XML_DOC_OLD10; + doc->parseFlags = ctxt->options; if (ctxt->encoding != NULL) doc->encoding = xmlStrdup(ctxt->encoding); else @@ -1035,7 +1078,7 @@ xmlSAX2EndDocument(void *ctx) } } -#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) +#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) /** * xmlSAX2AttributeInternal: * @ctx: the user data (XML parser context) @@ -1059,25 +1102,31 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, xmlChar *nval; xmlNsPtr namespace; - /* - * Split the full name into a namespace prefix and the tag name - */ - name = xmlSplitQName(ctxt, fullname, &ns); - if ((name != NULL) && (name[0] == 0)) { - if (xmlStrEqual(ns, BAD_CAST "xmlns")) { - xmlNsErrMsg(ctxt, XML_ERR_NS_DECL_ERROR, - "invalid namespace declaration '%s'\n", - fullname, NULL); - } else { - xmlNsWarnMsg(ctxt, XML_WAR_NS_COLUMN, - "Avoid attribute ending with ':' like '%s'\n", - fullname, NULL); - } - if (ns != NULL) - xmlFree(ns); - ns = NULL; - xmlFree(name); + if (ctxt->html) { name = xmlStrdup(fullname); + ns = NULL; + namespace = NULL; + } else { + /* + * Split the full name into a namespace prefix and the tag name + */ + name = xmlSplitQName(ctxt, fullname, &ns); + if ((name != NULL) && (name[0] == 0)) { + if (xmlStrEqual(ns, BAD_CAST "xmlns")) { + xmlNsErrMsg(ctxt, XML_ERR_NS_DECL_ERROR, + "invalid namespace declaration '%s'\n", + fullname, NULL); + } else { + xmlNsWarnMsg(ctxt, XML_WAR_NS_COLUMN, + "Avoid attribute ending with ':' like '%s'\n", + fullname, NULL); + } + if (ns != NULL) + xmlFree(ns); + ns = NULL; + xmlFree(name); + name = xmlStrdup(fullname); + } } if (name == NULL) { xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); @@ -1086,24 +1135,33 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, return; } +#ifdef LIBXML_HTML_ENABLED + if ((ctxt->html) && + (value == NULL) && (htmlIsBooleanAttr(fullname))) { + nval = xmlStrdup(fullname); + value = (const xmlChar *) nval; + } else +#endif + { #ifdef LIBXML_VALID_ENABLED - /* - * Do the last stage of the attribute normalization - * Needed for HTML too: - * http://www.w3.org/TR/html4/types.html#h-6.2 - */ - ctxt->vctxt.valid = 1; - nval = xmlValidCtxtNormalizeAttributeValue(&ctxt->vctxt, - ctxt->myDoc, ctxt->node, - fullname, value); - if (ctxt->vctxt.valid != 1) { - ctxt->valid = 0; - } - if (nval != NULL) - value = nval; + /* + * Do the last stage of the attribute normalization + * Needed for HTML too: + * http://www.w3.org/TR/html4/types.html#h-6.2 + */ + ctxt->vctxt.valid = 1; + nval = xmlValidCtxtNormalizeAttributeValue(&ctxt->vctxt, + ctxt->myDoc, ctxt->node, + fullname, value); + if (ctxt->vctxt.valid != 1) { + ctxt->valid = 0; + } + if (nval != NULL) + value = nval; #else - nval = NULL; + nval = NULL; #endif /* LIBXML_VALID_ENABLED */ + } /* * Check whether it's a namespace definition @@ -1119,6 +1177,12 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF, 0,0,0); ctxt->depth--; + if (val == NULL) { + xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); + if (name != NULL) + xmlFree(name); + return; + } } else { val = (xmlChar *) value; } @@ -1129,12 +1193,12 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, uri = xmlParseURI((const char *)val); if (uri == NULL) { if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) - ctxt->sax->warning(ctxt->userData, + ctxt->sax->warning(ctxt->userData, "xmlns: %s not a valid URI\n", val); } else { if (uri->scheme == NULL) { if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) - ctxt->sax->warning(ctxt->userData, + ctxt->sax->warning(ctxt->userData, "xmlns: URI %s is not absolute\n", val); } xmlFreeURI(uri); @@ -1154,7 +1218,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc, ctxt->node, prefix, nsret, val); #endif /* LIBXML_VALID_ENABLED */ - if (name != NULL) + if (name != NULL) xmlFree(name); if (nval != NULL) xmlFree(nval); @@ -1176,7 +1240,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, if (val == NULL) { xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); xmlFree(ns); - if (name != NULL) + if (name != NULL) xmlFree(name); return; } @@ -1217,7 +1281,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc, ctxt->node, prefix, nsret, value); #endif /* LIBXML_VALID_ENABLED */ - if (name != NULL) + if (name != NULL) xmlFree(name); if (nval != NULL) xmlFree(nval); @@ -1227,30 +1291,32 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, } if (ns != NULL) { - xmlAttrPtr prop; namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, ns); + if (namespace == NULL) { xmlNsErrMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, "Namespace prefix %s of attribute %s is not defined\n", ns, name); - } - - prop = ctxt->node->properties; - while (prop != NULL) { - if (prop->ns != NULL) { - if ((xmlStrEqual(name, prop->name)) && - ((namespace == prop->ns) || - (xmlStrEqual(namespace->href, prop->ns->href)))) { - xmlNsErrMsg(ctxt, XML_ERR_ATTRIBUTE_REDEFINED, - "Attribute %s in %s redefined\n", - name, namespace->href); - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) ctxt->disableSAX = 1; - goto error; - } - } - prop = prop->next; - } + } else { + xmlAttrPtr prop; + + prop = ctxt->node->properties; + while (prop != NULL) { + if (prop->ns != NULL) { + if ((xmlStrEqual(name, prop->name)) && + ((namespace == prop->ns) || + (xmlStrEqual(namespace->href, prop->ns->href)))) { + xmlNsErrMsg(ctxt, XML_ERR_ATTRIBUTE_REDEFINED, + "Attribute %s in %s redefined\n", + name, namespace->href); + ctxt->wellFormed = 0; + if (ctxt->recovery == 0) ctxt->disableSAX = 1; + goto error; + } + } + prop = prop->next; + } + } } else { namespace = NULL; } @@ -1281,7 +1347,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, #ifdef LIBXML_VALID_ENABLED if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed && ctxt->myDoc && ctxt->myDoc->intSubset) { - + /* * If we don't substitute entities, the validation should be * done on a value with replaced entities anyway. @@ -1293,7 +1359,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF, 0,0,0); ctxt->depth--; - + if (val == NULL) ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, ctxt->myDoc, ctxt->node, ret, value); @@ -1350,7 +1416,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname, error: if (nval != NULL) xmlFree(nval); - if (ns != NULL) + if (ns != NULL) xmlFree(ns); } @@ -1401,6 +1467,10 @@ process_external_subset: } else { fulln = xmlStrdup(attr->name); } + if (fulln == NULL) { + xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); + break; + } /* * Check that the attribute is not declared in the @@ -1423,6 +1493,7 @@ process_external_subset: (const char *)fulln, (const char *)attr->elem); } + xmlFree(fulln); } attr = attr->nexth; } @@ -1444,7 +1515,7 @@ process_external_subset: * - this is a namespace prefix * - the user required for completion in the tree * like XSLT - * - there isn't already an attribute definition + * - there isn't already an attribute definition * in the internal subset overriding it. */ if (((attr->prefix != NULL) && @@ -1533,17 +1604,17 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts) /* * First check on validity: */ - if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && + if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && ((ctxt->myDoc->intSubset == NULL) || - ((ctxt->myDoc->intSubset->notations == NULL) && + ((ctxt->myDoc->intSubset->notations == NULL) && (ctxt->myDoc->intSubset->elements == NULL) && - (ctxt->myDoc->intSubset->attributes == NULL) && + (ctxt->myDoc->intSubset->attributes == NULL) && (ctxt->myDoc->intSubset->entities == NULL)))) { xmlErrValid(ctxt, XML_ERR_NO_DTD, "Validation failed: no DTD found !", NULL, NULL); ctxt->validate = 0; } - + /* * Split the full name into a namespace prefix and the tag name @@ -1721,7 +1792,6 @@ void xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlParserNodeInfo node_info; xmlNodePtr cur; if (ctx == NULL) return; @@ -1732,13 +1802,13 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED) else xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndElement(%s)\n", name); #endif - + /* Capture end position and add node */ if (cur != NULL && ctxt->record_info) { - node_info.end_pos = ctxt->input->cur - ctxt->input->base; - node_info.end_line = ctxt->input->line; - node_info.node = cur; - xmlParserAddNodeInfo(ctxt, &node_info); + ctxt->nodeInfo->end_pos = ctxt->input->cur - ctxt->input->base; + ctxt->nodeInfo->end_line = ctxt->input->line; + ctxt->nodeInfo->node = cur; + xmlParserAddNodeInfo(ctxt, ctxt->nodeInfo); } ctxt->nodemem = -1; @@ -1749,7 +1819,7 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED) cur); #endif /* LIBXML_VALID_ENABLED */ - + /* * end of parsing of this node. */ @@ -1758,15 +1828,15 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED) #endif nodePop(ctxt); } -#endif /* LIBXML_SAX1_ENABLED || LIBXML_HTML_ENABLE */ +#endif /* LIBXML_SAX1_ENABLED || LIBXML_HTML_ENABLED || LIBXML_LEGACY_ENABLED */ /* * xmlSAX2TextNode: * @ctxt: the parser context * @str: the input string * @len: the string length - * - * Remove the entities from an attribute value + * + * Callback for a text node * * Returns the newly allocated string or NULL if not needed or error */ @@ -1799,7 +1869,7 @@ xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) { if ((len < (int) (2 * sizeof(void *))) && (ctxt->options & XML_PARSE_COMPACT)) { - /* store the string in the node overrithing properties and nsDef */ + /* store the string in the node overriding properties and nsDef */ xmlChar *tmp = (xmlChar *) &(ret->properties); memcpy(tmp, str, len); tmp[len] = 0; @@ -1831,6 +1901,18 @@ skip: } else ret->content = (xmlChar *) intern; + if (ctxt->linenumbers) { + if (ctxt->input != NULL) { + if (ctxt->input->line < 65535) + ret->line = (short) ctxt->input->line; + else { + ret->line = 65535; + if (ctxt->options & XML_PARSE_BIG_LINES) + ret->psvi = (void *) (long) ctxt->input->line; + } + } + } + if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) xmlRegisterNodeDefaultValue(ret); return(ret); @@ -1842,7 +1924,7 @@ skip: * @ctxt: the parser context * @str: the input string * @len: the string length - * + * * Remove the entities from an attribute value * * Returns the newly allocated string or NULL if not needed or error @@ -1908,7 +1990,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt, memset(ret, 0, sizeof(xmlAttr)); ret->type = XML_ATTRIBUTE_NODE; - ret->parent = ctxt->node; + ret->parent = ctxt->node; ret->doc = ctxt->myDoc; ret->ns = namespace; @@ -1932,7 +2014,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt, xmlRegisterNodeDefaultValue((xmlNodePtr)ret); } else { if (ctxt->dictNames) - ret = xmlNewNsPropEatName(ctxt->node, namespace, + ret = xmlNewNsPropEatName(ctxt->node, namespace, (xmlChar *) localname, NULL); else ret = xmlNewNsProp(ctxt->node, namespace, localname, NULL); @@ -2018,7 +2100,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt, xmlChar *nvalnorm; xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(localname, prefix, fn, 50); if (fullname != NULL) { ctxt->vctxt.valid = 1; @@ -2069,12 +2151,14 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt, */ if (dup == NULL) dup = xmlStrndup(value, valueend - value); +#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) #ifdef LIBXML_VALID_ENABLED if (xmlValidateNCName(dup, 1) != 0) { xmlErrValid(ctxt, XML_DTD_XMLID_VALUE, "xml:id : attribute value %s is not an NCName\n", (const char *) dup, NULL); } +#endif #endif xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret); } else if (xmlIsID(ctxt->myDoc, ctxt->node, ret)) { @@ -2125,6 +2209,7 @@ xmlSAX2StartElementNs(void *ctx, xmlNodePtr parent; xmlNsPtr last = NULL, ns; const xmlChar *uri, *pref; + xmlChar *lname = NULL; int i, j; if (ctx == NULL) return; @@ -2132,17 +2217,31 @@ xmlSAX2StartElementNs(void *ctx, /* * First check on validity: */ - if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && + if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && ((ctxt->myDoc->intSubset == NULL) || - ((ctxt->myDoc->intSubset->notations == NULL) && + ((ctxt->myDoc->intSubset->notations == NULL) && (ctxt->myDoc->intSubset->elements == NULL) && - (ctxt->myDoc->intSubset->attributes == NULL) && + (ctxt->myDoc->intSubset->attributes == NULL) && (ctxt->myDoc->intSubset->entities == NULL)))) { - xmlErrValid(ctxt, XML_ERR_NO_DTD, + xmlErrValid(ctxt, XML_DTD_NO_DTD, "Validation failed: no DTD found !", NULL, NULL); ctxt->validate = 0; } + /* + * Take care of the rare case of an undefined namespace prefix + */ + if ((prefix != NULL) && (URI == NULL)) { + if (ctxt->dictNames) { + const xmlChar *fullname; + + fullname = xmlDictQLookup(ctxt->dict, prefix, localname); + if (fullname != NULL) + localname = fullname; + } else { + lname = xmlBuildQName(localname, prefix, NULL, 0); + } + } /* * allocate the node */ @@ -2156,7 +2255,10 @@ xmlSAX2StartElementNs(void *ctx, if (ctxt->dictNames) ret->name = localname; else { - ret->name = xmlStrdup(localname); + if (lname == NULL) + ret->name = xmlStrdup(localname); + else + ret->name = lname; if (ret->name == NULL) { xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); return; @@ -2166,10 +2268,13 @@ xmlSAX2StartElementNs(void *ctx, xmlRegisterNodeDefaultValue(ret); } else { if (ctxt->dictNames) - ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, + ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, (xmlChar *) localname, NULL); - else + else if (lname == NULL) ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL); + else + ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, + (xmlChar *) lname, NULL); if (ret == NULL) { xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); return; @@ -2184,7 +2289,7 @@ xmlSAX2StartElementNs(void *ctx, } } - if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { + if (parent == NULL) { xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); } /* @@ -2204,8 +2309,12 @@ xmlSAX2StartElementNs(void *ctx, if ((URI != NULL) && (prefix == pref)) ret->ns = ns; } 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 if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed && @@ -2256,9 +2365,14 @@ xmlSAX2StartElementNs(void *ctx, xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); return; } - xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, - "Namespace prefix %s was not found\n", - prefix, NULL); + if (prefix != NULL) + xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, + "Namespace prefix %s was not found\n", + prefix, NULL); + else + xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, + "Namespace default prefix was not found\n", + NULL, NULL); } } @@ -2267,8 +2381,33 @@ xmlSAX2StartElementNs(void *ctx, */ if (nb_attributes > 0) { for (j = 0,i = 0;i < nb_attributes;i++,j+=5) { + /* + * Handle the rare case of an undefined atribute prefix + */ + if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) { + if (ctxt->dictNames) { + const xmlChar *fullname; + + fullname = xmlDictQLookup(ctxt->dict, attributes[j+1], + attributes[j]); + if (fullname != NULL) { + xmlSAX2AttributeNs(ctxt, fullname, NULL, + attributes[j+3], attributes[j+4]); + continue; + } + } else { + lname = xmlBuildQName(attributes[j], attributes[j+1], + NULL, 0); + if (lname != NULL) { + xmlSAX2AttributeNs(ctxt, lname, NULL, + attributes[j+3], attributes[j+4]); + xmlFree(lname); + continue; + } + } + } xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1], - attributes[j+3], attributes[j+4]); + attributes[j+3], attributes[j+4]); } } @@ -2339,7 +2478,7 @@ xmlSAX2EndElementNs(void *ctx, * @ctx: the user data (XML parser context) * @name: The entity name * - * called when an entity xmlSAX2Reference is detected. + * called when an entity xmlSAX2Reference is detected. */ void xmlSAX2Reference(void *ctx, const xmlChar *name) @@ -2360,7 +2499,9 @@ xmlSAX2Reference(void *ctx, const xmlChar *name) xmlGenericError(xmlGenericErrorContext, "add xmlSAX2Reference %s to %s \n", name, ctxt->node->name); #endif - xmlAddChild(ctxt->node, ret); + if (xmlAddChild(ctxt->node, ret) == NULL) { + xmlFreeNode(ret); + } } /** @@ -2437,9 +2578,23 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len) (xmlDictOwns(ctxt->dict, lastChild->content))) { lastChild->content = xmlStrdup(lastChild->content); } + if (lastChild->content == NULL) { + xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: xmlStrdup returned NULL"); + return; + } + if (((size_t)ctxt->nodelen + (size_t)len > XML_MAX_TEXT_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node"); + return; + } + if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len || + (size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) { + xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented"); + return; + } if (ctxt->nodelen + len >= ctxt->nodemem) { xmlChar *newbuf; - int size; + size_t size; size = ctxt->nodemem + len; size *= 2; @@ -2520,7 +2675,6 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target, ret = xmlNewDocPI(ctxt->myDoc, target, data); if (ret == NULL) return; - parent = ctxt->node; if (ctxt->linenumbers) { if (ctxt->input != NULL) { @@ -2537,7 +2691,7 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target, xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret); return; } - if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { + if (parent == NULL) { #ifdef DEBUG_SAX_TREE xmlGenericError(xmlGenericErrorContext, "Setting PI %s as root\n", target); @@ -2598,7 +2752,7 @@ xmlSAX2Comment(void *ctx, const xmlChar *value) xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret); return; } - if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { + if (parent == NULL) { #ifdef DEBUG_SAX_TREE xmlGenericError(xmlGenericErrorContext, "Setting xmlSAX2Comment as root\n"); diff --git a/gnulib-local/lib/libxml/SAX2.in.h b/gnulib-local/lib/libxml/SAX2.in.h index 8d2db02..a55212e 100644 --- a/gnulib-local/lib/libxml/SAX2.in.h +++ b/gnulib-local/lib/libxml/SAX2.in.h @@ -23,53 +23,53 @@ extern "C" { #endif XMLPUBFUN const xmlChar * XMLCALL xmlSAX2GetPublicId (void *ctx); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlSAX2GetSystemId (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2SetDocumentLocator (void *ctx, xmlSAXLocatorPtr loc); - -XMLPUBFUN int XMLCALL + +XMLPUBFUN int XMLCALL xmlSAX2GetLineNumber (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSAX2GetColumnNumber (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSAX2IsStandalone (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSAX2HasInternalSubset (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSAX2HasExternalSubset (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2InternalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2ExternalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetEntity (void *ctx, const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetParameterEntity (void *ctx, const xmlChar *name); -XMLPUBFUN xmlParserInputPtr XMLCALL +XMLPUBFUN xmlParserInputPtr XMLCALL xmlSAX2ResolveEntity (void *ctx, const xmlChar *publicId, const xmlChar *systemId); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2EntityDecl (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2AttributeDecl (void *ctx, const xmlChar *elem, const xmlChar *fullname, @@ -77,36 +77,38 @@ XMLPUBFUN void XMLCALL int def, const xmlChar *defaultValue, xmlEnumerationPtr tree); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2ElementDecl (void *ctx, const xmlChar *name, int type, xmlElementContentPtr content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2NotationDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2UnparsedEntityDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2StartDocument (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2EndDocument (void *ctx); -#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) -XMLPUBFUN void XMLCALL +#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ + defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || \ + defined(LIBXML_LEGACY_ENABLED) +XMLPUBFUN void XMLCALL xmlSAX2StartElement (void *ctx, const xmlChar *fullname, const xmlChar **atts); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2EndElement (void *ctx, const xmlChar *name); -#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED */ +#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED or LIBXML_LEGACY_ENABLED */ XMLPUBFUN void XMLCALL xmlSAX2StartElementNs (void *ctx, const xmlChar *localname, @@ -122,25 +124,25 @@ XMLPUBFUN void XMLCALL const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2Reference (void *ctx, const xmlChar *name); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2Characters (void *ctx, const xmlChar *ch, int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2IgnorableWhitespace (void *ctx, const xmlChar *ch, int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2ProcessingInstruction (void *ctx, const xmlChar *target, const xmlChar *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2Comment (void *ctx, const xmlChar *value); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2CDataBlock (void *ctx, const xmlChar *value, int len); @@ -153,22 +155,22 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlSAXVersion (xmlSAXHandler *hdlr, int version); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, int warning); #ifdef LIBXML_HTML_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL htmlDefaultSAXHandlerInit (void); #endif #ifdef LIBXML_DOCB_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL docbDefaultSAXHandlerInit (void); #endif -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDefaultSAXHandlerInit (void); #ifdef __cplusplus } diff --git a/gnulib-local/lib/libxml/c14n.c b/gnulib-local/lib/libxml/c14n.c index bb7c9ba..ca77f92 100644 --- a/gnulib-local/lib/libxml/c14n.c +++ b/gnulib-local/lib/libxml/c14n.c @@ -1,12 +1,12 @@ /* - * "Canonical XML" implementation + * "Canonical XML" implementation * http://www.w3.org/TR/xml-c14n - * + * * "Exclusive XML Canonicalization" implementation * http://www.w3.org/TR/xml-exc-c14n * * See Copyright for the status of this software. - * + * * Author: Aleksey Sanin */ #define IN_LIBXML @@ -27,6 +27,8 @@ #include #include +#include "buf.h" + /************************************************************************ * * * Some declaration better left private ATM * @@ -44,7 +46,7 @@ typedef struct _xmlC14NVisibleNsStack { int nsPrevStart; /* the begginning of the stack for previous visible node */ int nsPrevEnd; /* the end of the stack for previous visible node */ int nsMax; /* size of the array as allocated */ - xmlNsPtr *nsTab; /* array of ns in no particular order */ + xmlNsPtr *nsTab; /* array of ns in no particular order */ xmlNodePtr *nodeTab; /* array of nodes in no particular order */ } xmlC14NVisibleNsStack, *xmlC14NVisibleNsStackPtr; @@ -52,7 +54,7 @@ typedef struct _xmlC14NCtx { /* input parameters */ xmlDocPtr doc; xmlC14NIsVisibleCallback is_visible_callback; - void* user_data; + void* user_data; int with_comments; xmlOutputBufferPtr buf; @@ -61,8 +63,10 @@ typedef struct _xmlC14NCtx { int parent_is_doc; xmlC14NVisibleNsStackPtr ns_rendered; + /* C14N mode */ + xmlC14NMode mode; + /* exclusive canonicalization */ - int exclusive; xmlChar **inclusive_ns_prefixes; /* error number */ @@ -71,17 +75,17 @@ typedef struct _xmlC14NCtx { static xmlC14NVisibleNsStackPtr xmlC14NVisibleNsStackCreate (void); static void xmlC14NVisibleNsStackDestroy (xmlC14NVisibleNsStackPtr cur); -static void xmlC14NVisibleNsStackAdd (xmlC14NVisibleNsStackPtr cur, +static void xmlC14NVisibleNsStackAdd (xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlNodePtr node); -static void xmlC14NVisibleNsStackSave (xmlC14NVisibleNsStackPtr cur, +static void xmlC14NVisibleNsStackSave (xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state); -static void xmlC14NVisibleNsStackRestore (xmlC14NVisibleNsStackPtr cur, +static void xmlC14NVisibleNsStackRestore (xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state); -static void xmlC14NVisibleNsStackShift (xmlC14NVisibleNsStackPtr cur); -static int xmlC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur, +static void xmlC14NVisibleNsStackShift (xmlC14NVisibleNsStackPtr cur); +static int xmlC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns); -static int xmlExcC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur, +static int xmlExcC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlC14NCtxPtr ctx); @@ -103,23 +107,26 @@ typedef enum { static xmlChar *xmlC11NNormalizeString(const xmlChar * input, xmlC14NNormalizationMode mode); -#define xmlC11NNormalizeAttr( a ) \ +#define xmlC11NNormalizeAttr( a ) \ xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_ATTR) -#define xmlC11NNormalizeComment( a ) \ +#define xmlC11NNormalizeComment( a ) \ xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_COMMENT) -#define xmlC11NNormalizePI( a ) \ +#define xmlC11NNormalizePI( a ) \ xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_PI) -#define xmlC11NNormalizeText( a ) \ +#define xmlC11NNormalizeText( a ) \ xmlC11NNormalizeString((a), XMLC14N_NORMALIZE_TEXT) -#define xmlC14NIsVisible( ctx, node, parent ) \ +#define xmlC14NIsVisible( ctx, node, parent ) \ (((ctx)->is_visible_callback != NULL) ? \ (ctx)->is_visible_callback((ctx)->user_data, \ (xmlNodePtr)(node), (xmlNodePtr)(parent)) : 1) +#define xmlC14NIsExclusive( ctx ) \ + ( (ctx)->mode == XML_C14N_EXCLUSIVE_1_0 ) + /************************************************************************ * * - * Some factorized error routines * + * Some factorized error routines * * * ************************************************************************/ @@ -234,7 +241,7 @@ xmlC14NErr(xmlC14NCtxPtr ctxt, xmlNodePtr node, int error, __xmlRaiseError(NULL, NULL, NULL, ctxt, node, XML_FROM_C14N, error, XML_ERR_ERROR, NULL, 0, - NULL, NULL, NULL, 0, 0, msg); + NULL, NULL, NULL, 0, 0, "%s", msg); } /************************************************************************ @@ -244,25 +251,25 @@ xmlC14NErr(xmlC14NCtxPtr ctxt, xmlNodePtr node, int error, ************************************************************************/ #define XML_NAMESPACES_DEFAULT 16 -static int +static int xmlC14NIsNodeInNodeset(xmlNodeSetPtr nodes, xmlNodePtr node, xmlNodePtr parent) { if((nodes != NULL) && (node != NULL)) { if(node->type != XML_NAMESPACE_DECL) { return(xmlXPathNodeSetContains(nodes, node)); } else { xmlNs ns; - - memcpy(&ns, node, sizeof(ns)); - + + memcpy(&ns, node, sizeof(ns)); + /* this is a libxml hack! check xpath.c for details */ if((parent != NULL) && (parent->type == XML_ATTRIBUTE_NODE)) { ns.next = (xmlNsPtr)parent->parent; } else { - ns.next = (xmlNsPtr)parent; + ns.next = (xmlNsPtr)parent; } - /* - * If the input is an XPath node-set, then the node-set must explicitly + /* + * If the input is an XPath node-set, then the node-set must explicitly * contain every node to be rendered to the canonical form. */ return(xmlXPathNodeSetContains(nodes, (xmlNodePtr)&ns)); @@ -300,12 +307,12 @@ xmlC14NVisibleNsStackDestroy(xmlC14NVisibleNsStackPtr cur) { } memset(cur, 0, sizeof(xmlC14NVisibleNsStack)); xmlFree(cur); - + } -static void +static void xmlC14NVisibleNsStackAdd(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlNodePtr node) { - if((cur == NULL) || + if((cur == NULL) || ((cur->nsTab == NULL) && (cur->nodeTab != NULL)) || ((cur->nsTab != NULL) && (cur->nodeTab == NULL))) { xmlC14NErrParam("adding namespace to stack"); @@ -323,9 +330,9 @@ xmlC14NVisibleNsStackAdd(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlNodePtr n memset(cur->nodeTab, 0 , XML_NAMESPACES_DEFAULT * sizeof(xmlNodePtr)); cur->nsMax = XML_NAMESPACES_DEFAULT; } else if(cur->nsMax == cur->nsCurEnd) { - void *tmp; + void *tmp; int tmpSize; - + tmpSize = 2 * cur->nsMax; tmp = xmlRealloc(cur->nsTab, tmpSize * sizeof(xmlNsPtr)); if (tmp == NULL) { @@ -355,7 +362,7 @@ xmlC14NVisibleNsStackSave(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr xmlC14NErrParam("saving namespaces stack"); return; } - + state->nsCurEnd = cur->nsCurEnd; state->nsPrevStart = cur->nsPrevStart; state->nsPrevEnd = cur->nsPrevEnd; @@ -372,7 +379,7 @@ xmlC14NVisibleNsStackRestore(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStack cur->nsPrevEnd = state->nsPrevEnd; } -static void +static void xmlC14NVisibleNsStackShift(xmlC14NVisibleNsStackPtr cur) { if(cur == NULL) { xmlC14NErrParam("shifting namespaces stack"); @@ -395,7 +402,7 @@ xmlC14NStrEqual(const xmlChar *str1, const xmlChar *str2) { /** * xmlC14NVisibleNsStackFind: - * @ctx: the C14N context + * @ctx: the C14N context * @ns: the namespace to check * * Checks whether the given namespace was already rendered or not @@ -409,14 +416,14 @@ xmlC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns) const xmlChar *prefix; const xmlChar *href; int has_empty_ns; - + if(cur == NULL) { xmlC14NErrParam("searching namespaces stack (c14n)"); return (0); } /* - * if the default namespace xmlns="" is not defined yet then + * if the default namespace xmlns="" is not defined yet then * we do not want to print it out */ prefix = ((ns == NULL) || (ns->prefix == NULL)) ? BAD_CAST "" : ns->prefix; @@ -427,7 +434,7 @@ xmlC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns) int start = (has_empty_ns) ? 0 : cur->nsPrevStart; for (i = cur->nsCurEnd - 1; i >= start; --i) { xmlNsPtr ns1 = cur->nsTab[i]; - + if(xmlC14NStrEqual(prefix, (ns1 != NULL) ? ns1->prefix : NULL)) { return(xmlC14NStrEqual(href, (ns1 != NULL) ? ns1->href : NULL)); } @@ -436,20 +443,20 @@ xmlC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns) return(has_empty_ns); } -static int +static int xmlExcC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlC14NCtxPtr ctx) { int i; const xmlChar *prefix; const xmlChar *href; int has_empty_ns; - + if(cur == NULL) { xmlC14NErrParam("searching namespaces stack (exc c14n)"); return (0); } /* - * if the default namespace xmlns="" is not defined yet then + * if the default namespace xmlns="" is not defined yet then * we do not want to print it out */ prefix = ((ns == NULL) || (ns->prefix == NULL)) ? BAD_CAST "" : ns->prefix; @@ -460,10 +467,10 @@ xmlExcC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlC14NC int start = 0; for (i = cur->nsCurEnd - 1; i >= start; --i) { xmlNsPtr ns1 = cur->nsTab[i]; - + if(xmlC14NStrEqual(prefix, (ns1 != NULL) ? ns1->prefix : NULL)) { if(xmlC14NStrEqual(href, (ns1 != NULL) ? ns1->href : NULL)) { - return(xmlC14NIsVisible(ctx, ns1, cur->nodeTab[i])); + return(xmlC14NIsVisible(ctx, ns1, cur->nodeTab[i])); } else { return(0); } @@ -478,8 +485,8 @@ xmlExcC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlC14NC /** * xmlC14NIsXmlNs: - * @ns: the namespace to check - * + * @ns: the namespace to check + * * Checks whether the given namespace is a default "xml:" namespace * with href="http://www.w3.org/XML/1998/namespace" * @@ -492,16 +499,14 @@ xmlC14NIsXmlNs(xmlNsPtr ns) { return ((ns != NULL) && (xmlStrEqual(ns->prefix, BAD_CAST "xml")) && - (xmlStrEqual(ns->href, - BAD_CAST - "http://www.w3.org/XML/1998/namespace"))); + (xmlStrEqual(ns->href, XML_XML_NAMESPACE))); } /** * xmlC14NNsCompare: * @ns1: the pointer to first namespace - * @ns2: the pointer to second namespace + * @ns2: the pointer to second namespace * * Compares the namespaces by names (prefixes). * @@ -524,7 +529,7 @@ xmlC14NNsCompare(xmlNsPtr ns1, xmlNsPtr ns2) /** * xmlC14NPrintNamespaces: * @ns: the pointer to namespace - * @ctx: the C14N context + * @ctx: the C14N context * * Prints the given namespace to the output buffer from C14N context. * @@ -542,52 +547,53 @@ xmlC14NPrintNamespaces(const xmlNsPtr ns, xmlC14NCtxPtr ctx) if (ns->prefix != NULL) { xmlOutputBufferWriteString(ctx->buf, " xmlns:"); xmlOutputBufferWriteString(ctx->buf, (const char *) ns->prefix); - xmlOutputBufferWriteString(ctx->buf, "=\""); + xmlOutputBufferWriteString(ctx->buf, "="); } else { - xmlOutputBufferWriteString(ctx->buf, " xmlns=\""); + xmlOutputBufferWriteString(ctx->buf, " xmlns="); } if(ns->href != NULL) { - xmlOutputBufferWriteString(ctx->buf, (const char *) ns->href); + xmlBufWriteQuotedString(ctx->buf->buffer, ns->href); + } else { + xmlOutputBufferWriteString(ctx->buf, "\"\""); } - xmlOutputBufferWriteString(ctx->buf, "\""); return (1); } /** * xmlC14NProcessNamespacesAxis: - * @ctx: the C14N context + * @ctx: the C14N context * @node: the current node * * Prints out canonical namespace axis of the current node to the - * buffer from C14N context as follows + * buffer from C14N context as follows * * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n) * * Namespace Axis - * Consider a list L containing only namespace nodes in the - * axis and in the node-set in lexicographic order (ascending). To begin - * processing L, if the first node is not the default namespace node (a node - * with no namespace URI and no local name), then generate a space followed + * Consider a list L containing only namespace nodes in the + * axis and in the node-set in lexicographic order (ascending). To begin + * processing L, if the first node is not the default namespace node (a node + * with no namespace URI and no local name), then generate a space followed * by xmlns="" if and only if the following conditions are met: * - the element E that owns the axis is in the node-set - * - The nearest ancestor element of E in the node-set has a default - * namespace node in the node-set (default namespace nodes always + * - The nearest ancestor element of E in the node-set has a default + * namespace node in the node-set (default namespace nodes always * have non-empty values in XPath) - * The latter condition eliminates unnecessary occurrences of xmlns="" in - * the canonical form since an element only receives an xmlns="" if its - * default namespace is empty and if it has an immediate parent in the - * canonical form that has a non-empty default namespace. To finish - * processing L, simply process every namespace node in L, except omit - * namespace node with local name xml, which defines the xml prefix, + * The latter condition eliminates unnecessary occurrences of xmlns="" in + * the canonical form since an element only receives an xmlns="" if its + * default namespace is empty and if it has an immediate parent in the + * canonical form that has a non-empty default namespace. To finish + * processing L, simply process every namespace node in L, except omit + * namespace node with local name xml, which defines the xml prefix, * if its string value is http://www.w3.org/XML/1998/namespace. * * Exclusive XML Canonicalization v 1.0 (http://www.w3.org/TR/xml-exc-c14n) - * Canonical XML applied to a document subset requires the search of the - * ancestor nodes of each orphan element node for attributes in the xml - * namespace, such as xml:lang and xml:space. These are copied into the - * element node except if a declaration of the same attribute is already - * in the attribute axis of the element (whether or not it is included in - * the document subset). This search and copying are omitted from the + * Canonical XML applied to a document subset requires the search of the + * ancestor nodes of each orphan element node for attributes in the xml + * namespace, such as xml:lang and xml:space. These are copied into the + * element node except if a declaration of the same attribute is already + * in the attribute axis of the element (whether or not it is included in + * the document subset). This search and copying are omitted from the * Exclusive XML Canonicalization method. * * Returns 0 on success or -1 on fail. @@ -600,7 +606,7 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) xmlListPtr list; int already_rendered; int has_empty_ns = 0; - + if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { xmlC14NErrParam("processing namespaces axis (c14n)"); return (-1); @@ -619,29 +625,29 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) for(n = cur; n != NULL; n = n->parent) { for(ns = n->nsDef; ns != NULL; ns = ns->next) { tmp = xmlSearchNs(cur->doc, cur, ns->prefix); - + if((tmp == ns) && !xmlC14NIsXmlNs(ns) && xmlC14NIsVisible(ctx, ns, cur)) { already_rendered = xmlC14NVisibleNsStackFind(ctx->ns_rendered, ns); if(visible) { - xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur); + xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur); } if(!already_rendered) { - xmlListInsert(list, ns); + xmlListInsert(list, ns); } - if(xmlStrlen(ns->prefix) == 0) { + if(xmlStrlen(ns->prefix) == 0) { has_empty_ns = 1; } } } } - + /** - * if the first node is not the default namespace node (a node with no - * namespace URI and no local name), then generate a space followed by + * if the first node is not the default namespace node (a node with no + * namespace URI and no local name), then generate a space followed by * xmlns="" if and only if the following conditions are met: * - the element E that owns the axis is in the node-set - * - the nearest ancestor element of E in the node-set has a default - * namespace node in the node-set (default namespace nodes always + * - the nearest ancestor element of E in the node-set has a default + * namespace node in the node-set (default namespace nodes always * have non-empty values in XPath) */ if(visible && !has_empty_ns) { @@ -649,17 +655,17 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) memset(&ns_default, 0, sizeof(ns_default)); if(!xmlC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default)) { - xmlC14NPrintNamespaces(&ns_default, ctx); + xmlC14NPrintNamespaces(&ns_default, ctx); } } - - - /* - * print out all elements from list + + + /* + * print out all elements from list */ xmlListWalk(list, (xmlListWalker) xmlC14NPrintNamespaces, (const void *) ctx); - /* + /* * Cleanup */ xmlListDelete(list); @@ -669,28 +675,28 @@ xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) /** * xmlExcC14NProcessNamespacesAxis: - * @ctx: the C14N context + * @ctx: the C14N context * @node: the current node * * Prints out exclusive canonical namespace axis of the current node to the - * buffer from C14N context as follows + * buffer from C14N context as follows * * Exclusive XML Canonicalization * http://www.w3.org/TR/xml-exc-c14n * - * If the element node is in the XPath subset then output the node in - * accordance with Canonical XML except for namespace nodes which are + * If the element node is in the XPath subset then output the node in + * accordance with Canonical XML except for namespace nodes which are * rendered as follows: * * 1. Render each namespace node iff: - * * it is visibly utilized by the immediate parent element or one of + * * it is visibly utilized by the immediate parent element or one of * its attributes, or is present in InclusiveNamespaces PrefixList, and - * * its prefix and value do not appear in ns_rendered. ns_rendered is - * obtained by popping the state stack in order to obtain a list of - * prefixes and their values which have already been rendered by + * * its prefix and value do not appear in ns_rendered. ns_rendered is + * obtained by popping the state stack in order to obtain a list of + * prefixes and their values which have already been rendered by * an output ancestor of the namespace node's parent element. - * 2. Append the rendered namespace node to the list ns_rendered of namespace - * nodes rendered by output ancestors. Push ns_rendered on state stack and + * 2. Append the rendered namespace node to the list ns_rendered of namespace + * nodes rendered by output ancestors. Push ns_rendered on state stack and * recurse. * 3. After the recursion returns, pop thestate stack. * @@ -707,13 +713,13 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) int has_empty_ns = 0; int has_visibly_utilized_empty_ns = 0; int has_empty_ns_in_inclusive_list = 0; - + if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { xmlC14NErrParam("processing namespaces axis (exc c14n)"); return (-1); } - if(!ctx->exclusive) { + if(!xmlC14NIsExclusive(ctx)) { xmlC14NErrParam("processing namespaces axis (exc c14n)"); return (-1); @@ -728,15 +734,15 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) return (-1); } - /* + /* * process inclusive namespaces: - * All namespace nodes appearing on inclusive ns list are + * All namespace nodes appearing on inclusive ns list are * handled as provided in Canonical XML */ if(ctx->inclusive_ns_prefixes != NULL) { - xmlChar *prefix; + xmlChar *prefix; int i; - + for (i = 0; ctx->inclusive_ns_prefixes[i] != NULL; ++i) { prefix = ctx->inclusive_ns_prefixes[i]; /* @@ -747,23 +753,23 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) prefix = NULL; has_empty_ns_in_inclusive_list = 1; } - - ns = xmlSearchNs(cur->doc, cur, prefix); + + ns = xmlSearchNs(cur->doc, cur, prefix); if((ns != NULL) && !xmlC14NIsXmlNs(ns) && xmlC14NIsVisible(ctx, ns, cur)) { already_rendered = xmlC14NVisibleNsStackFind(ctx->ns_rendered, ns); if(visible) { - xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur); + xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur); } if(!already_rendered) { - xmlListInsert(list, ns); + xmlListInsert(list, ns); } - if(xmlStrlen(ns->prefix) == 0) { + if(xmlStrlen(ns->prefix) == 0) { has_empty_ns = 1; } } } } - + /* add node namespace */ if(cur->ns != NULL) { ns = cur->ns; @@ -772,32 +778,32 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) has_visibly_utilized_empty_ns = 1; } if((ns != NULL) && !xmlC14NIsXmlNs(ns)) { - if(visible && xmlC14NIsVisible(ctx, ns, cur)) { + if(visible && xmlC14NIsVisible(ctx, ns, cur)) { if(!xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, ns, ctx)) { xmlListInsert(list, ns); } } if(visible) { - xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur); + xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur); } if(xmlStrlen(ns->prefix) == 0) { has_empty_ns = 1; } } - - + + /* add attributes */ for(attr = cur->properties; attr != NULL; attr = attr->next) { - /* + /* * we need to check that attribute is visible and has non - * default namespace (XML Namespaces: "default namespaces - * do not apply directly to attributes") + * default namespace (XML Namespaces: "default namespaces + * do not apply directly to attributes") */ if((attr->ns != NULL) && !xmlC14NIsXmlNs(attr->ns) && xmlC14NIsVisible(ctx, attr, cur)) { already_rendered = xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, attr->ns, ctx); - xmlC14NVisibleNsStackAdd(ctx->ns_rendered, attr->ns, cur); + xmlC14NVisibleNsStackAdd(ctx->ns_rendered, attr->ns, cur); if(!already_rendered && visible) { - xmlListInsert(list, attr->ns); + xmlListInsert(list, attr->ns); } if(xmlStrlen(attr->ns->prefix) == 0) { has_empty_ns = 1; @@ -810,33 +816,33 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) /* * Process xmlns="" */ - if(visible && has_visibly_utilized_empty_ns && + if(visible && has_visibly_utilized_empty_ns && !has_empty_ns && !has_empty_ns_in_inclusive_list) { static xmlNs ns_default; memset(&ns_default, 0, sizeof(ns_default)); - + already_rendered = xmlExcC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default, ctx); if(!already_rendered) { - xmlC14NPrintNamespaces(&ns_default, ctx); + xmlC14NPrintNamespaces(&ns_default, ctx); } } else if(visible && !has_empty_ns && has_empty_ns_in_inclusive_list) { static xmlNs ns_default; memset(&ns_default, 0, sizeof(ns_default)); if(!xmlC14NVisibleNsStackFind(ctx->ns_rendered, &ns_default)) { - xmlC14NPrintNamespaces(&ns_default, ctx); + xmlC14NPrintNamespaces(&ns_default, ctx); } } - - /* - * print out all elements from list + + /* + * print out all elements from list */ xmlListWalk(list, (xmlListWalker) xmlC14NPrintNamespaces, (const void *) ctx); - /* + /* * Cleanup */ xmlListDelete(list); @@ -844,10 +850,29 @@ xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) } +/** + * xmlC14NIsXmlAttr: + * @attr: the attr to check + * + * Checks whether the given attribute is a default "xml:" namespace + * with href="http://www.w3.org/XML/1998/namespace" + * + * Returns 1 if the node is default or 0 otherwise + */ + +/* todo: make it a define? */ +static int +xmlC14NIsXmlAttr(xmlAttrPtr attr) +{ + return ((attr->ns != NULL) && + (xmlC14NIsXmlNs(attr->ns) != 0)); +} + + /** * xmlC14NAttrsCompare: * @attr1: the pointer tls o first attr - * @attr2: the pointer to second attr + * @attr2: the pointer to second attr * * Prints the given attribute to the output buffer from C14N context. * @@ -871,7 +896,7 @@ xmlC14NAttrsCompare(xmlAttrPtr attr1, xmlAttrPtr attr2) return (xmlStrcmp(attr1->name, attr2->name)); } - /* + /* * Attributes in the default namespace are first * because the default namespace is not applied to * unqualified attributes @@ -896,10 +921,10 @@ xmlC14NAttrsCompare(xmlAttrPtr attr1, xmlAttrPtr attr2) /** * xmlC14NPrintAttrs: * @attr: the pointer to attr - * @ctx: the C14N context + * @ctx: the C14N context * * Prints out canonical attribute urrent node to the - * buffer from C14N context as follows + * buffer from C14N context as follows * * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n) * @@ -925,7 +950,7 @@ xmlC14NPrintAttrs(const xmlAttrPtr attr, xmlC14NCtxPtr ctx) xmlOutputBufferWriteString(ctx->buf, (const char *) attr->name); xmlOutputBufferWriteString(ctx->buf, "=\""); - value = xmlNodeListGetString(attr->doc, attr->children, 1); + value = xmlNodeListGetString(ctx->doc, attr->children, 1); /* todo: should we log an error if value==NULL ? */ if (value != NULL) { buffer = xmlC11NNormalizeAttr(value); @@ -942,34 +967,157 @@ xmlC14NPrintAttrs(const xmlAttrPtr attr, xmlC14NCtxPtr ctx) return (1); } +/** + * xmlC14NFindHiddenParentAttr: + * + * Finds an attribute in a hidden parent node. + * + * Returns a pointer to the attribute node (if found) or NULL otherwise. + */ +static xmlAttrPtr +xmlC14NFindHiddenParentAttr(xmlC14NCtxPtr ctx, xmlNodePtr cur, const xmlChar * name, const xmlChar * ns) +{ + xmlAttrPtr res; + while((cur != NULL) && (!xmlC14NIsVisible(ctx, cur, cur->parent))) { + res = xmlHasNsProp(cur, name, ns); + if(res != NULL) { + return res; + } + + cur = cur->parent; + } + + return NULL; +} + +/** + * xmlC14NFixupBaseAttr: + * + * Fixes up the xml:base attribute + * + * Returns the newly created attribute or NULL + */ +static xmlAttrPtr +xmlC14NFixupBaseAttr(xmlC14NCtxPtr ctx, xmlAttrPtr xml_base_attr) +{ + xmlChar * res = NULL; + xmlNodePtr cur; + xmlAttrPtr attr; + xmlChar * tmp_str; + xmlChar * tmp_str2; + int tmp_str_len; + + if ((ctx == NULL) || (xml_base_attr == NULL) || (xml_base_attr->parent == NULL)) { + xmlC14NErrParam("processing xml:base attribute"); + return (NULL); + } + + /* start from current value */ + res = xmlNodeListGetString(ctx->doc, xml_base_attr->children, 1); + if(res == NULL) { + xmlC14NErrInternal("processing xml:base attribute - can't get attr value"); + return (NULL); + } + + /* go up the stack until we find a node that we rendered already */ + cur = xml_base_attr->parent->parent; + while((cur != NULL) && (!xmlC14NIsVisible(ctx, cur, cur->parent))) { + attr = xmlHasNsProp(cur, BAD_CAST "base", XML_XML_NAMESPACE); + if(attr != NULL) { + /* get attr value */ + tmp_str = xmlNodeListGetString(ctx->doc, attr->children, 1); + if(tmp_str == NULL) { + xmlFree(res); + + xmlC14NErrInternal("processing xml:base attribute - can't get attr value"); + return (NULL); + } + + /* we need to add '/' if our current base uri ends with '..' or '.' + to ensure that we are forced to go "up" all the time */ + tmp_str_len = xmlStrlen(tmp_str); + if(tmp_str_len > 1 && tmp_str[tmp_str_len - 2] == '.') { + tmp_str2 = xmlStrcat(tmp_str, BAD_CAST "/"); + if(tmp_str2 == NULL) { + xmlFree(tmp_str); + xmlFree(res); + + xmlC14NErrInternal("processing xml:base attribute - can't modify uri"); + return (NULL); + } + + tmp_str = tmp_str2; + } + + /* build uri */ + tmp_str2 = xmlBuildURI(res, tmp_str); + if(tmp_str2 == NULL) { + xmlFree(tmp_str); + xmlFree(res); + + xmlC14NErrInternal("processing xml:base attribute - can't construct uri"); + return (NULL); + } + + /* cleanup and set the new res */ + xmlFree(tmp_str); + xmlFree(res); + res = tmp_str2; + } + + /* next */ + cur = cur->parent; + } + + /* check if result uri is empty or not */ + if((res == NULL) || xmlStrEqual(res, BAD_CAST "")) { + xmlFree(res); + return (NULL); + } + + /* create and return the new attribute node */ + attr = xmlNewNsProp(NULL, xml_base_attr->ns, BAD_CAST "base", res); + if(attr == NULL) { + xmlFree(res); + + xmlC14NErrInternal("processing xml:base attribute - can't construct attribute"); + return (NULL); + } + + /* done */ + xmlFree(res); + return (attr); +} + /** * xmlC14NProcessAttrsAxis: - * @ctx: the C14N context + * @ctx: the C14N context * @cur: the current node * @parent_visible: the visibility of parent node + * @all_parents_visible: the visibility of all parent nodes * * Prints out canonical attribute axis of the current node to the - * buffer from C14N context as follows + * buffer from C14N context as follows * * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n) * - * Attribute Axis - * In lexicographic order (ascending), process each node that + * Attribute Axis + * In lexicographic order (ascending), process each node that * is in the element's attribute axis and in the node-set. - * - * The processing of an element node E MUST be modified slightly - * when an XPath node-set is given as input and the element's + * + * The processing of an element node E MUST be modified slightly + * when an XPath node-set is given as input and the element's * parent is omitted from the node-set. * * * Exclusive XML Canonicalization v 1.0 (http://www.w3.org/TR/xml-exc-c14n) * - * Canonical XML applied to a document subset requires the search of the - * ancestor nodes of each orphan element node for attributes in the xml - * namespace, such as xml:lang and xml:space. These are copied into the - * element node except if a declaration of the same attribute is already - * in the attribute axis of the element (whether or not it is included in - * the document subset). This search and copying are omitted from the + * Canonical XML applied to a document subset requires the search of the + * ancestor nodes of each orphan element node for attributes in the xml + * namespace, such as xml:lang and xml:space. These are copied into the + * element node except if a declaration of the same attribute is already + * in the attribute axis of the element (whether or not it is included in + * the document subset). This search and copying are omitted from the * Exclusive XML Canonicalization method. * * Returns 0 on success or -1 on fail. @@ -979,6 +1127,12 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible) { xmlAttrPtr attr; xmlListPtr list; + xmlAttrPtr attrs_to_delete = NULL; + + /* special processing for 1.1 spec */ + xmlAttrPtr xml_base_attr = NULL; + xmlAttrPtr xml_lang_attr = NULL; + xmlAttrPtr xml_space_attr = NULL; if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { xmlC14NErrParam("processing attributes axis"); @@ -994,57 +1148,200 @@ xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible) return (-1); } - /* - * Add all visible attributes from current node. - */ - attr = cur->properties; - while (attr != NULL) { - /* check that attribute is visible */ - if (xmlC14NIsVisible(ctx, attr, cur)) { - xmlListInsert(list, attr); + switch(ctx->mode) { + case XML_C14N_1_0: + /* The processing of an element node E MUST be modified slightly when an XPath node-set is + * given as input and the element's parent is omitted from the node-set. The method for processing + * the attribute axis of an element E in the node-set is enhanced. All element nodes along E's + * ancestor axis are examined for nearest occurrences of attributes in the xml namespace, such + * as xml:lang and xml:space (whether or not they are in the node-set). From this list of attributes, + * remove any that are in E's attribute axis (whether or not they are in the node-set). Then, + * lexicographically merge this attribute list with the nodes of E's attribute axis that are in + * the node-set. The result of visiting the attribute axis is computed by processing the attribute + * nodes in this merged attribute list. + */ + + /* + * Add all visible attributes from current node. + */ + attr = cur->properties; + while (attr != NULL) { + /* check that attribute is visible */ + if (xmlC14NIsVisible(ctx, attr, cur)) { + xmlListInsert(list, attr); + } + attr = attr->next; } - attr = attr->next; - } - /* - * include attributes in "xml" namespace defined in ancestors - * (only for non-exclusive XML Canonicalization) - */ - if (parent_visible && (!ctx->exclusive) && (cur->parent != NULL) - && (!xmlC14NIsVisible(ctx, cur->parent, cur->parent->parent))) { /* - * If XPath node-set is not specified then the parent is always - * visible! + * Handle xml attributes */ - cur = cur->parent; - while (cur != NULL) { - attr = cur->properties; - while (attr != NULL) { - if ((attr->ns != NULL) - && (xmlStrEqual(attr->ns->prefix, BAD_CAST "xml"))) { - if (xmlListSearch(list, attr) == NULL) { - xmlListInsert(list, attr); + if (parent_visible && (cur->parent != NULL) && + (!xmlC14NIsVisible(ctx, cur->parent, cur->parent->parent))) + { + xmlNodePtr tmp; + + /* + * If XPath node-set is not specified then the parent is always + * visible! + */ + tmp = cur->parent; + while (tmp != NULL) { + attr = tmp->properties; + while (attr != NULL) { + if (xmlC14NIsXmlAttr(attr) != 0) { + if (xmlListSearch(list, attr) == NULL) { + xmlListInsert(list, attr); + } } + attr = attr->next; + } + tmp = tmp->parent; + } + } + + /* done */ + break; + case XML_C14N_EXCLUSIVE_1_0: + /* attributes in the XML namespace, such as xml:lang and xml:space + * are not imported into orphan nodes of the document subset + */ + + /* + * Add all visible attributes from current node. + */ + attr = cur->properties; + while (attr != NULL) { + /* check that attribute is visible */ + if (xmlC14NIsVisible(ctx, attr, cur)) { + xmlListInsert(list, attr); + } + attr = attr->next; + } + + /* do nothing special for xml attributes */ + break; + case XML_C14N_1_1: + /* The processing of an element node E MUST be modified slightly when an XPath node-set is + * given as input and some of the element's ancestors are omitted from the node-set. + * + * Simple inheritable attributes are attributes that have a value that requires at most a simple + * redeclaration. This redeclaration is done by supplying a new value in the child axis. The + * redeclaration of a simple inheritable attribute A contained in one of E's ancestors is done + * by supplying a value to an attribute Ae inside E with the same name. Simple inheritable attributes + * are xml:lang and xml:space. + * + * The method for processing the attribute axis of an element E in the node-set is hence enhanced. + * All element nodes along E's ancestor axis are examined for the nearest occurrences of simple + * inheritable attributes in the xml namespace, such as xml:lang and xml:space (whether or not they + * are in the node-set). From this list of attributes, any simple inheritable attributes that are + * already in E's attribute axis (whether or not they are in the node-set) are removed. Then, + * lexicographically merge this attribute list with the nodes of E's attribute axis that are in + * the node-set. The result of visiting the attribute axis is computed by processing the attribute + * nodes in this merged attribute list. + * + * The xml:id attribute is not a simple inheritable attribute and no processing of these attributes is + * performed. + * + * The xml:base attribute is not a simple inheritable attribute and requires special processing beyond + * a simple redeclaration. + * + * Attributes in the XML namespace other than xml:base, xml:id, xml:lang, and xml:space MUST be processed + * as ordinary attributes. + */ + + /* + * Add all visible attributes from current node. + */ + attr = cur->properties; + while (attr != NULL) { + /* special processing for XML attribute kiks in only when we have invisible parents */ + if ((!parent_visible) || (xmlC14NIsXmlAttr(attr) == 0)) { + /* check that attribute is visible */ + if (xmlC14NIsVisible(ctx, attr, cur)) { + xmlListInsert(list, attr); + } + } else { + int matched = 0; + + /* check for simple inheritance attributes */ + if((!matched) && (xml_lang_attr == NULL) && xmlStrEqual(attr->name, BAD_CAST "lang")) { + xml_lang_attr = attr; + matched = 1; + } + if((!matched) && (xml_space_attr == NULL) && xmlStrEqual(attr->name, BAD_CAST "space")) { + xml_space_attr = attr; + matched = 1; + } + + /* check for base attr */ + if((!matched) && (xml_base_attr == NULL) && xmlStrEqual(attr->name, BAD_CAST "base")) { + xml_base_attr = attr; + matched = 1; + } + + /* otherwise, it is a normal attribute, so just check if it is visible */ + if((!matched) && xmlC14NIsVisible(ctx, attr, cur)) { + xmlListInsert(list, attr); + } + } + + /* move to the next one */ + attr = attr->next; + } + + /* special processing for XML attribute kiks in only when we have invisible parents */ + if ((parent_visible)) { + + /* simple inheritance attributes - copy */ + if(xml_lang_attr == NULL) { + xml_lang_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "lang", XML_XML_NAMESPACE); + } + if(xml_lang_attr != NULL) { + xmlListInsert(list, xml_lang_attr); + } + if(xml_space_attr == NULL) { + xml_space_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "space", XML_XML_NAMESPACE); + } + if(xml_space_attr != NULL) { + xmlListInsert(list, xml_space_attr); + } + + /* base uri attribute - fix up */ + if(xml_base_attr == NULL) { + /* if we don't have base uri attribute, check if we have a "hidden" one above */ + xml_base_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "base", XML_XML_NAMESPACE); + } + if(xml_base_attr != NULL) { + xml_base_attr = xmlC14NFixupBaseAttr(ctx, xml_base_attr); + if(xml_base_attr != NULL) { + xmlListInsert(list, xml_base_attr); + + /* note that we MUST delete returned attr node ourselves! */ + xml_base_attr->next = attrs_to_delete; + attrs_to_delete = xml_base_attr; } - attr = attr->next; } - cur = cur->parent; } + + /* done */ + break; } - /* - * print out all elements from list + /* + * print out all elements from list */ xmlListWalk(list, (xmlListWalker) xmlC14NPrintAttrs, (const void *) ctx); - /* + /* * Cleanup */ + xmlFreePropList(attrs_to_delete); xmlListDelete(list); return (0); } -/** +/** * xmlC14NCheckForRelativeNamespaces: * @ctx: the C14N context * @cur: the current element node @@ -1094,21 +1391,23 @@ xmlC14NCheckForRelativeNamespaces(xmlC14NCtxPtr ctx, xmlNodePtr cur) /** * xmlC14NProcessElementNode: - * @ctx: the pointer to C14N context object + * @ctx: the pointer to C14N context object * @cur: the node to process - * + * @visible: this node is visible + * @all_parents_visible: whether all the parents of this node are visible + * * Canonical XML v 1.0 (http://www.w3.org/TR/xml-c14n) * * Element Nodes - * If the element is not in the node-set, then the result is obtained - * by processing the namespace axis, then the attribute axis, then - * processing the child nodes of the element that are in the node-set - * (in document order). If the element is in the node-set, then the result - * is an open angle bracket (<), the element QName, the result of - * processing the namespace axis, the result of processing the attribute - * axis, a close angle bracket (>), the result of processing the child - * nodes of the element that are in the node-set (in document order), an - * open angle bracket, a forward slash (/), the element QName, and a close + * If the element is not in the node-set, then the result is obtained + * by processing the namespace axis, then the attribute axis, then + * processing the child nodes of the element that are in the node-set + * (in document order). If the element is in the node-set, then the result + * is an open angle bracket (<), the element QName, the result of + * processing the namespace axis, the result of processing the attribute + * axis, a close angle bracket (>), the result of processing the child + * nodes of the element that are in the node-set (in document order), an + * open angle bracket, a forward slash (/), the element QName, and a close * angle bracket. * * Returns non-negative value on success or negative value on fail @@ -1125,7 +1424,7 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) return (-1); } - /* + /* * Check relative relative namespaces: * implementations of XML canonicalization MUST report an operation * failure on documents containing relative namespace URIs. @@ -1136,13 +1435,13 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) } - /* + /* * Save ns_rendered stack position */ memset(&state, 0, sizeof(state)); xmlC14NVisibleNsStackSave(ctx->ns_rendered, &state); - if (visible) { + if (visible) { if (ctx->parent_is_doc) { /* save this flag into the stack */ parent_is_doc = ctx->parent_is_doc; @@ -1159,7 +1458,7 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) xmlOutputBufferWriteString(ctx->buf, (const char *) cur->name); } - if (!ctx->exclusive) { + if (!xmlC14NIsExclusive(ctx)) { ret = xmlC14NProcessNamespacesAxis(ctx, cur, visible); } else { ret = xmlExcC14NProcessNamespacesAxis(ctx, cur, visible); @@ -1172,14 +1471,14 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) if(visible) { xmlC14NVisibleNsStackShift(ctx->ns_rendered); } - + ret = xmlC14NProcessAttrsAxis(ctx, cur, visible); if (ret < 0) { xmlC14NErrInternal("processing attributes axis"); - return (-1); + return (-1); } - if (visible) { + if (visible) { xmlOutputBufferWriteString(ctx->buf, ">"); } if (cur->children != NULL) { @@ -1205,7 +1504,7 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) } } - /* + /* * Restore ns_rendered stack position */ xmlC14NVisibleNsStackRestore(ctx->ns_rendered, &state); @@ -1214,9 +1513,9 @@ xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible) /** * xmlC14NProcessNode: - * @ctx: the pointer to C14N context object + * @ctx: the pointer to C14N context object * @cur: the node to process - * + * * Processes the given node * * Returns non-negative value on success or negative value on fail @@ -1241,9 +1540,9 @@ xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) case XML_TEXT_NODE: /* * Text Nodes - * the string value, except all ampersands are replaced - * by &, all open angle brackets (<) are replaced by <, all closing - * angle brackets (>) are replaced by >, and all #xD characters are + * the string value, except all ampersands are replaced + * by &, all open angle brackets (<) are replaced by <, all closing + * angle brackets (>) are replaced by >, and all #xD characters are * replaced by . */ /* cdata sections are processed as text nodes */ @@ -1263,16 +1562,16 @@ xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) } break; case XML_PI_NODE: - /* - * Processing Instruction (PI) Nodes- - * The opening PI symbol (). If the string value is empty, - * then the leading space is not added. Also, a trailing #xA is - * rendered after the closing PI symbol for PI children of the - * root node with a lesser document order than the document - * element, and a leading #xA is rendered before the opening PI - * symbol of PI children of the root node with a greater document + /* + * Processing Instruction (PI) Nodes- + * The opening PI symbol (). If the string value is empty, + * then the leading space is not added. Also, a trailing #xA is + * rendered after the closing PI symbol for PI children of the + * root node with a lesser document order than the document + * element, and a leading #xA is rendered before the opening PI + * symbol of PI children of the root node with a greater document * order than the document element. */ if (visible) { @@ -1311,17 +1610,17 @@ xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) case XML_COMMENT_NODE: /* * Comment Nodes - * Nothing if generating canonical XML without comments. For - * canonical XML with comments, generate the opening comment - * symbol (). Also, a trailing #xA is rendered - * after the closing comment symbol for comment children of the - * root node with a lesser document order than the document - * element, and a leading #xA is rendered before the opening - * comment symbol of comment children of the root node with a - * greater document order than the document element. (Comment - * children of the root node represent comments outside of the - * top-level document element and outside of the document type + * Nothing if generating canonical XML without comments. For + * canonical XML with comments, generate the opening comment + * symbol (). Also, a trailing #xA is rendered + * after the closing comment symbol for comment children of the + * root node with a lesser document order than the document + * element, and a leading #xA is rendered before the opening + * comment symbol of comment children of the root node with a + * greater document order than the document element. (Comment + * children of the root node represent comments outside of the + * top-level document element and outside of the document type * declaration). */ if (visible && ctx->with_comments) { @@ -1391,8 +1690,8 @@ xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) case XML_XINCLUDE_START: case XML_XINCLUDE_END: #endif - /* - * should be ignored according to "W3C Canonical XML" + /* + * should be ignored according to "W3C Canonical XML" */ break; default: @@ -1405,9 +1704,9 @@ xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur) /** * xmlC14NProcessNodeList: - * @ctx: the pointer to C14N context object + * @ctx: the pointer to C14N context object * @cur: the node to start from - * + * * Processes all nodes in the row starting from cur. * * Returns non-negative value on success or negative value on fail @@ -1432,7 +1731,7 @@ xmlC14NProcessNodeList(xmlC14NCtxPtr ctx, xmlNodePtr cur) /** * xmlC14NFreeCtx: * @ctx: the pointer to C14N context object - * + * * Cleanups the C14N context object. */ @@ -1452,28 +1751,29 @@ xmlC14NFreeCtx(xmlC14NCtxPtr ctx) /** * xmlC14NNewCtx: - * @doc: the XML document for canonization - * @is_visible_callback:the function to use to determine is node visible + * @doc: the XML document for canonization + * @is_visible_callback:the function to use to determine is node visible * or not - * @user_data: the first parameter for @is_visible_callback function + * @user_data: the first parameter for @is_visible_callback function * (in most cases, it is nodes set) - * @inclusive_ns_prefixe the list of inclusive namespace prefixes + * @mode: the c14n mode (see @xmlC14NMode) + * @inclusive_ns_prefixe the list of inclusive namespace prefixes * ended with a NULL or NULL if there is no - * inclusive namespaces (only for exclusive + * inclusive namespaces (only for ` * canonicalization) - * @with_comments: include comments in the result (!=0) or not (==0) - * @buf: the output buffer to store canonical XML; this + * @with_comments: include comments in the result (!=0) or not (==0) + * @buf: the output buffer to store canonical XML; this * buffer MUST have encoder==NULL because C14N requires * UTF-8 output - * + * * Creates new C14N context object to store C14N parameters. * * Returns pointer to newly created object (success) or NULL (fail) */ static xmlC14NCtxPtr -xmlC14NNewCtx(xmlDocPtr doc, +xmlC14NNewCtx(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, void* user_data, - int exclusive, xmlChar ** inclusive_ns_prefixes, + xmlC14NMode mode, xmlChar ** inclusive_ns_prefixes, int with_comments, xmlOutputBufferPtr buf) { xmlC14NCtxPtr ctx = NULL; @@ -1531,11 +1831,11 @@ xmlC14NNewCtx(xmlDocPtr doc, } /* - * Set "exclusive" flag, create a nodes set for namespaces - * stack and remember list of incluseve prefixes + * Set "mode" flag and remember list of incluseve prefixes + * for exclusive c14n */ - if (exclusive) { - ctx->exclusive = 1; + ctx->mode = mode; + if(xmlC14NIsExclusive(ctx)) { ctx->inclusive_ns_prefixes = inclusive_ns_prefixes; } return (ctx); @@ -1543,34 +1843,34 @@ xmlC14NNewCtx(xmlDocPtr doc, /** * xmlC14NExecute: - * @doc: the XML document for canonization - * @is_visible_callback:the function to use to determine is node visible + * @doc: the XML document for canonization + * @is_visible_callback:the function to use to determine is node visible * or not - * @user_data: the first parameter for @is_visible_callback function + * @user_data: the first parameter for @is_visible_callback function * (in most cases, it is nodes set) - * @exclusive: the exclusive flag (0 - non-exclusive canonicalization; - * otherwise - exclusive canonicalization) - * @inclusive_ns_prefixes: the list of inclusive namespace prefixes + * @mode: the c14n mode (see @xmlC14NMode) + * @inclusive_ns_prefixes: the list of inclusive namespace prefixes * ended with a NULL or NULL if there is no - * inclusive namespaces (only for exclusive + * inclusive namespaces (only for exclusive * canonicalization, ignored otherwise) - * @with_comments: include comments in the result (!=0) or not (==0) - * @buf: the output buffer to store canonical XML; this + * @with_comments: include comments in the result (!=0) or not (==0) + * @buf: the output buffer to store canonical XML; this * buffer MUST have encoder==NULL because C14N requires * UTF-8 output - * + * * Dumps the canonized image of given XML document into the provided buffer. * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n) * - * Returns non-negative value on success or a negative value on fail + * Returns non-negative value on success or a negative value on fail */ -int +int xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, - void* user_data, int exclusive, xmlChar **inclusive_ns_prefixes, + void* user_data, int mode, xmlChar **inclusive_ns_prefixes, int with_comments, xmlOutputBufferPtr buf) { xmlC14NCtxPtr ctx; + xmlC14NMode c14n_mode = XML_C14N_1_0; int ret; if ((buf == NULL) || (doc == NULL)) { @@ -1578,6 +1878,19 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, return (-1); } + /* for backward compatibility, we have to have "mode" as "int" + and here we check that user gives valid value */ + switch(mode) { + case XML_C14N_1_0: + case XML_C14N_EXCLUSIVE_1_0: + case XML_C14N_1_1: + c14n_mode = (xmlC14NMode)mode; + break; + default: + xmlC14NErrParam("invalid mode for executing c14n"); + return (-1); + } + /* * Validate the encoding output buffer encoding */ @@ -1587,9 +1900,9 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, return (-1); } - ctx = xmlC14NNewCtx(doc, is_visible_callback, user_data, - exclusive, inclusive_ns_prefixes, - with_comments, buf); + ctx = xmlC14NNewCtx(doc, is_visible_callback, user_data, + c14n_mode, inclusive_ns_prefixes, + with_comments, buf); if (ctx == NULL) { xmlC14NErr(NULL, (xmlNodePtr) doc, XML_C14N_CREATE_CTXT, "xmlC14NExecute: unable to create C14N context\n"); @@ -1598,12 +1911,12 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, - /* + /* * Root Node - * The root node is the parent of the top-level document element. The - * result of processing each of its child nodes that is in the node-set - * in document order. The root node does not generate a byte order mark, - * XML declaration, nor anything from within the document type + * The root node is the parent of the top-level document element. The + * result of processing each of its child nodes that is in the node-set + * in document order. The root node does not generate a byte order mark, + * XML declaration, nor anything from within the document type * declaration. */ if (doc->children != NULL) { @@ -1625,7 +1938,7 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, return (-1); } - /* + /* * Cleanup */ xmlC14NFreeCtx(ctx); @@ -1634,34 +1947,33 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, /** * xmlC14NDocSaveTo: - * @doc: the XML document for canonization - * @nodes: the nodes set to be included in the canonized image - * or NULL if all document nodes should be included - * @exclusive: the exclusive flag (0 - non-exclusive canonicalization; - * otherwise - exclusive canonicalization) - * @inclusive_ns_prefixes: the list of inclusive namespace prefixes + * @doc: the XML document for canonization + * @nodes: the nodes set to be included in the canonized image + * or NULL if all document nodes should be included + * @mode: the c14n mode (see @xmlC14NMode) + * @inclusive_ns_prefixes: the list of inclusive namespace prefixes * ended with a NULL or NULL if there is no - * inclusive namespaces (only for exclusive + * inclusive namespaces (only for exclusive * canonicalization, ignored otherwise) - * @with_comments: include comments in the result (!=0) or not (==0) - * @buf: the output buffer to store canonical XML; this + * @with_comments: include comments in the result (!=0) or not (==0) + * @buf: the output buffer to store canonical XML; this * buffer MUST have encoder==NULL because C14N requires * UTF-8 output - * + * * Dumps the canonized image of given XML document into the provided buffer. * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n) * - * Returns non-negative value on success or a negative value on fail + * Returns non-negative value on success or a negative value on fail */ int xmlC14NDocSaveTo(xmlDocPtr doc, xmlNodeSetPtr nodes, - int exclusive, xmlChar ** inclusive_ns_prefixes, + int mode, xmlChar ** inclusive_ns_prefixes, int with_comments, xmlOutputBufferPtr buf) { - return(xmlC14NExecute(doc, + return(xmlC14NExecute(doc, (xmlC14NIsVisibleCallback)xmlC14NIsNodeInNodeset, nodes, - exclusive, + mode, inclusive_ns_prefixes, with_comments, buf)); @@ -1670,29 +1982,28 @@ xmlC14NDocSaveTo(xmlDocPtr doc, xmlNodeSetPtr nodes, /** * xmlC14NDocDumpMemory: - * @doc: the XML document for canonization - * @nodes: the nodes set to be included in the canonized image - * or NULL if all document nodes should be included - * @exclusive: the exclusive flag (0 - non-exclusive canonicalization; - * otherwise - exclusive canonicalization) - * @inclusive_ns_prefixes: the list of inclusive namespace prefixes + * @doc: the XML document for canonization + * @nodes: the nodes set to be included in the canonized image + * or NULL if all document nodes should be included + * @mode: the c14n mode (see @xmlC14NMode) + * @inclusive_ns_prefixes: the list of inclusive namespace prefixes * ended with a NULL or NULL if there is no - * inclusive namespaces (only for exclusive + * inclusive namespaces (only for exclusive * canonicalization, ignored otherwise) - * @with_comments: include comments in the result (!=0) or not (==0) - * @doc_txt_ptr: the memory pointer for allocated canonical XML text; + * @with_comments: include comments in the result (!=0) or not (==0) + * @doc_txt_ptr: the memory pointer for allocated canonical XML text; * the caller of this functions is responsible for calling - * xmlFree() to free allocated memory - * + * xmlFree() to free allocated memory + * * Dumps the canonized image of given XML document into memory. * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n) * - * Returns the number of bytes written on success or a negative value on fail + * Returns the number of bytes written on success or a negative value on fail */ int xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, - int exclusive, xmlChar ** inclusive_ns_prefixes, + int mode, xmlChar ** inclusive_ns_prefixes, int with_comments, xmlChar ** doc_txt_ptr) { int ret; @@ -1706,7 +2017,7 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, *doc_txt_ptr = NULL; /* - * create memory buffer with UTF8 (default) encoding + * create memory buffer with UTF8 (default) encoding */ buf = xmlAllocOutputBuffer(NULL); if (buf == NULL) { @@ -1717,7 +2028,7 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, /* * canonize document and write to buffer */ - ret = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, + ret = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, with_comments, buf); if (ret < 0) { xmlC14NErrInternal("saving doc to output buffer"); @@ -1725,9 +2036,9 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, return (-1); } - ret = buf->buffer->use; + ret = xmlBufUse(buf->buffer); if (ret > 0) { - *doc_txt_ptr = xmlStrndup(buf->buffer->content, ret); + *doc_txt_ptr = xmlStrndup(xmlBufContent(buf->buffer), ret); } (void) xmlOutputBufferClose(buf); @@ -1740,31 +2051,30 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, /** * xmlC14NDocSave: - * @doc: the XML document for canonization - * @nodes: the nodes set to be included in the canonized image - * or NULL if all document nodes should be included - * @exclusive: the exclusive flag (0 - non-exclusive canonicalization; - * otherwise - exclusive canonicalization) - * @inclusive_ns_prefixes: the list of inclusive namespace prefixes + * @doc: the XML document for canonization + * @nodes: the nodes set to be included in the canonized image + * or NULL if all document nodes should be included + * @mode: the c14n mode (see @xmlC14NMode) + * @inclusive_ns_prefixes: the list of inclusive namespace prefixes * ended with a NULL or NULL if there is no - * inclusive namespaces (only for exclusive + * inclusive namespaces (only for exclusive * canonicalization, ignored otherwise) - * @with_comments: include comments in the result (!=0) or not (==0) - * @filename: the filename to store canonical XML image - * @compression: the compression level (zlib requred): + * @with_comments: include comments in the result (!=0) or not (==0) + * @filename: the filename to store canonical XML image + * @compression: the compression level (zlib requred): * -1 - libxml default, - * 0 - uncompressed, + * 0 - uncompressed, * >0 - compression level - * + * * Dumps the canonized image of given XML document into the file. * For details see "Canonical XML" (http://www.w3.org/TR/xml-c14n) or * "Exclusive XML Canonicalization" (http://www.w3.org/TR/xml-exc-c14n) * - * Returns the number of bytes written success or a negative value on fail + * Returns the number of bytes written success or a negative value on fail */ int xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, - int exclusive, xmlChar ** inclusive_ns_prefixes, + int mode, xmlChar ** inclusive_ns_prefixes, int with_comments, const char *filename, int compression) { xmlOutputBufferPtr buf; @@ -1779,7 +2089,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, compression = xmlGetCompressMode(); #endif - /* + /* * save the content to a temp buffer, use default UTF8 encoding. */ buf = xmlOutputBufferCreateFilename(filename, NULL, compression); @@ -1791,7 +2101,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, /* * canonize document and write to buffer */ - ret = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, + ret = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, with_comments, buf); if (ret < 0) { xmlC14NErrInternal("cannicanize document to buffer"); @@ -1799,8 +2109,8 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, return (-1); } - /* - * get the numbers of bytes written + /* + * get the numbers of bytes written */ ret = xmlOutputBufferClose(buf); return (ret); @@ -1814,14 +2124,14 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, #define growBufferReentrant() { \ buffer_size *= 2; \ buffer = (xmlChar *) \ - xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \ + xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \ if (buffer == NULL) { \ xmlC14NErrMemory("growing buffer"); \ return(NULL); \ } \ } -/** +/** * xmlC11NNormalizeString: * @input: the input string * @mode: the normalization mode (attribute, comment, PI or text) @@ -1919,7 +2229,7 @@ xmlC11NNormalizeString(const xmlChar * input, } cur++; } - *out++ = 0; + *out = 0; return (buffer); } #endif /* LIBXML_OUTPUT_ENABLED */ diff --git a/gnulib-local/lib/libxml/c14n.in.h b/gnulib-local/lib/libxml/c14n.in.h index 9f4c6c0..b8971d9 100644 --- a/gnulib-local/lib/libxml/c14n.in.h +++ b/gnulib-local/lib/libxml/c14n.in.h @@ -2,30 +2,30 @@ * Summary: Provide Canonical XML and Exclusive XML Canonicalization * Description: the c14n modules provides a * - * "Canonical XML" implementation + * "Canonical XML" implementation * http://www.w3.org/TR/xml-c14n - * + * * and an * * "Exclusive XML Canonicalization" implementation * http://www.w3.org/TR/xml-exc-c14n - + * Copy: See Copyright for the status of this software. - * + * * Author: Aleksey Sanin */ #ifndef __XML_C14N_H__ -#define __XML_C14N_H__ +#define __XML_C14N_H__ #ifdef LIBXML_C14N_ENABLED #ifdef LIBXML_OUTPUT_ENABLED #ifdef __cplusplus extern "C" { -#endif /* __cplusplus */ +#endif /* __cplusplus */ #include #include -#include +#include /* * XML Canonicazation @@ -37,44 +37,55 @@ extern "C" { * Canonical form of an XML document could be created if and only if * a) default attributes (if any) are added to all nodes * b) all character and parsed entity references are resolved - * In order to achive this in libxml2 the document MUST be loaded with + * In order to achive this in libxml2 the document MUST be loaded with * following global setings: - * + * * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; * xmlSubstituteEntitiesDefault(1); * * or corresponding parser context setting: * xmlParserCtxtPtr ctxt; - * - * ... + * + * ... * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; * ctxt->replaceEntities = 1; * ... */ +/* + * xmlC14NMode: + * + * Predefined values for C14N modes + * + */ +typedef enum { + XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */ + XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */ + XML_C14N_1_1 = 2 /* C14N 1.1 spec */ +} xmlC14NMode; -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlC14NDocSaveTo (xmlDocPtr doc, xmlNodeSetPtr nodes, - int exclusive, + int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes, - int with_comments, + int with_comments, xmlOutputBufferPtr buf); XMLPUBFUN int XMLCALL xmlC14NDocDumpMemory (xmlDocPtr doc, xmlNodeSetPtr nodes, - int exclusive, + int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes, - int with_comments, + int with_comments, xmlChar **doc_txt_ptr); XMLPUBFUN int XMLCALL xmlC14NDocSave (xmlDocPtr doc, xmlNodeSetPtr nodes, - int exclusive, + int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes, - int with_comments, + int with_comments, const char* filename, int compression); @@ -82,17 +93,27 @@ XMLPUBFUN int XMLCALL /** * This is the core C14N function */ -typedef int (*xmlC14NIsVisibleCallback) (void* user_data, +/** + * xmlC14NIsVisibleCallback: + * @user_data: user data + * @node: the curent node + * @parent: the parent node + * + * Signature for a C14N callback on visible nodes + * + * Returns 1 if the node should be included + */ +typedef int (*xmlC14NIsVisibleCallback) (void* user_data, xmlNodePtr node, xmlNodePtr parent); XMLPUBFUN int XMLCALL xmlC14NExecute (xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, - void* user_data, - int exclusive, + void* user_data, + int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes, - int with_comments, + int with_comments, xmlOutputBufferPtr buf); #ifdef __cplusplus diff --git a/gnulib-local/lib/libxml/catalog.c b/gnulib-local/lib/libxml/catalog.c index 5456094..5773db3 100644 --- a/gnulib-local/lib/libxml/catalog.c +++ b/gnulib-local/lib/libxml/catalog.c @@ -1,5 +1,5 @@ /** - * catalog.c: set of generic Catalog related routines + * catalog.c: set of generic Catalog related routines * * Reference: SGML Open Technical Resolution TR9401:1997. * http://www.jclark.com/sp/catalog.htm @@ -41,9 +41,17 @@ #include #include +#include "buf.h" + #define MAX_DELEGATE 50 #define MAX_CATAL_DEPTH 50 +#ifdef _WIN32 +# define PATH_SEAPARATOR ';' +#else +# define PATH_SEAPARATOR ':' +#endif + /** * TODO: * @@ -54,7 +62,7 @@ *> values "system" and "public". I have made the default be "system" to *> match yours. */ -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); @@ -71,9 +79,17 @@ #if defined(_WIN32) && defined(_MSC_VER) #undef XML_XML_DEFAULT_CATALOG static char XML_XML_DEFAULT_CATALOG[256] = "file:///etc/xml/catalog"; +#if defined(_WIN32_WCE) +/* Windows CE don't have a A variant */ +#define GetModuleHandleA GetModuleHandle +#define GetModuleFileNameA GetModuleFileName +#else +#if !defined(_WINDOWS_) void* __stdcall GetModuleHandleA(const char*); unsigned long __stdcall GetModuleFileNameA(void*, char*, unsigned long); #endif +#endif +#endif static xmlChar *xmlCatalogNormalizePublic(const xmlChar *pubID); static int xmlExpandCatalog(xmlCatalogPtr catal, const char *filename); @@ -194,7 +210,7 @@ static int xmlCatalogInitialized = 0; /************************************************************************ * * - * Catalog error handlers * + * Catalog error handlers * * * ************************************************************************/ @@ -247,9 +263,9 @@ xmlCatalogErr(xmlCatalogEntryPtr catal, xmlNodePtr node, int error, * @name: name of the entry * @value: value of the entry * @prefer: the PUBLIC vs. SYSTEM current preference value - * @group: for members of a group, the group entry + * @group: for members of a group, the group entry * - * create a new Catalog entry, this type is shared both by XML and + * create a new Catalog entry, this type is shared both by XML and * SGML catalogs, but the acceptable types values differs. * * Returns the xmlCatalogEntryPtr or NULL in case of error @@ -387,7 +403,7 @@ xmlFreeCatalogHashEntryList(xmlCatalogEntryPtr catal) { * @type: type of catalog * @prefer: the PUBLIC vs. SYSTEM current preference value * - * create a new Catalog, this type is shared both by XML and + * create a new Catalog, this type is shared both by XML and * SGML catalogs, but the acceptable types values differs. * * Returns the xmlCatalogPtr or NULL in case of error @@ -555,7 +571,7 @@ static void xmlDumpXMLCatalogNode(xmlCatalogEntryPtr catal, xmlNodePtr catalog, xns = xmlSearchNsByHref(doc, node, XML_XML_NAMESPACE); if (xns != NULL) xmlSetNsProp(node, xns, BAD_CAST "base", - cur->value); + cur->value); } switch (cur->prefer) { case XML_CATA_PREFER_NONE: @@ -673,7 +689,7 @@ BAD_CAST "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"); xmlAddChild((xmlNodePtr) doc, catalog); xmlDumpXMLCatalogNode(catal, catalog, doc, ns, NULL); - + /* * reserialize it */ @@ -810,7 +826,7 @@ xmlCatalogUnWrapURN(const xmlChar *urn) { if (xmlStrncmp(urn, BAD_CAST XML_URN_PUBID, sizeof(XML_URN_PUBID) - 1)) return(NULL); urn += sizeof(XML_URN_PUBID) - 1; - + while (*urn != 0) { if (i > sizeof(result) - 4) break; @@ -900,10 +916,7 @@ xmlParseCatalogFile(const char *filename) { inputStream->filename = (char *) xmlCanonicPath((const xmlChar *)filename); inputStream->buf = buf; - inputStream->base = inputStream->buf->buffer->content; - inputStream->cur = inputStream->buf->buffer->content; - inputStream->end = - &inputStream->buf->buffer->content[inputStream->buf->buffer->use]; + xmlBufResetInput(buf->buffer, inputStream); inputPush(ctxt, inputStream); if ((ctxt->directory == NULL) && (directory == NULL)) @@ -926,7 +939,7 @@ xmlParseCatalogFile(const char *filename) { ctxt->myDoc = NULL; } xmlFreeParserCtxt(ctxt); - + return(ret); } @@ -978,25 +991,27 @@ xmlLoadFileContent(const char *filename) return (NULL); } #endif - content = xmlMallocAtomic(size + 10); + content = (xmlChar*)xmlMallocAtomic(size + 10); if (content == NULL) { xmlCatalogErrMemory("allocating catalog data"); +#ifdef HAVE_STAT + close(fd); +#else + fclose(fd); +#endif return (NULL); } #ifdef HAVE_STAT len = read(fd, content, size); + close(fd); #else len = fread(content, 1, size, fd); + fclose(fd); #endif if (len < 0) { xmlFree(content); return (NULL); } -#ifdef HAVE_STAT - close(fd); -#else - fclose(fd); -#endif content[len] = 0; return(content); @@ -1319,7 +1334,7 @@ xmlParseXMLCatalogNodeList(xmlNodePtr cur, xmlCatalogPrefer prefer, * * Parses the catalog file to extract the XML tree and then analyze the * tree to build a list of Catalog entries corresponding to this catalog - * + * * Returns the resulting Catalog entries list */ static xmlCatalogEntryPtr @@ -1387,19 +1402,17 @@ xmlParseXMLCatalogFile(xmlCatalogPrefer prefer, const xmlChar *filename) { * @catal: an existing but incomplete catalog entry * * Fetch and parse the subcatalog referenced by an entry - * + * * Returns 0 in case of success, -1 otherwise */ static int xmlFetchXMLCatalogFile(xmlCatalogEntryPtr catal) { xmlCatalogEntryPtr doc; - if (catal == NULL) + if (catal == NULL) return(-1); if (catal->URL == NULL) return(-1); - if (catal->children != NULL) - return(-1); /* * lock the whole catalog for modification @@ -1488,7 +1501,7 @@ xmlAddXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *type, xmlCatalogEntryType typ; int doregister = 0; - if ((catal == NULL) || + if ((catal == NULL) || ((catal->type != XML_CATA_CATALOG) && (catal->type != XML_CATA_BROKEN_CATALOG))) return(-1); @@ -1541,7 +1554,7 @@ xmlAddXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *type, NULL, catal->prefer, NULL); if (doregister) { catal->type = XML_CATA_CATALOG; - cur = xmlHashLookup(xmlCatalogXMLFiles, catal->URL); + cur = (xmlCatalogEntryPtr)xmlHashLookup(xmlCatalogXMLFiles, catal->URL); if (cur != NULL) cur->children = catal->children; } @@ -1564,7 +1577,7 @@ xmlDelXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *value) { xmlCatalogEntryPtr cur; int ret = 0; - if ((catal == NULL) || + if ((catal == NULL) || ((catal->type != XML_CATA_CATALOG) && (catal->type != XML_CATA_BROKEN_CATALOG))) return(-1); @@ -1779,7 +1792,7 @@ xmlCatalogXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID, } if (nbList < MAX_DELEGATE) delegates[nbList++] = cur->URL; - + if (cur->children == NULL) { xmlFetchXMLCatalogFile(cur); } @@ -1816,6 +1829,8 @@ xmlCatalogXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID, if (ret != NULL) { catal->depth--; return(ret); + } else if (catal->depth > MAX_CATAL_DEPTH) { + return(NULL); } } } @@ -1856,6 +1871,13 @@ xmlCatalogXMLResolveURI(xmlCatalogEntryPtr catal, const xmlChar *URI) { if (URI == NULL) return(NULL); + if (catal->depth > MAX_CATAL_DEPTH) { + xmlCatalogErr(catal, NULL, XML_CATALOG_RECURSION, + "Detected recursion in catalog %s\n", + catal->name, NULL, NULL); + return(NULL); + } + /* * First tries steps 2/ 3/ 4/ if a system ID is provided. */ @@ -1983,7 +2005,7 @@ xmlCatalogListXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID, xmlChar *ret = NULL; xmlChar *urnID = NULL; xmlChar *normid; - + if (catal == NULL) return(NULL); if ((pubID == NULL) && (sysID == NULL)) @@ -1992,7 +2014,7 @@ xmlCatalogListXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID, normid = xmlCatalogNormalizePublic(pubID); if (normid != NULL) pubID = (*normid != 0 ? normid : NULL); - + if (!xmlStrncmp(pubID, BAD_CAST XML_URN_PUBID, sizeof(XML_URN_PUBID) - 1)) { urnID = xmlCatalogUnWrapURN(pubID); if (xmlDebugCatalogs) { @@ -2041,16 +2063,18 @@ xmlCatalogListXMLResolve(xmlCatalogEntryPtr catal, const xmlChar *pubID, if (catal->children != NULL) { ret = xmlCatalogXMLResolve(catal->children, pubID, sysID); if (ret != NULL) { - if (normid != NULL) - xmlFree(normid); - return(ret); - } + break; + } else if ((catal->children != NULL) && + (catal->children->depth > MAX_CATAL_DEPTH)) { + ret = NULL; + break; + } } } catal = catal->next; } - if (normid != NULL) - xmlFree(normid); + if (normid != NULL) + xmlFree(normid); return(ret); } @@ -2070,7 +2094,7 @@ static xmlChar * xmlCatalogListXMLResolveURI(xmlCatalogEntryPtr catal, const xmlChar *URI) { xmlChar *ret = NULL; xmlChar *urnID = NULL; - + if (catal == NULL) return(NULL); if (URI == NULL) @@ -2130,7 +2154,7 @@ xmlCatalogListXMLResolveURI(xmlCatalogEntryPtr catal, const xmlChar *URI) { */ static const xmlChar * xmlParseSGMLCatalogComment(const xmlChar *cur) { - if ((cur[0] != '-') || (cur[1] != '-')) + if ((cur[0] != '-') || (cur[1] != '-')) return(cur); SKIP(2); while ((cur[0] != 0) && ((cur[0] != '-') || ((cur[1] != '-')))) @@ -2593,6 +2617,8 @@ xmlCatalogSGMLResolve(xmlCatalogPtr catal, const xmlChar *pubID, return(ret); if (sysID != NULL) ret = xmlCatalogGetSGMLSystem(catal->sgml, sysID); + if (ret != NULL) + return(ret); return(NULL); } @@ -2663,7 +2689,7 @@ xmlLoadACatalog(const char *filename) first = content; - + while ((*first != 0) && (*first != '-') && (*first != '<') && (!(((*first >= 'A') && (*first <= 'Z')) || ((*first >= 'a') && (*first <= 'z'))))) @@ -2758,7 +2784,7 @@ xmlACatalogResolveSystem(xmlCatalogPtr catal, const xmlChar *sysID) { if ((sysID == NULL) || (catal == NULL)) return(NULL); - + if (xmlDebugCatalogs) xmlGenericError(xmlGenericErrorContext, "Resolve sysID %s\n", sysID); @@ -2793,7 +2819,7 @@ xmlACatalogResolvePublic(xmlCatalogPtr catal, const xmlChar *pubID) { if ((pubID == NULL) || (catal == NULL)) return(NULL); - + if (xmlDebugCatalogs) xmlGenericError(xmlGenericErrorContext, "Resolve pubID %s\n", pubID); @@ -2889,7 +2915,7 @@ xmlACatalogResolveURI(xmlCatalogPtr catal, const xmlChar *URI) { sgml = xmlCatalogSGMLResolve(catal, NULL, URI); if (sgml != NULL) - sgml = xmlStrdup(sgml); + ret = xmlStrdup(sgml); } return(ret); } @@ -2912,7 +2938,7 @@ xmlACatalogDump(xmlCatalogPtr catal, FILE *out) { } else { xmlHashScan(catal->sgml, (xmlHashScanner) xmlCatalogDumpEntry, out); - } + } } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -2920,7 +2946,7 @@ xmlACatalogDump(xmlCatalogPtr catal, FILE *out) { * xmlACatalogAdd: * @catal: a Catalog * @type: the type of record to add to the catalog - * @orig: the system, public or prefix to match + * @orig: the system, public or prefix to match * @replace: the replacement value for the match * * Add an entry in the catalog, it may overwrite existing but @@ -2979,7 +3005,7 @@ xmlACatalogRemove(xmlCatalogPtr catal, const xmlChar *value) { (xmlHashDeallocator) xmlFreeCatalogEntry); if (res == 0) res = 1; - } + } return(res); } @@ -3038,7 +3064,7 @@ xmlCatalogIsEmpty(xmlCatalogPtr catal) { return(1); if (res < 0) return(-1); - } + } return(0); } @@ -3061,7 +3087,7 @@ xmlInitializeCatalogData(void) { if (xmlCatalogInitialized != 0) return; - if (getenv("XML_DEBUG_CATALOG")) + if (getenv("XML_DEBUG_CATALOG")) xmlDebugCatalogs = 1; xmlCatalogMutex = xmlNewRMutex(); @@ -3082,7 +3108,7 @@ xmlInitializeCatalog(void) { xmlInitializeCatalogData(); xmlRMutexLock(xmlCatalogMutex); - if (getenv("XML_DEBUG_CATALOG")) + if (getenv("XML_DEBUG_CATALOG")) xmlDebugCatalogs = 1; if (xmlDefaultCatalog == NULL) { @@ -3105,12 +3131,12 @@ xmlInitializeCatalog(void) { unsigned long len = GetModuleFileNameA(hmodule, buf, 255); if (len != 0) { char* p = &(buf[len]); - while (*p != '\\' && p > buf) + while (*p != '\\' && p > buf) p--; if (p != buf) { xmlChar* uri; strncpy(p, "\\..\\etc\\catalog", 255 - (p - buf)); - uri = xmlCanonicPath(buf); + uri = xmlCanonicPath((const xmlChar*)buf); if (uri != NULL) { strncpy(XML_XML_DEFAULT_CATALOG, uri, 255); xmlFree(uri); @@ -3124,15 +3150,15 @@ xmlInitializeCatalog(void) { catalogs = XML_XML_DEFAULT_CATALOG; #endif - catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE, + catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE, xmlCatalogDefaultPrefer); if (catal != NULL) { - /* the XML_CATALOG_FILES envvar is allowed to contain a + /* the XML_CATALOG_FILES envvar is allowed to contain a space-separated list of entries. */ cur = catalogs; nextent = &catal->xml; while (*cur != '\0') { - while (xmlIsBlank_ch(*cur)) + while (xmlIsBlank_ch(*cur)) cur++; if (*cur != 0) { paths = cur; @@ -3209,6 +3235,9 @@ xmlLoadCatalogs(const char *pathss) { const char *cur; const char *paths; xmlChar *path; +#ifdef _WIN32 + int i, iLen; +#endif if (pathss == NULL) return; @@ -3218,15 +3247,23 @@ xmlLoadCatalogs(const char *pathss) { while (xmlIsBlank_ch(*cur)) cur++; if (*cur != 0) { paths = cur; - while ((*cur != 0) && (*cur != ':') && (!xmlIsBlank_ch(*cur))) + while ((*cur != 0) && (*cur != PATH_SEAPARATOR) && (!xmlIsBlank_ch(*cur))) cur++; path = xmlStrndup((const xmlChar *)paths, cur - paths); +#ifdef _WIN32 + iLen = strlen((const char*)path); + for(i = 0; i < iLen; i++) { + if(path[i] == '\\') { + path[i] = '/'; + } + } +#endif if (path != NULL) { xmlLoadCatalog((const char *) path); xmlFree(path); } } - while (*cur == ':') + while (*cur == PATH_SEAPARATOR) cur++; } } @@ -3246,7 +3283,7 @@ xmlCatalogCleanup(void) { xmlGenericError(xmlGenericErrorContext, "Catalogs cleanup\n"); if (xmlCatalogXMLFiles != NULL) - xmlHashFree(xmlCatalogXMLFiles, + xmlHashFree(xmlCatalogXMLFiles, (xmlHashDeallocator)xmlFreeCatalogHashEntryList); xmlCatalogXMLFiles = NULL; if (xmlDefaultCatalog != NULL) @@ -3361,7 +3398,7 @@ xmlCatalogDump(FILE *out) { /** * xmlCatalogAdd: * @type: the type of record to add to the catalog - * @orig: the system, public or prefix to match + * @orig: the system, public or prefix to match * @replace: the replacement value for the match * * Add an entry in the catalog, it may overwrite existing but @@ -3392,7 +3429,7 @@ xmlCatalogAdd(const xmlChar *type, const xmlChar *orig, const xmlChar *replace) xmlRMutexUnlock(xmlCatalogMutex); return(0); - } + } res = xmlACatalogAdd(xmlDefaultCatalog, type, orig, replace); xmlRMutexUnlock(xmlCatalogMutex); @@ -3518,8 +3555,8 @@ xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer) { xmlGenericError(xmlGenericErrorContext, "Setting catalog preference to SYSTEM\n"); break; - case XML_CATA_PREFER_NONE: - break; + default: + return(ret); } } xmlCatalogDefaultPrefer = prefer; @@ -3580,7 +3617,7 @@ xmlCatalogFreeLocal(void *catalogs) { * * Returns the updated list */ -void * +void * xmlCatalogAddLocal(void *catalogs, const xmlChar *URL) { xmlCatalogEntryPtr catal, add; @@ -3600,7 +3637,7 @@ xmlCatalogAddLocal(void *catalogs, const xmlChar *URL) { return(catalogs); catal = (xmlCatalogEntryPtr) catalogs; - if (catal == NULL) + if (catal == NULL) return((void *) add); while (catal->next != NULL) @@ -3615,7 +3652,7 @@ xmlCatalogAddLocal(void *catalogs, const xmlChar *URL) { * @pubID: the public ID string * @sysID: the system ID string * - * Do a complete resolution lookup of an External Identifier using a + * Do a complete resolution lookup of an External Identifier using a * document's private catalog list * * Returns the URI of the resource or NULL if not found, it must be freed @@ -3660,7 +3697,7 @@ xmlCatalogLocalResolve(void *catalogs, const xmlChar *pubID, * @catalogs: a document's list of catalogs * @URI: the URI * - * Do a complete resolution lookup of an URI using a + * Do a complete resolution lookup of an URI using a * document's private catalog list * * Returns the URI of the resource or NULL if not found, it must be freed @@ -3721,7 +3758,7 @@ xmlCatalogGetSystem(const xmlChar *sysID) { if (sysID == NULL) return(NULL); - + /* * Check first the XML catalogs */ @@ -3765,7 +3802,7 @@ xmlCatalogGetPublic(const xmlChar *pubID) { if (pubID == NULL) return(NULL); - + /* * Check first the XML catalogs */ diff --git a/gnulib-local/lib/libxml/catalog.in.h b/gnulib-local/lib/libxml/catalog.in.h index b444137..5a13f51 100644 --- a/gnulib-local/lib/libxml/catalog.in.h +++ b/gnulib-local/lib/libxml/catalog.in.h @@ -68,111 +68,111 @@ typedef xmlCatalog *xmlCatalogPtr; */ XMLPUBFUN xmlCatalogPtr XMLCALL xmlNewCatalog (int sgml); -XMLPUBFUN xmlCatalogPtr XMLCALL +XMLPUBFUN xmlCatalogPtr XMLCALL xmlLoadACatalog (const char *filename); -XMLPUBFUN xmlCatalogPtr XMLCALL +XMLPUBFUN xmlCatalogPtr XMLCALL xmlLoadSGMLSuperCatalog (const char *filename); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlConvertSGMLCatalog (xmlCatalogPtr catal); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlACatalogAdd (xmlCatalogPtr catal, const xmlChar *type, const xmlChar *orig, const xmlChar *replace); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlACatalogRemove (xmlCatalogPtr catal, const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolve (xmlCatalogPtr catal, const xmlChar *pubID, const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolveSystem(xmlCatalogPtr catal, const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolvePublic(xmlCatalogPtr catal, const xmlChar *pubID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlACatalogResolveURI (xmlCatalogPtr catal, const xmlChar *URI); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlACatalogDump (xmlCatalogPtr catal, FILE *out); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeCatalog (xmlCatalogPtr catal); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCatalogIsEmpty (xmlCatalogPtr catal); /* * Global operations. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlInitializeCatalog (void); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlLoadCatalog (const char *filename); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlLoadCatalogs (const char *paths); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCatalogCleanup (void); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCatalogDump (FILE *out); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolve (const xmlChar *pubID, const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolveSystem (const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolvePublic (const xmlChar *pubID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogResolveURI (const xmlChar *URI); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCatalogAdd (const xmlChar *type, const xmlChar *orig, const xmlChar *replace); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCatalogRemove (const xmlChar *value); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlParseCatalogFile (const char *filename); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCatalogConvert (void); /* * Strictly minimal interfaces for per-document catalogs used * by the parser. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCatalogFreeLocal (void *catalogs); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlCatalogAddLocal (void *catalogs, const xmlChar *URL); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogLocalResolve (void *catalogs, const xmlChar *pubID, const xmlChar *sysID); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlCatalogLocalResolveURI(void *catalogs, const xmlChar *URI); /* * Preference settings. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCatalogSetDebug (int level); -XMLPUBFUN xmlCatalogPrefer XMLCALL +XMLPUBFUN xmlCatalogPrefer XMLCALL xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCatalogSetDefaults (xmlCatalogAllow allow); -XMLPUBFUN xmlCatalogAllow XMLCALL +XMLPUBFUN xmlCatalogAllow XMLCALL xmlCatalogGetDefaults (void); /* DEPRECATED interfaces */ -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlCatalogGetSystem (const xmlChar *sysID); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlCatalogGetPublic (const xmlChar *pubID); #ifdef __cplusplus diff --git a/gnulib-local/lib/libxml/chvalid.c b/gnulib-local/lib/libxml/chvalid.c index 00dd962..06e8db0 100644 --- a/gnulib-local/lib/libxml/chvalid.c +++ b/gnulib-local/lib/libxml/chvalid.c @@ -46,109 +46,109 @@ const unsigned char xmlIsPubidChar_tab[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static const xmlChSRange xmlIsBaseChar_srng[] = { {0x100, 0x131}, - {0x134, 0x13e}, {0x141, 0x148}, {0x14a, 0x17e}, {0x180, 0x1c3}, - {0x1cd, 0x1f0}, {0x1f4, 0x1f5}, {0x1fa, 0x217}, {0x250, 0x2a8}, - {0x2bb, 0x2c1}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c}, - {0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3d6}, {0x3da, 0x3da}, - {0x3dc, 0x3dc}, {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3f3}, - {0x401, 0x40c}, {0x40e, 0x44f}, {0x451, 0x45c}, {0x45e, 0x481}, - {0x490, 0x4c4}, {0x4c7, 0x4c8}, {0x4cb, 0x4cc}, {0x4d0, 0x4eb}, - {0x4ee, 0x4f5}, {0x4f8, 0x4f9}, {0x531, 0x556}, {0x559, 0x559}, - {0x561, 0x586}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, - {0x641, 0x64a}, {0x671, 0x6b7}, {0x6ba, 0x6be}, {0x6c0, 0x6ce}, - {0x6d0, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x905, 0x939}, - {0x93d, 0x93d}, {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990}, - {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9}, - {0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a}, - {0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33}, - {0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e}, - {0xa72, 0xa74}, {0xa85, 0xa8b}, {0xa8d, 0xa8d}, {0xa8f, 0xa91}, - {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9}, - {0xabd, 0xabd}, {0xae0, 0xae0}, {0xb05, 0xb0c}, {0xb0f, 0xb10}, - {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb36, 0xb39}, - {0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb85, 0xb8a}, - {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c}, - {0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5}, - {0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, - {0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c}, - {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, - {0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, - {0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xe01, 0xe2e}, - {0xe30, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, {0xe81, 0xe82}, - {0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d}, - {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5}, - {0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeae}, {0xeb0, 0xeb0}, - {0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xf40, 0xf47}, - {0xf49, 0xf69}, {0x10a0, 0x10c5}, {0x10d0, 0x10f6}, {0x1100, 0x1100}, - {0x1102, 0x1103}, {0x1105, 0x1107}, {0x1109, 0x1109}, {0x110b, 0x110c}, - {0x110e, 0x1112}, {0x113c, 0x113c}, {0x113e, 0x113e}, {0x1140, 0x1140}, - {0x114c, 0x114c}, {0x114e, 0x114e}, {0x1150, 0x1150}, {0x1154, 0x1155}, - {0x1159, 0x1159}, {0x115f, 0x1161}, {0x1163, 0x1163}, {0x1165, 0x1165}, - {0x1167, 0x1167}, {0x1169, 0x1169}, {0x116d, 0x116e}, {0x1172, 0x1173}, - {0x1175, 0x1175}, {0x119e, 0x119e}, {0x11a8, 0x11a8}, {0x11ab, 0x11ab}, - {0x11ae, 0x11af}, {0x11b7, 0x11b8}, {0x11ba, 0x11ba}, {0x11bc, 0x11c2}, - {0x11eb, 0x11eb}, {0x11f0, 0x11f0}, {0x11f9, 0x11f9}, {0x1e00, 0x1e9b}, - {0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, - {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b}, - {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, - {0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, - {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, - {0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182}, +static const xmlChSRange xmlIsBaseChar_srng[] = { {0x100, 0x131}, + {0x134, 0x13e}, {0x141, 0x148}, {0x14a, 0x17e}, {0x180, 0x1c3}, + {0x1cd, 0x1f0}, {0x1f4, 0x1f5}, {0x1fa, 0x217}, {0x250, 0x2a8}, + {0x2bb, 0x2c1}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c}, + {0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3d6}, {0x3da, 0x3da}, + {0x3dc, 0x3dc}, {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3f3}, + {0x401, 0x40c}, {0x40e, 0x44f}, {0x451, 0x45c}, {0x45e, 0x481}, + {0x490, 0x4c4}, {0x4c7, 0x4c8}, {0x4cb, 0x4cc}, {0x4d0, 0x4eb}, + {0x4ee, 0x4f5}, {0x4f8, 0x4f9}, {0x531, 0x556}, {0x559, 0x559}, + {0x561, 0x586}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, + {0x641, 0x64a}, {0x671, 0x6b7}, {0x6ba, 0x6be}, {0x6c0, 0x6ce}, + {0x6d0, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x905, 0x939}, + {0x93d, 0x93d}, {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990}, + {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9}, + {0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a}, + {0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33}, + {0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e}, + {0xa72, 0xa74}, {0xa85, 0xa8b}, {0xa8d, 0xa8d}, {0xa8f, 0xa91}, + {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9}, + {0xabd, 0xabd}, {0xae0, 0xae0}, {0xb05, 0xb0c}, {0xb0f, 0xb10}, + {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb36, 0xb39}, + {0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb85, 0xb8a}, + {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c}, + {0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5}, + {0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, + {0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c}, + {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, + {0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, + {0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xe01, 0xe2e}, + {0xe30, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, {0xe81, 0xe82}, + {0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d}, + {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5}, + {0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeae}, {0xeb0, 0xeb0}, + {0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xf40, 0xf47}, + {0xf49, 0xf69}, {0x10a0, 0x10c5}, {0x10d0, 0x10f6}, {0x1100, 0x1100}, + {0x1102, 0x1103}, {0x1105, 0x1107}, {0x1109, 0x1109}, {0x110b, 0x110c}, + {0x110e, 0x1112}, {0x113c, 0x113c}, {0x113e, 0x113e}, {0x1140, 0x1140}, + {0x114c, 0x114c}, {0x114e, 0x114e}, {0x1150, 0x1150}, {0x1154, 0x1155}, + {0x1159, 0x1159}, {0x115f, 0x1161}, {0x1163, 0x1163}, {0x1165, 0x1165}, + {0x1167, 0x1167}, {0x1169, 0x1169}, {0x116d, 0x116e}, {0x1172, 0x1173}, + {0x1175, 0x1175}, {0x119e, 0x119e}, {0x11a8, 0x11a8}, {0x11ab, 0x11ab}, + {0x11ae, 0x11af}, {0x11b7, 0x11b8}, {0x11ba, 0x11ba}, {0x11bc, 0x11c2}, + {0x11eb, 0x11eb}, {0x11f0, 0x11f0}, {0x11f9, 0x11f9}, {0x1e00, 0x1e9b}, + {0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, + {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b}, + {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, + {0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, + {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, + {0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182}, {0x3041, 0x3094}, {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}}; const xmlChRangeGroup xmlIsBaseCharGroup = {197, 0, xmlIsBaseChar_srng, (xmlChLRangePtr)0}; -static const xmlChSRange xmlIsChar_srng[] = { {0x100, 0xd7ff}, +static const xmlChSRange xmlIsChar_srng[] = { {0x100, 0xd7ff}, {0xe000, 0xfffd}}; static const xmlChLRange xmlIsChar_lrng[] = { {0x10000, 0x10ffff}}; const xmlChRangeGroup xmlIsCharGroup = {2, 1, xmlIsChar_srng, xmlIsChar_lrng}; -static const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345}, - {0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, - {0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4}, - {0x64b, 0x652}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6dd, 0x6df}, - {0x6e0, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x901, 0x903}, - {0x93c, 0x93c}, {0x93e, 0x94c}, {0x94d, 0x94d}, {0x951, 0x954}, - {0x962, 0x963}, {0x981, 0x983}, {0x9bc, 0x9bc}, {0x9be, 0x9be}, - {0x9bf, 0x9bf}, {0x9c0, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd}, - {0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa02, 0xa02}, {0xa3c, 0xa3c}, - {0xa3e, 0xa3e}, {0xa3f, 0xa3f}, {0xa40, 0xa42}, {0xa47, 0xa48}, - {0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa83}, {0xabc, 0xabc}, - {0xabe, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, {0xb01, 0xb03}, - {0xb3c, 0xb3c}, {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d}, - {0xb56, 0xb57}, {0xb82, 0xb83}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, - {0xbca, 0xbcd}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44}, - {0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83}, - {0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6}, - {0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d}, - {0xd57, 0xd57}, {0xe31, 0xe31}, {0xe34, 0xe3a}, {0xe47, 0xe4e}, - {0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, {0xec8, 0xecd}, - {0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, {0xf39, 0xf39}, - {0xf3e, 0xf3e}, {0xf3f, 0xf3f}, {0xf71, 0xf84}, {0xf86, 0xf8b}, - {0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7}, - {0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f}, +static const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345}, + {0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, + {0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4}, + {0x64b, 0x652}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6dd, 0x6df}, + {0x6e0, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x901, 0x903}, + {0x93c, 0x93c}, {0x93e, 0x94c}, {0x94d, 0x94d}, {0x951, 0x954}, + {0x962, 0x963}, {0x981, 0x983}, {0x9bc, 0x9bc}, {0x9be, 0x9be}, + {0x9bf, 0x9bf}, {0x9c0, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd}, + {0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa02, 0xa02}, {0xa3c, 0xa3c}, + {0xa3e, 0xa3e}, {0xa3f, 0xa3f}, {0xa40, 0xa42}, {0xa47, 0xa48}, + {0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa83}, {0xabc, 0xabc}, + {0xabe, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, {0xb01, 0xb03}, + {0xb3c, 0xb3c}, {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d}, + {0xb56, 0xb57}, {0xb82, 0xb83}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, + {0xbca, 0xbcd}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44}, + {0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83}, + {0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6}, + {0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d}, + {0xd57, 0xd57}, {0xe31, 0xe31}, {0xe34, 0xe3a}, {0xe47, 0xe4e}, + {0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, {0xec8, 0xecd}, + {0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, {0xf39, 0xf39}, + {0xf3e, 0xf3e}, {0xf3f, 0xf3f}, {0xf71, 0xf84}, {0xf86, 0xf8b}, + {0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7}, + {0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f}, {0x3099, 0x3099}, {0x309a, 0x309a}}; const xmlChRangeGroup xmlIsCombiningGroup = {95, 0, xmlIsCombining_srng, (xmlChLRangePtr)0}; -static const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669}, - {0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f}, - {0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f}, - {0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9}, +static const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669}, + {0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f}, + {0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f}, + {0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9}, {0xf20, 0xf29}}; const xmlChRangeGroup xmlIsDigitGroup = {14, 0, xmlIsDigit_srng, (xmlChLRangePtr)0}; -static const xmlChSRange xmlIsExtender_srng[] = { {0x2d0, 0x2d0}, - {0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46}, - {0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e}, +static const xmlChSRange xmlIsExtender_srng[] = { {0x2d0, 0x2d0}, + {0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46}, + {0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e}, {0x30fc, 0x30fe}}; const xmlChRangeGroup xmlIsExtenderGroup = {10, 0, xmlIsExtender_srng, (xmlChLRangePtr)0}; -static const xmlChSRange xmlIsIdeographic_srng[] = { {0x3007, 0x3007}, +static const xmlChSRange xmlIsIdeographic_srng[] = { {0x3007, 0x3007}, {0x3021, 0x3029}, {0x4e00, 0x9fa5}}; const xmlChRangeGroup xmlIsIdeographicGroup = {3, 0, xmlIsIdeographic_srng, (xmlChLRangePtr)0}; diff --git a/gnulib-local/lib/libxml/debugXML.c b/gnulib-local/lib/libxml/debugXML.c index 3985ad3..b05fdff 100644 --- a/gnulib-local/lib/libxml/debugXML.c +++ b/gnulib-local/lib/libxml/debugXML.c @@ -85,7 +85,7 @@ xmlCtxtDumpCleanCtxt(xmlDebugCtxtPtr ctxt ATTRIBUTE_UNUSED) * * Check that a given namespace is in scope on a node. * - * Returns 1 if in scope, -1 in case of argument error, + * Returns 1 if in scope, -1 in case of argument error, * -2 if the namespace is not in scope, and -3 if not on * an ancestor node. */ @@ -141,9 +141,9 @@ xmlCtxtDumpSpaces(xmlDebugCtxtPtr ctxt) return; if ((ctxt->output != NULL) && (ctxt->depth > 0)) { if (ctxt->depth < 50) - fprintf(ctxt->output, &ctxt->shift[100 - 2 * ctxt->depth]); + fprintf(ctxt->output, "%s", &ctxt->shift[100 - 2 * ctxt->depth]); else - fprintf(ctxt->output, ctxt->shift); + fprintf(ctxt->output, "%s", ctxt->shift); } } @@ -162,7 +162,7 @@ xmlDebugErr(xmlDebugCtxtPtr ctxt, int error, const char *msg) NULL, ctxt->node, XML_FROM_CHECK, error, XML_ERR_ERROR, NULL, 0, NULL, NULL, NULL, 0, 0, - msg); + "%s", msg); } static void xmlDebugErr2(xmlDebugCtxtPtr ctxt, int error, const char *msg, int extra) @@ -254,12 +254,16 @@ xmlCtxtCheckName(xmlDebugCtxtPtr ctxt, const xmlChar * name) xmlDebugErr(ctxt, XML_CHECK_NO_NAME, "Name is NULL"); return; } +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) if (xmlValidateName(name, 0)) { xmlDebugErr3(ctxt, XML_CHECK_NOT_NCNAME, "Name is not an NCName '%s'", (const char *) name); } +#endif if ((ctxt->dict != NULL) && - (!xmlDictOwns(ctxt->dict, name))) { + (!xmlDictOwns(ctxt->dict, name)) && + ((ctxt->doc == NULL) || + ((ctxt->doc->parseFlags & (XML_PARSE_SAX1 | XML_PARSE_NODICT)) == 0))) { xmlDebugErr3(ctxt, XML_CHECK_OUTSIDE_DICT, "Name is not from the document dictionnary '%s'", (const char *) name); @@ -309,7 +313,7 @@ xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) { (node != (xmlNodePtr) node->parent->properties)) xmlDebugErr(ctxt, XML_CHECK_NO_PREV, "Attr has no prev and not first of attr list\n"); - + } else if ((node->parent != NULL) && (node->parent->children != node)) xmlDebugErr(ctxt, XML_CHECK_NO_PREV, "Node has no prev and not first of parent list\n"); @@ -320,7 +324,8 @@ xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) { } if (node->next == NULL) { if ((node->parent != NULL) && (node->type != XML_ATTRIBUTE_NODE) && - (node->parent->last != node)) + (node->parent->last != node) && + (node->parent->type == XML_ELEMENT_NODE)) xmlDebugErr(ctxt, XML_CHECK_NO_NEXT, "Node has no next and not last of parent list\n"); } else { @@ -351,7 +356,6 @@ xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) { (node->type != XML_ELEMENT_DECL) && (node->type != XML_ATTRIBUTE_DECL) && (node->type != XML_DTD_NODE) && - (node->type != XML_ELEMENT_DECL) && (node->type != XML_HTML_DOCUMENT_NODE) && (node->type != XML_DOCUMENT_NODE)) { if (node->content != NULL) @@ -1065,7 +1069,7 @@ xmlCtxtDumpNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node) return; } xmlCtxtDumpOneNode(ctxt, node); - if ((node->type != XML_NAMESPACE_DECL) && + if ((node->type != XML_NAMESPACE_DECL) && (node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) { ctxt->depth++; xmlCtxtDumpNodeList(ctxt, node->children); @@ -1600,7 +1604,7 @@ int xmlLsCountNode(xmlNodePtr node) { int ret = 0; xmlNodePtr list = NULL; - + if (node == NULL) return(0); @@ -1641,7 +1645,7 @@ xmlLsCountNode(xmlNodePtr node) { ret = 1; break; } - for (;list != NULL;ret++) + for (;list != NULL;ret++) list = list->next; return(ret); } @@ -1709,11 +1713,11 @@ xmlLsOneNode(FILE *output, xmlNodePtr node) { if (node->type != XML_NAMESPACE_DECL) { if (node->properties != NULL) fprintf(output, "a"); - else + else fprintf(output, "-"); - if (node->nsDef != NULL) + if (node->nsDef != NULL) fprintf(output, "n"); - else + else fprintf(output, "-"); } @@ -1721,8 +1725,11 @@ xmlLsOneNode(FILE *output, xmlNodePtr node) { switch (node->type) { case XML_ELEMENT_NODE: - if (node->name != NULL) + if (node->name != NULL) { + if ((node->ns != NULL) && (node->ns->prefix != NULL)) + fprintf(output, "%s:", node->ns->prefix); fprintf(output, "%s", (const char *) node->name); + } break; case XML_ATTRIBUTE_NODE: if (node->name != NULL) @@ -1780,7 +1787,7 @@ xmlLsOneNode(FILE *output, xmlNodePtr node) { * xmlBoolToText: * @boolval: a bool to turn into text * - * Convenient way to turn bool into text + * Convenient way to turn bool into text * * Returns a pointer to either "True" or "False" */ @@ -1796,7 +1803,7 @@ xmlBoolToText(int boolval) #ifdef LIBXML_XPATH_ENABLED /**************************************************************** * * - * The XML shell related functions * + * The XML shell related functions * * * ****************************************************************/ @@ -2047,7 +2054,7 @@ xmlShellBase(xmlShellCtxtPtr ctxt, if (node == NULL) { fprintf(ctxt->output, "NULL\n"); return (0); - } + } base = xmlNodeGetBase(node->doc, node); @@ -2274,7 +2281,7 @@ xmlShellDir(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, if (node == NULL) { fprintf(ctxt->output, "NULL\n"); return (0); - } + } if ((node->type == XML_DOCUMENT_NODE) || (node->type == XML_HTML_DOCUMENT_NODE)) { xmlDebugDumpDocumentHead(ctxt->output, (xmlDocPtr) node); @@ -2409,7 +2416,7 @@ xmlShellCat(xmlShellCtxtPtr ctxt, char *arg ATTRIBUTE_UNUSED, if (node == NULL) { fprintf(ctxt->output, "NULL\n"); return (0); - } + } if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) { #ifdef LIBXML_HTML_ENABLED if (node->type == XML_HTML_DOCUMENT_NODE) @@ -2693,6 +2700,8 @@ xmlShellDu(xmlShellCtxtPtr ctxt, } else if (node->type == XML_ELEMENT_NODE) { for (i = 0; i < indent; i++) fprintf(ctxt->output, " "); + if ((node->ns) && (node->ns->prefix)) + fprintf(ctxt->output, "%s:", node->ns->prefix); fprintf(ctxt->output, "%s\n", node->name); } else { } @@ -2745,7 +2754,7 @@ xmlShellDu(xmlShellCtxtPtr ctxt, * xmlShellPwd: * @ctxt: the shell context * @buffer: the output buffer - * @node: a node + * @node: a node * @node2: unused * * Implements the XML shell function "pwd" @@ -2790,7 +2799,7 @@ xmlShellPwd(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *buffer, * @input: the line reading function * @output: the output FILE*, defaults to stdout if NULL * - * Implements the XML shell + * Implements the XML shell * This allow to load, validate, view, modify and save a document * using a environment similar to a UNIX commandline. */ @@ -2800,7 +2809,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, { char prompt[500] = "/ > "; char *cmdline = NULL, *cur; - int nbargs; char command[100]; char arg[400]; int i; @@ -2835,6 +2843,10 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, while (1) { if (ctxt->node == (xmlNodePtr) ctxt->doc) snprintf(prompt, sizeof(prompt), "%s > ", "/"); + else if ((ctxt->node != NULL) && (ctxt->node->name) && + (ctxt->node->ns) && (ctxt->node->ns->prefix)) + snprintf(prompt, sizeof(prompt), "%s:%s > ", + (ctxt->node->ns->prefix), ctxt->node->name); else if ((ctxt->node != NULL) && (ctxt->node->name)) snprintf(prompt, sizeof(prompt), "%s > ", ctxt->node->name); else @@ -2852,7 +2864,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, * Parse the command itself */ cur = cmdline; - nbargs = 0; while ((*cur == ' ') || (*cur == '\t')) cur++; i = 0; @@ -2865,7 +2876,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, command[i] = 0; if (i == 0) continue; - nbargs++; /* * Parse the argument @@ -2879,8 +2889,6 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, arg[i++] = *cur++; } arg[i] = 0; - if (i != 0) - nbargs++; /* * start interpreting the command @@ -2913,6 +2921,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, fprintf(ctxt->output, "\t the default namespace if any uses 'defaultns' prefix\n"); #endif /* LIBXML_XPATH_ENABLED */ fprintf(ctxt->output, "\tpwd display current working directory\n"); + fprintf(ctxt->output, "\twhereis display absolute path of [path] or current working directory\n"); fprintf(ctxt->output, "\tquit leave shell\n"); #ifdef LIBXML_OUTPUT_ENABLED fprintf(ctxt->output, "\tsave [name] save this document to name or the original name\n"); @@ -2939,11 +2948,11 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, } else if (!strcmp(command, "save")) { xmlShellSave(ctxt, arg, NULL, NULL); } else if (!strcmp(command, "write")) { - if ((arg == NULL) || (arg[0] == 0)) + if (arg[0] == 0) xmlGenericError(xmlGenericErrorContext, "Write command requires a filename argument\n"); else - xmlShellWrite(ctxt, arg, NULL, NULL); + xmlShellWrite(ctxt, arg, ctxt->node, NULL); #endif /* LIBXML_OUTPUT_ENABLED */ } else if (!strcmp(command, "grep")) { xmlShellGrep(ctxt, arg, ctxt->node, NULL); @@ -2962,7 +2971,79 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL)) fprintf(ctxt->output, "%s\n", dir); } else if (!strcmp(command, "du")) { - xmlShellDu(ctxt, NULL, ctxt->node, NULL); + if (arg[0] == 0) { + xmlShellDu(ctxt, NULL, ctxt->node, NULL); + } else { + ctxt->pctxt->node = ctxt->node; +#ifdef LIBXML_XPATH_ENABLED + ctxt->pctxt->node = ctxt->node; + list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); +#else + list = NULL; +#endif /* LIBXML_XPATH_ENABLED */ + if (list != NULL) { + switch (list->type) { + case XPATH_UNDEFINED: + xmlGenericError(xmlGenericErrorContext, + "%s: no such node\n", arg); + break; + case XPATH_NODESET:{ + int indx; + + if (list->nodesetval == NULL) + break; + + for (indx = 0; + indx < list->nodesetval->nodeNr; + indx++) + xmlShellDu(ctxt, NULL, + list->nodesetval-> + nodeTab[indx], NULL); + break; + } + case XPATH_BOOLEAN: + xmlGenericError(xmlGenericErrorContext, + "%s is a Boolean\n", arg); + break; + case XPATH_NUMBER: + xmlGenericError(xmlGenericErrorContext, + "%s is a number\n", arg); + break; + case XPATH_STRING: + xmlGenericError(xmlGenericErrorContext, + "%s is a string\n", arg); + break; + case XPATH_POINT: + xmlGenericError(xmlGenericErrorContext, + "%s is a point\n", arg); + break; + case XPATH_RANGE: + xmlGenericError(xmlGenericErrorContext, + "%s is a range\n", arg); + break; + case XPATH_LOCATIONSET: + xmlGenericError(xmlGenericErrorContext, + "%s is a range\n", arg); + break; + case XPATH_USERS: + xmlGenericError(xmlGenericErrorContext, + "%s is user-defined\n", arg); + break; + case XPATH_XSLT_TREE: + xmlGenericError(xmlGenericErrorContext, + "%s is an XSLT value tree\n", + arg); + break; + } +#ifdef LIBXML_XPATH_ENABLED + xmlXPathFreeObject(list); +#endif + } else { + xmlGenericError(xmlGenericErrorContext, + "%s: no such node\n", arg); + } + ctxt->pctxt->node = NULL; + } } else if (!strcmp(command, "base")) { xmlShellBase(ctxt, NULL, ctxt->node, NULL); } else if (!strcmp(command, "set")) { @@ -3073,6 +3154,83 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, } #ifdef LIBXML_XPATH_ENABLED xmlXPathFreeObject(list); +#endif + } else { + xmlGenericError(xmlGenericErrorContext, + "%s: no such node\n", arg); + } + ctxt->pctxt->node = NULL; + } + } else if (!strcmp(command, "whereis")) { + char dir[500]; + + if (arg[0] == 0) { + if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL)) + fprintf(ctxt->output, "%s\n", dir); + } else { + ctxt->pctxt->node = ctxt->node; +#ifdef LIBXML_XPATH_ENABLED + list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); +#else + list = NULL; +#endif /* LIBXML_XPATH_ENABLED */ + if (list != NULL) { + switch (list->type) { + case XPATH_UNDEFINED: + xmlGenericError(xmlGenericErrorContext, + "%s: no such node\n", arg); + break; + case XPATH_NODESET:{ + int indx; + + if (list->nodesetval == NULL) + break; + + for (indx = 0; + indx < list->nodesetval->nodeNr; + indx++) { + if (!xmlShellPwd(ctxt, dir, list->nodesetval-> + nodeTab[indx], NULL)) + fprintf(ctxt->output, "%s\n", dir); + } + break; + } + case XPATH_BOOLEAN: + xmlGenericError(xmlGenericErrorContext, + "%s is a Boolean\n", arg); + break; + case XPATH_NUMBER: + xmlGenericError(xmlGenericErrorContext, + "%s is a number\n", arg); + break; + case XPATH_STRING: + xmlGenericError(xmlGenericErrorContext, + "%s is a string\n", arg); + break; + case XPATH_POINT: + xmlGenericError(xmlGenericErrorContext, + "%s is a point\n", arg); + break; + case XPATH_RANGE: + xmlGenericError(xmlGenericErrorContext, + "%s is a range\n", arg); + break; + case XPATH_LOCATIONSET: + xmlGenericError(xmlGenericErrorContext, + "%s is a range\n", arg); + break; + case XPATH_USERS: + xmlGenericError(xmlGenericErrorContext, + "%s is user-defined\n", arg); + break; + case XPATH_XSLT_TREE: + xmlGenericError(xmlGenericErrorContext, + "%s is an XSLT value tree\n", + arg); + break; + } +#ifdef LIBXML_XPATH_ENABLED + xmlXPathFreeObject(list); #endif } else { xmlGenericError(xmlGenericErrorContext, @@ -3085,7 +3243,12 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, ctxt->node = (xmlNodePtr) ctxt->doc; } else { #ifdef LIBXML_XPATH_ENABLED + int l; + ctxt->pctxt->node = ctxt->node; + l = strlen(arg); + if ((l >= 2) && (arg[l - 1] == '/')) + arg[l - 1] = 0; list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt); #else list = NULL; @@ -3244,6 +3407,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, "Unknown command %s\n", command); } free(cmdline); /* not xmlFree here ! */ + cmdline = NULL; } #ifdef LIBXML_XPATH_ENABLED xmlXPathFreeContext(ctxt->pctxt); diff --git a/gnulib-local/lib/libxml/debugXML.in.h b/gnulib-local/lib/libxml/debugXML.in.h index 5a9d20b..5b3be13 100644 --- a/gnulib-local/lib/libxml/debugXML.in.h +++ b/gnulib-local/lib/libxml/debugXML.in.h @@ -25,18 +25,18 @@ extern "C" { /* * The standard Dump routines. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpString (FILE *output, const xmlChar *str); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpAttr (FILE *output, xmlAttrPtr attr, int depth); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpAttrList (FILE *output, xmlAttrPtr attr, int depth); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpOneNode (FILE *output, xmlNodePtr node, int depth); @@ -54,16 +54,16 @@ XMLPUBFUN void XMLCALL XMLPUBFUN void XMLCALL xmlDebugDumpDocument (FILE *output, xmlDocPtr doc); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpDTD (FILE *output, xmlDtdPtr dtd); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDebugDumpEntities (FILE *output, xmlDocPtr doc); /**************************************************************** * * - * Checking routines * + * Checking routines * * * ****************************************************************/ @@ -73,16 +73,16 @@ XMLPUBFUN int XMLCALL /**************************************************************** * * - * XML shell helpers * + * XML shell helpers * * * ****************************************************************/ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlLsOneNode (FILE *output, xmlNodePtr node); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlLsCountNode (xmlNodePtr node); -XMLPUBFUN const char * XMLCALL +XMLPUBFUN const char * XMLCALL xmlBoolToText (int boolval); /**************************************************************** @@ -136,63 +136,63 @@ typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlShellPrintXPathError (int errorType, const char *arg); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlShellPrintXPathResult(xmlXPathObjectPtr list); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellList (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellBase (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellDir (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellLoad (xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, xmlNodePtr node2); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlShellPrintNode (xmlNodePtr node); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellCat (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellWrite (xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellSave (xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, xmlNodePtr node2); #endif /* LIBXML_OUTPUT_ENABLED */ #ifdef LIBXML_VALID_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellValidate (xmlShellCtxtPtr ctxt, char *dtd, xmlNodePtr node, xmlNodePtr node2); #endif /* LIBXML_VALID_ENABLED */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellDu (xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr tree, xmlNodePtr node2); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlShellPwd (xmlShellCtxtPtr ctxt, char *buffer, xmlNodePtr node, @@ -201,12 +201,12 @@ XMLPUBFUN int XMLCALL /* * The Shell interface. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlShell (xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, FILE *output); - + #endif /* LIBXML_XPATH_ENABLED */ #ifdef __cplusplus diff --git a/gnulib-local/lib/libxml/dict.c b/gnulib-local/lib/libxml/dict.c index 3b4054f..8c8f931 100644 --- a/gnulib-local/lib/libxml/dict.c +++ b/gnulib-local/lib/libxml/dict.c @@ -2,7 +2,7 @@ * dict.c: dictionary of reusable strings, just used to avoid allocation * and freeing operations. * - * Copyright (C) 2003 Daniel Veillard. + * Copyright (C) 2003-2012 Daniel Veillard. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -19,19 +19,72 @@ #define IN_LIBXML #include "libxml.h" +#include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif + +/* + * Following http://www.ocert.org/advisories/ocert-2011-003.html + * it seems that having hash randomization might be a good idea + * when using XML with untrusted data + * Note1: that it works correctly only if compiled with WITH_BIG_KEY + * which is the default. + * Note2: the fast function used for a small dict won't protect very + * well but since the attack is based on growing a very big hash + * list we will use the BigKey algo as soon as the hash size grows + * over MIN_DICT_SIZE so this actually works + */ +#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) +#define DICT_RANDOMIZATION +#endif + #include +#ifdef HAVE_STDINT_H +#include +#else +#ifdef HAVE_INTTYPES_H +#include +#elif defined(WIN32) +typedef unsigned __int32 uint32_t; +#endif +#endif #include #include #include #include #include -#define MAX_HASH_LEN 4 +/* #define DEBUG_GROW */ +/* #define DICT_DEBUG_PATTERNS */ + +#define MAX_HASH_LEN 3 #define MIN_DICT_SIZE 128 #define MAX_DICT_HASH 8 * 2048 - -/* #define ALLOW_REMOVAL */ -/* #define DEBUG_GROW */ +#define WITH_BIG_KEY + +#ifdef WITH_BIG_KEY +#define xmlDictComputeKey(dict, name, len) \ + (((dict)->size == MIN_DICT_SIZE) ? \ + xmlDictComputeFastKey(name, len, (dict)->seed) : \ + xmlDictComputeBigKey(name, len, (dict)->seed)) + +#define xmlDictComputeQKey(dict, prefix, plen, name, len) \ + (((prefix) == NULL) ? \ + (xmlDictComputeKey(dict, name, len)) : \ + (((dict)->size == MIN_DICT_SIZE) ? \ + xmlDictComputeFastQKey(prefix, plen, name, len, (dict)->seed) : \ + xmlDictComputeBigQKey(prefix, plen, name, len, (dict)->seed))) + +#else /* !WITH_BIG_KEY */ +#define xmlDictComputeKey(dict, name, len) \ + xmlDictComputeFastKey(name, len, (dict)->seed) +#define xmlDictComputeQKey(dict, prefix, plen, name, len) \ + xmlDictComputeFastQKey(prefix, plen, name, len, (dict)->seed) +#endif /* WITH_BIG_KEY */ /* * An entry in the dictionnary @@ -41,8 +94,9 @@ typedef xmlDictEntry *xmlDictEntryPtr; struct _xmlDictEntry { struct _xmlDictEntry *next; const xmlChar *name; - int len; + unsigned int len; int valid; + unsigned long okey; }; typedef struct _xmlDictStrings xmlDictStrings; @@ -51,8 +105,8 @@ struct _xmlDictStrings { xmlDictStringsPtr next; xmlChar *free; xmlChar *end; - int size; - int nbStrings; + size_t size; + size_t nbStrings; xmlChar array[1]; }; /* @@ -60,14 +114,17 @@ struct _xmlDictStrings { */ struct _xmlDict { int ref_counter; - xmlRMutexPtr mutex; struct _xmlDictEntry *dict; - int size; - int nbElems; + size_t size; + unsigned int nbElems; xmlDictStringsPtr strings; struct _xmlDict *subdict; + /* used for randomization */ + int seed; + /* used to impose a limit on size */ + size_t limit; }; /* @@ -81,28 +138,84 @@ static xmlRMutexPtr xmlDictMutex = NULL; */ static int xmlDictInitialized = 0; +#ifdef DICT_RANDOMIZATION +#ifdef HAVE_RAND_R +/* + * Internal data for random function, protected by xmlDictMutex + */ +static unsigned int rand_seed = 0; +#endif +#endif + /** * xmlInitializeDict: * * Do the dictionary mutex initialization. + * this function is deprecated + * + * Returns 0 if initialization was already done, and 1 if that + * call led to the initialization + */ +int xmlInitializeDict(void) { + return(0); +} + +/** + * __xmlInitializeDict: + * + * This function is not public + * Do the dictionary mutex initialization. * this function is not thread safe, initialization should - * preferably be done once at startup + * normally be done once at setup when called from xmlOnceInit() + * we may also land in this code if thread support is not compiled in + * + * Returns 0 if initialization was already done, and 1 if that + * call led to the initialization */ -static int xmlInitializeDict(void) { +int __xmlInitializeDict(void) { if (xmlDictInitialized) return(1); if ((xmlDictMutex = xmlNewRMutex()) == NULL) return(0); + xmlRMutexLock(xmlDictMutex); +#ifdef DICT_RANDOMIZATION +#ifdef HAVE_RAND_R + rand_seed = time(NULL); + rand_r(& rand_seed); +#else + srand(time(NULL)); +#endif +#endif xmlDictInitialized = 1; + xmlRMutexUnlock(xmlDictMutex); return(1); } +#ifdef DICT_RANDOMIZATION +int __xmlRandom(void) { + int ret; + + if (xmlDictInitialized == 0) + __xmlInitializeDict(); + + xmlRMutexLock(xmlDictMutex); +#ifdef HAVE_RAND_R + ret = rand_r(& rand_seed); +#else + ret = rand(); +#endif + xmlRMutexUnlock(xmlDictMutex); + return(ret); +} +#endif + /** * xmlDictCleanup: * - * Free the dictionary mutex. + * Free the dictionary mutex. Do not call unless sure the library + * is not in use anymore ! */ void xmlDictCleanup(void) { @@ -118,32 +231,41 @@ xmlDictCleanup(void) { * xmlDictAddString: * @dict: the dictionnary * @name: the name of the userdata - * @len: the length of the name, if -1 it is recomputed + * @len: the length of the name * * Add the string to the array[s] * * Returns the pointer of the local string, or NULL in case of error. */ static const xmlChar * -xmlDictAddString(xmlDictPtr dict, const xmlChar *name, int namelen) { +xmlDictAddString(xmlDictPtr dict, const xmlChar *name, unsigned int namelen) { xmlDictStringsPtr pool; const xmlChar *ret; - int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */ + size_t size = 0; /* + sizeof(_xmlDictStrings) == 1024 */ + size_t limit = 0; +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "-"); +#endif pool = dict->strings; while (pool != NULL) { if (pool->end - pool->free > namelen) goto found_pool; if (pool->size > size) size = pool->size; + limit += pool->size; pool = pool->next; } /* * Not found, need to allocate */ if (pool == NULL) { + if ((dict->limit > 0) && (limit > dict->limit)) { + return(NULL); + } + if (size == 0) size = 1000; else size *= 4; /* exponential growth */ - if (size < 4 * namelen) + if (size < 4 * namelen) size = 4 * namelen; /* just in case ! */ pool = (xmlDictStringsPtr) xmlMalloc(sizeof(xmlDictStrings) + size); if (pool == NULL) @@ -154,12 +276,16 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, int namelen) { pool->end = &pool->array[size]; pool->next = dict->strings; dict->strings = pool; +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "+"); +#endif } found_pool: ret = pool->free; memcpy(pool->free, name, namelen); pool->free += namelen; *(pool->free++) = 0; + pool->nbStrings++; return(ret); } @@ -167,40 +293,48 @@ found_pool: * xmlDictAddQString: * @dict: the dictionnary * @prefix: the prefix of the userdata + * @plen: the prefix length * @name: the name of the userdata - * @len: the length of the name, if -1 it is recomputed + * @len: the length of the name * * Add the QName to the array[s] * * Returns the pointer of the local string, or NULL in case of error. */ static const xmlChar * -xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, - const xmlChar *name, int namelen) +xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, unsigned int plen, + const xmlChar *name, unsigned int namelen) { xmlDictStringsPtr pool; const xmlChar *ret; - int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */ - int plen; + size_t size = 0; /* + sizeof(_xmlDictStrings) == 1024 */ + size_t limit = 0; if (prefix == NULL) return(xmlDictAddString(dict, name, namelen)); - plen = xmlStrlen(prefix); +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "="); +#endif pool = dict->strings; while (pool != NULL) { - if (pool->end - pool->free > namelen) + if (pool->end - pool->free > namelen + plen + 1) goto found_pool; if (pool->size > size) size = pool->size; + limit += pool->size; pool = pool->next; } /* * Not found, need to allocate */ if (pool == NULL) { + if ((dict->limit > 0) && (limit > dict->limit)) { + return(NULL); + } + if (size == 0) size = 1000; else size *= 4; /* exponential growth */ - if (size < 4 * namelen) - size = 4 * namelen; /* just in case ! */ + if (size < 4 * (namelen + plen + 1)) + size = 4 * (namelen + plen + 1); /* just in case ! */ pool = (xmlDictStringsPtr) xmlMalloc(sizeof(xmlDictStrings) + size); if (pool == NULL) return(NULL); @@ -210,27 +344,106 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, pool->end = &pool->array[size]; pool->next = dict->strings; dict->strings = pool; +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "+"); +#endif } found_pool: ret = pool->free; memcpy(pool->free, prefix, plen); pool->free += plen; *(pool->free++) = ':'; - namelen -= plen + 1; memcpy(pool->free, name, namelen); pool->free += namelen; *(pool->free++) = 0; + pool->nbStrings++; return(ret); } +#ifdef WITH_BIG_KEY +/* + * xmlDictComputeBigKey: + * + * Calculate a hash key using a good hash function that works well for + * larger hash table sizes. + * + * Hash function by "One-at-a-Time Hash" see + * http://burtleburtle.net/bob/hash/doobs.html + */ + +static uint32_t +xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) { + uint32_t hash; + int i; + + if (namelen <= 0 || data == NULL) return(0); + + hash = seed; + + for (i = 0;i < namelen; i++) { + hash += data[i]; + hash += (hash << 10); + hash ^= (hash >> 6); + } + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + + return hash; +} + +/* + * xmlDictComputeBigQKey: + * + * Calculate a hash key for two strings using a good hash function + * that works well for larger hash table sizes. + * + * Hash function by "One-at-a-Time Hash" see + * http://burtleburtle.net/bob/hash/doobs.html + * + * Neither of the two strings must be NULL. + */ +static unsigned long +xmlDictComputeBigQKey(const xmlChar *prefix, int plen, + const xmlChar *name, int len, int seed) +{ + uint32_t hash; + int i; + + hash = seed; + + for (i = 0;i < plen; i++) { + hash += prefix[i]; + hash += (hash << 10); + hash ^= (hash >> 6); + } + hash += ':'; + hash += (hash << 10); + hash ^= (hash >> 6); + + for (i = 0;i < len; i++) { + hash += name[i]; + hash += (hash << 10); + hash ^= (hash >> 6); + } + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + + return hash; +} +#endif /* WITH_BIG_KEY */ + /* - * xmlDictComputeKey: - * Calculate the hash key + * xmlDictComputeFastKey: + * + * Calculate a hash key using a fast hash function that works well + * for low hash table fill. */ static unsigned long -xmlDictComputeKey(const xmlChar *name, int namelen) { - unsigned long value = 0L; - +xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) { + unsigned long value = seed; + if (name == NULL) return(0); value = *name; value <<= 5; @@ -254,26 +467,29 @@ xmlDictComputeKey(const xmlChar *name, int namelen) { } /* - * xmlDictComputeQKey: - * Calculate the hash key + * xmlDictComputeFastQKey: + * + * Calculate a hash key for two strings using a fast hash function + * that works well for low hash table fill. + * + * Neither of the two strings must be NULL. */ static unsigned long -xmlDictComputeQKey(const xmlChar *prefix, const xmlChar *name, int len) +xmlDictComputeFastQKey(const xmlChar *prefix, int plen, + const xmlChar *name, int len, int seed) { - unsigned long value = 0L; - int plen; - - if (prefix == NULL) - return(xmlDictComputeKey(name, len)); + unsigned long value = (unsigned long) seed; - plen = xmlStrlen(prefix); if (plen == 0) value += 30 * (unsigned long) ':'; else value += 30 * (*prefix); - + if (len > 10) { - value += name[len - (plen + 1 + 1)]; + int offset = len - (plen + 1 + 1); + if (offset < 0) + offset = len - (10 + 1); + value += name[offset]; len = 10; if (plen > 10) plen = 10; @@ -324,12 +540,17 @@ xmlDictCreate(void) { xmlDictPtr dict; if (!xmlDictInitialized) - if (!xmlInitializeDict()) + if (!__xmlInitializeDict()) return(NULL); - + +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "C"); +#endif + dict = xmlMalloc(sizeof(xmlDict)); if (dict) { dict->ref_counter = 1; + dict->limit = 0; dict->size = MIN_DICT_SIZE; dict->nbElems = 0; @@ -337,11 +558,13 @@ xmlDictCreate(void) { dict->strings = NULL; dict->subdict = NULL; if (dict->dict) { - if ((dict->mutex = xmlNewRMutex()) != NULL) { - memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry)); - return(dict); - } - xmlFree(dict->dict); + memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry)); +#ifdef DICT_RANDOMIZATION + dict->seed = __xmlRandom(); +#else + dict->seed = 0; +#endif + return(dict); } xmlFree(dict); } @@ -362,8 +585,12 @@ xmlDictCreate(void) { xmlDictPtr xmlDictCreateSub(xmlDictPtr sub) { xmlDictPtr dict = xmlDictCreate(); - + if ((dict != NULL) && (sub != NULL)) { +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "R"); +#endif + dict->seed = sub->seed; dict->subdict = sub; xmlDictReference(dict->subdict); } @@ -381,7 +608,7 @@ xmlDictCreateSub(xmlDictPtr sub) { int xmlDictReference(xmlDictPtr dict) { if (!xmlDictInitialized) - if (!xmlInitializeDict()) + if (!__xmlInitializeDict()) return(-1); if (dict == NULL) return -1; @@ -401,15 +628,17 @@ xmlDictReference(xmlDictPtr dict) { * Returns 0 in case of success, -1 in case of failure */ static int -xmlDictGrow(xmlDictPtr dict, int size) { - unsigned long key; - int oldsize, i; +xmlDictGrow(xmlDictPtr dict, size_t size) { + unsigned long key, okey; + size_t oldsize, i; xmlDictEntryPtr iter, next; struct _xmlDictEntry *olddict; #ifdef DEBUG_GROW unsigned long nbElem = 0; #endif - + int ret = 0; + int keep_keys = 1; + if (dict == NULL) return(-1); if (size < 8) @@ -417,11 +646,17 @@ xmlDictGrow(xmlDictPtr dict, int size) { if (size > 8 * 2048) return(-1); +#ifdef DICT_DEBUG_PATTERNS + fprintf(stderr, "*"); +#endif + oldsize = dict->size; olddict = dict->dict; if (olddict == NULL) return(-1); - + if (oldsize == MIN_DICT_SIZE) + keep_keys = 0; + dict->dict = xmlMalloc(size * sizeof(xmlDictEntry)); if (dict->dict == NULL) { dict->dict = olddict; @@ -431,17 +666,44 @@ xmlDictGrow(xmlDictPtr dict, int size) { dict->size = size; /* If the two loops are merged, there would be situations where - a new entry needs to allocated and data copied into it from - the main dict. So instead, we run through the array twice, first - copying all the elements in the main array (where we can't get - conflicts) and then the rest, so we only free (and don't allocate) + a new entry needs to allocated and data copied into it from + the main dict. It is nicer to run through the array twice, first + copying all the elements in the main array (less probability of + allocate) and then the rest, so we only free in the second loop. */ for (i = 0; i < oldsize; i++) { - if (olddict[i].valid == 0) + if (olddict[i].valid == 0) continue; - key = xmlDictComputeKey(olddict[i].name, olddict[i].len) % dict->size; - memcpy(&(dict->dict[key]), &(olddict[i]), sizeof(xmlDictEntry)); - dict->dict[key].next = NULL; + + if (keep_keys) + okey = olddict[i].okey; + else + okey = xmlDictComputeKey(dict, olddict[i].name, olddict[i].len); + key = okey % dict->size; + + if (dict->dict[key].valid == 0) { + memcpy(&(dict->dict[key]), &(olddict[i]), sizeof(xmlDictEntry)); + dict->dict[key].next = NULL; + dict->dict[key].okey = okey; + } else { + xmlDictEntryPtr entry; + + entry = xmlMalloc(sizeof(xmlDictEntry)); + if (entry != NULL) { + entry->name = olddict[i].name; + entry->len = olddict[i].len; + entry->okey = okey; + entry->next = dict->dict[key].next; + entry->valid = 1; + dict->dict[key].next = entry; + } else { + /* + * we don't have much ways to alert from herei + * result is loosing an entry and unicity garantee + */ + ret = -1; + } + } #ifdef DEBUG_GROW nbElem++; #endif @@ -456,15 +718,21 @@ xmlDictGrow(xmlDictPtr dict, int size) { * put back the entry in the new dict */ - key = xmlDictComputeKey(iter->name, iter->len) % dict->size; + if (keep_keys) + okey = iter->okey; + else + okey = xmlDictComputeKey(dict, iter->name, iter->len); + key = okey % dict->size; if (dict->dict[key].valid == 0) { memcpy(&(dict->dict[key]), iter, sizeof(xmlDictEntry)); dict->dict[key].next = NULL; dict->dict[key].valid = 1; + dict->dict[key].okey = okey; xmlFree(iter); } else { - iter->next = dict->dict[key].next; - dict->dict[key].next = iter; + iter->next = dict->dict[key].next; + iter->okey = okey; + dict->dict[key].next = iter; } #ifdef DEBUG_GROW @@ -479,10 +747,10 @@ xmlDictGrow(xmlDictPtr dict, int size) { #ifdef DEBUG_GROW xmlGenericError(xmlGenericErrorContext, - "xmlDictGrow : from %d to %d, %d elems\n", oldsize, size, nbElem); + "xmlDictGrow : from %lu to %lu, %u elems\n", oldsize, size, nbElem); #endif - return(0); + return(ret); } /** @@ -494,7 +762,7 @@ xmlDictGrow(xmlDictPtr dict, int size) { */ void xmlDictFree(xmlDictPtr dict) { - int i; + size_t i; xmlDictEntryPtr iter; xmlDictEntryPtr next; int inside_dict = 0; @@ -504,7 +772,7 @@ xmlDictFree(xmlDictPtr dict) { return; if (!xmlDictInitialized) - if (!xmlInitializeDict()) + if (!__xmlInitializeDict()) return; /* decrement the counter, it may be shared by a parser and docs */ @@ -535,7 +803,6 @@ xmlDictFree(xmlDictPtr dict) { inside_dict = 0; iter = next; } - inside_dict = 0; } xmlFree(dict->dict); } @@ -545,7 +812,6 @@ xmlDictFree(xmlDictPtr dict) { xmlFree(pool); pool = nextp; } - xmlFreeRMutex(dict->mutex); xmlFree(dict); } @@ -565,17 +831,24 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) { xmlDictEntryPtr entry; xmlDictEntryPtr insert; const xmlChar *ret; + unsigned int l; if ((dict == NULL) || (name == NULL)) return(NULL); if (len < 0) - len = xmlStrlen(name); + l = strlen((const char *) name); + else + l = len; + + if (((dict->limit > 0) && (l >= dict->limit)) || + (l > INT_MAX / 2)) + return(NULL); /* * Check for duplicate and insertion location. */ - okey = xmlDictComputeKey(name, len); + okey = xmlDictComputeKey(dict, name, l); key = okey % dict->size; if (dict->dict[key].valid == 0) { insert = NULL; @@ -583,63 +856,74 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) { for (insert = &(dict->dict[key]); insert->next != NULL; insert = insert->next) { #ifdef __GNUC__ - if (insert->len == len) { - if (!memcmp(insert->name, name, len)) + if ((insert->okey == okey) && (insert->len == l)) { + if (!memcmp(insert->name, name, l)) return(insert->name); } #else - if ((insert->len == len) && - (!xmlStrncmp(insert->name, name, len))) + if ((insert->okey == okey) && (insert->len == l) && + (!xmlStrncmp(insert->name, name, l))) return(insert->name); #endif nbi++; } #ifdef __GNUC__ - if (insert->len == len) { - if (!memcmp(insert->name, name, len)) + if ((insert->okey == okey) && (insert->len == l)) { + if (!memcmp(insert->name, name, l)) return(insert->name); } #else - if ((insert->len == len) && - (!xmlStrncmp(insert->name, name, len))) + if ((insert->okey == okey) && (insert->len == l) && + (!xmlStrncmp(insert->name, name, l))) return(insert->name); #endif } if (dict->subdict) { - key = okey % dict->subdict->size; + unsigned long skey; + + /* we cannot always reuse the same okey for the subdict */ + if (((dict->size == MIN_DICT_SIZE) && + (dict->subdict->size != MIN_DICT_SIZE)) || + ((dict->size != MIN_DICT_SIZE) && + (dict->subdict->size == MIN_DICT_SIZE))) + skey = xmlDictComputeKey(dict->subdict, name, l); + else + skey = okey; + + key = skey % dict->subdict->size; if (dict->subdict->dict[key].valid != 0) { xmlDictEntryPtr tmp; for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL; tmp = tmp->next) { #ifdef __GNUC__ - if (tmp->len == len) { - if (!memcmp(tmp->name, name, len)) + if ((tmp->okey == skey) && (tmp->len == l)) { + if (!memcmp(tmp->name, name, l)) return(tmp->name); } #else - if ((tmp->len == len) && - (!xmlStrncmp(tmp->name, name, len))) + if ((tmp->okey == skey) && (tmp->len == l) && + (!xmlStrncmp(tmp->name, name, l))) return(tmp->name); #endif nbi++; } #ifdef __GNUC__ - if (tmp->len == len) { - if (!memcmp(tmp->name, name, len)) + if ((tmp->okey == skey) && (tmp->len == l)) { + if (!memcmp(tmp->name, name, l)) return(tmp->name); } #else - if ((tmp->len == len) && - (!xmlStrncmp(tmp->name, name, len))) + if ((tmp->okey == skey) && (tmp->len == l) && + (!xmlStrncmp(tmp->name, name, l))) return(tmp->name); #endif } key = okey % dict->size; } - ret = xmlDictAddString(dict, name, len); + ret = xmlDictAddString(dict, name, l); if (ret == NULL) return(NULL); if (insert == NULL) { @@ -650,19 +934,22 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) { return(NULL); } entry->name = ret; - entry->len = len; + entry->len = l; entry->next = NULL; entry->valid = 1; + entry->okey = okey; - if (insert != NULL) + if (insert != NULL) insert->next = entry; dict->nbElems++; if ((nbi > MAX_HASH_LEN) && - (dict->size <= ((MAX_DICT_HASH / 2) / MAX_HASH_LEN))) - xmlDictGrow(dict, MAX_HASH_LEN * 2 * dict->size); + (dict->size <= ((MAX_DICT_HASH / 2) / MAX_HASH_LEN))) { + if (xmlDictGrow(dict, MAX_HASH_LEN * 2 * dict->size) != 0) + return(NULL); + } /* Note that entry may have been freed at this point by xmlDictGrow */ return(ret); @@ -682,17 +969,23 @@ const xmlChar * xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) { unsigned long key, okey, nbi = 0; xmlDictEntryPtr insert; + unsigned int l; if ((dict == NULL) || (name == NULL)) return(NULL); if (len < 0) - len = xmlStrlen(name); + l = strlen((const char *) name); + else + l = len; + if (((dict->limit > 0) && (l >= dict->limit)) || + (l > INT_MAX / 2)) + return(NULL); /* * Check for duplicate and insertion location. */ - okey = xmlDictComputeKey(name, len); + okey = xmlDictComputeKey(dict, name, l); key = okey % dict->size; if (dict->dict[key].valid == 0) { insert = NULL; @@ -700,60 +993,70 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) { for (insert = &(dict->dict[key]); insert->next != NULL; insert = insert->next) { #ifdef __GNUC__ - if (insert->len == len) { - if (!memcmp(insert->name, name, len)) + if ((insert->okey == okey) && (insert->len == l)) { + if (!memcmp(insert->name, name, l)) return(insert->name); } #else - if ((insert->len == len) && - (!xmlStrncmp(insert->name, name, len))) + if ((insert->okey == okey) && (insert->len == l) && + (!xmlStrncmp(insert->name, name, l))) return(insert->name); #endif nbi++; } #ifdef __GNUC__ - if (insert->len == len) { - if (!memcmp(insert->name, name, len)) + if ((insert->okey == okey) && (insert->len == l)) { + if (!memcmp(insert->name, name, l)) return(insert->name); } #else - if ((insert->len == len) && - (!xmlStrncmp(insert->name, name, len))) + if ((insert->okey == okey) && (insert->len == l) && + (!xmlStrncmp(insert->name, name, l))) return(insert->name); #endif } if (dict->subdict) { - key = okey % dict->subdict->size; + unsigned long skey; + + /* we cannot always reuse the same okey for the subdict */ + if (((dict->size == MIN_DICT_SIZE) && + (dict->subdict->size != MIN_DICT_SIZE)) || + ((dict->size != MIN_DICT_SIZE) && + (dict->subdict->size == MIN_DICT_SIZE))) + skey = xmlDictComputeKey(dict->subdict, name, l); + else + skey = okey; + + key = skey % dict->subdict->size; if (dict->subdict->dict[key].valid != 0) { xmlDictEntryPtr tmp; for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL; tmp = tmp->next) { #ifdef __GNUC__ - if (tmp->len == len) { - if (!memcmp(tmp->name, name, len)) + if ((tmp->okey == skey) && (tmp->len == l)) { + if (!memcmp(tmp->name, name, l)) return(tmp->name); } #else - if ((tmp->len == len) && - (!xmlStrncmp(tmp->name, name, len))) + if ((tmp->okey == skey) && (tmp->len == l) && + (!xmlStrncmp(tmp->name, name, l))) return(tmp->name); #endif nbi++; } #ifdef __GNUC__ - if (tmp->len == len) { - if (!memcmp(tmp->name, name, len)) + if ((tmp->okey == skey) && (tmp->len == l)) { + if (!memcmp(tmp->name, name, l)) return(tmp->name); } #else - if ((tmp->len == len) && - (!xmlStrncmp(tmp->name, name, len))) + if ((tmp->okey == skey) && (tmp->len == l) && + (!xmlStrncmp(tmp->name, name, l))) return(tmp->name); #endif } - key = okey % dict->size; } /* not found */ @@ -763,7 +1066,7 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) { /** * xmlDictQLookup: * @dict: the dictionnary - * @prefix: the prefix + * @prefix: the prefix * @name: the name * * Add the QName @prefix:@name to the hash @dict if not present. @@ -776,54 +1079,67 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) { xmlDictEntryPtr entry; xmlDictEntryPtr insert; const xmlChar *ret; - int len; + unsigned int len, plen, l; if ((dict == NULL) || (name == NULL)) return(NULL); + if (prefix == NULL) + return(xmlDictLookup(dict, name, -1)); - len = xmlStrlen(name); - if (prefix != NULL) - len += 1 + xmlStrlen(prefix); + l = len = strlen((const char *) name); + plen = strlen((const char *) prefix); + len += 1 + plen; /* * Check for duplicate and insertion location. */ - okey = xmlDictComputeQKey(prefix, name, len); + okey = xmlDictComputeQKey(dict, prefix, plen, name, l); key = okey % dict->size; if (dict->dict[key].valid == 0) { insert = NULL; } else { for (insert = &(dict->dict[key]); insert->next != NULL; insert = insert->next) { - if ((insert->len == len) && + if ((insert->okey == okey) && (insert->len == len) && (xmlStrQEqual(prefix, name, insert->name))) return(insert->name); nbi++; } - if ((insert->len == len) && + if ((insert->okey == okey) && (insert->len == len) && (xmlStrQEqual(prefix, name, insert->name))) return(insert->name); } if (dict->subdict) { - key = okey % dict->subdict->size; + unsigned long skey; + + /* we cannot always reuse the same okey for the subdict */ + if (((dict->size == MIN_DICT_SIZE) && + (dict->subdict->size != MIN_DICT_SIZE)) || + ((dict->size != MIN_DICT_SIZE) && + (dict->subdict->size == MIN_DICT_SIZE))) + skey = xmlDictComputeQKey(dict->subdict, prefix, plen, name, l); + else + skey = okey; + + key = skey % dict->subdict->size; if (dict->subdict->dict[key].valid != 0) { xmlDictEntryPtr tmp; for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL; tmp = tmp->next) { - if ((tmp->len == len) && + if ((tmp->okey == skey) && (tmp->len == len) && (xmlStrQEqual(prefix, name, tmp->name))) return(tmp->name); nbi++; } - if ((tmp->len == len) && + if ((tmp->okey == skey) && (tmp->len == len) && (xmlStrQEqual(prefix, name, tmp->name))) return(tmp->name); } key = okey % dict->size; } - ret = xmlDictAddQString(dict, prefix, name, len); + ret = xmlDictAddQString(dict, prefix, plen, name, l); if (ret == NULL) return(NULL); if (insert == NULL) { @@ -837,8 +1153,9 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) { entry->len = len; entry->next = NULL; entry->valid = 1; + entry->okey = okey; - if (insert != NULL) + if (insert != NULL) insert->next = entry; dict->nbElems++; @@ -896,6 +1213,50 @@ xmlDictSize(xmlDictPtr dict) { return(dict->nbElems); } +/** + * xmlDictSetLimit: + * @dict: the dictionnary + * @limit: the limit in bytes + * + * Set a size limit for the dictionary + * Added in 2.9.0 + * + * Returns the previous limit of the dictionary or 0 + */ +size_t +xmlDictSetLimit(xmlDictPtr dict, size_t limit) { + size_t ret; + + if (dict == NULL) + return(0); + ret = dict->limit; + dict->limit = limit; + return(ret); +} + +/** + * xmlDictGetUsage: + * @dict: the dictionnary + * + * Get how much memory is used by a dictionary for strings + * Added in 2.9.0 + * + * Returns the amount of strings allocated + */ +size_t +xmlDictGetUsage(xmlDictPtr dict) { + xmlDictStringsPtr pool; + size_t limit = 0; + + if (dict == NULL) + return(0); + pool = dict->strings; + while (pool != NULL) { + limit += pool->size; + pool = pool->next; + } + return(limit); +} #define bottom_dict #include "elfgcchack.h" diff --git a/gnulib-local/lib/libxml/dict.in.h b/gnulib-local/lib/libxml/dict.in.h index abb8339..7022ec8 100644 --- a/gnulib-local/lib/libxml/dict.in.h +++ b/gnulib-local/lib/libxml/dict.in.h @@ -11,6 +11,7 @@ #ifndef __XML_DICT_H__ #define __XML_DICT_H__ +#include #include #include @@ -24,37 +25,47 @@ extern "C" { typedef struct _xmlDict xmlDict; typedef xmlDict *xmlDictPtr; +/* + * Initializer + */ +XMLPUBFUN int XMLCALL xmlInitializeDict(void); + /* * Constructor and destructor. */ XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreate (void); +XMLPUBFUN size_t XMLCALL + xmlDictSetLimit (xmlDictPtr dict, + size_t limit); +XMLPUBFUN size_t XMLCALL + xmlDictGetUsage (xmlDictPtr dict); XMLPUBFUN xmlDictPtr XMLCALL xmlDictCreateSub(xmlDictPtr sub); XMLPUBFUN int XMLCALL xmlDictReference(xmlDictPtr dict); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDictFree (xmlDictPtr dict); /* * Lookup of entry in the dictionnary. */ -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlDictLookup (xmlDictPtr dict, const xmlChar *name, int len); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlDictExists (xmlDictPtr dict, const xmlChar *name, int len); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlDictQLookup (xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name); XMLPUBFUN int XMLCALL xmlDictOwns (xmlDictPtr dict, const xmlChar *str); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlDictSize (xmlDictPtr dict); /* diff --git a/gnulib-local/lib/libxml/elfgcchack.h b/gnulib-local/lib/libxml/elfgcchack.h index e69de29..8c52884 100644 --- a/gnulib-local/lib/libxml/elfgcchack.h +++ b/gnulib-local/lib/libxml/elfgcchack.h @@ -0,0 +1,17808 @@ +/* + * elfgcchack.h: hack by Arjan van de Ven to speed + * up the code when using gcc for call within the library. + * + * Based on the analysis http://people.redhat.com/drepper/dsohowto.pdf + * from Ulrich drepper. Rewritten to be generated from the XML description + * file for libxml2 API + * autogenerated with xsltproc doc/elfgcchack.xsl doc/libxml2-api.xml + */ + +#ifdef IN_LIBXML +#ifdef __GNUC__ +#ifdef PIC +#ifdef linux +#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3) + +#include "libxml/c14n.h" +#include "libxml/catalog.h" +#include "libxml/chvalid.h" +#include "libxml/debugXML.h" +#include "libxml/dict.h" +#include "libxml/DOCBparser.h" +#include "libxml/encoding.h" +#include "libxml/entities.h" +#include "libxml/globals.h" +#include "libxml/hash.h" +#include "libxml/HTMLparser.h" +#include "libxml/HTMLtree.h" +#include "libxml/list.h" +#include "libxml/nanoftp.h" +#include "libxml/nanohttp.h" +#include "libxml/parser.h" +#include "libxml/parserInternals.h" +#include "libxml/pattern.h" +#include "libxml/relaxng.h" +#include "libxml/SAX2.h" +#include "libxml/SAX.h" +#include "libxml/schemasInternals.h" +#include "libxml/schematron.h" +#include "libxml/threads.h" +#include "libxml/tree.h" +#include "libxml/uri.h" +#include "libxml/valid.h" +#include "libxml/xinclude.h" +#include "libxml/xlink.h" +#include "libxml/xmlautomata.h" +#include "libxml/xmlerror.h" +#include "libxml/xmlexports.h" +#include "libxml/xmlIO.h" +#include "libxml/xmlmemory.h" +#include "libxml/xmlreader.h" +#include "libxml/xmlregexp.h" +#include "libxml/xmlsave.h" +#include "libxml/xmlschemas.h" +#include "libxml/xmlschemastypes.h" +#include "libxml/xmlstring.h" +#include "libxml/xmlunicode.h" +#include "libxml/xmlversion.h" +#include "libxml/xmlwriter.h" +#include "libxml/xpath.h" +#include "libxml/xpathInternals.h" +#include "libxml/xpointer.h" +#include "libxml/xmlmodule.h" + +/* special hot spot not exported ones */ + +#ifdef bottom_globals +#undef __xmlGenericError +extern __typeof (__xmlGenericError) __xmlGenericError __attribute((alias("__xmlGenericError__internal_alias"))); +#else +#ifndef __xmlGenericError +extern __typeof (__xmlGenericError) __xmlGenericError__internal_alias __attribute((visibility("hidden"))); +#define __xmlGenericError __xmlGenericError__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef __xmlGenericErrorContext +extern __typeof (__xmlGenericErrorContext) __xmlGenericErrorContext __attribute((alias("__xmlGenericErrorContext__internal_alias"))); +#else +#ifndef __xmlGenericErrorContext +extern __typeof (__xmlGenericErrorContext) __xmlGenericErrorContext__internal_alias __attribute((visibility("hidden"))); +#define __xmlGenericErrorContext __xmlGenericErrorContext__internal_alias +#endif +#endif + +/* list generated from libxml2-api.xml */ +#if defined(LIBXML_DOCB_ENABLED) +#ifdef bottom_DOCBparser +#undef docbCreatePushParserCtxt +extern __typeof (docbCreatePushParserCtxt) docbCreatePushParserCtxt __attribute((alias("docbCreatePushParserCtxt__internal_alias"))); +#else +#ifndef docbCreatePushParserCtxt +extern __typeof (docbCreatePushParserCtxt) docbCreatePushParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define docbCreatePushParserCtxt docbCreatePushParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlAttrAllowed +extern __typeof (htmlAttrAllowed) htmlAttrAllowed __attribute((alias("htmlAttrAllowed__internal_alias"))); +#else +#ifndef htmlAttrAllowed +extern __typeof (htmlAttrAllowed) htmlAttrAllowed__internal_alias __attribute((visibility("hidden"))); +#define htmlAttrAllowed htmlAttrAllowed__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlAutoCloseTag +extern __typeof (htmlAutoCloseTag) htmlAutoCloseTag __attribute((alias("htmlAutoCloseTag__internal_alias"))); +#else +#ifndef htmlAutoCloseTag +extern __typeof (htmlAutoCloseTag) htmlAutoCloseTag__internal_alias __attribute((visibility("hidden"))); +#define htmlAutoCloseTag htmlAutoCloseTag__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlCreateFileParserCtxt +extern __typeof (htmlCreateFileParserCtxt) htmlCreateFileParserCtxt __attribute((alias("htmlCreateFileParserCtxt__internal_alias"))); +#else +#ifndef htmlCreateFileParserCtxt +extern __typeof (htmlCreateFileParserCtxt) htmlCreateFileParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define htmlCreateFileParserCtxt htmlCreateFileParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlCreateMemoryParserCtxt +extern __typeof (htmlCreateMemoryParserCtxt) htmlCreateMemoryParserCtxt __attribute((alias("htmlCreateMemoryParserCtxt__internal_alias"))); +#else +#ifndef htmlCreateMemoryParserCtxt +extern __typeof (htmlCreateMemoryParserCtxt) htmlCreateMemoryParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define htmlCreateMemoryParserCtxt htmlCreateMemoryParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlCreatePushParserCtxt +extern __typeof (htmlCreatePushParserCtxt) htmlCreatePushParserCtxt __attribute((alias("htmlCreatePushParserCtxt__internal_alias"))); +#else +#ifndef htmlCreatePushParserCtxt +extern __typeof (htmlCreatePushParserCtxt) htmlCreatePushParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define htmlCreatePushParserCtxt htmlCreatePushParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlCtxtReadDoc +extern __typeof (htmlCtxtReadDoc) htmlCtxtReadDoc __attribute((alias("htmlCtxtReadDoc__internal_alias"))); +#else +#ifndef htmlCtxtReadDoc +extern __typeof (htmlCtxtReadDoc) htmlCtxtReadDoc__internal_alias __attribute((visibility("hidden"))); +#define htmlCtxtReadDoc htmlCtxtReadDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlCtxtReadFd +extern __typeof (htmlCtxtReadFd) htmlCtxtReadFd __attribute((alias("htmlCtxtReadFd__internal_alias"))); +#else +#ifndef htmlCtxtReadFd +extern __typeof (htmlCtxtReadFd) htmlCtxtReadFd__internal_alias __attribute((visibility("hidden"))); +#define htmlCtxtReadFd htmlCtxtReadFd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlCtxtReadFile +extern __typeof (htmlCtxtReadFile) htmlCtxtReadFile __attribute((alias("htmlCtxtReadFile__internal_alias"))); +#else +#ifndef htmlCtxtReadFile +extern __typeof (htmlCtxtReadFile) htmlCtxtReadFile__internal_alias __attribute((visibility("hidden"))); +#define htmlCtxtReadFile htmlCtxtReadFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlCtxtReadIO +extern __typeof (htmlCtxtReadIO) htmlCtxtReadIO __attribute((alias("htmlCtxtReadIO__internal_alias"))); +#else +#ifndef htmlCtxtReadIO +extern __typeof (htmlCtxtReadIO) htmlCtxtReadIO__internal_alias __attribute((visibility("hidden"))); +#define htmlCtxtReadIO htmlCtxtReadIO__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlCtxtReadMemory +extern __typeof (htmlCtxtReadMemory) htmlCtxtReadMemory __attribute((alias("htmlCtxtReadMemory__internal_alias"))); +#else +#ifndef htmlCtxtReadMemory +extern __typeof (htmlCtxtReadMemory) htmlCtxtReadMemory__internal_alias __attribute((visibility("hidden"))); +#define htmlCtxtReadMemory htmlCtxtReadMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlCtxtReset +extern __typeof (htmlCtxtReset) htmlCtxtReset __attribute((alias("htmlCtxtReset__internal_alias"))); +#else +#ifndef htmlCtxtReset +extern __typeof (htmlCtxtReset) htmlCtxtReset__internal_alias __attribute((visibility("hidden"))); +#define htmlCtxtReset htmlCtxtReset__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlCtxtUseOptions +extern __typeof (htmlCtxtUseOptions) htmlCtxtUseOptions __attribute((alias("htmlCtxtUseOptions__internal_alias"))); +#else +#ifndef htmlCtxtUseOptions +extern __typeof (htmlCtxtUseOptions) htmlCtxtUseOptions__internal_alias __attribute((visibility("hidden"))); +#define htmlCtxtUseOptions htmlCtxtUseOptions__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_SAX2 +#undef htmlDefaultSAXHandlerInit +extern __typeof (htmlDefaultSAXHandlerInit) htmlDefaultSAXHandlerInit __attribute((alias("htmlDefaultSAXHandlerInit__internal_alias"))); +#else +#ifndef htmlDefaultSAXHandlerInit +extern __typeof (htmlDefaultSAXHandlerInit) htmlDefaultSAXHandlerInit__internal_alias __attribute((visibility("hidden"))); +#define htmlDefaultSAXHandlerInit htmlDefaultSAXHandlerInit__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlDocContentDumpFormatOutput +extern __typeof (htmlDocContentDumpFormatOutput) htmlDocContentDumpFormatOutput __attribute((alias("htmlDocContentDumpFormatOutput__internal_alias"))); +#else +#ifndef htmlDocContentDumpFormatOutput +extern __typeof (htmlDocContentDumpFormatOutput) htmlDocContentDumpFormatOutput__internal_alias __attribute((visibility("hidden"))); +#define htmlDocContentDumpFormatOutput htmlDocContentDumpFormatOutput__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlDocContentDumpOutput +extern __typeof (htmlDocContentDumpOutput) htmlDocContentDumpOutput __attribute((alias("htmlDocContentDumpOutput__internal_alias"))); +#else +#ifndef htmlDocContentDumpOutput +extern __typeof (htmlDocContentDumpOutput) htmlDocContentDumpOutput__internal_alias __attribute((visibility("hidden"))); +#define htmlDocContentDumpOutput htmlDocContentDumpOutput__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlDocDump +extern __typeof (htmlDocDump) htmlDocDump __attribute((alias("htmlDocDump__internal_alias"))); +#else +#ifndef htmlDocDump +extern __typeof (htmlDocDump) htmlDocDump__internal_alias __attribute((visibility("hidden"))); +#define htmlDocDump htmlDocDump__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlDocDumpMemory +extern __typeof (htmlDocDumpMemory) htmlDocDumpMemory __attribute((alias("htmlDocDumpMemory__internal_alias"))); +#else +#ifndef htmlDocDumpMemory +extern __typeof (htmlDocDumpMemory) htmlDocDumpMemory__internal_alias __attribute((visibility("hidden"))); +#define htmlDocDumpMemory htmlDocDumpMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlDocDumpMemoryFormat +extern __typeof (htmlDocDumpMemoryFormat) htmlDocDumpMemoryFormat __attribute((alias("htmlDocDumpMemoryFormat__internal_alias"))); +#else +#ifndef htmlDocDumpMemoryFormat +extern __typeof (htmlDocDumpMemoryFormat) htmlDocDumpMemoryFormat__internal_alias __attribute((visibility("hidden"))); +#define htmlDocDumpMemoryFormat htmlDocDumpMemoryFormat__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlElementAllowedHere +extern __typeof (htmlElementAllowedHere) htmlElementAllowedHere __attribute((alias("htmlElementAllowedHere__internal_alias"))); +#else +#ifndef htmlElementAllowedHere +extern __typeof (htmlElementAllowedHere) htmlElementAllowedHere__internal_alias __attribute((visibility("hidden"))); +#define htmlElementAllowedHere htmlElementAllowedHere__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlElementStatusHere +extern __typeof (htmlElementStatusHere) htmlElementStatusHere __attribute((alias("htmlElementStatusHere__internal_alias"))); +#else +#ifndef htmlElementStatusHere +extern __typeof (htmlElementStatusHere) htmlElementStatusHere__internal_alias __attribute((visibility("hidden"))); +#define htmlElementStatusHere htmlElementStatusHere__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlEncodeEntities +extern __typeof (htmlEncodeEntities) htmlEncodeEntities __attribute((alias("htmlEncodeEntities__internal_alias"))); +#else +#ifndef htmlEncodeEntities +extern __typeof (htmlEncodeEntities) htmlEncodeEntities__internal_alias __attribute((visibility("hidden"))); +#define htmlEncodeEntities htmlEncodeEntities__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlEntityLookup +extern __typeof (htmlEntityLookup) htmlEntityLookup __attribute((alias("htmlEntityLookup__internal_alias"))); +#else +#ifndef htmlEntityLookup +extern __typeof (htmlEntityLookup) htmlEntityLookup__internal_alias __attribute((visibility("hidden"))); +#define htmlEntityLookup htmlEntityLookup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlEntityValueLookup +extern __typeof (htmlEntityValueLookup) htmlEntityValueLookup __attribute((alias("htmlEntityValueLookup__internal_alias"))); +#else +#ifndef htmlEntityValueLookup +extern __typeof (htmlEntityValueLookup) htmlEntityValueLookup__internal_alias __attribute((visibility("hidden"))); +#define htmlEntityValueLookup htmlEntityValueLookup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlFreeParserCtxt +extern __typeof (htmlFreeParserCtxt) htmlFreeParserCtxt __attribute((alias("htmlFreeParserCtxt__internal_alias"))); +#else +#ifndef htmlFreeParserCtxt +extern __typeof (htmlFreeParserCtxt) htmlFreeParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define htmlFreeParserCtxt htmlFreeParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlGetMetaEncoding +extern __typeof (htmlGetMetaEncoding) htmlGetMetaEncoding __attribute((alias("htmlGetMetaEncoding__internal_alias"))); +#else +#ifndef htmlGetMetaEncoding +extern __typeof (htmlGetMetaEncoding) htmlGetMetaEncoding__internal_alias __attribute((visibility("hidden"))); +#define htmlGetMetaEncoding htmlGetMetaEncoding__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlHandleOmittedElem +extern __typeof (htmlHandleOmittedElem) htmlHandleOmittedElem __attribute((alias("htmlHandleOmittedElem__internal_alias"))); +#else +#ifndef htmlHandleOmittedElem +extern __typeof (htmlHandleOmittedElem) htmlHandleOmittedElem__internal_alias __attribute((visibility("hidden"))); +#define htmlHandleOmittedElem htmlHandleOmittedElem__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlInitAutoClose +extern __typeof (htmlInitAutoClose) htmlInitAutoClose __attribute((alias("htmlInitAutoClose__internal_alias"))); +#else +#ifndef htmlInitAutoClose +extern __typeof (htmlInitAutoClose) htmlInitAutoClose__internal_alias __attribute((visibility("hidden"))); +#define htmlInitAutoClose htmlInitAutoClose__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlIsAutoClosed +extern __typeof (htmlIsAutoClosed) htmlIsAutoClosed __attribute((alias("htmlIsAutoClosed__internal_alias"))); +#else +#ifndef htmlIsAutoClosed +extern __typeof (htmlIsAutoClosed) htmlIsAutoClosed__internal_alias __attribute((visibility("hidden"))); +#define htmlIsAutoClosed htmlIsAutoClosed__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlIsBooleanAttr +extern __typeof (htmlIsBooleanAttr) htmlIsBooleanAttr __attribute((alias("htmlIsBooleanAttr__internal_alias"))); +#else +#ifndef htmlIsBooleanAttr +extern __typeof (htmlIsBooleanAttr) htmlIsBooleanAttr__internal_alias __attribute((visibility("hidden"))); +#define htmlIsBooleanAttr htmlIsBooleanAttr__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlIsScriptAttribute +extern __typeof (htmlIsScriptAttribute) htmlIsScriptAttribute __attribute((alias("htmlIsScriptAttribute__internal_alias"))); +#else +#ifndef htmlIsScriptAttribute +extern __typeof (htmlIsScriptAttribute) htmlIsScriptAttribute__internal_alias __attribute((visibility("hidden"))); +#define htmlIsScriptAttribute htmlIsScriptAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlNewDoc +extern __typeof (htmlNewDoc) htmlNewDoc __attribute((alias("htmlNewDoc__internal_alias"))); +#else +#ifndef htmlNewDoc +extern __typeof (htmlNewDoc) htmlNewDoc__internal_alias __attribute((visibility("hidden"))); +#define htmlNewDoc htmlNewDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlNewDocNoDtD +extern __typeof (htmlNewDocNoDtD) htmlNewDocNoDtD __attribute((alias("htmlNewDocNoDtD__internal_alias"))); +#else +#ifndef htmlNewDocNoDtD +extern __typeof (htmlNewDocNoDtD) htmlNewDocNoDtD__internal_alias __attribute((visibility("hidden"))); +#define htmlNewDocNoDtD htmlNewDocNoDtD__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlNewParserCtxt +extern __typeof (htmlNewParserCtxt) htmlNewParserCtxt __attribute((alias("htmlNewParserCtxt__internal_alias"))); +#else +#ifndef htmlNewParserCtxt +extern __typeof (htmlNewParserCtxt) htmlNewParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define htmlNewParserCtxt htmlNewParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlNodeDump +extern __typeof (htmlNodeDump) htmlNodeDump __attribute((alias("htmlNodeDump__internal_alias"))); +#else +#ifndef htmlNodeDump +extern __typeof (htmlNodeDump) htmlNodeDump__internal_alias __attribute((visibility("hidden"))); +#define htmlNodeDump htmlNodeDump__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlNodeDumpFile +extern __typeof (htmlNodeDumpFile) htmlNodeDumpFile __attribute((alias("htmlNodeDumpFile__internal_alias"))); +#else +#ifndef htmlNodeDumpFile +extern __typeof (htmlNodeDumpFile) htmlNodeDumpFile__internal_alias __attribute((visibility("hidden"))); +#define htmlNodeDumpFile htmlNodeDumpFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlNodeDumpFileFormat +extern __typeof (htmlNodeDumpFileFormat) htmlNodeDumpFileFormat __attribute((alias("htmlNodeDumpFileFormat__internal_alias"))); +#else +#ifndef htmlNodeDumpFileFormat +extern __typeof (htmlNodeDumpFileFormat) htmlNodeDumpFileFormat__internal_alias __attribute((visibility("hidden"))); +#define htmlNodeDumpFileFormat htmlNodeDumpFileFormat__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlNodeDumpFormatOutput +extern __typeof (htmlNodeDumpFormatOutput) htmlNodeDumpFormatOutput __attribute((alias("htmlNodeDumpFormatOutput__internal_alias"))); +#else +#ifndef htmlNodeDumpFormatOutput +extern __typeof (htmlNodeDumpFormatOutput) htmlNodeDumpFormatOutput__internal_alias __attribute((visibility("hidden"))); +#define htmlNodeDumpFormatOutput htmlNodeDumpFormatOutput__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlNodeDumpOutput +extern __typeof (htmlNodeDumpOutput) htmlNodeDumpOutput __attribute((alias("htmlNodeDumpOutput__internal_alias"))); +#else +#ifndef htmlNodeDumpOutput +extern __typeof (htmlNodeDumpOutput) htmlNodeDumpOutput__internal_alias __attribute((visibility("hidden"))); +#define htmlNodeDumpOutput htmlNodeDumpOutput__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlNodeStatus +extern __typeof (htmlNodeStatus) htmlNodeStatus __attribute((alias("htmlNodeStatus__internal_alias"))); +#else +#ifndef htmlNodeStatus +extern __typeof (htmlNodeStatus) htmlNodeStatus__internal_alias __attribute((visibility("hidden"))); +#define htmlNodeStatus htmlNodeStatus__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlParseCharRef +extern __typeof (htmlParseCharRef) htmlParseCharRef __attribute((alias("htmlParseCharRef__internal_alias"))); +#else +#ifndef htmlParseCharRef +extern __typeof (htmlParseCharRef) htmlParseCharRef__internal_alias __attribute((visibility("hidden"))); +#define htmlParseCharRef htmlParseCharRef__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlParseChunk +extern __typeof (htmlParseChunk) htmlParseChunk __attribute((alias("htmlParseChunk__internal_alias"))); +#else +#ifndef htmlParseChunk +extern __typeof (htmlParseChunk) htmlParseChunk__internal_alias __attribute((visibility("hidden"))); +#define htmlParseChunk htmlParseChunk__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlParseDoc +extern __typeof (htmlParseDoc) htmlParseDoc __attribute((alias("htmlParseDoc__internal_alias"))); +#else +#ifndef htmlParseDoc +extern __typeof (htmlParseDoc) htmlParseDoc__internal_alias __attribute((visibility("hidden"))); +#define htmlParseDoc htmlParseDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlParseDocument +extern __typeof (htmlParseDocument) htmlParseDocument __attribute((alias("htmlParseDocument__internal_alias"))); +#else +#ifndef htmlParseDocument +extern __typeof (htmlParseDocument) htmlParseDocument__internal_alias __attribute((visibility("hidden"))); +#define htmlParseDocument htmlParseDocument__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlParseElement +extern __typeof (htmlParseElement) htmlParseElement __attribute((alias("htmlParseElement__internal_alias"))); +#else +#ifndef htmlParseElement +extern __typeof (htmlParseElement) htmlParseElement__internal_alias __attribute((visibility("hidden"))); +#define htmlParseElement htmlParseElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlParseEntityRef +extern __typeof (htmlParseEntityRef) htmlParseEntityRef __attribute((alias("htmlParseEntityRef__internal_alias"))); +#else +#ifndef htmlParseEntityRef +extern __typeof (htmlParseEntityRef) htmlParseEntityRef__internal_alias __attribute((visibility("hidden"))); +#define htmlParseEntityRef htmlParseEntityRef__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlParseFile +extern __typeof (htmlParseFile) htmlParseFile __attribute((alias("htmlParseFile__internal_alias"))); +#else +#ifndef htmlParseFile +extern __typeof (htmlParseFile) htmlParseFile__internal_alias __attribute((visibility("hidden"))); +#define htmlParseFile htmlParseFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlReadDoc +extern __typeof (htmlReadDoc) htmlReadDoc __attribute((alias("htmlReadDoc__internal_alias"))); +#else +#ifndef htmlReadDoc +extern __typeof (htmlReadDoc) htmlReadDoc__internal_alias __attribute((visibility("hidden"))); +#define htmlReadDoc htmlReadDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlReadFd +extern __typeof (htmlReadFd) htmlReadFd __attribute((alias("htmlReadFd__internal_alias"))); +#else +#ifndef htmlReadFd +extern __typeof (htmlReadFd) htmlReadFd__internal_alias __attribute((visibility("hidden"))); +#define htmlReadFd htmlReadFd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlReadFile +extern __typeof (htmlReadFile) htmlReadFile __attribute((alias("htmlReadFile__internal_alias"))); +#else +#ifndef htmlReadFile +extern __typeof (htmlReadFile) htmlReadFile__internal_alias __attribute((visibility("hidden"))); +#define htmlReadFile htmlReadFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlReadIO +extern __typeof (htmlReadIO) htmlReadIO __attribute((alias("htmlReadIO__internal_alias"))); +#else +#ifndef htmlReadIO +extern __typeof (htmlReadIO) htmlReadIO__internal_alias __attribute((visibility("hidden"))); +#define htmlReadIO htmlReadIO__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlReadMemory +extern __typeof (htmlReadMemory) htmlReadMemory __attribute((alias("htmlReadMemory__internal_alias"))); +#else +#ifndef htmlReadMemory +extern __typeof (htmlReadMemory) htmlReadMemory__internal_alias __attribute((visibility("hidden"))); +#define htmlReadMemory htmlReadMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlSAXParseDoc +extern __typeof (htmlSAXParseDoc) htmlSAXParseDoc __attribute((alias("htmlSAXParseDoc__internal_alias"))); +#else +#ifndef htmlSAXParseDoc +extern __typeof (htmlSAXParseDoc) htmlSAXParseDoc__internal_alias __attribute((visibility("hidden"))); +#define htmlSAXParseDoc htmlSAXParseDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlSAXParseFile +extern __typeof (htmlSAXParseFile) htmlSAXParseFile __attribute((alias("htmlSAXParseFile__internal_alias"))); +#else +#ifndef htmlSAXParseFile +extern __typeof (htmlSAXParseFile) htmlSAXParseFile__internal_alias __attribute((visibility("hidden"))); +#define htmlSAXParseFile htmlSAXParseFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlSaveFile +extern __typeof (htmlSaveFile) htmlSaveFile __attribute((alias("htmlSaveFile__internal_alias"))); +#else +#ifndef htmlSaveFile +extern __typeof (htmlSaveFile) htmlSaveFile__internal_alias __attribute((visibility("hidden"))); +#define htmlSaveFile htmlSaveFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlSaveFileEnc +extern __typeof (htmlSaveFileEnc) htmlSaveFileEnc __attribute((alias("htmlSaveFileEnc__internal_alias"))); +#else +#ifndef htmlSaveFileEnc +extern __typeof (htmlSaveFileEnc) htmlSaveFileEnc__internal_alias __attribute((visibility("hidden"))); +#define htmlSaveFileEnc htmlSaveFileEnc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlSaveFileFormat +extern __typeof (htmlSaveFileFormat) htmlSaveFileFormat __attribute((alias("htmlSaveFileFormat__internal_alias"))); +#else +#ifndef htmlSaveFileFormat +extern __typeof (htmlSaveFileFormat) htmlSaveFileFormat__internal_alias __attribute((visibility("hidden"))); +#define htmlSaveFileFormat htmlSaveFileFormat__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLtree +#undef htmlSetMetaEncoding +extern __typeof (htmlSetMetaEncoding) htmlSetMetaEncoding __attribute((alias("htmlSetMetaEncoding__internal_alias"))); +#else +#ifndef htmlSetMetaEncoding +extern __typeof (htmlSetMetaEncoding) htmlSetMetaEncoding__internal_alias __attribute((visibility("hidden"))); +#define htmlSetMetaEncoding htmlSetMetaEncoding__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_HTMLparser +#undef htmlTagLookup +extern __typeof (htmlTagLookup) htmlTagLookup __attribute((alias("htmlTagLookup__internal_alias"))); +#else +#ifndef htmlTagLookup +extern __typeof (htmlTagLookup) htmlTagLookup__internal_alias __attribute((visibility("hidden"))); +#define htmlTagLookup htmlTagLookup__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef inputPop +extern __typeof (inputPop) inputPop __attribute((alias("inputPop__internal_alias"))); +#else +#ifndef inputPop +extern __typeof (inputPop) inputPop__internal_alias __attribute((visibility("hidden"))); +#define inputPop inputPop__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef inputPush +extern __typeof (inputPush) inputPush __attribute((alias("inputPush__internal_alias"))); +#else +#ifndef inputPush +extern __typeof (inputPush) inputPush__internal_alias __attribute((visibility("hidden"))); +#define inputPush inputPush__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef namePop +extern __typeof (namePop) namePop __attribute((alias("namePop__internal_alias"))); +#else +#ifndef namePop +extern __typeof (namePop) namePop__internal_alias __attribute((visibility("hidden"))); +#define namePop namePop__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef namePush +extern __typeof (namePush) namePush __attribute((alias("namePush__internal_alias"))); +#else +#ifndef namePush +extern __typeof (namePush) namePush__internal_alias __attribute((visibility("hidden"))); +#define namePush namePush__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef nodePop +extern __typeof (nodePop) nodePop __attribute((alias("nodePop__internal_alias"))); +#else +#ifndef nodePop +extern __typeof (nodePop) nodePop__internal_alias __attribute((visibility("hidden"))); +#define nodePop nodePop__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef nodePush +extern __typeof (nodePush) nodePush __attribute((alias("nodePush__internal_alias"))); +#else +#ifndef nodePush +extern __typeof (nodePush) nodePush__internal_alias __attribute((visibility("hidden"))); +#define nodePush nodePush__internal_alias +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef valuePop +extern __typeof (valuePop) valuePop __attribute((alias("valuePop__internal_alias"))); +#else +#ifndef valuePop +extern __typeof (valuePop) valuePop__internal_alias __attribute((visibility("hidden"))); +#define valuePop valuePop__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef valuePush +extern __typeof (valuePush) valuePush __attribute((alias("valuePush__internal_alias"))); +#else +#ifndef valuePush +extern __typeof (valuePush) valuePush__internal_alias __attribute((visibility("hidden"))); +#define valuePush valuePush__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlACatalogAdd +extern __typeof (xmlACatalogAdd) xmlACatalogAdd __attribute((alias("xmlACatalogAdd__internal_alias"))); +#else +#ifndef xmlACatalogAdd +extern __typeof (xmlACatalogAdd) xmlACatalogAdd__internal_alias __attribute((visibility("hidden"))); +#define xmlACatalogAdd xmlACatalogAdd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_catalog +#undef xmlACatalogDump +extern __typeof (xmlACatalogDump) xmlACatalogDump __attribute((alias("xmlACatalogDump__internal_alias"))); +#else +#ifndef xmlACatalogDump +extern __typeof (xmlACatalogDump) xmlACatalogDump__internal_alias __attribute((visibility("hidden"))); +#define xmlACatalogDump xmlACatalogDump__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlACatalogRemove +extern __typeof (xmlACatalogRemove) xmlACatalogRemove __attribute((alias("xmlACatalogRemove__internal_alias"))); +#else +#ifndef xmlACatalogRemove +extern __typeof (xmlACatalogRemove) xmlACatalogRemove__internal_alias __attribute((visibility("hidden"))); +#define xmlACatalogRemove xmlACatalogRemove__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlACatalogResolve +extern __typeof (xmlACatalogResolve) xmlACatalogResolve __attribute((alias("xmlACatalogResolve__internal_alias"))); +#else +#ifndef xmlACatalogResolve +extern __typeof (xmlACatalogResolve) xmlACatalogResolve__internal_alias __attribute((visibility("hidden"))); +#define xmlACatalogResolve xmlACatalogResolve__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlACatalogResolvePublic +extern __typeof (xmlACatalogResolvePublic) xmlACatalogResolvePublic __attribute((alias("xmlACatalogResolvePublic__internal_alias"))); +#else +#ifndef xmlACatalogResolvePublic +extern __typeof (xmlACatalogResolvePublic) xmlACatalogResolvePublic__internal_alias __attribute((visibility("hidden"))); +#define xmlACatalogResolvePublic xmlACatalogResolvePublic__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlACatalogResolveSystem +extern __typeof (xmlACatalogResolveSystem) xmlACatalogResolveSystem __attribute((alias("xmlACatalogResolveSystem__internal_alias"))); +#else +#ifndef xmlACatalogResolveSystem +extern __typeof (xmlACatalogResolveSystem) xmlACatalogResolveSystem__internal_alias __attribute((visibility("hidden"))); +#define xmlACatalogResolveSystem xmlACatalogResolveSystem__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlACatalogResolveURI +extern __typeof (xmlACatalogResolveURI) xmlACatalogResolveURI __attribute((alias("xmlACatalogResolveURI__internal_alias"))); +#else +#ifndef xmlACatalogResolveURI +extern __typeof (xmlACatalogResolveURI) xmlACatalogResolveURI__internal_alias __attribute((visibility("hidden"))); +#define xmlACatalogResolveURI xmlACatalogResolveURI__internal_alias +#endif +#endif +#endif + +#ifdef bottom_valid +#undef xmlAddAttributeDecl +extern __typeof (xmlAddAttributeDecl) xmlAddAttributeDecl __attribute((alias("xmlAddAttributeDecl__internal_alias"))); +#else +#ifndef xmlAddAttributeDecl +extern __typeof (xmlAddAttributeDecl) xmlAddAttributeDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlAddAttributeDecl xmlAddAttributeDecl__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlAddChild +extern __typeof (xmlAddChild) xmlAddChild __attribute((alias("xmlAddChild__internal_alias"))); +#else +#ifndef xmlAddChild +extern __typeof (xmlAddChild) xmlAddChild__internal_alias __attribute((visibility("hidden"))); +#define xmlAddChild xmlAddChild__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlAddChildList +extern __typeof (xmlAddChildList) xmlAddChildList __attribute((alias("xmlAddChildList__internal_alias"))); +#else +#ifndef xmlAddChildList +extern __typeof (xmlAddChildList) xmlAddChildList__internal_alias __attribute((visibility("hidden"))); +#define xmlAddChildList xmlAddChildList__internal_alias +#endif +#endif + +#ifdef bottom_entities +#undef xmlAddDocEntity +extern __typeof (xmlAddDocEntity) xmlAddDocEntity __attribute((alias("xmlAddDocEntity__internal_alias"))); +#else +#ifndef xmlAddDocEntity +extern __typeof (xmlAddDocEntity) xmlAddDocEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlAddDocEntity xmlAddDocEntity__internal_alias +#endif +#endif + +#ifdef bottom_entities +#undef xmlAddDtdEntity +extern __typeof (xmlAddDtdEntity) xmlAddDtdEntity __attribute((alias("xmlAddDtdEntity__internal_alias"))); +#else +#ifndef xmlAddDtdEntity +extern __typeof (xmlAddDtdEntity) xmlAddDtdEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlAddDtdEntity xmlAddDtdEntity__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlAddElementDecl +extern __typeof (xmlAddElementDecl) xmlAddElementDecl __attribute((alias("xmlAddElementDecl__internal_alias"))); +#else +#ifndef xmlAddElementDecl +extern __typeof (xmlAddElementDecl) xmlAddElementDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlAddElementDecl xmlAddElementDecl__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlAddEncodingAlias +extern __typeof (xmlAddEncodingAlias) xmlAddEncodingAlias __attribute((alias("xmlAddEncodingAlias__internal_alias"))); +#else +#ifndef xmlAddEncodingAlias +extern __typeof (xmlAddEncodingAlias) xmlAddEncodingAlias__internal_alias __attribute((visibility("hidden"))); +#define xmlAddEncodingAlias xmlAddEncodingAlias__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlAddID +extern __typeof (xmlAddID) xmlAddID __attribute((alias("xmlAddID__internal_alias"))); +#else +#ifndef xmlAddID +extern __typeof (xmlAddID) xmlAddID__internal_alias __attribute((visibility("hidden"))); +#define xmlAddID xmlAddID__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlAddNextSibling +extern __typeof (xmlAddNextSibling) xmlAddNextSibling __attribute((alias("xmlAddNextSibling__internal_alias"))); +#else +#ifndef xmlAddNextSibling +extern __typeof (xmlAddNextSibling) xmlAddNextSibling__internal_alias __attribute((visibility("hidden"))); +#define xmlAddNextSibling xmlAddNextSibling__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlAddNotationDecl +extern __typeof (xmlAddNotationDecl) xmlAddNotationDecl __attribute((alias("xmlAddNotationDecl__internal_alias"))); +#else +#ifndef xmlAddNotationDecl +extern __typeof (xmlAddNotationDecl) xmlAddNotationDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlAddNotationDecl xmlAddNotationDecl__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_tree +#undef xmlAddPrevSibling +extern __typeof (xmlAddPrevSibling) xmlAddPrevSibling __attribute((alias("xmlAddPrevSibling__internal_alias"))); +#else +#ifndef xmlAddPrevSibling +extern __typeof (xmlAddPrevSibling) xmlAddPrevSibling__internal_alias __attribute((visibility("hidden"))); +#define xmlAddPrevSibling xmlAddPrevSibling__internal_alias +#endif +#endif +#endif + +#ifdef bottom_valid +#undef xmlAddRef +extern __typeof (xmlAddRef) xmlAddRef __attribute((alias("xmlAddRef__internal_alias"))); +#else +#ifndef xmlAddRef +extern __typeof (xmlAddRef) xmlAddRef__internal_alias __attribute((visibility("hidden"))); +#define xmlAddRef xmlAddRef__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlAddSibling +extern __typeof (xmlAddSibling) xmlAddSibling __attribute((alias("xmlAddSibling__internal_alias"))); +#else +#ifndef xmlAddSibling +extern __typeof (xmlAddSibling) xmlAddSibling__internal_alias __attribute((visibility("hidden"))); +#define xmlAddSibling xmlAddSibling__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlAllocOutputBuffer +extern __typeof (xmlAllocOutputBuffer) xmlAllocOutputBuffer __attribute((alias("xmlAllocOutputBuffer__internal_alias"))); +#else +#ifndef xmlAllocOutputBuffer +extern __typeof (xmlAllocOutputBuffer) xmlAllocOutputBuffer__internal_alias __attribute((visibility("hidden"))); +#define xmlAllocOutputBuffer xmlAllocOutputBuffer__internal_alias +#endif +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlAllocParserInputBuffer +extern __typeof (xmlAllocParserInputBuffer) xmlAllocParserInputBuffer __attribute((alias("xmlAllocParserInputBuffer__internal_alias"))); +#else +#ifndef xmlAllocParserInputBuffer +extern __typeof (xmlAllocParserInputBuffer) xmlAllocParserInputBuffer__internal_alias __attribute((visibility("hidden"))); +#define xmlAllocParserInputBuffer xmlAllocParserInputBuffer__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlAttrSerializeTxtContent +extern __typeof (xmlAttrSerializeTxtContent) xmlAttrSerializeTxtContent __attribute((alias("xmlAttrSerializeTxtContent__internal_alias"))); +#else +#ifndef xmlAttrSerializeTxtContent +extern __typeof (xmlAttrSerializeTxtContent) xmlAttrSerializeTxtContent__internal_alias __attribute((visibility("hidden"))); +#define xmlAttrSerializeTxtContent xmlAttrSerializeTxtContent__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataCompile +extern __typeof (xmlAutomataCompile) xmlAutomataCompile __attribute((alias("xmlAutomataCompile__internal_alias"))); +#else +#ifndef xmlAutomataCompile +extern __typeof (xmlAutomataCompile) xmlAutomataCompile__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataCompile xmlAutomataCompile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataGetInitState +extern __typeof (xmlAutomataGetInitState) xmlAutomataGetInitState __attribute((alias("xmlAutomataGetInitState__internal_alias"))); +#else +#ifndef xmlAutomataGetInitState +extern __typeof (xmlAutomataGetInitState) xmlAutomataGetInitState__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataGetInitState xmlAutomataGetInitState__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataIsDeterminist +extern __typeof (xmlAutomataIsDeterminist) xmlAutomataIsDeterminist __attribute((alias("xmlAutomataIsDeterminist__internal_alias"))); +#else +#ifndef xmlAutomataIsDeterminist +extern __typeof (xmlAutomataIsDeterminist) xmlAutomataIsDeterminist__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataIsDeterminist xmlAutomataIsDeterminist__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewAllTrans +extern __typeof (xmlAutomataNewAllTrans) xmlAutomataNewAllTrans __attribute((alias("xmlAutomataNewAllTrans__internal_alias"))); +#else +#ifndef xmlAutomataNewAllTrans +extern __typeof (xmlAutomataNewAllTrans) xmlAutomataNewAllTrans__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewAllTrans xmlAutomataNewAllTrans__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewCountTrans +extern __typeof (xmlAutomataNewCountTrans) xmlAutomataNewCountTrans __attribute((alias("xmlAutomataNewCountTrans__internal_alias"))); +#else +#ifndef xmlAutomataNewCountTrans +extern __typeof (xmlAutomataNewCountTrans) xmlAutomataNewCountTrans__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewCountTrans xmlAutomataNewCountTrans__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewCountTrans2 +extern __typeof (xmlAutomataNewCountTrans2) xmlAutomataNewCountTrans2 __attribute((alias("xmlAutomataNewCountTrans2__internal_alias"))); +#else +#ifndef xmlAutomataNewCountTrans2 +extern __typeof (xmlAutomataNewCountTrans2) xmlAutomataNewCountTrans2__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewCountTrans2 xmlAutomataNewCountTrans2__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewCountedTrans +extern __typeof (xmlAutomataNewCountedTrans) xmlAutomataNewCountedTrans __attribute((alias("xmlAutomataNewCountedTrans__internal_alias"))); +#else +#ifndef xmlAutomataNewCountedTrans +extern __typeof (xmlAutomataNewCountedTrans) xmlAutomataNewCountedTrans__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewCountedTrans xmlAutomataNewCountedTrans__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewCounter +extern __typeof (xmlAutomataNewCounter) xmlAutomataNewCounter __attribute((alias("xmlAutomataNewCounter__internal_alias"))); +#else +#ifndef xmlAutomataNewCounter +extern __typeof (xmlAutomataNewCounter) xmlAutomataNewCounter__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewCounter xmlAutomataNewCounter__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewCounterTrans +extern __typeof (xmlAutomataNewCounterTrans) xmlAutomataNewCounterTrans __attribute((alias("xmlAutomataNewCounterTrans__internal_alias"))); +#else +#ifndef xmlAutomataNewCounterTrans +extern __typeof (xmlAutomataNewCounterTrans) xmlAutomataNewCounterTrans__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewCounterTrans xmlAutomataNewCounterTrans__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewEpsilon +extern __typeof (xmlAutomataNewEpsilon) xmlAutomataNewEpsilon __attribute((alias("xmlAutomataNewEpsilon__internal_alias"))); +#else +#ifndef xmlAutomataNewEpsilon +extern __typeof (xmlAutomataNewEpsilon) xmlAutomataNewEpsilon__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewEpsilon xmlAutomataNewEpsilon__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewNegTrans +extern __typeof (xmlAutomataNewNegTrans) xmlAutomataNewNegTrans __attribute((alias("xmlAutomataNewNegTrans__internal_alias"))); +#else +#ifndef xmlAutomataNewNegTrans +extern __typeof (xmlAutomataNewNegTrans) xmlAutomataNewNegTrans__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewNegTrans xmlAutomataNewNegTrans__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewOnceTrans +extern __typeof (xmlAutomataNewOnceTrans) xmlAutomataNewOnceTrans __attribute((alias("xmlAutomataNewOnceTrans__internal_alias"))); +#else +#ifndef xmlAutomataNewOnceTrans +extern __typeof (xmlAutomataNewOnceTrans) xmlAutomataNewOnceTrans__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewOnceTrans xmlAutomataNewOnceTrans__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewOnceTrans2 +extern __typeof (xmlAutomataNewOnceTrans2) xmlAutomataNewOnceTrans2 __attribute((alias("xmlAutomataNewOnceTrans2__internal_alias"))); +#else +#ifndef xmlAutomataNewOnceTrans2 +extern __typeof (xmlAutomataNewOnceTrans2) xmlAutomataNewOnceTrans2__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewOnceTrans2 xmlAutomataNewOnceTrans2__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewState +extern __typeof (xmlAutomataNewState) xmlAutomataNewState __attribute((alias("xmlAutomataNewState__internal_alias"))); +#else +#ifndef xmlAutomataNewState +extern __typeof (xmlAutomataNewState) xmlAutomataNewState__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewState xmlAutomataNewState__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewTransition +extern __typeof (xmlAutomataNewTransition) xmlAutomataNewTransition __attribute((alias("xmlAutomataNewTransition__internal_alias"))); +#else +#ifndef xmlAutomataNewTransition +extern __typeof (xmlAutomataNewTransition) xmlAutomataNewTransition__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewTransition xmlAutomataNewTransition__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataNewTransition2 +extern __typeof (xmlAutomataNewTransition2) xmlAutomataNewTransition2 __attribute((alias("xmlAutomataNewTransition2__internal_alias"))); +#else +#ifndef xmlAutomataNewTransition2 +extern __typeof (xmlAutomataNewTransition2) xmlAutomataNewTransition2__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataNewTransition2 xmlAutomataNewTransition2__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlAutomataSetFinalState +extern __typeof (xmlAutomataSetFinalState) xmlAutomataSetFinalState __attribute((alias("xmlAutomataSetFinalState__internal_alias"))); +#else +#ifndef xmlAutomataSetFinalState +extern __typeof (xmlAutomataSetFinalState) xmlAutomataSetFinalState__internal_alias __attribute((visibility("hidden"))); +#define xmlAutomataSetFinalState xmlAutomataSetFinalState__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlBoolToText +extern __typeof (xmlBoolToText) xmlBoolToText __attribute((alias("xmlBoolToText__internal_alias"))); +#else +#ifndef xmlBoolToText +extern __typeof (xmlBoolToText) xmlBoolToText__internal_alias __attribute((visibility("hidden"))); +#define xmlBoolToText xmlBoolToText__internal_alias +#endif +#endif +#endif + +#ifdef bottom_buf +#undef xmlBufContent +extern __typeof (xmlBufContent) xmlBufContent __attribute((alias("xmlBufContent__internal_alias"))); +#else +#ifndef xmlBufContent +extern __typeof (xmlBufContent) xmlBufContent__internal_alias __attribute((visibility("hidden"))); +#define xmlBufContent xmlBufContent__internal_alias +#endif +#endif + +#ifdef bottom_buf +#undef xmlBufEnd +extern __typeof (xmlBufEnd) xmlBufEnd __attribute((alias("xmlBufEnd__internal_alias"))); +#else +#ifndef xmlBufEnd +extern __typeof (xmlBufEnd) xmlBufEnd__internal_alias __attribute((visibility("hidden"))); +#define xmlBufEnd xmlBufEnd__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufGetNodeContent +extern __typeof (xmlBufGetNodeContent) xmlBufGetNodeContent __attribute((alias("xmlBufGetNodeContent__internal_alias"))); +#else +#ifndef xmlBufGetNodeContent +extern __typeof (xmlBufGetNodeContent) xmlBufGetNodeContent__internal_alias __attribute((visibility("hidden"))); +#define xmlBufGetNodeContent xmlBufGetNodeContent__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlBufNodeDump +extern __typeof (xmlBufNodeDump) xmlBufNodeDump __attribute((alias("xmlBufNodeDump__internal_alias"))); +#else +#ifndef xmlBufNodeDump +extern __typeof (xmlBufNodeDump) xmlBufNodeDump__internal_alias __attribute((visibility("hidden"))); +#define xmlBufNodeDump xmlBufNodeDump__internal_alias +#endif +#endif +#endif + +#ifdef bottom_buf +#undef xmlBufShrink +extern __typeof (xmlBufShrink) xmlBufShrink __attribute((alias("xmlBufShrink__internal_alias"))); +#else +#ifndef xmlBufShrink +extern __typeof (xmlBufShrink) xmlBufShrink__internal_alias __attribute((visibility("hidden"))); +#define xmlBufShrink xmlBufShrink__internal_alias +#endif +#endif + +#ifdef bottom_buf +#undef xmlBufUse +extern __typeof (xmlBufUse) xmlBufUse __attribute((alias("xmlBufUse__internal_alias"))); +#else +#ifndef xmlBufUse +extern __typeof (xmlBufUse) xmlBufUse__internal_alias __attribute((visibility("hidden"))); +#define xmlBufUse xmlBufUse__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferAdd +extern __typeof (xmlBufferAdd) xmlBufferAdd __attribute((alias("xmlBufferAdd__internal_alias"))); +#else +#ifndef xmlBufferAdd +extern __typeof (xmlBufferAdd) xmlBufferAdd__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferAdd xmlBufferAdd__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferAddHead +extern __typeof (xmlBufferAddHead) xmlBufferAddHead __attribute((alias("xmlBufferAddHead__internal_alias"))); +#else +#ifndef xmlBufferAddHead +extern __typeof (xmlBufferAddHead) xmlBufferAddHead__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferAddHead xmlBufferAddHead__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferCCat +extern __typeof (xmlBufferCCat) xmlBufferCCat __attribute((alias("xmlBufferCCat__internal_alias"))); +#else +#ifndef xmlBufferCCat +extern __typeof (xmlBufferCCat) xmlBufferCCat__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferCCat xmlBufferCCat__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferCat +extern __typeof (xmlBufferCat) xmlBufferCat __attribute((alias("xmlBufferCat__internal_alias"))); +#else +#ifndef xmlBufferCat +extern __typeof (xmlBufferCat) xmlBufferCat__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferCat xmlBufferCat__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferContent +extern __typeof (xmlBufferContent) xmlBufferContent __attribute((alias("xmlBufferContent__internal_alias"))); +#else +#ifndef xmlBufferContent +extern __typeof (xmlBufferContent) xmlBufferContent__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferContent xmlBufferContent__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferCreate +extern __typeof (xmlBufferCreate) xmlBufferCreate __attribute((alias("xmlBufferCreate__internal_alias"))); +#else +#ifndef xmlBufferCreate +extern __typeof (xmlBufferCreate) xmlBufferCreate__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferCreate xmlBufferCreate__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferCreateSize +extern __typeof (xmlBufferCreateSize) xmlBufferCreateSize __attribute((alias("xmlBufferCreateSize__internal_alias"))); +#else +#ifndef xmlBufferCreateSize +extern __typeof (xmlBufferCreateSize) xmlBufferCreateSize__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferCreateSize xmlBufferCreateSize__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferCreateStatic +extern __typeof (xmlBufferCreateStatic) xmlBufferCreateStatic __attribute((alias("xmlBufferCreateStatic__internal_alias"))); +#else +#ifndef xmlBufferCreateStatic +extern __typeof (xmlBufferCreateStatic) xmlBufferCreateStatic__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferCreateStatic xmlBufferCreateStatic__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferDetach +extern __typeof (xmlBufferDetach) xmlBufferDetach __attribute((alias("xmlBufferDetach__internal_alias"))); +#else +#ifndef xmlBufferDetach +extern __typeof (xmlBufferDetach) xmlBufferDetach__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferDetach xmlBufferDetach__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferDump +extern __typeof (xmlBufferDump) xmlBufferDump __attribute((alias("xmlBufferDump__internal_alias"))); +#else +#ifndef xmlBufferDump +extern __typeof (xmlBufferDump) xmlBufferDump__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferDump xmlBufferDump__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferEmpty +extern __typeof (xmlBufferEmpty) xmlBufferEmpty __attribute((alias("xmlBufferEmpty__internal_alias"))); +#else +#ifndef xmlBufferEmpty +extern __typeof (xmlBufferEmpty) xmlBufferEmpty__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferEmpty xmlBufferEmpty__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferFree +extern __typeof (xmlBufferFree) xmlBufferFree __attribute((alias("xmlBufferFree__internal_alias"))); +#else +#ifndef xmlBufferFree +extern __typeof (xmlBufferFree) xmlBufferFree__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferFree xmlBufferFree__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferGrow +extern __typeof (xmlBufferGrow) xmlBufferGrow __attribute((alias("xmlBufferGrow__internal_alias"))); +#else +#ifndef xmlBufferGrow +extern __typeof (xmlBufferGrow) xmlBufferGrow__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferGrow xmlBufferGrow__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferLength +extern __typeof (xmlBufferLength) xmlBufferLength __attribute((alias("xmlBufferLength__internal_alias"))); +#else +#ifndef xmlBufferLength +extern __typeof (xmlBufferLength) xmlBufferLength__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferLength xmlBufferLength__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferResize +extern __typeof (xmlBufferResize) xmlBufferResize __attribute((alias("xmlBufferResize__internal_alias"))); +#else +#ifndef xmlBufferResize +extern __typeof (xmlBufferResize) xmlBufferResize__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferResize xmlBufferResize__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferSetAllocationScheme +extern __typeof (xmlBufferSetAllocationScheme) xmlBufferSetAllocationScheme __attribute((alias("xmlBufferSetAllocationScheme__internal_alias"))); +#else +#ifndef xmlBufferSetAllocationScheme +extern __typeof (xmlBufferSetAllocationScheme) xmlBufferSetAllocationScheme__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferSetAllocationScheme xmlBufferSetAllocationScheme__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferShrink +extern __typeof (xmlBufferShrink) xmlBufferShrink __attribute((alias("xmlBufferShrink__internal_alias"))); +#else +#ifndef xmlBufferShrink +extern __typeof (xmlBufferShrink) xmlBufferShrink__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferShrink xmlBufferShrink__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferWriteCHAR +extern __typeof (xmlBufferWriteCHAR) xmlBufferWriteCHAR __attribute((alias("xmlBufferWriteCHAR__internal_alias"))); +#else +#ifndef xmlBufferWriteCHAR +extern __typeof (xmlBufferWriteCHAR) xmlBufferWriteCHAR__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferWriteCHAR xmlBufferWriteCHAR__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferWriteChar +extern __typeof (xmlBufferWriteChar) xmlBufferWriteChar __attribute((alias("xmlBufferWriteChar__internal_alias"))); +#else +#ifndef xmlBufferWriteChar +extern __typeof (xmlBufferWriteChar) xmlBufferWriteChar__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferWriteChar xmlBufferWriteChar__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBufferWriteQuotedString +extern __typeof (xmlBufferWriteQuotedString) xmlBufferWriteQuotedString __attribute((alias("xmlBufferWriteQuotedString__internal_alias"))); +#else +#ifndef xmlBufferWriteQuotedString +extern __typeof (xmlBufferWriteQuotedString) xmlBufferWriteQuotedString__internal_alias __attribute((visibility("hidden"))); +#define xmlBufferWriteQuotedString xmlBufferWriteQuotedString__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlBuildQName +extern __typeof (xmlBuildQName) xmlBuildQName __attribute((alias("xmlBuildQName__internal_alias"))); +#else +#ifndef xmlBuildQName +extern __typeof (xmlBuildQName) xmlBuildQName__internal_alias __attribute((visibility("hidden"))); +#define xmlBuildQName xmlBuildQName__internal_alias +#endif +#endif + +#ifdef bottom_uri +#undef xmlBuildRelativeURI +extern __typeof (xmlBuildRelativeURI) xmlBuildRelativeURI __attribute((alias("xmlBuildRelativeURI__internal_alias"))); +#else +#ifndef xmlBuildRelativeURI +extern __typeof (xmlBuildRelativeURI) xmlBuildRelativeURI__internal_alias __attribute((visibility("hidden"))); +#define xmlBuildRelativeURI xmlBuildRelativeURI__internal_alias +#endif +#endif + +#ifdef bottom_uri +#undef xmlBuildURI +extern __typeof (xmlBuildURI) xmlBuildURI __attribute((alias("xmlBuildURI__internal_alias"))); +#else +#ifndef xmlBuildURI +extern __typeof (xmlBuildURI) xmlBuildURI__internal_alias __attribute((visibility("hidden"))); +#define xmlBuildURI xmlBuildURI__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlByteConsumed +extern __typeof (xmlByteConsumed) xmlByteConsumed __attribute((alias("xmlByteConsumed__internal_alias"))); +#else +#ifndef xmlByteConsumed +extern __typeof (xmlByteConsumed) xmlByteConsumed__internal_alias __attribute((visibility("hidden"))); +#define xmlByteConsumed xmlByteConsumed__internal_alias +#endif +#endif + +#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_c14n +#undef xmlC14NDocDumpMemory +extern __typeof (xmlC14NDocDumpMemory) xmlC14NDocDumpMemory __attribute((alias("xmlC14NDocDumpMemory__internal_alias"))); +#else +#ifndef xmlC14NDocDumpMemory +extern __typeof (xmlC14NDocDumpMemory) xmlC14NDocDumpMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlC14NDocDumpMemory xmlC14NDocDumpMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_c14n +#undef xmlC14NDocSave +extern __typeof (xmlC14NDocSave) xmlC14NDocSave __attribute((alias("xmlC14NDocSave__internal_alias"))); +#else +#ifndef xmlC14NDocSave +extern __typeof (xmlC14NDocSave) xmlC14NDocSave__internal_alias __attribute((visibility("hidden"))); +#define xmlC14NDocSave xmlC14NDocSave__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_c14n +#undef xmlC14NDocSaveTo +extern __typeof (xmlC14NDocSaveTo) xmlC14NDocSaveTo __attribute((alias("xmlC14NDocSaveTo__internal_alias"))); +#else +#ifndef xmlC14NDocSaveTo +extern __typeof (xmlC14NDocSaveTo) xmlC14NDocSaveTo__internal_alias __attribute((visibility("hidden"))); +#define xmlC14NDocSaveTo xmlC14NDocSaveTo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_c14n +#undef xmlC14NExecute +extern __typeof (xmlC14NExecute) xmlC14NExecute __attribute((alias("xmlC14NExecute__internal_alias"))); +#else +#ifndef xmlC14NExecute +extern __typeof (xmlC14NExecute) xmlC14NExecute__internal_alias __attribute((visibility("hidden"))); +#define xmlC14NExecute xmlC14NExecute__internal_alias +#endif +#endif +#endif + +#ifdef bottom_uri +#undef xmlCanonicPath +extern __typeof (xmlCanonicPath) xmlCanonicPath __attribute((alias("xmlCanonicPath__internal_alias"))); +#else +#ifndef xmlCanonicPath +extern __typeof (xmlCanonicPath) xmlCanonicPath__internal_alias __attribute((visibility("hidden"))); +#define xmlCanonicPath xmlCanonicPath__internal_alias +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogAdd +extern __typeof (xmlCatalogAdd) xmlCatalogAdd __attribute((alias("xmlCatalogAdd__internal_alias"))); +#else +#ifndef xmlCatalogAdd +extern __typeof (xmlCatalogAdd) xmlCatalogAdd__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogAdd xmlCatalogAdd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogAddLocal +extern __typeof (xmlCatalogAddLocal) xmlCatalogAddLocal __attribute((alias("xmlCatalogAddLocal__internal_alias"))); +#else +#ifndef xmlCatalogAddLocal +extern __typeof (xmlCatalogAddLocal) xmlCatalogAddLocal__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogAddLocal xmlCatalogAddLocal__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogCleanup +extern __typeof (xmlCatalogCleanup) xmlCatalogCleanup __attribute((alias("xmlCatalogCleanup__internal_alias"))); +#else +#ifndef xmlCatalogCleanup +extern __typeof (xmlCatalogCleanup) xmlCatalogCleanup__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogCleanup xmlCatalogCleanup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogConvert +extern __typeof (xmlCatalogConvert) xmlCatalogConvert __attribute((alias("xmlCatalogConvert__internal_alias"))); +#else +#ifndef xmlCatalogConvert +extern __typeof (xmlCatalogConvert) xmlCatalogConvert__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogConvert xmlCatalogConvert__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogDump +extern __typeof (xmlCatalogDump) xmlCatalogDump __attribute((alias("xmlCatalogDump__internal_alias"))); +#else +#ifndef xmlCatalogDump +extern __typeof (xmlCatalogDump) xmlCatalogDump__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogDump xmlCatalogDump__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogFreeLocal +extern __typeof (xmlCatalogFreeLocal) xmlCatalogFreeLocal __attribute((alias("xmlCatalogFreeLocal__internal_alias"))); +#else +#ifndef xmlCatalogFreeLocal +extern __typeof (xmlCatalogFreeLocal) xmlCatalogFreeLocal__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogFreeLocal xmlCatalogFreeLocal__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogGetDefaults +extern __typeof (xmlCatalogGetDefaults) xmlCatalogGetDefaults __attribute((alias("xmlCatalogGetDefaults__internal_alias"))); +#else +#ifndef xmlCatalogGetDefaults +extern __typeof (xmlCatalogGetDefaults) xmlCatalogGetDefaults__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogGetDefaults xmlCatalogGetDefaults__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogGetPublic +extern __typeof (xmlCatalogGetPublic) xmlCatalogGetPublic __attribute((alias("xmlCatalogGetPublic__internal_alias"))); +#else +#ifndef xmlCatalogGetPublic +extern __typeof (xmlCatalogGetPublic) xmlCatalogGetPublic__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogGetPublic xmlCatalogGetPublic__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogGetSystem +extern __typeof (xmlCatalogGetSystem) xmlCatalogGetSystem __attribute((alias("xmlCatalogGetSystem__internal_alias"))); +#else +#ifndef xmlCatalogGetSystem +extern __typeof (xmlCatalogGetSystem) xmlCatalogGetSystem__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogGetSystem xmlCatalogGetSystem__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogIsEmpty +extern __typeof (xmlCatalogIsEmpty) xmlCatalogIsEmpty __attribute((alias("xmlCatalogIsEmpty__internal_alias"))); +#else +#ifndef xmlCatalogIsEmpty +extern __typeof (xmlCatalogIsEmpty) xmlCatalogIsEmpty__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogIsEmpty xmlCatalogIsEmpty__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogLocalResolve +extern __typeof (xmlCatalogLocalResolve) xmlCatalogLocalResolve __attribute((alias("xmlCatalogLocalResolve__internal_alias"))); +#else +#ifndef xmlCatalogLocalResolve +extern __typeof (xmlCatalogLocalResolve) xmlCatalogLocalResolve__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogLocalResolve xmlCatalogLocalResolve__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogLocalResolveURI +extern __typeof (xmlCatalogLocalResolveURI) xmlCatalogLocalResolveURI __attribute((alias("xmlCatalogLocalResolveURI__internal_alias"))); +#else +#ifndef xmlCatalogLocalResolveURI +extern __typeof (xmlCatalogLocalResolveURI) xmlCatalogLocalResolveURI__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogLocalResolveURI xmlCatalogLocalResolveURI__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogRemove +extern __typeof (xmlCatalogRemove) xmlCatalogRemove __attribute((alias("xmlCatalogRemove__internal_alias"))); +#else +#ifndef xmlCatalogRemove +extern __typeof (xmlCatalogRemove) xmlCatalogRemove__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogRemove xmlCatalogRemove__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogResolve +extern __typeof (xmlCatalogResolve) xmlCatalogResolve __attribute((alias("xmlCatalogResolve__internal_alias"))); +#else +#ifndef xmlCatalogResolve +extern __typeof (xmlCatalogResolve) xmlCatalogResolve__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogResolve xmlCatalogResolve__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogResolvePublic +extern __typeof (xmlCatalogResolvePublic) xmlCatalogResolvePublic __attribute((alias("xmlCatalogResolvePublic__internal_alias"))); +#else +#ifndef xmlCatalogResolvePublic +extern __typeof (xmlCatalogResolvePublic) xmlCatalogResolvePublic__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogResolvePublic xmlCatalogResolvePublic__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogResolveSystem +extern __typeof (xmlCatalogResolveSystem) xmlCatalogResolveSystem __attribute((alias("xmlCatalogResolveSystem__internal_alias"))); +#else +#ifndef xmlCatalogResolveSystem +extern __typeof (xmlCatalogResolveSystem) xmlCatalogResolveSystem__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogResolveSystem xmlCatalogResolveSystem__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogResolveURI +extern __typeof (xmlCatalogResolveURI) xmlCatalogResolveURI __attribute((alias("xmlCatalogResolveURI__internal_alias"))); +#else +#ifndef xmlCatalogResolveURI +extern __typeof (xmlCatalogResolveURI) xmlCatalogResolveURI__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogResolveURI xmlCatalogResolveURI__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogSetDebug +extern __typeof (xmlCatalogSetDebug) xmlCatalogSetDebug __attribute((alias("xmlCatalogSetDebug__internal_alias"))); +#else +#ifndef xmlCatalogSetDebug +extern __typeof (xmlCatalogSetDebug) xmlCatalogSetDebug__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogSetDebug xmlCatalogSetDebug__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogSetDefaultPrefer +extern __typeof (xmlCatalogSetDefaultPrefer) xmlCatalogSetDefaultPrefer __attribute((alias("xmlCatalogSetDefaultPrefer__internal_alias"))); +#else +#ifndef xmlCatalogSetDefaultPrefer +extern __typeof (xmlCatalogSetDefaultPrefer) xmlCatalogSetDefaultPrefer__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogSetDefaultPrefer xmlCatalogSetDefaultPrefer__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlCatalogSetDefaults +extern __typeof (xmlCatalogSetDefaults) xmlCatalogSetDefaults __attribute((alias("xmlCatalogSetDefaults__internal_alias"))); +#else +#ifndef xmlCatalogSetDefaults +extern __typeof (xmlCatalogSetDefaults) xmlCatalogSetDefaults__internal_alias __attribute((visibility("hidden"))); +#define xmlCatalogSetDefaults xmlCatalogSetDefaults__internal_alias +#endif +#endif +#endif + +#ifdef bottom_encoding +#undef xmlCharEncCloseFunc +extern __typeof (xmlCharEncCloseFunc) xmlCharEncCloseFunc __attribute((alias("xmlCharEncCloseFunc__internal_alias"))); +#else +#ifndef xmlCharEncCloseFunc +extern __typeof (xmlCharEncCloseFunc) xmlCharEncCloseFunc__internal_alias __attribute((visibility("hidden"))); +#define xmlCharEncCloseFunc xmlCharEncCloseFunc__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlCharEncFirstLine +extern __typeof (xmlCharEncFirstLine) xmlCharEncFirstLine __attribute((alias("xmlCharEncFirstLine__internal_alias"))); +#else +#ifndef xmlCharEncFirstLine +extern __typeof (xmlCharEncFirstLine) xmlCharEncFirstLine__internal_alias __attribute((visibility("hidden"))); +#define xmlCharEncFirstLine xmlCharEncFirstLine__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlCharEncInFunc +extern __typeof (xmlCharEncInFunc) xmlCharEncInFunc __attribute((alias("xmlCharEncInFunc__internal_alias"))); +#else +#ifndef xmlCharEncInFunc +extern __typeof (xmlCharEncInFunc) xmlCharEncInFunc__internal_alias __attribute((visibility("hidden"))); +#define xmlCharEncInFunc xmlCharEncInFunc__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlCharEncOutFunc +extern __typeof (xmlCharEncOutFunc) xmlCharEncOutFunc __attribute((alias("xmlCharEncOutFunc__internal_alias"))); +#else +#ifndef xmlCharEncOutFunc +extern __typeof (xmlCharEncOutFunc) xmlCharEncOutFunc__internal_alias __attribute((visibility("hidden"))); +#define xmlCharEncOutFunc xmlCharEncOutFunc__internal_alias +#endif +#endif + +#ifdef bottom_chvalid +#undef xmlCharInRange +extern __typeof (xmlCharInRange) xmlCharInRange __attribute((alias("xmlCharInRange__internal_alias"))); +#else +#ifndef xmlCharInRange +extern __typeof (xmlCharInRange) xmlCharInRange__internal_alias __attribute((visibility("hidden"))); +#define xmlCharInRange xmlCharInRange__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlCharStrdup +extern __typeof (xmlCharStrdup) xmlCharStrdup __attribute((alias("xmlCharStrdup__internal_alias"))); +#else +#ifndef xmlCharStrdup +extern __typeof (xmlCharStrdup) xmlCharStrdup__internal_alias __attribute((visibility("hidden"))); +#define xmlCharStrdup xmlCharStrdup__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlCharStrndup +extern __typeof (xmlCharStrndup) xmlCharStrndup __attribute((alias("xmlCharStrndup__internal_alias"))); +#else +#ifndef xmlCharStrndup +extern __typeof (xmlCharStrndup) xmlCharStrndup__internal_alias __attribute((visibility("hidden"))); +#define xmlCharStrndup xmlCharStrndup__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlCheckFilename +extern __typeof (xmlCheckFilename) xmlCheckFilename __attribute((alias("xmlCheckFilename__internal_alias"))); +#else +#ifndef xmlCheckFilename +extern __typeof (xmlCheckFilename) xmlCheckFilename__internal_alias __attribute((visibility("hidden"))); +#define xmlCheckFilename xmlCheckFilename__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlCheckHTTPInput +extern __typeof (xmlCheckHTTPInput) xmlCheckHTTPInput __attribute((alias("xmlCheckHTTPInput__internal_alias"))); +#else +#ifndef xmlCheckHTTPInput +extern __typeof (xmlCheckHTTPInput) xmlCheckHTTPInput__internal_alias __attribute((visibility("hidden"))); +#define xmlCheckHTTPInput xmlCheckHTTPInput__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCheckLanguageID +extern __typeof (xmlCheckLanguageID) xmlCheckLanguageID __attribute((alias("xmlCheckLanguageID__internal_alias"))); +#else +#ifndef xmlCheckLanguageID +extern __typeof (xmlCheckLanguageID) xmlCheckLanguageID__internal_alias __attribute((visibility("hidden"))); +#define xmlCheckLanguageID xmlCheckLanguageID__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlCheckUTF8 +extern __typeof (xmlCheckUTF8) xmlCheckUTF8 __attribute((alias("xmlCheckUTF8__internal_alias"))); +#else +#ifndef xmlCheckUTF8 +extern __typeof (xmlCheckUTF8) xmlCheckUTF8__internal_alias __attribute((visibility("hidden"))); +#define xmlCheckUTF8 xmlCheckUTF8__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlCheckVersion +extern __typeof (xmlCheckVersion) xmlCheckVersion __attribute((alias("xmlCheckVersion__internal_alias"))); +#else +#ifndef xmlCheckVersion +extern __typeof (xmlCheckVersion) xmlCheckVersion__internal_alias __attribute((visibility("hidden"))); +#define xmlCheckVersion xmlCheckVersion__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlChildElementCount +extern __typeof (xmlChildElementCount) xmlChildElementCount __attribute((alias("xmlChildElementCount__internal_alias"))); +#else +#ifndef xmlChildElementCount +extern __typeof (xmlChildElementCount) xmlChildElementCount__internal_alias __attribute((visibility("hidden"))); +#define xmlChildElementCount xmlChildElementCount__internal_alias +#endif +#endif +#endif + +#ifdef bottom_encoding +#undef xmlCleanupCharEncodingHandlers +extern __typeof (xmlCleanupCharEncodingHandlers) xmlCleanupCharEncodingHandlers __attribute((alias("xmlCleanupCharEncodingHandlers__internal_alias"))); +#else +#ifndef xmlCleanupCharEncodingHandlers +extern __typeof (xmlCleanupCharEncodingHandlers) xmlCleanupCharEncodingHandlers__internal_alias __attribute((visibility("hidden"))); +#define xmlCleanupCharEncodingHandlers xmlCleanupCharEncodingHandlers__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlCleanupEncodingAliases +extern __typeof (xmlCleanupEncodingAliases) xmlCleanupEncodingAliases __attribute((alias("xmlCleanupEncodingAliases__internal_alias"))); +#else +#ifndef xmlCleanupEncodingAliases +extern __typeof (xmlCleanupEncodingAliases) xmlCleanupEncodingAliases__internal_alias __attribute((visibility("hidden"))); +#define xmlCleanupEncodingAliases xmlCleanupEncodingAliases__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlCleanupGlobals +extern __typeof (xmlCleanupGlobals) xmlCleanupGlobals __attribute((alias("xmlCleanupGlobals__internal_alias"))); +#else +#ifndef xmlCleanupGlobals +extern __typeof (xmlCleanupGlobals) xmlCleanupGlobals__internal_alias __attribute((visibility("hidden"))); +#define xmlCleanupGlobals xmlCleanupGlobals__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlCleanupInputCallbacks +extern __typeof (xmlCleanupInputCallbacks) xmlCleanupInputCallbacks __attribute((alias("xmlCleanupInputCallbacks__internal_alias"))); +#else +#ifndef xmlCleanupInputCallbacks +extern __typeof (xmlCleanupInputCallbacks) xmlCleanupInputCallbacks__internal_alias __attribute((visibility("hidden"))); +#define xmlCleanupInputCallbacks xmlCleanupInputCallbacks__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlCleanupMemory +extern __typeof (xmlCleanupMemory) xmlCleanupMemory __attribute((alias("xmlCleanupMemory__internal_alias"))); +#else +#ifndef xmlCleanupMemory +extern __typeof (xmlCleanupMemory) xmlCleanupMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlCleanupMemory xmlCleanupMemory__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlCleanupOutputCallbacks +extern __typeof (xmlCleanupOutputCallbacks) xmlCleanupOutputCallbacks __attribute((alias("xmlCleanupOutputCallbacks__internal_alias"))); +#else +#ifndef xmlCleanupOutputCallbacks +extern __typeof (xmlCleanupOutputCallbacks) xmlCleanupOutputCallbacks__internal_alias __attribute((visibility("hidden"))); +#define xmlCleanupOutputCallbacks xmlCleanupOutputCallbacks__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlCleanupParser +extern __typeof (xmlCleanupParser) xmlCleanupParser __attribute((alias("xmlCleanupParser__internal_alias"))); +#else +#ifndef xmlCleanupParser +extern __typeof (xmlCleanupParser) xmlCleanupParser__internal_alias __attribute((visibility("hidden"))); +#define xmlCleanupParser xmlCleanupParser__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlCleanupPredefinedEntities +extern __typeof (xmlCleanupPredefinedEntities) xmlCleanupPredefinedEntities __attribute((alias("xmlCleanupPredefinedEntities__internal_alias"))); +#else +#ifndef xmlCleanupPredefinedEntities +extern __typeof (xmlCleanupPredefinedEntities) xmlCleanupPredefinedEntities__internal_alias __attribute((visibility("hidden"))); +#define xmlCleanupPredefinedEntities xmlCleanupPredefinedEntities__internal_alias +#endif +#endif +#endif + +#ifdef bottom_threads +#undef xmlCleanupThreads +extern __typeof (xmlCleanupThreads) xmlCleanupThreads __attribute((alias("xmlCleanupThreads__internal_alias"))); +#else +#ifndef xmlCleanupThreads +extern __typeof (xmlCleanupThreads) xmlCleanupThreads__internal_alias __attribute((visibility("hidden"))); +#define xmlCleanupThreads xmlCleanupThreads__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlClearNodeInfoSeq +extern __typeof (xmlClearNodeInfoSeq) xmlClearNodeInfoSeq __attribute((alias("xmlClearNodeInfoSeq__internal_alias"))); +#else +#ifndef xmlClearNodeInfoSeq +extern __typeof (xmlClearNodeInfoSeq) xmlClearNodeInfoSeq__internal_alias __attribute((visibility("hidden"))); +#define xmlClearNodeInfoSeq xmlClearNodeInfoSeq__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlClearParserCtxt +extern __typeof (xmlClearParserCtxt) xmlClearParserCtxt __attribute((alias("xmlClearParserCtxt__internal_alias"))); +#else +#ifndef xmlClearParserCtxt +extern __typeof (xmlClearParserCtxt) xmlClearParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlClearParserCtxt xmlClearParserCtxt__internal_alias +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlConvertSGMLCatalog +extern __typeof (xmlConvertSGMLCatalog) xmlConvertSGMLCatalog __attribute((alias("xmlConvertSGMLCatalog__internal_alias"))); +#else +#ifndef xmlConvertSGMLCatalog +extern __typeof (xmlConvertSGMLCatalog) xmlConvertSGMLCatalog__internal_alias __attribute((visibility("hidden"))); +#define xmlConvertSGMLCatalog xmlConvertSGMLCatalog__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_valid +#undef xmlCopyAttributeTable +extern __typeof (xmlCopyAttributeTable) xmlCopyAttributeTable __attribute((alias("xmlCopyAttributeTable__internal_alias"))); +#else +#ifndef xmlCopyAttributeTable +extern __typeof (xmlCopyAttributeTable) xmlCopyAttributeTable__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyAttributeTable xmlCopyAttributeTable__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlCopyChar +extern __typeof (xmlCopyChar) xmlCopyChar __attribute((alias("xmlCopyChar__internal_alias"))); +#else +#ifndef xmlCopyChar +extern __typeof (xmlCopyChar) xmlCopyChar__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyChar xmlCopyChar__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlCopyCharMultiByte +extern __typeof (xmlCopyCharMultiByte) xmlCopyCharMultiByte __attribute((alias("xmlCopyCharMultiByte__internal_alias"))); +#else +#ifndef xmlCopyCharMultiByte +extern __typeof (xmlCopyCharMultiByte) xmlCopyCharMultiByte__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyCharMultiByte xmlCopyCharMultiByte__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_tree +#undef xmlCopyDoc +extern __typeof (xmlCopyDoc) xmlCopyDoc __attribute((alias("xmlCopyDoc__internal_alias"))); +#else +#ifndef xmlCopyDoc +extern __typeof (xmlCopyDoc) xmlCopyDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyDoc xmlCopyDoc__internal_alias +#endif +#endif +#endif + +#ifdef bottom_valid +#undef xmlCopyDocElementContent +extern __typeof (xmlCopyDocElementContent) xmlCopyDocElementContent __attribute((alias("xmlCopyDocElementContent__internal_alias"))); +#else +#ifndef xmlCopyDocElementContent +extern __typeof (xmlCopyDocElementContent) xmlCopyDocElementContent__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyDocElementContent xmlCopyDocElementContent__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlCopyDtd +extern __typeof (xmlCopyDtd) xmlCopyDtd __attribute((alias("xmlCopyDtd__internal_alias"))); +#else +#ifndef xmlCopyDtd +extern __typeof (xmlCopyDtd) xmlCopyDtd__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyDtd xmlCopyDtd__internal_alias +#endif +#endif +#endif + +#ifdef bottom_valid +#undef xmlCopyElementContent +extern __typeof (xmlCopyElementContent) xmlCopyElementContent __attribute((alias("xmlCopyElementContent__internal_alias"))); +#else +#ifndef xmlCopyElementContent +extern __typeof (xmlCopyElementContent) xmlCopyElementContent__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyElementContent xmlCopyElementContent__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_valid +#undef xmlCopyElementTable +extern __typeof (xmlCopyElementTable) xmlCopyElementTable __attribute((alias("xmlCopyElementTable__internal_alias"))); +#else +#ifndef xmlCopyElementTable +extern __typeof (xmlCopyElementTable) xmlCopyElementTable__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyElementTable xmlCopyElementTable__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_entities +#undef xmlCopyEntitiesTable +extern __typeof (xmlCopyEntitiesTable) xmlCopyEntitiesTable __attribute((alias("xmlCopyEntitiesTable__internal_alias"))); +#else +#ifndef xmlCopyEntitiesTable +extern __typeof (xmlCopyEntitiesTable) xmlCopyEntitiesTable__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyEntitiesTable xmlCopyEntitiesTable__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_valid +#undef xmlCopyEnumeration +extern __typeof (xmlCopyEnumeration) xmlCopyEnumeration __attribute((alias("xmlCopyEnumeration__internal_alias"))); +#else +#ifndef xmlCopyEnumeration +extern __typeof (xmlCopyEnumeration) xmlCopyEnumeration__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyEnumeration xmlCopyEnumeration__internal_alias +#endif +#endif +#endif + +#ifdef bottom_error +#undef xmlCopyError +extern __typeof (xmlCopyError) xmlCopyError __attribute((alias("xmlCopyError__internal_alias"))); +#else +#ifndef xmlCopyError +extern __typeof (xmlCopyError) xmlCopyError__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyError xmlCopyError__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlCopyNamespace +extern __typeof (xmlCopyNamespace) xmlCopyNamespace __attribute((alias("xmlCopyNamespace__internal_alias"))); +#else +#ifndef xmlCopyNamespace +extern __typeof (xmlCopyNamespace) xmlCopyNamespace__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyNamespace xmlCopyNamespace__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlCopyNamespaceList +extern __typeof (xmlCopyNamespaceList) xmlCopyNamespaceList __attribute((alias("xmlCopyNamespaceList__internal_alias"))); +#else +#ifndef xmlCopyNamespaceList +extern __typeof (xmlCopyNamespaceList) xmlCopyNamespaceList__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyNamespaceList xmlCopyNamespaceList__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlCopyNode +extern __typeof (xmlCopyNode) xmlCopyNode __attribute((alias("xmlCopyNode__internal_alias"))); +#else +#ifndef xmlCopyNode +extern __typeof (xmlCopyNode) xmlCopyNode__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyNode xmlCopyNode__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlCopyNodeList +extern __typeof (xmlCopyNodeList) xmlCopyNodeList __attribute((alias("xmlCopyNodeList__internal_alias"))); +#else +#ifndef xmlCopyNodeList +extern __typeof (xmlCopyNodeList) xmlCopyNodeList__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyNodeList xmlCopyNodeList__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_valid +#undef xmlCopyNotationTable +extern __typeof (xmlCopyNotationTable) xmlCopyNotationTable __attribute((alias("xmlCopyNotationTable__internal_alias"))); +#else +#ifndef xmlCopyNotationTable +extern __typeof (xmlCopyNotationTable) xmlCopyNotationTable__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyNotationTable xmlCopyNotationTable__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlCopyProp +extern __typeof (xmlCopyProp) xmlCopyProp __attribute((alias("xmlCopyProp__internal_alias"))); +#else +#ifndef xmlCopyProp +extern __typeof (xmlCopyProp) xmlCopyProp__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyProp xmlCopyProp__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlCopyPropList +extern __typeof (xmlCopyPropList) xmlCopyPropList __attribute((alias("xmlCopyPropList__internal_alias"))); +#else +#ifndef xmlCopyPropList +extern __typeof (xmlCopyPropList) xmlCopyPropList__internal_alias __attribute((visibility("hidden"))); +#define xmlCopyPropList xmlCopyPropList__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCreateDocParserCtxt +extern __typeof (xmlCreateDocParserCtxt) xmlCreateDocParserCtxt __attribute((alias("xmlCreateDocParserCtxt__internal_alias"))); +#else +#ifndef xmlCreateDocParserCtxt +extern __typeof (xmlCreateDocParserCtxt) xmlCreateDocParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlCreateDocParserCtxt xmlCreateDocParserCtxt__internal_alias +#endif +#endif + +#ifdef bottom_entities +#undef xmlCreateEntitiesTable +extern __typeof (xmlCreateEntitiesTable) xmlCreateEntitiesTable __attribute((alias("xmlCreateEntitiesTable__internal_alias"))); +#else +#ifndef xmlCreateEntitiesTable +extern __typeof (xmlCreateEntitiesTable) xmlCreateEntitiesTable__internal_alias __attribute((visibility("hidden"))); +#define xmlCreateEntitiesTable xmlCreateEntitiesTable__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCreateEntityParserCtxt +extern __typeof (xmlCreateEntityParserCtxt) xmlCreateEntityParserCtxt __attribute((alias("xmlCreateEntityParserCtxt__internal_alias"))); +#else +#ifndef xmlCreateEntityParserCtxt +extern __typeof (xmlCreateEntityParserCtxt) xmlCreateEntityParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlCreateEntityParserCtxt xmlCreateEntityParserCtxt__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlCreateEnumeration +extern __typeof (xmlCreateEnumeration) xmlCreateEnumeration __attribute((alias("xmlCreateEnumeration__internal_alias"))); +#else +#ifndef xmlCreateEnumeration +extern __typeof (xmlCreateEnumeration) xmlCreateEnumeration__internal_alias __attribute((visibility("hidden"))); +#define xmlCreateEnumeration xmlCreateEnumeration__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCreateFileParserCtxt +extern __typeof (xmlCreateFileParserCtxt) xmlCreateFileParserCtxt __attribute((alias("xmlCreateFileParserCtxt__internal_alias"))); +#else +#ifndef xmlCreateFileParserCtxt +extern __typeof (xmlCreateFileParserCtxt) xmlCreateFileParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlCreateFileParserCtxt xmlCreateFileParserCtxt__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCreateIOParserCtxt +extern __typeof (xmlCreateIOParserCtxt) xmlCreateIOParserCtxt __attribute((alias("xmlCreateIOParserCtxt__internal_alias"))); +#else +#ifndef xmlCreateIOParserCtxt +extern __typeof (xmlCreateIOParserCtxt) xmlCreateIOParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlCreateIOParserCtxt xmlCreateIOParserCtxt__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlCreateIntSubset +extern __typeof (xmlCreateIntSubset) xmlCreateIntSubset __attribute((alias("xmlCreateIntSubset__internal_alias"))); +#else +#ifndef xmlCreateIntSubset +extern __typeof (xmlCreateIntSubset) xmlCreateIntSubset__internal_alias __attribute((visibility("hidden"))); +#define xmlCreateIntSubset xmlCreateIntSubset__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCreateMemoryParserCtxt +extern __typeof (xmlCreateMemoryParserCtxt) xmlCreateMemoryParserCtxt __attribute((alias("xmlCreateMemoryParserCtxt__internal_alias"))); +#else +#ifndef xmlCreateMemoryParserCtxt +extern __typeof (xmlCreateMemoryParserCtxt) xmlCreateMemoryParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlCreateMemoryParserCtxt xmlCreateMemoryParserCtxt__internal_alias +#endif +#endif + +#if defined(LIBXML_PUSH_ENABLED) +#ifdef bottom_parser +#undef xmlCreatePushParserCtxt +extern __typeof (xmlCreatePushParserCtxt) xmlCreatePushParserCtxt __attribute((alias("xmlCreatePushParserCtxt__internal_alias"))); +#else +#ifndef xmlCreatePushParserCtxt +extern __typeof (xmlCreatePushParserCtxt) xmlCreatePushParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlCreatePushParserCtxt xmlCreatePushParserCtxt__internal_alias +#endif +#endif +#endif + +#ifdef bottom_uri +#undef xmlCreateURI +extern __typeof (xmlCreateURI) xmlCreateURI __attribute((alias("xmlCreateURI__internal_alias"))); +#else +#ifndef xmlCreateURI +extern __typeof (xmlCreateURI) xmlCreateURI__internal_alias __attribute((visibility("hidden"))); +#define xmlCreateURI xmlCreateURI__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCreateURLParserCtxt +extern __typeof (xmlCreateURLParserCtxt) xmlCreateURLParserCtxt __attribute((alias("xmlCreateURLParserCtxt__internal_alias"))); +#else +#ifndef xmlCreateURLParserCtxt +extern __typeof (xmlCreateURLParserCtxt) xmlCreateURLParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlCreateURLParserCtxt xmlCreateURLParserCtxt__internal_alias +#endif +#endif + +#ifdef bottom_error +#undef xmlCtxtGetLastError +extern __typeof (xmlCtxtGetLastError) xmlCtxtGetLastError __attribute((alias("xmlCtxtGetLastError__internal_alias"))); +#else +#ifndef xmlCtxtGetLastError +extern __typeof (xmlCtxtGetLastError) xmlCtxtGetLastError__internal_alias __attribute((visibility("hidden"))); +#define xmlCtxtGetLastError xmlCtxtGetLastError__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCtxtReadDoc +extern __typeof (xmlCtxtReadDoc) xmlCtxtReadDoc __attribute((alias("xmlCtxtReadDoc__internal_alias"))); +#else +#ifndef xmlCtxtReadDoc +extern __typeof (xmlCtxtReadDoc) xmlCtxtReadDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlCtxtReadDoc xmlCtxtReadDoc__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCtxtReadFd +extern __typeof (xmlCtxtReadFd) xmlCtxtReadFd __attribute((alias("xmlCtxtReadFd__internal_alias"))); +#else +#ifndef xmlCtxtReadFd +extern __typeof (xmlCtxtReadFd) xmlCtxtReadFd__internal_alias __attribute((visibility("hidden"))); +#define xmlCtxtReadFd xmlCtxtReadFd__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCtxtReadFile +extern __typeof (xmlCtxtReadFile) xmlCtxtReadFile __attribute((alias("xmlCtxtReadFile__internal_alias"))); +#else +#ifndef xmlCtxtReadFile +extern __typeof (xmlCtxtReadFile) xmlCtxtReadFile__internal_alias __attribute((visibility("hidden"))); +#define xmlCtxtReadFile xmlCtxtReadFile__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCtxtReadIO +extern __typeof (xmlCtxtReadIO) xmlCtxtReadIO __attribute((alias("xmlCtxtReadIO__internal_alias"))); +#else +#ifndef xmlCtxtReadIO +extern __typeof (xmlCtxtReadIO) xmlCtxtReadIO__internal_alias __attribute((visibility("hidden"))); +#define xmlCtxtReadIO xmlCtxtReadIO__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCtxtReadMemory +extern __typeof (xmlCtxtReadMemory) xmlCtxtReadMemory __attribute((alias("xmlCtxtReadMemory__internal_alias"))); +#else +#ifndef xmlCtxtReadMemory +extern __typeof (xmlCtxtReadMemory) xmlCtxtReadMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlCtxtReadMemory xmlCtxtReadMemory__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCtxtReset +extern __typeof (xmlCtxtReset) xmlCtxtReset __attribute((alias("xmlCtxtReset__internal_alias"))); +#else +#ifndef xmlCtxtReset +extern __typeof (xmlCtxtReset) xmlCtxtReset__internal_alias __attribute((visibility("hidden"))); +#define xmlCtxtReset xmlCtxtReset__internal_alias +#endif +#endif + +#ifdef bottom_error +#undef xmlCtxtResetLastError +extern __typeof (xmlCtxtResetLastError) xmlCtxtResetLastError __attribute((alias("xmlCtxtResetLastError__internal_alias"))); +#else +#ifndef xmlCtxtResetLastError +extern __typeof (xmlCtxtResetLastError) xmlCtxtResetLastError__internal_alias __attribute((visibility("hidden"))); +#define xmlCtxtResetLastError xmlCtxtResetLastError__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCtxtResetPush +extern __typeof (xmlCtxtResetPush) xmlCtxtResetPush __attribute((alias("xmlCtxtResetPush__internal_alias"))); +#else +#ifndef xmlCtxtResetPush +extern __typeof (xmlCtxtResetPush) xmlCtxtResetPush__internal_alias __attribute((visibility("hidden"))); +#define xmlCtxtResetPush xmlCtxtResetPush__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlCtxtUseOptions +extern __typeof (xmlCtxtUseOptions) xmlCtxtUseOptions __attribute((alias("xmlCtxtUseOptions__internal_alias"))); +#else +#ifndef xmlCtxtUseOptions +extern __typeof (xmlCtxtUseOptions) xmlCtxtUseOptions__internal_alias __attribute((visibility("hidden"))); +#define xmlCtxtUseOptions xmlCtxtUseOptions__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlCurrentChar +extern __typeof (xmlCurrentChar) xmlCurrentChar __attribute((alias("xmlCurrentChar__internal_alias"))); +#else +#ifndef xmlCurrentChar +extern __typeof (xmlCurrentChar) xmlCurrentChar__internal_alias __attribute((visibility("hidden"))); +#define xmlCurrentChar xmlCurrentChar__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlDOMWrapAdoptNode +extern __typeof (xmlDOMWrapAdoptNode) xmlDOMWrapAdoptNode __attribute((alias("xmlDOMWrapAdoptNode__internal_alias"))); +#else +#ifndef xmlDOMWrapAdoptNode +extern __typeof (xmlDOMWrapAdoptNode) xmlDOMWrapAdoptNode__internal_alias __attribute((visibility("hidden"))); +#define xmlDOMWrapAdoptNode xmlDOMWrapAdoptNode__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlDOMWrapCloneNode +extern __typeof (xmlDOMWrapCloneNode) xmlDOMWrapCloneNode __attribute((alias("xmlDOMWrapCloneNode__internal_alias"))); +#else +#ifndef xmlDOMWrapCloneNode +extern __typeof (xmlDOMWrapCloneNode) xmlDOMWrapCloneNode__internal_alias __attribute((visibility("hidden"))); +#define xmlDOMWrapCloneNode xmlDOMWrapCloneNode__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlDOMWrapFreeCtxt +extern __typeof (xmlDOMWrapFreeCtxt) xmlDOMWrapFreeCtxt __attribute((alias("xmlDOMWrapFreeCtxt__internal_alias"))); +#else +#ifndef xmlDOMWrapFreeCtxt +extern __typeof (xmlDOMWrapFreeCtxt) xmlDOMWrapFreeCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlDOMWrapFreeCtxt xmlDOMWrapFreeCtxt__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlDOMWrapNewCtxt +extern __typeof (xmlDOMWrapNewCtxt) xmlDOMWrapNewCtxt __attribute((alias("xmlDOMWrapNewCtxt__internal_alias"))); +#else +#ifndef xmlDOMWrapNewCtxt +extern __typeof (xmlDOMWrapNewCtxt) xmlDOMWrapNewCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlDOMWrapNewCtxt xmlDOMWrapNewCtxt__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlDOMWrapReconcileNamespaces +extern __typeof (xmlDOMWrapReconcileNamespaces) xmlDOMWrapReconcileNamespaces __attribute((alias("xmlDOMWrapReconcileNamespaces__internal_alias"))); +#else +#ifndef xmlDOMWrapReconcileNamespaces +extern __typeof (xmlDOMWrapReconcileNamespaces) xmlDOMWrapReconcileNamespaces__internal_alias __attribute((visibility("hidden"))); +#define xmlDOMWrapReconcileNamespaces xmlDOMWrapReconcileNamespaces__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlDOMWrapRemoveNode +extern __typeof (xmlDOMWrapRemoveNode) xmlDOMWrapRemoveNode __attribute((alias("xmlDOMWrapRemoveNode__internal_alias"))); +#else +#ifndef xmlDOMWrapRemoveNode +extern __typeof (xmlDOMWrapRemoveNode) xmlDOMWrapRemoveNode__internal_alias __attribute((visibility("hidden"))); +#define xmlDOMWrapRemoveNode xmlDOMWrapRemoveNode__internal_alias +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlDebugCheckDocument +extern __typeof (xmlDebugCheckDocument) xmlDebugCheckDocument __attribute((alias("xmlDebugCheckDocument__internal_alias"))); +#else +#ifndef xmlDebugCheckDocument +extern __typeof (xmlDebugCheckDocument) xmlDebugCheckDocument__internal_alias __attribute((visibility("hidden"))); +#define xmlDebugCheckDocument xmlDebugCheckDocument__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlDebugDumpAttr +extern __typeof (xmlDebugDumpAttr) xmlDebugDumpAttr __attribute((alias("xmlDebugDumpAttr__internal_alias"))); +#else +#ifndef xmlDebugDumpAttr +extern __typeof (xmlDebugDumpAttr) xmlDebugDumpAttr__internal_alias __attribute((visibility("hidden"))); +#define xmlDebugDumpAttr xmlDebugDumpAttr__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlDebugDumpAttrList +extern __typeof (xmlDebugDumpAttrList) xmlDebugDumpAttrList __attribute((alias("xmlDebugDumpAttrList__internal_alias"))); +#else +#ifndef xmlDebugDumpAttrList +extern __typeof (xmlDebugDumpAttrList) xmlDebugDumpAttrList__internal_alias __attribute((visibility("hidden"))); +#define xmlDebugDumpAttrList xmlDebugDumpAttrList__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlDebugDumpDTD +extern __typeof (xmlDebugDumpDTD) xmlDebugDumpDTD __attribute((alias("xmlDebugDumpDTD__internal_alias"))); +#else +#ifndef xmlDebugDumpDTD +extern __typeof (xmlDebugDumpDTD) xmlDebugDumpDTD__internal_alias __attribute((visibility("hidden"))); +#define xmlDebugDumpDTD xmlDebugDumpDTD__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlDebugDumpDocument +extern __typeof (xmlDebugDumpDocument) xmlDebugDumpDocument __attribute((alias("xmlDebugDumpDocument__internal_alias"))); +#else +#ifndef xmlDebugDumpDocument +extern __typeof (xmlDebugDumpDocument) xmlDebugDumpDocument__internal_alias __attribute((visibility("hidden"))); +#define xmlDebugDumpDocument xmlDebugDumpDocument__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlDebugDumpDocumentHead +extern __typeof (xmlDebugDumpDocumentHead) xmlDebugDumpDocumentHead __attribute((alias("xmlDebugDumpDocumentHead__internal_alias"))); +#else +#ifndef xmlDebugDumpDocumentHead +extern __typeof (xmlDebugDumpDocumentHead) xmlDebugDumpDocumentHead__internal_alias __attribute((visibility("hidden"))); +#define xmlDebugDumpDocumentHead xmlDebugDumpDocumentHead__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlDebugDumpEntities +extern __typeof (xmlDebugDumpEntities) xmlDebugDumpEntities __attribute((alias("xmlDebugDumpEntities__internal_alias"))); +#else +#ifndef xmlDebugDumpEntities +extern __typeof (xmlDebugDumpEntities) xmlDebugDumpEntities__internal_alias __attribute((visibility("hidden"))); +#define xmlDebugDumpEntities xmlDebugDumpEntities__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlDebugDumpNode +extern __typeof (xmlDebugDumpNode) xmlDebugDumpNode __attribute((alias("xmlDebugDumpNode__internal_alias"))); +#else +#ifndef xmlDebugDumpNode +extern __typeof (xmlDebugDumpNode) xmlDebugDumpNode__internal_alias __attribute((visibility("hidden"))); +#define xmlDebugDumpNode xmlDebugDumpNode__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlDebugDumpNodeList +extern __typeof (xmlDebugDumpNodeList) xmlDebugDumpNodeList __attribute((alias("xmlDebugDumpNodeList__internal_alias"))); +#else +#ifndef xmlDebugDumpNodeList +extern __typeof (xmlDebugDumpNodeList) xmlDebugDumpNodeList__internal_alias __attribute((visibility("hidden"))); +#define xmlDebugDumpNodeList xmlDebugDumpNodeList__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlDebugDumpOneNode +extern __typeof (xmlDebugDumpOneNode) xmlDebugDumpOneNode __attribute((alias("xmlDebugDumpOneNode__internal_alias"))); +#else +#ifndef xmlDebugDumpOneNode +extern __typeof (xmlDebugDumpOneNode) xmlDebugDumpOneNode__internal_alias __attribute((visibility("hidden"))); +#define xmlDebugDumpOneNode xmlDebugDumpOneNode__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlDebugDumpString +extern __typeof (xmlDebugDumpString) xmlDebugDumpString __attribute((alias("xmlDebugDumpString__internal_alias"))); +#else +#ifndef xmlDebugDumpString +extern __typeof (xmlDebugDumpString) xmlDebugDumpString__internal_alias __attribute((visibility("hidden"))); +#define xmlDebugDumpString xmlDebugDumpString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlDecodeEntities +extern __typeof (xmlDecodeEntities) xmlDecodeEntities __attribute((alias("xmlDecodeEntities__internal_alias"))); +#else +#ifndef xmlDecodeEntities +extern __typeof (xmlDecodeEntities) xmlDecodeEntities__internal_alias __attribute((visibility("hidden"))); +#define xmlDecodeEntities xmlDecodeEntities__internal_alias +#endif +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlDefaultSAXHandlerInit +extern __typeof (xmlDefaultSAXHandlerInit) xmlDefaultSAXHandlerInit __attribute((alias("xmlDefaultSAXHandlerInit__internal_alias"))); +#else +#ifndef xmlDefaultSAXHandlerInit +extern __typeof (xmlDefaultSAXHandlerInit) xmlDefaultSAXHandlerInit__internal_alias __attribute((visibility("hidden"))); +#define xmlDefaultSAXHandlerInit xmlDefaultSAXHandlerInit__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlDelEncodingAlias +extern __typeof (xmlDelEncodingAlias) xmlDelEncodingAlias __attribute((alias("xmlDelEncodingAlias__internal_alias"))); +#else +#ifndef xmlDelEncodingAlias +extern __typeof (xmlDelEncodingAlias) xmlDelEncodingAlias__internal_alias __attribute((visibility("hidden"))); +#define xmlDelEncodingAlias xmlDelEncodingAlias__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlDeregisterNodeDefault +extern __typeof (xmlDeregisterNodeDefault) xmlDeregisterNodeDefault __attribute((alias("xmlDeregisterNodeDefault__internal_alias"))); +#else +#ifndef xmlDeregisterNodeDefault +extern __typeof (xmlDeregisterNodeDefault) xmlDeregisterNodeDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlDeregisterNodeDefault xmlDeregisterNodeDefault__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlDetectCharEncoding +extern __typeof (xmlDetectCharEncoding) xmlDetectCharEncoding __attribute((alias("xmlDetectCharEncoding__internal_alias"))); +#else +#ifndef xmlDetectCharEncoding +extern __typeof (xmlDetectCharEncoding) xmlDetectCharEncoding__internal_alias __attribute((visibility("hidden"))); +#define xmlDetectCharEncoding xmlDetectCharEncoding__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictCleanup +extern __typeof (xmlDictCleanup) xmlDictCleanup __attribute((alias("xmlDictCleanup__internal_alias"))); +#else +#ifndef xmlDictCleanup +extern __typeof (xmlDictCleanup) xmlDictCleanup__internal_alias __attribute((visibility("hidden"))); +#define xmlDictCleanup xmlDictCleanup__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictCreate +extern __typeof (xmlDictCreate) xmlDictCreate __attribute((alias("xmlDictCreate__internal_alias"))); +#else +#ifndef xmlDictCreate +extern __typeof (xmlDictCreate) xmlDictCreate__internal_alias __attribute((visibility("hidden"))); +#define xmlDictCreate xmlDictCreate__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictCreateSub +extern __typeof (xmlDictCreateSub) xmlDictCreateSub __attribute((alias("xmlDictCreateSub__internal_alias"))); +#else +#ifndef xmlDictCreateSub +extern __typeof (xmlDictCreateSub) xmlDictCreateSub__internal_alias __attribute((visibility("hidden"))); +#define xmlDictCreateSub xmlDictCreateSub__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictExists +extern __typeof (xmlDictExists) xmlDictExists __attribute((alias("xmlDictExists__internal_alias"))); +#else +#ifndef xmlDictExists +extern __typeof (xmlDictExists) xmlDictExists__internal_alias __attribute((visibility("hidden"))); +#define xmlDictExists xmlDictExists__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictFree +extern __typeof (xmlDictFree) xmlDictFree __attribute((alias("xmlDictFree__internal_alias"))); +#else +#ifndef xmlDictFree +extern __typeof (xmlDictFree) xmlDictFree__internal_alias __attribute((visibility("hidden"))); +#define xmlDictFree xmlDictFree__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictGetUsage +extern __typeof (xmlDictGetUsage) xmlDictGetUsage __attribute((alias("xmlDictGetUsage__internal_alias"))); +#else +#ifndef xmlDictGetUsage +extern __typeof (xmlDictGetUsage) xmlDictGetUsage__internal_alias __attribute((visibility("hidden"))); +#define xmlDictGetUsage xmlDictGetUsage__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictLookup +extern __typeof (xmlDictLookup) xmlDictLookup __attribute((alias("xmlDictLookup__internal_alias"))); +#else +#ifndef xmlDictLookup +extern __typeof (xmlDictLookup) xmlDictLookup__internal_alias __attribute((visibility("hidden"))); +#define xmlDictLookup xmlDictLookup__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictOwns +extern __typeof (xmlDictOwns) xmlDictOwns __attribute((alias("xmlDictOwns__internal_alias"))); +#else +#ifndef xmlDictOwns +extern __typeof (xmlDictOwns) xmlDictOwns__internal_alias __attribute((visibility("hidden"))); +#define xmlDictOwns xmlDictOwns__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictQLookup +extern __typeof (xmlDictQLookup) xmlDictQLookup __attribute((alias("xmlDictQLookup__internal_alias"))); +#else +#ifndef xmlDictQLookup +extern __typeof (xmlDictQLookup) xmlDictQLookup__internal_alias __attribute((visibility("hidden"))); +#define xmlDictQLookup xmlDictQLookup__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictReference +extern __typeof (xmlDictReference) xmlDictReference __attribute((alias("xmlDictReference__internal_alias"))); +#else +#ifndef xmlDictReference +extern __typeof (xmlDictReference) xmlDictReference__internal_alias __attribute((visibility("hidden"))); +#define xmlDictReference xmlDictReference__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictSetLimit +extern __typeof (xmlDictSetLimit) xmlDictSetLimit __attribute((alias("xmlDictSetLimit__internal_alias"))); +#else +#ifndef xmlDictSetLimit +extern __typeof (xmlDictSetLimit) xmlDictSetLimit__internal_alias __attribute((visibility("hidden"))); +#define xmlDictSetLimit xmlDictSetLimit__internal_alias +#endif +#endif + +#ifdef bottom_dict +#undef xmlDictSize +extern __typeof (xmlDictSize) xmlDictSize __attribute((alias("xmlDictSize__internal_alias"))); +#else +#ifndef xmlDictSize +extern __typeof (xmlDictSize) xmlDictSize__internal_alias __attribute((visibility("hidden"))); +#define xmlDictSize xmlDictSize__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlDocCopyNode +extern __typeof (xmlDocCopyNode) xmlDocCopyNode __attribute((alias("xmlDocCopyNode__internal_alias"))); +#else +#ifndef xmlDocCopyNode +extern __typeof (xmlDocCopyNode) xmlDocCopyNode__internal_alias __attribute((visibility("hidden"))); +#define xmlDocCopyNode xmlDocCopyNode__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlDocCopyNodeList +extern __typeof (xmlDocCopyNodeList) xmlDocCopyNodeList __attribute((alias("xmlDocCopyNodeList__internal_alias"))); +#else +#ifndef xmlDocCopyNodeList +extern __typeof (xmlDocCopyNodeList) xmlDocCopyNodeList__internal_alias __attribute((visibility("hidden"))); +#define xmlDocCopyNodeList xmlDocCopyNodeList__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlDocDump +extern __typeof (xmlDocDump) xmlDocDump __attribute((alias("xmlDocDump__internal_alias"))); +#else +#ifndef xmlDocDump +extern __typeof (xmlDocDump) xmlDocDump__internal_alias __attribute((visibility("hidden"))); +#define xmlDocDump xmlDocDump__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlDocDumpFormatMemory +extern __typeof (xmlDocDumpFormatMemory) xmlDocDumpFormatMemory __attribute((alias("xmlDocDumpFormatMemory__internal_alias"))); +#else +#ifndef xmlDocDumpFormatMemory +extern __typeof (xmlDocDumpFormatMemory) xmlDocDumpFormatMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlDocDumpFormatMemory xmlDocDumpFormatMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlDocDumpFormatMemoryEnc +extern __typeof (xmlDocDumpFormatMemoryEnc) xmlDocDumpFormatMemoryEnc __attribute((alias("xmlDocDumpFormatMemoryEnc__internal_alias"))); +#else +#ifndef xmlDocDumpFormatMemoryEnc +extern __typeof (xmlDocDumpFormatMemoryEnc) xmlDocDumpFormatMemoryEnc__internal_alias __attribute((visibility("hidden"))); +#define xmlDocDumpFormatMemoryEnc xmlDocDumpFormatMemoryEnc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlDocDumpMemory +extern __typeof (xmlDocDumpMemory) xmlDocDumpMemory __attribute((alias("xmlDocDumpMemory__internal_alias"))); +#else +#ifndef xmlDocDumpMemory +extern __typeof (xmlDocDumpMemory) xmlDocDumpMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlDocDumpMemory xmlDocDumpMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlDocDumpMemoryEnc +extern __typeof (xmlDocDumpMemoryEnc) xmlDocDumpMemoryEnc __attribute((alias("xmlDocDumpMemoryEnc__internal_alias"))); +#else +#ifndef xmlDocDumpMemoryEnc +extern __typeof (xmlDocDumpMemoryEnc) xmlDocDumpMemoryEnc__internal_alias __attribute((visibility("hidden"))); +#define xmlDocDumpMemoryEnc xmlDocDumpMemoryEnc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlDocFormatDump +extern __typeof (xmlDocFormatDump) xmlDocFormatDump __attribute((alias("xmlDocFormatDump__internal_alias"))); +#else +#ifndef xmlDocFormatDump +extern __typeof (xmlDocFormatDump) xmlDocFormatDump__internal_alias __attribute((visibility("hidden"))); +#define xmlDocFormatDump xmlDocFormatDump__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlDocGetRootElement +extern __typeof (xmlDocGetRootElement) xmlDocGetRootElement __attribute((alias("xmlDocGetRootElement__internal_alias"))); +#else +#ifndef xmlDocGetRootElement +extern __typeof (xmlDocGetRootElement) xmlDocGetRootElement__internal_alias __attribute((visibility("hidden"))); +#define xmlDocGetRootElement xmlDocGetRootElement__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_tree +#undef xmlDocSetRootElement +extern __typeof (xmlDocSetRootElement) xmlDocSetRootElement __attribute((alias("xmlDocSetRootElement__internal_alias"))); +#else +#ifndef xmlDocSetRootElement +extern __typeof (xmlDocSetRootElement) xmlDocSetRootElement__internal_alias __attribute((visibility("hidden"))); +#define xmlDocSetRootElement xmlDocSetRootElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_valid +#undef xmlDumpAttributeDecl +extern __typeof (xmlDumpAttributeDecl) xmlDumpAttributeDecl __attribute((alias("xmlDumpAttributeDecl__internal_alias"))); +#else +#ifndef xmlDumpAttributeDecl +extern __typeof (xmlDumpAttributeDecl) xmlDumpAttributeDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlDumpAttributeDecl xmlDumpAttributeDecl__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_valid +#undef xmlDumpAttributeTable +extern __typeof (xmlDumpAttributeTable) xmlDumpAttributeTable __attribute((alias("xmlDumpAttributeTable__internal_alias"))); +#else +#ifndef xmlDumpAttributeTable +extern __typeof (xmlDumpAttributeTable) xmlDumpAttributeTable__internal_alias __attribute((visibility("hidden"))); +#define xmlDumpAttributeTable xmlDumpAttributeTable__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_valid +#undef xmlDumpElementDecl +extern __typeof (xmlDumpElementDecl) xmlDumpElementDecl __attribute((alias("xmlDumpElementDecl__internal_alias"))); +#else +#ifndef xmlDumpElementDecl +extern __typeof (xmlDumpElementDecl) xmlDumpElementDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlDumpElementDecl xmlDumpElementDecl__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_valid +#undef xmlDumpElementTable +extern __typeof (xmlDumpElementTable) xmlDumpElementTable __attribute((alias("xmlDumpElementTable__internal_alias"))); +#else +#ifndef xmlDumpElementTable +extern __typeof (xmlDumpElementTable) xmlDumpElementTable__internal_alias __attribute((visibility("hidden"))); +#define xmlDumpElementTable xmlDumpElementTable__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_entities +#undef xmlDumpEntitiesTable +extern __typeof (xmlDumpEntitiesTable) xmlDumpEntitiesTable __attribute((alias("xmlDumpEntitiesTable__internal_alias"))); +#else +#ifndef xmlDumpEntitiesTable +extern __typeof (xmlDumpEntitiesTable) xmlDumpEntitiesTable__internal_alias __attribute((visibility("hidden"))); +#define xmlDumpEntitiesTable xmlDumpEntitiesTable__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_entities +#undef xmlDumpEntityDecl +extern __typeof (xmlDumpEntityDecl) xmlDumpEntityDecl __attribute((alias("xmlDumpEntityDecl__internal_alias"))); +#else +#ifndef xmlDumpEntityDecl +extern __typeof (xmlDumpEntityDecl) xmlDumpEntityDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlDumpEntityDecl xmlDumpEntityDecl__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_valid +#undef xmlDumpNotationDecl +extern __typeof (xmlDumpNotationDecl) xmlDumpNotationDecl __attribute((alias("xmlDumpNotationDecl__internal_alias"))); +#else +#ifndef xmlDumpNotationDecl +extern __typeof (xmlDumpNotationDecl) xmlDumpNotationDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlDumpNotationDecl xmlDumpNotationDecl__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_valid +#undef xmlDumpNotationTable +extern __typeof (xmlDumpNotationTable) xmlDumpNotationTable __attribute((alias("xmlDumpNotationTable__internal_alias"))); +#else +#ifndef xmlDumpNotationTable +extern __typeof (xmlDumpNotationTable) xmlDumpNotationTable__internal_alias __attribute((visibility("hidden"))); +#define xmlDumpNotationTable xmlDumpNotationTable__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlElemDump +extern __typeof (xmlElemDump) xmlElemDump __attribute((alias("xmlElemDump__internal_alias"))); +#else +#ifndef xmlElemDump +extern __typeof (xmlElemDump) xmlElemDump__internal_alias __attribute((visibility("hidden"))); +#define xmlElemDump xmlElemDump__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlEncodeEntities +extern __typeof (xmlEncodeEntities) xmlEncodeEntities __attribute((alias("xmlEncodeEntities__internal_alias"))); +#else +#ifndef xmlEncodeEntities +extern __typeof (xmlEncodeEntities) xmlEncodeEntities__internal_alias __attribute((visibility("hidden"))); +#define xmlEncodeEntities xmlEncodeEntities__internal_alias +#endif +#endif +#endif + +#ifdef bottom_entities +#undef xmlEncodeEntitiesReentrant +extern __typeof (xmlEncodeEntitiesReentrant) xmlEncodeEntitiesReentrant __attribute((alias("xmlEncodeEntitiesReentrant__internal_alias"))); +#else +#ifndef xmlEncodeEntitiesReentrant +extern __typeof (xmlEncodeEntitiesReentrant) xmlEncodeEntitiesReentrant__internal_alias __attribute((visibility("hidden"))); +#define xmlEncodeEntitiesReentrant xmlEncodeEntitiesReentrant__internal_alias +#endif +#endif + +#ifdef bottom_entities +#undef xmlEncodeSpecialChars +extern __typeof (xmlEncodeSpecialChars) xmlEncodeSpecialChars __attribute((alias("xmlEncodeSpecialChars__internal_alias"))); +#else +#ifndef xmlEncodeSpecialChars +extern __typeof (xmlEncodeSpecialChars) xmlEncodeSpecialChars__internal_alias __attribute((visibility("hidden"))); +#define xmlEncodeSpecialChars xmlEncodeSpecialChars__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlErrMemory +extern __typeof (xmlErrMemory) xmlErrMemory __attribute((alias("xmlErrMemory__internal_alias"))); +#else +#ifndef xmlErrMemory +extern __typeof (xmlErrMemory) xmlErrMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlErrMemory xmlErrMemory__internal_alias +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpCtxtNbCons +extern __typeof (xmlExpCtxtNbCons) xmlExpCtxtNbCons __attribute((alias("xmlExpCtxtNbCons__internal_alias"))); +#else +#ifndef xmlExpCtxtNbCons +extern __typeof (xmlExpCtxtNbCons) xmlExpCtxtNbCons__internal_alias __attribute((visibility("hidden"))); +#define xmlExpCtxtNbCons xmlExpCtxtNbCons__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpCtxtNbNodes +extern __typeof (xmlExpCtxtNbNodes) xmlExpCtxtNbNodes __attribute((alias("xmlExpCtxtNbNodes__internal_alias"))); +#else +#ifndef xmlExpCtxtNbNodes +extern __typeof (xmlExpCtxtNbNodes) xmlExpCtxtNbNodes__internal_alias __attribute((visibility("hidden"))); +#define xmlExpCtxtNbNodes xmlExpCtxtNbNodes__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpDump +extern __typeof (xmlExpDump) xmlExpDump __attribute((alias("xmlExpDump__internal_alias"))); +#else +#ifndef xmlExpDump +extern __typeof (xmlExpDump) xmlExpDump__internal_alias __attribute((visibility("hidden"))); +#define xmlExpDump xmlExpDump__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpExpDerive +extern __typeof (xmlExpExpDerive) xmlExpExpDerive __attribute((alias("xmlExpExpDerive__internal_alias"))); +#else +#ifndef xmlExpExpDerive +extern __typeof (xmlExpExpDerive) xmlExpExpDerive__internal_alias __attribute((visibility("hidden"))); +#define xmlExpExpDerive xmlExpExpDerive__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpFree +extern __typeof (xmlExpFree) xmlExpFree __attribute((alias("xmlExpFree__internal_alias"))); +#else +#ifndef xmlExpFree +extern __typeof (xmlExpFree) xmlExpFree__internal_alias __attribute((visibility("hidden"))); +#define xmlExpFree xmlExpFree__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpFreeCtxt +extern __typeof (xmlExpFreeCtxt) xmlExpFreeCtxt __attribute((alias("xmlExpFreeCtxt__internal_alias"))); +#else +#ifndef xmlExpFreeCtxt +extern __typeof (xmlExpFreeCtxt) xmlExpFreeCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlExpFreeCtxt xmlExpFreeCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpGetLanguage +extern __typeof (xmlExpGetLanguage) xmlExpGetLanguage __attribute((alias("xmlExpGetLanguage__internal_alias"))); +#else +#ifndef xmlExpGetLanguage +extern __typeof (xmlExpGetLanguage) xmlExpGetLanguage__internal_alias __attribute((visibility("hidden"))); +#define xmlExpGetLanguage xmlExpGetLanguage__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpGetStart +extern __typeof (xmlExpGetStart) xmlExpGetStart __attribute((alias("xmlExpGetStart__internal_alias"))); +#else +#ifndef xmlExpGetStart +extern __typeof (xmlExpGetStart) xmlExpGetStart__internal_alias __attribute((visibility("hidden"))); +#define xmlExpGetStart xmlExpGetStart__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpIsNillable +extern __typeof (xmlExpIsNillable) xmlExpIsNillable __attribute((alias("xmlExpIsNillable__internal_alias"))); +#else +#ifndef xmlExpIsNillable +extern __typeof (xmlExpIsNillable) xmlExpIsNillable__internal_alias __attribute((visibility("hidden"))); +#define xmlExpIsNillable xmlExpIsNillable__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpMaxToken +extern __typeof (xmlExpMaxToken) xmlExpMaxToken __attribute((alias("xmlExpMaxToken__internal_alias"))); +#else +#ifndef xmlExpMaxToken +extern __typeof (xmlExpMaxToken) xmlExpMaxToken__internal_alias __attribute((visibility("hidden"))); +#define xmlExpMaxToken xmlExpMaxToken__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpNewAtom +extern __typeof (xmlExpNewAtom) xmlExpNewAtom __attribute((alias("xmlExpNewAtom__internal_alias"))); +#else +#ifndef xmlExpNewAtom +extern __typeof (xmlExpNewAtom) xmlExpNewAtom__internal_alias __attribute((visibility("hidden"))); +#define xmlExpNewAtom xmlExpNewAtom__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpNewCtxt +extern __typeof (xmlExpNewCtxt) xmlExpNewCtxt __attribute((alias("xmlExpNewCtxt__internal_alias"))); +#else +#ifndef xmlExpNewCtxt +extern __typeof (xmlExpNewCtxt) xmlExpNewCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlExpNewCtxt xmlExpNewCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpNewOr +extern __typeof (xmlExpNewOr) xmlExpNewOr __attribute((alias("xmlExpNewOr__internal_alias"))); +#else +#ifndef xmlExpNewOr +extern __typeof (xmlExpNewOr) xmlExpNewOr__internal_alias __attribute((visibility("hidden"))); +#define xmlExpNewOr xmlExpNewOr__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpNewRange +extern __typeof (xmlExpNewRange) xmlExpNewRange __attribute((alias("xmlExpNewRange__internal_alias"))); +#else +#ifndef xmlExpNewRange +extern __typeof (xmlExpNewRange) xmlExpNewRange__internal_alias __attribute((visibility("hidden"))); +#define xmlExpNewRange xmlExpNewRange__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpNewSeq +extern __typeof (xmlExpNewSeq) xmlExpNewSeq __attribute((alias("xmlExpNewSeq__internal_alias"))); +#else +#ifndef xmlExpNewSeq +extern __typeof (xmlExpNewSeq) xmlExpNewSeq__internal_alias __attribute((visibility("hidden"))); +#define xmlExpNewSeq xmlExpNewSeq__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpParse +extern __typeof (xmlExpParse) xmlExpParse __attribute((alias("xmlExpParse__internal_alias"))); +#else +#ifndef xmlExpParse +extern __typeof (xmlExpParse) xmlExpParse__internal_alias __attribute((visibility("hidden"))); +#define xmlExpParse xmlExpParse__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpRef +extern __typeof (xmlExpRef) xmlExpRef __attribute((alias("xmlExpRef__internal_alias"))); +#else +#ifndef xmlExpRef +extern __typeof (xmlExpRef) xmlExpRef__internal_alias __attribute((visibility("hidden"))); +#define xmlExpRef xmlExpRef__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpStringDerive +extern __typeof (xmlExpStringDerive) xmlExpStringDerive __attribute((alias("xmlExpStringDerive__internal_alias"))); +#else +#ifndef xmlExpStringDerive +extern __typeof (xmlExpStringDerive) xmlExpStringDerive__internal_alias __attribute((visibility("hidden"))); +#define xmlExpStringDerive xmlExpStringDerive__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlExpSubsume +extern __typeof (xmlExpSubsume) xmlExpSubsume __attribute((alias("xmlExpSubsume__internal_alias"))); +#else +#ifndef xmlExpSubsume +extern __typeof (xmlExpSubsume) xmlExpSubsume__internal_alias __attribute((visibility("hidden"))); +#define xmlExpSubsume xmlExpSubsume__internal_alias +#endif +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlFileClose +extern __typeof (xmlFileClose) xmlFileClose __attribute((alias("xmlFileClose__internal_alias"))); +#else +#ifndef xmlFileClose +extern __typeof (xmlFileClose) xmlFileClose__internal_alias __attribute((visibility("hidden"))); +#define xmlFileClose xmlFileClose__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlFileMatch +extern __typeof (xmlFileMatch) xmlFileMatch __attribute((alias("xmlFileMatch__internal_alias"))); +#else +#ifndef xmlFileMatch +extern __typeof (xmlFileMatch) xmlFileMatch__internal_alias __attribute((visibility("hidden"))); +#define xmlFileMatch xmlFileMatch__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlFileOpen +extern __typeof (xmlFileOpen) xmlFileOpen __attribute((alias("xmlFileOpen__internal_alias"))); +#else +#ifndef xmlFileOpen +extern __typeof (xmlFileOpen) xmlFileOpen__internal_alias __attribute((visibility("hidden"))); +#define xmlFileOpen xmlFileOpen__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlFileRead +extern __typeof (xmlFileRead) xmlFileRead __attribute((alias("xmlFileRead__internal_alias"))); +#else +#ifndef xmlFileRead +extern __typeof (xmlFileRead) xmlFileRead__internal_alias __attribute((visibility("hidden"))); +#define xmlFileRead xmlFileRead__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlFindCharEncodingHandler +extern __typeof (xmlFindCharEncodingHandler) xmlFindCharEncodingHandler __attribute((alias("xmlFindCharEncodingHandler__internal_alias"))); +#else +#ifndef xmlFindCharEncodingHandler +extern __typeof (xmlFindCharEncodingHandler) xmlFindCharEncodingHandler__internal_alias __attribute((visibility("hidden"))); +#define xmlFindCharEncodingHandler xmlFindCharEncodingHandler__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlFirstElementChild +extern __typeof (xmlFirstElementChild) xmlFirstElementChild __attribute((alias("xmlFirstElementChild__internal_alias"))); +#else +#ifndef xmlFirstElementChild +extern __typeof (xmlFirstElementChild) xmlFirstElementChild__internal_alias __attribute((visibility("hidden"))); +#define xmlFirstElementChild xmlFirstElementChild__internal_alias +#endif +#endif +#endif + +#ifdef bottom_valid +#undef xmlFreeAttributeTable +extern __typeof (xmlFreeAttributeTable) xmlFreeAttributeTable __attribute((alias("xmlFreeAttributeTable__internal_alias"))); +#else +#ifndef xmlFreeAttributeTable +extern __typeof (xmlFreeAttributeTable) xmlFreeAttributeTable__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeAttributeTable xmlFreeAttributeTable__internal_alias +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlFreeAutomata +extern __typeof (xmlFreeAutomata) xmlFreeAutomata __attribute((alias("xmlFreeAutomata__internal_alias"))); +#else +#ifndef xmlFreeAutomata +extern __typeof (xmlFreeAutomata) xmlFreeAutomata__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeAutomata xmlFreeAutomata__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlFreeCatalog +extern __typeof (xmlFreeCatalog) xmlFreeCatalog __attribute((alias("xmlFreeCatalog__internal_alias"))); +#else +#ifndef xmlFreeCatalog +extern __typeof (xmlFreeCatalog) xmlFreeCatalog__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeCatalog xmlFreeCatalog__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlFreeDoc +extern __typeof (xmlFreeDoc) xmlFreeDoc __attribute((alias("xmlFreeDoc__internal_alias"))); +#else +#ifndef xmlFreeDoc +extern __typeof (xmlFreeDoc) xmlFreeDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeDoc xmlFreeDoc__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlFreeDocElementContent +extern __typeof (xmlFreeDocElementContent) xmlFreeDocElementContent __attribute((alias("xmlFreeDocElementContent__internal_alias"))); +#else +#ifndef xmlFreeDocElementContent +extern __typeof (xmlFreeDocElementContent) xmlFreeDocElementContent__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeDocElementContent xmlFreeDocElementContent__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlFreeDtd +extern __typeof (xmlFreeDtd) xmlFreeDtd __attribute((alias("xmlFreeDtd__internal_alias"))); +#else +#ifndef xmlFreeDtd +extern __typeof (xmlFreeDtd) xmlFreeDtd__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeDtd xmlFreeDtd__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlFreeElementContent +extern __typeof (xmlFreeElementContent) xmlFreeElementContent __attribute((alias("xmlFreeElementContent__internal_alias"))); +#else +#ifndef xmlFreeElementContent +extern __typeof (xmlFreeElementContent) xmlFreeElementContent__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeElementContent xmlFreeElementContent__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlFreeElementTable +extern __typeof (xmlFreeElementTable) xmlFreeElementTable __attribute((alias("xmlFreeElementTable__internal_alias"))); +#else +#ifndef xmlFreeElementTable +extern __typeof (xmlFreeElementTable) xmlFreeElementTable__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeElementTable xmlFreeElementTable__internal_alias +#endif +#endif + +#ifdef bottom_entities +#undef xmlFreeEntitiesTable +extern __typeof (xmlFreeEntitiesTable) xmlFreeEntitiesTable __attribute((alias("xmlFreeEntitiesTable__internal_alias"))); +#else +#ifndef xmlFreeEntitiesTable +extern __typeof (xmlFreeEntitiesTable) xmlFreeEntitiesTable__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeEntitiesTable xmlFreeEntitiesTable__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlFreeEnumeration +extern __typeof (xmlFreeEnumeration) xmlFreeEnumeration __attribute((alias("xmlFreeEnumeration__internal_alias"))); +#else +#ifndef xmlFreeEnumeration +extern __typeof (xmlFreeEnumeration) xmlFreeEnumeration__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeEnumeration xmlFreeEnumeration__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlFreeIDTable +extern __typeof (xmlFreeIDTable) xmlFreeIDTable __attribute((alias("xmlFreeIDTable__internal_alias"))); +#else +#ifndef xmlFreeIDTable +extern __typeof (xmlFreeIDTable) xmlFreeIDTable__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeIDTable xmlFreeIDTable__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlFreeInputStream +extern __typeof (xmlFreeInputStream) xmlFreeInputStream __attribute((alias("xmlFreeInputStream__internal_alias"))); +#else +#ifndef xmlFreeInputStream +extern __typeof (xmlFreeInputStream) xmlFreeInputStream__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeInputStream xmlFreeInputStream__internal_alias +#endif +#endif + +#ifdef bottom_threads +#undef xmlFreeMutex +extern __typeof (xmlFreeMutex) xmlFreeMutex __attribute((alias("xmlFreeMutex__internal_alias"))); +#else +#ifndef xmlFreeMutex +extern __typeof (xmlFreeMutex) xmlFreeMutex__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeMutex xmlFreeMutex__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlFreeNode +extern __typeof (xmlFreeNode) xmlFreeNode __attribute((alias("xmlFreeNode__internal_alias"))); +#else +#ifndef xmlFreeNode +extern __typeof (xmlFreeNode) xmlFreeNode__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeNode xmlFreeNode__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlFreeNodeList +extern __typeof (xmlFreeNodeList) xmlFreeNodeList __attribute((alias("xmlFreeNodeList__internal_alias"))); +#else +#ifndef xmlFreeNodeList +extern __typeof (xmlFreeNodeList) xmlFreeNodeList__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeNodeList xmlFreeNodeList__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlFreeNotationTable +extern __typeof (xmlFreeNotationTable) xmlFreeNotationTable __attribute((alias("xmlFreeNotationTable__internal_alias"))); +#else +#ifndef xmlFreeNotationTable +extern __typeof (xmlFreeNotationTable) xmlFreeNotationTable__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeNotationTable xmlFreeNotationTable__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlFreeNs +extern __typeof (xmlFreeNs) xmlFreeNs __attribute((alias("xmlFreeNs__internal_alias"))); +#else +#ifndef xmlFreeNs +extern __typeof (xmlFreeNs) xmlFreeNs__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeNs xmlFreeNs__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlFreeNsList +extern __typeof (xmlFreeNsList) xmlFreeNsList __attribute((alias("xmlFreeNsList__internal_alias"))); +#else +#ifndef xmlFreeNsList +extern __typeof (xmlFreeNsList) xmlFreeNsList__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeNsList xmlFreeNsList__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlFreeParserCtxt +extern __typeof (xmlFreeParserCtxt) xmlFreeParserCtxt __attribute((alias("xmlFreeParserCtxt__internal_alias"))); +#else +#ifndef xmlFreeParserCtxt +extern __typeof (xmlFreeParserCtxt) xmlFreeParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeParserCtxt xmlFreeParserCtxt__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlFreeParserInputBuffer +extern __typeof (xmlFreeParserInputBuffer) xmlFreeParserInputBuffer __attribute((alias("xmlFreeParserInputBuffer__internal_alias"))); +#else +#ifndef xmlFreeParserInputBuffer +extern __typeof (xmlFreeParserInputBuffer) xmlFreeParserInputBuffer__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeParserInputBuffer xmlFreeParserInputBuffer__internal_alias +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlFreePattern +extern __typeof (xmlFreePattern) xmlFreePattern __attribute((alias("xmlFreePattern__internal_alias"))); +#else +#ifndef xmlFreePattern +extern __typeof (xmlFreePattern) xmlFreePattern__internal_alias __attribute((visibility("hidden"))); +#define xmlFreePattern xmlFreePattern__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlFreePatternList +extern __typeof (xmlFreePatternList) xmlFreePatternList __attribute((alias("xmlFreePatternList__internal_alias"))); +#else +#ifndef xmlFreePatternList +extern __typeof (xmlFreePatternList) xmlFreePatternList__internal_alias __attribute((visibility("hidden"))); +#define xmlFreePatternList xmlFreePatternList__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlFreeProp +extern __typeof (xmlFreeProp) xmlFreeProp __attribute((alias("xmlFreeProp__internal_alias"))); +#else +#ifndef xmlFreeProp +extern __typeof (xmlFreeProp) xmlFreeProp__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeProp xmlFreeProp__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlFreePropList +extern __typeof (xmlFreePropList) xmlFreePropList __attribute((alias("xmlFreePropList__internal_alias"))); +#else +#ifndef xmlFreePropList +extern __typeof (xmlFreePropList) xmlFreePropList__internal_alias __attribute((visibility("hidden"))); +#define xmlFreePropList xmlFreePropList__internal_alias +#endif +#endif + +#ifdef bottom_threads +#undef xmlFreeRMutex +extern __typeof (xmlFreeRMutex) xmlFreeRMutex __attribute((alias("xmlFreeRMutex__internal_alias"))); +#else +#ifndef xmlFreeRMutex +extern __typeof (xmlFreeRMutex) xmlFreeRMutex__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeRMutex xmlFreeRMutex__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlFreeRefTable +extern __typeof (xmlFreeRefTable) xmlFreeRefTable __attribute((alias("xmlFreeRefTable__internal_alias"))); +#else +#ifndef xmlFreeRefTable +extern __typeof (xmlFreeRefTable) xmlFreeRefTable__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeRefTable xmlFreeRefTable__internal_alias +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlFreeStreamCtxt +extern __typeof (xmlFreeStreamCtxt) xmlFreeStreamCtxt __attribute((alias("xmlFreeStreamCtxt__internal_alias"))); +#else +#ifndef xmlFreeStreamCtxt +extern __typeof (xmlFreeStreamCtxt) xmlFreeStreamCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeStreamCtxt xmlFreeStreamCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlFreeTextReader +extern __typeof (xmlFreeTextReader) xmlFreeTextReader __attribute((alias("xmlFreeTextReader__internal_alias"))); +#else +#ifndef xmlFreeTextReader +extern __typeof (xmlFreeTextReader) xmlFreeTextReader__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeTextReader xmlFreeTextReader__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlFreeTextWriter +extern __typeof (xmlFreeTextWriter) xmlFreeTextWriter __attribute((alias("xmlFreeTextWriter__internal_alias"))); +#else +#ifndef xmlFreeTextWriter +extern __typeof (xmlFreeTextWriter) xmlFreeTextWriter__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeTextWriter xmlFreeTextWriter__internal_alias +#endif +#endif +#endif + +#ifdef bottom_uri +#undef xmlFreeURI +extern __typeof (xmlFreeURI) xmlFreeURI __attribute((alias("xmlFreeURI__internal_alias"))); +#else +#ifndef xmlFreeURI +extern __typeof (xmlFreeURI) xmlFreeURI__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeURI xmlFreeURI__internal_alias +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlFreeValidCtxt +extern __typeof (xmlFreeValidCtxt) xmlFreeValidCtxt __attribute((alias("xmlFreeValidCtxt__internal_alias"))); +#else +#ifndef xmlFreeValidCtxt +extern __typeof (xmlFreeValidCtxt) xmlFreeValidCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlFreeValidCtxt xmlFreeValidCtxt__internal_alias +#endif +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlGcMemGet +extern __typeof (xmlGcMemGet) xmlGcMemGet __attribute((alias("xmlGcMemGet__internal_alias"))); +#else +#ifndef xmlGcMemGet +extern __typeof (xmlGcMemGet) xmlGcMemGet__internal_alias __attribute((visibility("hidden"))); +#define xmlGcMemGet xmlGcMemGet__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlGcMemSetup +extern __typeof (xmlGcMemSetup) xmlGcMemSetup __attribute((alias("xmlGcMemSetup__internal_alias"))); +#else +#ifndef xmlGcMemSetup +extern __typeof (xmlGcMemSetup) xmlGcMemSetup__internal_alias __attribute((visibility("hidden"))); +#define xmlGcMemSetup xmlGcMemSetup__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlGetBufferAllocationScheme +extern __typeof (xmlGetBufferAllocationScheme) xmlGetBufferAllocationScheme __attribute((alias("xmlGetBufferAllocationScheme__internal_alias"))); +#else +#ifndef xmlGetBufferAllocationScheme +extern __typeof (xmlGetBufferAllocationScheme) xmlGetBufferAllocationScheme__internal_alias __attribute((visibility("hidden"))); +#define xmlGetBufferAllocationScheme xmlGetBufferAllocationScheme__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlGetCharEncodingHandler +extern __typeof (xmlGetCharEncodingHandler) xmlGetCharEncodingHandler __attribute((alias("xmlGetCharEncodingHandler__internal_alias"))); +#else +#ifndef xmlGetCharEncodingHandler +extern __typeof (xmlGetCharEncodingHandler) xmlGetCharEncodingHandler__internal_alias __attribute((visibility("hidden"))); +#define xmlGetCharEncodingHandler xmlGetCharEncodingHandler__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlGetCharEncodingName +extern __typeof (xmlGetCharEncodingName) xmlGetCharEncodingName __attribute((alias("xmlGetCharEncodingName__internal_alias"))); +#else +#ifndef xmlGetCharEncodingName +extern __typeof (xmlGetCharEncodingName) xmlGetCharEncodingName__internal_alias __attribute((visibility("hidden"))); +#define xmlGetCharEncodingName xmlGetCharEncodingName__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlGetCompressMode +extern __typeof (xmlGetCompressMode) xmlGetCompressMode __attribute((alias("xmlGetCompressMode__internal_alias"))); +#else +#ifndef xmlGetCompressMode +extern __typeof (xmlGetCompressMode) xmlGetCompressMode__internal_alias __attribute((visibility("hidden"))); +#define xmlGetCompressMode xmlGetCompressMode__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlGetDocCompressMode +extern __typeof (xmlGetDocCompressMode) xmlGetDocCompressMode __attribute((alias("xmlGetDocCompressMode__internal_alias"))); +#else +#ifndef xmlGetDocCompressMode +extern __typeof (xmlGetDocCompressMode) xmlGetDocCompressMode__internal_alias __attribute((visibility("hidden"))); +#define xmlGetDocCompressMode xmlGetDocCompressMode__internal_alias +#endif +#endif + +#ifdef bottom_entities +#undef xmlGetDocEntity +extern __typeof (xmlGetDocEntity) xmlGetDocEntity __attribute((alias("xmlGetDocEntity__internal_alias"))); +#else +#ifndef xmlGetDocEntity +extern __typeof (xmlGetDocEntity) xmlGetDocEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlGetDocEntity xmlGetDocEntity__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlGetDtdAttrDesc +extern __typeof (xmlGetDtdAttrDesc) xmlGetDtdAttrDesc __attribute((alias("xmlGetDtdAttrDesc__internal_alias"))); +#else +#ifndef xmlGetDtdAttrDesc +extern __typeof (xmlGetDtdAttrDesc) xmlGetDtdAttrDesc__internal_alias __attribute((visibility("hidden"))); +#define xmlGetDtdAttrDesc xmlGetDtdAttrDesc__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlGetDtdElementDesc +extern __typeof (xmlGetDtdElementDesc) xmlGetDtdElementDesc __attribute((alias("xmlGetDtdElementDesc__internal_alias"))); +#else +#ifndef xmlGetDtdElementDesc +extern __typeof (xmlGetDtdElementDesc) xmlGetDtdElementDesc__internal_alias __attribute((visibility("hidden"))); +#define xmlGetDtdElementDesc xmlGetDtdElementDesc__internal_alias +#endif +#endif + +#ifdef bottom_entities +#undef xmlGetDtdEntity +extern __typeof (xmlGetDtdEntity) xmlGetDtdEntity __attribute((alias("xmlGetDtdEntity__internal_alias"))); +#else +#ifndef xmlGetDtdEntity +extern __typeof (xmlGetDtdEntity) xmlGetDtdEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlGetDtdEntity xmlGetDtdEntity__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlGetDtdNotationDesc +extern __typeof (xmlGetDtdNotationDesc) xmlGetDtdNotationDesc __attribute((alias("xmlGetDtdNotationDesc__internal_alias"))); +#else +#ifndef xmlGetDtdNotationDesc +extern __typeof (xmlGetDtdNotationDesc) xmlGetDtdNotationDesc__internal_alias __attribute((visibility("hidden"))); +#define xmlGetDtdNotationDesc xmlGetDtdNotationDesc__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlGetDtdQAttrDesc +extern __typeof (xmlGetDtdQAttrDesc) xmlGetDtdQAttrDesc __attribute((alias("xmlGetDtdQAttrDesc__internal_alias"))); +#else +#ifndef xmlGetDtdQAttrDesc +extern __typeof (xmlGetDtdQAttrDesc) xmlGetDtdQAttrDesc__internal_alias __attribute((visibility("hidden"))); +#define xmlGetDtdQAttrDesc xmlGetDtdQAttrDesc__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlGetDtdQElementDesc +extern __typeof (xmlGetDtdQElementDesc) xmlGetDtdQElementDesc __attribute((alias("xmlGetDtdQElementDesc__internal_alias"))); +#else +#ifndef xmlGetDtdQElementDesc +extern __typeof (xmlGetDtdQElementDesc) xmlGetDtdQElementDesc__internal_alias __attribute((visibility("hidden"))); +#define xmlGetDtdQElementDesc xmlGetDtdQElementDesc__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlGetEncodingAlias +extern __typeof (xmlGetEncodingAlias) xmlGetEncodingAlias __attribute((alias("xmlGetEncodingAlias__internal_alias"))); +#else +#ifndef xmlGetEncodingAlias +extern __typeof (xmlGetEncodingAlias) xmlGetEncodingAlias__internal_alias __attribute((visibility("hidden"))); +#define xmlGetEncodingAlias xmlGetEncodingAlias__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlGetExternalEntityLoader +extern __typeof (xmlGetExternalEntityLoader) xmlGetExternalEntityLoader __attribute((alias("xmlGetExternalEntityLoader__internal_alias"))); +#else +#ifndef xmlGetExternalEntityLoader +extern __typeof (xmlGetExternalEntityLoader) xmlGetExternalEntityLoader__internal_alias __attribute((visibility("hidden"))); +#define xmlGetExternalEntityLoader xmlGetExternalEntityLoader__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlGetFeature +extern __typeof (xmlGetFeature) xmlGetFeature __attribute((alias("xmlGetFeature__internal_alias"))); +#else +#ifndef xmlGetFeature +extern __typeof (xmlGetFeature) xmlGetFeature__internal_alias __attribute((visibility("hidden"))); +#define xmlGetFeature xmlGetFeature__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlGetFeaturesList +extern __typeof (xmlGetFeaturesList) xmlGetFeaturesList __attribute((alias("xmlGetFeaturesList__internal_alias"))); +#else +#ifndef xmlGetFeaturesList +extern __typeof (xmlGetFeaturesList) xmlGetFeaturesList__internal_alias __attribute((visibility("hidden"))); +#define xmlGetFeaturesList xmlGetFeaturesList__internal_alias +#endif +#endif +#endif + +#ifdef bottom_threads +#undef xmlGetGlobalState +extern __typeof (xmlGetGlobalState) xmlGetGlobalState __attribute((alias("xmlGetGlobalState__internal_alias"))); +#else +#ifndef xmlGetGlobalState +extern __typeof (xmlGetGlobalState) xmlGetGlobalState__internal_alias __attribute((visibility("hidden"))); +#define xmlGetGlobalState xmlGetGlobalState__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlGetID +extern __typeof (xmlGetID) xmlGetID __attribute((alias("xmlGetID__internal_alias"))); +#else +#ifndef xmlGetID +extern __typeof (xmlGetID) xmlGetID__internal_alias __attribute((visibility("hidden"))); +#define xmlGetID xmlGetID__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlGetIntSubset +extern __typeof (xmlGetIntSubset) xmlGetIntSubset __attribute((alias("xmlGetIntSubset__internal_alias"))); +#else +#ifndef xmlGetIntSubset +extern __typeof (xmlGetIntSubset) xmlGetIntSubset__internal_alias __attribute((visibility("hidden"))); +#define xmlGetIntSubset xmlGetIntSubset__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlGetLastChild +extern __typeof (xmlGetLastChild) xmlGetLastChild __attribute((alias("xmlGetLastChild__internal_alias"))); +#else +#ifndef xmlGetLastChild +extern __typeof (xmlGetLastChild) xmlGetLastChild__internal_alias __attribute((visibility("hidden"))); +#define xmlGetLastChild xmlGetLastChild__internal_alias +#endif +#endif + +#ifdef bottom_error +#undef xmlGetLastError +extern __typeof (xmlGetLastError) xmlGetLastError __attribute((alias("xmlGetLastError__internal_alias"))); +#else +#ifndef xmlGetLastError +extern __typeof (xmlGetLastError) xmlGetLastError__internal_alias __attribute((visibility("hidden"))); +#define xmlGetLastError xmlGetLastError__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlGetLineNo +extern __typeof (xmlGetLineNo) xmlGetLineNo __attribute((alias("xmlGetLineNo__internal_alias"))); +#else +#ifndef xmlGetLineNo +extern __typeof (xmlGetLineNo) xmlGetLineNo__internal_alias __attribute((visibility("hidden"))); +#define xmlGetLineNo xmlGetLineNo__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlGetNoNsProp +extern __typeof (xmlGetNoNsProp) xmlGetNoNsProp __attribute((alias("xmlGetNoNsProp__internal_alias"))); +#else +#ifndef xmlGetNoNsProp +extern __typeof (xmlGetNoNsProp) xmlGetNoNsProp__internal_alias __attribute((visibility("hidden"))); +#define xmlGetNoNsProp xmlGetNoNsProp__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_tree +#undef xmlGetNodePath +extern __typeof (xmlGetNodePath) xmlGetNodePath __attribute((alias("xmlGetNodePath__internal_alias"))); +#else +#ifndef xmlGetNodePath +extern __typeof (xmlGetNodePath) xmlGetNodePath__internal_alias __attribute((visibility("hidden"))); +#define xmlGetNodePath xmlGetNodePath__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_tree +#undef xmlGetNsList +extern __typeof (xmlGetNsList) xmlGetNsList __attribute((alias("xmlGetNsList__internal_alias"))); +#else +#ifndef xmlGetNsList +extern __typeof (xmlGetNsList) xmlGetNsList__internal_alias __attribute((visibility("hidden"))); +#define xmlGetNsList xmlGetNsList__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlGetNsProp +extern __typeof (xmlGetNsProp) xmlGetNsProp __attribute((alias("xmlGetNsProp__internal_alias"))); +#else +#ifndef xmlGetNsProp +extern __typeof (xmlGetNsProp) xmlGetNsProp__internal_alias __attribute((visibility("hidden"))); +#define xmlGetNsProp xmlGetNsProp__internal_alias +#endif +#endif + +#ifdef bottom_entities +#undef xmlGetParameterEntity +extern __typeof (xmlGetParameterEntity) xmlGetParameterEntity __attribute((alias("xmlGetParameterEntity__internal_alias"))); +#else +#ifndef xmlGetParameterEntity +extern __typeof (xmlGetParameterEntity) xmlGetParameterEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlGetParameterEntity xmlGetParameterEntity__internal_alias +#endif +#endif + +#ifdef bottom_entities +#undef xmlGetPredefinedEntity +extern __typeof (xmlGetPredefinedEntity) xmlGetPredefinedEntity __attribute((alias("xmlGetPredefinedEntity__internal_alias"))); +#else +#ifndef xmlGetPredefinedEntity +extern __typeof (xmlGetPredefinedEntity) xmlGetPredefinedEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlGetPredefinedEntity xmlGetPredefinedEntity__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlGetProp +extern __typeof (xmlGetProp) xmlGetProp __attribute((alias("xmlGetProp__internal_alias"))); +#else +#ifndef xmlGetProp +extern __typeof (xmlGetProp) xmlGetProp__internal_alias __attribute((visibility("hidden"))); +#define xmlGetProp xmlGetProp__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlGetRefs +extern __typeof (xmlGetRefs) xmlGetRefs __attribute((alias("xmlGetRefs__internal_alias"))); +#else +#ifndef xmlGetRefs +extern __typeof (xmlGetRefs) xmlGetRefs__internal_alias __attribute((visibility("hidden"))); +#define xmlGetRefs xmlGetRefs__internal_alias +#endif +#endif + +#ifdef bottom_threads +#undef xmlGetThreadId +extern __typeof (xmlGetThreadId) xmlGetThreadId __attribute((alias("xmlGetThreadId__internal_alias"))); +#else +#ifndef xmlGetThreadId +extern __typeof (xmlGetThreadId) xmlGetThreadId__internal_alias __attribute((visibility("hidden"))); +#define xmlGetThreadId xmlGetThreadId__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlGetUTF8Char +extern __typeof (xmlGetUTF8Char) xmlGetUTF8Char __attribute((alias("xmlGetUTF8Char__internal_alias"))); +#else +#ifndef xmlGetUTF8Char +extern __typeof (xmlGetUTF8Char) xmlGetUTF8Char__internal_alias __attribute((visibility("hidden"))); +#define xmlGetUTF8Char xmlGetUTF8Char__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlHandleEntity +extern __typeof (xmlHandleEntity) xmlHandleEntity __attribute((alias("xmlHandleEntity__internal_alias"))); +#else +#ifndef xmlHandleEntity +extern __typeof (xmlHandleEntity) xmlHandleEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlHandleEntity xmlHandleEntity__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlHasFeature +extern __typeof (xmlHasFeature) xmlHasFeature __attribute((alias("xmlHasFeature__internal_alias"))); +#else +#ifndef xmlHasFeature +extern __typeof (xmlHasFeature) xmlHasFeature__internal_alias __attribute((visibility("hidden"))); +#define xmlHasFeature xmlHasFeature__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlHasNsProp +extern __typeof (xmlHasNsProp) xmlHasNsProp __attribute((alias("xmlHasNsProp__internal_alias"))); +#else +#ifndef xmlHasNsProp +extern __typeof (xmlHasNsProp) xmlHasNsProp__internal_alias __attribute((visibility("hidden"))); +#define xmlHasNsProp xmlHasNsProp__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlHasProp +extern __typeof (xmlHasProp) xmlHasProp __attribute((alias("xmlHasProp__internal_alias"))); +#else +#ifndef xmlHasProp +extern __typeof (xmlHasProp) xmlHasProp__internal_alias __attribute((visibility("hidden"))); +#define xmlHasProp xmlHasProp__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashAddEntry +extern __typeof (xmlHashAddEntry) xmlHashAddEntry __attribute((alias("xmlHashAddEntry__internal_alias"))); +#else +#ifndef xmlHashAddEntry +extern __typeof (xmlHashAddEntry) xmlHashAddEntry__internal_alias __attribute((visibility("hidden"))); +#define xmlHashAddEntry xmlHashAddEntry__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashAddEntry2 +extern __typeof (xmlHashAddEntry2) xmlHashAddEntry2 __attribute((alias("xmlHashAddEntry2__internal_alias"))); +#else +#ifndef xmlHashAddEntry2 +extern __typeof (xmlHashAddEntry2) xmlHashAddEntry2__internal_alias __attribute((visibility("hidden"))); +#define xmlHashAddEntry2 xmlHashAddEntry2__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashAddEntry3 +extern __typeof (xmlHashAddEntry3) xmlHashAddEntry3 __attribute((alias("xmlHashAddEntry3__internal_alias"))); +#else +#ifndef xmlHashAddEntry3 +extern __typeof (xmlHashAddEntry3) xmlHashAddEntry3__internal_alias __attribute((visibility("hidden"))); +#define xmlHashAddEntry3 xmlHashAddEntry3__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashCopy +extern __typeof (xmlHashCopy) xmlHashCopy __attribute((alias("xmlHashCopy__internal_alias"))); +#else +#ifndef xmlHashCopy +extern __typeof (xmlHashCopy) xmlHashCopy__internal_alias __attribute((visibility("hidden"))); +#define xmlHashCopy xmlHashCopy__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashCreate +extern __typeof (xmlHashCreate) xmlHashCreate __attribute((alias("xmlHashCreate__internal_alias"))); +#else +#ifndef xmlHashCreate +extern __typeof (xmlHashCreate) xmlHashCreate__internal_alias __attribute((visibility("hidden"))); +#define xmlHashCreate xmlHashCreate__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashCreateDict +extern __typeof (xmlHashCreateDict) xmlHashCreateDict __attribute((alias("xmlHashCreateDict__internal_alias"))); +#else +#ifndef xmlHashCreateDict +extern __typeof (xmlHashCreateDict) xmlHashCreateDict__internal_alias __attribute((visibility("hidden"))); +#define xmlHashCreateDict xmlHashCreateDict__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashFree +extern __typeof (xmlHashFree) xmlHashFree __attribute((alias("xmlHashFree__internal_alias"))); +#else +#ifndef xmlHashFree +extern __typeof (xmlHashFree) xmlHashFree__internal_alias __attribute((visibility("hidden"))); +#define xmlHashFree xmlHashFree__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashLookup +extern __typeof (xmlHashLookup) xmlHashLookup __attribute((alias("xmlHashLookup__internal_alias"))); +#else +#ifndef xmlHashLookup +extern __typeof (xmlHashLookup) xmlHashLookup__internal_alias __attribute((visibility("hidden"))); +#define xmlHashLookup xmlHashLookup__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashLookup2 +extern __typeof (xmlHashLookup2) xmlHashLookup2 __attribute((alias("xmlHashLookup2__internal_alias"))); +#else +#ifndef xmlHashLookup2 +extern __typeof (xmlHashLookup2) xmlHashLookup2__internal_alias __attribute((visibility("hidden"))); +#define xmlHashLookup2 xmlHashLookup2__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashLookup3 +extern __typeof (xmlHashLookup3) xmlHashLookup3 __attribute((alias("xmlHashLookup3__internal_alias"))); +#else +#ifndef xmlHashLookup3 +extern __typeof (xmlHashLookup3) xmlHashLookup3__internal_alias __attribute((visibility("hidden"))); +#define xmlHashLookup3 xmlHashLookup3__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashQLookup +extern __typeof (xmlHashQLookup) xmlHashQLookup __attribute((alias("xmlHashQLookup__internal_alias"))); +#else +#ifndef xmlHashQLookup +extern __typeof (xmlHashQLookup) xmlHashQLookup__internal_alias __attribute((visibility("hidden"))); +#define xmlHashQLookup xmlHashQLookup__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashQLookup2 +extern __typeof (xmlHashQLookup2) xmlHashQLookup2 __attribute((alias("xmlHashQLookup2__internal_alias"))); +#else +#ifndef xmlHashQLookup2 +extern __typeof (xmlHashQLookup2) xmlHashQLookup2__internal_alias __attribute((visibility("hidden"))); +#define xmlHashQLookup2 xmlHashQLookup2__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashQLookup3 +extern __typeof (xmlHashQLookup3) xmlHashQLookup3 __attribute((alias("xmlHashQLookup3__internal_alias"))); +#else +#ifndef xmlHashQLookup3 +extern __typeof (xmlHashQLookup3) xmlHashQLookup3__internal_alias __attribute((visibility("hidden"))); +#define xmlHashQLookup3 xmlHashQLookup3__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashRemoveEntry +extern __typeof (xmlHashRemoveEntry) xmlHashRemoveEntry __attribute((alias("xmlHashRemoveEntry__internal_alias"))); +#else +#ifndef xmlHashRemoveEntry +extern __typeof (xmlHashRemoveEntry) xmlHashRemoveEntry__internal_alias __attribute((visibility("hidden"))); +#define xmlHashRemoveEntry xmlHashRemoveEntry__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashRemoveEntry2 +extern __typeof (xmlHashRemoveEntry2) xmlHashRemoveEntry2 __attribute((alias("xmlHashRemoveEntry2__internal_alias"))); +#else +#ifndef xmlHashRemoveEntry2 +extern __typeof (xmlHashRemoveEntry2) xmlHashRemoveEntry2__internal_alias __attribute((visibility("hidden"))); +#define xmlHashRemoveEntry2 xmlHashRemoveEntry2__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashRemoveEntry3 +extern __typeof (xmlHashRemoveEntry3) xmlHashRemoveEntry3 __attribute((alias("xmlHashRemoveEntry3__internal_alias"))); +#else +#ifndef xmlHashRemoveEntry3 +extern __typeof (xmlHashRemoveEntry3) xmlHashRemoveEntry3__internal_alias __attribute((visibility("hidden"))); +#define xmlHashRemoveEntry3 xmlHashRemoveEntry3__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashScan +extern __typeof (xmlHashScan) xmlHashScan __attribute((alias("xmlHashScan__internal_alias"))); +#else +#ifndef xmlHashScan +extern __typeof (xmlHashScan) xmlHashScan__internal_alias __attribute((visibility("hidden"))); +#define xmlHashScan xmlHashScan__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashScan3 +extern __typeof (xmlHashScan3) xmlHashScan3 __attribute((alias("xmlHashScan3__internal_alias"))); +#else +#ifndef xmlHashScan3 +extern __typeof (xmlHashScan3) xmlHashScan3__internal_alias __attribute((visibility("hidden"))); +#define xmlHashScan3 xmlHashScan3__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashScanFull +extern __typeof (xmlHashScanFull) xmlHashScanFull __attribute((alias("xmlHashScanFull__internal_alias"))); +#else +#ifndef xmlHashScanFull +extern __typeof (xmlHashScanFull) xmlHashScanFull__internal_alias __attribute((visibility("hidden"))); +#define xmlHashScanFull xmlHashScanFull__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashScanFull3 +extern __typeof (xmlHashScanFull3) xmlHashScanFull3 __attribute((alias("xmlHashScanFull3__internal_alias"))); +#else +#ifndef xmlHashScanFull3 +extern __typeof (xmlHashScanFull3) xmlHashScanFull3__internal_alias __attribute((visibility("hidden"))); +#define xmlHashScanFull3 xmlHashScanFull3__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashSize +extern __typeof (xmlHashSize) xmlHashSize __attribute((alias("xmlHashSize__internal_alias"))); +#else +#ifndef xmlHashSize +extern __typeof (xmlHashSize) xmlHashSize__internal_alias __attribute((visibility("hidden"))); +#define xmlHashSize xmlHashSize__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashUpdateEntry +extern __typeof (xmlHashUpdateEntry) xmlHashUpdateEntry __attribute((alias("xmlHashUpdateEntry__internal_alias"))); +#else +#ifndef xmlHashUpdateEntry +extern __typeof (xmlHashUpdateEntry) xmlHashUpdateEntry__internal_alias __attribute((visibility("hidden"))); +#define xmlHashUpdateEntry xmlHashUpdateEntry__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashUpdateEntry2 +extern __typeof (xmlHashUpdateEntry2) xmlHashUpdateEntry2 __attribute((alias("xmlHashUpdateEntry2__internal_alias"))); +#else +#ifndef xmlHashUpdateEntry2 +extern __typeof (xmlHashUpdateEntry2) xmlHashUpdateEntry2__internal_alias __attribute((visibility("hidden"))); +#define xmlHashUpdateEntry2 xmlHashUpdateEntry2__internal_alias +#endif +#endif + +#ifdef bottom_hash +#undef xmlHashUpdateEntry3 +extern __typeof (xmlHashUpdateEntry3) xmlHashUpdateEntry3 __attribute((alias("xmlHashUpdateEntry3__internal_alias"))); +#else +#ifndef xmlHashUpdateEntry3 +extern __typeof (xmlHashUpdateEntry3) xmlHashUpdateEntry3__internal_alias __attribute((visibility("hidden"))); +#define xmlHashUpdateEntry3 xmlHashUpdateEntry3__internal_alias +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_xmlIO +#undef xmlIOFTPClose +extern __typeof (xmlIOFTPClose) xmlIOFTPClose __attribute((alias("xmlIOFTPClose__internal_alias"))); +#else +#ifndef xmlIOFTPClose +extern __typeof (xmlIOFTPClose) xmlIOFTPClose__internal_alias __attribute((visibility("hidden"))); +#define xmlIOFTPClose xmlIOFTPClose__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_xmlIO +#undef xmlIOFTPMatch +extern __typeof (xmlIOFTPMatch) xmlIOFTPMatch __attribute((alias("xmlIOFTPMatch__internal_alias"))); +#else +#ifndef xmlIOFTPMatch +extern __typeof (xmlIOFTPMatch) xmlIOFTPMatch__internal_alias __attribute((visibility("hidden"))); +#define xmlIOFTPMatch xmlIOFTPMatch__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_xmlIO +#undef xmlIOFTPOpen +extern __typeof (xmlIOFTPOpen) xmlIOFTPOpen __attribute((alias("xmlIOFTPOpen__internal_alias"))); +#else +#ifndef xmlIOFTPOpen +extern __typeof (xmlIOFTPOpen) xmlIOFTPOpen__internal_alias __attribute((visibility("hidden"))); +#define xmlIOFTPOpen xmlIOFTPOpen__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_xmlIO +#undef xmlIOFTPRead +extern __typeof (xmlIOFTPRead) xmlIOFTPRead __attribute((alias("xmlIOFTPRead__internal_alias"))); +#else +#ifndef xmlIOFTPRead +extern __typeof (xmlIOFTPRead) xmlIOFTPRead__internal_alias __attribute((visibility("hidden"))); +#define xmlIOFTPRead xmlIOFTPRead__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_xmlIO +#undef xmlIOHTTPClose +extern __typeof (xmlIOHTTPClose) xmlIOHTTPClose __attribute((alias("xmlIOHTTPClose__internal_alias"))); +#else +#ifndef xmlIOHTTPClose +extern __typeof (xmlIOHTTPClose) xmlIOHTTPClose__internal_alias __attribute((visibility("hidden"))); +#define xmlIOHTTPClose xmlIOHTTPClose__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_xmlIO +#undef xmlIOHTTPMatch +extern __typeof (xmlIOHTTPMatch) xmlIOHTTPMatch __attribute((alias("xmlIOHTTPMatch__internal_alias"))); +#else +#ifndef xmlIOHTTPMatch +extern __typeof (xmlIOHTTPMatch) xmlIOHTTPMatch__internal_alias __attribute((visibility("hidden"))); +#define xmlIOHTTPMatch xmlIOHTTPMatch__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_xmlIO +#undef xmlIOHTTPOpen +extern __typeof (xmlIOHTTPOpen) xmlIOHTTPOpen __attribute((alias("xmlIOHTTPOpen__internal_alias"))); +#else +#ifndef xmlIOHTTPOpen +extern __typeof (xmlIOHTTPOpen) xmlIOHTTPOpen__internal_alias __attribute((visibility("hidden"))); +#define xmlIOHTTPOpen xmlIOHTTPOpen__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlIOHTTPOpenW +extern __typeof (xmlIOHTTPOpenW) xmlIOHTTPOpenW __attribute((alias("xmlIOHTTPOpenW__internal_alias"))); +#else +#ifndef xmlIOHTTPOpenW +extern __typeof (xmlIOHTTPOpenW) xmlIOHTTPOpenW__internal_alias __attribute((visibility("hidden"))); +#define xmlIOHTTPOpenW xmlIOHTTPOpenW__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_xmlIO +#undef xmlIOHTTPRead +extern __typeof (xmlIOHTTPRead) xmlIOHTTPRead __attribute((alias("xmlIOHTTPRead__internal_alias"))); +#else +#ifndef xmlIOHTTPRead +extern __typeof (xmlIOHTTPRead) xmlIOHTTPRead__internal_alias __attribute((visibility("hidden"))); +#define xmlIOHTTPRead xmlIOHTTPRead__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_parser +#undef xmlIOParseDTD +extern __typeof (xmlIOParseDTD) xmlIOParseDTD __attribute((alias("xmlIOParseDTD__internal_alias"))); +#else +#ifndef xmlIOParseDTD +extern __typeof (xmlIOParseDTD) xmlIOParseDTD__internal_alias __attribute((visibility("hidden"))); +#define xmlIOParseDTD xmlIOParseDTD__internal_alias +#endif +#endif +#endif + +#ifdef bottom_encoding +#undef xmlInitCharEncodingHandlers +extern __typeof (xmlInitCharEncodingHandlers) xmlInitCharEncodingHandlers __attribute((alias("xmlInitCharEncodingHandlers__internal_alias"))); +#else +#ifndef xmlInitCharEncodingHandlers +extern __typeof (xmlInitCharEncodingHandlers) xmlInitCharEncodingHandlers__internal_alias __attribute((visibility("hidden"))); +#define xmlInitCharEncodingHandlers xmlInitCharEncodingHandlers__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlInitGlobals +extern __typeof (xmlInitGlobals) xmlInitGlobals __attribute((alias("xmlInitGlobals__internal_alias"))); +#else +#ifndef xmlInitGlobals +extern __typeof (xmlInitGlobals) xmlInitGlobals__internal_alias __attribute((visibility("hidden"))); +#define xmlInitGlobals xmlInitGlobals__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlInitMemory +extern __typeof (xmlInitMemory) xmlInitMemory __attribute((alias("xmlInitMemory__internal_alias"))); +#else +#ifndef xmlInitMemory +extern __typeof (xmlInitMemory) xmlInitMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlInitMemory xmlInitMemory__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlInitNodeInfoSeq +extern __typeof (xmlInitNodeInfoSeq) xmlInitNodeInfoSeq __attribute((alias("xmlInitNodeInfoSeq__internal_alias"))); +#else +#ifndef xmlInitNodeInfoSeq +extern __typeof (xmlInitNodeInfoSeq) xmlInitNodeInfoSeq__internal_alias __attribute((visibility("hidden"))); +#define xmlInitNodeInfoSeq xmlInitNodeInfoSeq__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlInitParser +extern __typeof (xmlInitParser) xmlInitParser __attribute((alias("xmlInitParser__internal_alias"))); +#else +#ifndef xmlInitParser +extern __typeof (xmlInitParser) xmlInitParser__internal_alias __attribute((visibility("hidden"))); +#define xmlInitParser xmlInitParser__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlInitParserCtxt +extern __typeof (xmlInitParserCtxt) xmlInitParserCtxt __attribute((alias("xmlInitParserCtxt__internal_alias"))); +#else +#ifndef xmlInitParserCtxt +extern __typeof (xmlInitParserCtxt) xmlInitParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlInitParserCtxt xmlInitParserCtxt__internal_alias +#endif +#endif + +#ifdef bottom_threads +#undef xmlInitThreads +extern __typeof (xmlInitThreads) xmlInitThreads __attribute((alias("xmlInitThreads__internal_alias"))); +#else +#ifndef xmlInitThreads +extern __typeof (xmlInitThreads) xmlInitThreads__internal_alias __attribute((visibility("hidden"))); +#define xmlInitThreads xmlInitThreads__internal_alias +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlInitializeCatalog +extern __typeof (xmlInitializeCatalog) xmlInitializeCatalog __attribute((alias("xmlInitializeCatalog__internal_alias"))); +#else +#ifndef xmlInitializeCatalog +extern __typeof (xmlInitializeCatalog) xmlInitializeCatalog__internal_alias __attribute((visibility("hidden"))); +#define xmlInitializeCatalog xmlInitializeCatalog__internal_alias +#endif +#endif +#endif + +#ifdef bottom_dict +#undef xmlInitializeDict +extern __typeof (xmlInitializeDict) xmlInitializeDict __attribute((alias("xmlInitializeDict__internal_alias"))); +#else +#ifndef xmlInitializeDict +extern __typeof (xmlInitializeDict) xmlInitializeDict__internal_alias __attribute((visibility("hidden"))); +#define xmlInitializeDict xmlInitializeDict__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlInitializeGlobalState +extern __typeof (xmlInitializeGlobalState) xmlInitializeGlobalState __attribute((alias("xmlInitializeGlobalState__internal_alias"))); +#else +#ifndef xmlInitializeGlobalState +extern __typeof (xmlInitializeGlobalState) xmlInitializeGlobalState__internal_alias __attribute((visibility("hidden"))); +#define xmlInitializeGlobalState xmlInitializeGlobalState__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlInitializePredefinedEntities +extern __typeof (xmlInitializePredefinedEntities) xmlInitializePredefinedEntities __attribute((alias("xmlInitializePredefinedEntities__internal_alias"))); +#else +#ifndef xmlInitializePredefinedEntities +extern __typeof (xmlInitializePredefinedEntities) xmlInitializePredefinedEntities__internal_alias __attribute((visibility("hidden"))); +#define xmlInitializePredefinedEntities xmlInitializePredefinedEntities__internal_alias +#endif +#endif +#endif + +#ifdef bottom_chvalid +#undef xmlIsBaseChar +extern __typeof (xmlIsBaseChar) xmlIsBaseChar __attribute((alias("xmlIsBaseChar__internal_alias"))); +#else +#ifndef xmlIsBaseChar +extern __typeof (xmlIsBaseChar) xmlIsBaseChar__internal_alias __attribute((visibility("hidden"))); +#define xmlIsBaseChar xmlIsBaseChar__internal_alias +#endif +#endif + +#ifdef bottom_chvalid +#undef xmlIsBlank +extern __typeof (xmlIsBlank) xmlIsBlank __attribute((alias("xmlIsBlank__internal_alias"))); +#else +#ifndef xmlIsBlank +extern __typeof (xmlIsBlank) xmlIsBlank__internal_alias __attribute((visibility("hidden"))); +#define xmlIsBlank xmlIsBlank__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlIsBlankNode +extern __typeof (xmlIsBlankNode) xmlIsBlankNode __attribute((alias("xmlIsBlankNode__internal_alias"))); +#else +#ifndef xmlIsBlankNode +extern __typeof (xmlIsBlankNode) xmlIsBlankNode__internal_alias __attribute((visibility("hidden"))); +#define xmlIsBlankNode xmlIsBlankNode__internal_alias +#endif +#endif + +#ifdef bottom_chvalid +#undef xmlIsChar +extern __typeof (xmlIsChar) xmlIsChar __attribute((alias("xmlIsChar__internal_alias"))); +#else +#ifndef xmlIsChar +extern __typeof (xmlIsChar) xmlIsChar__internal_alias __attribute((visibility("hidden"))); +#define xmlIsChar xmlIsChar__internal_alias +#endif +#endif + +#ifdef bottom_chvalid +#undef xmlIsCombining +extern __typeof (xmlIsCombining) xmlIsCombining __attribute((alias("xmlIsCombining__internal_alias"))); +#else +#ifndef xmlIsCombining +extern __typeof (xmlIsCombining) xmlIsCombining__internal_alias __attribute((visibility("hidden"))); +#define xmlIsCombining xmlIsCombining__internal_alias +#endif +#endif + +#ifdef bottom_chvalid +#undef xmlIsDigit +extern __typeof (xmlIsDigit) xmlIsDigit __attribute((alias("xmlIsDigit__internal_alias"))); +#else +#ifndef xmlIsDigit +extern __typeof (xmlIsDigit) xmlIsDigit__internal_alias __attribute((visibility("hidden"))); +#define xmlIsDigit xmlIsDigit__internal_alias +#endif +#endif + +#ifdef bottom_chvalid +#undef xmlIsExtender +extern __typeof (xmlIsExtender) xmlIsExtender __attribute((alias("xmlIsExtender__internal_alias"))); +#else +#ifndef xmlIsExtender +extern __typeof (xmlIsExtender) xmlIsExtender__internal_alias __attribute((visibility("hidden"))); +#define xmlIsExtender xmlIsExtender__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlIsID +extern __typeof (xmlIsID) xmlIsID __attribute((alias("xmlIsID__internal_alias"))); +#else +#ifndef xmlIsID +extern __typeof (xmlIsID) xmlIsID__internal_alias __attribute((visibility("hidden"))); +#define xmlIsID xmlIsID__internal_alias +#endif +#endif + +#ifdef bottom_chvalid +#undef xmlIsIdeographic +extern __typeof (xmlIsIdeographic) xmlIsIdeographic __attribute((alias("xmlIsIdeographic__internal_alias"))); +#else +#ifndef xmlIsIdeographic +extern __typeof (xmlIsIdeographic) xmlIsIdeographic__internal_alias __attribute((visibility("hidden"))); +#define xmlIsIdeographic xmlIsIdeographic__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlIsLetter +extern __typeof (xmlIsLetter) xmlIsLetter __attribute((alias("xmlIsLetter__internal_alias"))); +#else +#ifndef xmlIsLetter +extern __typeof (xmlIsLetter) xmlIsLetter__internal_alias __attribute((visibility("hidden"))); +#define xmlIsLetter xmlIsLetter__internal_alias +#endif +#endif + +#ifdef bottom_threads +#undef xmlIsMainThread +extern __typeof (xmlIsMainThread) xmlIsMainThread __attribute((alias("xmlIsMainThread__internal_alias"))); +#else +#ifndef xmlIsMainThread +extern __typeof (xmlIsMainThread) xmlIsMainThread__internal_alias __attribute((visibility("hidden"))); +#define xmlIsMainThread xmlIsMainThread__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlIsMixedElement +extern __typeof (xmlIsMixedElement) xmlIsMixedElement __attribute((alias("xmlIsMixedElement__internal_alias"))); +#else +#ifndef xmlIsMixedElement +extern __typeof (xmlIsMixedElement) xmlIsMixedElement__internal_alias __attribute((visibility("hidden"))); +#define xmlIsMixedElement xmlIsMixedElement__internal_alias +#endif +#endif + +#ifdef bottom_chvalid +#undef xmlIsPubidChar +extern __typeof (xmlIsPubidChar) xmlIsPubidChar __attribute((alias("xmlIsPubidChar__internal_alias"))); +#else +#ifndef xmlIsPubidChar +extern __typeof (xmlIsPubidChar) xmlIsPubidChar__internal_alias __attribute((visibility("hidden"))); +#define xmlIsPubidChar xmlIsPubidChar__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlIsRef +extern __typeof (xmlIsRef) xmlIsRef __attribute((alias("xmlIsRef__internal_alias"))); +#else +#ifndef xmlIsRef +extern __typeof (xmlIsRef) xmlIsRef__internal_alias __attribute((visibility("hidden"))); +#define xmlIsRef xmlIsRef__internal_alias +#endif +#endif + +#ifdef bottom_xmlsave +#undef xmlIsXHTML +extern __typeof (xmlIsXHTML) xmlIsXHTML __attribute((alias("xmlIsXHTML__internal_alias"))); +#else +#ifndef xmlIsXHTML +extern __typeof (xmlIsXHTML) xmlIsXHTML__internal_alias __attribute((visibility("hidden"))); +#define xmlIsXHTML xmlIsXHTML__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlKeepBlanksDefault +extern __typeof (xmlKeepBlanksDefault) xmlKeepBlanksDefault __attribute((alias("xmlKeepBlanksDefault__internal_alias"))); +#else +#ifndef xmlKeepBlanksDefault +extern __typeof (xmlKeepBlanksDefault) xmlKeepBlanksDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlKeepBlanksDefault xmlKeepBlanksDefault__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlLastElementChild +extern __typeof (xmlLastElementChild) xmlLastElementChild __attribute((alias("xmlLastElementChild__internal_alias"))); +#else +#ifndef xmlLastElementChild +extern __typeof (xmlLastElementChild) xmlLastElementChild__internal_alias __attribute((visibility("hidden"))); +#define xmlLastElementChild xmlLastElementChild__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlLineNumbersDefault +extern __typeof (xmlLineNumbersDefault) xmlLineNumbersDefault __attribute((alias("xmlLineNumbersDefault__internal_alias"))); +#else +#ifndef xmlLineNumbersDefault +extern __typeof (xmlLineNumbersDefault) xmlLineNumbersDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlLineNumbersDefault xmlLineNumbersDefault__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlLinkGetData +extern __typeof (xmlLinkGetData) xmlLinkGetData __attribute((alias("xmlLinkGetData__internal_alias"))); +#else +#ifndef xmlLinkGetData +extern __typeof (xmlLinkGetData) xmlLinkGetData__internal_alias __attribute((visibility("hidden"))); +#define xmlLinkGetData xmlLinkGetData__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListAppend +extern __typeof (xmlListAppend) xmlListAppend __attribute((alias("xmlListAppend__internal_alias"))); +#else +#ifndef xmlListAppend +extern __typeof (xmlListAppend) xmlListAppend__internal_alias __attribute((visibility("hidden"))); +#define xmlListAppend xmlListAppend__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListClear +extern __typeof (xmlListClear) xmlListClear __attribute((alias("xmlListClear__internal_alias"))); +#else +#ifndef xmlListClear +extern __typeof (xmlListClear) xmlListClear__internal_alias __attribute((visibility("hidden"))); +#define xmlListClear xmlListClear__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListCopy +extern __typeof (xmlListCopy) xmlListCopy __attribute((alias("xmlListCopy__internal_alias"))); +#else +#ifndef xmlListCopy +extern __typeof (xmlListCopy) xmlListCopy__internal_alias __attribute((visibility("hidden"))); +#define xmlListCopy xmlListCopy__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListCreate +extern __typeof (xmlListCreate) xmlListCreate __attribute((alias("xmlListCreate__internal_alias"))); +#else +#ifndef xmlListCreate +extern __typeof (xmlListCreate) xmlListCreate__internal_alias __attribute((visibility("hidden"))); +#define xmlListCreate xmlListCreate__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListDelete +extern __typeof (xmlListDelete) xmlListDelete __attribute((alias("xmlListDelete__internal_alias"))); +#else +#ifndef xmlListDelete +extern __typeof (xmlListDelete) xmlListDelete__internal_alias __attribute((visibility("hidden"))); +#define xmlListDelete xmlListDelete__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListDup +extern __typeof (xmlListDup) xmlListDup __attribute((alias("xmlListDup__internal_alias"))); +#else +#ifndef xmlListDup +extern __typeof (xmlListDup) xmlListDup__internal_alias __attribute((visibility("hidden"))); +#define xmlListDup xmlListDup__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListEmpty +extern __typeof (xmlListEmpty) xmlListEmpty __attribute((alias("xmlListEmpty__internal_alias"))); +#else +#ifndef xmlListEmpty +extern __typeof (xmlListEmpty) xmlListEmpty__internal_alias __attribute((visibility("hidden"))); +#define xmlListEmpty xmlListEmpty__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListEnd +extern __typeof (xmlListEnd) xmlListEnd __attribute((alias("xmlListEnd__internal_alias"))); +#else +#ifndef xmlListEnd +extern __typeof (xmlListEnd) xmlListEnd__internal_alias __attribute((visibility("hidden"))); +#define xmlListEnd xmlListEnd__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListFront +extern __typeof (xmlListFront) xmlListFront __attribute((alias("xmlListFront__internal_alias"))); +#else +#ifndef xmlListFront +extern __typeof (xmlListFront) xmlListFront__internal_alias __attribute((visibility("hidden"))); +#define xmlListFront xmlListFront__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListInsert +extern __typeof (xmlListInsert) xmlListInsert __attribute((alias("xmlListInsert__internal_alias"))); +#else +#ifndef xmlListInsert +extern __typeof (xmlListInsert) xmlListInsert__internal_alias __attribute((visibility("hidden"))); +#define xmlListInsert xmlListInsert__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListMerge +extern __typeof (xmlListMerge) xmlListMerge __attribute((alias("xmlListMerge__internal_alias"))); +#else +#ifndef xmlListMerge +extern __typeof (xmlListMerge) xmlListMerge__internal_alias __attribute((visibility("hidden"))); +#define xmlListMerge xmlListMerge__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListPopBack +extern __typeof (xmlListPopBack) xmlListPopBack __attribute((alias("xmlListPopBack__internal_alias"))); +#else +#ifndef xmlListPopBack +extern __typeof (xmlListPopBack) xmlListPopBack__internal_alias __attribute((visibility("hidden"))); +#define xmlListPopBack xmlListPopBack__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListPopFront +extern __typeof (xmlListPopFront) xmlListPopFront __attribute((alias("xmlListPopFront__internal_alias"))); +#else +#ifndef xmlListPopFront +extern __typeof (xmlListPopFront) xmlListPopFront__internal_alias __attribute((visibility("hidden"))); +#define xmlListPopFront xmlListPopFront__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListPushBack +extern __typeof (xmlListPushBack) xmlListPushBack __attribute((alias("xmlListPushBack__internal_alias"))); +#else +#ifndef xmlListPushBack +extern __typeof (xmlListPushBack) xmlListPushBack__internal_alias __attribute((visibility("hidden"))); +#define xmlListPushBack xmlListPushBack__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListPushFront +extern __typeof (xmlListPushFront) xmlListPushFront __attribute((alias("xmlListPushFront__internal_alias"))); +#else +#ifndef xmlListPushFront +extern __typeof (xmlListPushFront) xmlListPushFront__internal_alias __attribute((visibility("hidden"))); +#define xmlListPushFront xmlListPushFront__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListRemoveAll +extern __typeof (xmlListRemoveAll) xmlListRemoveAll __attribute((alias("xmlListRemoveAll__internal_alias"))); +#else +#ifndef xmlListRemoveAll +extern __typeof (xmlListRemoveAll) xmlListRemoveAll__internal_alias __attribute((visibility("hidden"))); +#define xmlListRemoveAll xmlListRemoveAll__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListRemoveFirst +extern __typeof (xmlListRemoveFirst) xmlListRemoveFirst __attribute((alias("xmlListRemoveFirst__internal_alias"))); +#else +#ifndef xmlListRemoveFirst +extern __typeof (xmlListRemoveFirst) xmlListRemoveFirst__internal_alias __attribute((visibility("hidden"))); +#define xmlListRemoveFirst xmlListRemoveFirst__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListRemoveLast +extern __typeof (xmlListRemoveLast) xmlListRemoveLast __attribute((alias("xmlListRemoveLast__internal_alias"))); +#else +#ifndef xmlListRemoveLast +extern __typeof (xmlListRemoveLast) xmlListRemoveLast__internal_alias __attribute((visibility("hidden"))); +#define xmlListRemoveLast xmlListRemoveLast__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListReverse +extern __typeof (xmlListReverse) xmlListReverse __attribute((alias("xmlListReverse__internal_alias"))); +#else +#ifndef xmlListReverse +extern __typeof (xmlListReverse) xmlListReverse__internal_alias __attribute((visibility("hidden"))); +#define xmlListReverse xmlListReverse__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListReverseSearch +extern __typeof (xmlListReverseSearch) xmlListReverseSearch __attribute((alias("xmlListReverseSearch__internal_alias"))); +#else +#ifndef xmlListReverseSearch +extern __typeof (xmlListReverseSearch) xmlListReverseSearch__internal_alias __attribute((visibility("hidden"))); +#define xmlListReverseSearch xmlListReverseSearch__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListReverseWalk +extern __typeof (xmlListReverseWalk) xmlListReverseWalk __attribute((alias("xmlListReverseWalk__internal_alias"))); +#else +#ifndef xmlListReverseWalk +extern __typeof (xmlListReverseWalk) xmlListReverseWalk__internal_alias __attribute((visibility("hidden"))); +#define xmlListReverseWalk xmlListReverseWalk__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListSearch +extern __typeof (xmlListSearch) xmlListSearch __attribute((alias("xmlListSearch__internal_alias"))); +#else +#ifndef xmlListSearch +extern __typeof (xmlListSearch) xmlListSearch__internal_alias __attribute((visibility("hidden"))); +#define xmlListSearch xmlListSearch__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListSize +extern __typeof (xmlListSize) xmlListSize __attribute((alias("xmlListSize__internal_alias"))); +#else +#ifndef xmlListSize +extern __typeof (xmlListSize) xmlListSize__internal_alias __attribute((visibility("hidden"))); +#define xmlListSize xmlListSize__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListSort +extern __typeof (xmlListSort) xmlListSort __attribute((alias("xmlListSort__internal_alias"))); +#else +#ifndef xmlListSort +extern __typeof (xmlListSort) xmlListSort__internal_alias __attribute((visibility("hidden"))); +#define xmlListSort xmlListSort__internal_alias +#endif +#endif + +#ifdef bottom_list +#undef xmlListWalk +extern __typeof (xmlListWalk) xmlListWalk __attribute((alias("xmlListWalk__internal_alias"))); +#else +#ifndef xmlListWalk +extern __typeof (xmlListWalk) xmlListWalk__internal_alias __attribute((visibility("hidden"))); +#define xmlListWalk xmlListWalk__internal_alias +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlLoadACatalog +extern __typeof (xmlLoadACatalog) xmlLoadACatalog __attribute((alias("xmlLoadACatalog__internal_alias"))); +#else +#ifndef xmlLoadACatalog +extern __typeof (xmlLoadACatalog) xmlLoadACatalog__internal_alias __attribute((visibility("hidden"))); +#define xmlLoadACatalog xmlLoadACatalog__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlLoadCatalog +extern __typeof (xmlLoadCatalog) xmlLoadCatalog __attribute((alias("xmlLoadCatalog__internal_alias"))); +#else +#ifndef xmlLoadCatalog +extern __typeof (xmlLoadCatalog) xmlLoadCatalog__internal_alias __attribute((visibility("hidden"))); +#define xmlLoadCatalog xmlLoadCatalog__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlLoadCatalogs +extern __typeof (xmlLoadCatalogs) xmlLoadCatalogs __attribute((alias("xmlLoadCatalogs__internal_alias"))); +#else +#ifndef xmlLoadCatalogs +extern __typeof (xmlLoadCatalogs) xmlLoadCatalogs__internal_alias __attribute((visibility("hidden"))); +#define xmlLoadCatalogs xmlLoadCatalogs__internal_alias +#endif +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlLoadExternalEntity +extern __typeof (xmlLoadExternalEntity) xmlLoadExternalEntity __attribute((alias("xmlLoadExternalEntity__internal_alias"))); +#else +#ifndef xmlLoadExternalEntity +extern __typeof (xmlLoadExternalEntity) xmlLoadExternalEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlLoadExternalEntity xmlLoadExternalEntity__internal_alias +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlLoadSGMLSuperCatalog +extern __typeof (xmlLoadSGMLSuperCatalog) xmlLoadSGMLSuperCatalog __attribute((alias("xmlLoadSGMLSuperCatalog__internal_alias"))); +#else +#ifndef xmlLoadSGMLSuperCatalog +extern __typeof (xmlLoadSGMLSuperCatalog) xmlLoadSGMLSuperCatalog__internal_alias __attribute((visibility("hidden"))); +#define xmlLoadSGMLSuperCatalog xmlLoadSGMLSuperCatalog__internal_alias +#endif +#endif +#endif + +#ifdef bottom_threads +#undef xmlLockLibrary +extern __typeof (xmlLockLibrary) xmlLockLibrary __attribute((alias("xmlLockLibrary__internal_alias"))); +#else +#ifndef xmlLockLibrary +extern __typeof (xmlLockLibrary) xmlLockLibrary__internal_alias __attribute((visibility("hidden"))); +#define xmlLockLibrary xmlLockLibrary__internal_alias +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlLsCountNode +extern __typeof (xmlLsCountNode) xmlLsCountNode __attribute((alias("xmlLsCountNode__internal_alias"))); +#else +#ifndef xmlLsCountNode +extern __typeof (xmlLsCountNode) xmlLsCountNode__internal_alias __attribute((visibility("hidden"))); +#define xmlLsCountNode xmlLsCountNode__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_debugXML +#undef xmlLsOneNode +extern __typeof (xmlLsOneNode) xmlLsOneNode __attribute((alias("xmlLsOneNode__internal_alias"))); +#else +#ifndef xmlLsOneNode +extern __typeof (xmlLsOneNode) xmlLsOneNode__internal_alias __attribute((visibility("hidden"))); +#define xmlLsOneNode xmlLsOneNode__internal_alias +#endif +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMallocAtomicLoc +extern __typeof (xmlMallocAtomicLoc) xmlMallocAtomicLoc __attribute((alias("xmlMallocAtomicLoc__internal_alias"))); +#else +#ifndef xmlMallocAtomicLoc +extern __typeof (xmlMallocAtomicLoc) xmlMallocAtomicLoc__internal_alias __attribute((visibility("hidden"))); +#define xmlMallocAtomicLoc xmlMallocAtomicLoc__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMallocLoc +extern __typeof (xmlMallocLoc) xmlMallocLoc __attribute((alias("xmlMallocLoc__internal_alias"))); +#else +#ifndef xmlMallocLoc +extern __typeof (xmlMallocLoc) xmlMallocLoc__internal_alias __attribute((visibility("hidden"))); +#define xmlMallocLoc xmlMallocLoc__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemBlocks +extern __typeof (xmlMemBlocks) xmlMemBlocks __attribute((alias("xmlMemBlocks__internal_alias"))); +#else +#ifndef xmlMemBlocks +extern __typeof (xmlMemBlocks) xmlMemBlocks__internal_alias __attribute((visibility("hidden"))); +#define xmlMemBlocks xmlMemBlocks__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemDisplay +extern __typeof (xmlMemDisplay) xmlMemDisplay __attribute((alias("xmlMemDisplay__internal_alias"))); +#else +#ifndef xmlMemDisplay +extern __typeof (xmlMemDisplay) xmlMemDisplay__internal_alias __attribute((visibility("hidden"))); +#define xmlMemDisplay xmlMemDisplay__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemDisplayLast +extern __typeof (xmlMemDisplayLast) xmlMemDisplayLast __attribute((alias("xmlMemDisplayLast__internal_alias"))); +#else +#ifndef xmlMemDisplayLast +extern __typeof (xmlMemDisplayLast) xmlMemDisplayLast__internal_alias __attribute((visibility("hidden"))); +#define xmlMemDisplayLast xmlMemDisplayLast__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemFree +extern __typeof (xmlMemFree) xmlMemFree __attribute((alias("xmlMemFree__internal_alias"))); +#else +#ifndef xmlMemFree +extern __typeof (xmlMemFree) xmlMemFree__internal_alias __attribute((visibility("hidden"))); +#define xmlMemFree xmlMemFree__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemGet +extern __typeof (xmlMemGet) xmlMemGet __attribute((alias("xmlMemGet__internal_alias"))); +#else +#ifndef xmlMemGet +extern __typeof (xmlMemGet) xmlMemGet__internal_alias __attribute((visibility("hidden"))); +#define xmlMemGet xmlMemGet__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemMalloc +extern __typeof (xmlMemMalloc) xmlMemMalloc __attribute((alias("xmlMemMalloc__internal_alias"))); +#else +#ifndef xmlMemMalloc +extern __typeof (xmlMemMalloc) xmlMemMalloc__internal_alias __attribute((visibility("hidden"))); +#define xmlMemMalloc xmlMemMalloc__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemRealloc +extern __typeof (xmlMemRealloc) xmlMemRealloc __attribute((alias("xmlMemRealloc__internal_alias"))); +#else +#ifndef xmlMemRealloc +extern __typeof (xmlMemRealloc) xmlMemRealloc__internal_alias __attribute((visibility("hidden"))); +#define xmlMemRealloc xmlMemRealloc__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemSetup +extern __typeof (xmlMemSetup) xmlMemSetup __attribute((alias("xmlMemSetup__internal_alias"))); +#else +#ifndef xmlMemSetup +extern __typeof (xmlMemSetup) xmlMemSetup__internal_alias __attribute((visibility("hidden"))); +#define xmlMemSetup xmlMemSetup__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemShow +extern __typeof (xmlMemShow) xmlMemShow __attribute((alias("xmlMemShow__internal_alias"))); +#else +#ifndef xmlMemShow +extern __typeof (xmlMemShow) xmlMemShow__internal_alias __attribute((visibility("hidden"))); +#define xmlMemShow xmlMemShow__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemStrdupLoc +extern __typeof (xmlMemStrdupLoc) xmlMemStrdupLoc __attribute((alias("xmlMemStrdupLoc__internal_alias"))); +#else +#ifndef xmlMemStrdupLoc +extern __typeof (xmlMemStrdupLoc) xmlMemStrdupLoc__internal_alias __attribute((visibility("hidden"))); +#define xmlMemStrdupLoc xmlMemStrdupLoc__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemUsed +extern __typeof (xmlMemUsed) xmlMemUsed __attribute((alias("xmlMemUsed__internal_alias"))); +#else +#ifndef xmlMemUsed +extern __typeof (xmlMemUsed) xmlMemUsed__internal_alias __attribute((visibility("hidden"))); +#define xmlMemUsed xmlMemUsed__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemoryDump +extern __typeof (xmlMemoryDump) xmlMemoryDump __attribute((alias("xmlMemoryDump__internal_alias"))); +#else +#ifndef xmlMemoryDump +extern __typeof (xmlMemoryDump) xmlMemoryDump__internal_alias __attribute((visibility("hidden"))); +#define xmlMemoryDump xmlMemoryDump__internal_alias +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlMemoryStrdup +extern __typeof (xmlMemoryStrdup) xmlMemoryStrdup __attribute((alias("xmlMemoryStrdup__internal_alias"))); +#else +#ifndef xmlMemoryStrdup +extern __typeof (xmlMemoryStrdup) xmlMemoryStrdup__internal_alias __attribute((visibility("hidden"))); +#define xmlMemoryStrdup xmlMemoryStrdup__internal_alias +#endif +#endif + +#if defined(LIBXML_MODULES_ENABLED) +#ifdef bottom_xmlmodule +#undef xmlModuleClose +extern __typeof (xmlModuleClose) xmlModuleClose __attribute((alias("xmlModuleClose__internal_alias"))); +#else +#ifndef xmlModuleClose +extern __typeof (xmlModuleClose) xmlModuleClose__internal_alias __attribute((visibility("hidden"))); +#define xmlModuleClose xmlModuleClose__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_MODULES_ENABLED) +#ifdef bottom_xmlmodule +#undef xmlModuleFree +extern __typeof (xmlModuleFree) xmlModuleFree __attribute((alias("xmlModuleFree__internal_alias"))); +#else +#ifndef xmlModuleFree +extern __typeof (xmlModuleFree) xmlModuleFree__internal_alias __attribute((visibility("hidden"))); +#define xmlModuleFree xmlModuleFree__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_MODULES_ENABLED) +#ifdef bottom_xmlmodule +#undef xmlModuleOpen +extern __typeof (xmlModuleOpen) xmlModuleOpen __attribute((alias("xmlModuleOpen__internal_alias"))); +#else +#ifndef xmlModuleOpen +extern __typeof (xmlModuleOpen) xmlModuleOpen__internal_alias __attribute((visibility("hidden"))); +#define xmlModuleOpen xmlModuleOpen__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_MODULES_ENABLED) +#ifdef bottom_xmlmodule +#undef xmlModuleSymbol +extern __typeof (xmlModuleSymbol) xmlModuleSymbol __attribute((alias("xmlModuleSymbol__internal_alias"))); +#else +#ifndef xmlModuleSymbol +extern __typeof (xmlModuleSymbol) xmlModuleSymbol__internal_alias __attribute((visibility("hidden"))); +#define xmlModuleSymbol xmlModuleSymbol__internal_alias +#endif +#endif +#endif + +#ifdef bottom_threads +#undef xmlMutexLock +extern __typeof (xmlMutexLock) xmlMutexLock __attribute((alias("xmlMutexLock__internal_alias"))); +#else +#ifndef xmlMutexLock +extern __typeof (xmlMutexLock) xmlMutexLock__internal_alias __attribute((visibility("hidden"))); +#define xmlMutexLock xmlMutexLock__internal_alias +#endif +#endif + +#ifdef bottom_threads +#undef xmlMutexUnlock +extern __typeof (xmlMutexUnlock) xmlMutexUnlock __attribute((alias("xmlMutexUnlock__internal_alias"))); +#else +#ifndef xmlMutexUnlock +extern __typeof (xmlMutexUnlock) xmlMutexUnlock__internal_alias __attribute((visibility("hidden"))); +#define xmlMutexUnlock xmlMutexUnlock__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlNamespaceParseNCName +extern __typeof (xmlNamespaceParseNCName) xmlNamespaceParseNCName __attribute((alias("xmlNamespaceParseNCName__internal_alias"))); +#else +#ifndef xmlNamespaceParseNCName +extern __typeof (xmlNamespaceParseNCName) xmlNamespaceParseNCName__internal_alias __attribute((visibility("hidden"))); +#define xmlNamespaceParseNCName xmlNamespaceParseNCName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlNamespaceParseNSDef +extern __typeof (xmlNamespaceParseNSDef) xmlNamespaceParseNSDef __attribute((alias("xmlNamespaceParseNSDef__internal_alias"))); +#else +#ifndef xmlNamespaceParseNSDef +extern __typeof (xmlNamespaceParseNSDef) xmlNamespaceParseNSDef__internal_alias __attribute((visibility("hidden"))); +#define xmlNamespaceParseNSDef xmlNamespaceParseNSDef__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlNamespaceParseQName +extern __typeof (xmlNamespaceParseQName) xmlNamespaceParseQName __attribute((alias("xmlNamespaceParseQName__internal_alias"))); +#else +#ifndef xmlNamespaceParseQName +extern __typeof (xmlNamespaceParseQName) xmlNamespaceParseQName__internal_alias __attribute((visibility("hidden"))); +#define xmlNamespaceParseQName xmlNamespaceParseQName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPCheckResponse +extern __typeof (xmlNanoFTPCheckResponse) xmlNanoFTPCheckResponse __attribute((alias("xmlNanoFTPCheckResponse__internal_alias"))); +#else +#ifndef xmlNanoFTPCheckResponse +extern __typeof (xmlNanoFTPCheckResponse) xmlNanoFTPCheckResponse__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPCheckResponse xmlNanoFTPCheckResponse__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPCleanup +extern __typeof (xmlNanoFTPCleanup) xmlNanoFTPCleanup __attribute((alias("xmlNanoFTPCleanup__internal_alias"))); +#else +#ifndef xmlNanoFTPCleanup +extern __typeof (xmlNanoFTPCleanup) xmlNanoFTPCleanup__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPCleanup xmlNanoFTPCleanup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPClose +extern __typeof (xmlNanoFTPClose) xmlNanoFTPClose __attribute((alias("xmlNanoFTPClose__internal_alias"))); +#else +#ifndef xmlNanoFTPClose +extern __typeof (xmlNanoFTPClose) xmlNanoFTPClose__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPClose xmlNanoFTPClose__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPCloseConnection +extern __typeof (xmlNanoFTPCloseConnection) xmlNanoFTPCloseConnection __attribute((alias("xmlNanoFTPCloseConnection__internal_alias"))); +#else +#ifndef xmlNanoFTPCloseConnection +extern __typeof (xmlNanoFTPCloseConnection) xmlNanoFTPCloseConnection__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPCloseConnection xmlNanoFTPCloseConnection__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPConnect +extern __typeof (xmlNanoFTPConnect) xmlNanoFTPConnect __attribute((alias("xmlNanoFTPConnect__internal_alias"))); +#else +#ifndef xmlNanoFTPConnect +extern __typeof (xmlNanoFTPConnect) xmlNanoFTPConnect__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPConnect xmlNanoFTPConnect__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPConnectTo +extern __typeof (xmlNanoFTPConnectTo) xmlNanoFTPConnectTo __attribute((alias("xmlNanoFTPConnectTo__internal_alias"))); +#else +#ifndef xmlNanoFTPConnectTo +extern __typeof (xmlNanoFTPConnectTo) xmlNanoFTPConnectTo__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPConnectTo xmlNanoFTPConnectTo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPCwd +extern __typeof (xmlNanoFTPCwd) xmlNanoFTPCwd __attribute((alias("xmlNanoFTPCwd__internal_alias"))); +#else +#ifndef xmlNanoFTPCwd +extern __typeof (xmlNanoFTPCwd) xmlNanoFTPCwd__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPCwd xmlNanoFTPCwd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPDele +extern __typeof (xmlNanoFTPDele) xmlNanoFTPDele __attribute((alias("xmlNanoFTPDele__internal_alias"))); +#else +#ifndef xmlNanoFTPDele +extern __typeof (xmlNanoFTPDele) xmlNanoFTPDele__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPDele xmlNanoFTPDele__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPFreeCtxt +extern __typeof (xmlNanoFTPFreeCtxt) xmlNanoFTPFreeCtxt __attribute((alias("xmlNanoFTPFreeCtxt__internal_alias"))); +#else +#ifndef xmlNanoFTPFreeCtxt +extern __typeof (xmlNanoFTPFreeCtxt) xmlNanoFTPFreeCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPFreeCtxt xmlNanoFTPFreeCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPGet +extern __typeof (xmlNanoFTPGet) xmlNanoFTPGet __attribute((alias("xmlNanoFTPGet__internal_alias"))); +#else +#ifndef xmlNanoFTPGet +extern __typeof (xmlNanoFTPGet) xmlNanoFTPGet__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPGet xmlNanoFTPGet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPGetConnection +extern __typeof (xmlNanoFTPGetConnection) xmlNanoFTPGetConnection __attribute((alias("xmlNanoFTPGetConnection__internal_alias"))); +#else +#ifndef xmlNanoFTPGetConnection +extern __typeof (xmlNanoFTPGetConnection) xmlNanoFTPGetConnection__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPGetConnection xmlNanoFTPGetConnection__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPGetResponse +extern __typeof (xmlNanoFTPGetResponse) xmlNanoFTPGetResponse __attribute((alias("xmlNanoFTPGetResponse__internal_alias"))); +#else +#ifndef xmlNanoFTPGetResponse +extern __typeof (xmlNanoFTPGetResponse) xmlNanoFTPGetResponse__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPGetResponse xmlNanoFTPGetResponse__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPGetSocket +extern __typeof (xmlNanoFTPGetSocket) xmlNanoFTPGetSocket __attribute((alias("xmlNanoFTPGetSocket__internal_alias"))); +#else +#ifndef xmlNanoFTPGetSocket +extern __typeof (xmlNanoFTPGetSocket) xmlNanoFTPGetSocket__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPGetSocket xmlNanoFTPGetSocket__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPInit +extern __typeof (xmlNanoFTPInit) xmlNanoFTPInit __attribute((alias("xmlNanoFTPInit__internal_alias"))); +#else +#ifndef xmlNanoFTPInit +extern __typeof (xmlNanoFTPInit) xmlNanoFTPInit__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPInit xmlNanoFTPInit__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPList +extern __typeof (xmlNanoFTPList) xmlNanoFTPList __attribute((alias("xmlNanoFTPList__internal_alias"))); +#else +#ifndef xmlNanoFTPList +extern __typeof (xmlNanoFTPList) xmlNanoFTPList__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPList xmlNanoFTPList__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPNewCtxt +extern __typeof (xmlNanoFTPNewCtxt) xmlNanoFTPNewCtxt __attribute((alias("xmlNanoFTPNewCtxt__internal_alias"))); +#else +#ifndef xmlNanoFTPNewCtxt +extern __typeof (xmlNanoFTPNewCtxt) xmlNanoFTPNewCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPNewCtxt xmlNanoFTPNewCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPOpen +extern __typeof (xmlNanoFTPOpen) xmlNanoFTPOpen __attribute((alias("xmlNanoFTPOpen__internal_alias"))); +#else +#ifndef xmlNanoFTPOpen +extern __typeof (xmlNanoFTPOpen) xmlNanoFTPOpen__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPOpen xmlNanoFTPOpen__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPProxy +extern __typeof (xmlNanoFTPProxy) xmlNanoFTPProxy __attribute((alias("xmlNanoFTPProxy__internal_alias"))); +#else +#ifndef xmlNanoFTPProxy +extern __typeof (xmlNanoFTPProxy) xmlNanoFTPProxy__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPProxy xmlNanoFTPProxy__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPQuit +extern __typeof (xmlNanoFTPQuit) xmlNanoFTPQuit __attribute((alias("xmlNanoFTPQuit__internal_alias"))); +#else +#ifndef xmlNanoFTPQuit +extern __typeof (xmlNanoFTPQuit) xmlNanoFTPQuit__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPQuit xmlNanoFTPQuit__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPRead +extern __typeof (xmlNanoFTPRead) xmlNanoFTPRead __attribute((alias("xmlNanoFTPRead__internal_alias"))); +#else +#ifndef xmlNanoFTPRead +extern __typeof (xmlNanoFTPRead) xmlNanoFTPRead__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPRead xmlNanoFTPRead__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPScanProxy +extern __typeof (xmlNanoFTPScanProxy) xmlNanoFTPScanProxy __attribute((alias("xmlNanoFTPScanProxy__internal_alias"))); +#else +#ifndef xmlNanoFTPScanProxy +extern __typeof (xmlNanoFTPScanProxy) xmlNanoFTPScanProxy__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPScanProxy xmlNanoFTPScanProxy__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_FTP_ENABLED) +#ifdef bottom_nanoftp +#undef xmlNanoFTPUpdateURL +extern __typeof (xmlNanoFTPUpdateURL) xmlNanoFTPUpdateURL __attribute((alias("xmlNanoFTPUpdateURL__internal_alias"))); +#else +#ifndef xmlNanoFTPUpdateURL +extern __typeof (xmlNanoFTPUpdateURL) xmlNanoFTPUpdateURL__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoFTPUpdateURL xmlNanoFTPUpdateURL__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPAuthHeader +extern __typeof (xmlNanoHTTPAuthHeader) xmlNanoHTTPAuthHeader __attribute((alias("xmlNanoHTTPAuthHeader__internal_alias"))); +#else +#ifndef xmlNanoHTTPAuthHeader +extern __typeof (xmlNanoHTTPAuthHeader) xmlNanoHTTPAuthHeader__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPAuthHeader xmlNanoHTTPAuthHeader__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPCleanup +extern __typeof (xmlNanoHTTPCleanup) xmlNanoHTTPCleanup __attribute((alias("xmlNanoHTTPCleanup__internal_alias"))); +#else +#ifndef xmlNanoHTTPCleanup +extern __typeof (xmlNanoHTTPCleanup) xmlNanoHTTPCleanup__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPCleanup xmlNanoHTTPCleanup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPClose +extern __typeof (xmlNanoHTTPClose) xmlNanoHTTPClose __attribute((alias("xmlNanoHTTPClose__internal_alias"))); +#else +#ifndef xmlNanoHTTPClose +extern __typeof (xmlNanoHTTPClose) xmlNanoHTTPClose__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPClose xmlNanoHTTPClose__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPContentLength +extern __typeof (xmlNanoHTTPContentLength) xmlNanoHTTPContentLength __attribute((alias("xmlNanoHTTPContentLength__internal_alias"))); +#else +#ifndef xmlNanoHTTPContentLength +extern __typeof (xmlNanoHTTPContentLength) xmlNanoHTTPContentLength__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPContentLength xmlNanoHTTPContentLength__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPEncoding +extern __typeof (xmlNanoHTTPEncoding) xmlNanoHTTPEncoding __attribute((alias("xmlNanoHTTPEncoding__internal_alias"))); +#else +#ifndef xmlNanoHTTPEncoding +extern __typeof (xmlNanoHTTPEncoding) xmlNanoHTTPEncoding__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPEncoding xmlNanoHTTPEncoding__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPFetch +extern __typeof (xmlNanoHTTPFetch) xmlNanoHTTPFetch __attribute((alias("xmlNanoHTTPFetch__internal_alias"))); +#else +#ifndef xmlNanoHTTPFetch +extern __typeof (xmlNanoHTTPFetch) xmlNanoHTTPFetch__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPFetch xmlNanoHTTPFetch__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPInit +extern __typeof (xmlNanoHTTPInit) xmlNanoHTTPInit __attribute((alias("xmlNanoHTTPInit__internal_alias"))); +#else +#ifndef xmlNanoHTTPInit +extern __typeof (xmlNanoHTTPInit) xmlNanoHTTPInit__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPInit xmlNanoHTTPInit__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPMethod +extern __typeof (xmlNanoHTTPMethod) xmlNanoHTTPMethod __attribute((alias("xmlNanoHTTPMethod__internal_alias"))); +#else +#ifndef xmlNanoHTTPMethod +extern __typeof (xmlNanoHTTPMethod) xmlNanoHTTPMethod__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPMethod xmlNanoHTTPMethod__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPMethodRedir +extern __typeof (xmlNanoHTTPMethodRedir) xmlNanoHTTPMethodRedir __attribute((alias("xmlNanoHTTPMethodRedir__internal_alias"))); +#else +#ifndef xmlNanoHTTPMethodRedir +extern __typeof (xmlNanoHTTPMethodRedir) xmlNanoHTTPMethodRedir__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPMethodRedir xmlNanoHTTPMethodRedir__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPMimeType +extern __typeof (xmlNanoHTTPMimeType) xmlNanoHTTPMimeType __attribute((alias("xmlNanoHTTPMimeType__internal_alias"))); +#else +#ifndef xmlNanoHTTPMimeType +extern __typeof (xmlNanoHTTPMimeType) xmlNanoHTTPMimeType__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPMimeType xmlNanoHTTPMimeType__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPOpen +extern __typeof (xmlNanoHTTPOpen) xmlNanoHTTPOpen __attribute((alias("xmlNanoHTTPOpen__internal_alias"))); +#else +#ifndef xmlNanoHTTPOpen +extern __typeof (xmlNanoHTTPOpen) xmlNanoHTTPOpen__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPOpen xmlNanoHTTPOpen__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPOpenRedir +extern __typeof (xmlNanoHTTPOpenRedir) xmlNanoHTTPOpenRedir __attribute((alias("xmlNanoHTTPOpenRedir__internal_alias"))); +#else +#ifndef xmlNanoHTTPOpenRedir +extern __typeof (xmlNanoHTTPOpenRedir) xmlNanoHTTPOpenRedir__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPOpenRedir xmlNanoHTTPOpenRedir__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPRead +extern __typeof (xmlNanoHTTPRead) xmlNanoHTTPRead __attribute((alias("xmlNanoHTTPRead__internal_alias"))); +#else +#ifndef xmlNanoHTTPRead +extern __typeof (xmlNanoHTTPRead) xmlNanoHTTPRead__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPRead xmlNanoHTTPRead__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPRedir +extern __typeof (xmlNanoHTTPRedir) xmlNanoHTTPRedir __attribute((alias("xmlNanoHTTPRedir__internal_alias"))); +#else +#ifndef xmlNanoHTTPRedir +extern __typeof (xmlNanoHTTPRedir) xmlNanoHTTPRedir__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPRedir xmlNanoHTTPRedir__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPReturnCode +extern __typeof (xmlNanoHTTPReturnCode) xmlNanoHTTPReturnCode __attribute((alias("xmlNanoHTTPReturnCode__internal_alias"))); +#else +#ifndef xmlNanoHTTPReturnCode +extern __typeof (xmlNanoHTTPReturnCode) xmlNanoHTTPReturnCode__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPReturnCode xmlNanoHTTPReturnCode__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPSave +extern __typeof (xmlNanoHTTPSave) xmlNanoHTTPSave __attribute((alias("xmlNanoHTTPSave__internal_alias"))); +#else +#ifndef xmlNanoHTTPSave +extern __typeof (xmlNanoHTTPSave) xmlNanoHTTPSave__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPSave xmlNanoHTTPSave__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_nanohttp +#undef xmlNanoHTTPScanProxy +extern __typeof (xmlNanoHTTPScanProxy) xmlNanoHTTPScanProxy __attribute((alias("xmlNanoHTTPScanProxy__internal_alias"))); +#else +#ifndef xmlNanoHTTPScanProxy +extern __typeof (xmlNanoHTTPScanProxy) xmlNanoHTTPScanProxy__internal_alias __attribute((visibility("hidden"))); +#define xmlNanoHTTPScanProxy xmlNanoHTTPScanProxy__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlNewAutomata +extern __typeof (xmlNewAutomata) xmlNewAutomata __attribute((alias("xmlNewAutomata__internal_alias"))); +#else +#ifndef xmlNewAutomata +extern __typeof (xmlNewAutomata) xmlNewAutomata__internal_alias __attribute((visibility("hidden"))); +#define xmlNewAutomata xmlNewAutomata__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewCDataBlock +extern __typeof (xmlNewCDataBlock) xmlNewCDataBlock __attribute((alias("xmlNewCDataBlock__internal_alias"))); +#else +#ifndef xmlNewCDataBlock +extern __typeof (xmlNewCDataBlock) xmlNewCDataBlock__internal_alias __attribute((visibility("hidden"))); +#define xmlNewCDataBlock xmlNewCDataBlock__internal_alias +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlNewCatalog +extern __typeof (xmlNewCatalog) xmlNewCatalog __attribute((alias("xmlNewCatalog__internal_alias"))); +#else +#ifndef xmlNewCatalog +extern __typeof (xmlNewCatalog) xmlNewCatalog__internal_alias __attribute((visibility("hidden"))); +#define xmlNewCatalog xmlNewCatalog__internal_alias +#endif +#endif +#endif + +#ifdef bottom_encoding +#undef xmlNewCharEncodingHandler +extern __typeof (xmlNewCharEncodingHandler) xmlNewCharEncodingHandler __attribute((alias("xmlNewCharEncodingHandler__internal_alias"))); +#else +#ifndef xmlNewCharEncodingHandler +extern __typeof (xmlNewCharEncodingHandler) xmlNewCharEncodingHandler__internal_alias __attribute((visibility("hidden"))); +#define xmlNewCharEncodingHandler xmlNewCharEncodingHandler__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewCharRef +extern __typeof (xmlNewCharRef) xmlNewCharRef __attribute((alias("xmlNewCharRef__internal_alias"))); +#else +#ifndef xmlNewCharRef +extern __typeof (xmlNewCharRef) xmlNewCharRef__internal_alias __attribute((visibility("hidden"))); +#define xmlNewCharRef xmlNewCharRef__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_tree +#undef xmlNewChild +extern __typeof (xmlNewChild) xmlNewChild __attribute((alias("xmlNewChild__internal_alias"))); +#else +#ifndef xmlNewChild +extern __typeof (xmlNewChild) xmlNewChild__internal_alias __attribute((visibility("hidden"))); +#define xmlNewChild xmlNewChild__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewComment +extern __typeof (xmlNewComment) xmlNewComment __attribute((alias("xmlNewComment__internal_alias"))); +#else +#ifndef xmlNewComment +extern __typeof (xmlNewComment) xmlNewComment__internal_alias __attribute((visibility("hidden"))); +#define xmlNewComment xmlNewComment__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewDoc +extern __typeof (xmlNewDoc) xmlNewDoc __attribute((alias("xmlNewDoc__internal_alias"))); +#else +#ifndef xmlNewDoc +extern __typeof (xmlNewDoc) xmlNewDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDoc xmlNewDoc__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewDocComment +extern __typeof (xmlNewDocComment) xmlNewDocComment __attribute((alias("xmlNewDocComment__internal_alias"))); +#else +#ifndef xmlNewDocComment +extern __typeof (xmlNewDocComment) xmlNewDocComment__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDocComment xmlNewDocComment__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlNewDocElementContent +extern __typeof (xmlNewDocElementContent) xmlNewDocElementContent __attribute((alias("xmlNewDocElementContent__internal_alias"))); +#else +#ifndef xmlNewDocElementContent +extern __typeof (xmlNewDocElementContent) xmlNewDocElementContent__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDocElementContent xmlNewDocElementContent__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlNewDocFragment +extern __typeof (xmlNewDocFragment) xmlNewDocFragment __attribute((alias("xmlNewDocFragment__internal_alias"))); +#else +#ifndef xmlNewDocFragment +extern __typeof (xmlNewDocFragment) xmlNewDocFragment__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDocFragment xmlNewDocFragment__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewDocNode +extern __typeof (xmlNewDocNode) xmlNewDocNode __attribute((alias("xmlNewDocNode__internal_alias"))); +#else +#ifndef xmlNewDocNode +extern __typeof (xmlNewDocNode) xmlNewDocNode__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDocNode xmlNewDocNode__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewDocNodeEatName +extern __typeof (xmlNewDocNodeEatName) xmlNewDocNodeEatName __attribute((alias("xmlNewDocNodeEatName__internal_alias"))); +#else +#ifndef xmlNewDocNodeEatName +extern __typeof (xmlNewDocNodeEatName) xmlNewDocNodeEatName__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDocNodeEatName xmlNewDocNodeEatName__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewDocPI +extern __typeof (xmlNewDocPI) xmlNewDocPI __attribute((alias("xmlNewDocPI__internal_alias"))); +#else +#ifndef xmlNewDocPI +extern __typeof (xmlNewDocPI) xmlNewDocPI__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDocPI xmlNewDocPI__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewDocProp +extern __typeof (xmlNewDocProp) xmlNewDocProp __attribute((alias("xmlNewDocProp__internal_alias"))); +#else +#ifndef xmlNewDocProp +extern __typeof (xmlNewDocProp) xmlNewDocProp__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDocProp xmlNewDocProp__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlNewDocRawNode +extern __typeof (xmlNewDocRawNode) xmlNewDocRawNode __attribute((alias("xmlNewDocRawNode__internal_alias"))); +#else +#ifndef xmlNewDocRawNode +extern __typeof (xmlNewDocRawNode) xmlNewDocRawNode__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDocRawNode xmlNewDocRawNode__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewDocText +extern __typeof (xmlNewDocText) xmlNewDocText __attribute((alias("xmlNewDocText__internal_alias"))); +#else +#ifndef xmlNewDocText +extern __typeof (xmlNewDocText) xmlNewDocText__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDocText xmlNewDocText__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewDocTextLen +extern __typeof (xmlNewDocTextLen) xmlNewDocTextLen __attribute((alias("xmlNewDocTextLen__internal_alias"))); +#else +#ifndef xmlNewDocTextLen +extern __typeof (xmlNewDocTextLen) xmlNewDocTextLen__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDocTextLen xmlNewDocTextLen__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewDtd +extern __typeof (xmlNewDtd) xmlNewDtd __attribute((alias("xmlNewDtd__internal_alias"))); +#else +#ifndef xmlNewDtd +extern __typeof (xmlNewDtd) xmlNewDtd__internal_alias __attribute((visibility("hidden"))); +#define xmlNewDtd xmlNewDtd__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlNewElementContent +extern __typeof (xmlNewElementContent) xmlNewElementContent __attribute((alias("xmlNewElementContent__internal_alias"))); +#else +#ifndef xmlNewElementContent +extern __typeof (xmlNewElementContent) xmlNewElementContent__internal_alias __attribute((visibility("hidden"))); +#define xmlNewElementContent xmlNewElementContent__internal_alias +#endif +#endif + +#ifdef bottom_entities +#undef xmlNewEntity +extern __typeof (xmlNewEntity) xmlNewEntity __attribute((alias("xmlNewEntity__internal_alias"))); +#else +#ifndef xmlNewEntity +extern __typeof (xmlNewEntity) xmlNewEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlNewEntity xmlNewEntity__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlNewEntityInputStream +extern __typeof (xmlNewEntityInputStream) xmlNewEntityInputStream __attribute((alias("xmlNewEntityInputStream__internal_alias"))); +#else +#ifndef xmlNewEntityInputStream +extern __typeof (xmlNewEntityInputStream) xmlNewEntityInputStream__internal_alias __attribute((visibility("hidden"))); +#define xmlNewEntityInputStream xmlNewEntityInputStream__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlNewGlobalNs +extern __typeof (xmlNewGlobalNs) xmlNewGlobalNs __attribute((alias("xmlNewGlobalNs__internal_alias"))); +#else +#ifndef xmlNewGlobalNs +extern __typeof (xmlNewGlobalNs) xmlNewGlobalNs__internal_alias __attribute((visibility("hidden"))); +#define xmlNewGlobalNs xmlNewGlobalNs__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlNewIOInputStream +extern __typeof (xmlNewIOInputStream) xmlNewIOInputStream __attribute((alias("xmlNewIOInputStream__internal_alias"))); +#else +#ifndef xmlNewIOInputStream +extern __typeof (xmlNewIOInputStream) xmlNewIOInputStream__internal_alias __attribute((visibility("hidden"))); +#define xmlNewIOInputStream xmlNewIOInputStream__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlNewInputFromFile +extern __typeof (xmlNewInputFromFile) xmlNewInputFromFile __attribute((alias("xmlNewInputFromFile__internal_alias"))); +#else +#ifndef xmlNewInputFromFile +extern __typeof (xmlNewInputFromFile) xmlNewInputFromFile__internal_alias __attribute((visibility("hidden"))); +#define xmlNewInputFromFile xmlNewInputFromFile__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlNewInputStream +extern __typeof (xmlNewInputStream) xmlNewInputStream __attribute((alias("xmlNewInputStream__internal_alias"))); +#else +#ifndef xmlNewInputStream +extern __typeof (xmlNewInputStream) xmlNewInputStream__internal_alias __attribute((visibility("hidden"))); +#define xmlNewInputStream xmlNewInputStream__internal_alias +#endif +#endif + +#ifdef bottom_threads +#undef xmlNewMutex +extern __typeof (xmlNewMutex) xmlNewMutex __attribute((alias("xmlNewMutex__internal_alias"))); +#else +#ifndef xmlNewMutex +extern __typeof (xmlNewMutex) xmlNewMutex__internal_alias __attribute((visibility("hidden"))); +#define xmlNewMutex xmlNewMutex__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewNode +extern __typeof (xmlNewNode) xmlNewNode __attribute((alias("xmlNewNode__internal_alias"))); +#else +#ifndef xmlNewNode +extern __typeof (xmlNewNode) xmlNewNode__internal_alias __attribute((visibility("hidden"))); +#define xmlNewNode xmlNewNode__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewNodeEatName +extern __typeof (xmlNewNodeEatName) xmlNewNodeEatName __attribute((alias("xmlNewNodeEatName__internal_alias"))); +#else +#ifndef xmlNewNodeEatName +extern __typeof (xmlNewNodeEatName) xmlNewNodeEatName__internal_alias __attribute((visibility("hidden"))); +#define xmlNewNodeEatName xmlNewNodeEatName__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewNs +extern __typeof (xmlNewNs) xmlNewNs __attribute((alias("xmlNewNs__internal_alias"))); +#else +#ifndef xmlNewNs +extern __typeof (xmlNewNs) xmlNewNs__internal_alias __attribute((visibility("hidden"))); +#define xmlNewNs xmlNewNs__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewNsProp +extern __typeof (xmlNewNsProp) xmlNewNsProp __attribute((alias("xmlNewNsProp__internal_alias"))); +#else +#ifndef xmlNewNsProp +extern __typeof (xmlNewNsProp) xmlNewNsProp__internal_alias __attribute((visibility("hidden"))); +#define xmlNewNsProp xmlNewNsProp__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewNsPropEatName +extern __typeof (xmlNewNsPropEatName) xmlNewNsPropEatName __attribute((alias("xmlNewNsPropEatName__internal_alias"))); +#else +#ifndef xmlNewNsPropEatName +extern __typeof (xmlNewNsPropEatName) xmlNewNsPropEatName__internal_alias __attribute((visibility("hidden"))); +#define xmlNewNsPropEatName xmlNewNsPropEatName__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewPI +extern __typeof (xmlNewPI) xmlNewPI __attribute((alias("xmlNewPI__internal_alias"))); +#else +#ifndef xmlNewPI +extern __typeof (xmlNewPI) xmlNewPI__internal_alias __attribute((visibility("hidden"))); +#define xmlNewPI xmlNewPI__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlNewParserCtxt +extern __typeof (xmlNewParserCtxt) xmlNewParserCtxt __attribute((alias("xmlNewParserCtxt__internal_alias"))); +#else +#ifndef xmlNewParserCtxt +extern __typeof (xmlNewParserCtxt) xmlNewParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlNewParserCtxt xmlNewParserCtxt__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_tree +#undef xmlNewProp +extern __typeof (xmlNewProp) xmlNewProp __attribute((alias("xmlNewProp__internal_alias"))); +#else +#ifndef xmlNewProp +extern __typeof (xmlNewProp) xmlNewProp__internal_alias __attribute((visibility("hidden"))); +#define xmlNewProp xmlNewProp__internal_alias +#endif +#endif +#endif + +#ifdef bottom_threads +#undef xmlNewRMutex +extern __typeof (xmlNewRMutex) xmlNewRMutex __attribute((alias("xmlNewRMutex__internal_alias"))); +#else +#ifndef xmlNewRMutex +extern __typeof (xmlNewRMutex) xmlNewRMutex__internal_alias __attribute((visibility("hidden"))); +#define xmlNewRMutex xmlNewRMutex__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewReference +extern __typeof (xmlNewReference) xmlNewReference __attribute((alias("xmlNewReference__internal_alias"))); +#else +#ifndef xmlNewReference +extern __typeof (xmlNewReference) xmlNewReference__internal_alias __attribute((visibility("hidden"))); +#define xmlNewReference xmlNewReference__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlNewStringInputStream +extern __typeof (xmlNewStringInputStream) xmlNewStringInputStream __attribute((alias("xmlNewStringInputStream__internal_alias"))); +#else +#ifndef xmlNewStringInputStream +extern __typeof (xmlNewStringInputStream) xmlNewStringInputStream__internal_alias __attribute((visibility("hidden"))); +#define xmlNewStringInputStream xmlNewStringInputStream__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewText +extern __typeof (xmlNewText) xmlNewText __attribute((alias("xmlNewText__internal_alias"))); +#else +#ifndef xmlNewText +extern __typeof (xmlNewText) xmlNewText__internal_alias __attribute((visibility("hidden"))); +#define xmlNewText xmlNewText__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlNewTextChild +extern __typeof (xmlNewTextChild) xmlNewTextChild __attribute((alias("xmlNewTextChild__internal_alias"))); +#else +#ifndef xmlNewTextChild +extern __typeof (xmlNewTextChild) xmlNewTextChild__internal_alias __attribute((visibility("hidden"))); +#define xmlNewTextChild xmlNewTextChild__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlNewTextLen +extern __typeof (xmlNewTextLen) xmlNewTextLen __attribute((alias("xmlNewTextLen__internal_alias"))); +#else +#ifndef xmlNewTextLen +extern __typeof (xmlNewTextLen) xmlNewTextLen__internal_alias __attribute((visibility("hidden"))); +#define xmlNewTextLen xmlNewTextLen__internal_alias +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlNewTextReader +extern __typeof (xmlNewTextReader) xmlNewTextReader __attribute((alias("xmlNewTextReader__internal_alias"))); +#else +#ifndef xmlNewTextReader +extern __typeof (xmlNewTextReader) xmlNewTextReader__internal_alias __attribute((visibility("hidden"))); +#define xmlNewTextReader xmlNewTextReader__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlNewTextReaderFilename +extern __typeof (xmlNewTextReaderFilename) xmlNewTextReaderFilename __attribute((alias("xmlNewTextReaderFilename__internal_alias"))); +#else +#ifndef xmlNewTextReaderFilename +extern __typeof (xmlNewTextReaderFilename) xmlNewTextReaderFilename__internal_alias __attribute((visibility("hidden"))); +#define xmlNewTextReaderFilename xmlNewTextReaderFilename__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlNewTextWriter +extern __typeof (xmlNewTextWriter) xmlNewTextWriter __attribute((alias("xmlNewTextWriter__internal_alias"))); +#else +#ifndef xmlNewTextWriter +extern __typeof (xmlNewTextWriter) xmlNewTextWriter__internal_alias __attribute((visibility("hidden"))); +#define xmlNewTextWriter xmlNewTextWriter__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlNewTextWriterDoc +extern __typeof (xmlNewTextWriterDoc) xmlNewTextWriterDoc __attribute((alias("xmlNewTextWriterDoc__internal_alias"))); +#else +#ifndef xmlNewTextWriterDoc +extern __typeof (xmlNewTextWriterDoc) xmlNewTextWriterDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlNewTextWriterDoc xmlNewTextWriterDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlNewTextWriterFilename +extern __typeof (xmlNewTextWriterFilename) xmlNewTextWriterFilename __attribute((alias("xmlNewTextWriterFilename__internal_alias"))); +#else +#ifndef xmlNewTextWriterFilename +extern __typeof (xmlNewTextWriterFilename) xmlNewTextWriterFilename__internal_alias __attribute((visibility("hidden"))); +#define xmlNewTextWriterFilename xmlNewTextWriterFilename__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlNewTextWriterMemory +extern __typeof (xmlNewTextWriterMemory) xmlNewTextWriterMemory __attribute((alias("xmlNewTextWriterMemory__internal_alias"))); +#else +#ifndef xmlNewTextWriterMemory +extern __typeof (xmlNewTextWriterMemory) xmlNewTextWriterMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlNewTextWriterMemory xmlNewTextWriterMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlNewTextWriterPushParser +extern __typeof (xmlNewTextWriterPushParser) xmlNewTextWriterPushParser __attribute((alias("xmlNewTextWriterPushParser__internal_alias"))); +#else +#ifndef xmlNewTextWriterPushParser +extern __typeof (xmlNewTextWriterPushParser) xmlNewTextWriterPushParser__internal_alias __attribute((visibility("hidden"))); +#define xmlNewTextWriterPushParser xmlNewTextWriterPushParser__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlNewTextWriterTree +extern __typeof (xmlNewTextWriterTree) xmlNewTextWriterTree __attribute((alias("xmlNewTextWriterTree__internal_alias"))); +#else +#ifndef xmlNewTextWriterTree +extern __typeof (xmlNewTextWriterTree) xmlNewTextWriterTree__internal_alias __attribute((visibility("hidden"))); +#define xmlNewTextWriterTree xmlNewTextWriterTree__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlNewValidCtxt +extern __typeof (xmlNewValidCtxt) xmlNewValidCtxt __attribute((alias("xmlNewValidCtxt__internal_alias"))); +#else +#ifndef xmlNewValidCtxt +extern __typeof (xmlNewValidCtxt) xmlNewValidCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlNewValidCtxt xmlNewValidCtxt__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlNextChar +extern __typeof (xmlNextChar) xmlNextChar __attribute((alias("xmlNextChar__internal_alias"))); +#else +#ifndef xmlNextChar +extern __typeof (xmlNextChar) xmlNextChar__internal_alias __attribute((visibility("hidden"))); +#define xmlNextChar xmlNextChar__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlNextElementSibling +extern __typeof (xmlNextElementSibling) xmlNextElementSibling __attribute((alias("xmlNextElementSibling__internal_alias"))); +#else +#ifndef xmlNextElementSibling +extern __typeof (xmlNextElementSibling) xmlNextElementSibling__internal_alias __attribute((visibility("hidden"))); +#define xmlNextElementSibling xmlNextElementSibling__internal_alias +#endif +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlNoNetExternalEntityLoader +extern __typeof (xmlNoNetExternalEntityLoader) xmlNoNetExternalEntityLoader __attribute((alias("xmlNoNetExternalEntityLoader__internal_alias"))); +#else +#ifndef xmlNoNetExternalEntityLoader +extern __typeof (xmlNoNetExternalEntityLoader) xmlNoNetExternalEntityLoader__internal_alias __attribute((visibility("hidden"))); +#define xmlNoNetExternalEntityLoader xmlNoNetExternalEntityLoader__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNodeAddContent +extern __typeof (xmlNodeAddContent) xmlNodeAddContent __attribute((alias("xmlNodeAddContent__internal_alias"))); +#else +#ifndef xmlNodeAddContent +extern __typeof (xmlNodeAddContent) xmlNodeAddContent__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeAddContent xmlNodeAddContent__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNodeAddContentLen +extern __typeof (xmlNodeAddContentLen) xmlNodeAddContentLen __attribute((alias("xmlNodeAddContentLen__internal_alias"))); +#else +#ifndef xmlNodeAddContentLen +extern __typeof (xmlNodeAddContentLen) xmlNodeAddContentLen__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeAddContentLen xmlNodeAddContentLen__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNodeBufGetContent +extern __typeof (xmlNodeBufGetContent) xmlNodeBufGetContent __attribute((alias("xmlNodeBufGetContent__internal_alias"))); +#else +#ifndef xmlNodeBufGetContent +extern __typeof (xmlNodeBufGetContent) xmlNodeBufGetContent__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeBufGetContent xmlNodeBufGetContent__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlNodeDump +extern __typeof (xmlNodeDump) xmlNodeDump __attribute((alias("xmlNodeDump__internal_alias"))); +#else +#ifndef xmlNodeDump +extern __typeof (xmlNodeDump) xmlNodeDump__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeDump xmlNodeDump__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlNodeDumpOutput +extern __typeof (xmlNodeDumpOutput) xmlNodeDumpOutput __attribute((alias("xmlNodeDumpOutput__internal_alias"))); +#else +#ifndef xmlNodeDumpOutput +extern __typeof (xmlNodeDumpOutput) xmlNodeDumpOutput__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeDumpOutput xmlNodeDumpOutput__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlNodeGetBase +extern __typeof (xmlNodeGetBase) xmlNodeGetBase __attribute((alias("xmlNodeGetBase__internal_alias"))); +#else +#ifndef xmlNodeGetBase +extern __typeof (xmlNodeGetBase) xmlNodeGetBase__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeGetBase xmlNodeGetBase__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNodeGetContent +extern __typeof (xmlNodeGetContent) xmlNodeGetContent __attribute((alias("xmlNodeGetContent__internal_alias"))); +#else +#ifndef xmlNodeGetContent +extern __typeof (xmlNodeGetContent) xmlNodeGetContent__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeGetContent xmlNodeGetContent__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNodeGetLang +extern __typeof (xmlNodeGetLang) xmlNodeGetLang __attribute((alias("xmlNodeGetLang__internal_alias"))); +#else +#ifndef xmlNodeGetLang +extern __typeof (xmlNodeGetLang) xmlNodeGetLang__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeGetLang xmlNodeGetLang__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNodeGetSpacePreserve +extern __typeof (xmlNodeGetSpacePreserve) xmlNodeGetSpacePreserve __attribute((alias("xmlNodeGetSpacePreserve__internal_alias"))); +#else +#ifndef xmlNodeGetSpacePreserve +extern __typeof (xmlNodeGetSpacePreserve) xmlNodeGetSpacePreserve__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeGetSpacePreserve xmlNodeGetSpacePreserve__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlNodeIsText +extern __typeof (xmlNodeIsText) xmlNodeIsText __attribute((alias("xmlNodeIsText__internal_alias"))); +#else +#ifndef xmlNodeIsText +extern __typeof (xmlNodeIsText) xmlNodeIsText__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeIsText xmlNodeIsText__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlNodeListGetRawString +extern __typeof (xmlNodeListGetRawString) xmlNodeListGetRawString __attribute((alias("xmlNodeListGetRawString__internal_alias"))); +#else +#ifndef xmlNodeListGetRawString +extern __typeof (xmlNodeListGetRawString) xmlNodeListGetRawString__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeListGetRawString xmlNodeListGetRawString__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlNodeListGetString +extern __typeof (xmlNodeListGetString) xmlNodeListGetString __attribute((alias("xmlNodeListGetString__internal_alias"))); +#else +#ifndef xmlNodeListGetString +extern __typeof (xmlNodeListGetString) xmlNodeListGetString__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeListGetString xmlNodeListGetString__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_tree +#undef xmlNodeSetBase +extern __typeof (xmlNodeSetBase) xmlNodeSetBase __attribute((alias("xmlNodeSetBase__internal_alias"))); +#else +#ifndef xmlNodeSetBase +extern __typeof (xmlNodeSetBase) xmlNodeSetBase__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeSetBase xmlNodeSetBase__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlNodeSetContent +extern __typeof (xmlNodeSetContent) xmlNodeSetContent __attribute((alias("xmlNodeSetContent__internal_alias"))); +#else +#ifndef xmlNodeSetContent +extern __typeof (xmlNodeSetContent) xmlNodeSetContent__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeSetContent xmlNodeSetContent__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlNodeSetContentLen +extern __typeof (xmlNodeSetContentLen) xmlNodeSetContentLen __attribute((alias("xmlNodeSetContentLen__internal_alias"))); +#else +#ifndef xmlNodeSetContentLen +extern __typeof (xmlNodeSetContentLen) xmlNodeSetContentLen__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeSetContentLen xmlNodeSetContentLen__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlNodeSetLang +extern __typeof (xmlNodeSetLang) xmlNodeSetLang __attribute((alias("xmlNodeSetLang__internal_alias"))); +#else +#ifndef xmlNodeSetLang +extern __typeof (xmlNodeSetLang) xmlNodeSetLang__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeSetLang xmlNodeSetLang__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlNodeSetName +extern __typeof (xmlNodeSetName) xmlNodeSetName __attribute((alias("xmlNodeSetName__internal_alias"))); +#else +#ifndef xmlNodeSetName +extern __typeof (xmlNodeSetName) xmlNodeSetName__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeSetName xmlNodeSetName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlNodeSetSpacePreserve +extern __typeof (xmlNodeSetSpacePreserve) xmlNodeSetSpacePreserve __attribute((alias("xmlNodeSetSpacePreserve__internal_alias"))); +#else +#ifndef xmlNodeSetSpacePreserve +extern __typeof (xmlNodeSetSpacePreserve) xmlNodeSetSpacePreserve__internal_alias __attribute((visibility("hidden"))); +#define xmlNodeSetSpacePreserve xmlNodeSetSpacePreserve__internal_alias +#endif +#endif +#endif + +#ifdef bottom_uri +#undef xmlNormalizeURIPath +extern __typeof (xmlNormalizeURIPath) xmlNormalizeURIPath __attribute((alias("xmlNormalizeURIPath__internal_alias"))); +#else +#ifndef xmlNormalizeURIPath +extern __typeof (xmlNormalizeURIPath) xmlNormalizeURIPath__internal_alias __attribute((visibility("hidden"))); +#define xmlNormalizeURIPath xmlNormalizeURIPath__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlNormalizeWindowsPath +extern __typeof (xmlNormalizeWindowsPath) xmlNormalizeWindowsPath __attribute((alias("xmlNormalizeWindowsPath__internal_alias"))); +#else +#ifndef xmlNormalizeWindowsPath +extern __typeof (xmlNormalizeWindowsPath) xmlNormalizeWindowsPath__internal_alias __attribute((visibility("hidden"))); +#define xmlNormalizeWindowsPath xmlNormalizeWindowsPath__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferClose +extern __typeof (xmlOutputBufferClose) xmlOutputBufferClose __attribute((alias("xmlOutputBufferClose__internal_alias"))); +#else +#ifndef xmlOutputBufferClose +extern __typeof (xmlOutputBufferClose) xmlOutputBufferClose__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferClose xmlOutputBufferClose__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferCreateBuffer +extern __typeof (xmlOutputBufferCreateBuffer) xmlOutputBufferCreateBuffer __attribute((alias("xmlOutputBufferCreateBuffer__internal_alias"))); +#else +#ifndef xmlOutputBufferCreateBuffer +extern __typeof (xmlOutputBufferCreateBuffer) xmlOutputBufferCreateBuffer__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferCreateBuffer xmlOutputBufferCreateBuffer__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferCreateFd +extern __typeof (xmlOutputBufferCreateFd) xmlOutputBufferCreateFd __attribute((alias("xmlOutputBufferCreateFd__internal_alias"))); +#else +#ifndef xmlOutputBufferCreateFd +extern __typeof (xmlOutputBufferCreateFd) xmlOutputBufferCreateFd__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferCreateFd xmlOutputBufferCreateFd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferCreateFile +extern __typeof (xmlOutputBufferCreateFile) xmlOutputBufferCreateFile __attribute((alias("xmlOutputBufferCreateFile__internal_alias"))); +#else +#ifndef xmlOutputBufferCreateFile +extern __typeof (xmlOutputBufferCreateFile) xmlOutputBufferCreateFile__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferCreateFile xmlOutputBufferCreateFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferCreateFilename +extern __typeof (xmlOutputBufferCreateFilename) xmlOutputBufferCreateFilename __attribute((alias("xmlOutputBufferCreateFilename__internal_alias"))); +#else +#ifndef xmlOutputBufferCreateFilename +extern __typeof (xmlOutputBufferCreateFilename) xmlOutputBufferCreateFilename__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferCreateFilename xmlOutputBufferCreateFilename__internal_alias +#endif +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlOutputBufferCreateFilenameDefault +extern __typeof (xmlOutputBufferCreateFilenameDefault) xmlOutputBufferCreateFilenameDefault __attribute((alias("xmlOutputBufferCreateFilenameDefault__internal_alias"))); +#else +#ifndef xmlOutputBufferCreateFilenameDefault +extern __typeof (xmlOutputBufferCreateFilenameDefault) xmlOutputBufferCreateFilenameDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferCreateFilenameDefault xmlOutputBufferCreateFilenameDefault__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferCreateIO +extern __typeof (xmlOutputBufferCreateIO) xmlOutputBufferCreateIO __attribute((alias("xmlOutputBufferCreateIO__internal_alias"))); +#else +#ifndef xmlOutputBufferCreateIO +extern __typeof (xmlOutputBufferCreateIO) xmlOutputBufferCreateIO__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferCreateIO xmlOutputBufferCreateIO__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferFlush +extern __typeof (xmlOutputBufferFlush) xmlOutputBufferFlush __attribute((alias("xmlOutputBufferFlush__internal_alias"))); +#else +#ifndef xmlOutputBufferFlush +extern __typeof (xmlOutputBufferFlush) xmlOutputBufferFlush__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferFlush xmlOutputBufferFlush__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferGetContent +extern __typeof (xmlOutputBufferGetContent) xmlOutputBufferGetContent __attribute((alias("xmlOutputBufferGetContent__internal_alias"))); +#else +#ifndef xmlOutputBufferGetContent +extern __typeof (xmlOutputBufferGetContent) xmlOutputBufferGetContent__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferGetContent xmlOutputBufferGetContent__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferGetSize +extern __typeof (xmlOutputBufferGetSize) xmlOutputBufferGetSize __attribute((alias("xmlOutputBufferGetSize__internal_alias"))); +#else +#ifndef xmlOutputBufferGetSize +extern __typeof (xmlOutputBufferGetSize) xmlOutputBufferGetSize__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferGetSize xmlOutputBufferGetSize__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferWrite +extern __typeof (xmlOutputBufferWrite) xmlOutputBufferWrite __attribute((alias("xmlOutputBufferWrite__internal_alias"))); +#else +#ifndef xmlOutputBufferWrite +extern __typeof (xmlOutputBufferWrite) xmlOutputBufferWrite__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferWrite xmlOutputBufferWrite__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferWriteEscape +extern __typeof (xmlOutputBufferWriteEscape) xmlOutputBufferWriteEscape __attribute((alias("xmlOutputBufferWriteEscape__internal_alias"))); +#else +#ifndef xmlOutputBufferWriteEscape +extern __typeof (xmlOutputBufferWriteEscape) xmlOutputBufferWriteEscape__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferWriteEscape xmlOutputBufferWriteEscape__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlOutputBufferWriteString +extern __typeof (xmlOutputBufferWriteString) xmlOutputBufferWriteString __attribute((alias("xmlOutputBufferWriteString__internal_alias"))); +#else +#ifndef xmlOutputBufferWriteString +extern __typeof (xmlOutputBufferWriteString) xmlOutputBufferWriteString__internal_alias __attribute((visibility("hidden"))); +#define xmlOutputBufferWriteString xmlOutputBufferWriteString__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseAttValue +extern __typeof (xmlParseAttValue) xmlParseAttValue __attribute((alias("xmlParseAttValue__internal_alias"))); +#else +#ifndef xmlParseAttValue +extern __typeof (xmlParseAttValue) xmlParseAttValue__internal_alias __attribute((visibility("hidden"))); +#define xmlParseAttValue xmlParseAttValue__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlParseAttribute +extern __typeof (xmlParseAttribute) xmlParseAttribute __attribute((alias("xmlParseAttribute__internal_alias"))); +#else +#ifndef xmlParseAttribute +extern __typeof (xmlParseAttribute) xmlParseAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlParseAttribute xmlParseAttribute__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseAttributeListDecl +extern __typeof (xmlParseAttributeListDecl) xmlParseAttributeListDecl __attribute((alias("xmlParseAttributeListDecl__internal_alias"))); +#else +#ifndef xmlParseAttributeListDecl +extern __typeof (xmlParseAttributeListDecl) xmlParseAttributeListDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseAttributeListDecl xmlParseAttributeListDecl__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseAttributeType +extern __typeof (xmlParseAttributeType) xmlParseAttributeType __attribute((alias("xmlParseAttributeType__internal_alias"))); +#else +#ifndef xmlParseAttributeType +extern __typeof (xmlParseAttributeType) xmlParseAttributeType__internal_alias __attribute((visibility("hidden"))); +#define xmlParseAttributeType xmlParseAttributeType__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlParseBalancedChunkMemory +extern __typeof (xmlParseBalancedChunkMemory) xmlParseBalancedChunkMemory __attribute((alias("xmlParseBalancedChunkMemory__internal_alias"))); +#else +#ifndef xmlParseBalancedChunkMemory +extern __typeof (xmlParseBalancedChunkMemory) xmlParseBalancedChunkMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlParseBalancedChunkMemory xmlParseBalancedChunkMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlParseBalancedChunkMemoryRecover +extern __typeof (xmlParseBalancedChunkMemoryRecover) xmlParseBalancedChunkMemoryRecover __attribute((alias("xmlParseBalancedChunkMemoryRecover__internal_alias"))); +#else +#ifndef xmlParseBalancedChunkMemoryRecover +extern __typeof (xmlParseBalancedChunkMemoryRecover) xmlParseBalancedChunkMemoryRecover__internal_alias __attribute((visibility("hidden"))); +#define xmlParseBalancedChunkMemoryRecover xmlParseBalancedChunkMemoryRecover__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseCDSect +extern __typeof (xmlParseCDSect) xmlParseCDSect __attribute((alias("xmlParseCDSect__internal_alias"))); +#else +#ifndef xmlParseCDSect +extern __typeof (xmlParseCDSect) xmlParseCDSect__internal_alias __attribute((visibility("hidden"))); +#define xmlParseCDSect xmlParseCDSect__internal_alias +#endif +#endif + +#if defined(LIBXML_CATALOG_ENABLED) +#ifdef bottom_catalog +#undef xmlParseCatalogFile +extern __typeof (xmlParseCatalogFile) xmlParseCatalogFile __attribute((alias("xmlParseCatalogFile__internal_alias"))); +#else +#ifndef xmlParseCatalogFile +extern __typeof (xmlParseCatalogFile) xmlParseCatalogFile__internal_alias __attribute((visibility("hidden"))); +#define xmlParseCatalogFile xmlParseCatalogFile__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseCharData +extern __typeof (xmlParseCharData) xmlParseCharData __attribute((alias("xmlParseCharData__internal_alias"))); +#else +#ifndef xmlParseCharData +extern __typeof (xmlParseCharData) xmlParseCharData__internal_alias __attribute((visibility("hidden"))); +#define xmlParseCharData xmlParseCharData__internal_alias +#endif +#endif + +#ifdef bottom_encoding +#undef xmlParseCharEncoding +extern __typeof (xmlParseCharEncoding) xmlParseCharEncoding __attribute((alias("xmlParseCharEncoding__internal_alias"))); +#else +#ifndef xmlParseCharEncoding +extern __typeof (xmlParseCharEncoding) xmlParseCharEncoding__internal_alias __attribute((visibility("hidden"))); +#define xmlParseCharEncoding xmlParseCharEncoding__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseCharRef +extern __typeof (xmlParseCharRef) xmlParseCharRef __attribute((alias("xmlParseCharRef__internal_alias"))); +#else +#ifndef xmlParseCharRef +extern __typeof (xmlParseCharRef) xmlParseCharRef__internal_alias __attribute((visibility("hidden"))); +#define xmlParseCharRef xmlParseCharRef__internal_alias +#endif +#endif + +#if defined(LIBXML_PUSH_ENABLED) +#ifdef bottom_parser +#undef xmlParseChunk +extern __typeof (xmlParseChunk) xmlParseChunk __attribute((alias("xmlParseChunk__internal_alias"))); +#else +#ifndef xmlParseChunk +extern __typeof (xmlParseChunk) xmlParseChunk__internal_alias __attribute((visibility("hidden"))); +#define xmlParseChunk xmlParseChunk__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseComment +extern __typeof (xmlParseComment) xmlParseComment __attribute((alias("xmlParseComment__internal_alias"))); +#else +#ifndef xmlParseComment +extern __typeof (xmlParseComment) xmlParseComment__internal_alias __attribute((visibility("hidden"))); +#define xmlParseComment xmlParseComment__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseContent +extern __typeof (xmlParseContent) xmlParseContent __attribute((alias("xmlParseContent__internal_alias"))); +#else +#ifndef xmlParseContent +extern __typeof (xmlParseContent) xmlParseContent__internal_alias __attribute((visibility("hidden"))); +#define xmlParseContent xmlParseContent__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseCtxtExternalEntity +extern __typeof (xmlParseCtxtExternalEntity) xmlParseCtxtExternalEntity __attribute((alias("xmlParseCtxtExternalEntity__internal_alias"))); +#else +#ifndef xmlParseCtxtExternalEntity +extern __typeof (xmlParseCtxtExternalEntity) xmlParseCtxtExternalEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlParseCtxtExternalEntity xmlParseCtxtExternalEntity__internal_alias +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_parser +#undef xmlParseDTD +extern __typeof (xmlParseDTD) xmlParseDTD __attribute((alias("xmlParseDTD__internal_alias"))); +#else +#ifndef xmlParseDTD +extern __typeof (xmlParseDTD) xmlParseDTD__internal_alias __attribute((visibility("hidden"))); +#define xmlParseDTD xmlParseDTD__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseDefaultDecl +extern __typeof (xmlParseDefaultDecl) xmlParseDefaultDecl __attribute((alias("xmlParseDefaultDecl__internal_alias"))); +#else +#ifndef xmlParseDefaultDecl +extern __typeof (xmlParseDefaultDecl) xmlParseDefaultDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseDefaultDecl xmlParseDefaultDecl__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlParseDoc +extern __typeof (xmlParseDoc) xmlParseDoc __attribute((alias("xmlParseDoc__internal_alias"))); +#else +#ifndef xmlParseDoc +extern __typeof (xmlParseDoc) xmlParseDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlParseDoc xmlParseDoc__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseDocTypeDecl +extern __typeof (xmlParseDocTypeDecl) xmlParseDocTypeDecl __attribute((alias("xmlParseDocTypeDecl__internal_alias"))); +#else +#ifndef xmlParseDocTypeDecl +extern __typeof (xmlParseDocTypeDecl) xmlParseDocTypeDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseDocTypeDecl xmlParseDocTypeDecl__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseDocument +extern __typeof (xmlParseDocument) xmlParseDocument __attribute((alias("xmlParseDocument__internal_alias"))); +#else +#ifndef xmlParseDocument +extern __typeof (xmlParseDocument) xmlParseDocument__internal_alias __attribute((visibility("hidden"))); +#define xmlParseDocument xmlParseDocument__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseElement +extern __typeof (xmlParseElement) xmlParseElement __attribute((alias("xmlParseElement__internal_alias"))); +#else +#ifndef xmlParseElement +extern __typeof (xmlParseElement) xmlParseElement__internal_alias __attribute((visibility("hidden"))); +#define xmlParseElement xmlParseElement__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseElementChildrenContentDecl +extern __typeof (xmlParseElementChildrenContentDecl) xmlParseElementChildrenContentDecl __attribute((alias("xmlParseElementChildrenContentDecl__internal_alias"))); +#else +#ifndef xmlParseElementChildrenContentDecl +extern __typeof (xmlParseElementChildrenContentDecl) xmlParseElementChildrenContentDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseElementChildrenContentDecl xmlParseElementChildrenContentDecl__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseElementContentDecl +extern __typeof (xmlParseElementContentDecl) xmlParseElementContentDecl __attribute((alias("xmlParseElementContentDecl__internal_alias"))); +#else +#ifndef xmlParseElementContentDecl +extern __typeof (xmlParseElementContentDecl) xmlParseElementContentDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseElementContentDecl xmlParseElementContentDecl__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseElementDecl +extern __typeof (xmlParseElementDecl) xmlParseElementDecl __attribute((alias("xmlParseElementDecl__internal_alias"))); +#else +#ifndef xmlParseElementDecl +extern __typeof (xmlParseElementDecl) xmlParseElementDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseElementDecl xmlParseElementDecl__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseElementMixedContentDecl +extern __typeof (xmlParseElementMixedContentDecl) xmlParseElementMixedContentDecl __attribute((alias("xmlParseElementMixedContentDecl__internal_alias"))); +#else +#ifndef xmlParseElementMixedContentDecl +extern __typeof (xmlParseElementMixedContentDecl) xmlParseElementMixedContentDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseElementMixedContentDecl xmlParseElementMixedContentDecl__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseEncName +extern __typeof (xmlParseEncName) xmlParseEncName __attribute((alias("xmlParseEncName__internal_alias"))); +#else +#ifndef xmlParseEncName +extern __typeof (xmlParseEncName) xmlParseEncName__internal_alias __attribute((visibility("hidden"))); +#define xmlParseEncName xmlParseEncName__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseEncodingDecl +extern __typeof (xmlParseEncodingDecl) xmlParseEncodingDecl __attribute((alias("xmlParseEncodingDecl__internal_alias"))); +#else +#ifndef xmlParseEncodingDecl +extern __typeof (xmlParseEncodingDecl) xmlParseEncodingDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseEncodingDecl xmlParseEncodingDecl__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlParseEndTag +extern __typeof (xmlParseEndTag) xmlParseEndTag __attribute((alias("xmlParseEndTag__internal_alias"))); +#else +#ifndef xmlParseEndTag +extern __typeof (xmlParseEndTag) xmlParseEndTag__internal_alias __attribute((visibility("hidden"))); +#define xmlParseEndTag xmlParseEndTag__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlParseEntity +extern __typeof (xmlParseEntity) xmlParseEntity __attribute((alias("xmlParseEntity__internal_alias"))); +#else +#ifndef xmlParseEntity +extern __typeof (xmlParseEntity) xmlParseEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlParseEntity xmlParseEntity__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseEntityDecl +extern __typeof (xmlParseEntityDecl) xmlParseEntityDecl __attribute((alias("xmlParseEntityDecl__internal_alias"))); +#else +#ifndef xmlParseEntityDecl +extern __typeof (xmlParseEntityDecl) xmlParseEntityDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseEntityDecl xmlParseEntityDecl__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseEntityRef +extern __typeof (xmlParseEntityRef) xmlParseEntityRef __attribute((alias("xmlParseEntityRef__internal_alias"))); +#else +#ifndef xmlParseEntityRef +extern __typeof (xmlParseEntityRef) xmlParseEntityRef__internal_alias __attribute((visibility("hidden"))); +#define xmlParseEntityRef xmlParseEntityRef__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseEntityValue +extern __typeof (xmlParseEntityValue) xmlParseEntityValue __attribute((alias("xmlParseEntityValue__internal_alias"))); +#else +#ifndef xmlParseEntityValue +extern __typeof (xmlParseEntityValue) xmlParseEntityValue__internal_alias __attribute((visibility("hidden"))); +#define xmlParseEntityValue xmlParseEntityValue__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseEnumeratedType +extern __typeof (xmlParseEnumeratedType) xmlParseEnumeratedType __attribute((alias("xmlParseEnumeratedType__internal_alias"))); +#else +#ifndef xmlParseEnumeratedType +extern __typeof (xmlParseEnumeratedType) xmlParseEnumeratedType__internal_alias __attribute((visibility("hidden"))); +#define xmlParseEnumeratedType xmlParseEnumeratedType__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseEnumerationType +extern __typeof (xmlParseEnumerationType) xmlParseEnumerationType __attribute((alias("xmlParseEnumerationType__internal_alias"))); +#else +#ifndef xmlParseEnumerationType +extern __typeof (xmlParseEnumerationType) xmlParseEnumerationType__internal_alias __attribute((visibility("hidden"))); +#define xmlParseEnumerationType xmlParseEnumerationType__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseExtParsedEnt +extern __typeof (xmlParseExtParsedEnt) xmlParseExtParsedEnt __attribute((alias("xmlParseExtParsedEnt__internal_alias"))); +#else +#ifndef xmlParseExtParsedEnt +extern __typeof (xmlParseExtParsedEnt) xmlParseExtParsedEnt__internal_alias __attribute((visibility("hidden"))); +#define xmlParseExtParsedEnt xmlParseExtParsedEnt__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlParseExternalEntity +extern __typeof (xmlParseExternalEntity) xmlParseExternalEntity __attribute((alias("xmlParseExternalEntity__internal_alias"))); +#else +#ifndef xmlParseExternalEntity +extern __typeof (xmlParseExternalEntity) xmlParseExternalEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlParseExternalEntity xmlParseExternalEntity__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseExternalID +extern __typeof (xmlParseExternalID) xmlParseExternalID __attribute((alias("xmlParseExternalID__internal_alias"))); +#else +#ifndef xmlParseExternalID +extern __typeof (xmlParseExternalID) xmlParseExternalID__internal_alias __attribute((visibility("hidden"))); +#define xmlParseExternalID xmlParseExternalID__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseExternalSubset +extern __typeof (xmlParseExternalSubset) xmlParseExternalSubset __attribute((alias("xmlParseExternalSubset__internal_alias"))); +#else +#ifndef xmlParseExternalSubset +extern __typeof (xmlParseExternalSubset) xmlParseExternalSubset__internal_alias __attribute((visibility("hidden"))); +#define xmlParseExternalSubset xmlParseExternalSubset__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlParseFile +extern __typeof (xmlParseFile) xmlParseFile __attribute((alias("xmlParseFile__internal_alias"))); +#else +#ifndef xmlParseFile +extern __typeof (xmlParseFile) xmlParseFile__internal_alias __attribute((visibility("hidden"))); +#define xmlParseFile xmlParseFile__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseInNodeContext +extern __typeof (xmlParseInNodeContext) xmlParseInNodeContext __attribute((alias("xmlParseInNodeContext__internal_alias"))); +#else +#ifndef xmlParseInNodeContext +extern __typeof (xmlParseInNodeContext) xmlParseInNodeContext__internal_alias __attribute((visibility("hidden"))); +#define xmlParseInNodeContext xmlParseInNodeContext__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseMarkupDecl +extern __typeof (xmlParseMarkupDecl) xmlParseMarkupDecl __attribute((alias("xmlParseMarkupDecl__internal_alias"))); +#else +#ifndef xmlParseMarkupDecl +extern __typeof (xmlParseMarkupDecl) xmlParseMarkupDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseMarkupDecl xmlParseMarkupDecl__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlParseMemory +extern __typeof (xmlParseMemory) xmlParseMemory __attribute((alias("xmlParseMemory__internal_alias"))); +#else +#ifndef xmlParseMemory +extern __typeof (xmlParseMemory) xmlParseMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlParseMemory xmlParseMemory__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseMisc +extern __typeof (xmlParseMisc) xmlParseMisc __attribute((alias("xmlParseMisc__internal_alias"))); +#else +#ifndef xmlParseMisc +extern __typeof (xmlParseMisc) xmlParseMisc__internal_alias __attribute((visibility("hidden"))); +#define xmlParseMisc xmlParseMisc__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseName +extern __typeof (xmlParseName) xmlParseName __attribute((alias("xmlParseName__internal_alias"))); +#else +#ifndef xmlParseName +extern __typeof (xmlParseName) xmlParseName__internal_alias __attribute((visibility("hidden"))); +#define xmlParseName xmlParseName__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlParseNamespace +extern __typeof (xmlParseNamespace) xmlParseNamespace __attribute((alias("xmlParseNamespace__internal_alias"))); +#else +#ifndef xmlParseNamespace +extern __typeof (xmlParseNamespace) xmlParseNamespace__internal_alias __attribute((visibility("hidden"))); +#define xmlParseNamespace xmlParseNamespace__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseNmtoken +extern __typeof (xmlParseNmtoken) xmlParseNmtoken __attribute((alias("xmlParseNmtoken__internal_alias"))); +#else +#ifndef xmlParseNmtoken +extern __typeof (xmlParseNmtoken) xmlParseNmtoken__internal_alias __attribute((visibility("hidden"))); +#define xmlParseNmtoken xmlParseNmtoken__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseNotationDecl +extern __typeof (xmlParseNotationDecl) xmlParseNotationDecl __attribute((alias("xmlParseNotationDecl__internal_alias"))); +#else +#ifndef xmlParseNotationDecl +extern __typeof (xmlParseNotationDecl) xmlParseNotationDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseNotationDecl xmlParseNotationDecl__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseNotationType +extern __typeof (xmlParseNotationType) xmlParseNotationType __attribute((alias("xmlParseNotationType__internal_alias"))); +#else +#ifndef xmlParseNotationType +extern __typeof (xmlParseNotationType) xmlParseNotationType__internal_alias __attribute((visibility("hidden"))); +#define xmlParseNotationType xmlParseNotationType__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParsePEReference +extern __typeof (xmlParsePEReference) xmlParsePEReference __attribute((alias("xmlParsePEReference__internal_alias"))); +#else +#ifndef xmlParsePEReference +extern __typeof (xmlParsePEReference) xmlParsePEReference__internal_alias __attribute((visibility("hidden"))); +#define xmlParsePEReference xmlParsePEReference__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParsePI +extern __typeof (xmlParsePI) xmlParsePI __attribute((alias("xmlParsePI__internal_alias"))); +#else +#ifndef xmlParsePI +extern __typeof (xmlParsePI) xmlParsePI__internal_alias __attribute((visibility("hidden"))); +#define xmlParsePI xmlParsePI__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParsePITarget +extern __typeof (xmlParsePITarget) xmlParsePITarget __attribute((alias("xmlParsePITarget__internal_alias"))); +#else +#ifndef xmlParsePITarget +extern __typeof (xmlParsePITarget) xmlParsePITarget__internal_alias __attribute((visibility("hidden"))); +#define xmlParsePITarget xmlParsePITarget__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParsePubidLiteral +extern __typeof (xmlParsePubidLiteral) xmlParsePubidLiteral __attribute((alias("xmlParsePubidLiteral__internal_alias"))); +#else +#ifndef xmlParsePubidLiteral +extern __typeof (xmlParsePubidLiteral) xmlParsePubidLiteral__internal_alias __attribute((visibility("hidden"))); +#define xmlParsePubidLiteral xmlParsePubidLiteral__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlParseQuotedString +extern __typeof (xmlParseQuotedString) xmlParseQuotedString __attribute((alias("xmlParseQuotedString__internal_alias"))); +#else +#ifndef xmlParseQuotedString +extern __typeof (xmlParseQuotedString) xmlParseQuotedString__internal_alias __attribute((visibility("hidden"))); +#define xmlParseQuotedString xmlParseQuotedString__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseReference +extern __typeof (xmlParseReference) xmlParseReference __attribute((alias("xmlParseReference__internal_alias"))); +#else +#ifndef xmlParseReference +extern __typeof (xmlParseReference) xmlParseReference__internal_alias __attribute((visibility("hidden"))); +#define xmlParseReference xmlParseReference__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseSDDecl +extern __typeof (xmlParseSDDecl) xmlParseSDDecl __attribute((alias("xmlParseSDDecl__internal_alias"))); +#else +#ifndef xmlParseSDDecl +extern __typeof (xmlParseSDDecl) xmlParseSDDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseSDDecl xmlParseSDDecl__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlParseStartTag +extern __typeof (xmlParseStartTag) xmlParseStartTag __attribute((alias("xmlParseStartTag__internal_alias"))); +#else +#ifndef xmlParseStartTag +extern __typeof (xmlParseStartTag) xmlParseStartTag__internal_alias __attribute((visibility("hidden"))); +#define xmlParseStartTag xmlParseStartTag__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseSystemLiteral +extern __typeof (xmlParseSystemLiteral) xmlParseSystemLiteral __attribute((alias("xmlParseSystemLiteral__internal_alias"))); +#else +#ifndef xmlParseSystemLiteral +extern __typeof (xmlParseSystemLiteral) xmlParseSystemLiteral__internal_alias __attribute((visibility("hidden"))); +#define xmlParseSystemLiteral xmlParseSystemLiteral__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseTextDecl +extern __typeof (xmlParseTextDecl) xmlParseTextDecl __attribute((alias("xmlParseTextDecl__internal_alias"))); +#else +#ifndef xmlParseTextDecl +extern __typeof (xmlParseTextDecl) xmlParseTextDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseTextDecl xmlParseTextDecl__internal_alias +#endif +#endif + +#ifdef bottom_uri +#undef xmlParseURI +extern __typeof (xmlParseURI) xmlParseURI __attribute((alias("xmlParseURI__internal_alias"))); +#else +#ifndef xmlParseURI +extern __typeof (xmlParseURI) xmlParseURI__internal_alias __attribute((visibility("hidden"))); +#define xmlParseURI xmlParseURI__internal_alias +#endif +#endif + +#ifdef bottom_uri +#undef xmlParseURIRaw +extern __typeof (xmlParseURIRaw) xmlParseURIRaw __attribute((alias("xmlParseURIRaw__internal_alias"))); +#else +#ifndef xmlParseURIRaw +extern __typeof (xmlParseURIRaw) xmlParseURIRaw__internal_alias __attribute((visibility("hidden"))); +#define xmlParseURIRaw xmlParseURIRaw__internal_alias +#endif +#endif + +#ifdef bottom_uri +#undef xmlParseURIReference +extern __typeof (xmlParseURIReference) xmlParseURIReference __attribute((alias("xmlParseURIReference__internal_alias"))); +#else +#ifndef xmlParseURIReference +extern __typeof (xmlParseURIReference) xmlParseURIReference__internal_alias __attribute((visibility("hidden"))); +#define xmlParseURIReference xmlParseURIReference__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseVersionInfo +extern __typeof (xmlParseVersionInfo) xmlParseVersionInfo __attribute((alias("xmlParseVersionInfo__internal_alias"))); +#else +#ifndef xmlParseVersionInfo +extern __typeof (xmlParseVersionInfo) xmlParseVersionInfo__internal_alias __attribute((visibility("hidden"))); +#define xmlParseVersionInfo xmlParseVersionInfo__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseVersionNum +extern __typeof (xmlParseVersionNum) xmlParseVersionNum __attribute((alias("xmlParseVersionNum__internal_alias"))); +#else +#ifndef xmlParseVersionNum +extern __typeof (xmlParseVersionNum) xmlParseVersionNum__internal_alias __attribute((visibility("hidden"))); +#define xmlParseVersionNum xmlParseVersionNum__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParseXMLDecl +extern __typeof (xmlParseXMLDecl) xmlParseXMLDecl __attribute((alias("xmlParseXMLDecl__internal_alias"))); +#else +#ifndef xmlParseXMLDecl +extern __typeof (xmlParseXMLDecl) xmlParseXMLDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlParseXMLDecl xmlParseXMLDecl__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlParserAddNodeInfo +extern __typeof (xmlParserAddNodeInfo) xmlParserAddNodeInfo __attribute((alias("xmlParserAddNodeInfo__internal_alias"))); +#else +#ifndef xmlParserAddNodeInfo +extern __typeof (xmlParserAddNodeInfo) xmlParserAddNodeInfo__internal_alias __attribute((visibility("hidden"))); +#define xmlParserAddNodeInfo xmlParserAddNodeInfo__internal_alias +#endif +#endif + +#ifdef bottom_error +#undef xmlParserError +extern __typeof (xmlParserError) xmlParserError __attribute((alias("xmlParserError__internal_alias"))); +#else +#ifndef xmlParserError +extern __typeof (xmlParserError) xmlParserError__internal_alias __attribute((visibility("hidden"))); +#define xmlParserError xmlParserError__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlParserFindNodeInfo +extern __typeof (xmlParserFindNodeInfo) xmlParserFindNodeInfo __attribute((alias("xmlParserFindNodeInfo__internal_alias"))); +#else +#ifndef xmlParserFindNodeInfo +extern __typeof (xmlParserFindNodeInfo) xmlParserFindNodeInfo__internal_alias __attribute((visibility("hidden"))); +#define xmlParserFindNodeInfo xmlParserFindNodeInfo__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlParserFindNodeInfoIndex +extern __typeof (xmlParserFindNodeInfoIndex) xmlParserFindNodeInfoIndex __attribute((alias("xmlParserFindNodeInfoIndex__internal_alias"))); +#else +#ifndef xmlParserFindNodeInfoIndex +extern __typeof (xmlParserFindNodeInfoIndex) xmlParserFindNodeInfoIndex__internal_alias __attribute((visibility("hidden"))); +#define xmlParserFindNodeInfoIndex xmlParserFindNodeInfoIndex__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlParserGetDirectory +extern __typeof (xmlParserGetDirectory) xmlParserGetDirectory __attribute((alias("xmlParserGetDirectory__internal_alias"))); +#else +#ifndef xmlParserGetDirectory +extern __typeof (xmlParserGetDirectory) xmlParserGetDirectory__internal_alias __attribute((visibility("hidden"))); +#define xmlParserGetDirectory xmlParserGetDirectory__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlParserHandlePEReference +extern __typeof (xmlParserHandlePEReference) xmlParserHandlePEReference __attribute((alias("xmlParserHandlePEReference__internal_alias"))); +#else +#ifndef xmlParserHandlePEReference +extern __typeof (xmlParserHandlePEReference) xmlParserHandlePEReference__internal_alias __attribute((visibility("hidden"))); +#define xmlParserHandlePEReference xmlParserHandlePEReference__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlParserHandleReference +extern __typeof (xmlParserHandleReference) xmlParserHandleReference __attribute((alias("xmlParserHandleReference__internal_alias"))); +#else +#ifndef xmlParserHandleReference +extern __typeof (xmlParserHandleReference) xmlParserHandleReference__internal_alias __attribute((visibility("hidden"))); +#define xmlParserHandleReference xmlParserHandleReference__internal_alias +#endif +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlParserInputBufferCreateFd +extern __typeof (xmlParserInputBufferCreateFd) xmlParserInputBufferCreateFd __attribute((alias("xmlParserInputBufferCreateFd__internal_alias"))); +#else +#ifndef xmlParserInputBufferCreateFd +extern __typeof (xmlParserInputBufferCreateFd) xmlParserInputBufferCreateFd__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputBufferCreateFd xmlParserInputBufferCreateFd__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlParserInputBufferCreateFile +extern __typeof (xmlParserInputBufferCreateFile) xmlParserInputBufferCreateFile __attribute((alias("xmlParserInputBufferCreateFile__internal_alias"))); +#else +#ifndef xmlParserInputBufferCreateFile +extern __typeof (xmlParserInputBufferCreateFile) xmlParserInputBufferCreateFile__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputBufferCreateFile xmlParserInputBufferCreateFile__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlParserInputBufferCreateFilename +extern __typeof (xmlParserInputBufferCreateFilename) xmlParserInputBufferCreateFilename __attribute((alias("xmlParserInputBufferCreateFilename__internal_alias"))); +#else +#ifndef xmlParserInputBufferCreateFilename +extern __typeof (xmlParserInputBufferCreateFilename) xmlParserInputBufferCreateFilename__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputBufferCreateFilename xmlParserInputBufferCreateFilename__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlParserInputBufferCreateFilenameDefault +extern __typeof (xmlParserInputBufferCreateFilenameDefault) xmlParserInputBufferCreateFilenameDefault __attribute((alias("xmlParserInputBufferCreateFilenameDefault__internal_alias"))); +#else +#ifndef xmlParserInputBufferCreateFilenameDefault +extern __typeof (xmlParserInputBufferCreateFilenameDefault) xmlParserInputBufferCreateFilenameDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputBufferCreateFilenameDefault xmlParserInputBufferCreateFilenameDefault__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlParserInputBufferCreateIO +extern __typeof (xmlParserInputBufferCreateIO) xmlParserInputBufferCreateIO __attribute((alias("xmlParserInputBufferCreateIO__internal_alias"))); +#else +#ifndef xmlParserInputBufferCreateIO +extern __typeof (xmlParserInputBufferCreateIO) xmlParserInputBufferCreateIO__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputBufferCreateIO xmlParserInputBufferCreateIO__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlParserInputBufferCreateMem +extern __typeof (xmlParserInputBufferCreateMem) xmlParserInputBufferCreateMem __attribute((alias("xmlParserInputBufferCreateMem__internal_alias"))); +#else +#ifndef xmlParserInputBufferCreateMem +extern __typeof (xmlParserInputBufferCreateMem) xmlParserInputBufferCreateMem__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputBufferCreateMem xmlParserInputBufferCreateMem__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlParserInputBufferCreateStatic +extern __typeof (xmlParserInputBufferCreateStatic) xmlParserInputBufferCreateStatic __attribute((alias("xmlParserInputBufferCreateStatic__internal_alias"))); +#else +#ifndef xmlParserInputBufferCreateStatic +extern __typeof (xmlParserInputBufferCreateStatic) xmlParserInputBufferCreateStatic__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputBufferCreateStatic xmlParserInputBufferCreateStatic__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlParserInputBufferGrow +extern __typeof (xmlParserInputBufferGrow) xmlParserInputBufferGrow __attribute((alias("xmlParserInputBufferGrow__internal_alias"))); +#else +#ifndef xmlParserInputBufferGrow +extern __typeof (xmlParserInputBufferGrow) xmlParserInputBufferGrow__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputBufferGrow xmlParserInputBufferGrow__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlParserInputBufferPush +extern __typeof (xmlParserInputBufferPush) xmlParserInputBufferPush __attribute((alias("xmlParserInputBufferPush__internal_alias"))); +#else +#ifndef xmlParserInputBufferPush +extern __typeof (xmlParserInputBufferPush) xmlParserInputBufferPush__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputBufferPush xmlParserInputBufferPush__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlParserInputBufferRead +extern __typeof (xmlParserInputBufferRead) xmlParserInputBufferRead __attribute((alias("xmlParserInputBufferRead__internal_alias"))); +#else +#ifndef xmlParserInputBufferRead +extern __typeof (xmlParserInputBufferRead) xmlParserInputBufferRead__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputBufferRead xmlParserInputBufferRead__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlParserInputGrow +extern __typeof (xmlParserInputGrow) xmlParserInputGrow __attribute((alias("xmlParserInputGrow__internal_alias"))); +#else +#ifndef xmlParserInputGrow +extern __typeof (xmlParserInputGrow) xmlParserInputGrow__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputGrow xmlParserInputGrow__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlParserInputRead +extern __typeof (xmlParserInputRead) xmlParserInputRead __attribute((alias("xmlParserInputRead__internal_alias"))); +#else +#ifndef xmlParserInputRead +extern __typeof (xmlParserInputRead) xmlParserInputRead__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputRead xmlParserInputRead__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlParserInputShrink +extern __typeof (xmlParserInputShrink) xmlParserInputShrink __attribute((alias("xmlParserInputShrink__internal_alias"))); +#else +#ifndef xmlParserInputShrink +extern __typeof (xmlParserInputShrink) xmlParserInputShrink__internal_alias __attribute((visibility("hidden"))); +#define xmlParserInputShrink xmlParserInputShrink__internal_alias +#endif +#endif + +#ifdef bottom_error +#undef xmlParserPrintFileContext +extern __typeof (xmlParserPrintFileContext) xmlParserPrintFileContext __attribute((alias("xmlParserPrintFileContext__internal_alias"))); +#else +#ifndef xmlParserPrintFileContext +extern __typeof (xmlParserPrintFileContext) xmlParserPrintFileContext__internal_alias __attribute((visibility("hidden"))); +#define xmlParserPrintFileContext xmlParserPrintFileContext__internal_alias +#endif +#endif + +#ifdef bottom_error +#undef xmlParserPrintFileInfo +extern __typeof (xmlParserPrintFileInfo) xmlParserPrintFileInfo __attribute((alias("xmlParserPrintFileInfo__internal_alias"))); +#else +#ifndef xmlParserPrintFileInfo +extern __typeof (xmlParserPrintFileInfo) xmlParserPrintFileInfo__internal_alias __attribute((visibility("hidden"))); +#define xmlParserPrintFileInfo xmlParserPrintFileInfo__internal_alias +#endif +#endif + +#ifdef bottom_error +#undef xmlParserValidityError +extern __typeof (xmlParserValidityError) xmlParserValidityError __attribute((alias("xmlParserValidityError__internal_alias"))); +#else +#ifndef xmlParserValidityError +extern __typeof (xmlParserValidityError) xmlParserValidityError__internal_alias __attribute((visibility("hidden"))); +#define xmlParserValidityError xmlParserValidityError__internal_alias +#endif +#endif + +#ifdef bottom_error +#undef xmlParserValidityWarning +extern __typeof (xmlParserValidityWarning) xmlParserValidityWarning __attribute((alias("xmlParserValidityWarning__internal_alias"))); +#else +#ifndef xmlParserValidityWarning +extern __typeof (xmlParserValidityWarning) xmlParserValidityWarning__internal_alias __attribute((visibility("hidden"))); +#define xmlParserValidityWarning xmlParserValidityWarning__internal_alias +#endif +#endif + +#ifdef bottom_error +#undef xmlParserWarning +extern __typeof (xmlParserWarning) xmlParserWarning __attribute((alias("xmlParserWarning__internal_alias"))); +#else +#ifndef xmlParserWarning +extern __typeof (xmlParserWarning) xmlParserWarning__internal_alias __attribute((visibility("hidden"))); +#define xmlParserWarning xmlParserWarning__internal_alias +#endif +#endif + +#ifdef bottom_uri +#undef xmlPathToURI +extern __typeof (xmlPathToURI) xmlPathToURI __attribute((alias("xmlPathToURI__internal_alias"))); +#else +#ifndef xmlPathToURI +extern __typeof (xmlPathToURI) xmlPathToURI__internal_alias __attribute((visibility("hidden"))); +#define xmlPathToURI xmlPathToURI__internal_alias +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlPatternFromRoot +extern __typeof (xmlPatternFromRoot) xmlPatternFromRoot __attribute((alias("xmlPatternFromRoot__internal_alias"))); +#else +#ifndef xmlPatternFromRoot +extern __typeof (xmlPatternFromRoot) xmlPatternFromRoot__internal_alias __attribute((visibility("hidden"))); +#define xmlPatternFromRoot xmlPatternFromRoot__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlPatternGetStreamCtxt +extern __typeof (xmlPatternGetStreamCtxt) xmlPatternGetStreamCtxt __attribute((alias("xmlPatternGetStreamCtxt__internal_alias"))); +#else +#ifndef xmlPatternGetStreamCtxt +extern __typeof (xmlPatternGetStreamCtxt) xmlPatternGetStreamCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlPatternGetStreamCtxt xmlPatternGetStreamCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlPatternMatch +extern __typeof (xmlPatternMatch) xmlPatternMatch __attribute((alias("xmlPatternMatch__internal_alias"))); +#else +#ifndef xmlPatternMatch +extern __typeof (xmlPatternMatch) xmlPatternMatch__internal_alias __attribute((visibility("hidden"))); +#define xmlPatternMatch xmlPatternMatch__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlPatternMaxDepth +extern __typeof (xmlPatternMaxDepth) xmlPatternMaxDepth __attribute((alias("xmlPatternMaxDepth__internal_alias"))); +#else +#ifndef xmlPatternMaxDepth +extern __typeof (xmlPatternMaxDepth) xmlPatternMaxDepth__internal_alias __attribute((visibility("hidden"))); +#define xmlPatternMaxDepth xmlPatternMaxDepth__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlPatternMinDepth +extern __typeof (xmlPatternMinDepth) xmlPatternMinDepth __attribute((alias("xmlPatternMinDepth__internal_alias"))); +#else +#ifndef xmlPatternMinDepth +extern __typeof (xmlPatternMinDepth) xmlPatternMinDepth__internal_alias __attribute((visibility("hidden"))); +#define xmlPatternMinDepth xmlPatternMinDepth__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlPatternStreamable +extern __typeof (xmlPatternStreamable) xmlPatternStreamable __attribute((alias("xmlPatternStreamable__internal_alias"))); +#else +#ifndef xmlPatternStreamable +extern __typeof (xmlPatternStreamable) xmlPatternStreamable__internal_alias __attribute((visibility("hidden"))); +#define xmlPatternStreamable xmlPatternStreamable__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlPatterncompile +extern __typeof (xmlPatterncompile) xmlPatterncompile __attribute((alias("xmlPatterncompile__internal_alias"))); +#else +#ifndef xmlPatterncompile +extern __typeof (xmlPatterncompile) xmlPatterncompile__internal_alias __attribute((visibility("hidden"))); +#define xmlPatterncompile xmlPatterncompile__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlPedanticParserDefault +extern __typeof (xmlPedanticParserDefault) xmlPedanticParserDefault __attribute((alias("xmlPedanticParserDefault__internal_alias"))); +#else +#ifndef xmlPedanticParserDefault +extern __typeof (xmlPedanticParserDefault) xmlPedanticParserDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlPedanticParserDefault xmlPedanticParserDefault__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlPopInput +extern __typeof (xmlPopInput) xmlPopInput __attribute((alias("xmlPopInput__internal_alias"))); +#else +#ifndef xmlPopInput +extern __typeof (xmlPopInput) xmlPopInput__internal_alias __attribute((visibility("hidden"))); +#define xmlPopInput xmlPopInput__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlPopInputCallbacks +extern __typeof (xmlPopInputCallbacks) xmlPopInputCallbacks __attribute((alias("xmlPopInputCallbacks__internal_alias"))); +#else +#ifndef xmlPopInputCallbacks +extern __typeof (xmlPopInputCallbacks) xmlPopInputCallbacks__internal_alias __attribute((visibility("hidden"))); +#define xmlPopInputCallbacks xmlPopInputCallbacks__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlPreviousElementSibling +extern __typeof (xmlPreviousElementSibling) xmlPreviousElementSibling __attribute((alias("xmlPreviousElementSibling__internal_alias"))); +#else +#ifndef xmlPreviousElementSibling +extern __typeof (xmlPreviousElementSibling) xmlPreviousElementSibling__internal_alias __attribute((visibility("hidden"))); +#define xmlPreviousElementSibling xmlPreviousElementSibling__internal_alias +#endif +#endif +#endif + +#ifdef bottom_uri +#undef xmlPrintURI +extern __typeof (xmlPrintURI) xmlPrintURI __attribute((alias("xmlPrintURI__internal_alias"))); +#else +#ifndef xmlPrintURI +extern __typeof (xmlPrintURI) xmlPrintURI__internal_alias __attribute((visibility("hidden"))); +#define xmlPrintURI xmlPrintURI__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlPushInput +extern __typeof (xmlPushInput) xmlPushInput __attribute((alias("xmlPushInput__internal_alias"))); +#else +#ifndef xmlPushInput +extern __typeof (xmlPushInput) xmlPushInput__internal_alias __attribute((visibility("hidden"))); +#define xmlPushInput xmlPushInput__internal_alias +#endif +#endif + +#ifdef bottom_threads +#undef xmlRMutexLock +extern __typeof (xmlRMutexLock) xmlRMutexLock __attribute((alias("xmlRMutexLock__internal_alias"))); +#else +#ifndef xmlRMutexLock +extern __typeof (xmlRMutexLock) xmlRMutexLock__internal_alias __attribute((visibility("hidden"))); +#define xmlRMutexLock xmlRMutexLock__internal_alias +#endif +#endif + +#ifdef bottom_threads +#undef xmlRMutexUnlock +extern __typeof (xmlRMutexUnlock) xmlRMutexUnlock __attribute((alias("xmlRMutexUnlock__internal_alias"))); +#else +#ifndef xmlRMutexUnlock +extern __typeof (xmlRMutexUnlock) xmlRMutexUnlock__internal_alias __attribute((visibility("hidden"))); +#define xmlRMutexUnlock xmlRMutexUnlock__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlReadDoc +extern __typeof (xmlReadDoc) xmlReadDoc __attribute((alias("xmlReadDoc__internal_alias"))); +#else +#ifndef xmlReadDoc +extern __typeof (xmlReadDoc) xmlReadDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlReadDoc xmlReadDoc__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlReadFd +extern __typeof (xmlReadFd) xmlReadFd __attribute((alias("xmlReadFd__internal_alias"))); +#else +#ifndef xmlReadFd +extern __typeof (xmlReadFd) xmlReadFd__internal_alias __attribute((visibility("hidden"))); +#define xmlReadFd xmlReadFd__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlReadFile +extern __typeof (xmlReadFile) xmlReadFile __attribute((alias("xmlReadFile__internal_alias"))); +#else +#ifndef xmlReadFile +extern __typeof (xmlReadFile) xmlReadFile__internal_alias __attribute((visibility("hidden"))); +#define xmlReadFile xmlReadFile__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlReadIO +extern __typeof (xmlReadIO) xmlReadIO __attribute((alias("xmlReadIO__internal_alias"))); +#else +#ifndef xmlReadIO +extern __typeof (xmlReadIO) xmlReadIO__internal_alias __attribute((visibility("hidden"))); +#define xmlReadIO xmlReadIO__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlReadMemory +extern __typeof (xmlReadMemory) xmlReadMemory __attribute((alias("xmlReadMemory__internal_alias"))); +#else +#ifndef xmlReadMemory +extern __typeof (xmlReadMemory) xmlReadMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlReadMemory xmlReadMemory__internal_alias +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderForDoc +extern __typeof (xmlReaderForDoc) xmlReaderForDoc __attribute((alias("xmlReaderForDoc__internal_alias"))); +#else +#ifndef xmlReaderForDoc +extern __typeof (xmlReaderForDoc) xmlReaderForDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderForDoc xmlReaderForDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderForFd +extern __typeof (xmlReaderForFd) xmlReaderForFd __attribute((alias("xmlReaderForFd__internal_alias"))); +#else +#ifndef xmlReaderForFd +extern __typeof (xmlReaderForFd) xmlReaderForFd__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderForFd xmlReaderForFd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderForFile +extern __typeof (xmlReaderForFile) xmlReaderForFile __attribute((alias("xmlReaderForFile__internal_alias"))); +#else +#ifndef xmlReaderForFile +extern __typeof (xmlReaderForFile) xmlReaderForFile__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderForFile xmlReaderForFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderForIO +extern __typeof (xmlReaderForIO) xmlReaderForIO __attribute((alias("xmlReaderForIO__internal_alias"))); +#else +#ifndef xmlReaderForIO +extern __typeof (xmlReaderForIO) xmlReaderForIO__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderForIO xmlReaderForIO__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderForMemory +extern __typeof (xmlReaderForMemory) xmlReaderForMemory __attribute((alias("xmlReaderForMemory__internal_alias"))); +#else +#ifndef xmlReaderForMemory +extern __typeof (xmlReaderForMemory) xmlReaderForMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderForMemory xmlReaderForMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderNewDoc +extern __typeof (xmlReaderNewDoc) xmlReaderNewDoc __attribute((alias("xmlReaderNewDoc__internal_alias"))); +#else +#ifndef xmlReaderNewDoc +extern __typeof (xmlReaderNewDoc) xmlReaderNewDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderNewDoc xmlReaderNewDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderNewFd +extern __typeof (xmlReaderNewFd) xmlReaderNewFd __attribute((alias("xmlReaderNewFd__internal_alias"))); +#else +#ifndef xmlReaderNewFd +extern __typeof (xmlReaderNewFd) xmlReaderNewFd__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderNewFd xmlReaderNewFd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderNewFile +extern __typeof (xmlReaderNewFile) xmlReaderNewFile __attribute((alias("xmlReaderNewFile__internal_alias"))); +#else +#ifndef xmlReaderNewFile +extern __typeof (xmlReaderNewFile) xmlReaderNewFile__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderNewFile xmlReaderNewFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderNewIO +extern __typeof (xmlReaderNewIO) xmlReaderNewIO __attribute((alias("xmlReaderNewIO__internal_alias"))); +#else +#ifndef xmlReaderNewIO +extern __typeof (xmlReaderNewIO) xmlReaderNewIO__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderNewIO xmlReaderNewIO__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderNewMemory +extern __typeof (xmlReaderNewMemory) xmlReaderNewMemory __attribute((alias("xmlReaderNewMemory__internal_alias"))); +#else +#ifndef xmlReaderNewMemory +extern __typeof (xmlReaderNewMemory) xmlReaderNewMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderNewMemory xmlReaderNewMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderNewWalker +extern __typeof (xmlReaderNewWalker) xmlReaderNewWalker __attribute((alias("xmlReaderNewWalker__internal_alias"))); +#else +#ifndef xmlReaderNewWalker +extern __typeof (xmlReaderNewWalker) xmlReaderNewWalker__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderNewWalker xmlReaderNewWalker__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlReaderWalker +extern __typeof (xmlReaderWalker) xmlReaderWalker __attribute((alias("xmlReaderWalker__internal_alias"))); +#else +#ifndef xmlReaderWalker +extern __typeof (xmlReaderWalker) xmlReaderWalker__internal_alias __attribute((visibility("hidden"))); +#define xmlReaderWalker xmlReaderWalker__internal_alias +#endif +#endif +#endif + +#ifdef bottom_xmlmemory +#undef xmlReallocLoc +extern __typeof (xmlReallocLoc) xmlReallocLoc __attribute((alias("xmlReallocLoc__internal_alias"))); +#else +#ifndef xmlReallocLoc +extern __typeof (xmlReallocLoc) xmlReallocLoc__internal_alias __attribute((visibility("hidden"))); +#define xmlReallocLoc xmlReallocLoc__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) +#ifdef bottom_tree +#undef xmlReconciliateNs +extern __typeof (xmlReconciliateNs) xmlReconciliateNs __attribute((alias("xmlReconciliateNs__internal_alias"))); +#else +#ifndef xmlReconciliateNs +extern __typeof (xmlReconciliateNs) xmlReconciliateNs__internal_alias __attribute((visibility("hidden"))); +#define xmlReconciliateNs xmlReconciliateNs__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlRecoverDoc +extern __typeof (xmlRecoverDoc) xmlRecoverDoc __attribute((alias("xmlRecoverDoc__internal_alias"))); +#else +#ifndef xmlRecoverDoc +extern __typeof (xmlRecoverDoc) xmlRecoverDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlRecoverDoc xmlRecoverDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlRecoverFile +extern __typeof (xmlRecoverFile) xmlRecoverFile __attribute((alias("xmlRecoverFile__internal_alias"))); +#else +#ifndef xmlRecoverFile +extern __typeof (xmlRecoverFile) xmlRecoverFile__internal_alias __attribute((visibility("hidden"))); +#define xmlRecoverFile xmlRecoverFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlRecoverMemory +extern __typeof (xmlRecoverMemory) xmlRecoverMemory __attribute((alias("xmlRecoverMemory__internal_alias"))); +#else +#ifndef xmlRecoverMemory +extern __typeof (xmlRecoverMemory) xmlRecoverMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlRecoverMemory xmlRecoverMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlRegExecErrInfo +extern __typeof (xmlRegExecErrInfo) xmlRegExecErrInfo __attribute((alias("xmlRegExecErrInfo__internal_alias"))); +#else +#ifndef xmlRegExecErrInfo +extern __typeof (xmlRegExecErrInfo) xmlRegExecErrInfo__internal_alias __attribute((visibility("hidden"))); +#define xmlRegExecErrInfo xmlRegExecErrInfo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlRegExecNextValues +extern __typeof (xmlRegExecNextValues) xmlRegExecNextValues __attribute((alias("xmlRegExecNextValues__internal_alias"))); +#else +#ifndef xmlRegExecNextValues +extern __typeof (xmlRegExecNextValues) xmlRegExecNextValues__internal_alias __attribute((visibility("hidden"))); +#define xmlRegExecNextValues xmlRegExecNextValues__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlRegExecPushString +extern __typeof (xmlRegExecPushString) xmlRegExecPushString __attribute((alias("xmlRegExecPushString__internal_alias"))); +#else +#ifndef xmlRegExecPushString +extern __typeof (xmlRegExecPushString) xmlRegExecPushString__internal_alias __attribute((visibility("hidden"))); +#define xmlRegExecPushString xmlRegExecPushString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlRegExecPushString2 +extern __typeof (xmlRegExecPushString2) xmlRegExecPushString2 __attribute((alias("xmlRegExecPushString2__internal_alias"))); +#else +#ifndef xmlRegExecPushString2 +extern __typeof (xmlRegExecPushString2) xmlRegExecPushString2__internal_alias __attribute((visibility("hidden"))); +#define xmlRegExecPushString2 xmlRegExecPushString2__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlRegFreeExecCtxt +extern __typeof (xmlRegFreeExecCtxt) xmlRegFreeExecCtxt __attribute((alias("xmlRegFreeExecCtxt__internal_alias"))); +#else +#ifndef xmlRegFreeExecCtxt +extern __typeof (xmlRegFreeExecCtxt) xmlRegFreeExecCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlRegFreeExecCtxt xmlRegFreeExecCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlRegFreeRegexp +extern __typeof (xmlRegFreeRegexp) xmlRegFreeRegexp __attribute((alias("xmlRegFreeRegexp__internal_alias"))); +#else +#ifndef xmlRegFreeRegexp +extern __typeof (xmlRegFreeRegexp) xmlRegFreeRegexp__internal_alias __attribute((visibility("hidden"))); +#define xmlRegFreeRegexp xmlRegFreeRegexp__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlRegNewExecCtxt +extern __typeof (xmlRegNewExecCtxt) xmlRegNewExecCtxt __attribute((alias("xmlRegNewExecCtxt__internal_alias"))); +#else +#ifndef xmlRegNewExecCtxt +extern __typeof (xmlRegNewExecCtxt) xmlRegNewExecCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlRegNewExecCtxt xmlRegNewExecCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlRegexpCompile +extern __typeof (xmlRegexpCompile) xmlRegexpCompile __attribute((alias("xmlRegexpCompile__internal_alias"))); +#else +#ifndef xmlRegexpCompile +extern __typeof (xmlRegexpCompile) xmlRegexpCompile__internal_alias __attribute((visibility("hidden"))); +#define xmlRegexpCompile xmlRegexpCompile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlRegexpExec +extern __typeof (xmlRegexpExec) xmlRegexpExec __attribute((alias("xmlRegexpExec__internal_alias"))); +#else +#ifndef xmlRegexpExec +extern __typeof (xmlRegexpExec) xmlRegexpExec__internal_alias __attribute((visibility("hidden"))); +#define xmlRegexpExec xmlRegexpExec__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlRegexpIsDeterminist +extern __typeof (xmlRegexpIsDeterminist) xmlRegexpIsDeterminist __attribute((alias("xmlRegexpIsDeterminist__internal_alias"))); +#else +#ifndef xmlRegexpIsDeterminist +extern __typeof (xmlRegexpIsDeterminist) xmlRegexpIsDeterminist__internal_alias __attribute((visibility("hidden"))); +#define xmlRegexpIsDeterminist xmlRegexpIsDeterminist__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_xmlregexp +#undef xmlRegexpPrint +extern __typeof (xmlRegexpPrint) xmlRegexpPrint __attribute((alias("xmlRegexpPrint__internal_alias"))); +#else +#ifndef xmlRegexpPrint +extern __typeof (xmlRegexpPrint) xmlRegexpPrint__internal_alias __attribute((visibility("hidden"))); +#define xmlRegexpPrint xmlRegexpPrint__internal_alias +#endif +#endif +#endif + +#ifdef bottom_encoding +#undef xmlRegisterCharEncodingHandler +extern __typeof (xmlRegisterCharEncodingHandler) xmlRegisterCharEncodingHandler __attribute((alias("xmlRegisterCharEncodingHandler__internal_alias"))); +#else +#ifndef xmlRegisterCharEncodingHandler +extern __typeof (xmlRegisterCharEncodingHandler) xmlRegisterCharEncodingHandler__internal_alias __attribute((visibility("hidden"))); +#define xmlRegisterCharEncodingHandler xmlRegisterCharEncodingHandler__internal_alias +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlRegisterDefaultInputCallbacks +extern __typeof (xmlRegisterDefaultInputCallbacks) xmlRegisterDefaultInputCallbacks __attribute((alias("xmlRegisterDefaultInputCallbacks__internal_alias"))); +#else +#ifndef xmlRegisterDefaultInputCallbacks +extern __typeof (xmlRegisterDefaultInputCallbacks) xmlRegisterDefaultInputCallbacks__internal_alias __attribute((visibility("hidden"))); +#define xmlRegisterDefaultInputCallbacks xmlRegisterDefaultInputCallbacks__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlRegisterDefaultOutputCallbacks +extern __typeof (xmlRegisterDefaultOutputCallbacks) xmlRegisterDefaultOutputCallbacks __attribute((alias("xmlRegisterDefaultOutputCallbacks__internal_alias"))); +#else +#ifndef xmlRegisterDefaultOutputCallbacks +extern __typeof (xmlRegisterDefaultOutputCallbacks) xmlRegisterDefaultOutputCallbacks__internal_alias __attribute((visibility("hidden"))); +#define xmlRegisterDefaultOutputCallbacks xmlRegisterDefaultOutputCallbacks__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED) +#ifdef bottom_xmlIO +#undef xmlRegisterHTTPPostCallbacks +extern __typeof (xmlRegisterHTTPPostCallbacks) xmlRegisterHTTPPostCallbacks __attribute((alias("xmlRegisterHTTPPostCallbacks__internal_alias"))); +#else +#ifndef xmlRegisterHTTPPostCallbacks +extern __typeof (xmlRegisterHTTPPostCallbacks) xmlRegisterHTTPPostCallbacks__internal_alias __attribute((visibility("hidden"))); +#define xmlRegisterHTTPPostCallbacks xmlRegisterHTTPPostCallbacks__internal_alias +#endif +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlRegisterInputCallbacks +extern __typeof (xmlRegisterInputCallbacks) xmlRegisterInputCallbacks __attribute((alias("xmlRegisterInputCallbacks__internal_alias"))); +#else +#ifndef xmlRegisterInputCallbacks +extern __typeof (xmlRegisterInputCallbacks) xmlRegisterInputCallbacks__internal_alias __attribute((visibility("hidden"))); +#define xmlRegisterInputCallbacks xmlRegisterInputCallbacks__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlRegisterNodeDefault +extern __typeof (xmlRegisterNodeDefault) xmlRegisterNodeDefault __attribute((alias("xmlRegisterNodeDefault__internal_alias"))); +#else +#ifndef xmlRegisterNodeDefault +extern __typeof (xmlRegisterNodeDefault) xmlRegisterNodeDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlRegisterNodeDefault xmlRegisterNodeDefault__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlIO +#undef xmlRegisterOutputCallbacks +extern __typeof (xmlRegisterOutputCallbacks) xmlRegisterOutputCallbacks __attribute((alias("xmlRegisterOutputCallbacks__internal_alias"))); +#else +#ifndef xmlRegisterOutputCallbacks +extern __typeof (xmlRegisterOutputCallbacks) xmlRegisterOutputCallbacks__internal_alias __attribute((visibility("hidden"))); +#define xmlRegisterOutputCallbacks xmlRegisterOutputCallbacks__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGCleanupTypes +extern __typeof (xmlRelaxNGCleanupTypes) xmlRelaxNGCleanupTypes __attribute((alias("xmlRelaxNGCleanupTypes__internal_alias"))); +#else +#ifndef xmlRelaxNGCleanupTypes +extern __typeof (xmlRelaxNGCleanupTypes) xmlRelaxNGCleanupTypes__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGCleanupTypes xmlRelaxNGCleanupTypes__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGDump +extern __typeof (xmlRelaxNGDump) xmlRelaxNGDump __attribute((alias("xmlRelaxNGDump__internal_alias"))); +#else +#ifndef xmlRelaxNGDump +extern __typeof (xmlRelaxNGDump) xmlRelaxNGDump__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGDump xmlRelaxNGDump__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGDumpTree +extern __typeof (xmlRelaxNGDumpTree) xmlRelaxNGDumpTree __attribute((alias("xmlRelaxNGDumpTree__internal_alias"))); +#else +#ifndef xmlRelaxNGDumpTree +extern __typeof (xmlRelaxNGDumpTree) xmlRelaxNGDumpTree__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGDumpTree xmlRelaxNGDumpTree__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGFree +extern __typeof (xmlRelaxNGFree) xmlRelaxNGFree __attribute((alias("xmlRelaxNGFree__internal_alias"))); +#else +#ifndef xmlRelaxNGFree +extern __typeof (xmlRelaxNGFree) xmlRelaxNGFree__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGFree xmlRelaxNGFree__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGFreeParserCtxt +extern __typeof (xmlRelaxNGFreeParserCtxt) xmlRelaxNGFreeParserCtxt __attribute((alias("xmlRelaxNGFreeParserCtxt__internal_alias"))); +#else +#ifndef xmlRelaxNGFreeParserCtxt +extern __typeof (xmlRelaxNGFreeParserCtxt) xmlRelaxNGFreeParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGFreeParserCtxt xmlRelaxNGFreeParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGFreeValidCtxt +extern __typeof (xmlRelaxNGFreeValidCtxt) xmlRelaxNGFreeValidCtxt __attribute((alias("xmlRelaxNGFreeValidCtxt__internal_alias"))); +#else +#ifndef xmlRelaxNGFreeValidCtxt +extern __typeof (xmlRelaxNGFreeValidCtxt) xmlRelaxNGFreeValidCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGFreeValidCtxt xmlRelaxNGFreeValidCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGGetParserErrors +extern __typeof (xmlRelaxNGGetParserErrors) xmlRelaxNGGetParserErrors __attribute((alias("xmlRelaxNGGetParserErrors__internal_alias"))); +#else +#ifndef xmlRelaxNGGetParserErrors +extern __typeof (xmlRelaxNGGetParserErrors) xmlRelaxNGGetParserErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGGetParserErrors xmlRelaxNGGetParserErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGGetValidErrors +extern __typeof (xmlRelaxNGGetValidErrors) xmlRelaxNGGetValidErrors __attribute((alias("xmlRelaxNGGetValidErrors__internal_alias"))); +#else +#ifndef xmlRelaxNGGetValidErrors +extern __typeof (xmlRelaxNGGetValidErrors) xmlRelaxNGGetValidErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGGetValidErrors xmlRelaxNGGetValidErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGInitTypes +extern __typeof (xmlRelaxNGInitTypes) xmlRelaxNGInitTypes __attribute((alias("xmlRelaxNGInitTypes__internal_alias"))); +#else +#ifndef xmlRelaxNGInitTypes +extern __typeof (xmlRelaxNGInitTypes) xmlRelaxNGInitTypes__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGInitTypes xmlRelaxNGInitTypes__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGNewDocParserCtxt +extern __typeof (xmlRelaxNGNewDocParserCtxt) xmlRelaxNGNewDocParserCtxt __attribute((alias("xmlRelaxNGNewDocParserCtxt__internal_alias"))); +#else +#ifndef xmlRelaxNGNewDocParserCtxt +extern __typeof (xmlRelaxNGNewDocParserCtxt) xmlRelaxNGNewDocParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGNewDocParserCtxt xmlRelaxNGNewDocParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGNewMemParserCtxt +extern __typeof (xmlRelaxNGNewMemParserCtxt) xmlRelaxNGNewMemParserCtxt __attribute((alias("xmlRelaxNGNewMemParserCtxt__internal_alias"))); +#else +#ifndef xmlRelaxNGNewMemParserCtxt +extern __typeof (xmlRelaxNGNewMemParserCtxt) xmlRelaxNGNewMemParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGNewMemParserCtxt xmlRelaxNGNewMemParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGNewParserCtxt +extern __typeof (xmlRelaxNGNewParserCtxt) xmlRelaxNGNewParserCtxt __attribute((alias("xmlRelaxNGNewParserCtxt__internal_alias"))); +#else +#ifndef xmlRelaxNGNewParserCtxt +extern __typeof (xmlRelaxNGNewParserCtxt) xmlRelaxNGNewParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGNewParserCtxt xmlRelaxNGNewParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGNewValidCtxt +extern __typeof (xmlRelaxNGNewValidCtxt) xmlRelaxNGNewValidCtxt __attribute((alias("xmlRelaxNGNewValidCtxt__internal_alias"))); +#else +#ifndef xmlRelaxNGNewValidCtxt +extern __typeof (xmlRelaxNGNewValidCtxt) xmlRelaxNGNewValidCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGNewValidCtxt xmlRelaxNGNewValidCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGParse +extern __typeof (xmlRelaxNGParse) xmlRelaxNGParse __attribute((alias("xmlRelaxNGParse__internal_alias"))); +#else +#ifndef xmlRelaxNGParse +extern __typeof (xmlRelaxNGParse) xmlRelaxNGParse__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGParse xmlRelaxNGParse__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGSetParserErrors +extern __typeof (xmlRelaxNGSetParserErrors) xmlRelaxNGSetParserErrors __attribute((alias("xmlRelaxNGSetParserErrors__internal_alias"))); +#else +#ifndef xmlRelaxNGSetParserErrors +extern __typeof (xmlRelaxNGSetParserErrors) xmlRelaxNGSetParserErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGSetParserErrors xmlRelaxNGSetParserErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGSetParserStructuredErrors +extern __typeof (xmlRelaxNGSetParserStructuredErrors) xmlRelaxNGSetParserStructuredErrors __attribute((alias("xmlRelaxNGSetParserStructuredErrors__internal_alias"))); +#else +#ifndef xmlRelaxNGSetParserStructuredErrors +extern __typeof (xmlRelaxNGSetParserStructuredErrors) xmlRelaxNGSetParserStructuredErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGSetParserStructuredErrors xmlRelaxNGSetParserStructuredErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGSetValidErrors +extern __typeof (xmlRelaxNGSetValidErrors) xmlRelaxNGSetValidErrors __attribute((alias("xmlRelaxNGSetValidErrors__internal_alias"))); +#else +#ifndef xmlRelaxNGSetValidErrors +extern __typeof (xmlRelaxNGSetValidErrors) xmlRelaxNGSetValidErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGSetValidErrors xmlRelaxNGSetValidErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGSetValidStructuredErrors +extern __typeof (xmlRelaxNGSetValidStructuredErrors) xmlRelaxNGSetValidStructuredErrors __attribute((alias("xmlRelaxNGSetValidStructuredErrors__internal_alias"))); +#else +#ifndef xmlRelaxNGSetValidStructuredErrors +extern __typeof (xmlRelaxNGSetValidStructuredErrors) xmlRelaxNGSetValidStructuredErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGSetValidStructuredErrors xmlRelaxNGSetValidStructuredErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGValidateDoc +extern __typeof (xmlRelaxNGValidateDoc) xmlRelaxNGValidateDoc __attribute((alias("xmlRelaxNGValidateDoc__internal_alias"))); +#else +#ifndef xmlRelaxNGValidateDoc +extern __typeof (xmlRelaxNGValidateDoc) xmlRelaxNGValidateDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGValidateDoc xmlRelaxNGValidateDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGValidateFullElement +extern __typeof (xmlRelaxNGValidateFullElement) xmlRelaxNGValidateFullElement __attribute((alias("xmlRelaxNGValidateFullElement__internal_alias"))); +#else +#ifndef xmlRelaxNGValidateFullElement +extern __typeof (xmlRelaxNGValidateFullElement) xmlRelaxNGValidateFullElement__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGValidateFullElement xmlRelaxNGValidateFullElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGValidatePopElement +extern __typeof (xmlRelaxNGValidatePopElement) xmlRelaxNGValidatePopElement __attribute((alias("xmlRelaxNGValidatePopElement__internal_alias"))); +#else +#ifndef xmlRelaxNGValidatePopElement +extern __typeof (xmlRelaxNGValidatePopElement) xmlRelaxNGValidatePopElement__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGValidatePopElement xmlRelaxNGValidatePopElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGValidatePushCData +extern __typeof (xmlRelaxNGValidatePushCData) xmlRelaxNGValidatePushCData __attribute((alias("xmlRelaxNGValidatePushCData__internal_alias"))); +#else +#ifndef xmlRelaxNGValidatePushCData +extern __typeof (xmlRelaxNGValidatePushCData) xmlRelaxNGValidatePushCData__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGValidatePushCData xmlRelaxNGValidatePushCData__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxNGValidatePushElement +extern __typeof (xmlRelaxNGValidatePushElement) xmlRelaxNGValidatePushElement __attribute((alias("xmlRelaxNGValidatePushElement__internal_alias"))); +#else +#ifndef xmlRelaxNGValidatePushElement +extern __typeof (xmlRelaxNGValidatePushElement) xmlRelaxNGValidatePushElement__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxNGValidatePushElement xmlRelaxNGValidatePushElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_relaxng +#undef xmlRelaxParserSetFlag +extern __typeof (xmlRelaxParserSetFlag) xmlRelaxParserSetFlag __attribute((alias("xmlRelaxParserSetFlag__internal_alias"))); +#else +#ifndef xmlRelaxParserSetFlag +extern __typeof (xmlRelaxParserSetFlag) xmlRelaxParserSetFlag__internal_alias __attribute((visibility("hidden"))); +#define xmlRelaxParserSetFlag xmlRelaxParserSetFlag__internal_alias +#endif +#endif +#endif + +#ifdef bottom_valid +#undef xmlRemoveID +extern __typeof (xmlRemoveID) xmlRemoveID __attribute((alias("xmlRemoveID__internal_alias"))); +#else +#ifndef xmlRemoveID +extern __typeof (xmlRemoveID) xmlRemoveID__internal_alias __attribute((visibility("hidden"))); +#define xmlRemoveID xmlRemoveID__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlRemoveProp +extern __typeof (xmlRemoveProp) xmlRemoveProp __attribute((alias("xmlRemoveProp__internal_alias"))); +#else +#ifndef xmlRemoveProp +extern __typeof (xmlRemoveProp) xmlRemoveProp__internal_alias __attribute((visibility("hidden"))); +#define xmlRemoveProp xmlRemoveProp__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlRemoveRef +extern __typeof (xmlRemoveRef) xmlRemoveRef __attribute((alias("xmlRemoveRef__internal_alias"))); +#else +#ifndef xmlRemoveRef +extern __typeof (xmlRemoveRef) xmlRemoveRef__internal_alias __attribute((visibility("hidden"))); +#define xmlRemoveRef xmlRemoveRef__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_tree +#undef xmlReplaceNode +extern __typeof (xmlReplaceNode) xmlReplaceNode __attribute((alias("xmlReplaceNode__internal_alias"))); +#else +#ifndef xmlReplaceNode +extern __typeof (xmlReplaceNode) xmlReplaceNode__internal_alias __attribute((visibility("hidden"))); +#define xmlReplaceNode xmlReplaceNode__internal_alias +#endif +#endif +#endif + +#ifdef bottom_error +#undef xmlResetError +extern __typeof (xmlResetError) xmlResetError __attribute((alias("xmlResetError__internal_alias"))); +#else +#ifndef xmlResetError +extern __typeof (xmlResetError) xmlResetError__internal_alias __attribute((visibility("hidden"))); +#define xmlResetError xmlResetError__internal_alias +#endif +#endif + +#ifdef bottom_error +#undef xmlResetLastError +extern __typeof (xmlResetLastError) xmlResetLastError __attribute((alias("xmlResetLastError__internal_alias"))); +#else +#ifndef xmlResetLastError +extern __typeof (xmlResetLastError) xmlResetLastError__internal_alias __attribute((visibility("hidden"))); +#define xmlResetLastError xmlResetLastError__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2AttributeDecl +extern __typeof (xmlSAX2AttributeDecl) xmlSAX2AttributeDecl __attribute((alias("xmlSAX2AttributeDecl__internal_alias"))); +#else +#ifndef xmlSAX2AttributeDecl +extern __typeof (xmlSAX2AttributeDecl) xmlSAX2AttributeDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2AttributeDecl xmlSAX2AttributeDecl__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2CDataBlock +extern __typeof (xmlSAX2CDataBlock) xmlSAX2CDataBlock __attribute((alias("xmlSAX2CDataBlock__internal_alias"))); +#else +#ifndef xmlSAX2CDataBlock +extern __typeof (xmlSAX2CDataBlock) xmlSAX2CDataBlock__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2CDataBlock xmlSAX2CDataBlock__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2Characters +extern __typeof (xmlSAX2Characters) xmlSAX2Characters __attribute((alias("xmlSAX2Characters__internal_alias"))); +#else +#ifndef xmlSAX2Characters +extern __typeof (xmlSAX2Characters) xmlSAX2Characters__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2Characters xmlSAX2Characters__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2Comment +extern __typeof (xmlSAX2Comment) xmlSAX2Comment __attribute((alias("xmlSAX2Comment__internal_alias"))); +#else +#ifndef xmlSAX2Comment +extern __typeof (xmlSAX2Comment) xmlSAX2Comment__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2Comment xmlSAX2Comment__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2ElementDecl +extern __typeof (xmlSAX2ElementDecl) xmlSAX2ElementDecl __attribute((alias("xmlSAX2ElementDecl__internal_alias"))); +#else +#ifndef xmlSAX2ElementDecl +extern __typeof (xmlSAX2ElementDecl) xmlSAX2ElementDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2ElementDecl xmlSAX2ElementDecl__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2EndDocument +extern __typeof (xmlSAX2EndDocument) xmlSAX2EndDocument __attribute((alias("xmlSAX2EndDocument__internal_alias"))); +#else +#ifndef xmlSAX2EndDocument +extern __typeof (xmlSAX2EndDocument) xmlSAX2EndDocument__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2EndDocument xmlSAX2EndDocument__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_SAX2 +#undef xmlSAX2EndElement +extern __typeof (xmlSAX2EndElement) xmlSAX2EndElement __attribute((alias("xmlSAX2EndElement__internal_alias"))); +#else +#ifndef xmlSAX2EndElement +extern __typeof (xmlSAX2EndElement) xmlSAX2EndElement__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2EndElement xmlSAX2EndElement__internal_alias +#endif +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2EndElementNs +extern __typeof (xmlSAX2EndElementNs) xmlSAX2EndElementNs __attribute((alias("xmlSAX2EndElementNs__internal_alias"))); +#else +#ifndef xmlSAX2EndElementNs +extern __typeof (xmlSAX2EndElementNs) xmlSAX2EndElementNs__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2EndElementNs xmlSAX2EndElementNs__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2EntityDecl +extern __typeof (xmlSAX2EntityDecl) xmlSAX2EntityDecl __attribute((alias("xmlSAX2EntityDecl__internal_alias"))); +#else +#ifndef xmlSAX2EntityDecl +extern __typeof (xmlSAX2EntityDecl) xmlSAX2EntityDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2EntityDecl xmlSAX2EntityDecl__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2ExternalSubset +extern __typeof (xmlSAX2ExternalSubset) xmlSAX2ExternalSubset __attribute((alias("xmlSAX2ExternalSubset__internal_alias"))); +#else +#ifndef xmlSAX2ExternalSubset +extern __typeof (xmlSAX2ExternalSubset) xmlSAX2ExternalSubset__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2ExternalSubset xmlSAX2ExternalSubset__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2GetColumnNumber +extern __typeof (xmlSAX2GetColumnNumber) xmlSAX2GetColumnNumber __attribute((alias("xmlSAX2GetColumnNumber__internal_alias"))); +#else +#ifndef xmlSAX2GetColumnNumber +extern __typeof (xmlSAX2GetColumnNumber) xmlSAX2GetColumnNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2GetColumnNumber xmlSAX2GetColumnNumber__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2GetEntity +extern __typeof (xmlSAX2GetEntity) xmlSAX2GetEntity __attribute((alias("xmlSAX2GetEntity__internal_alias"))); +#else +#ifndef xmlSAX2GetEntity +extern __typeof (xmlSAX2GetEntity) xmlSAX2GetEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2GetEntity xmlSAX2GetEntity__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2GetLineNumber +extern __typeof (xmlSAX2GetLineNumber) xmlSAX2GetLineNumber __attribute((alias("xmlSAX2GetLineNumber__internal_alias"))); +#else +#ifndef xmlSAX2GetLineNumber +extern __typeof (xmlSAX2GetLineNumber) xmlSAX2GetLineNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2GetLineNumber xmlSAX2GetLineNumber__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2GetParameterEntity +extern __typeof (xmlSAX2GetParameterEntity) xmlSAX2GetParameterEntity __attribute((alias("xmlSAX2GetParameterEntity__internal_alias"))); +#else +#ifndef xmlSAX2GetParameterEntity +extern __typeof (xmlSAX2GetParameterEntity) xmlSAX2GetParameterEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2GetParameterEntity xmlSAX2GetParameterEntity__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2GetPublicId +extern __typeof (xmlSAX2GetPublicId) xmlSAX2GetPublicId __attribute((alias("xmlSAX2GetPublicId__internal_alias"))); +#else +#ifndef xmlSAX2GetPublicId +extern __typeof (xmlSAX2GetPublicId) xmlSAX2GetPublicId__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2GetPublicId xmlSAX2GetPublicId__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2GetSystemId +extern __typeof (xmlSAX2GetSystemId) xmlSAX2GetSystemId __attribute((alias("xmlSAX2GetSystemId__internal_alias"))); +#else +#ifndef xmlSAX2GetSystemId +extern __typeof (xmlSAX2GetSystemId) xmlSAX2GetSystemId__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2GetSystemId xmlSAX2GetSystemId__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2HasExternalSubset +extern __typeof (xmlSAX2HasExternalSubset) xmlSAX2HasExternalSubset __attribute((alias("xmlSAX2HasExternalSubset__internal_alias"))); +#else +#ifndef xmlSAX2HasExternalSubset +extern __typeof (xmlSAX2HasExternalSubset) xmlSAX2HasExternalSubset__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2HasExternalSubset xmlSAX2HasExternalSubset__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2HasInternalSubset +extern __typeof (xmlSAX2HasInternalSubset) xmlSAX2HasInternalSubset __attribute((alias("xmlSAX2HasInternalSubset__internal_alias"))); +#else +#ifndef xmlSAX2HasInternalSubset +extern __typeof (xmlSAX2HasInternalSubset) xmlSAX2HasInternalSubset__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2HasInternalSubset xmlSAX2HasInternalSubset__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2IgnorableWhitespace +extern __typeof (xmlSAX2IgnorableWhitespace) xmlSAX2IgnorableWhitespace __attribute((alias("xmlSAX2IgnorableWhitespace__internal_alias"))); +#else +#ifndef xmlSAX2IgnorableWhitespace +extern __typeof (xmlSAX2IgnorableWhitespace) xmlSAX2IgnorableWhitespace__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2IgnorableWhitespace xmlSAX2IgnorableWhitespace__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2InitDefaultSAXHandler +extern __typeof (xmlSAX2InitDefaultSAXHandler) xmlSAX2InitDefaultSAXHandler __attribute((alias("xmlSAX2InitDefaultSAXHandler__internal_alias"))); +#else +#ifndef xmlSAX2InitDefaultSAXHandler +extern __typeof (xmlSAX2InitDefaultSAXHandler) xmlSAX2InitDefaultSAXHandler__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2InitDefaultSAXHandler xmlSAX2InitDefaultSAXHandler__internal_alias +#endif +#endif + +#if defined(LIBXML_DOCB_ENABLED) +#ifdef bottom_SAX2 +#undef xmlSAX2InitDocbDefaultSAXHandler +extern __typeof (xmlSAX2InitDocbDefaultSAXHandler) xmlSAX2InitDocbDefaultSAXHandler __attribute((alias("xmlSAX2InitDocbDefaultSAXHandler__internal_alias"))); +#else +#ifndef xmlSAX2InitDocbDefaultSAXHandler +extern __typeof (xmlSAX2InitDocbDefaultSAXHandler) xmlSAX2InitDocbDefaultSAXHandler__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2InitDocbDefaultSAXHandler xmlSAX2InitDocbDefaultSAXHandler__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_HTML_ENABLED) +#ifdef bottom_SAX2 +#undef xmlSAX2InitHtmlDefaultSAXHandler +extern __typeof (xmlSAX2InitHtmlDefaultSAXHandler) xmlSAX2InitHtmlDefaultSAXHandler __attribute((alias("xmlSAX2InitHtmlDefaultSAXHandler__internal_alias"))); +#else +#ifndef xmlSAX2InitHtmlDefaultSAXHandler +extern __typeof (xmlSAX2InitHtmlDefaultSAXHandler) xmlSAX2InitHtmlDefaultSAXHandler__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2InitHtmlDefaultSAXHandler xmlSAX2InitHtmlDefaultSAXHandler__internal_alias +#endif +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2InternalSubset +extern __typeof (xmlSAX2InternalSubset) xmlSAX2InternalSubset __attribute((alias("xmlSAX2InternalSubset__internal_alias"))); +#else +#ifndef xmlSAX2InternalSubset +extern __typeof (xmlSAX2InternalSubset) xmlSAX2InternalSubset__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2InternalSubset xmlSAX2InternalSubset__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2IsStandalone +extern __typeof (xmlSAX2IsStandalone) xmlSAX2IsStandalone __attribute((alias("xmlSAX2IsStandalone__internal_alias"))); +#else +#ifndef xmlSAX2IsStandalone +extern __typeof (xmlSAX2IsStandalone) xmlSAX2IsStandalone__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2IsStandalone xmlSAX2IsStandalone__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2NotationDecl +extern __typeof (xmlSAX2NotationDecl) xmlSAX2NotationDecl __attribute((alias("xmlSAX2NotationDecl__internal_alias"))); +#else +#ifndef xmlSAX2NotationDecl +extern __typeof (xmlSAX2NotationDecl) xmlSAX2NotationDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2NotationDecl xmlSAX2NotationDecl__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2ProcessingInstruction +extern __typeof (xmlSAX2ProcessingInstruction) xmlSAX2ProcessingInstruction __attribute((alias("xmlSAX2ProcessingInstruction__internal_alias"))); +#else +#ifndef xmlSAX2ProcessingInstruction +extern __typeof (xmlSAX2ProcessingInstruction) xmlSAX2ProcessingInstruction__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2ProcessingInstruction xmlSAX2ProcessingInstruction__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2Reference +extern __typeof (xmlSAX2Reference) xmlSAX2Reference __attribute((alias("xmlSAX2Reference__internal_alias"))); +#else +#ifndef xmlSAX2Reference +extern __typeof (xmlSAX2Reference) xmlSAX2Reference__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2Reference xmlSAX2Reference__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2ResolveEntity +extern __typeof (xmlSAX2ResolveEntity) xmlSAX2ResolveEntity __attribute((alias("xmlSAX2ResolveEntity__internal_alias"))); +#else +#ifndef xmlSAX2ResolveEntity +extern __typeof (xmlSAX2ResolveEntity) xmlSAX2ResolveEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2ResolveEntity xmlSAX2ResolveEntity__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2SetDocumentLocator +extern __typeof (xmlSAX2SetDocumentLocator) xmlSAX2SetDocumentLocator __attribute((alias("xmlSAX2SetDocumentLocator__internal_alias"))); +#else +#ifndef xmlSAX2SetDocumentLocator +extern __typeof (xmlSAX2SetDocumentLocator) xmlSAX2SetDocumentLocator__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2SetDocumentLocator xmlSAX2SetDocumentLocator__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2StartDocument +extern __typeof (xmlSAX2StartDocument) xmlSAX2StartDocument __attribute((alias("xmlSAX2StartDocument__internal_alias"))); +#else +#ifndef xmlSAX2StartDocument +extern __typeof (xmlSAX2StartDocument) xmlSAX2StartDocument__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2StartDocument xmlSAX2StartDocument__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_SAX2 +#undef xmlSAX2StartElement +extern __typeof (xmlSAX2StartElement) xmlSAX2StartElement __attribute((alias("xmlSAX2StartElement__internal_alias"))); +#else +#ifndef xmlSAX2StartElement +extern __typeof (xmlSAX2StartElement) xmlSAX2StartElement__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2StartElement xmlSAX2StartElement__internal_alias +#endif +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2StartElementNs +extern __typeof (xmlSAX2StartElementNs) xmlSAX2StartElementNs __attribute((alias("xmlSAX2StartElementNs__internal_alias"))); +#else +#ifndef xmlSAX2StartElementNs +extern __typeof (xmlSAX2StartElementNs) xmlSAX2StartElementNs__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2StartElementNs xmlSAX2StartElementNs__internal_alias +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAX2UnparsedEntityDecl +extern __typeof (xmlSAX2UnparsedEntityDecl) xmlSAX2UnparsedEntityDecl __attribute((alias("xmlSAX2UnparsedEntityDecl__internal_alias"))); +#else +#ifndef xmlSAX2UnparsedEntityDecl +extern __typeof (xmlSAX2UnparsedEntityDecl) xmlSAX2UnparsedEntityDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlSAX2UnparsedEntityDecl xmlSAX2UnparsedEntityDecl__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_SAX2 +#undef xmlSAXDefaultVersion +extern __typeof (xmlSAXDefaultVersion) xmlSAXDefaultVersion __attribute((alias("xmlSAXDefaultVersion__internal_alias"))); +#else +#ifndef xmlSAXDefaultVersion +extern __typeof (xmlSAXDefaultVersion) xmlSAXDefaultVersion__internal_alias __attribute((visibility("hidden"))); +#define xmlSAXDefaultVersion xmlSAXDefaultVersion__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_parser +#undef xmlSAXParseDTD +extern __typeof (xmlSAXParseDTD) xmlSAXParseDTD __attribute((alias("xmlSAXParseDTD__internal_alias"))); +#else +#ifndef xmlSAXParseDTD +extern __typeof (xmlSAXParseDTD) xmlSAXParseDTD__internal_alias __attribute((visibility("hidden"))); +#define xmlSAXParseDTD xmlSAXParseDTD__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlSAXParseDoc +extern __typeof (xmlSAXParseDoc) xmlSAXParseDoc __attribute((alias("xmlSAXParseDoc__internal_alias"))); +#else +#ifndef xmlSAXParseDoc +extern __typeof (xmlSAXParseDoc) xmlSAXParseDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlSAXParseDoc xmlSAXParseDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlSAXParseEntity +extern __typeof (xmlSAXParseEntity) xmlSAXParseEntity __attribute((alias("xmlSAXParseEntity__internal_alias"))); +#else +#ifndef xmlSAXParseEntity +extern __typeof (xmlSAXParseEntity) xmlSAXParseEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlSAXParseEntity xmlSAXParseEntity__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlSAXParseFile +extern __typeof (xmlSAXParseFile) xmlSAXParseFile __attribute((alias("xmlSAXParseFile__internal_alias"))); +#else +#ifndef xmlSAXParseFile +extern __typeof (xmlSAXParseFile) xmlSAXParseFile__internal_alias __attribute((visibility("hidden"))); +#define xmlSAXParseFile xmlSAXParseFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlSAXParseFileWithData +extern __typeof (xmlSAXParseFileWithData) xmlSAXParseFileWithData __attribute((alias("xmlSAXParseFileWithData__internal_alias"))); +#else +#ifndef xmlSAXParseFileWithData +extern __typeof (xmlSAXParseFileWithData) xmlSAXParseFileWithData__internal_alias __attribute((visibility("hidden"))); +#define xmlSAXParseFileWithData xmlSAXParseFileWithData__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlSAXParseMemory +extern __typeof (xmlSAXParseMemory) xmlSAXParseMemory __attribute((alias("xmlSAXParseMemory__internal_alias"))); +#else +#ifndef xmlSAXParseMemory +extern __typeof (xmlSAXParseMemory) xmlSAXParseMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlSAXParseMemory xmlSAXParseMemory__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlSAXParseMemoryWithData +extern __typeof (xmlSAXParseMemoryWithData) xmlSAXParseMemoryWithData __attribute((alias("xmlSAXParseMemoryWithData__internal_alias"))); +#else +#ifndef xmlSAXParseMemoryWithData +extern __typeof (xmlSAXParseMemoryWithData) xmlSAXParseMemoryWithData__internal_alias __attribute((visibility("hidden"))); +#define xmlSAXParseMemoryWithData xmlSAXParseMemoryWithData__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlSAXUserParseFile +extern __typeof (xmlSAXUserParseFile) xmlSAXUserParseFile __attribute((alias("xmlSAXUserParseFile__internal_alias"))); +#else +#ifndef xmlSAXUserParseFile +extern __typeof (xmlSAXUserParseFile) xmlSAXUserParseFile__internal_alias __attribute((visibility("hidden"))); +#define xmlSAXUserParseFile xmlSAXUserParseFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlSAXUserParseMemory +extern __typeof (xmlSAXUserParseMemory) xmlSAXUserParseMemory __attribute((alias("xmlSAXUserParseMemory__internal_alias"))); +#else +#ifndef xmlSAXUserParseMemory +extern __typeof (xmlSAXUserParseMemory) xmlSAXUserParseMemory__internal_alias __attribute((visibility("hidden"))); +#define xmlSAXUserParseMemory xmlSAXUserParseMemory__internal_alias +#endif +#endif +#endif + +#ifdef bottom_SAX2 +#undef xmlSAXVersion +extern __typeof (xmlSAXVersion) xmlSAXVersion __attribute((alias("xmlSAXVersion__internal_alias"))); +#else +#ifndef xmlSAXVersion +extern __typeof (xmlSAXVersion) xmlSAXVersion__internal_alias __attribute((visibility("hidden"))); +#define xmlSAXVersion xmlSAXVersion__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveClose +extern __typeof (xmlSaveClose) xmlSaveClose __attribute((alias("xmlSaveClose__internal_alias"))); +#else +#ifndef xmlSaveClose +extern __typeof (xmlSaveClose) xmlSaveClose__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveClose xmlSaveClose__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveDoc +extern __typeof (xmlSaveDoc) xmlSaveDoc __attribute((alias("xmlSaveDoc__internal_alias"))); +#else +#ifndef xmlSaveDoc +extern __typeof (xmlSaveDoc) xmlSaveDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveDoc xmlSaveDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveFile +extern __typeof (xmlSaveFile) xmlSaveFile __attribute((alias("xmlSaveFile__internal_alias"))); +#else +#ifndef xmlSaveFile +extern __typeof (xmlSaveFile) xmlSaveFile__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveFile xmlSaveFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveFileEnc +extern __typeof (xmlSaveFileEnc) xmlSaveFileEnc __attribute((alias("xmlSaveFileEnc__internal_alias"))); +#else +#ifndef xmlSaveFileEnc +extern __typeof (xmlSaveFileEnc) xmlSaveFileEnc__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveFileEnc xmlSaveFileEnc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveFileTo +extern __typeof (xmlSaveFileTo) xmlSaveFileTo __attribute((alias("xmlSaveFileTo__internal_alias"))); +#else +#ifndef xmlSaveFileTo +extern __typeof (xmlSaveFileTo) xmlSaveFileTo__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveFileTo xmlSaveFileTo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveFlush +extern __typeof (xmlSaveFlush) xmlSaveFlush __attribute((alias("xmlSaveFlush__internal_alias"))); +#else +#ifndef xmlSaveFlush +extern __typeof (xmlSaveFlush) xmlSaveFlush__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveFlush xmlSaveFlush__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveFormatFile +extern __typeof (xmlSaveFormatFile) xmlSaveFormatFile __attribute((alias("xmlSaveFormatFile__internal_alias"))); +#else +#ifndef xmlSaveFormatFile +extern __typeof (xmlSaveFormatFile) xmlSaveFormatFile__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveFormatFile xmlSaveFormatFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveFormatFileEnc +extern __typeof (xmlSaveFormatFileEnc) xmlSaveFormatFileEnc __attribute((alias("xmlSaveFormatFileEnc__internal_alias"))); +#else +#ifndef xmlSaveFormatFileEnc +extern __typeof (xmlSaveFormatFileEnc) xmlSaveFormatFileEnc__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveFormatFileEnc xmlSaveFormatFileEnc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveFormatFileTo +extern __typeof (xmlSaveFormatFileTo) xmlSaveFormatFileTo __attribute((alias("xmlSaveFormatFileTo__internal_alias"))); +#else +#ifndef xmlSaveFormatFileTo +extern __typeof (xmlSaveFormatFileTo) xmlSaveFormatFileTo__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveFormatFileTo xmlSaveFormatFileTo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveSetAttrEscape +extern __typeof (xmlSaveSetAttrEscape) xmlSaveSetAttrEscape __attribute((alias("xmlSaveSetAttrEscape__internal_alias"))); +#else +#ifndef xmlSaveSetAttrEscape +extern __typeof (xmlSaveSetAttrEscape) xmlSaveSetAttrEscape__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveSetAttrEscape xmlSaveSetAttrEscape__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveSetEscape +extern __typeof (xmlSaveSetEscape) xmlSaveSetEscape __attribute((alias("xmlSaveSetEscape__internal_alias"))); +#else +#ifndef xmlSaveSetEscape +extern __typeof (xmlSaveSetEscape) xmlSaveSetEscape__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveSetEscape xmlSaveSetEscape__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveToBuffer +extern __typeof (xmlSaveToBuffer) xmlSaveToBuffer __attribute((alias("xmlSaveToBuffer__internal_alias"))); +#else +#ifndef xmlSaveToBuffer +extern __typeof (xmlSaveToBuffer) xmlSaveToBuffer__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveToBuffer xmlSaveToBuffer__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveToFd +extern __typeof (xmlSaveToFd) xmlSaveToFd __attribute((alias("xmlSaveToFd__internal_alias"))); +#else +#ifndef xmlSaveToFd +extern __typeof (xmlSaveToFd) xmlSaveToFd__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveToFd xmlSaveToFd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveToFilename +extern __typeof (xmlSaveToFilename) xmlSaveToFilename __attribute((alias("xmlSaveToFilename__internal_alias"))); +#else +#ifndef xmlSaveToFilename +extern __typeof (xmlSaveToFilename) xmlSaveToFilename__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveToFilename xmlSaveToFilename__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveToIO +extern __typeof (xmlSaveToIO) xmlSaveToIO __attribute((alias("xmlSaveToIO__internal_alias"))); +#else +#ifndef xmlSaveToIO +extern __typeof (xmlSaveToIO) xmlSaveToIO__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveToIO xmlSaveToIO__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlsave +#undef xmlSaveTree +extern __typeof (xmlSaveTree) xmlSaveTree __attribute((alias("xmlSaveTree__internal_alias"))); +#else +#ifndef xmlSaveTree +extern __typeof (xmlSaveTree) xmlSaveTree__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveTree xmlSaveTree__internal_alias +#endif +#endif +#endif + +#ifdef bottom_uri +#undef xmlSaveUri +extern __typeof (xmlSaveUri) xmlSaveUri __attribute((alias("xmlSaveUri__internal_alias"))); +#else +#ifndef xmlSaveUri +extern __typeof (xmlSaveUri) xmlSaveUri__internal_alias __attribute((visibility("hidden"))); +#define xmlSaveUri xmlSaveUri__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlScanName +extern __typeof (xmlScanName) xmlScanName __attribute((alias("xmlScanName__internal_alias"))); +#else +#ifndef xmlScanName +extern __typeof (xmlScanName) xmlScanName__internal_alias __attribute((visibility("hidden"))); +#define xmlScanName xmlScanName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaCheckFacet +extern __typeof (xmlSchemaCheckFacet) xmlSchemaCheckFacet __attribute((alias("xmlSchemaCheckFacet__internal_alias"))); +#else +#ifndef xmlSchemaCheckFacet +extern __typeof (xmlSchemaCheckFacet) xmlSchemaCheckFacet__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaCheckFacet xmlSchemaCheckFacet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaCleanupTypes +extern __typeof (xmlSchemaCleanupTypes) xmlSchemaCleanupTypes __attribute((alias("xmlSchemaCleanupTypes__internal_alias"))); +#else +#ifndef xmlSchemaCleanupTypes +extern __typeof (xmlSchemaCleanupTypes) xmlSchemaCleanupTypes__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaCleanupTypes xmlSchemaCleanupTypes__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaCollapseString +extern __typeof (xmlSchemaCollapseString) xmlSchemaCollapseString __attribute((alias("xmlSchemaCollapseString__internal_alias"))); +#else +#ifndef xmlSchemaCollapseString +extern __typeof (xmlSchemaCollapseString) xmlSchemaCollapseString__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaCollapseString xmlSchemaCollapseString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaCompareValues +extern __typeof (xmlSchemaCompareValues) xmlSchemaCompareValues __attribute((alias("xmlSchemaCompareValues__internal_alias"))); +#else +#ifndef xmlSchemaCompareValues +extern __typeof (xmlSchemaCompareValues) xmlSchemaCompareValues__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaCompareValues xmlSchemaCompareValues__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaCompareValuesWhtsp +extern __typeof (xmlSchemaCompareValuesWhtsp) xmlSchemaCompareValuesWhtsp __attribute((alias("xmlSchemaCompareValuesWhtsp__internal_alias"))); +#else +#ifndef xmlSchemaCompareValuesWhtsp +extern __typeof (xmlSchemaCompareValuesWhtsp) xmlSchemaCompareValuesWhtsp__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaCompareValuesWhtsp xmlSchemaCompareValuesWhtsp__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaCopyValue +extern __typeof (xmlSchemaCopyValue) xmlSchemaCopyValue __attribute((alias("xmlSchemaCopyValue__internal_alias"))); +#else +#ifndef xmlSchemaCopyValue +extern __typeof (xmlSchemaCopyValue) xmlSchemaCopyValue__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaCopyValue xmlSchemaCopyValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaDump +extern __typeof (xmlSchemaDump) xmlSchemaDump __attribute((alias("xmlSchemaDump__internal_alias"))); +#else +#ifndef xmlSchemaDump +extern __typeof (xmlSchemaDump) xmlSchemaDump__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaDump xmlSchemaDump__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaFree +extern __typeof (xmlSchemaFree) xmlSchemaFree __attribute((alias("xmlSchemaFree__internal_alias"))); +#else +#ifndef xmlSchemaFree +extern __typeof (xmlSchemaFree) xmlSchemaFree__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaFree xmlSchemaFree__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaFreeFacet +extern __typeof (xmlSchemaFreeFacet) xmlSchemaFreeFacet __attribute((alias("xmlSchemaFreeFacet__internal_alias"))); +#else +#ifndef xmlSchemaFreeFacet +extern __typeof (xmlSchemaFreeFacet) xmlSchemaFreeFacet__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaFreeFacet xmlSchemaFreeFacet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaFreeParserCtxt +extern __typeof (xmlSchemaFreeParserCtxt) xmlSchemaFreeParserCtxt __attribute((alias("xmlSchemaFreeParserCtxt__internal_alias"))); +#else +#ifndef xmlSchemaFreeParserCtxt +extern __typeof (xmlSchemaFreeParserCtxt) xmlSchemaFreeParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaFreeParserCtxt xmlSchemaFreeParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaFreeType +extern __typeof (xmlSchemaFreeType) xmlSchemaFreeType __attribute((alias("xmlSchemaFreeType__internal_alias"))); +#else +#ifndef xmlSchemaFreeType +extern __typeof (xmlSchemaFreeType) xmlSchemaFreeType__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaFreeType xmlSchemaFreeType__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaFreeValidCtxt +extern __typeof (xmlSchemaFreeValidCtxt) xmlSchemaFreeValidCtxt __attribute((alias("xmlSchemaFreeValidCtxt__internal_alias"))); +#else +#ifndef xmlSchemaFreeValidCtxt +extern __typeof (xmlSchemaFreeValidCtxt) xmlSchemaFreeValidCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaFreeValidCtxt xmlSchemaFreeValidCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaFreeValue +extern __typeof (xmlSchemaFreeValue) xmlSchemaFreeValue __attribute((alias("xmlSchemaFreeValue__internal_alias"))); +#else +#ifndef xmlSchemaFreeValue +extern __typeof (xmlSchemaFreeValue) xmlSchemaFreeValue__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaFreeValue xmlSchemaFreeValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaFreeWildcard +extern __typeof (xmlSchemaFreeWildcard) xmlSchemaFreeWildcard __attribute((alias("xmlSchemaFreeWildcard__internal_alias"))); +#else +#ifndef xmlSchemaFreeWildcard +extern __typeof (xmlSchemaFreeWildcard) xmlSchemaFreeWildcard__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaFreeWildcard xmlSchemaFreeWildcard__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaGetBuiltInListSimpleTypeItemType +extern __typeof (xmlSchemaGetBuiltInListSimpleTypeItemType) xmlSchemaGetBuiltInListSimpleTypeItemType __attribute((alias("xmlSchemaGetBuiltInListSimpleTypeItemType__internal_alias"))); +#else +#ifndef xmlSchemaGetBuiltInListSimpleTypeItemType +extern __typeof (xmlSchemaGetBuiltInListSimpleTypeItemType) xmlSchemaGetBuiltInListSimpleTypeItemType__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaGetBuiltInListSimpleTypeItemType xmlSchemaGetBuiltInListSimpleTypeItemType__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaGetBuiltInType +extern __typeof (xmlSchemaGetBuiltInType) xmlSchemaGetBuiltInType __attribute((alias("xmlSchemaGetBuiltInType__internal_alias"))); +#else +#ifndef xmlSchemaGetBuiltInType +extern __typeof (xmlSchemaGetBuiltInType) xmlSchemaGetBuiltInType__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaGetBuiltInType xmlSchemaGetBuiltInType__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaGetCanonValue +extern __typeof (xmlSchemaGetCanonValue) xmlSchemaGetCanonValue __attribute((alias("xmlSchemaGetCanonValue__internal_alias"))); +#else +#ifndef xmlSchemaGetCanonValue +extern __typeof (xmlSchemaGetCanonValue) xmlSchemaGetCanonValue__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaGetCanonValue xmlSchemaGetCanonValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaGetCanonValueWhtsp +extern __typeof (xmlSchemaGetCanonValueWhtsp) xmlSchemaGetCanonValueWhtsp __attribute((alias("xmlSchemaGetCanonValueWhtsp__internal_alias"))); +#else +#ifndef xmlSchemaGetCanonValueWhtsp +extern __typeof (xmlSchemaGetCanonValueWhtsp) xmlSchemaGetCanonValueWhtsp__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaGetCanonValueWhtsp xmlSchemaGetCanonValueWhtsp__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaGetFacetValueAsULong +extern __typeof (xmlSchemaGetFacetValueAsULong) xmlSchemaGetFacetValueAsULong __attribute((alias("xmlSchemaGetFacetValueAsULong__internal_alias"))); +#else +#ifndef xmlSchemaGetFacetValueAsULong +extern __typeof (xmlSchemaGetFacetValueAsULong) xmlSchemaGetFacetValueAsULong__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaGetFacetValueAsULong xmlSchemaGetFacetValueAsULong__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaGetParserErrors +extern __typeof (xmlSchemaGetParserErrors) xmlSchemaGetParserErrors __attribute((alias("xmlSchemaGetParserErrors__internal_alias"))); +#else +#ifndef xmlSchemaGetParserErrors +extern __typeof (xmlSchemaGetParserErrors) xmlSchemaGetParserErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaGetParserErrors xmlSchemaGetParserErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaGetPredefinedType +extern __typeof (xmlSchemaGetPredefinedType) xmlSchemaGetPredefinedType __attribute((alias("xmlSchemaGetPredefinedType__internal_alias"))); +#else +#ifndef xmlSchemaGetPredefinedType +extern __typeof (xmlSchemaGetPredefinedType) xmlSchemaGetPredefinedType__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaGetPredefinedType xmlSchemaGetPredefinedType__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaGetValType +extern __typeof (xmlSchemaGetValType) xmlSchemaGetValType __attribute((alias("xmlSchemaGetValType__internal_alias"))); +#else +#ifndef xmlSchemaGetValType +extern __typeof (xmlSchemaGetValType) xmlSchemaGetValType__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaGetValType xmlSchemaGetValType__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaGetValidErrors +extern __typeof (xmlSchemaGetValidErrors) xmlSchemaGetValidErrors __attribute((alias("xmlSchemaGetValidErrors__internal_alias"))); +#else +#ifndef xmlSchemaGetValidErrors +extern __typeof (xmlSchemaGetValidErrors) xmlSchemaGetValidErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaGetValidErrors xmlSchemaGetValidErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaInitTypes +extern __typeof (xmlSchemaInitTypes) xmlSchemaInitTypes __attribute((alias("xmlSchemaInitTypes__internal_alias"))); +#else +#ifndef xmlSchemaInitTypes +extern __typeof (xmlSchemaInitTypes) xmlSchemaInitTypes__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaInitTypes xmlSchemaInitTypes__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaIsBuiltInTypeFacet +extern __typeof (xmlSchemaIsBuiltInTypeFacet) xmlSchemaIsBuiltInTypeFacet __attribute((alias("xmlSchemaIsBuiltInTypeFacet__internal_alias"))); +#else +#ifndef xmlSchemaIsBuiltInTypeFacet +extern __typeof (xmlSchemaIsBuiltInTypeFacet) xmlSchemaIsBuiltInTypeFacet__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaIsBuiltInTypeFacet xmlSchemaIsBuiltInTypeFacet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaIsValid +extern __typeof (xmlSchemaIsValid) xmlSchemaIsValid __attribute((alias("xmlSchemaIsValid__internal_alias"))); +#else +#ifndef xmlSchemaIsValid +extern __typeof (xmlSchemaIsValid) xmlSchemaIsValid__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaIsValid xmlSchemaIsValid__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaNewDocParserCtxt +extern __typeof (xmlSchemaNewDocParserCtxt) xmlSchemaNewDocParserCtxt __attribute((alias("xmlSchemaNewDocParserCtxt__internal_alias"))); +#else +#ifndef xmlSchemaNewDocParserCtxt +extern __typeof (xmlSchemaNewDocParserCtxt) xmlSchemaNewDocParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaNewDocParserCtxt xmlSchemaNewDocParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaNewFacet +extern __typeof (xmlSchemaNewFacet) xmlSchemaNewFacet __attribute((alias("xmlSchemaNewFacet__internal_alias"))); +#else +#ifndef xmlSchemaNewFacet +extern __typeof (xmlSchemaNewFacet) xmlSchemaNewFacet__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaNewFacet xmlSchemaNewFacet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaNewMemParserCtxt +extern __typeof (xmlSchemaNewMemParserCtxt) xmlSchemaNewMemParserCtxt __attribute((alias("xmlSchemaNewMemParserCtxt__internal_alias"))); +#else +#ifndef xmlSchemaNewMemParserCtxt +extern __typeof (xmlSchemaNewMemParserCtxt) xmlSchemaNewMemParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaNewMemParserCtxt xmlSchemaNewMemParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaNewNOTATIONValue +extern __typeof (xmlSchemaNewNOTATIONValue) xmlSchemaNewNOTATIONValue __attribute((alias("xmlSchemaNewNOTATIONValue__internal_alias"))); +#else +#ifndef xmlSchemaNewNOTATIONValue +extern __typeof (xmlSchemaNewNOTATIONValue) xmlSchemaNewNOTATIONValue__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaNewNOTATIONValue xmlSchemaNewNOTATIONValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaNewParserCtxt +extern __typeof (xmlSchemaNewParserCtxt) xmlSchemaNewParserCtxt __attribute((alias("xmlSchemaNewParserCtxt__internal_alias"))); +#else +#ifndef xmlSchemaNewParserCtxt +extern __typeof (xmlSchemaNewParserCtxt) xmlSchemaNewParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaNewParserCtxt xmlSchemaNewParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaNewQNameValue +extern __typeof (xmlSchemaNewQNameValue) xmlSchemaNewQNameValue __attribute((alias("xmlSchemaNewQNameValue__internal_alias"))); +#else +#ifndef xmlSchemaNewQNameValue +extern __typeof (xmlSchemaNewQNameValue) xmlSchemaNewQNameValue__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaNewQNameValue xmlSchemaNewQNameValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaNewStringValue +extern __typeof (xmlSchemaNewStringValue) xmlSchemaNewStringValue __attribute((alias("xmlSchemaNewStringValue__internal_alias"))); +#else +#ifndef xmlSchemaNewStringValue +extern __typeof (xmlSchemaNewStringValue) xmlSchemaNewStringValue__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaNewStringValue xmlSchemaNewStringValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaNewValidCtxt +extern __typeof (xmlSchemaNewValidCtxt) xmlSchemaNewValidCtxt __attribute((alias("xmlSchemaNewValidCtxt__internal_alias"))); +#else +#ifndef xmlSchemaNewValidCtxt +extern __typeof (xmlSchemaNewValidCtxt) xmlSchemaNewValidCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaNewValidCtxt xmlSchemaNewValidCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaParse +extern __typeof (xmlSchemaParse) xmlSchemaParse __attribute((alias("xmlSchemaParse__internal_alias"))); +#else +#ifndef xmlSchemaParse +extern __typeof (xmlSchemaParse) xmlSchemaParse__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaParse xmlSchemaParse__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaSAXPlug +extern __typeof (xmlSchemaSAXPlug) xmlSchemaSAXPlug __attribute((alias("xmlSchemaSAXPlug__internal_alias"))); +#else +#ifndef xmlSchemaSAXPlug +extern __typeof (xmlSchemaSAXPlug) xmlSchemaSAXPlug__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaSAXPlug xmlSchemaSAXPlug__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaSAXUnplug +extern __typeof (xmlSchemaSAXUnplug) xmlSchemaSAXUnplug __attribute((alias("xmlSchemaSAXUnplug__internal_alias"))); +#else +#ifndef xmlSchemaSAXUnplug +extern __typeof (xmlSchemaSAXUnplug) xmlSchemaSAXUnplug__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaSAXUnplug xmlSchemaSAXUnplug__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaSetParserErrors +extern __typeof (xmlSchemaSetParserErrors) xmlSchemaSetParserErrors __attribute((alias("xmlSchemaSetParserErrors__internal_alias"))); +#else +#ifndef xmlSchemaSetParserErrors +extern __typeof (xmlSchemaSetParserErrors) xmlSchemaSetParserErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaSetParserErrors xmlSchemaSetParserErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaSetParserStructuredErrors +extern __typeof (xmlSchemaSetParserStructuredErrors) xmlSchemaSetParserStructuredErrors __attribute((alias("xmlSchemaSetParserStructuredErrors__internal_alias"))); +#else +#ifndef xmlSchemaSetParserStructuredErrors +extern __typeof (xmlSchemaSetParserStructuredErrors) xmlSchemaSetParserStructuredErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaSetParserStructuredErrors xmlSchemaSetParserStructuredErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaSetValidErrors +extern __typeof (xmlSchemaSetValidErrors) xmlSchemaSetValidErrors __attribute((alias("xmlSchemaSetValidErrors__internal_alias"))); +#else +#ifndef xmlSchemaSetValidErrors +extern __typeof (xmlSchemaSetValidErrors) xmlSchemaSetValidErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaSetValidErrors xmlSchemaSetValidErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaSetValidOptions +extern __typeof (xmlSchemaSetValidOptions) xmlSchemaSetValidOptions __attribute((alias("xmlSchemaSetValidOptions__internal_alias"))); +#else +#ifndef xmlSchemaSetValidOptions +extern __typeof (xmlSchemaSetValidOptions) xmlSchemaSetValidOptions__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaSetValidOptions xmlSchemaSetValidOptions__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaSetValidStructuredErrors +extern __typeof (xmlSchemaSetValidStructuredErrors) xmlSchemaSetValidStructuredErrors __attribute((alias("xmlSchemaSetValidStructuredErrors__internal_alias"))); +#else +#ifndef xmlSchemaSetValidStructuredErrors +extern __typeof (xmlSchemaSetValidStructuredErrors) xmlSchemaSetValidStructuredErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaSetValidStructuredErrors xmlSchemaSetValidStructuredErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValPredefTypeNode +extern __typeof (xmlSchemaValPredefTypeNode) xmlSchemaValPredefTypeNode __attribute((alias("xmlSchemaValPredefTypeNode__internal_alias"))); +#else +#ifndef xmlSchemaValPredefTypeNode +extern __typeof (xmlSchemaValPredefTypeNode) xmlSchemaValPredefTypeNode__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValPredefTypeNode xmlSchemaValPredefTypeNode__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValPredefTypeNodeNoNorm +extern __typeof (xmlSchemaValPredefTypeNodeNoNorm) xmlSchemaValPredefTypeNodeNoNorm __attribute((alias("xmlSchemaValPredefTypeNodeNoNorm__internal_alias"))); +#else +#ifndef xmlSchemaValPredefTypeNodeNoNorm +extern __typeof (xmlSchemaValPredefTypeNodeNoNorm) xmlSchemaValPredefTypeNodeNoNorm__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValPredefTypeNodeNoNorm xmlSchemaValPredefTypeNodeNoNorm__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaValidCtxtGetOptions +extern __typeof (xmlSchemaValidCtxtGetOptions) xmlSchemaValidCtxtGetOptions __attribute((alias("xmlSchemaValidCtxtGetOptions__internal_alias"))); +#else +#ifndef xmlSchemaValidCtxtGetOptions +extern __typeof (xmlSchemaValidCtxtGetOptions) xmlSchemaValidCtxtGetOptions__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidCtxtGetOptions xmlSchemaValidCtxtGetOptions__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaValidCtxtGetParserCtxt +extern __typeof (xmlSchemaValidCtxtGetParserCtxt) xmlSchemaValidCtxtGetParserCtxt __attribute((alias("xmlSchemaValidCtxtGetParserCtxt__internal_alias"))); +#else +#ifndef xmlSchemaValidCtxtGetParserCtxt +extern __typeof (xmlSchemaValidCtxtGetParserCtxt) xmlSchemaValidCtxtGetParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidCtxtGetParserCtxt xmlSchemaValidCtxtGetParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaValidateDoc +extern __typeof (xmlSchemaValidateDoc) xmlSchemaValidateDoc __attribute((alias("xmlSchemaValidateDoc__internal_alias"))); +#else +#ifndef xmlSchemaValidateDoc +extern __typeof (xmlSchemaValidateDoc) xmlSchemaValidateDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateDoc xmlSchemaValidateDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValidateFacet +extern __typeof (xmlSchemaValidateFacet) xmlSchemaValidateFacet __attribute((alias("xmlSchemaValidateFacet__internal_alias"))); +#else +#ifndef xmlSchemaValidateFacet +extern __typeof (xmlSchemaValidateFacet) xmlSchemaValidateFacet__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateFacet xmlSchemaValidateFacet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValidateFacetWhtsp +extern __typeof (xmlSchemaValidateFacetWhtsp) xmlSchemaValidateFacetWhtsp __attribute((alias("xmlSchemaValidateFacetWhtsp__internal_alias"))); +#else +#ifndef xmlSchemaValidateFacetWhtsp +extern __typeof (xmlSchemaValidateFacetWhtsp) xmlSchemaValidateFacetWhtsp__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateFacetWhtsp xmlSchemaValidateFacetWhtsp__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaValidateFile +extern __typeof (xmlSchemaValidateFile) xmlSchemaValidateFile __attribute((alias("xmlSchemaValidateFile__internal_alias"))); +#else +#ifndef xmlSchemaValidateFile +extern __typeof (xmlSchemaValidateFile) xmlSchemaValidateFile__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateFile xmlSchemaValidateFile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValidateLengthFacet +extern __typeof (xmlSchemaValidateLengthFacet) xmlSchemaValidateLengthFacet __attribute((alias("xmlSchemaValidateLengthFacet__internal_alias"))); +#else +#ifndef xmlSchemaValidateLengthFacet +extern __typeof (xmlSchemaValidateLengthFacet) xmlSchemaValidateLengthFacet__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateLengthFacet xmlSchemaValidateLengthFacet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValidateLengthFacetWhtsp +extern __typeof (xmlSchemaValidateLengthFacetWhtsp) xmlSchemaValidateLengthFacetWhtsp __attribute((alias("xmlSchemaValidateLengthFacetWhtsp__internal_alias"))); +#else +#ifndef xmlSchemaValidateLengthFacetWhtsp +extern __typeof (xmlSchemaValidateLengthFacetWhtsp) xmlSchemaValidateLengthFacetWhtsp__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateLengthFacetWhtsp xmlSchemaValidateLengthFacetWhtsp__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValidateListSimpleTypeFacet +extern __typeof (xmlSchemaValidateListSimpleTypeFacet) xmlSchemaValidateListSimpleTypeFacet __attribute((alias("xmlSchemaValidateListSimpleTypeFacet__internal_alias"))); +#else +#ifndef xmlSchemaValidateListSimpleTypeFacet +extern __typeof (xmlSchemaValidateListSimpleTypeFacet) xmlSchemaValidateListSimpleTypeFacet__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateListSimpleTypeFacet xmlSchemaValidateListSimpleTypeFacet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaValidateOneElement +extern __typeof (xmlSchemaValidateOneElement) xmlSchemaValidateOneElement __attribute((alias("xmlSchemaValidateOneElement__internal_alias"))); +#else +#ifndef xmlSchemaValidateOneElement +extern __typeof (xmlSchemaValidateOneElement) xmlSchemaValidateOneElement__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateOneElement xmlSchemaValidateOneElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValidatePredefinedType +extern __typeof (xmlSchemaValidatePredefinedType) xmlSchemaValidatePredefinedType __attribute((alias("xmlSchemaValidatePredefinedType__internal_alias"))); +#else +#ifndef xmlSchemaValidatePredefinedType +extern __typeof (xmlSchemaValidatePredefinedType) xmlSchemaValidatePredefinedType__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidatePredefinedType xmlSchemaValidatePredefinedType__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaValidateSetFilename +extern __typeof (xmlSchemaValidateSetFilename) xmlSchemaValidateSetFilename __attribute((alias("xmlSchemaValidateSetFilename__internal_alias"))); +#else +#ifndef xmlSchemaValidateSetFilename +extern __typeof (xmlSchemaValidateSetFilename) xmlSchemaValidateSetFilename__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateSetFilename xmlSchemaValidateSetFilename__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaValidateSetLocator +extern __typeof (xmlSchemaValidateSetLocator) xmlSchemaValidateSetLocator __attribute((alias("xmlSchemaValidateSetLocator__internal_alias"))); +#else +#ifndef xmlSchemaValidateSetLocator +extern __typeof (xmlSchemaValidateSetLocator) xmlSchemaValidateSetLocator__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateSetLocator xmlSchemaValidateSetLocator__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemas +#undef xmlSchemaValidateStream +extern __typeof (xmlSchemaValidateStream) xmlSchemaValidateStream __attribute((alias("xmlSchemaValidateStream__internal_alias"))); +#else +#ifndef xmlSchemaValidateStream +extern __typeof (xmlSchemaValidateStream) xmlSchemaValidateStream__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValidateStream xmlSchemaValidateStream__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValueAppend +extern __typeof (xmlSchemaValueAppend) xmlSchemaValueAppend __attribute((alias("xmlSchemaValueAppend__internal_alias"))); +#else +#ifndef xmlSchemaValueAppend +extern __typeof (xmlSchemaValueAppend) xmlSchemaValueAppend__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValueAppend xmlSchemaValueAppend__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValueGetAsBoolean +extern __typeof (xmlSchemaValueGetAsBoolean) xmlSchemaValueGetAsBoolean __attribute((alias("xmlSchemaValueGetAsBoolean__internal_alias"))); +#else +#ifndef xmlSchemaValueGetAsBoolean +extern __typeof (xmlSchemaValueGetAsBoolean) xmlSchemaValueGetAsBoolean__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValueGetAsBoolean xmlSchemaValueGetAsBoolean__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValueGetAsString +extern __typeof (xmlSchemaValueGetAsString) xmlSchemaValueGetAsString __attribute((alias("xmlSchemaValueGetAsString__internal_alias"))); +#else +#ifndef xmlSchemaValueGetAsString +extern __typeof (xmlSchemaValueGetAsString) xmlSchemaValueGetAsString__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValueGetAsString xmlSchemaValueGetAsString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaValueGetNext +extern __typeof (xmlSchemaValueGetNext) xmlSchemaValueGetNext __attribute((alias("xmlSchemaValueGetNext__internal_alias"))); +#else +#ifndef xmlSchemaValueGetNext +extern __typeof (xmlSchemaValueGetNext) xmlSchemaValueGetNext__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaValueGetNext xmlSchemaValueGetNext__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlschemastypes +#undef xmlSchemaWhiteSpaceReplace +extern __typeof (xmlSchemaWhiteSpaceReplace) xmlSchemaWhiteSpaceReplace __attribute((alias("xmlSchemaWhiteSpaceReplace__internal_alias"))); +#else +#ifndef xmlSchemaWhiteSpaceReplace +extern __typeof (xmlSchemaWhiteSpaceReplace) xmlSchemaWhiteSpaceReplace__internal_alias __attribute((visibility("hidden"))); +#define xmlSchemaWhiteSpaceReplace xmlSchemaWhiteSpaceReplace__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMATRON_ENABLED) +#ifdef bottom_schematron +#undef xmlSchematronFree +extern __typeof (xmlSchematronFree) xmlSchematronFree __attribute((alias("xmlSchematronFree__internal_alias"))); +#else +#ifndef xmlSchematronFree +extern __typeof (xmlSchematronFree) xmlSchematronFree__internal_alias __attribute((visibility("hidden"))); +#define xmlSchematronFree xmlSchematronFree__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMATRON_ENABLED) +#ifdef bottom_schematron +#undef xmlSchematronFreeParserCtxt +extern __typeof (xmlSchematronFreeParserCtxt) xmlSchematronFreeParserCtxt __attribute((alias("xmlSchematronFreeParserCtxt__internal_alias"))); +#else +#ifndef xmlSchematronFreeParserCtxt +extern __typeof (xmlSchematronFreeParserCtxt) xmlSchematronFreeParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchematronFreeParserCtxt xmlSchematronFreeParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMATRON_ENABLED) +#ifdef bottom_schematron +#undef xmlSchematronFreeValidCtxt +extern __typeof (xmlSchematronFreeValidCtxt) xmlSchematronFreeValidCtxt __attribute((alias("xmlSchematronFreeValidCtxt__internal_alias"))); +#else +#ifndef xmlSchematronFreeValidCtxt +extern __typeof (xmlSchematronFreeValidCtxt) xmlSchematronFreeValidCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchematronFreeValidCtxt xmlSchematronFreeValidCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMATRON_ENABLED) +#ifdef bottom_schematron +#undef xmlSchematronNewDocParserCtxt +extern __typeof (xmlSchematronNewDocParserCtxt) xmlSchematronNewDocParserCtxt __attribute((alias("xmlSchematronNewDocParserCtxt__internal_alias"))); +#else +#ifndef xmlSchematronNewDocParserCtxt +extern __typeof (xmlSchematronNewDocParserCtxt) xmlSchematronNewDocParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchematronNewDocParserCtxt xmlSchematronNewDocParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMATRON_ENABLED) +#ifdef bottom_schematron +#undef xmlSchematronNewMemParserCtxt +extern __typeof (xmlSchematronNewMemParserCtxt) xmlSchematronNewMemParserCtxt __attribute((alias("xmlSchematronNewMemParserCtxt__internal_alias"))); +#else +#ifndef xmlSchematronNewMemParserCtxt +extern __typeof (xmlSchematronNewMemParserCtxt) xmlSchematronNewMemParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchematronNewMemParserCtxt xmlSchematronNewMemParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMATRON_ENABLED) +#ifdef bottom_schematron +#undef xmlSchematronNewParserCtxt +extern __typeof (xmlSchematronNewParserCtxt) xmlSchematronNewParserCtxt __attribute((alias("xmlSchematronNewParserCtxt__internal_alias"))); +#else +#ifndef xmlSchematronNewParserCtxt +extern __typeof (xmlSchematronNewParserCtxt) xmlSchematronNewParserCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchematronNewParserCtxt xmlSchematronNewParserCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMATRON_ENABLED) +#ifdef bottom_schematron +#undef xmlSchematronNewValidCtxt +extern __typeof (xmlSchematronNewValidCtxt) xmlSchematronNewValidCtxt __attribute((alias("xmlSchematronNewValidCtxt__internal_alias"))); +#else +#ifndef xmlSchematronNewValidCtxt +extern __typeof (xmlSchematronNewValidCtxt) xmlSchematronNewValidCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlSchematronNewValidCtxt xmlSchematronNewValidCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMATRON_ENABLED) +#ifdef bottom_schematron +#undef xmlSchematronParse +extern __typeof (xmlSchematronParse) xmlSchematronParse __attribute((alias("xmlSchematronParse__internal_alias"))); +#else +#ifndef xmlSchematronParse +extern __typeof (xmlSchematronParse) xmlSchematronParse__internal_alias __attribute((visibility("hidden"))); +#define xmlSchematronParse xmlSchematronParse__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMATRON_ENABLED) +#ifdef bottom_schematron +#undef xmlSchematronSetValidStructuredErrors +extern __typeof (xmlSchematronSetValidStructuredErrors) xmlSchematronSetValidStructuredErrors __attribute((alias("xmlSchematronSetValidStructuredErrors__internal_alias"))); +#else +#ifndef xmlSchematronSetValidStructuredErrors +extern __typeof (xmlSchematronSetValidStructuredErrors) xmlSchematronSetValidStructuredErrors__internal_alias __attribute((visibility("hidden"))); +#define xmlSchematronSetValidStructuredErrors xmlSchematronSetValidStructuredErrors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_SCHEMATRON_ENABLED) +#ifdef bottom_schematron +#undef xmlSchematronValidateDoc +extern __typeof (xmlSchematronValidateDoc) xmlSchematronValidateDoc __attribute((alias("xmlSchematronValidateDoc__internal_alias"))); +#else +#ifndef xmlSchematronValidateDoc +extern __typeof (xmlSchematronValidateDoc) xmlSchematronValidateDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlSchematronValidateDoc xmlSchematronValidateDoc__internal_alias +#endif +#endif +#endif + +#ifdef bottom_tree +#undef xmlSearchNs +extern __typeof (xmlSearchNs) xmlSearchNs __attribute((alias("xmlSearchNs__internal_alias"))); +#else +#ifndef xmlSearchNs +extern __typeof (xmlSearchNs) xmlSearchNs__internal_alias __attribute((visibility("hidden"))); +#define xmlSearchNs xmlSearchNs__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlSearchNsByHref +extern __typeof (xmlSearchNsByHref) xmlSearchNsByHref __attribute((alias("xmlSearchNsByHref__internal_alias"))); +#else +#ifndef xmlSearchNsByHref +extern __typeof (xmlSearchNsByHref) xmlSearchNsByHref__internal_alias __attribute((visibility("hidden"))); +#define xmlSearchNsByHref xmlSearchNsByHref__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlSetBufferAllocationScheme +extern __typeof (xmlSetBufferAllocationScheme) xmlSetBufferAllocationScheme __attribute((alias("xmlSetBufferAllocationScheme__internal_alias"))); +#else +#ifndef xmlSetBufferAllocationScheme +extern __typeof (xmlSetBufferAllocationScheme) xmlSetBufferAllocationScheme__internal_alias __attribute((visibility("hidden"))); +#define xmlSetBufferAllocationScheme xmlSetBufferAllocationScheme__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlSetCompressMode +extern __typeof (xmlSetCompressMode) xmlSetCompressMode __attribute((alias("xmlSetCompressMode__internal_alias"))); +#else +#ifndef xmlSetCompressMode +extern __typeof (xmlSetCompressMode) xmlSetCompressMode__internal_alias __attribute((visibility("hidden"))); +#define xmlSetCompressMode xmlSetCompressMode__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlSetDocCompressMode +extern __typeof (xmlSetDocCompressMode) xmlSetDocCompressMode __attribute((alias("xmlSetDocCompressMode__internal_alias"))); +#else +#ifndef xmlSetDocCompressMode +extern __typeof (xmlSetDocCompressMode) xmlSetDocCompressMode__internal_alias __attribute((visibility("hidden"))); +#define xmlSetDocCompressMode xmlSetDocCompressMode__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_parser +#undef xmlSetEntityReferenceFunc +extern __typeof (xmlSetEntityReferenceFunc) xmlSetEntityReferenceFunc __attribute((alias("xmlSetEntityReferenceFunc__internal_alias"))); +#else +#ifndef xmlSetEntityReferenceFunc +extern __typeof (xmlSetEntityReferenceFunc) xmlSetEntityReferenceFunc__internal_alias __attribute((visibility("hidden"))); +#define xmlSetEntityReferenceFunc xmlSetEntityReferenceFunc__internal_alias +#endif +#endif +#endif + +#ifdef bottom_xmlIO +#undef xmlSetExternalEntityLoader +extern __typeof (xmlSetExternalEntityLoader) xmlSetExternalEntityLoader __attribute((alias("xmlSetExternalEntityLoader__internal_alias"))); +#else +#ifndef xmlSetExternalEntityLoader +extern __typeof (xmlSetExternalEntityLoader) xmlSetExternalEntityLoader__internal_alias __attribute((visibility("hidden"))); +#define xmlSetExternalEntityLoader xmlSetExternalEntityLoader__internal_alias +#endif +#endif + +#if defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_legacy +#undef xmlSetFeature +extern __typeof (xmlSetFeature) xmlSetFeature __attribute((alias("xmlSetFeature__internal_alias"))); +#else +#ifndef xmlSetFeature +extern __typeof (xmlSetFeature) xmlSetFeature__internal_alias __attribute((visibility("hidden"))); +#define xmlSetFeature xmlSetFeature__internal_alias +#endif +#endif +#endif + +#ifdef bottom_error +#undef xmlSetGenericErrorFunc +extern __typeof (xmlSetGenericErrorFunc) xmlSetGenericErrorFunc __attribute((alias("xmlSetGenericErrorFunc__internal_alias"))); +#else +#ifndef xmlSetGenericErrorFunc +extern __typeof (xmlSetGenericErrorFunc) xmlSetGenericErrorFunc__internal_alias __attribute((visibility("hidden"))); +#define xmlSetGenericErrorFunc xmlSetGenericErrorFunc__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlSetListDoc +extern __typeof (xmlSetListDoc) xmlSetListDoc __attribute((alias("xmlSetListDoc__internal_alias"))); +#else +#ifndef xmlSetListDoc +extern __typeof (xmlSetListDoc) xmlSetListDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlSetListDoc xmlSetListDoc__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlSetNs +extern __typeof (xmlSetNs) xmlSetNs __attribute((alias("xmlSetNs__internal_alias"))); +#else +#ifndef xmlSetNs +extern __typeof (xmlSetNs) xmlSetNs__internal_alias __attribute((visibility("hidden"))); +#define xmlSetNs xmlSetNs__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) +#ifdef bottom_tree +#undef xmlSetNsProp +extern __typeof (xmlSetNsProp) xmlSetNsProp __attribute((alias("xmlSetNsProp__internal_alias"))); +#else +#ifndef xmlSetNsProp +extern __typeof (xmlSetNsProp) xmlSetNsProp__internal_alias __attribute((visibility("hidden"))); +#define xmlSetNsProp xmlSetNsProp__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) +#ifdef bottom_tree +#undef xmlSetProp +extern __typeof (xmlSetProp) xmlSetProp __attribute((alias("xmlSetProp__internal_alias"))); +#else +#ifndef xmlSetProp +extern __typeof (xmlSetProp) xmlSetProp__internal_alias __attribute((visibility("hidden"))); +#define xmlSetProp xmlSetProp__internal_alias +#endif +#endif +#endif + +#ifdef bottom_error +#undef xmlSetStructuredErrorFunc +extern __typeof (xmlSetStructuredErrorFunc) xmlSetStructuredErrorFunc __attribute((alias("xmlSetStructuredErrorFunc__internal_alias"))); +#else +#ifndef xmlSetStructuredErrorFunc +extern __typeof (xmlSetStructuredErrorFunc) xmlSetStructuredErrorFunc__internal_alias __attribute((visibility("hidden"))); +#define xmlSetStructuredErrorFunc xmlSetStructuredErrorFunc__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlSetTreeDoc +extern __typeof (xmlSetTreeDoc) xmlSetTreeDoc __attribute((alias("xmlSetTreeDoc__internal_alias"))); +#else +#ifndef xmlSetTreeDoc +extern __typeof (xmlSetTreeDoc) xmlSetTreeDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlSetTreeDoc xmlSetTreeDoc__internal_alias +#endif +#endif + +#if defined(LIBXML_SAX1_ENABLED) +#ifdef bottom_parser +#undef xmlSetupParserForBuffer +extern __typeof (xmlSetupParserForBuffer) xmlSetupParserForBuffer __attribute((alias("xmlSetupParserForBuffer__internal_alias"))); +#else +#ifndef xmlSetupParserForBuffer +extern __typeof (xmlSetupParserForBuffer) xmlSetupParserForBuffer__internal_alias __attribute((visibility("hidden"))); +#define xmlSetupParserForBuffer xmlSetupParserForBuffer__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_debugXML +#undef xmlShell +extern __typeof (xmlShell) xmlShell __attribute((alias("xmlShell__internal_alias"))); +#else +#ifndef xmlShell +extern __typeof (xmlShell) xmlShell__internal_alias __attribute((visibility("hidden"))); +#define xmlShell xmlShell__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellBase +extern __typeof (xmlShellBase) xmlShellBase __attribute((alias("xmlShellBase__internal_alias"))); +#else +#ifndef xmlShellBase +extern __typeof (xmlShellBase) xmlShellBase__internal_alias __attribute((visibility("hidden"))); +#define xmlShellBase xmlShellBase__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellCat +extern __typeof (xmlShellCat) xmlShellCat __attribute((alias("xmlShellCat__internal_alias"))); +#else +#ifndef xmlShellCat +extern __typeof (xmlShellCat) xmlShellCat__internal_alias __attribute((visibility("hidden"))); +#define xmlShellCat xmlShellCat__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellDir +extern __typeof (xmlShellDir) xmlShellDir __attribute((alias("xmlShellDir__internal_alias"))); +#else +#ifndef xmlShellDir +extern __typeof (xmlShellDir) xmlShellDir__internal_alias __attribute((visibility("hidden"))); +#define xmlShellDir xmlShellDir__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellDu +extern __typeof (xmlShellDu) xmlShellDu __attribute((alias("xmlShellDu__internal_alias"))); +#else +#ifndef xmlShellDu +extern __typeof (xmlShellDu) xmlShellDu__internal_alias __attribute((visibility("hidden"))); +#define xmlShellDu xmlShellDu__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellList +extern __typeof (xmlShellList) xmlShellList __attribute((alias("xmlShellList__internal_alias"))); +#else +#ifndef xmlShellList +extern __typeof (xmlShellList) xmlShellList__internal_alias __attribute((visibility("hidden"))); +#define xmlShellList xmlShellList__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellLoad +extern __typeof (xmlShellLoad) xmlShellLoad __attribute((alias("xmlShellLoad__internal_alias"))); +#else +#ifndef xmlShellLoad +extern __typeof (xmlShellLoad) xmlShellLoad__internal_alias __attribute((visibility("hidden"))); +#define xmlShellLoad xmlShellLoad__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellPrintNode +extern __typeof (xmlShellPrintNode) xmlShellPrintNode __attribute((alias("xmlShellPrintNode__internal_alias"))); +#else +#ifndef xmlShellPrintNode +extern __typeof (xmlShellPrintNode) xmlShellPrintNode__internal_alias __attribute((visibility("hidden"))); +#define xmlShellPrintNode xmlShellPrintNode__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellPrintXPathError +extern __typeof (xmlShellPrintXPathError) xmlShellPrintXPathError __attribute((alias("xmlShellPrintXPathError__internal_alias"))); +#else +#ifndef xmlShellPrintXPathError +extern __typeof (xmlShellPrintXPathError) xmlShellPrintXPathError__internal_alias __attribute((visibility("hidden"))); +#define xmlShellPrintXPathError xmlShellPrintXPathError__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellPrintXPathResult +extern __typeof (xmlShellPrintXPathResult) xmlShellPrintXPathResult __attribute((alias("xmlShellPrintXPathResult__internal_alias"))); +#else +#ifndef xmlShellPrintXPathResult +extern __typeof (xmlShellPrintXPathResult) xmlShellPrintXPathResult__internal_alias __attribute((visibility("hidden"))); +#define xmlShellPrintXPathResult xmlShellPrintXPathResult__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellPwd +extern __typeof (xmlShellPwd) xmlShellPwd __attribute((alias("xmlShellPwd__internal_alias"))); +#else +#ifndef xmlShellPwd +extern __typeof (xmlShellPwd) xmlShellPwd__internal_alias __attribute((visibility("hidden"))); +#define xmlShellPwd xmlShellPwd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellSave +extern __typeof (xmlShellSave) xmlShellSave __attribute((alias("xmlShellSave__internal_alias"))); +#else +#ifndef xmlShellSave +extern __typeof (xmlShellSave) xmlShellSave__internal_alias __attribute((visibility("hidden"))); +#define xmlShellSave xmlShellSave__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellValidate +extern __typeof (xmlShellValidate) xmlShellValidate __attribute((alias("xmlShellValidate__internal_alias"))); +#else +#ifndef xmlShellValidate +extern __typeof (xmlShellValidate) xmlShellValidate__internal_alias __attribute((visibility("hidden"))); +#define xmlShellValidate xmlShellValidate__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_debugXML +#undef xmlShellWrite +extern __typeof (xmlShellWrite) xmlShellWrite __attribute((alias("xmlShellWrite__internal_alias"))); +#else +#ifndef xmlShellWrite +extern __typeof (xmlShellWrite) xmlShellWrite__internal_alias __attribute((visibility("hidden"))); +#define xmlShellWrite xmlShellWrite__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlSkipBlankChars +extern __typeof (xmlSkipBlankChars) xmlSkipBlankChars __attribute((alias("xmlSkipBlankChars__internal_alias"))); +#else +#ifndef xmlSkipBlankChars +extern __typeof (xmlSkipBlankChars) xmlSkipBlankChars__internal_alias __attribute((visibility("hidden"))); +#define xmlSkipBlankChars xmlSkipBlankChars__internal_alias +#endif +#endif + +#ifdef bottom_valid +#undef xmlSnprintfElementContent +extern __typeof (xmlSnprintfElementContent) xmlSnprintfElementContent __attribute((alias("xmlSnprintfElementContent__internal_alias"))); +#else +#ifndef xmlSnprintfElementContent +extern __typeof (xmlSnprintfElementContent) xmlSnprintfElementContent__internal_alias __attribute((visibility("hidden"))); +#define xmlSnprintfElementContent xmlSnprintfElementContent__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlSplitQName +extern __typeof (xmlSplitQName) xmlSplitQName __attribute((alias("xmlSplitQName__internal_alias"))); +#else +#ifndef xmlSplitQName +extern __typeof (xmlSplitQName) xmlSplitQName__internal_alias __attribute((visibility("hidden"))); +#define xmlSplitQName xmlSplitQName__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlSplitQName2 +extern __typeof (xmlSplitQName2) xmlSplitQName2 __attribute((alias("xmlSplitQName2__internal_alias"))); +#else +#ifndef xmlSplitQName2 +extern __typeof (xmlSplitQName2) xmlSplitQName2__internal_alias __attribute((visibility("hidden"))); +#define xmlSplitQName2 xmlSplitQName2__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlSplitQName3 +extern __typeof (xmlSplitQName3) xmlSplitQName3 __attribute((alias("xmlSplitQName3__internal_alias"))); +#else +#ifndef xmlSplitQName3 +extern __typeof (xmlSplitQName3) xmlSplitQName3__internal_alias __attribute((visibility("hidden"))); +#define xmlSplitQName3 xmlSplitQName3__internal_alias +#endif +#endif + +#if defined(LIBXML_OUTPUT_ENABLED) +#ifdef bottom_valid +#undef xmlSprintfElementContent +extern __typeof (xmlSprintfElementContent) xmlSprintfElementContent __attribute((alias("xmlSprintfElementContent__internal_alias"))); +#else +#ifndef xmlSprintfElementContent +extern __typeof (xmlSprintfElementContent) xmlSprintfElementContent__internal_alias __attribute((visibility("hidden"))); +#define xmlSprintfElementContent xmlSprintfElementContent__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parser +#undef xmlStopParser +extern __typeof (xmlStopParser) xmlStopParser __attribute((alias("xmlStopParser__internal_alias"))); +#else +#ifndef xmlStopParser +extern __typeof (xmlStopParser) xmlStopParser__internal_alias __attribute((visibility("hidden"))); +#define xmlStopParser xmlStopParser__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrEqual +extern __typeof (xmlStrEqual) xmlStrEqual __attribute((alias("xmlStrEqual__internal_alias"))); +#else +#ifndef xmlStrEqual +extern __typeof (xmlStrEqual) xmlStrEqual__internal_alias __attribute((visibility("hidden"))); +#define xmlStrEqual xmlStrEqual__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrPrintf +extern __typeof (xmlStrPrintf) xmlStrPrintf __attribute((alias("xmlStrPrintf__internal_alias"))); +#else +#ifndef xmlStrPrintf +extern __typeof (xmlStrPrintf) xmlStrPrintf__internal_alias __attribute((visibility("hidden"))); +#define xmlStrPrintf xmlStrPrintf__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrQEqual +extern __typeof (xmlStrQEqual) xmlStrQEqual __attribute((alias("xmlStrQEqual__internal_alias"))); +#else +#ifndef xmlStrQEqual +extern __typeof (xmlStrQEqual) xmlStrQEqual__internal_alias __attribute((visibility("hidden"))); +#define xmlStrQEqual xmlStrQEqual__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrVPrintf +extern __typeof (xmlStrVPrintf) xmlStrVPrintf __attribute((alias("xmlStrVPrintf__internal_alias"))); +#else +#ifndef xmlStrVPrintf +extern __typeof (xmlStrVPrintf) xmlStrVPrintf__internal_alias __attribute((visibility("hidden"))); +#define xmlStrVPrintf xmlStrVPrintf__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrcasecmp +extern __typeof (xmlStrcasecmp) xmlStrcasecmp __attribute((alias("xmlStrcasecmp__internal_alias"))); +#else +#ifndef xmlStrcasecmp +extern __typeof (xmlStrcasecmp) xmlStrcasecmp__internal_alias __attribute((visibility("hidden"))); +#define xmlStrcasecmp xmlStrcasecmp__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrcasestr +extern __typeof (xmlStrcasestr) xmlStrcasestr __attribute((alias("xmlStrcasestr__internal_alias"))); +#else +#ifndef xmlStrcasestr +extern __typeof (xmlStrcasestr) xmlStrcasestr__internal_alias __attribute((visibility("hidden"))); +#define xmlStrcasestr xmlStrcasestr__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrcat +extern __typeof (xmlStrcat) xmlStrcat __attribute((alias("xmlStrcat__internal_alias"))); +#else +#ifndef xmlStrcat +extern __typeof (xmlStrcat) xmlStrcat__internal_alias __attribute((visibility("hidden"))); +#define xmlStrcat xmlStrcat__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrchr +extern __typeof (xmlStrchr) xmlStrchr __attribute((alias("xmlStrchr__internal_alias"))); +#else +#ifndef xmlStrchr +extern __typeof (xmlStrchr) xmlStrchr__internal_alias __attribute((visibility("hidden"))); +#define xmlStrchr xmlStrchr__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrcmp +extern __typeof (xmlStrcmp) xmlStrcmp __attribute((alias("xmlStrcmp__internal_alias"))); +#else +#ifndef xmlStrcmp +extern __typeof (xmlStrcmp) xmlStrcmp__internal_alias __attribute((visibility("hidden"))); +#define xmlStrcmp xmlStrcmp__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrdup +extern __typeof (xmlStrdup) xmlStrdup __attribute((alias("xmlStrdup__internal_alias"))); +#else +#ifndef xmlStrdup +extern __typeof (xmlStrdup) xmlStrdup__internal_alias __attribute((visibility("hidden"))); +#define xmlStrdup xmlStrdup__internal_alias +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlStreamPop +extern __typeof (xmlStreamPop) xmlStreamPop __attribute((alias("xmlStreamPop__internal_alias"))); +#else +#ifndef xmlStreamPop +extern __typeof (xmlStreamPop) xmlStreamPop__internal_alias __attribute((visibility("hidden"))); +#define xmlStreamPop xmlStreamPop__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlStreamPush +extern __typeof (xmlStreamPush) xmlStreamPush __attribute((alias("xmlStreamPush__internal_alias"))); +#else +#ifndef xmlStreamPush +extern __typeof (xmlStreamPush) xmlStreamPush__internal_alias __attribute((visibility("hidden"))); +#define xmlStreamPush xmlStreamPush__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlStreamPushAttr +extern __typeof (xmlStreamPushAttr) xmlStreamPushAttr __attribute((alias("xmlStreamPushAttr__internal_alias"))); +#else +#ifndef xmlStreamPushAttr +extern __typeof (xmlStreamPushAttr) xmlStreamPushAttr__internal_alias __attribute((visibility("hidden"))); +#define xmlStreamPushAttr xmlStreamPushAttr__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlStreamPushNode +extern __typeof (xmlStreamPushNode) xmlStreamPushNode __attribute((alias("xmlStreamPushNode__internal_alias"))); +#else +#ifndef xmlStreamPushNode +extern __typeof (xmlStreamPushNode) xmlStreamPushNode__internal_alias __attribute((visibility("hidden"))); +#define xmlStreamPushNode xmlStreamPushNode__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_pattern +#undef xmlStreamWantsAnyNode +extern __typeof (xmlStreamWantsAnyNode) xmlStreamWantsAnyNode __attribute((alias("xmlStreamWantsAnyNode__internal_alias"))); +#else +#ifndef xmlStreamWantsAnyNode +extern __typeof (xmlStreamWantsAnyNode) xmlStreamWantsAnyNode__internal_alias __attribute((visibility("hidden"))); +#define xmlStreamWantsAnyNode xmlStreamWantsAnyNode__internal_alias +#endif +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlStringCurrentChar +extern __typeof (xmlStringCurrentChar) xmlStringCurrentChar __attribute((alias("xmlStringCurrentChar__internal_alias"))); +#else +#ifndef xmlStringCurrentChar +extern __typeof (xmlStringCurrentChar) xmlStringCurrentChar__internal_alias __attribute((visibility("hidden"))); +#define xmlStringCurrentChar xmlStringCurrentChar__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlStringDecodeEntities +extern __typeof (xmlStringDecodeEntities) xmlStringDecodeEntities __attribute((alias("xmlStringDecodeEntities__internal_alias"))); +#else +#ifndef xmlStringDecodeEntities +extern __typeof (xmlStringDecodeEntities) xmlStringDecodeEntities__internal_alias __attribute((visibility("hidden"))); +#define xmlStringDecodeEntities xmlStringDecodeEntities__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlStringGetNodeList +extern __typeof (xmlStringGetNodeList) xmlStringGetNodeList __attribute((alias("xmlStringGetNodeList__internal_alias"))); +#else +#ifndef xmlStringGetNodeList +extern __typeof (xmlStringGetNodeList) xmlStringGetNodeList__internal_alias __attribute((visibility("hidden"))); +#define xmlStringGetNodeList xmlStringGetNodeList__internal_alias +#endif +#endif + +#ifdef bottom_parser +#undef xmlStringLenDecodeEntities +extern __typeof (xmlStringLenDecodeEntities) xmlStringLenDecodeEntities __attribute((alias("xmlStringLenDecodeEntities__internal_alias"))); +#else +#ifndef xmlStringLenDecodeEntities +extern __typeof (xmlStringLenDecodeEntities) xmlStringLenDecodeEntities__internal_alias __attribute((visibility("hidden"))); +#define xmlStringLenDecodeEntities xmlStringLenDecodeEntities__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlStringLenGetNodeList +extern __typeof (xmlStringLenGetNodeList) xmlStringLenGetNodeList __attribute((alias("xmlStringLenGetNodeList__internal_alias"))); +#else +#ifndef xmlStringLenGetNodeList +extern __typeof (xmlStringLenGetNodeList) xmlStringLenGetNodeList__internal_alias __attribute((visibility("hidden"))); +#define xmlStringLenGetNodeList xmlStringLenGetNodeList__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrlen +extern __typeof (xmlStrlen) xmlStrlen __attribute((alias("xmlStrlen__internal_alias"))); +#else +#ifndef xmlStrlen +extern __typeof (xmlStrlen) xmlStrlen__internal_alias __attribute((visibility("hidden"))); +#define xmlStrlen xmlStrlen__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrncasecmp +extern __typeof (xmlStrncasecmp) xmlStrncasecmp __attribute((alias("xmlStrncasecmp__internal_alias"))); +#else +#ifndef xmlStrncasecmp +extern __typeof (xmlStrncasecmp) xmlStrncasecmp__internal_alias __attribute((visibility("hidden"))); +#define xmlStrncasecmp xmlStrncasecmp__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrncat +extern __typeof (xmlStrncat) xmlStrncat __attribute((alias("xmlStrncat__internal_alias"))); +#else +#ifndef xmlStrncat +extern __typeof (xmlStrncat) xmlStrncat__internal_alias __attribute((visibility("hidden"))); +#define xmlStrncat xmlStrncat__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrncatNew +extern __typeof (xmlStrncatNew) xmlStrncatNew __attribute((alias("xmlStrncatNew__internal_alias"))); +#else +#ifndef xmlStrncatNew +extern __typeof (xmlStrncatNew) xmlStrncatNew__internal_alias __attribute((visibility("hidden"))); +#define xmlStrncatNew xmlStrncatNew__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrncmp +extern __typeof (xmlStrncmp) xmlStrncmp __attribute((alias("xmlStrncmp__internal_alias"))); +#else +#ifndef xmlStrncmp +extern __typeof (xmlStrncmp) xmlStrncmp__internal_alias __attribute((visibility("hidden"))); +#define xmlStrncmp xmlStrncmp__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrndup +extern __typeof (xmlStrndup) xmlStrndup __attribute((alias("xmlStrndup__internal_alias"))); +#else +#ifndef xmlStrndup +extern __typeof (xmlStrndup) xmlStrndup__internal_alias __attribute((visibility("hidden"))); +#define xmlStrndup xmlStrndup__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrstr +extern __typeof (xmlStrstr) xmlStrstr __attribute((alias("xmlStrstr__internal_alias"))); +#else +#ifndef xmlStrstr +extern __typeof (xmlStrstr) xmlStrstr__internal_alias __attribute((visibility("hidden"))); +#define xmlStrstr xmlStrstr__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlStrsub +extern __typeof (xmlStrsub) xmlStrsub __attribute((alias("xmlStrsub__internal_alias"))); +#else +#ifndef xmlStrsub +extern __typeof (xmlStrsub) xmlStrsub__internal_alias __attribute((visibility("hidden"))); +#define xmlStrsub xmlStrsub__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlSubstituteEntitiesDefault +extern __typeof (xmlSubstituteEntitiesDefault) xmlSubstituteEntitiesDefault __attribute((alias("xmlSubstituteEntitiesDefault__internal_alias"))); +#else +#ifndef xmlSubstituteEntitiesDefault +extern __typeof (xmlSubstituteEntitiesDefault) xmlSubstituteEntitiesDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlSubstituteEntitiesDefault xmlSubstituteEntitiesDefault__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlSwitchEncoding +extern __typeof (xmlSwitchEncoding) xmlSwitchEncoding __attribute((alias("xmlSwitchEncoding__internal_alias"))); +#else +#ifndef xmlSwitchEncoding +extern __typeof (xmlSwitchEncoding) xmlSwitchEncoding__internal_alias __attribute((visibility("hidden"))); +#define xmlSwitchEncoding xmlSwitchEncoding__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlSwitchInputEncoding +extern __typeof (xmlSwitchInputEncoding) xmlSwitchInputEncoding __attribute((alias("xmlSwitchInputEncoding__internal_alias"))); +#else +#ifndef xmlSwitchInputEncoding +extern __typeof (xmlSwitchInputEncoding) xmlSwitchInputEncoding__internal_alias __attribute((visibility("hidden"))); +#define xmlSwitchInputEncoding xmlSwitchInputEncoding__internal_alias +#endif +#endif + +#ifdef bottom_parserInternals +#undef xmlSwitchToEncoding +extern __typeof (xmlSwitchToEncoding) xmlSwitchToEncoding __attribute((alias("xmlSwitchToEncoding__internal_alias"))); +#else +#ifndef xmlSwitchToEncoding +extern __typeof (xmlSwitchToEncoding) xmlSwitchToEncoding__internal_alias __attribute((visibility("hidden"))); +#define xmlSwitchToEncoding xmlSwitchToEncoding__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlTextConcat +extern __typeof (xmlTextConcat) xmlTextConcat __attribute((alias("xmlTextConcat__internal_alias"))); +#else +#ifndef xmlTextConcat +extern __typeof (xmlTextConcat) xmlTextConcat__internal_alias __attribute((visibility("hidden"))); +#define xmlTextConcat xmlTextConcat__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlTextMerge +extern __typeof (xmlTextMerge) xmlTextMerge __attribute((alias("xmlTextMerge__internal_alias"))); +#else +#ifndef xmlTextMerge +extern __typeof (xmlTextMerge) xmlTextMerge__internal_alias __attribute((visibility("hidden"))); +#define xmlTextMerge xmlTextMerge__internal_alias +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderAttributeCount +extern __typeof (xmlTextReaderAttributeCount) xmlTextReaderAttributeCount __attribute((alias("xmlTextReaderAttributeCount__internal_alias"))); +#else +#ifndef xmlTextReaderAttributeCount +extern __typeof (xmlTextReaderAttributeCount) xmlTextReaderAttributeCount__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderAttributeCount xmlTextReaderAttributeCount__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderBaseUri +extern __typeof (xmlTextReaderBaseUri) xmlTextReaderBaseUri __attribute((alias("xmlTextReaderBaseUri__internal_alias"))); +#else +#ifndef xmlTextReaderBaseUri +extern __typeof (xmlTextReaderBaseUri) xmlTextReaderBaseUri__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderBaseUri xmlTextReaderBaseUri__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderByteConsumed +extern __typeof (xmlTextReaderByteConsumed) xmlTextReaderByteConsumed __attribute((alias("xmlTextReaderByteConsumed__internal_alias"))); +#else +#ifndef xmlTextReaderByteConsumed +extern __typeof (xmlTextReaderByteConsumed) xmlTextReaderByteConsumed__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderByteConsumed xmlTextReaderByteConsumed__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderClose +extern __typeof (xmlTextReaderClose) xmlTextReaderClose __attribute((alias("xmlTextReaderClose__internal_alias"))); +#else +#ifndef xmlTextReaderClose +extern __typeof (xmlTextReaderClose) xmlTextReaderClose__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderClose xmlTextReaderClose__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderConstBaseUri +extern __typeof (xmlTextReaderConstBaseUri) xmlTextReaderConstBaseUri __attribute((alias("xmlTextReaderConstBaseUri__internal_alias"))); +#else +#ifndef xmlTextReaderConstBaseUri +extern __typeof (xmlTextReaderConstBaseUri) xmlTextReaderConstBaseUri__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderConstBaseUri xmlTextReaderConstBaseUri__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderConstEncoding +extern __typeof (xmlTextReaderConstEncoding) xmlTextReaderConstEncoding __attribute((alias("xmlTextReaderConstEncoding__internal_alias"))); +#else +#ifndef xmlTextReaderConstEncoding +extern __typeof (xmlTextReaderConstEncoding) xmlTextReaderConstEncoding__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderConstEncoding xmlTextReaderConstEncoding__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderConstLocalName +extern __typeof (xmlTextReaderConstLocalName) xmlTextReaderConstLocalName __attribute((alias("xmlTextReaderConstLocalName__internal_alias"))); +#else +#ifndef xmlTextReaderConstLocalName +extern __typeof (xmlTextReaderConstLocalName) xmlTextReaderConstLocalName__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderConstLocalName xmlTextReaderConstLocalName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderConstName +extern __typeof (xmlTextReaderConstName) xmlTextReaderConstName __attribute((alias("xmlTextReaderConstName__internal_alias"))); +#else +#ifndef xmlTextReaderConstName +extern __typeof (xmlTextReaderConstName) xmlTextReaderConstName__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderConstName xmlTextReaderConstName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderConstNamespaceUri +extern __typeof (xmlTextReaderConstNamespaceUri) xmlTextReaderConstNamespaceUri __attribute((alias("xmlTextReaderConstNamespaceUri__internal_alias"))); +#else +#ifndef xmlTextReaderConstNamespaceUri +extern __typeof (xmlTextReaderConstNamespaceUri) xmlTextReaderConstNamespaceUri__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderConstNamespaceUri xmlTextReaderConstNamespaceUri__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderConstPrefix +extern __typeof (xmlTextReaderConstPrefix) xmlTextReaderConstPrefix __attribute((alias("xmlTextReaderConstPrefix__internal_alias"))); +#else +#ifndef xmlTextReaderConstPrefix +extern __typeof (xmlTextReaderConstPrefix) xmlTextReaderConstPrefix__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderConstPrefix xmlTextReaderConstPrefix__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderConstString +extern __typeof (xmlTextReaderConstString) xmlTextReaderConstString __attribute((alias("xmlTextReaderConstString__internal_alias"))); +#else +#ifndef xmlTextReaderConstString +extern __typeof (xmlTextReaderConstString) xmlTextReaderConstString__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderConstString xmlTextReaderConstString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderConstValue +extern __typeof (xmlTextReaderConstValue) xmlTextReaderConstValue __attribute((alias("xmlTextReaderConstValue__internal_alias"))); +#else +#ifndef xmlTextReaderConstValue +extern __typeof (xmlTextReaderConstValue) xmlTextReaderConstValue__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderConstValue xmlTextReaderConstValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderConstXmlLang +extern __typeof (xmlTextReaderConstXmlLang) xmlTextReaderConstXmlLang __attribute((alias("xmlTextReaderConstXmlLang__internal_alias"))); +#else +#ifndef xmlTextReaderConstXmlLang +extern __typeof (xmlTextReaderConstXmlLang) xmlTextReaderConstXmlLang__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderConstXmlLang xmlTextReaderConstXmlLang__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderConstXmlVersion +extern __typeof (xmlTextReaderConstXmlVersion) xmlTextReaderConstXmlVersion __attribute((alias("xmlTextReaderConstXmlVersion__internal_alias"))); +#else +#ifndef xmlTextReaderConstXmlVersion +extern __typeof (xmlTextReaderConstXmlVersion) xmlTextReaderConstXmlVersion__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderConstXmlVersion xmlTextReaderConstXmlVersion__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderCurrentDoc +extern __typeof (xmlTextReaderCurrentDoc) xmlTextReaderCurrentDoc __attribute((alias("xmlTextReaderCurrentDoc__internal_alias"))); +#else +#ifndef xmlTextReaderCurrentDoc +extern __typeof (xmlTextReaderCurrentDoc) xmlTextReaderCurrentDoc__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderCurrentDoc xmlTextReaderCurrentDoc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderCurrentNode +extern __typeof (xmlTextReaderCurrentNode) xmlTextReaderCurrentNode __attribute((alias("xmlTextReaderCurrentNode__internal_alias"))); +#else +#ifndef xmlTextReaderCurrentNode +extern __typeof (xmlTextReaderCurrentNode) xmlTextReaderCurrentNode__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderCurrentNode xmlTextReaderCurrentNode__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderDepth +extern __typeof (xmlTextReaderDepth) xmlTextReaderDepth __attribute((alias("xmlTextReaderDepth__internal_alias"))); +#else +#ifndef xmlTextReaderDepth +extern __typeof (xmlTextReaderDepth) xmlTextReaderDepth__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderDepth xmlTextReaderDepth__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderExpand +extern __typeof (xmlTextReaderExpand) xmlTextReaderExpand __attribute((alias("xmlTextReaderExpand__internal_alias"))); +#else +#ifndef xmlTextReaderExpand +extern __typeof (xmlTextReaderExpand) xmlTextReaderExpand__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderExpand xmlTextReaderExpand__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderGetAttribute +extern __typeof (xmlTextReaderGetAttribute) xmlTextReaderGetAttribute __attribute((alias("xmlTextReaderGetAttribute__internal_alias"))); +#else +#ifndef xmlTextReaderGetAttribute +extern __typeof (xmlTextReaderGetAttribute) xmlTextReaderGetAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderGetAttribute xmlTextReaderGetAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderGetAttributeNo +extern __typeof (xmlTextReaderGetAttributeNo) xmlTextReaderGetAttributeNo __attribute((alias("xmlTextReaderGetAttributeNo__internal_alias"))); +#else +#ifndef xmlTextReaderGetAttributeNo +extern __typeof (xmlTextReaderGetAttributeNo) xmlTextReaderGetAttributeNo__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderGetAttributeNo xmlTextReaderGetAttributeNo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderGetAttributeNs +extern __typeof (xmlTextReaderGetAttributeNs) xmlTextReaderGetAttributeNs __attribute((alias("xmlTextReaderGetAttributeNs__internal_alias"))); +#else +#ifndef xmlTextReaderGetAttributeNs +extern __typeof (xmlTextReaderGetAttributeNs) xmlTextReaderGetAttributeNs__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderGetAttributeNs xmlTextReaderGetAttributeNs__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderGetErrorHandler +extern __typeof (xmlTextReaderGetErrorHandler) xmlTextReaderGetErrorHandler __attribute((alias("xmlTextReaderGetErrorHandler__internal_alias"))); +#else +#ifndef xmlTextReaderGetErrorHandler +extern __typeof (xmlTextReaderGetErrorHandler) xmlTextReaderGetErrorHandler__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderGetErrorHandler xmlTextReaderGetErrorHandler__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderGetParserColumnNumber +extern __typeof (xmlTextReaderGetParserColumnNumber) xmlTextReaderGetParserColumnNumber __attribute((alias("xmlTextReaderGetParserColumnNumber__internal_alias"))); +#else +#ifndef xmlTextReaderGetParserColumnNumber +extern __typeof (xmlTextReaderGetParserColumnNumber) xmlTextReaderGetParserColumnNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderGetParserColumnNumber xmlTextReaderGetParserColumnNumber__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderGetParserLineNumber +extern __typeof (xmlTextReaderGetParserLineNumber) xmlTextReaderGetParserLineNumber __attribute((alias("xmlTextReaderGetParserLineNumber__internal_alias"))); +#else +#ifndef xmlTextReaderGetParserLineNumber +extern __typeof (xmlTextReaderGetParserLineNumber) xmlTextReaderGetParserLineNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderGetParserLineNumber xmlTextReaderGetParserLineNumber__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderGetParserProp +extern __typeof (xmlTextReaderGetParserProp) xmlTextReaderGetParserProp __attribute((alias("xmlTextReaderGetParserProp__internal_alias"))); +#else +#ifndef xmlTextReaderGetParserProp +extern __typeof (xmlTextReaderGetParserProp) xmlTextReaderGetParserProp__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderGetParserProp xmlTextReaderGetParserProp__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderGetRemainder +extern __typeof (xmlTextReaderGetRemainder) xmlTextReaderGetRemainder __attribute((alias("xmlTextReaderGetRemainder__internal_alias"))); +#else +#ifndef xmlTextReaderGetRemainder +extern __typeof (xmlTextReaderGetRemainder) xmlTextReaderGetRemainder__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderGetRemainder xmlTextReaderGetRemainder__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderHasAttributes +extern __typeof (xmlTextReaderHasAttributes) xmlTextReaderHasAttributes __attribute((alias("xmlTextReaderHasAttributes__internal_alias"))); +#else +#ifndef xmlTextReaderHasAttributes +extern __typeof (xmlTextReaderHasAttributes) xmlTextReaderHasAttributes__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderHasAttributes xmlTextReaderHasAttributes__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderHasValue +extern __typeof (xmlTextReaderHasValue) xmlTextReaderHasValue __attribute((alias("xmlTextReaderHasValue__internal_alias"))); +#else +#ifndef xmlTextReaderHasValue +extern __typeof (xmlTextReaderHasValue) xmlTextReaderHasValue__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderHasValue xmlTextReaderHasValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderIsDefault +extern __typeof (xmlTextReaderIsDefault) xmlTextReaderIsDefault __attribute((alias("xmlTextReaderIsDefault__internal_alias"))); +#else +#ifndef xmlTextReaderIsDefault +extern __typeof (xmlTextReaderIsDefault) xmlTextReaderIsDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderIsDefault xmlTextReaderIsDefault__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderIsEmptyElement +extern __typeof (xmlTextReaderIsEmptyElement) xmlTextReaderIsEmptyElement __attribute((alias("xmlTextReaderIsEmptyElement__internal_alias"))); +#else +#ifndef xmlTextReaderIsEmptyElement +extern __typeof (xmlTextReaderIsEmptyElement) xmlTextReaderIsEmptyElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderIsEmptyElement xmlTextReaderIsEmptyElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderIsNamespaceDecl +extern __typeof (xmlTextReaderIsNamespaceDecl) xmlTextReaderIsNamespaceDecl __attribute((alias("xmlTextReaderIsNamespaceDecl__internal_alias"))); +#else +#ifndef xmlTextReaderIsNamespaceDecl +extern __typeof (xmlTextReaderIsNamespaceDecl) xmlTextReaderIsNamespaceDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderIsNamespaceDecl xmlTextReaderIsNamespaceDecl__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderIsValid +extern __typeof (xmlTextReaderIsValid) xmlTextReaderIsValid __attribute((alias("xmlTextReaderIsValid__internal_alias"))); +#else +#ifndef xmlTextReaderIsValid +extern __typeof (xmlTextReaderIsValid) xmlTextReaderIsValid__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderIsValid xmlTextReaderIsValid__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderLocalName +extern __typeof (xmlTextReaderLocalName) xmlTextReaderLocalName __attribute((alias("xmlTextReaderLocalName__internal_alias"))); +#else +#ifndef xmlTextReaderLocalName +extern __typeof (xmlTextReaderLocalName) xmlTextReaderLocalName__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderLocalName xmlTextReaderLocalName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderLocatorBaseURI +extern __typeof (xmlTextReaderLocatorBaseURI) xmlTextReaderLocatorBaseURI __attribute((alias("xmlTextReaderLocatorBaseURI__internal_alias"))); +#else +#ifndef xmlTextReaderLocatorBaseURI +extern __typeof (xmlTextReaderLocatorBaseURI) xmlTextReaderLocatorBaseURI__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderLocatorBaseURI xmlTextReaderLocatorBaseURI__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderLocatorLineNumber +extern __typeof (xmlTextReaderLocatorLineNumber) xmlTextReaderLocatorLineNumber __attribute((alias("xmlTextReaderLocatorLineNumber__internal_alias"))); +#else +#ifndef xmlTextReaderLocatorLineNumber +extern __typeof (xmlTextReaderLocatorLineNumber) xmlTextReaderLocatorLineNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderLocatorLineNumber xmlTextReaderLocatorLineNumber__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderLookupNamespace +extern __typeof (xmlTextReaderLookupNamespace) xmlTextReaderLookupNamespace __attribute((alias("xmlTextReaderLookupNamespace__internal_alias"))); +#else +#ifndef xmlTextReaderLookupNamespace +extern __typeof (xmlTextReaderLookupNamespace) xmlTextReaderLookupNamespace__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderLookupNamespace xmlTextReaderLookupNamespace__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderMoveToAttribute +extern __typeof (xmlTextReaderMoveToAttribute) xmlTextReaderMoveToAttribute __attribute((alias("xmlTextReaderMoveToAttribute__internal_alias"))); +#else +#ifndef xmlTextReaderMoveToAttribute +extern __typeof (xmlTextReaderMoveToAttribute) xmlTextReaderMoveToAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderMoveToAttribute xmlTextReaderMoveToAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderMoveToAttributeNo +extern __typeof (xmlTextReaderMoveToAttributeNo) xmlTextReaderMoveToAttributeNo __attribute((alias("xmlTextReaderMoveToAttributeNo__internal_alias"))); +#else +#ifndef xmlTextReaderMoveToAttributeNo +extern __typeof (xmlTextReaderMoveToAttributeNo) xmlTextReaderMoveToAttributeNo__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderMoveToAttributeNo xmlTextReaderMoveToAttributeNo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderMoveToAttributeNs +extern __typeof (xmlTextReaderMoveToAttributeNs) xmlTextReaderMoveToAttributeNs __attribute((alias("xmlTextReaderMoveToAttributeNs__internal_alias"))); +#else +#ifndef xmlTextReaderMoveToAttributeNs +extern __typeof (xmlTextReaderMoveToAttributeNs) xmlTextReaderMoveToAttributeNs__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderMoveToAttributeNs xmlTextReaderMoveToAttributeNs__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderMoveToElement +extern __typeof (xmlTextReaderMoveToElement) xmlTextReaderMoveToElement __attribute((alias("xmlTextReaderMoveToElement__internal_alias"))); +#else +#ifndef xmlTextReaderMoveToElement +extern __typeof (xmlTextReaderMoveToElement) xmlTextReaderMoveToElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderMoveToElement xmlTextReaderMoveToElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderMoveToFirstAttribute +extern __typeof (xmlTextReaderMoveToFirstAttribute) xmlTextReaderMoveToFirstAttribute __attribute((alias("xmlTextReaderMoveToFirstAttribute__internal_alias"))); +#else +#ifndef xmlTextReaderMoveToFirstAttribute +extern __typeof (xmlTextReaderMoveToFirstAttribute) xmlTextReaderMoveToFirstAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderMoveToFirstAttribute xmlTextReaderMoveToFirstAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderMoveToNextAttribute +extern __typeof (xmlTextReaderMoveToNextAttribute) xmlTextReaderMoveToNextAttribute __attribute((alias("xmlTextReaderMoveToNextAttribute__internal_alias"))); +#else +#ifndef xmlTextReaderMoveToNextAttribute +extern __typeof (xmlTextReaderMoveToNextAttribute) xmlTextReaderMoveToNextAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderMoveToNextAttribute xmlTextReaderMoveToNextAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderName +extern __typeof (xmlTextReaderName) xmlTextReaderName __attribute((alias("xmlTextReaderName__internal_alias"))); +#else +#ifndef xmlTextReaderName +extern __typeof (xmlTextReaderName) xmlTextReaderName__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderName xmlTextReaderName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderNamespaceUri +extern __typeof (xmlTextReaderNamespaceUri) xmlTextReaderNamespaceUri __attribute((alias("xmlTextReaderNamespaceUri__internal_alias"))); +#else +#ifndef xmlTextReaderNamespaceUri +extern __typeof (xmlTextReaderNamespaceUri) xmlTextReaderNamespaceUri__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderNamespaceUri xmlTextReaderNamespaceUri__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderNext +extern __typeof (xmlTextReaderNext) xmlTextReaderNext __attribute((alias("xmlTextReaderNext__internal_alias"))); +#else +#ifndef xmlTextReaderNext +extern __typeof (xmlTextReaderNext) xmlTextReaderNext__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderNext xmlTextReaderNext__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderNextSibling +extern __typeof (xmlTextReaderNextSibling) xmlTextReaderNextSibling __attribute((alias("xmlTextReaderNextSibling__internal_alias"))); +#else +#ifndef xmlTextReaderNextSibling +extern __typeof (xmlTextReaderNextSibling) xmlTextReaderNextSibling__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderNextSibling xmlTextReaderNextSibling__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderNodeType +extern __typeof (xmlTextReaderNodeType) xmlTextReaderNodeType __attribute((alias("xmlTextReaderNodeType__internal_alias"))); +#else +#ifndef xmlTextReaderNodeType +extern __typeof (xmlTextReaderNodeType) xmlTextReaderNodeType__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderNodeType xmlTextReaderNodeType__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderNormalization +extern __typeof (xmlTextReaderNormalization) xmlTextReaderNormalization __attribute((alias("xmlTextReaderNormalization__internal_alias"))); +#else +#ifndef xmlTextReaderNormalization +extern __typeof (xmlTextReaderNormalization) xmlTextReaderNormalization__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderNormalization xmlTextReaderNormalization__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderPrefix +extern __typeof (xmlTextReaderPrefix) xmlTextReaderPrefix __attribute((alias("xmlTextReaderPrefix__internal_alias"))); +#else +#ifndef xmlTextReaderPrefix +extern __typeof (xmlTextReaderPrefix) xmlTextReaderPrefix__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderPrefix xmlTextReaderPrefix__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderPreserve +extern __typeof (xmlTextReaderPreserve) xmlTextReaderPreserve __attribute((alias("xmlTextReaderPreserve__internal_alias"))); +#else +#ifndef xmlTextReaderPreserve +extern __typeof (xmlTextReaderPreserve) xmlTextReaderPreserve__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderPreserve xmlTextReaderPreserve__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderPreservePattern +extern __typeof (xmlTextReaderPreservePattern) xmlTextReaderPreservePattern __attribute((alias("xmlTextReaderPreservePattern__internal_alias"))); +#else +#ifndef xmlTextReaderPreservePattern +extern __typeof (xmlTextReaderPreservePattern) xmlTextReaderPreservePattern__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderPreservePattern xmlTextReaderPreservePattern__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderQuoteChar +extern __typeof (xmlTextReaderQuoteChar) xmlTextReaderQuoteChar __attribute((alias("xmlTextReaderQuoteChar__internal_alias"))); +#else +#ifndef xmlTextReaderQuoteChar +extern __typeof (xmlTextReaderQuoteChar) xmlTextReaderQuoteChar__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderQuoteChar xmlTextReaderQuoteChar__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderRead +extern __typeof (xmlTextReaderRead) xmlTextReaderRead __attribute((alias("xmlTextReaderRead__internal_alias"))); +#else +#ifndef xmlTextReaderRead +extern __typeof (xmlTextReaderRead) xmlTextReaderRead__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderRead xmlTextReaderRead__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderReadAttributeValue +extern __typeof (xmlTextReaderReadAttributeValue) xmlTextReaderReadAttributeValue __attribute((alias("xmlTextReaderReadAttributeValue__internal_alias"))); +#else +#ifndef xmlTextReaderReadAttributeValue +extern __typeof (xmlTextReaderReadAttributeValue) xmlTextReaderReadAttributeValue__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderReadAttributeValue xmlTextReaderReadAttributeValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderReadInnerXml +extern __typeof (xmlTextReaderReadInnerXml) xmlTextReaderReadInnerXml __attribute((alias("xmlTextReaderReadInnerXml__internal_alias"))); +#else +#ifndef xmlTextReaderReadInnerXml +extern __typeof (xmlTextReaderReadInnerXml) xmlTextReaderReadInnerXml__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderReadInnerXml xmlTextReaderReadInnerXml__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderReadOuterXml +extern __typeof (xmlTextReaderReadOuterXml) xmlTextReaderReadOuterXml __attribute((alias("xmlTextReaderReadOuterXml__internal_alias"))); +#else +#ifndef xmlTextReaderReadOuterXml +extern __typeof (xmlTextReaderReadOuterXml) xmlTextReaderReadOuterXml__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderReadOuterXml xmlTextReaderReadOuterXml__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderReadState +extern __typeof (xmlTextReaderReadState) xmlTextReaderReadState __attribute((alias("xmlTextReaderReadState__internal_alias"))); +#else +#ifndef xmlTextReaderReadState +extern __typeof (xmlTextReaderReadState) xmlTextReaderReadState__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderReadState xmlTextReaderReadState__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderReadString +extern __typeof (xmlTextReaderReadString) xmlTextReaderReadString __attribute((alias("xmlTextReaderReadString__internal_alias"))); +#else +#ifndef xmlTextReaderReadString +extern __typeof (xmlTextReaderReadString) xmlTextReaderReadString__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderReadString xmlTextReaderReadString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderRelaxNGSetSchema +extern __typeof (xmlTextReaderRelaxNGSetSchema) xmlTextReaderRelaxNGSetSchema __attribute((alias("xmlTextReaderRelaxNGSetSchema__internal_alias"))); +#else +#ifndef xmlTextReaderRelaxNGSetSchema +extern __typeof (xmlTextReaderRelaxNGSetSchema) xmlTextReaderRelaxNGSetSchema__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderRelaxNGSetSchema xmlTextReaderRelaxNGSetSchema__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderRelaxNGValidate +extern __typeof (xmlTextReaderRelaxNGValidate) xmlTextReaderRelaxNGValidate __attribute((alias("xmlTextReaderRelaxNGValidate__internal_alias"))); +#else +#ifndef xmlTextReaderRelaxNGValidate +extern __typeof (xmlTextReaderRelaxNGValidate) xmlTextReaderRelaxNGValidate__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderRelaxNGValidate xmlTextReaderRelaxNGValidate__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderRelaxNGValidateCtxt +extern __typeof (xmlTextReaderRelaxNGValidateCtxt) xmlTextReaderRelaxNGValidateCtxt __attribute((alias("xmlTextReaderRelaxNGValidateCtxt__internal_alias"))); +#else +#ifndef xmlTextReaderRelaxNGValidateCtxt +extern __typeof (xmlTextReaderRelaxNGValidateCtxt) xmlTextReaderRelaxNGValidateCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderRelaxNGValidateCtxt xmlTextReaderRelaxNGValidateCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderSchemaValidate +extern __typeof (xmlTextReaderSchemaValidate) xmlTextReaderSchemaValidate __attribute((alias("xmlTextReaderSchemaValidate__internal_alias"))); +#else +#ifndef xmlTextReaderSchemaValidate +extern __typeof (xmlTextReaderSchemaValidate) xmlTextReaderSchemaValidate__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderSchemaValidate xmlTextReaderSchemaValidate__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderSchemaValidateCtxt +extern __typeof (xmlTextReaderSchemaValidateCtxt) xmlTextReaderSchemaValidateCtxt __attribute((alias("xmlTextReaderSchemaValidateCtxt__internal_alias"))); +#else +#ifndef xmlTextReaderSchemaValidateCtxt +extern __typeof (xmlTextReaderSchemaValidateCtxt) xmlTextReaderSchemaValidateCtxt__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderSchemaValidateCtxt xmlTextReaderSchemaValidateCtxt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderSetErrorHandler +extern __typeof (xmlTextReaderSetErrorHandler) xmlTextReaderSetErrorHandler __attribute((alias("xmlTextReaderSetErrorHandler__internal_alias"))); +#else +#ifndef xmlTextReaderSetErrorHandler +extern __typeof (xmlTextReaderSetErrorHandler) xmlTextReaderSetErrorHandler__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderSetErrorHandler xmlTextReaderSetErrorHandler__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderSetParserProp +extern __typeof (xmlTextReaderSetParserProp) xmlTextReaderSetParserProp __attribute((alias("xmlTextReaderSetParserProp__internal_alias"))); +#else +#ifndef xmlTextReaderSetParserProp +extern __typeof (xmlTextReaderSetParserProp) xmlTextReaderSetParserProp__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderSetParserProp xmlTextReaderSetParserProp__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderSetSchema +extern __typeof (xmlTextReaderSetSchema) xmlTextReaderSetSchema __attribute((alias("xmlTextReaderSetSchema__internal_alias"))); +#else +#ifndef xmlTextReaderSetSchema +extern __typeof (xmlTextReaderSetSchema) xmlTextReaderSetSchema__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderSetSchema xmlTextReaderSetSchema__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderSetStructuredErrorHandler +extern __typeof (xmlTextReaderSetStructuredErrorHandler) xmlTextReaderSetStructuredErrorHandler __attribute((alias("xmlTextReaderSetStructuredErrorHandler__internal_alias"))); +#else +#ifndef xmlTextReaderSetStructuredErrorHandler +extern __typeof (xmlTextReaderSetStructuredErrorHandler) xmlTextReaderSetStructuredErrorHandler__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderSetStructuredErrorHandler xmlTextReaderSetStructuredErrorHandler__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderSetup +extern __typeof (xmlTextReaderSetup) xmlTextReaderSetup __attribute((alias("xmlTextReaderSetup__internal_alias"))); +#else +#ifndef xmlTextReaderSetup +extern __typeof (xmlTextReaderSetup) xmlTextReaderSetup__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderSetup xmlTextReaderSetup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderStandalone +extern __typeof (xmlTextReaderStandalone) xmlTextReaderStandalone __attribute((alias("xmlTextReaderStandalone__internal_alias"))); +#else +#ifndef xmlTextReaderStandalone +extern __typeof (xmlTextReaderStandalone) xmlTextReaderStandalone__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderStandalone xmlTextReaderStandalone__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderValue +extern __typeof (xmlTextReaderValue) xmlTextReaderValue __attribute((alias("xmlTextReaderValue__internal_alias"))); +#else +#ifndef xmlTextReaderValue +extern __typeof (xmlTextReaderValue) xmlTextReaderValue__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderValue xmlTextReaderValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_READER_ENABLED) +#ifdef bottom_xmlreader +#undef xmlTextReaderXmlLang +extern __typeof (xmlTextReaderXmlLang) xmlTextReaderXmlLang __attribute((alias("xmlTextReaderXmlLang__internal_alias"))); +#else +#ifndef xmlTextReaderXmlLang +extern __typeof (xmlTextReaderXmlLang) xmlTextReaderXmlLang__internal_alias __attribute((visibility("hidden"))); +#define xmlTextReaderXmlLang xmlTextReaderXmlLang__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterEndAttribute +extern __typeof (xmlTextWriterEndAttribute) xmlTextWriterEndAttribute __attribute((alias("xmlTextWriterEndAttribute__internal_alias"))); +#else +#ifndef xmlTextWriterEndAttribute +extern __typeof (xmlTextWriterEndAttribute) xmlTextWriterEndAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterEndAttribute xmlTextWriterEndAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterEndCDATA +extern __typeof (xmlTextWriterEndCDATA) xmlTextWriterEndCDATA __attribute((alias("xmlTextWriterEndCDATA__internal_alias"))); +#else +#ifndef xmlTextWriterEndCDATA +extern __typeof (xmlTextWriterEndCDATA) xmlTextWriterEndCDATA__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterEndCDATA xmlTextWriterEndCDATA__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterEndComment +extern __typeof (xmlTextWriterEndComment) xmlTextWriterEndComment __attribute((alias("xmlTextWriterEndComment__internal_alias"))); +#else +#ifndef xmlTextWriterEndComment +extern __typeof (xmlTextWriterEndComment) xmlTextWriterEndComment__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterEndComment xmlTextWriterEndComment__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterEndDTD +extern __typeof (xmlTextWriterEndDTD) xmlTextWriterEndDTD __attribute((alias("xmlTextWriterEndDTD__internal_alias"))); +#else +#ifndef xmlTextWriterEndDTD +extern __typeof (xmlTextWriterEndDTD) xmlTextWriterEndDTD__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterEndDTD xmlTextWriterEndDTD__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterEndDTDAttlist +extern __typeof (xmlTextWriterEndDTDAttlist) xmlTextWriterEndDTDAttlist __attribute((alias("xmlTextWriterEndDTDAttlist__internal_alias"))); +#else +#ifndef xmlTextWriterEndDTDAttlist +extern __typeof (xmlTextWriterEndDTDAttlist) xmlTextWriterEndDTDAttlist__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterEndDTDAttlist xmlTextWriterEndDTDAttlist__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterEndDTDElement +extern __typeof (xmlTextWriterEndDTDElement) xmlTextWriterEndDTDElement __attribute((alias("xmlTextWriterEndDTDElement__internal_alias"))); +#else +#ifndef xmlTextWriterEndDTDElement +extern __typeof (xmlTextWriterEndDTDElement) xmlTextWriterEndDTDElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterEndDTDElement xmlTextWriterEndDTDElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterEndDTDEntity +extern __typeof (xmlTextWriterEndDTDEntity) xmlTextWriterEndDTDEntity __attribute((alias("xmlTextWriterEndDTDEntity__internal_alias"))); +#else +#ifndef xmlTextWriterEndDTDEntity +extern __typeof (xmlTextWriterEndDTDEntity) xmlTextWriterEndDTDEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterEndDTDEntity xmlTextWriterEndDTDEntity__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterEndDocument +extern __typeof (xmlTextWriterEndDocument) xmlTextWriterEndDocument __attribute((alias("xmlTextWriterEndDocument__internal_alias"))); +#else +#ifndef xmlTextWriterEndDocument +extern __typeof (xmlTextWriterEndDocument) xmlTextWriterEndDocument__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterEndDocument xmlTextWriterEndDocument__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterEndElement +extern __typeof (xmlTextWriterEndElement) xmlTextWriterEndElement __attribute((alias("xmlTextWriterEndElement__internal_alias"))); +#else +#ifndef xmlTextWriterEndElement +extern __typeof (xmlTextWriterEndElement) xmlTextWriterEndElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterEndElement xmlTextWriterEndElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterEndPI +extern __typeof (xmlTextWriterEndPI) xmlTextWriterEndPI __attribute((alias("xmlTextWriterEndPI__internal_alias"))); +#else +#ifndef xmlTextWriterEndPI +extern __typeof (xmlTextWriterEndPI) xmlTextWriterEndPI__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterEndPI xmlTextWriterEndPI__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterFlush +extern __typeof (xmlTextWriterFlush) xmlTextWriterFlush __attribute((alias("xmlTextWriterFlush__internal_alias"))); +#else +#ifndef xmlTextWriterFlush +extern __typeof (xmlTextWriterFlush) xmlTextWriterFlush__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterFlush xmlTextWriterFlush__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterFullEndElement +extern __typeof (xmlTextWriterFullEndElement) xmlTextWriterFullEndElement __attribute((alias("xmlTextWriterFullEndElement__internal_alias"))); +#else +#ifndef xmlTextWriterFullEndElement +extern __typeof (xmlTextWriterFullEndElement) xmlTextWriterFullEndElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterFullEndElement xmlTextWriterFullEndElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterSetIndent +extern __typeof (xmlTextWriterSetIndent) xmlTextWriterSetIndent __attribute((alias("xmlTextWriterSetIndent__internal_alias"))); +#else +#ifndef xmlTextWriterSetIndent +extern __typeof (xmlTextWriterSetIndent) xmlTextWriterSetIndent__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterSetIndent xmlTextWriterSetIndent__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterSetIndentString +extern __typeof (xmlTextWriterSetIndentString) xmlTextWriterSetIndentString __attribute((alias("xmlTextWriterSetIndentString__internal_alias"))); +#else +#ifndef xmlTextWriterSetIndentString +extern __typeof (xmlTextWriterSetIndentString) xmlTextWriterSetIndentString__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterSetIndentString xmlTextWriterSetIndentString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterSetQuoteChar +extern __typeof (xmlTextWriterSetQuoteChar) xmlTextWriterSetQuoteChar __attribute((alias("xmlTextWriterSetQuoteChar__internal_alias"))); +#else +#ifndef xmlTextWriterSetQuoteChar +extern __typeof (xmlTextWriterSetQuoteChar) xmlTextWriterSetQuoteChar__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterSetQuoteChar xmlTextWriterSetQuoteChar__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartAttribute +extern __typeof (xmlTextWriterStartAttribute) xmlTextWriterStartAttribute __attribute((alias("xmlTextWriterStartAttribute__internal_alias"))); +#else +#ifndef xmlTextWriterStartAttribute +extern __typeof (xmlTextWriterStartAttribute) xmlTextWriterStartAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartAttribute xmlTextWriterStartAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartAttributeNS +extern __typeof (xmlTextWriterStartAttributeNS) xmlTextWriterStartAttributeNS __attribute((alias("xmlTextWriterStartAttributeNS__internal_alias"))); +#else +#ifndef xmlTextWriterStartAttributeNS +extern __typeof (xmlTextWriterStartAttributeNS) xmlTextWriterStartAttributeNS__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartAttributeNS xmlTextWriterStartAttributeNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartCDATA +extern __typeof (xmlTextWriterStartCDATA) xmlTextWriterStartCDATA __attribute((alias("xmlTextWriterStartCDATA__internal_alias"))); +#else +#ifndef xmlTextWriterStartCDATA +extern __typeof (xmlTextWriterStartCDATA) xmlTextWriterStartCDATA__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartCDATA xmlTextWriterStartCDATA__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartComment +extern __typeof (xmlTextWriterStartComment) xmlTextWriterStartComment __attribute((alias("xmlTextWriterStartComment__internal_alias"))); +#else +#ifndef xmlTextWriterStartComment +extern __typeof (xmlTextWriterStartComment) xmlTextWriterStartComment__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartComment xmlTextWriterStartComment__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartDTD +extern __typeof (xmlTextWriterStartDTD) xmlTextWriterStartDTD __attribute((alias("xmlTextWriterStartDTD__internal_alias"))); +#else +#ifndef xmlTextWriterStartDTD +extern __typeof (xmlTextWriterStartDTD) xmlTextWriterStartDTD__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartDTD xmlTextWriterStartDTD__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartDTDAttlist +extern __typeof (xmlTextWriterStartDTDAttlist) xmlTextWriterStartDTDAttlist __attribute((alias("xmlTextWriterStartDTDAttlist__internal_alias"))); +#else +#ifndef xmlTextWriterStartDTDAttlist +extern __typeof (xmlTextWriterStartDTDAttlist) xmlTextWriterStartDTDAttlist__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartDTDAttlist xmlTextWriterStartDTDAttlist__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartDTDElement +extern __typeof (xmlTextWriterStartDTDElement) xmlTextWriterStartDTDElement __attribute((alias("xmlTextWriterStartDTDElement__internal_alias"))); +#else +#ifndef xmlTextWriterStartDTDElement +extern __typeof (xmlTextWriterStartDTDElement) xmlTextWriterStartDTDElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartDTDElement xmlTextWriterStartDTDElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartDTDEntity +extern __typeof (xmlTextWriterStartDTDEntity) xmlTextWriterStartDTDEntity __attribute((alias("xmlTextWriterStartDTDEntity__internal_alias"))); +#else +#ifndef xmlTextWriterStartDTDEntity +extern __typeof (xmlTextWriterStartDTDEntity) xmlTextWriterStartDTDEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartDTDEntity xmlTextWriterStartDTDEntity__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartDocument +extern __typeof (xmlTextWriterStartDocument) xmlTextWriterStartDocument __attribute((alias("xmlTextWriterStartDocument__internal_alias"))); +#else +#ifndef xmlTextWriterStartDocument +extern __typeof (xmlTextWriterStartDocument) xmlTextWriterStartDocument__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartDocument xmlTextWriterStartDocument__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartElement +extern __typeof (xmlTextWriterStartElement) xmlTextWriterStartElement __attribute((alias("xmlTextWriterStartElement__internal_alias"))); +#else +#ifndef xmlTextWriterStartElement +extern __typeof (xmlTextWriterStartElement) xmlTextWriterStartElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartElement xmlTextWriterStartElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartElementNS +extern __typeof (xmlTextWriterStartElementNS) xmlTextWriterStartElementNS __attribute((alias("xmlTextWriterStartElementNS__internal_alias"))); +#else +#ifndef xmlTextWriterStartElementNS +extern __typeof (xmlTextWriterStartElementNS) xmlTextWriterStartElementNS__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartElementNS xmlTextWriterStartElementNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterStartPI +extern __typeof (xmlTextWriterStartPI) xmlTextWriterStartPI __attribute((alias("xmlTextWriterStartPI__internal_alias"))); +#else +#ifndef xmlTextWriterStartPI +extern __typeof (xmlTextWriterStartPI) xmlTextWriterStartPI__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterStartPI xmlTextWriterStartPI__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteAttribute +extern __typeof (xmlTextWriterWriteAttribute) xmlTextWriterWriteAttribute __attribute((alias("xmlTextWriterWriteAttribute__internal_alias"))); +#else +#ifndef xmlTextWriterWriteAttribute +extern __typeof (xmlTextWriterWriteAttribute) xmlTextWriterWriteAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteAttribute xmlTextWriterWriteAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteAttributeNS +extern __typeof (xmlTextWriterWriteAttributeNS) xmlTextWriterWriteAttributeNS __attribute((alias("xmlTextWriterWriteAttributeNS__internal_alias"))); +#else +#ifndef xmlTextWriterWriteAttributeNS +extern __typeof (xmlTextWriterWriteAttributeNS) xmlTextWriterWriteAttributeNS__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteAttributeNS xmlTextWriterWriteAttributeNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteBase64 +extern __typeof (xmlTextWriterWriteBase64) xmlTextWriterWriteBase64 __attribute((alias("xmlTextWriterWriteBase64__internal_alias"))); +#else +#ifndef xmlTextWriterWriteBase64 +extern __typeof (xmlTextWriterWriteBase64) xmlTextWriterWriteBase64__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteBase64 xmlTextWriterWriteBase64__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteBinHex +extern __typeof (xmlTextWriterWriteBinHex) xmlTextWriterWriteBinHex __attribute((alias("xmlTextWriterWriteBinHex__internal_alias"))); +#else +#ifndef xmlTextWriterWriteBinHex +extern __typeof (xmlTextWriterWriteBinHex) xmlTextWriterWriteBinHex__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteBinHex xmlTextWriterWriteBinHex__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteCDATA +extern __typeof (xmlTextWriterWriteCDATA) xmlTextWriterWriteCDATA __attribute((alias("xmlTextWriterWriteCDATA__internal_alias"))); +#else +#ifndef xmlTextWriterWriteCDATA +extern __typeof (xmlTextWriterWriteCDATA) xmlTextWriterWriteCDATA__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteCDATA xmlTextWriterWriteCDATA__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteComment +extern __typeof (xmlTextWriterWriteComment) xmlTextWriterWriteComment __attribute((alias("xmlTextWriterWriteComment__internal_alias"))); +#else +#ifndef xmlTextWriterWriteComment +extern __typeof (xmlTextWriterWriteComment) xmlTextWriterWriteComment__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteComment xmlTextWriterWriteComment__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteDTD +extern __typeof (xmlTextWriterWriteDTD) xmlTextWriterWriteDTD __attribute((alias("xmlTextWriterWriteDTD__internal_alias"))); +#else +#ifndef xmlTextWriterWriteDTD +extern __typeof (xmlTextWriterWriteDTD) xmlTextWriterWriteDTD__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteDTD xmlTextWriterWriteDTD__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteDTDAttlist +extern __typeof (xmlTextWriterWriteDTDAttlist) xmlTextWriterWriteDTDAttlist __attribute((alias("xmlTextWriterWriteDTDAttlist__internal_alias"))); +#else +#ifndef xmlTextWriterWriteDTDAttlist +extern __typeof (xmlTextWriterWriteDTDAttlist) xmlTextWriterWriteDTDAttlist__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteDTDAttlist xmlTextWriterWriteDTDAttlist__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteDTDElement +extern __typeof (xmlTextWriterWriteDTDElement) xmlTextWriterWriteDTDElement __attribute((alias("xmlTextWriterWriteDTDElement__internal_alias"))); +#else +#ifndef xmlTextWriterWriteDTDElement +extern __typeof (xmlTextWriterWriteDTDElement) xmlTextWriterWriteDTDElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteDTDElement xmlTextWriterWriteDTDElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteDTDEntity +extern __typeof (xmlTextWriterWriteDTDEntity) xmlTextWriterWriteDTDEntity __attribute((alias("xmlTextWriterWriteDTDEntity__internal_alias"))); +#else +#ifndef xmlTextWriterWriteDTDEntity +extern __typeof (xmlTextWriterWriteDTDEntity) xmlTextWriterWriteDTDEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteDTDEntity xmlTextWriterWriteDTDEntity__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteDTDExternalEntity +extern __typeof (xmlTextWriterWriteDTDExternalEntity) xmlTextWriterWriteDTDExternalEntity __attribute((alias("xmlTextWriterWriteDTDExternalEntity__internal_alias"))); +#else +#ifndef xmlTextWriterWriteDTDExternalEntity +extern __typeof (xmlTextWriterWriteDTDExternalEntity) xmlTextWriterWriteDTDExternalEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteDTDExternalEntity xmlTextWriterWriteDTDExternalEntity__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteDTDExternalEntityContents +extern __typeof (xmlTextWriterWriteDTDExternalEntityContents) xmlTextWriterWriteDTDExternalEntityContents __attribute((alias("xmlTextWriterWriteDTDExternalEntityContents__internal_alias"))); +#else +#ifndef xmlTextWriterWriteDTDExternalEntityContents +extern __typeof (xmlTextWriterWriteDTDExternalEntityContents) xmlTextWriterWriteDTDExternalEntityContents__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteDTDExternalEntityContents xmlTextWriterWriteDTDExternalEntityContents__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteDTDInternalEntity +extern __typeof (xmlTextWriterWriteDTDInternalEntity) xmlTextWriterWriteDTDInternalEntity __attribute((alias("xmlTextWriterWriteDTDInternalEntity__internal_alias"))); +#else +#ifndef xmlTextWriterWriteDTDInternalEntity +extern __typeof (xmlTextWriterWriteDTDInternalEntity) xmlTextWriterWriteDTDInternalEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteDTDInternalEntity xmlTextWriterWriteDTDInternalEntity__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteDTDNotation +extern __typeof (xmlTextWriterWriteDTDNotation) xmlTextWriterWriteDTDNotation __attribute((alias("xmlTextWriterWriteDTDNotation__internal_alias"))); +#else +#ifndef xmlTextWriterWriteDTDNotation +extern __typeof (xmlTextWriterWriteDTDNotation) xmlTextWriterWriteDTDNotation__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteDTDNotation xmlTextWriterWriteDTDNotation__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteElement +extern __typeof (xmlTextWriterWriteElement) xmlTextWriterWriteElement __attribute((alias("xmlTextWriterWriteElement__internal_alias"))); +#else +#ifndef xmlTextWriterWriteElement +extern __typeof (xmlTextWriterWriteElement) xmlTextWriterWriteElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteElement xmlTextWriterWriteElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteElementNS +extern __typeof (xmlTextWriterWriteElementNS) xmlTextWriterWriteElementNS __attribute((alias("xmlTextWriterWriteElementNS__internal_alias"))); +#else +#ifndef xmlTextWriterWriteElementNS +extern __typeof (xmlTextWriterWriteElementNS) xmlTextWriterWriteElementNS__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteElementNS xmlTextWriterWriteElementNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatAttribute +extern __typeof (xmlTextWriterWriteFormatAttribute) xmlTextWriterWriteFormatAttribute __attribute((alias("xmlTextWriterWriteFormatAttribute__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatAttribute +extern __typeof (xmlTextWriterWriteFormatAttribute) xmlTextWriterWriteFormatAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatAttribute xmlTextWriterWriteFormatAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatAttributeNS +extern __typeof (xmlTextWriterWriteFormatAttributeNS) xmlTextWriterWriteFormatAttributeNS __attribute((alias("xmlTextWriterWriteFormatAttributeNS__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatAttributeNS +extern __typeof (xmlTextWriterWriteFormatAttributeNS) xmlTextWriterWriteFormatAttributeNS__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatAttributeNS xmlTextWriterWriteFormatAttributeNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatCDATA +extern __typeof (xmlTextWriterWriteFormatCDATA) xmlTextWriterWriteFormatCDATA __attribute((alias("xmlTextWriterWriteFormatCDATA__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatCDATA +extern __typeof (xmlTextWriterWriteFormatCDATA) xmlTextWriterWriteFormatCDATA__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatCDATA xmlTextWriterWriteFormatCDATA__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatComment +extern __typeof (xmlTextWriterWriteFormatComment) xmlTextWriterWriteFormatComment __attribute((alias("xmlTextWriterWriteFormatComment__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatComment +extern __typeof (xmlTextWriterWriteFormatComment) xmlTextWriterWriteFormatComment__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatComment xmlTextWriterWriteFormatComment__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatDTD +extern __typeof (xmlTextWriterWriteFormatDTD) xmlTextWriterWriteFormatDTD __attribute((alias("xmlTextWriterWriteFormatDTD__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatDTD +extern __typeof (xmlTextWriterWriteFormatDTD) xmlTextWriterWriteFormatDTD__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatDTD xmlTextWriterWriteFormatDTD__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatDTDAttlist +extern __typeof (xmlTextWriterWriteFormatDTDAttlist) xmlTextWriterWriteFormatDTDAttlist __attribute((alias("xmlTextWriterWriteFormatDTDAttlist__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatDTDAttlist +extern __typeof (xmlTextWriterWriteFormatDTDAttlist) xmlTextWriterWriteFormatDTDAttlist__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatDTDAttlist xmlTextWriterWriteFormatDTDAttlist__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatDTDElement +extern __typeof (xmlTextWriterWriteFormatDTDElement) xmlTextWriterWriteFormatDTDElement __attribute((alias("xmlTextWriterWriteFormatDTDElement__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatDTDElement +extern __typeof (xmlTextWriterWriteFormatDTDElement) xmlTextWriterWriteFormatDTDElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatDTDElement xmlTextWriterWriteFormatDTDElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatDTDInternalEntity +extern __typeof (xmlTextWriterWriteFormatDTDInternalEntity) xmlTextWriterWriteFormatDTDInternalEntity __attribute((alias("xmlTextWriterWriteFormatDTDInternalEntity__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatDTDInternalEntity +extern __typeof (xmlTextWriterWriteFormatDTDInternalEntity) xmlTextWriterWriteFormatDTDInternalEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatDTDInternalEntity xmlTextWriterWriteFormatDTDInternalEntity__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatElement +extern __typeof (xmlTextWriterWriteFormatElement) xmlTextWriterWriteFormatElement __attribute((alias("xmlTextWriterWriteFormatElement__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatElement +extern __typeof (xmlTextWriterWriteFormatElement) xmlTextWriterWriteFormatElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatElement xmlTextWriterWriteFormatElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatElementNS +extern __typeof (xmlTextWriterWriteFormatElementNS) xmlTextWriterWriteFormatElementNS __attribute((alias("xmlTextWriterWriteFormatElementNS__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatElementNS +extern __typeof (xmlTextWriterWriteFormatElementNS) xmlTextWriterWriteFormatElementNS__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatElementNS xmlTextWriterWriteFormatElementNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatPI +extern __typeof (xmlTextWriterWriteFormatPI) xmlTextWriterWriteFormatPI __attribute((alias("xmlTextWriterWriteFormatPI__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatPI +extern __typeof (xmlTextWriterWriteFormatPI) xmlTextWriterWriteFormatPI__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatPI xmlTextWriterWriteFormatPI__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatRaw +extern __typeof (xmlTextWriterWriteFormatRaw) xmlTextWriterWriteFormatRaw __attribute((alias("xmlTextWriterWriteFormatRaw__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatRaw +extern __typeof (xmlTextWriterWriteFormatRaw) xmlTextWriterWriteFormatRaw__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatRaw xmlTextWriterWriteFormatRaw__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteFormatString +extern __typeof (xmlTextWriterWriteFormatString) xmlTextWriterWriteFormatString __attribute((alias("xmlTextWriterWriteFormatString__internal_alias"))); +#else +#ifndef xmlTextWriterWriteFormatString +extern __typeof (xmlTextWriterWriteFormatString) xmlTextWriterWriteFormatString__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteFormatString xmlTextWriterWriteFormatString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWritePI +extern __typeof (xmlTextWriterWritePI) xmlTextWriterWritePI __attribute((alias("xmlTextWriterWritePI__internal_alias"))); +#else +#ifndef xmlTextWriterWritePI +extern __typeof (xmlTextWriterWritePI) xmlTextWriterWritePI__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWritePI xmlTextWriterWritePI__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteRaw +extern __typeof (xmlTextWriterWriteRaw) xmlTextWriterWriteRaw __attribute((alias("xmlTextWriterWriteRaw__internal_alias"))); +#else +#ifndef xmlTextWriterWriteRaw +extern __typeof (xmlTextWriterWriteRaw) xmlTextWriterWriteRaw__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteRaw xmlTextWriterWriteRaw__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteRawLen +extern __typeof (xmlTextWriterWriteRawLen) xmlTextWriterWriteRawLen __attribute((alias("xmlTextWriterWriteRawLen__internal_alias"))); +#else +#ifndef xmlTextWriterWriteRawLen +extern __typeof (xmlTextWriterWriteRawLen) xmlTextWriterWriteRawLen__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteRawLen xmlTextWriterWriteRawLen__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteString +extern __typeof (xmlTextWriterWriteString) xmlTextWriterWriteString __attribute((alias("xmlTextWriterWriteString__internal_alias"))); +#else +#ifndef xmlTextWriterWriteString +extern __typeof (xmlTextWriterWriteString) xmlTextWriterWriteString__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteString xmlTextWriterWriteString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatAttribute +extern __typeof (xmlTextWriterWriteVFormatAttribute) xmlTextWriterWriteVFormatAttribute __attribute((alias("xmlTextWriterWriteVFormatAttribute__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatAttribute +extern __typeof (xmlTextWriterWriteVFormatAttribute) xmlTextWriterWriteVFormatAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatAttribute xmlTextWriterWriteVFormatAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatAttributeNS +extern __typeof (xmlTextWriterWriteVFormatAttributeNS) xmlTextWriterWriteVFormatAttributeNS __attribute((alias("xmlTextWriterWriteVFormatAttributeNS__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatAttributeNS +extern __typeof (xmlTextWriterWriteVFormatAttributeNS) xmlTextWriterWriteVFormatAttributeNS__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatAttributeNS xmlTextWriterWriteVFormatAttributeNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatCDATA +extern __typeof (xmlTextWriterWriteVFormatCDATA) xmlTextWriterWriteVFormatCDATA __attribute((alias("xmlTextWriterWriteVFormatCDATA__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatCDATA +extern __typeof (xmlTextWriterWriteVFormatCDATA) xmlTextWriterWriteVFormatCDATA__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatCDATA xmlTextWriterWriteVFormatCDATA__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatComment +extern __typeof (xmlTextWriterWriteVFormatComment) xmlTextWriterWriteVFormatComment __attribute((alias("xmlTextWriterWriteVFormatComment__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatComment +extern __typeof (xmlTextWriterWriteVFormatComment) xmlTextWriterWriteVFormatComment__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatComment xmlTextWriterWriteVFormatComment__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatDTD +extern __typeof (xmlTextWriterWriteVFormatDTD) xmlTextWriterWriteVFormatDTD __attribute((alias("xmlTextWriterWriteVFormatDTD__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatDTD +extern __typeof (xmlTextWriterWriteVFormatDTD) xmlTextWriterWriteVFormatDTD__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatDTD xmlTextWriterWriteVFormatDTD__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatDTDAttlist +extern __typeof (xmlTextWriterWriteVFormatDTDAttlist) xmlTextWriterWriteVFormatDTDAttlist __attribute((alias("xmlTextWriterWriteVFormatDTDAttlist__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatDTDAttlist +extern __typeof (xmlTextWriterWriteVFormatDTDAttlist) xmlTextWriterWriteVFormatDTDAttlist__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatDTDAttlist xmlTextWriterWriteVFormatDTDAttlist__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatDTDElement +extern __typeof (xmlTextWriterWriteVFormatDTDElement) xmlTextWriterWriteVFormatDTDElement __attribute((alias("xmlTextWriterWriteVFormatDTDElement__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatDTDElement +extern __typeof (xmlTextWriterWriteVFormatDTDElement) xmlTextWriterWriteVFormatDTDElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatDTDElement xmlTextWriterWriteVFormatDTDElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatDTDInternalEntity +extern __typeof (xmlTextWriterWriteVFormatDTDInternalEntity) xmlTextWriterWriteVFormatDTDInternalEntity __attribute((alias("xmlTextWriterWriteVFormatDTDInternalEntity__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatDTDInternalEntity +extern __typeof (xmlTextWriterWriteVFormatDTDInternalEntity) xmlTextWriterWriteVFormatDTDInternalEntity__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatDTDInternalEntity xmlTextWriterWriteVFormatDTDInternalEntity__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatElement +extern __typeof (xmlTextWriterWriteVFormatElement) xmlTextWriterWriteVFormatElement __attribute((alias("xmlTextWriterWriteVFormatElement__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatElement +extern __typeof (xmlTextWriterWriteVFormatElement) xmlTextWriterWriteVFormatElement__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatElement xmlTextWriterWriteVFormatElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatElementNS +extern __typeof (xmlTextWriterWriteVFormatElementNS) xmlTextWriterWriteVFormatElementNS __attribute((alias("xmlTextWriterWriteVFormatElementNS__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatElementNS +extern __typeof (xmlTextWriterWriteVFormatElementNS) xmlTextWriterWriteVFormatElementNS__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatElementNS xmlTextWriterWriteVFormatElementNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatPI +extern __typeof (xmlTextWriterWriteVFormatPI) xmlTextWriterWriteVFormatPI __attribute((alias("xmlTextWriterWriteVFormatPI__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatPI +extern __typeof (xmlTextWriterWriteVFormatPI) xmlTextWriterWriteVFormatPI__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatPI xmlTextWriterWriteVFormatPI__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatRaw +extern __typeof (xmlTextWriterWriteVFormatRaw) xmlTextWriterWriteVFormatRaw __attribute((alias("xmlTextWriterWriteVFormatRaw__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatRaw +extern __typeof (xmlTextWriterWriteVFormatRaw) xmlTextWriterWriteVFormatRaw__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatRaw xmlTextWriterWriteVFormatRaw__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_WRITER_ENABLED) +#ifdef bottom_xmlwriter +#undef xmlTextWriterWriteVFormatString +extern __typeof (xmlTextWriterWriteVFormatString) xmlTextWriterWriteVFormatString __attribute((alias("xmlTextWriterWriteVFormatString__internal_alias"))); +#else +#ifndef xmlTextWriterWriteVFormatString +extern __typeof (xmlTextWriterWriteVFormatString) xmlTextWriterWriteVFormatString__internal_alias __attribute((visibility("hidden"))); +#define xmlTextWriterWriteVFormatString xmlTextWriterWriteVFormatString__internal_alias +#endif +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefBufferAllocScheme +extern __typeof (xmlThrDefBufferAllocScheme) xmlThrDefBufferAllocScheme __attribute((alias("xmlThrDefBufferAllocScheme__internal_alias"))); +#else +#ifndef xmlThrDefBufferAllocScheme +extern __typeof (xmlThrDefBufferAllocScheme) xmlThrDefBufferAllocScheme__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefBufferAllocScheme xmlThrDefBufferAllocScheme__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefDefaultBufferSize +extern __typeof (xmlThrDefDefaultBufferSize) xmlThrDefDefaultBufferSize __attribute((alias("xmlThrDefDefaultBufferSize__internal_alias"))); +#else +#ifndef xmlThrDefDefaultBufferSize +extern __typeof (xmlThrDefDefaultBufferSize) xmlThrDefDefaultBufferSize__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefDefaultBufferSize xmlThrDefDefaultBufferSize__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefDeregisterNodeDefault +extern __typeof (xmlThrDefDeregisterNodeDefault) xmlThrDefDeregisterNodeDefault __attribute((alias("xmlThrDefDeregisterNodeDefault__internal_alias"))); +#else +#ifndef xmlThrDefDeregisterNodeDefault +extern __typeof (xmlThrDefDeregisterNodeDefault) xmlThrDefDeregisterNodeDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefDeregisterNodeDefault xmlThrDefDeregisterNodeDefault__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefDoValidityCheckingDefaultValue +extern __typeof (xmlThrDefDoValidityCheckingDefaultValue) xmlThrDefDoValidityCheckingDefaultValue __attribute((alias("xmlThrDefDoValidityCheckingDefaultValue__internal_alias"))); +#else +#ifndef xmlThrDefDoValidityCheckingDefaultValue +extern __typeof (xmlThrDefDoValidityCheckingDefaultValue) xmlThrDefDoValidityCheckingDefaultValue__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefDoValidityCheckingDefaultValue xmlThrDefDoValidityCheckingDefaultValue__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefGetWarningsDefaultValue +extern __typeof (xmlThrDefGetWarningsDefaultValue) xmlThrDefGetWarningsDefaultValue __attribute((alias("xmlThrDefGetWarningsDefaultValue__internal_alias"))); +#else +#ifndef xmlThrDefGetWarningsDefaultValue +extern __typeof (xmlThrDefGetWarningsDefaultValue) xmlThrDefGetWarningsDefaultValue__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefGetWarningsDefaultValue xmlThrDefGetWarningsDefaultValue__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefIndentTreeOutput +extern __typeof (xmlThrDefIndentTreeOutput) xmlThrDefIndentTreeOutput __attribute((alias("xmlThrDefIndentTreeOutput__internal_alias"))); +#else +#ifndef xmlThrDefIndentTreeOutput +extern __typeof (xmlThrDefIndentTreeOutput) xmlThrDefIndentTreeOutput__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefIndentTreeOutput xmlThrDefIndentTreeOutput__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefKeepBlanksDefaultValue +extern __typeof (xmlThrDefKeepBlanksDefaultValue) xmlThrDefKeepBlanksDefaultValue __attribute((alias("xmlThrDefKeepBlanksDefaultValue__internal_alias"))); +#else +#ifndef xmlThrDefKeepBlanksDefaultValue +extern __typeof (xmlThrDefKeepBlanksDefaultValue) xmlThrDefKeepBlanksDefaultValue__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefKeepBlanksDefaultValue xmlThrDefKeepBlanksDefaultValue__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefLineNumbersDefaultValue +extern __typeof (xmlThrDefLineNumbersDefaultValue) xmlThrDefLineNumbersDefaultValue __attribute((alias("xmlThrDefLineNumbersDefaultValue__internal_alias"))); +#else +#ifndef xmlThrDefLineNumbersDefaultValue +extern __typeof (xmlThrDefLineNumbersDefaultValue) xmlThrDefLineNumbersDefaultValue__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefLineNumbersDefaultValue xmlThrDefLineNumbersDefaultValue__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefLoadExtDtdDefaultValue +extern __typeof (xmlThrDefLoadExtDtdDefaultValue) xmlThrDefLoadExtDtdDefaultValue __attribute((alias("xmlThrDefLoadExtDtdDefaultValue__internal_alias"))); +#else +#ifndef xmlThrDefLoadExtDtdDefaultValue +extern __typeof (xmlThrDefLoadExtDtdDefaultValue) xmlThrDefLoadExtDtdDefaultValue__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefLoadExtDtdDefaultValue xmlThrDefLoadExtDtdDefaultValue__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefOutputBufferCreateFilenameDefault +extern __typeof (xmlThrDefOutputBufferCreateFilenameDefault) xmlThrDefOutputBufferCreateFilenameDefault __attribute((alias("xmlThrDefOutputBufferCreateFilenameDefault__internal_alias"))); +#else +#ifndef xmlThrDefOutputBufferCreateFilenameDefault +extern __typeof (xmlThrDefOutputBufferCreateFilenameDefault) xmlThrDefOutputBufferCreateFilenameDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefOutputBufferCreateFilenameDefault xmlThrDefOutputBufferCreateFilenameDefault__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefParserDebugEntities +extern __typeof (xmlThrDefParserDebugEntities) xmlThrDefParserDebugEntities __attribute((alias("xmlThrDefParserDebugEntities__internal_alias"))); +#else +#ifndef xmlThrDefParserDebugEntities +extern __typeof (xmlThrDefParserDebugEntities) xmlThrDefParserDebugEntities__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefParserDebugEntities xmlThrDefParserDebugEntities__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefParserInputBufferCreateFilenameDefault +extern __typeof (xmlThrDefParserInputBufferCreateFilenameDefault) xmlThrDefParserInputBufferCreateFilenameDefault __attribute((alias("xmlThrDefParserInputBufferCreateFilenameDefault__internal_alias"))); +#else +#ifndef xmlThrDefParserInputBufferCreateFilenameDefault +extern __typeof (xmlThrDefParserInputBufferCreateFilenameDefault) xmlThrDefParserInputBufferCreateFilenameDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefParserInputBufferCreateFilenameDefault xmlThrDefParserInputBufferCreateFilenameDefault__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefPedanticParserDefaultValue +extern __typeof (xmlThrDefPedanticParserDefaultValue) xmlThrDefPedanticParserDefaultValue __attribute((alias("xmlThrDefPedanticParserDefaultValue__internal_alias"))); +#else +#ifndef xmlThrDefPedanticParserDefaultValue +extern __typeof (xmlThrDefPedanticParserDefaultValue) xmlThrDefPedanticParserDefaultValue__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefPedanticParserDefaultValue xmlThrDefPedanticParserDefaultValue__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefRegisterNodeDefault +extern __typeof (xmlThrDefRegisterNodeDefault) xmlThrDefRegisterNodeDefault __attribute((alias("xmlThrDefRegisterNodeDefault__internal_alias"))); +#else +#ifndef xmlThrDefRegisterNodeDefault +extern __typeof (xmlThrDefRegisterNodeDefault) xmlThrDefRegisterNodeDefault__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefRegisterNodeDefault xmlThrDefRegisterNodeDefault__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefSaveNoEmptyTags +extern __typeof (xmlThrDefSaveNoEmptyTags) xmlThrDefSaveNoEmptyTags __attribute((alias("xmlThrDefSaveNoEmptyTags__internal_alias"))); +#else +#ifndef xmlThrDefSaveNoEmptyTags +extern __typeof (xmlThrDefSaveNoEmptyTags) xmlThrDefSaveNoEmptyTags__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefSaveNoEmptyTags xmlThrDefSaveNoEmptyTags__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefSetGenericErrorFunc +extern __typeof (xmlThrDefSetGenericErrorFunc) xmlThrDefSetGenericErrorFunc __attribute((alias("xmlThrDefSetGenericErrorFunc__internal_alias"))); +#else +#ifndef xmlThrDefSetGenericErrorFunc +extern __typeof (xmlThrDefSetGenericErrorFunc) xmlThrDefSetGenericErrorFunc__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefSetGenericErrorFunc xmlThrDefSetGenericErrorFunc__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefSetStructuredErrorFunc +extern __typeof (xmlThrDefSetStructuredErrorFunc) xmlThrDefSetStructuredErrorFunc __attribute((alias("xmlThrDefSetStructuredErrorFunc__internal_alias"))); +#else +#ifndef xmlThrDefSetStructuredErrorFunc +extern __typeof (xmlThrDefSetStructuredErrorFunc) xmlThrDefSetStructuredErrorFunc__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefSetStructuredErrorFunc xmlThrDefSetStructuredErrorFunc__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefSubstituteEntitiesDefaultValue +extern __typeof (xmlThrDefSubstituteEntitiesDefaultValue) xmlThrDefSubstituteEntitiesDefaultValue __attribute((alias("xmlThrDefSubstituteEntitiesDefaultValue__internal_alias"))); +#else +#ifndef xmlThrDefSubstituteEntitiesDefaultValue +extern __typeof (xmlThrDefSubstituteEntitiesDefaultValue) xmlThrDefSubstituteEntitiesDefaultValue__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefSubstituteEntitiesDefaultValue xmlThrDefSubstituteEntitiesDefaultValue__internal_alias +#endif +#endif + +#ifdef bottom_globals +#undef xmlThrDefTreeIndentString +extern __typeof (xmlThrDefTreeIndentString) xmlThrDefTreeIndentString __attribute((alias("xmlThrDefTreeIndentString__internal_alias"))); +#else +#ifndef xmlThrDefTreeIndentString +extern __typeof (xmlThrDefTreeIndentString) xmlThrDefTreeIndentString__internal_alias __attribute((visibility("hidden"))); +#define xmlThrDefTreeIndentString xmlThrDefTreeIndentString__internal_alias +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsAegeanNumbers +extern __typeof (xmlUCSIsAegeanNumbers) xmlUCSIsAegeanNumbers __attribute((alias("xmlUCSIsAegeanNumbers__internal_alias"))); +#else +#ifndef xmlUCSIsAegeanNumbers +extern __typeof (xmlUCSIsAegeanNumbers) xmlUCSIsAegeanNumbers__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsAegeanNumbers xmlUCSIsAegeanNumbers__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsAlphabeticPresentationForms +extern __typeof (xmlUCSIsAlphabeticPresentationForms) xmlUCSIsAlphabeticPresentationForms __attribute((alias("xmlUCSIsAlphabeticPresentationForms__internal_alias"))); +#else +#ifndef xmlUCSIsAlphabeticPresentationForms +extern __typeof (xmlUCSIsAlphabeticPresentationForms) xmlUCSIsAlphabeticPresentationForms__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsAlphabeticPresentationForms xmlUCSIsAlphabeticPresentationForms__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsArabic +extern __typeof (xmlUCSIsArabic) xmlUCSIsArabic __attribute((alias("xmlUCSIsArabic__internal_alias"))); +#else +#ifndef xmlUCSIsArabic +extern __typeof (xmlUCSIsArabic) xmlUCSIsArabic__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsArabic xmlUCSIsArabic__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsArabicPresentationFormsA +extern __typeof (xmlUCSIsArabicPresentationFormsA) xmlUCSIsArabicPresentationFormsA __attribute((alias("xmlUCSIsArabicPresentationFormsA__internal_alias"))); +#else +#ifndef xmlUCSIsArabicPresentationFormsA +extern __typeof (xmlUCSIsArabicPresentationFormsA) xmlUCSIsArabicPresentationFormsA__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsArabicPresentationFormsA xmlUCSIsArabicPresentationFormsA__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsArabicPresentationFormsB +extern __typeof (xmlUCSIsArabicPresentationFormsB) xmlUCSIsArabicPresentationFormsB __attribute((alias("xmlUCSIsArabicPresentationFormsB__internal_alias"))); +#else +#ifndef xmlUCSIsArabicPresentationFormsB +extern __typeof (xmlUCSIsArabicPresentationFormsB) xmlUCSIsArabicPresentationFormsB__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsArabicPresentationFormsB xmlUCSIsArabicPresentationFormsB__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsArmenian +extern __typeof (xmlUCSIsArmenian) xmlUCSIsArmenian __attribute((alias("xmlUCSIsArmenian__internal_alias"))); +#else +#ifndef xmlUCSIsArmenian +extern __typeof (xmlUCSIsArmenian) xmlUCSIsArmenian__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsArmenian xmlUCSIsArmenian__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsArrows +extern __typeof (xmlUCSIsArrows) xmlUCSIsArrows __attribute((alias("xmlUCSIsArrows__internal_alias"))); +#else +#ifndef xmlUCSIsArrows +extern __typeof (xmlUCSIsArrows) xmlUCSIsArrows__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsArrows xmlUCSIsArrows__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsBasicLatin +extern __typeof (xmlUCSIsBasicLatin) xmlUCSIsBasicLatin __attribute((alias("xmlUCSIsBasicLatin__internal_alias"))); +#else +#ifndef xmlUCSIsBasicLatin +extern __typeof (xmlUCSIsBasicLatin) xmlUCSIsBasicLatin__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsBasicLatin xmlUCSIsBasicLatin__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsBengali +extern __typeof (xmlUCSIsBengali) xmlUCSIsBengali __attribute((alias("xmlUCSIsBengali__internal_alias"))); +#else +#ifndef xmlUCSIsBengali +extern __typeof (xmlUCSIsBengali) xmlUCSIsBengali__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsBengali xmlUCSIsBengali__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsBlock +extern __typeof (xmlUCSIsBlock) xmlUCSIsBlock __attribute((alias("xmlUCSIsBlock__internal_alias"))); +#else +#ifndef xmlUCSIsBlock +extern __typeof (xmlUCSIsBlock) xmlUCSIsBlock__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsBlock xmlUCSIsBlock__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsBlockElements +extern __typeof (xmlUCSIsBlockElements) xmlUCSIsBlockElements __attribute((alias("xmlUCSIsBlockElements__internal_alias"))); +#else +#ifndef xmlUCSIsBlockElements +extern __typeof (xmlUCSIsBlockElements) xmlUCSIsBlockElements__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsBlockElements xmlUCSIsBlockElements__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsBopomofo +extern __typeof (xmlUCSIsBopomofo) xmlUCSIsBopomofo __attribute((alias("xmlUCSIsBopomofo__internal_alias"))); +#else +#ifndef xmlUCSIsBopomofo +extern __typeof (xmlUCSIsBopomofo) xmlUCSIsBopomofo__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsBopomofo xmlUCSIsBopomofo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsBopomofoExtended +extern __typeof (xmlUCSIsBopomofoExtended) xmlUCSIsBopomofoExtended __attribute((alias("xmlUCSIsBopomofoExtended__internal_alias"))); +#else +#ifndef xmlUCSIsBopomofoExtended +extern __typeof (xmlUCSIsBopomofoExtended) xmlUCSIsBopomofoExtended__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsBopomofoExtended xmlUCSIsBopomofoExtended__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsBoxDrawing +extern __typeof (xmlUCSIsBoxDrawing) xmlUCSIsBoxDrawing __attribute((alias("xmlUCSIsBoxDrawing__internal_alias"))); +#else +#ifndef xmlUCSIsBoxDrawing +extern __typeof (xmlUCSIsBoxDrawing) xmlUCSIsBoxDrawing__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsBoxDrawing xmlUCSIsBoxDrawing__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsBraillePatterns +extern __typeof (xmlUCSIsBraillePatterns) xmlUCSIsBraillePatterns __attribute((alias("xmlUCSIsBraillePatterns__internal_alias"))); +#else +#ifndef xmlUCSIsBraillePatterns +extern __typeof (xmlUCSIsBraillePatterns) xmlUCSIsBraillePatterns__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsBraillePatterns xmlUCSIsBraillePatterns__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsBuhid +extern __typeof (xmlUCSIsBuhid) xmlUCSIsBuhid __attribute((alias("xmlUCSIsBuhid__internal_alias"))); +#else +#ifndef xmlUCSIsBuhid +extern __typeof (xmlUCSIsBuhid) xmlUCSIsBuhid__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsBuhid xmlUCSIsBuhid__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsByzantineMusicalSymbols +extern __typeof (xmlUCSIsByzantineMusicalSymbols) xmlUCSIsByzantineMusicalSymbols __attribute((alias("xmlUCSIsByzantineMusicalSymbols__internal_alias"))); +#else +#ifndef xmlUCSIsByzantineMusicalSymbols +extern __typeof (xmlUCSIsByzantineMusicalSymbols) xmlUCSIsByzantineMusicalSymbols__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsByzantineMusicalSymbols xmlUCSIsByzantineMusicalSymbols__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCJKCompatibility +extern __typeof (xmlUCSIsCJKCompatibility) xmlUCSIsCJKCompatibility __attribute((alias("xmlUCSIsCJKCompatibility__internal_alias"))); +#else +#ifndef xmlUCSIsCJKCompatibility +extern __typeof (xmlUCSIsCJKCompatibility) xmlUCSIsCJKCompatibility__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCJKCompatibility xmlUCSIsCJKCompatibility__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCJKCompatibilityForms +extern __typeof (xmlUCSIsCJKCompatibilityForms) xmlUCSIsCJKCompatibilityForms __attribute((alias("xmlUCSIsCJKCompatibilityForms__internal_alias"))); +#else +#ifndef xmlUCSIsCJKCompatibilityForms +extern __typeof (xmlUCSIsCJKCompatibilityForms) xmlUCSIsCJKCompatibilityForms__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCJKCompatibilityForms xmlUCSIsCJKCompatibilityForms__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCJKCompatibilityIdeographs +extern __typeof (xmlUCSIsCJKCompatibilityIdeographs) xmlUCSIsCJKCompatibilityIdeographs __attribute((alias("xmlUCSIsCJKCompatibilityIdeographs__internal_alias"))); +#else +#ifndef xmlUCSIsCJKCompatibilityIdeographs +extern __typeof (xmlUCSIsCJKCompatibilityIdeographs) xmlUCSIsCJKCompatibilityIdeographs__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCJKCompatibilityIdeographs xmlUCSIsCJKCompatibilityIdeographs__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCJKCompatibilityIdeographsSupplement +extern __typeof (xmlUCSIsCJKCompatibilityIdeographsSupplement) xmlUCSIsCJKCompatibilityIdeographsSupplement __attribute((alias("xmlUCSIsCJKCompatibilityIdeographsSupplement__internal_alias"))); +#else +#ifndef xmlUCSIsCJKCompatibilityIdeographsSupplement +extern __typeof (xmlUCSIsCJKCompatibilityIdeographsSupplement) xmlUCSIsCJKCompatibilityIdeographsSupplement__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCJKCompatibilityIdeographsSupplement xmlUCSIsCJKCompatibilityIdeographsSupplement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCJKRadicalsSupplement +extern __typeof (xmlUCSIsCJKRadicalsSupplement) xmlUCSIsCJKRadicalsSupplement __attribute((alias("xmlUCSIsCJKRadicalsSupplement__internal_alias"))); +#else +#ifndef xmlUCSIsCJKRadicalsSupplement +extern __typeof (xmlUCSIsCJKRadicalsSupplement) xmlUCSIsCJKRadicalsSupplement__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCJKRadicalsSupplement xmlUCSIsCJKRadicalsSupplement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCJKSymbolsandPunctuation +extern __typeof (xmlUCSIsCJKSymbolsandPunctuation) xmlUCSIsCJKSymbolsandPunctuation __attribute((alias("xmlUCSIsCJKSymbolsandPunctuation__internal_alias"))); +#else +#ifndef xmlUCSIsCJKSymbolsandPunctuation +extern __typeof (xmlUCSIsCJKSymbolsandPunctuation) xmlUCSIsCJKSymbolsandPunctuation__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCJKSymbolsandPunctuation xmlUCSIsCJKSymbolsandPunctuation__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCJKUnifiedIdeographs +extern __typeof (xmlUCSIsCJKUnifiedIdeographs) xmlUCSIsCJKUnifiedIdeographs __attribute((alias("xmlUCSIsCJKUnifiedIdeographs__internal_alias"))); +#else +#ifndef xmlUCSIsCJKUnifiedIdeographs +extern __typeof (xmlUCSIsCJKUnifiedIdeographs) xmlUCSIsCJKUnifiedIdeographs__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCJKUnifiedIdeographs xmlUCSIsCJKUnifiedIdeographs__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCJKUnifiedIdeographsExtensionA +extern __typeof (xmlUCSIsCJKUnifiedIdeographsExtensionA) xmlUCSIsCJKUnifiedIdeographsExtensionA __attribute((alias("xmlUCSIsCJKUnifiedIdeographsExtensionA__internal_alias"))); +#else +#ifndef xmlUCSIsCJKUnifiedIdeographsExtensionA +extern __typeof (xmlUCSIsCJKUnifiedIdeographsExtensionA) xmlUCSIsCJKUnifiedIdeographsExtensionA__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCJKUnifiedIdeographsExtensionA xmlUCSIsCJKUnifiedIdeographsExtensionA__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCJKUnifiedIdeographsExtensionB +extern __typeof (xmlUCSIsCJKUnifiedIdeographsExtensionB) xmlUCSIsCJKUnifiedIdeographsExtensionB __attribute((alias("xmlUCSIsCJKUnifiedIdeographsExtensionB__internal_alias"))); +#else +#ifndef xmlUCSIsCJKUnifiedIdeographsExtensionB +extern __typeof (xmlUCSIsCJKUnifiedIdeographsExtensionB) xmlUCSIsCJKUnifiedIdeographsExtensionB__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCJKUnifiedIdeographsExtensionB xmlUCSIsCJKUnifiedIdeographsExtensionB__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCat +extern __typeof (xmlUCSIsCat) xmlUCSIsCat __attribute((alias("xmlUCSIsCat__internal_alias"))); +#else +#ifndef xmlUCSIsCat +extern __typeof (xmlUCSIsCat) xmlUCSIsCat__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCat xmlUCSIsCat__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatC +extern __typeof (xmlUCSIsCatC) xmlUCSIsCatC __attribute((alias("xmlUCSIsCatC__internal_alias"))); +#else +#ifndef xmlUCSIsCatC +extern __typeof (xmlUCSIsCatC) xmlUCSIsCatC__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatC xmlUCSIsCatC__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatCc +extern __typeof (xmlUCSIsCatCc) xmlUCSIsCatCc __attribute((alias("xmlUCSIsCatCc__internal_alias"))); +#else +#ifndef xmlUCSIsCatCc +extern __typeof (xmlUCSIsCatCc) xmlUCSIsCatCc__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatCc xmlUCSIsCatCc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatCf +extern __typeof (xmlUCSIsCatCf) xmlUCSIsCatCf __attribute((alias("xmlUCSIsCatCf__internal_alias"))); +#else +#ifndef xmlUCSIsCatCf +extern __typeof (xmlUCSIsCatCf) xmlUCSIsCatCf__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatCf xmlUCSIsCatCf__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatCo +extern __typeof (xmlUCSIsCatCo) xmlUCSIsCatCo __attribute((alias("xmlUCSIsCatCo__internal_alias"))); +#else +#ifndef xmlUCSIsCatCo +extern __typeof (xmlUCSIsCatCo) xmlUCSIsCatCo__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatCo xmlUCSIsCatCo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatCs +extern __typeof (xmlUCSIsCatCs) xmlUCSIsCatCs __attribute((alias("xmlUCSIsCatCs__internal_alias"))); +#else +#ifndef xmlUCSIsCatCs +extern __typeof (xmlUCSIsCatCs) xmlUCSIsCatCs__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatCs xmlUCSIsCatCs__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatL +extern __typeof (xmlUCSIsCatL) xmlUCSIsCatL __attribute((alias("xmlUCSIsCatL__internal_alias"))); +#else +#ifndef xmlUCSIsCatL +extern __typeof (xmlUCSIsCatL) xmlUCSIsCatL__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatL xmlUCSIsCatL__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatLl +extern __typeof (xmlUCSIsCatLl) xmlUCSIsCatLl __attribute((alias("xmlUCSIsCatLl__internal_alias"))); +#else +#ifndef xmlUCSIsCatLl +extern __typeof (xmlUCSIsCatLl) xmlUCSIsCatLl__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatLl xmlUCSIsCatLl__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatLm +extern __typeof (xmlUCSIsCatLm) xmlUCSIsCatLm __attribute((alias("xmlUCSIsCatLm__internal_alias"))); +#else +#ifndef xmlUCSIsCatLm +extern __typeof (xmlUCSIsCatLm) xmlUCSIsCatLm__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatLm xmlUCSIsCatLm__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatLo +extern __typeof (xmlUCSIsCatLo) xmlUCSIsCatLo __attribute((alias("xmlUCSIsCatLo__internal_alias"))); +#else +#ifndef xmlUCSIsCatLo +extern __typeof (xmlUCSIsCatLo) xmlUCSIsCatLo__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatLo xmlUCSIsCatLo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatLt +extern __typeof (xmlUCSIsCatLt) xmlUCSIsCatLt __attribute((alias("xmlUCSIsCatLt__internal_alias"))); +#else +#ifndef xmlUCSIsCatLt +extern __typeof (xmlUCSIsCatLt) xmlUCSIsCatLt__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatLt xmlUCSIsCatLt__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatLu +extern __typeof (xmlUCSIsCatLu) xmlUCSIsCatLu __attribute((alias("xmlUCSIsCatLu__internal_alias"))); +#else +#ifndef xmlUCSIsCatLu +extern __typeof (xmlUCSIsCatLu) xmlUCSIsCatLu__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatLu xmlUCSIsCatLu__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatM +extern __typeof (xmlUCSIsCatM) xmlUCSIsCatM __attribute((alias("xmlUCSIsCatM__internal_alias"))); +#else +#ifndef xmlUCSIsCatM +extern __typeof (xmlUCSIsCatM) xmlUCSIsCatM__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatM xmlUCSIsCatM__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatMc +extern __typeof (xmlUCSIsCatMc) xmlUCSIsCatMc __attribute((alias("xmlUCSIsCatMc__internal_alias"))); +#else +#ifndef xmlUCSIsCatMc +extern __typeof (xmlUCSIsCatMc) xmlUCSIsCatMc__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatMc xmlUCSIsCatMc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatMe +extern __typeof (xmlUCSIsCatMe) xmlUCSIsCatMe __attribute((alias("xmlUCSIsCatMe__internal_alias"))); +#else +#ifndef xmlUCSIsCatMe +extern __typeof (xmlUCSIsCatMe) xmlUCSIsCatMe__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatMe xmlUCSIsCatMe__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatMn +extern __typeof (xmlUCSIsCatMn) xmlUCSIsCatMn __attribute((alias("xmlUCSIsCatMn__internal_alias"))); +#else +#ifndef xmlUCSIsCatMn +extern __typeof (xmlUCSIsCatMn) xmlUCSIsCatMn__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatMn xmlUCSIsCatMn__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatN +extern __typeof (xmlUCSIsCatN) xmlUCSIsCatN __attribute((alias("xmlUCSIsCatN__internal_alias"))); +#else +#ifndef xmlUCSIsCatN +extern __typeof (xmlUCSIsCatN) xmlUCSIsCatN__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatN xmlUCSIsCatN__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatNd +extern __typeof (xmlUCSIsCatNd) xmlUCSIsCatNd __attribute((alias("xmlUCSIsCatNd__internal_alias"))); +#else +#ifndef xmlUCSIsCatNd +extern __typeof (xmlUCSIsCatNd) xmlUCSIsCatNd__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatNd xmlUCSIsCatNd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatNl +extern __typeof (xmlUCSIsCatNl) xmlUCSIsCatNl __attribute((alias("xmlUCSIsCatNl__internal_alias"))); +#else +#ifndef xmlUCSIsCatNl +extern __typeof (xmlUCSIsCatNl) xmlUCSIsCatNl__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatNl xmlUCSIsCatNl__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatNo +extern __typeof (xmlUCSIsCatNo) xmlUCSIsCatNo __attribute((alias("xmlUCSIsCatNo__internal_alias"))); +#else +#ifndef xmlUCSIsCatNo +extern __typeof (xmlUCSIsCatNo) xmlUCSIsCatNo__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatNo xmlUCSIsCatNo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatP +extern __typeof (xmlUCSIsCatP) xmlUCSIsCatP __attribute((alias("xmlUCSIsCatP__internal_alias"))); +#else +#ifndef xmlUCSIsCatP +extern __typeof (xmlUCSIsCatP) xmlUCSIsCatP__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatP xmlUCSIsCatP__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatPc +extern __typeof (xmlUCSIsCatPc) xmlUCSIsCatPc __attribute((alias("xmlUCSIsCatPc__internal_alias"))); +#else +#ifndef xmlUCSIsCatPc +extern __typeof (xmlUCSIsCatPc) xmlUCSIsCatPc__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatPc xmlUCSIsCatPc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatPd +extern __typeof (xmlUCSIsCatPd) xmlUCSIsCatPd __attribute((alias("xmlUCSIsCatPd__internal_alias"))); +#else +#ifndef xmlUCSIsCatPd +extern __typeof (xmlUCSIsCatPd) xmlUCSIsCatPd__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatPd xmlUCSIsCatPd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatPe +extern __typeof (xmlUCSIsCatPe) xmlUCSIsCatPe __attribute((alias("xmlUCSIsCatPe__internal_alias"))); +#else +#ifndef xmlUCSIsCatPe +extern __typeof (xmlUCSIsCatPe) xmlUCSIsCatPe__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatPe xmlUCSIsCatPe__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatPf +extern __typeof (xmlUCSIsCatPf) xmlUCSIsCatPf __attribute((alias("xmlUCSIsCatPf__internal_alias"))); +#else +#ifndef xmlUCSIsCatPf +extern __typeof (xmlUCSIsCatPf) xmlUCSIsCatPf__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatPf xmlUCSIsCatPf__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatPi +extern __typeof (xmlUCSIsCatPi) xmlUCSIsCatPi __attribute((alias("xmlUCSIsCatPi__internal_alias"))); +#else +#ifndef xmlUCSIsCatPi +extern __typeof (xmlUCSIsCatPi) xmlUCSIsCatPi__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatPi xmlUCSIsCatPi__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatPo +extern __typeof (xmlUCSIsCatPo) xmlUCSIsCatPo __attribute((alias("xmlUCSIsCatPo__internal_alias"))); +#else +#ifndef xmlUCSIsCatPo +extern __typeof (xmlUCSIsCatPo) xmlUCSIsCatPo__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatPo xmlUCSIsCatPo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatPs +extern __typeof (xmlUCSIsCatPs) xmlUCSIsCatPs __attribute((alias("xmlUCSIsCatPs__internal_alias"))); +#else +#ifndef xmlUCSIsCatPs +extern __typeof (xmlUCSIsCatPs) xmlUCSIsCatPs__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatPs xmlUCSIsCatPs__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatS +extern __typeof (xmlUCSIsCatS) xmlUCSIsCatS __attribute((alias("xmlUCSIsCatS__internal_alias"))); +#else +#ifndef xmlUCSIsCatS +extern __typeof (xmlUCSIsCatS) xmlUCSIsCatS__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatS xmlUCSIsCatS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatSc +extern __typeof (xmlUCSIsCatSc) xmlUCSIsCatSc __attribute((alias("xmlUCSIsCatSc__internal_alias"))); +#else +#ifndef xmlUCSIsCatSc +extern __typeof (xmlUCSIsCatSc) xmlUCSIsCatSc__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatSc xmlUCSIsCatSc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatSk +extern __typeof (xmlUCSIsCatSk) xmlUCSIsCatSk __attribute((alias("xmlUCSIsCatSk__internal_alias"))); +#else +#ifndef xmlUCSIsCatSk +extern __typeof (xmlUCSIsCatSk) xmlUCSIsCatSk__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatSk xmlUCSIsCatSk__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatSm +extern __typeof (xmlUCSIsCatSm) xmlUCSIsCatSm __attribute((alias("xmlUCSIsCatSm__internal_alias"))); +#else +#ifndef xmlUCSIsCatSm +extern __typeof (xmlUCSIsCatSm) xmlUCSIsCatSm__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatSm xmlUCSIsCatSm__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatSo +extern __typeof (xmlUCSIsCatSo) xmlUCSIsCatSo __attribute((alias("xmlUCSIsCatSo__internal_alias"))); +#else +#ifndef xmlUCSIsCatSo +extern __typeof (xmlUCSIsCatSo) xmlUCSIsCatSo__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatSo xmlUCSIsCatSo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatZ +extern __typeof (xmlUCSIsCatZ) xmlUCSIsCatZ __attribute((alias("xmlUCSIsCatZ__internal_alias"))); +#else +#ifndef xmlUCSIsCatZ +extern __typeof (xmlUCSIsCatZ) xmlUCSIsCatZ__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatZ xmlUCSIsCatZ__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatZl +extern __typeof (xmlUCSIsCatZl) xmlUCSIsCatZl __attribute((alias("xmlUCSIsCatZl__internal_alias"))); +#else +#ifndef xmlUCSIsCatZl +extern __typeof (xmlUCSIsCatZl) xmlUCSIsCatZl__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatZl xmlUCSIsCatZl__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatZp +extern __typeof (xmlUCSIsCatZp) xmlUCSIsCatZp __attribute((alias("xmlUCSIsCatZp__internal_alias"))); +#else +#ifndef xmlUCSIsCatZp +extern __typeof (xmlUCSIsCatZp) xmlUCSIsCatZp__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatZp xmlUCSIsCatZp__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCatZs +extern __typeof (xmlUCSIsCatZs) xmlUCSIsCatZs __attribute((alias("xmlUCSIsCatZs__internal_alias"))); +#else +#ifndef xmlUCSIsCatZs +extern __typeof (xmlUCSIsCatZs) xmlUCSIsCatZs__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCatZs xmlUCSIsCatZs__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCherokee +extern __typeof (xmlUCSIsCherokee) xmlUCSIsCherokee __attribute((alias("xmlUCSIsCherokee__internal_alias"))); +#else +#ifndef xmlUCSIsCherokee +extern __typeof (xmlUCSIsCherokee) xmlUCSIsCherokee__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCherokee xmlUCSIsCherokee__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCombiningDiacriticalMarks +extern __typeof (xmlUCSIsCombiningDiacriticalMarks) xmlUCSIsCombiningDiacriticalMarks __attribute((alias("xmlUCSIsCombiningDiacriticalMarks__internal_alias"))); +#else +#ifndef xmlUCSIsCombiningDiacriticalMarks +extern __typeof (xmlUCSIsCombiningDiacriticalMarks) xmlUCSIsCombiningDiacriticalMarks__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCombiningDiacriticalMarks xmlUCSIsCombiningDiacriticalMarks__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCombiningDiacriticalMarksforSymbols +extern __typeof (xmlUCSIsCombiningDiacriticalMarksforSymbols) xmlUCSIsCombiningDiacriticalMarksforSymbols __attribute((alias("xmlUCSIsCombiningDiacriticalMarksforSymbols__internal_alias"))); +#else +#ifndef xmlUCSIsCombiningDiacriticalMarksforSymbols +extern __typeof (xmlUCSIsCombiningDiacriticalMarksforSymbols) xmlUCSIsCombiningDiacriticalMarksforSymbols__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCombiningDiacriticalMarksforSymbols xmlUCSIsCombiningDiacriticalMarksforSymbols__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCombiningHalfMarks +extern __typeof (xmlUCSIsCombiningHalfMarks) xmlUCSIsCombiningHalfMarks __attribute((alias("xmlUCSIsCombiningHalfMarks__internal_alias"))); +#else +#ifndef xmlUCSIsCombiningHalfMarks +extern __typeof (xmlUCSIsCombiningHalfMarks) xmlUCSIsCombiningHalfMarks__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCombiningHalfMarks xmlUCSIsCombiningHalfMarks__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCombiningMarksforSymbols +extern __typeof (xmlUCSIsCombiningMarksforSymbols) xmlUCSIsCombiningMarksforSymbols __attribute((alias("xmlUCSIsCombiningMarksforSymbols__internal_alias"))); +#else +#ifndef xmlUCSIsCombiningMarksforSymbols +extern __typeof (xmlUCSIsCombiningMarksforSymbols) xmlUCSIsCombiningMarksforSymbols__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCombiningMarksforSymbols xmlUCSIsCombiningMarksforSymbols__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsControlPictures +extern __typeof (xmlUCSIsControlPictures) xmlUCSIsControlPictures __attribute((alias("xmlUCSIsControlPictures__internal_alias"))); +#else +#ifndef xmlUCSIsControlPictures +extern __typeof (xmlUCSIsControlPictures) xmlUCSIsControlPictures__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsControlPictures xmlUCSIsControlPictures__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCurrencySymbols +extern __typeof (xmlUCSIsCurrencySymbols) xmlUCSIsCurrencySymbols __attribute((alias("xmlUCSIsCurrencySymbols__internal_alias"))); +#else +#ifndef xmlUCSIsCurrencySymbols +extern __typeof (xmlUCSIsCurrencySymbols) xmlUCSIsCurrencySymbols__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCurrencySymbols xmlUCSIsCurrencySymbols__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCypriotSyllabary +extern __typeof (xmlUCSIsCypriotSyllabary) xmlUCSIsCypriotSyllabary __attribute((alias("xmlUCSIsCypriotSyllabary__internal_alias"))); +#else +#ifndef xmlUCSIsCypriotSyllabary +extern __typeof (xmlUCSIsCypriotSyllabary) xmlUCSIsCypriotSyllabary__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCypriotSyllabary xmlUCSIsCypriotSyllabary__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCyrillic +extern __typeof (xmlUCSIsCyrillic) xmlUCSIsCyrillic __attribute((alias("xmlUCSIsCyrillic__internal_alias"))); +#else +#ifndef xmlUCSIsCyrillic +extern __typeof (xmlUCSIsCyrillic) xmlUCSIsCyrillic__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCyrillic xmlUCSIsCyrillic__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsCyrillicSupplement +extern __typeof (xmlUCSIsCyrillicSupplement) xmlUCSIsCyrillicSupplement __attribute((alias("xmlUCSIsCyrillicSupplement__internal_alias"))); +#else +#ifndef xmlUCSIsCyrillicSupplement +extern __typeof (xmlUCSIsCyrillicSupplement) xmlUCSIsCyrillicSupplement__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsCyrillicSupplement xmlUCSIsCyrillicSupplement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsDeseret +extern __typeof (xmlUCSIsDeseret) xmlUCSIsDeseret __attribute((alias("xmlUCSIsDeseret__internal_alias"))); +#else +#ifndef xmlUCSIsDeseret +extern __typeof (xmlUCSIsDeseret) xmlUCSIsDeseret__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsDeseret xmlUCSIsDeseret__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsDevanagari +extern __typeof (xmlUCSIsDevanagari) xmlUCSIsDevanagari __attribute((alias("xmlUCSIsDevanagari__internal_alias"))); +#else +#ifndef xmlUCSIsDevanagari +extern __typeof (xmlUCSIsDevanagari) xmlUCSIsDevanagari__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsDevanagari xmlUCSIsDevanagari__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsDingbats +extern __typeof (xmlUCSIsDingbats) xmlUCSIsDingbats __attribute((alias("xmlUCSIsDingbats__internal_alias"))); +#else +#ifndef xmlUCSIsDingbats +extern __typeof (xmlUCSIsDingbats) xmlUCSIsDingbats__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsDingbats xmlUCSIsDingbats__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsEnclosedAlphanumerics +extern __typeof (xmlUCSIsEnclosedAlphanumerics) xmlUCSIsEnclosedAlphanumerics __attribute((alias("xmlUCSIsEnclosedAlphanumerics__internal_alias"))); +#else +#ifndef xmlUCSIsEnclosedAlphanumerics +extern __typeof (xmlUCSIsEnclosedAlphanumerics) xmlUCSIsEnclosedAlphanumerics__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsEnclosedAlphanumerics xmlUCSIsEnclosedAlphanumerics__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsEnclosedCJKLettersandMonths +extern __typeof (xmlUCSIsEnclosedCJKLettersandMonths) xmlUCSIsEnclosedCJKLettersandMonths __attribute((alias("xmlUCSIsEnclosedCJKLettersandMonths__internal_alias"))); +#else +#ifndef xmlUCSIsEnclosedCJKLettersandMonths +extern __typeof (xmlUCSIsEnclosedCJKLettersandMonths) xmlUCSIsEnclosedCJKLettersandMonths__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsEnclosedCJKLettersandMonths xmlUCSIsEnclosedCJKLettersandMonths__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsEthiopic +extern __typeof (xmlUCSIsEthiopic) xmlUCSIsEthiopic __attribute((alias("xmlUCSIsEthiopic__internal_alias"))); +#else +#ifndef xmlUCSIsEthiopic +extern __typeof (xmlUCSIsEthiopic) xmlUCSIsEthiopic__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsEthiopic xmlUCSIsEthiopic__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsGeneralPunctuation +extern __typeof (xmlUCSIsGeneralPunctuation) xmlUCSIsGeneralPunctuation __attribute((alias("xmlUCSIsGeneralPunctuation__internal_alias"))); +#else +#ifndef xmlUCSIsGeneralPunctuation +extern __typeof (xmlUCSIsGeneralPunctuation) xmlUCSIsGeneralPunctuation__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsGeneralPunctuation xmlUCSIsGeneralPunctuation__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsGeometricShapes +extern __typeof (xmlUCSIsGeometricShapes) xmlUCSIsGeometricShapes __attribute((alias("xmlUCSIsGeometricShapes__internal_alias"))); +#else +#ifndef xmlUCSIsGeometricShapes +extern __typeof (xmlUCSIsGeometricShapes) xmlUCSIsGeometricShapes__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsGeometricShapes xmlUCSIsGeometricShapes__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsGeorgian +extern __typeof (xmlUCSIsGeorgian) xmlUCSIsGeorgian __attribute((alias("xmlUCSIsGeorgian__internal_alias"))); +#else +#ifndef xmlUCSIsGeorgian +extern __typeof (xmlUCSIsGeorgian) xmlUCSIsGeorgian__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsGeorgian xmlUCSIsGeorgian__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsGothic +extern __typeof (xmlUCSIsGothic) xmlUCSIsGothic __attribute((alias("xmlUCSIsGothic__internal_alias"))); +#else +#ifndef xmlUCSIsGothic +extern __typeof (xmlUCSIsGothic) xmlUCSIsGothic__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsGothic xmlUCSIsGothic__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsGreek +extern __typeof (xmlUCSIsGreek) xmlUCSIsGreek __attribute((alias("xmlUCSIsGreek__internal_alias"))); +#else +#ifndef xmlUCSIsGreek +extern __typeof (xmlUCSIsGreek) xmlUCSIsGreek__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsGreek xmlUCSIsGreek__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsGreekExtended +extern __typeof (xmlUCSIsGreekExtended) xmlUCSIsGreekExtended __attribute((alias("xmlUCSIsGreekExtended__internal_alias"))); +#else +#ifndef xmlUCSIsGreekExtended +extern __typeof (xmlUCSIsGreekExtended) xmlUCSIsGreekExtended__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsGreekExtended xmlUCSIsGreekExtended__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsGreekandCoptic +extern __typeof (xmlUCSIsGreekandCoptic) xmlUCSIsGreekandCoptic __attribute((alias("xmlUCSIsGreekandCoptic__internal_alias"))); +#else +#ifndef xmlUCSIsGreekandCoptic +extern __typeof (xmlUCSIsGreekandCoptic) xmlUCSIsGreekandCoptic__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsGreekandCoptic xmlUCSIsGreekandCoptic__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsGujarati +extern __typeof (xmlUCSIsGujarati) xmlUCSIsGujarati __attribute((alias("xmlUCSIsGujarati__internal_alias"))); +#else +#ifndef xmlUCSIsGujarati +extern __typeof (xmlUCSIsGujarati) xmlUCSIsGujarati__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsGujarati xmlUCSIsGujarati__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsGurmukhi +extern __typeof (xmlUCSIsGurmukhi) xmlUCSIsGurmukhi __attribute((alias("xmlUCSIsGurmukhi__internal_alias"))); +#else +#ifndef xmlUCSIsGurmukhi +extern __typeof (xmlUCSIsGurmukhi) xmlUCSIsGurmukhi__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsGurmukhi xmlUCSIsGurmukhi__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsHalfwidthandFullwidthForms +extern __typeof (xmlUCSIsHalfwidthandFullwidthForms) xmlUCSIsHalfwidthandFullwidthForms __attribute((alias("xmlUCSIsHalfwidthandFullwidthForms__internal_alias"))); +#else +#ifndef xmlUCSIsHalfwidthandFullwidthForms +extern __typeof (xmlUCSIsHalfwidthandFullwidthForms) xmlUCSIsHalfwidthandFullwidthForms__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsHalfwidthandFullwidthForms xmlUCSIsHalfwidthandFullwidthForms__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsHangulCompatibilityJamo +extern __typeof (xmlUCSIsHangulCompatibilityJamo) xmlUCSIsHangulCompatibilityJamo __attribute((alias("xmlUCSIsHangulCompatibilityJamo__internal_alias"))); +#else +#ifndef xmlUCSIsHangulCompatibilityJamo +extern __typeof (xmlUCSIsHangulCompatibilityJamo) xmlUCSIsHangulCompatibilityJamo__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsHangulCompatibilityJamo xmlUCSIsHangulCompatibilityJamo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsHangulJamo +extern __typeof (xmlUCSIsHangulJamo) xmlUCSIsHangulJamo __attribute((alias("xmlUCSIsHangulJamo__internal_alias"))); +#else +#ifndef xmlUCSIsHangulJamo +extern __typeof (xmlUCSIsHangulJamo) xmlUCSIsHangulJamo__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsHangulJamo xmlUCSIsHangulJamo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsHangulSyllables +extern __typeof (xmlUCSIsHangulSyllables) xmlUCSIsHangulSyllables __attribute((alias("xmlUCSIsHangulSyllables__internal_alias"))); +#else +#ifndef xmlUCSIsHangulSyllables +extern __typeof (xmlUCSIsHangulSyllables) xmlUCSIsHangulSyllables__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsHangulSyllables xmlUCSIsHangulSyllables__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsHanunoo +extern __typeof (xmlUCSIsHanunoo) xmlUCSIsHanunoo __attribute((alias("xmlUCSIsHanunoo__internal_alias"))); +#else +#ifndef xmlUCSIsHanunoo +extern __typeof (xmlUCSIsHanunoo) xmlUCSIsHanunoo__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsHanunoo xmlUCSIsHanunoo__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsHebrew +extern __typeof (xmlUCSIsHebrew) xmlUCSIsHebrew __attribute((alias("xmlUCSIsHebrew__internal_alias"))); +#else +#ifndef xmlUCSIsHebrew +extern __typeof (xmlUCSIsHebrew) xmlUCSIsHebrew__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsHebrew xmlUCSIsHebrew__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsHighPrivateUseSurrogates +extern __typeof (xmlUCSIsHighPrivateUseSurrogates) xmlUCSIsHighPrivateUseSurrogates __attribute((alias("xmlUCSIsHighPrivateUseSurrogates__internal_alias"))); +#else +#ifndef xmlUCSIsHighPrivateUseSurrogates +extern __typeof (xmlUCSIsHighPrivateUseSurrogates) xmlUCSIsHighPrivateUseSurrogates__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsHighPrivateUseSurrogates xmlUCSIsHighPrivateUseSurrogates__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsHighSurrogates +extern __typeof (xmlUCSIsHighSurrogates) xmlUCSIsHighSurrogates __attribute((alias("xmlUCSIsHighSurrogates__internal_alias"))); +#else +#ifndef xmlUCSIsHighSurrogates +extern __typeof (xmlUCSIsHighSurrogates) xmlUCSIsHighSurrogates__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsHighSurrogates xmlUCSIsHighSurrogates__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsHiragana +extern __typeof (xmlUCSIsHiragana) xmlUCSIsHiragana __attribute((alias("xmlUCSIsHiragana__internal_alias"))); +#else +#ifndef xmlUCSIsHiragana +extern __typeof (xmlUCSIsHiragana) xmlUCSIsHiragana__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsHiragana xmlUCSIsHiragana__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsIPAExtensions +extern __typeof (xmlUCSIsIPAExtensions) xmlUCSIsIPAExtensions __attribute((alias("xmlUCSIsIPAExtensions__internal_alias"))); +#else +#ifndef xmlUCSIsIPAExtensions +extern __typeof (xmlUCSIsIPAExtensions) xmlUCSIsIPAExtensions__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsIPAExtensions xmlUCSIsIPAExtensions__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsIdeographicDescriptionCharacters +extern __typeof (xmlUCSIsIdeographicDescriptionCharacters) xmlUCSIsIdeographicDescriptionCharacters __attribute((alias("xmlUCSIsIdeographicDescriptionCharacters__internal_alias"))); +#else +#ifndef xmlUCSIsIdeographicDescriptionCharacters +extern __typeof (xmlUCSIsIdeographicDescriptionCharacters) xmlUCSIsIdeographicDescriptionCharacters__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsIdeographicDescriptionCharacters xmlUCSIsIdeographicDescriptionCharacters__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsKanbun +extern __typeof (xmlUCSIsKanbun) xmlUCSIsKanbun __attribute((alias("xmlUCSIsKanbun__internal_alias"))); +#else +#ifndef xmlUCSIsKanbun +extern __typeof (xmlUCSIsKanbun) xmlUCSIsKanbun__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsKanbun xmlUCSIsKanbun__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsKangxiRadicals +extern __typeof (xmlUCSIsKangxiRadicals) xmlUCSIsKangxiRadicals __attribute((alias("xmlUCSIsKangxiRadicals__internal_alias"))); +#else +#ifndef xmlUCSIsKangxiRadicals +extern __typeof (xmlUCSIsKangxiRadicals) xmlUCSIsKangxiRadicals__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsKangxiRadicals xmlUCSIsKangxiRadicals__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsKannada +extern __typeof (xmlUCSIsKannada) xmlUCSIsKannada __attribute((alias("xmlUCSIsKannada__internal_alias"))); +#else +#ifndef xmlUCSIsKannada +extern __typeof (xmlUCSIsKannada) xmlUCSIsKannada__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsKannada xmlUCSIsKannada__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsKatakana +extern __typeof (xmlUCSIsKatakana) xmlUCSIsKatakana __attribute((alias("xmlUCSIsKatakana__internal_alias"))); +#else +#ifndef xmlUCSIsKatakana +extern __typeof (xmlUCSIsKatakana) xmlUCSIsKatakana__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsKatakana xmlUCSIsKatakana__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsKatakanaPhoneticExtensions +extern __typeof (xmlUCSIsKatakanaPhoneticExtensions) xmlUCSIsKatakanaPhoneticExtensions __attribute((alias("xmlUCSIsKatakanaPhoneticExtensions__internal_alias"))); +#else +#ifndef xmlUCSIsKatakanaPhoneticExtensions +extern __typeof (xmlUCSIsKatakanaPhoneticExtensions) xmlUCSIsKatakanaPhoneticExtensions__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsKatakanaPhoneticExtensions xmlUCSIsKatakanaPhoneticExtensions__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsKhmer +extern __typeof (xmlUCSIsKhmer) xmlUCSIsKhmer __attribute((alias("xmlUCSIsKhmer__internal_alias"))); +#else +#ifndef xmlUCSIsKhmer +extern __typeof (xmlUCSIsKhmer) xmlUCSIsKhmer__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsKhmer xmlUCSIsKhmer__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsKhmerSymbols +extern __typeof (xmlUCSIsKhmerSymbols) xmlUCSIsKhmerSymbols __attribute((alias("xmlUCSIsKhmerSymbols__internal_alias"))); +#else +#ifndef xmlUCSIsKhmerSymbols +extern __typeof (xmlUCSIsKhmerSymbols) xmlUCSIsKhmerSymbols__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsKhmerSymbols xmlUCSIsKhmerSymbols__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsLao +extern __typeof (xmlUCSIsLao) xmlUCSIsLao __attribute((alias("xmlUCSIsLao__internal_alias"))); +#else +#ifndef xmlUCSIsLao +extern __typeof (xmlUCSIsLao) xmlUCSIsLao__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsLao xmlUCSIsLao__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsLatin1Supplement +extern __typeof (xmlUCSIsLatin1Supplement) xmlUCSIsLatin1Supplement __attribute((alias("xmlUCSIsLatin1Supplement__internal_alias"))); +#else +#ifndef xmlUCSIsLatin1Supplement +extern __typeof (xmlUCSIsLatin1Supplement) xmlUCSIsLatin1Supplement__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsLatin1Supplement xmlUCSIsLatin1Supplement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsLatinExtendedA +extern __typeof (xmlUCSIsLatinExtendedA) xmlUCSIsLatinExtendedA __attribute((alias("xmlUCSIsLatinExtendedA__internal_alias"))); +#else +#ifndef xmlUCSIsLatinExtendedA +extern __typeof (xmlUCSIsLatinExtendedA) xmlUCSIsLatinExtendedA__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsLatinExtendedA xmlUCSIsLatinExtendedA__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsLatinExtendedAdditional +extern __typeof (xmlUCSIsLatinExtendedAdditional) xmlUCSIsLatinExtendedAdditional __attribute((alias("xmlUCSIsLatinExtendedAdditional__internal_alias"))); +#else +#ifndef xmlUCSIsLatinExtendedAdditional +extern __typeof (xmlUCSIsLatinExtendedAdditional) xmlUCSIsLatinExtendedAdditional__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsLatinExtendedAdditional xmlUCSIsLatinExtendedAdditional__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsLatinExtendedB +extern __typeof (xmlUCSIsLatinExtendedB) xmlUCSIsLatinExtendedB __attribute((alias("xmlUCSIsLatinExtendedB__internal_alias"))); +#else +#ifndef xmlUCSIsLatinExtendedB +extern __typeof (xmlUCSIsLatinExtendedB) xmlUCSIsLatinExtendedB__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsLatinExtendedB xmlUCSIsLatinExtendedB__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsLetterlikeSymbols +extern __typeof (xmlUCSIsLetterlikeSymbols) xmlUCSIsLetterlikeSymbols __attribute((alias("xmlUCSIsLetterlikeSymbols__internal_alias"))); +#else +#ifndef xmlUCSIsLetterlikeSymbols +extern __typeof (xmlUCSIsLetterlikeSymbols) xmlUCSIsLetterlikeSymbols__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsLetterlikeSymbols xmlUCSIsLetterlikeSymbols__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsLimbu +extern __typeof (xmlUCSIsLimbu) xmlUCSIsLimbu __attribute((alias("xmlUCSIsLimbu__internal_alias"))); +#else +#ifndef xmlUCSIsLimbu +extern __typeof (xmlUCSIsLimbu) xmlUCSIsLimbu__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsLimbu xmlUCSIsLimbu__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsLinearBIdeograms +extern __typeof (xmlUCSIsLinearBIdeograms) xmlUCSIsLinearBIdeograms __attribute((alias("xmlUCSIsLinearBIdeograms__internal_alias"))); +#else +#ifndef xmlUCSIsLinearBIdeograms +extern __typeof (xmlUCSIsLinearBIdeograms) xmlUCSIsLinearBIdeograms__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsLinearBIdeograms xmlUCSIsLinearBIdeograms__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsLinearBSyllabary +extern __typeof (xmlUCSIsLinearBSyllabary) xmlUCSIsLinearBSyllabary __attribute((alias("xmlUCSIsLinearBSyllabary__internal_alias"))); +#else +#ifndef xmlUCSIsLinearBSyllabary +extern __typeof (xmlUCSIsLinearBSyllabary) xmlUCSIsLinearBSyllabary__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsLinearBSyllabary xmlUCSIsLinearBSyllabary__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsLowSurrogates +extern __typeof (xmlUCSIsLowSurrogates) xmlUCSIsLowSurrogates __attribute((alias("xmlUCSIsLowSurrogates__internal_alias"))); +#else +#ifndef xmlUCSIsLowSurrogates +extern __typeof (xmlUCSIsLowSurrogates) xmlUCSIsLowSurrogates__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsLowSurrogates xmlUCSIsLowSurrogates__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsMalayalam +extern __typeof (xmlUCSIsMalayalam) xmlUCSIsMalayalam __attribute((alias("xmlUCSIsMalayalam__internal_alias"))); +#else +#ifndef xmlUCSIsMalayalam +extern __typeof (xmlUCSIsMalayalam) xmlUCSIsMalayalam__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsMalayalam xmlUCSIsMalayalam__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsMathematicalAlphanumericSymbols +extern __typeof (xmlUCSIsMathematicalAlphanumericSymbols) xmlUCSIsMathematicalAlphanumericSymbols __attribute((alias("xmlUCSIsMathematicalAlphanumericSymbols__internal_alias"))); +#else +#ifndef xmlUCSIsMathematicalAlphanumericSymbols +extern __typeof (xmlUCSIsMathematicalAlphanumericSymbols) xmlUCSIsMathematicalAlphanumericSymbols__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsMathematicalAlphanumericSymbols xmlUCSIsMathematicalAlphanumericSymbols__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsMathematicalOperators +extern __typeof (xmlUCSIsMathematicalOperators) xmlUCSIsMathematicalOperators __attribute((alias("xmlUCSIsMathematicalOperators__internal_alias"))); +#else +#ifndef xmlUCSIsMathematicalOperators +extern __typeof (xmlUCSIsMathematicalOperators) xmlUCSIsMathematicalOperators__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsMathematicalOperators xmlUCSIsMathematicalOperators__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsMiscellaneousMathematicalSymbolsA +extern __typeof (xmlUCSIsMiscellaneousMathematicalSymbolsA) xmlUCSIsMiscellaneousMathematicalSymbolsA __attribute((alias("xmlUCSIsMiscellaneousMathematicalSymbolsA__internal_alias"))); +#else +#ifndef xmlUCSIsMiscellaneousMathematicalSymbolsA +extern __typeof (xmlUCSIsMiscellaneousMathematicalSymbolsA) xmlUCSIsMiscellaneousMathematicalSymbolsA__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsMiscellaneousMathematicalSymbolsA xmlUCSIsMiscellaneousMathematicalSymbolsA__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsMiscellaneousMathematicalSymbolsB +extern __typeof (xmlUCSIsMiscellaneousMathematicalSymbolsB) xmlUCSIsMiscellaneousMathematicalSymbolsB __attribute((alias("xmlUCSIsMiscellaneousMathematicalSymbolsB__internal_alias"))); +#else +#ifndef xmlUCSIsMiscellaneousMathematicalSymbolsB +extern __typeof (xmlUCSIsMiscellaneousMathematicalSymbolsB) xmlUCSIsMiscellaneousMathematicalSymbolsB__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsMiscellaneousMathematicalSymbolsB xmlUCSIsMiscellaneousMathematicalSymbolsB__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsMiscellaneousSymbols +extern __typeof (xmlUCSIsMiscellaneousSymbols) xmlUCSIsMiscellaneousSymbols __attribute((alias("xmlUCSIsMiscellaneousSymbols__internal_alias"))); +#else +#ifndef xmlUCSIsMiscellaneousSymbols +extern __typeof (xmlUCSIsMiscellaneousSymbols) xmlUCSIsMiscellaneousSymbols__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsMiscellaneousSymbols xmlUCSIsMiscellaneousSymbols__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsMiscellaneousSymbolsandArrows +extern __typeof (xmlUCSIsMiscellaneousSymbolsandArrows) xmlUCSIsMiscellaneousSymbolsandArrows __attribute((alias("xmlUCSIsMiscellaneousSymbolsandArrows__internal_alias"))); +#else +#ifndef xmlUCSIsMiscellaneousSymbolsandArrows +extern __typeof (xmlUCSIsMiscellaneousSymbolsandArrows) xmlUCSIsMiscellaneousSymbolsandArrows__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsMiscellaneousSymbolsandArrows xmlUCSIsMiscellaneousSymbolsandArrows__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsMiscellaneousTechnical +extern __typeof (xmlUCSIsMiscellaneousTechnical) xmlUCSIsMiscellaneousTechnical __attribute((alias("xmlUCSIsMiscellaneousTechnical__internal_alias"))); +#else +#ifndef xmlUCSIsMiscellaneousTechnical +extern __typeof (xmlUCSIsMiscellaneousTechnical) xmlUCSIsMiscellaneousTechnical__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsMiscellaneousTechnical xmlUCSIsMiscellaneousTechnical__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsMongolian +extern __typeof (xmlUCSIsMongolian) xmlUCSIsMongolian __attribute((alias("xmlUCSIsMongolian__internal_alias"))); +#else +#ifndef xmlUCSIsMongolian +extern __typeof (xmlUCSIsMongolian) xmlUCSIsMongolian__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsMongolian xmlUCSIsMongolian__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsMusicalSymbols +extern __typeof (xmlUCSIsMusicalSymbols) xmlUCSIsMusicalSymbols __attribute((alias("xmlUCSIsMusicalSymbols__internal_alias"))); +#else +#ifndef xmlUCSIsMusicalSymbols +extern __typeof (xmlUCSIsMusicalSymbols) xmlUCSIsMusicalSymbols__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsMusicalSymbols xmlUCSIsMusicalSymbols__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsMyanmar +extern __typeof (xmlUCSIsMyanmar) xmlUCSIsMyanmar __attribute((alias("xmlUCSIsMyanmar__internal_alias"))); +#else +#ifndef xmlUCSIsMyanmar +extern __typeof (xmlUCSIsMyanmar) xmlUCSIsMyanmar__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsMyanmar xmlUCSIsMyanmar__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsNumberForms +extern __typeof (xmlUCSIsNumberForms) xmlUCSIsNumberForms __attribute((alias("xmlUCSIsNumberForms__internal_alias"))); +#else +#ifndef xmlUCSIsNumberForms +extern __typeof (xmlUCSIsNumberForms) xmlUCSIsNumberForms__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsNumberForms xmlUCSIsNumberForms__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsOgham +extern __typeof (xmlUCSIsOgham) xmlUCSIsOgham __attribute((alias("xmlUCSIsOgham__internal_alias"))); +#else +#ifndef xmlUCSIsOgham +extern __typeof (xmlUCSIsOgham) xmlUCSIsOgham__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsOgham xmlUCSIsOgham__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsOldItalic +extern __typeof (xmlUCSIsOldItalic) xmlUCSIsOldItalic __attribute((alias("xmlUCSIsOldItalic__internal_alias"))); +#else +#ifndef xmlUCSIsOldItalic +extern __typeof (xmlUCSIsOldItalic) xmlUCSIsOldItalic__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsOldItalic xmlUCSIsOldItalic__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsOpticalCharacterRecognition +extern __typeof (xmlUCSIsOpticalCharacterRecognition) xmlUCSIsOpticalCharacterRecognition __attribute((alias("xmlUCSIsOpticalCharacterRecognition__internal_alias"))); +#else +#ifndef xmlUCSIsOpticalCharacterRecognition +extern __typeof (xmlUCSIsOpticalCharacterRecognition) xmlUCSIsOpticalCharacterRecognition__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsOpticalCharacterRecognition xmlUCSIsOpticalCharacterRecognition__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsOriya +extern __typeof (xmlUCSIsOriya) xmlUCSIsOriya __attribute((alias("xmlUCSIsOriya__internal_alias"))); +#else +#ifndef xmlUCSIsOriya +extern __typeof (xmlUCSIsOriya) xmlUCSIsOriya__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsOriya xmlUCSIsOriya__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsOsmanya +extern __typeof (xmlUCSIsOsmanya) xmlUCSIsOsmanya __attribute((alias("xmlUCSIsOsmanya__internal_alias"))); +#else +#ifndef xmlUCSIsOsmanya +extern __typeof (xmlUCSIsOsmanya) xmlUCSIsOsmanya__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsOsmanya xmlUCSIsOsmanya__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsPhoneticExtensions +extern __typeof (xmlUCSIsPhoneticExtensions) xmlUCSIsPhoneticExtensions __attribute((alias("xmlUCSIsPhoneticExtensions__internal_alias"))); +#else +#ifndef xmlUCSIsPhoneticExtensions +extern __typeof (xmlUCSIsPhoneticExtensions) xmlUCSIsPhoneticExtensions__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsPhoneticExtensions xmlUCSIsPhoneticExtensions__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsPrivateUse +extern __typeof (xmlUCSIsPrivateUse) xmlUCSIsPrivateUse __attribute((alias("xmlUCSIsPrivateUse__internal_alias"))); +#else +#ifndef xmlUCSIsPrivateUse +extern __typeof (xmlUCSIsPrivateUse) xmlUCSIsPrivateUse__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsPrivateUse xmlUCSIsPrivateUse__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsPrivateUseArea +extern __typeof (xmlUCSIsPrivateUseArea) xmlUCSIsPrivateUseArea __attribute((alias("xmlUCSIsPrivateUseArea__internal_alias"))); +#else +#ifndef xmlUCSIsPrivateUseArea +extern __typeof (xmlUCSIsPrivateUseArea) xmlUCSIsPrivateUseArea__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsPrivateUseArea xmlUCSIsPrivateUseArea__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsRunic +extern __typeof (xmlUCSIsRunic) xmlUCSIsRunic __attribute((alias("xmlUCSIsRunic__internal_alias"))); +#else +#ifndef xmlUCSIsRunic +extern __typeof (xmlUCSIsRunic) xmlUCSIsRunic__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsRunic xmlUCSIsRunic__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsShavian +extern __typeof (xmlUCSIsShavian) xmlUCSIsShavian __attribute((alias("xmlUCSIsShavian__internal_alias"))); +#else +#ifndef xmlUCSIsShavian +extern __typeof (xmlUCSIsShavian) xmlUCSIsShavian__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsShavian xmlUCSIsShavian__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsSinhala +extern __typeof (xmlUCSIsSinhala) xmlUCSIsSinhala __attribute((alias("xmlUCSIsSinhala__internal_alias"))); +#else +#ifndef xmlUCSIsSinhala +extern __typeof (xmlUCSIsSinhala) xmlUCSIsSinhala__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsSinhala xmlUCSIsSinhala__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsSmallFormVariants +extern __typeof (xmlUCSIsSmallFormVariants) xmlUCSIsSmallFormVariants __attribute((alias("xmlUCSIsSmallFormVariants__internal_alias"))); +#else +#ifndef xmlUCSIsSmallFormVariants +extern __typeof (xmlUCSIsSmallFormVariants) xmlUCSIsSmallFormVariants__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsSmallFormVariants xmlUCSIsSmallFormVariants__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsSpacingModifierLetters +extern __typeof (xmlUCSIsSpacingModifierLetters) xmlUCSIsSpacingModifierLetters __attribute((alias("xmlUCSIsSpacingModifierLetters__internal_alias"))); +#else +#ifndef xmlUCSIsSpacingModifierLetters +extern __typeof (xmlUCSIsSpacingModifierLetters) xmlUCSIsSpacingModifierLetters__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsSpacingModifierLetters xmlUCSIsSpacingModifierLetters__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsSpecials +extern __typeof (xmlUCSIsSpecials) xmlUCSIsSpecials __attribute((alias("xmlUCSIsSpecials__internal_alias"))); +#else +#ifndef xmlUCSIsSpecials +extern __typeof (xmlUCSIsSpecials) xmlUCSIsSpecials__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsSpecials xmlUCSIsSpecials__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsSuperscriptsandSubscripts +extern __typeof (xmlUCSIsSuperscriptsandSubscripts) xmlUCSIsSuperscriptsandSubscripts __attribute((alias("xmlUCSIsSuperscriptsandSubscripts__internal_alias"))); +#else +#ifndef xmlUCSIsSuperscriptsandSubscripts +extern __typeof (xmlUCSIsSuperscriptsandSubscripts) xmlUCSIsSuperscriptsandSubscripts__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsSuperscriptsandSubscripts xmlUCSIsSuperscriptsandSubscripts__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsSupplementalArrowsA +extern __typeof (xmlUCSIsSupplementalArrowsA) xmlUCSIsSupplementalArrowsA __attribute((alias("xmlUCSIsSupplementalArrowsA__internal_alias"))); +#else +#ifndef xmlUCSIsSupplementalArrowsA +extern __typeof (xmlUCSIsSupplementalArrowsA) xmlUCSIsSupplementalArrowsA__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsSupplementalArrowsA xmlUCSIsSupplementalArrowsA__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsSupplementalArrowsB +extern __typeof (xmlUCSIsSupplementalArrowsB) xmlUCSIsSupplementalArrowsB __attribute((alias("xmlUCSIsSupplementalArrowsB__internal_alias"))); +#else +#ifndef xmlUCSIsSupplementalArrowsB +extern __typeof (xmlUCSIsSupplementalArrowsB) xmlUCSIsSupplementalArrowsB__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsSupplementalArrowsB xmlUCSIsSupplementalArrowsB__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsSupplementalMathematicalOperators +extern __typeof (xmlUCSIsSupplementalMathematicalOperators) xmlUCSIsSupplementalMathematicalOperators __attribute((alias("xmlUCSIsSupplementalMathematicalOperators__internal_alias"))); +#else +#ifndef xmlUCSIsSupplementalMathematicalOperators +extern __typeof (xmlUCSIsSupplementalMathematicalOperators) xmlUCSIsSupplementalMathematicalOperators__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsSupplementalMathematicalOperators xmlUCSIsSupplementalMathematicalOperators__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsSupplementaryPrivateUseAreaA +extern __typeof (xmlUCSIsSupplementaryPrivateUseAreaA) xmlUCSIsSupplementaryPrivateUseAreaA __attribute((alias("xmlUCSIsSupplementaryPrivateUseAreaA__internal_alias"))); +#else +#ifndef xmlUCSIsSupplementaryPrivateUseAreaA +extern __typeof (xmlUCSIsSupplementaryPrivateUseAreaA) xmlUCSIsSupplementaryPrivateUseAreaA__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsSupplementaryPrivateUseAreaA xmlUCSIsSupplementaryPrivateUseAreaA__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsSupplementaryPrivateUseAreaB +extern __typeof (xmlUCSIsSupplementaryPrivateUseAreaB) xmlUCSIsSupplementaryPrivateUseAreaB __attribute((alias("xmlUCSIsSupplementaryPrivateUseAreaB__internal_alias"))); +#else +#ifndef xmlUCSIsSupplementaryPrivateUseAreaB +extern __typeof (xmlUCSIsSupplementaryPrivateUseAreaB) xmlUCSIsSupplementaryPrivateUseAreaB__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsSupplementaryPrivateUseAreaB xmlUCSIsSupplementaryPrivateUseAreaB__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsSyriac +extern __typeof (xmlUCSIsSyriac) xmlUCSIsSyriac __attribute((alias("xmlUCSIsSyriac__internal_alias"))); +#else +#ifndef xmlUCSIsSyriac +extern __typeof (xmlUCSIsSyriac) xmlUCSIsSyriac__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsSyriac xmlUCSIsSyriac__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsTagalog +extern __typeof (xmlUCSIsTagalog) xmlUCSIsTagalog __attribute((alias("xmlUCSIsTagalog__internal_alias"))); +#else +#ifndef xmlUCSIsTagalog +extern __typeof (xmlUCSIsTagalog) xmlUCSIsTagalog__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsTagalog xmlUCSIsTagalog__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsTagbanwa +extern __typeof (xmlUCSIsTagbanwa) xmlUCSIsTagbanwa __attribute((alias("xmlUCSIsTagbanwa__internal_alias"))); +#else +#ifndef xmlUCSIsTagbanwa +extern __typeof (xmlUCSIsTagbanwa) xmlUCSIsTagbanwa__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsTagbanwa xmlUCSIsTagbanwa__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsTags +extern __typeof (xmlUCSIsTags) xmlUCSIsTags __attribute((alias("xmlUCSIsTags__internal_alias"))); +#else +#ifndef xmlUCSIsTags +extern __typeof (xmlUCSIsTags) xmlUCSIsTags__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsTags xmlUCSIsTags__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsTaiLe +extern __typeof (xmlUCSIsTaiLe) xmlUCSIsTaiLe __attribute((alias("xmlUCSIsTaiLe__internal_alias"))); +#else +#ifndef xmlUCSIsTaiLe +extern __typeof (xmlUCSIsTaiLe) xmlUCSIsTaiLe__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsTaiLe xmlUCSIsTaiLe__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsTaiXuanJingSymbols +extern __typeof (xmlUCSIsTaiXuanJingSymbols) xmlUCSIsTaiXuanJingSymbols __attribute((alias("xmlUCSIsTaiXuanJingSymbols__internal_alias"))); +#else +#ifndef xmlUCSIsTaiXuanJingSymbols +extern __typeof (xmlUCSIsTaiXuanJingSymbols) xmlUCSIsTaiXuanJingSymbols__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsTaiXuanJingSymbols xmlUCSIsTaiXuanJingSymbols__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsTamil +extern __typeof (xmlUCSIsTamil) xmlUCSIsTamil __attribute((alias("xmlUCSIsTamil__internal_alias"))); +#else +#ifndef xmlUCSIsTamil +extern __typeof (xmlUCSIsTamil) xmlUCSIsTamil__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsTamil xmlUCSIsTamil__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsTelugu +extern __typeof (xmlUCSIsTelugu) xmlUCSIsTelugu __attribute((alias("xmlUCSIsTelugu__internal_alias"))); +#else +#ifndef xmlUCSIsTelugu +extern __typeof (xmlUCSIsTelugu) xmlUCSIsTelugu__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsTelugu xmlUCSIsTelugu__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsThaana +extern __typeof (xmlUCSIsThaana) xmlUCSIsThaana __attribute((alias("xmlUCSIsThaana__internal_alias"))); +#else +#ifndef xmlUCSIsThaana +extern __typeof (xmlUCSIsThaana) xmlUCSIsThaana__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsThaana xmlUCSIsThaana__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsThai +extern __typeof (xmlUCSIsThai) xmlUCSIsThai __attribute((alias("xmlUCSIsThai__internal_alias"))); +#else +#ifndef xmlUCSIsThai +extern __typeof (xmlUCSIsThai) xmlUCSIsThai__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsThai xmlUCSIsThai__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsTibetan +extern __typeof (xmlUCSIsTibetan) xmlUCSIsTibetan __attribute((alias("xmlUCSIsTibetan__internal_alias"))); +#else +#ifndef xmlUCSIsTibetan +extern __typeof (xmlUCSIsTibetan) xmlUCSIsTibetan__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsTibetan xmlUCSIsTibetan__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsUgaritic +extern __typeof (xmlUCSIsUgaritic) xmlUCSIsUgaritic __attribute((alias("xmlUCSIsUgaritic__internal_alias"))); +#else +#ifndef xmlUCSIsUgaritic +extern __typeof (xmlUCSIsUgaritic) xmlUCSIsUgaritic__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsUgaritic xmlUCSIsUgaritic__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsUnifiedCanadianAboriginalSyllabics +extern __typeof (xmlUCSIsUnifiedCanadianAboriginalSyllabics) xmlUCSIsUnifiedCanadianAboriginalSyllabics __attribute((alias("xmlUCSIsUnifiedCanadianAboriginalSyllabics__internal_alias"))); +#else +#ifndef xmlUCSIsUnifiedCanadianAboriginalSyllabics +extern __typeof (xmlUCSIsUnifiedCanadianAboriginalSyllabics) xmlUCSIsUnifiedCanadianAboriginalSyllabics__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsUnifiedCanadianAboriginalSyllabics xmlUCSIsUnifiedCanadianAboriginalSyllabics__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsVariationSelectors +extern __typeof (xmlUCSIsVariationSelectors) xmlUCSIsVariationSelectors __attribute((alias("xmlUCSIsVariationSelectors__internal_alias"))); +#else +#ifndef xmlUCSIsVariationSelectors +extern __typeof (xmlUCSIsVariationSelectors) xmlUCSIsVariationSelectors__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsVariationSelectors xmlUCSIsVariationSelectors__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsVariationSelectorsSupplement +extern __typeof (xmlUCSIsVariationSelectorsSupplement) xmlUCSIsVariationSelectorsSupplement __attribute((alias("xmlUCSIsVariationSelectorsSupplement__internal_alias"))); +#else +#ifndef xmlUCSIsVariationSelectorsSupplement +extern __typeof (xmlUCSIsVariationSelectorsSupplement) xmlUCSIsVariationSelectorsSupplement__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsVariationSelectorsSupplement xmlUCSIsVariationSelectorsSupplement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsYiRadicals +extern __typeof (xmlUCSIsYiRadicals) xmlUCSIsYiRadicals __attribute((alias("xmlUCSIsYiRadicals__internal_alias"))); +#else +#ifndef xmlUCSIsYiRadicals +extern __typeof (xmlUCSIsYiRadicals) xmlUCSIsYiRadicals__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsYiRadicals xmlUCSIsYiRadicals__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsYiSyllables +extern __typeof (xmlUCSIsYiSyllables) xmlUCSIsYiSyllables __attribute((alias("xmlUCSIsYiSyllables__internal_alias"))); +#else +#ifndef xmlUCSIsYiSyllables +extern __typeof (xmlUCSIsYiSyllables) xmlUCSIsYiSyllables__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsYiSyllables xmlUCSIsYiSyllables__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_UNICODE_ENABLED) +#ifdef bottom_xmlunicode +#undef xmlUCSIsYijingHexagramSymbols +extern __typeof (xmlUCSIsYijingHexagramSymbols) xmlUCSIsYijingHexagramSymbols __attribute((alias("xmlUCSIsYijingHexagramSymbols__internal_alias"))); +#else +#ifndef xmlUCSIsYijingHexagramSymbols +extern __typeof (xmlUCSIsYijingHexagramSymbols) xmlUCSIsYijingHexagramSymbols__internal_alias __attribute((visibility("hidden"))); +#define xmlUCSIsYijingHexagramSymbols xmlUCSIsYijingHexagramSymbols__internal_alias +#endif +#endif +#endif + +#ifdef bottom_uri +#undef xmlURIEscape +extern __typeof (xmlURIEscape) xmlURIEscape __attribute((alias("xmlURIEscape__internal_alias"))); +#else +#ifndef xmlURIEscape +extern __typeof (xmlURIEscape) xmlURIEscape__internal_alias __attribute((visibility("hidden"))); +#define xmlURIEscape xmlURIEscape__internal_alias +#endif +#endif + +#ifdef bottom_uri +#undef xmlURIEscapeStr +extern __typeof (xmlURIEscapeStr) xmlURIEscapeStr __attribute((alias("xmlURIEscapeStr__internal_alias"))); +#else +#ifndef xmlURIEscapeStr +extern __typeof (xmlURIEscapeStr) xmlURIEscapeStr__internal_alias __attribute((visibility("hidden"))); +#define xmlURIEscapeStr xmlURIEscapeStr__internal_alias +#endif +#endif + +#ifdef bottom_uri +#undef xmlURIUnescapeString +extern __typeof (xmlURIUnescapeString) xmlURIUnescapeString __attribute((alias("xmlURIUnescapeString__internal_alias"))); +#else +#ifndef xmlURIUnescapeString +extern __typeof (xmlURIUnescapeString) xmlURIUnescapeString__internal_alias __attribute((visibility("hidden"))); +#define xmlURIUnescapeString xmlURIUnescapeString__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlUTF8Charcmp +extern __typeof (xmlUTF8Charcmp) xmlUTF8Charcmp __attribute((alias("xmlUTF8Charcmp__internal_alias"))); +#else +#ifndef xmlUTF8Charcmp +extern __typeof (xmlUTF8Charcmp) xmlUTF8Charcmp__internal_alias __attribute((visibility("hidden"))); +#define xmlUTF8Charcmp xmlUTF8Charcmp__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlUTF8Size +extern __typeof (xmlUTF8Size) xmlUTF8Size __attribute((alias("xmlUTF8Size__internal_alias"))); +#else +#ifndef xmlUTF8Size +extern __typeof (xmlUTF8Size) xmlUTF8Size__internal_alias __attribute((visibility("hidden"))); +#define xmlUTF8Size xmlUTF8Size__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlUTF8Strlen +extern __typeof (xmlUTF8Strlen) xmlUTF8Strlen __attribute((alias("xmlUTF8Strlen__internal_alias"))); +#else +#ifndef xmlUTF8Strlen +extern __typeof (xmlUTF8Strlen) xmlUTF8Strlen__internal_alias __attribute((visibility("hidden"))); +#define xmlUTF8Strlen xmlUTF8Strlen__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlUTF8Strloc +extern __typeof (xmlUTF8Strloc) xmlUTF8Strloc __attribute((alias("xmlUTF8Strloc__internal_alias"))); +#else +#ifndef xmlUTF8Strloc +extern __typeof (xmlUTF8Strloc) xmlUTF8Strloc__internal_alias __attribute((visibility("hidden"))); +#define xmlUTF8Strloc xmlUTF8Strloc__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlUTF8Strndup +extern __typeof (xmlUTF8Strndup) xmlUTF8Strndup __attribute((alias("xmlUTF8Strndup__internal_alias"))); +#else +#ifndef xmlUTF8Strndup +extern __typeof (xmlUTF8Strndup) xmlUTF8Strndup__internal_alias __attribute((visibility("hidden"))); +#define xmlUTF8Strndup xmlUTF8Strndup__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlUTF8Strpos +extern __typeof (xmlUTF8Strpos) xmlUTF8Strpos __attribute((alias("xmlUTF8Strpos__internal_alias"))); +#else +#ifndef xmlUTF8Strpos +extern __typeof (xmlUTF8Strpos) xmlUTF8Strpos__internal_alias __attribute((visibility("hidden"))); +#define xmlUTF8Strpos xmlUTF8Strpos__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlUTF8Strsize +extern __typeof (xmlUTF8Strsize) xmlUTF8Strsize __attribute((alias("xmlUTF8Strsize__internal_alias"))); +#else +#ifndef xmlUTF8Strsize +extern __typeof (xmlUTF8Strsize) xmlUTF8Strsize__internal_alias __attribute((visibility("hidden"))); +#define xmlUTF8Strsize xmlUTF8Strsize__internal_alias +#endif +#endif + +#ifdef bottom_xmlstring +#undef xmlUTF8Strsub +extern __typeof (xmlUTF8Strsub) xmlUTF8Strsub __attribute((alias("xmlUTF8Strsub__internal_alias"))); +#else +#ifndef xmlUTF8Strsub +extern __typeof (xmlUTF8Strsub) xmlUTF8Strsub__internal_alias __attribute((visibility("hidden"))); +#define xmlUTF8Strsub xmlUTF8Strsub__internal_alias +#endif +#endif + +#ifdef bottom_tree +#undef xmlUnlinkNode +extern __typeof (xmlUnlinkNode) xmlUnlinkNode __attribute((alias("xmlUnlinkNode__internal_alias"))); +#else +#ifndef xmlUnlinkNode +extern __typeof (xmlUnlinkNode) xmlUnlinkNode__internal_alias __attribute((visibility("hidden"))); +#define xmlUnlinkNode xmlUnlinkNode__internal_alias +#endif +#endif + +#ifdef bottom_threads +#undef xmlUnlockLibrary +extern __typeof (xmlUnlockLibrary) xmlUnlockLibrary __attribute((alias("xmlUnlockLibrary__internal_alias"))); +#else +#ifndef xmlUnlockLibrary +extern __typeof (xmlUnlockLibrary) xmlUnlockLibrary__internal_alias __attribute((visibility("hidden"))); +#define xmlUnlockLibrary xmlUnlockLibrary__internal_alias +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_tree +#undef xmlUnsetNsProp +extern __typeof (xmlUnsetNsProp) xmlUnsetNsProp __attribute((alias("xmlUnsetNsProp__internal_alias"))); +#else +#ifndef xmlUnsetNsProp +extern __typeof (xmlUnsetNsProp) xmlUnsetNsProp__internal_alias __attribute((visibility("hidden"))); +#define xmlUnsetNsProp xmlUnsetNsProp__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_tree +#undef xmlUnsetProp +extern __typeof (xmlUnsetProp) xmlUnsetProp __attribute((alias("xmlUnsetProp__internal_alias"))); +#else +#ifndef xmlUnsetProp +extern __typeof (xmlUnsetProp) xmlUnsetProp__internal_alias __attribute((visibility("hidden"))); +#define xmlUnsetProp xmlUnsetProp__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_valid +#undef xmlValidBuildContentModel +extern __typeof (xmlValidBuildContentModel) xmlValidBuildContentModel __attribute((alias("xmlValidBuildContentModel__internal_alias"))); +#else +#ifndef xmlValidBuildContentModel +extern __typeof (xmlValidBuildContentModel) xmlValidBuildContentModel__internal_alias __attribute((visibility("hidden"))); +#define xmlValidBuildContentModel xmlValidBuildContentModel__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidCtxtNormalizeAttributeValue +extern __typeof (xmlValidCtxtNormalizeAttributeValue) xmlValidCtxtNormalizeAttributeValue __attribute((alias("xmlValidCtxtNormalizeAttributeValue__internal_alias"))); +#else +#ifndef xmlValidCtxtNormalizeAttributeValue +extern __typeof (xmlValidCtxtNormalizeAttributeValue) xmlValidCtxtNormalizeAttributeValue__internal_alias __attribute((visibility("hidden"))); +#define xmlValidCtxtNormalizeAttributeValue xmlValidCtxtNormalizeAttributeValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidGetPotentialChildren +extern __typeof (xmlValidGetPotentialChildren) xmlValidGetPotentialChildren __attribute((alias("xmlValidGetPotentialChildren__internal_alias"))); +#else +#ifndef xmlValidGetPotentialChildren +extern __typeof (xmlValidGetPotentialChildren) xmlValidGetPotentialChildren__internal_alias __attribute((visibility("hidden"))); +#define xmlValidGetPotentialChildren xmlValidGetPotentialChildren__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidGetValidElements +extern __typeof (xmlValidGetValidElements) xmlValidGetValidElements __attribute((alias("xmlValidGetValidElements__internal_alias"))); +#else +#ifndef xmlValidGetValidElements +extern __typeof (xmlValidGetValidElements) xmlValidGetValidElements__internal_alias __attribute((visibility("hidden"))); +#define xmlValidGetValidElements xmlValidGetValidElements__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidNormalizeAttributeValue +extern __typeof (xmlValidNormalizeAttributeValue) xmlValidNormalizeAttributeValue __attribute((alias("xmlValidNormalizeAttributeValue__internal_alias"))); +#else +#ifndef xmlValidNormalizeAttributeValue +extern __typeof (xmlValidNormalizeAttributeValue) xmlValidNormalizeAttributeValue__internal_alias __attribute((visibility("hidden"))); +#define xmlValidNormalizeAttributeValue xmlValidNormalizeAttributeValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateAttributeDecl +extern __typeof (xmlValidateAttributeDecl) xmlValidateAttributeDecl __attribute((alias("xmlValidateAttributeDecl__internal_alias"))); +#else +#ifndef xmlValidateAttributeDecl +extern __typeof (xmlValidateAttributeDecl) xmlValidateAttributeDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateAttributeDecl xmlValidateAttributeDecl__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateAttributeValue +extern __typeof (xmlValidateAttributeValue) xmlValidateAttributeValue __attribute((alias("xmlValidateAttributeValue__internal_alias"))); +#else +#ifndef xmlValidateAttributeValue +extern __typeof (xmlValidateAttributeValue) xmlValidateAttributeValue__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateAttributeValue xmlValidateAttributeValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateDocument +extern __typeof (xmlValidateDocument) xmlValidateDocument __attribute((alias("xmlValidateDocument__internal_alias"))); +#else +#ifndef xmlValidateDocument +extern __typeof (xmlValidateDocument) xmlValidateDocument__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateDocument xmlValidateDocument__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateDocumentFinal +extern __typeof (xmlValidateDocumentFinal) xmlValidateDocumentFinal __attribute((alias("xmlValidateDocumentFinal__internal_alias"))); +#else +#ifndef xmlValidateDocumentFinal +extern __typeof (xmlValidateDocumentFinal) xmlValidateDocumentFinal__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateDocumentFinal xmlValidateDocumentFinal__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateDtd +extern __typeof (xmlValidateDtd) xmlValidateDtd __attribute((alias("xmlValidateDtd__internal_alias"))); +#else +#ifndef xmlValidateDtd +extern __typeof (xmlValidateDtd) xmlValidateDtd__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateDtd xmlValidateDtd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateDtdFinal +extern __typeof (xmlValidateDtdFinal) xmlValidateDtdFinal __attribute((alias("xmlValidateDtdFinal__internal_alias"))); +#else +#ifndef xmlValidateDtdFinal +extern __typeof (xmlValidateDtdFinal) xmlValidateDtdFinal__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateDtdFinal xmlValidateDtdFinal__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateElement +extern __typeof (xmlValidateElement) xmlValidateElement __attribute((alias("xmlValidateElement__internal_alias"))); +#else +#ifndef xmlValidateElement +extern __typeof (xmlValidateElement) xmlValidateElement__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateElement xmlValidateElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateElementDecl +extern __typeof (xmlValidateElementDecl) xmlValidateElementDecl __attribute((alias("xmlValidateElementDecl__internal_alias"))); +#else +#ifndef xmlValidateElementDecl +extern __typeof (xmlValidateElementDecl) xmlValidateElementDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateElementDecl xmlValidateElementDecl__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) +#ifdef bottom_tree +#undef xmlValidateNCName +extern __typeof (xmlValidateNCName) xmlValidateNCName __attribute((alias("xmlValidateNCName__internal_alias"))); +#else +#ifndef xmlValidateNCName +extern __typeof (xmlValidateNCName) xmlValidateNCName__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateNCName xmlValidateNCName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_tree +#undef xmlValidateNMToken +extern __typeof (xmlValidateNMToken) xmlValidateNMToken __attribute((alias("xmlValidateNMToken__internal_alias"))); +#else +#ifndef xmlValidateNMToken +extern __typeof (xmlValidateNMToken) xmlValidateNMToken__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateNMToken xmlValidateNMToken__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_tree +#undef xmlValidateName +extern __typeof (xmlValidateName) xmlValidateName __attribute((alias("xmlValidateName__internal_alias"))); +#else +#ifndef xmlValidateName +extern __typeof (xmlValidateName) xmlValidateName__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateName xmlValidateName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateNameValue +extern __typeof (xmlValidateNameValue) xmlValidateNameValue __attribute((alias("xmlValidateNameValue__internal_alias"))); +#else +#ifndef xmlValidateNameValue +extern __typeof (xmlValidateNameValue) xmlValidateNameValue__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateNameValue xmlValidateNameValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateNamesValue +extern __typeof (xmlValidateNamesValue) xmlValidateNamesValue __attribute((alias("xmlValidateNamesValue__internal_alias"))); +#else +#ifndef xmlValidateNamesValue +extern __typeof (xmlValidateNamesValue) xmlValidateNamesValue__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateNamesValue xmlValidateNamesValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateNmtokenValue +extern __typeof (xmlValidateNmtokenValue) xmlValidateNmtokenValue __attribute((alias("xmlValidateNmtokenValue__internal_alias"))); +#else +#ifndef xmlValidateNmtokenValue +extern __typeof (xmlValidateNmtokenValue) xmlValidateNmtokenValue__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateNmtokenValue xmlValidateNmtokenValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateNmtokensValue +extern __typeof (xmlValidateNmtokensValue) xmlValidateNmtokensValue __attribute((alias("xmlValidateNmtokensValue__internal_alias"))); +#else +#ifndef xmlValidateNmtokensValue +extern __typeof (xmlValidateNmtokensValue) xmlValidateNmtokensValue__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateNmtokensValue xmlValidateNmtokensValue__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateNotationDecl +extern __typeof (xmlValidateNotationDecl) xmlValidateNotationDecl __attribute((alias("xmlValidateNotationDecl__internal_alias"))); +#else +#ifndef xmlValidateNotationDecl +extern __typeof (xmlValidateNotationDecl) xmlValidateNotationDecl__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateNotationDecl xmlValidateNotationDecl__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_valid +#undef xmlValidateNotationUse +extern __typeof (xmlValidateNotationUse) xmlValidateNotationUse __attribute((alias("xmlValidateNotationUse__internal_alias"))); +#else +#ifndef xmlValidateNotationUse +extern __typeof (xmlValidateNotationUse) xmlValidateNotationUse__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateNotationUse xmlValidateNotationUse__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateOneAttribute +extern __typeof (xmlValidateOneAttribute) xmlValidateOneAttribute __attribute((alias("xmlValidateOneAttribute__internal_alias"))); +#else +#ifndef xmlValidateOneAttribute +extern __typeof (xmlValidateOneAttribute) xmlValidateOneAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateOneAttribute xmlValidateOneAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateOneElement +extern __typeof (xmlValidateOneElement) xmlValidateOneElement __attribute((alias("xmlValidateOneElement__internal_alias"))); +#else +#ifndef xmlValidateOneElement +extern __typeof (xmlValidateOneElement) xmlValidateOneElement__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateOneElement xmlValidateOneElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateOneNamespace +extern __typeof (xmlValidateOneNamespace) xmlValidateOneNamespace __attribute((alias("xmlValidateOneNamespace__internal_alias"))); +#else +#ifndef xmlValidateOneNamespace +extern __typeof (xmlValidateOneNamespace) xmlValidateOneNamespace__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateOneNamespace xmlValidateOneNamespace__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_valid +#undef xmlValidatePopElement +extern __typeof (xmlValidatePopElement) xmlValidatePopElement __attribute((alias("xmlValidatePopElement__internal_alias"))); +#else +#ifndef xmlValidatePopElement +extern __typeof (xmlValidatePopElement) xmlValidatePopElement__internal_alias __attribute((visibility("hidden"))); +#define xmlValidatePopElement xmlValidatePopElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_valid +#undef xmlValidatePushCData +extern __typeof (xmlValidatePushCData) xmlValidatePushCData __attribute((alias("xmlValidatePushCData__internal_alias"))); +#else +#ifndef xmlValidatePushCData +extern __typeof (xmlValidatePushCData) xmlValidatePushCData__internal_alias __attribute((visibility("hidden"))); +#define xmlValidatePushCData xmlValidatePushCData__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED) +#ifdef bottom_valid +#undef xmlValidatePushElement +extern __typeof (xmlValidatePushElement) xmlValidatePushElement __attribute((alias("xmlValidatePushElement__internal_alias"))); +#else +#ifndef xmlValidatePushElement +extern __typeof (xmlValidatePushElement) xmlValidatePushElement__internal_alias __attribute((visibility("hidden"))); +#define xmlValidatePushElement xmlValidatePushElement__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_tree +#undef xmlValidateQName +extern __typeof (xmlValidateQName) xmlValidateQName __attribute((alias("xmlValidateQName__internal_alias"))); +#else +#ifndef xmlValidateQName +extern __typeof (xmlValidateQName) xmlValidateQName__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateQName xmlValidateQName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_VALID_ENABLED) +#ifdef bottom_valid +#undef xmlValidateRoot +extern __typeof (xmlValidateRoot) xmlValidateRoot __attribute((alias("xmlValidateRoot__internal_alias"))); +#else +#ifndef xmlValidateRoot +extern __typeof (xmlValidateRoot) xmlValidateRoot__internal_alias __attribute((visibility("hidden"))); +#define xmlValidateRoot xmlValidateRoot__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_xinclude +#undef xmlXIncludeFreeContext +extern __typeof (xmlXIncludeFreeContext) xmlXIncludeFreeContext __attribute((alias("xmlXIncludeFreeContext__internal_alias"))); +#else +#ifndef xmlXIncludeFreeContext +extern __typeof (xmlXIncludeFreeContext) xmlXIncludeFreeContext__internal_alias __attribute((visibility("hidden"))); +#define xmlXIncludeFreeContext xmlXIncludeFreeContext__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_xinclude +#undef xmlXIncludeNewContext +extern __typeof (xmlXIncludeNewContext) xmlXIncludeNewContext __attribute((alias("xmlXIncludeNewContext__internal_alias"))); +#else +#ifndef xmlXIncludeNewContext +extern __typeof (xmlXIncludeNewContext) xmlXIncludeNewContext__internal_alias __attribute((visibility("hidden"))); +#define xmlXIncludeNewContext xmlXIncludeNewContext__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_xinclude +#undef xmlXIncludeProcess +extern __typeof (xmlXIncludeProcess) xmlXIncludeProcess __attribute((alias("xmlXIncludeProcess__internal_alias"))); +#else +#ifndef xmlXIncludeProcess +extern __typeof (xmlXIncludeProcess) xmlXIncludeProcess__internal_alias __attribute((visibility("hidden"))); +#define xmlXIncludeProcess xmlXIncludeProcess__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_xinclude +#undef xmlXIncludeProcessFlags +extern __typeof (xmlXIncludeProcessFlags) xmlXIncludeProcessFlags __attribute((alias("xmlXIncludeProcessFlags__internal_alias"))); +#else +#ifndef xmlXIncludeProcessFlags +extern __typeof (xmlXIncludeProcessFlags) xmlXIncludeProcessFlags__internal_alias __attribute((visibility("hidden"))); +#define xmlXIncludeProcessFlags xmlXIncludeProcessFlags__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_xinclude +#undef xmlXIncludeProcessFlagsData +extern __typeof (xmlXIncludeProcessFlagsData) xmlXIncludeProcessFlagsData __attribute((alias("xmlXIncludeProcessFlagsData__internal_alias"))); +#else +#ifndef xmlXIncludeProcessFlagsData +extern __typeof (xmlXIncludeProcessFlagsData) xmlXIncludeProcessFlagsData__internal_alias __attribute((visibility("hidden"))); +#define xmlXIncludeProcessFlagsData xmlXIncludeProcessFlagsData__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_xinclude +#undef xmlXIncludeProcessNode +extern __typeof (xmlXIncludeProcessNode) xmlXIncludeProcessNode __attribute((alias("xmlXIncludeProcessNode__internal_alias"))); +#else +#ifndef xmlXIncludeProcessNode +extern __typeof (xmlXIncludeProcessNode) xmlXIncludeProcessNode__internal_alias __attribute((visibility("hidden"))); +#define xmlXIncludeProcessNode xmlXIncludeProcessNode__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_xinclude +#undef xmlXIncludeProcessTree +extern __typeof (xmlXIncludeProcessTree) xmlXIncludeProcessTree __attribute((alias("xmlXIncludeProcessTree__internal_alias"))); +#else +#ifndef xmlXIncludeProcessTree +extern __typeof (xmlXIncludeProcessTree) xmlXIncludeProcessTree__internal_alias __attribute((visibility("hidden"))); +#define xmlXIncludeProcessTree xmlXIncludeProcessTree__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_xinclude +#undef xmlXIncludeProcessTreeFlags +extern __typeof (xmlXIncludeProcessTreeFlags) xmlXIncludeProcessTreeFlags __attribute((alias("xmlXIncludeProcessTreeFlags__internal_alias"))); +#else +#ifndef xmlXIncludeProcessTreeFlags +extern __typeof (xmlXIncludeProcessTreeFlags) xmlXIncludeProcessTreeFlags__internal_alias __attribute((visibility("hidden"))); +#define xmlXIncludeProcessTreeFlags xmlXIncludeProcessTreeFlags__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_xinclude +#undef xmlXIncludeProcessTreeFlagsData +extern __typeof (xmlXIncludeProcessTreeFlagsData) xmlXIncludeProcessTreeFlagsData __attribute((alias("xmlXIncludeProcessTreeFlagsData__internal_alias"))); +#else +#ifndef xmlXIncludeProcessTreeFlagsData +extern __typeof (xmlXIncludeProcessTreeFlagsData) xmlXIncludeProcessTreeFlagsData__internal_alias __attribute((visibility("hidden"))); +#define xmlXIncludeProcessTreeFlagsData xmlXIncludeProcessTreeFlagsData__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XINCLUDE_ENABLED) +#ifdef bottom_xinclude +#undef xmlXIncludeSetFlags +extern __typeof (xmlXIncludeSetFlags) xmlXIncludeSetFlags __attribute((alias("xmlXIncludeSetFlags__internal_alias"))); +#else +#ifndef xmlXIncludeSetFlags +extern __typeof (xmlXIncludeSetFlags) xmlXIncludeSetFlags__internal_alias __attribute((visibility("hidden"))); +#define xmlXIncludeSetFlags xmlXIncludeSetFlags__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathAddValues +extern __typeof (xmlXPathAddValues) xmlXPathAddValues __attribute((alias("xmlXPathAddValues__internal_alias"))); +#else +#ifndef xmlXPathAddValues +extern __typeof (xmlXPathAddValues) xmlXPathAddValues__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathAddValues xmlXPathAddValues__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathBooleanFunction +extern __typeof (xmlXPathBooleanFunction) xmlXPathBooleanFunction __attribute((alias("xmlXPathBooleanFunction__internal_alias"))); +#else +#ifndef xmlXPathBooleanFunction +extern __typeof (xmlXPathBooleanFunction) xmlXPathBooleanFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathBooleanFunction xmlXPathBooleanFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastBooleanToNumber +extern __typeof (xmlXPathCastBooleanToNumber) xmlXPathCastBooleanToNumber __attribute((alias("xmlXPathCastBooleanToNumber__internal_alias"))); +#else +#ifndef xmlXPathCastBooleanToNumber +extern __typeof (xmlXPathCastBooleanToNumber) xmlXPathCastBooleanToNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastBooleanToNumber xmlXPathCastBooleanToNumber__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastBooleanToString +extern __typeof (xmlXPathCastBooleanToString) xmlXPathCastBooleanToString __attribute((alias("xmlXPathCastBooleanToString__internal_alias"))); +#else +#ifndef xmlXPathCastBooleanToString +extern __typeof (xmlXPathCastBooleanToString) xmlXPathCastBooleanToString__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastBooleanToString xmlXPathCastBooleanToString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastNodeSetToBoolean +extern __typeof (xmlXPathCastNodeSetToBoolean) xmlXPathCastNodeSetToBoolean __attribute((alias("xmlXPathCastNodeSetToBoolean__internal_alias"))); +#else +#ifndef xmlXPathCastNodeSetToBoolean +extern __typeof (xmlXPathCastNodeSetToBoolean) xmlXPathCastNodeSetToBoolean__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastNodeSetToBoolean xmlXPathCastNodeSetToBoolean__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastNodeSetToNumber +extern __typeof (xmlXPathCastNodeSetToNumber) xmlXPathCastNodeSetToNumber __attribute((alias("xmlXPathCastNodeSetToNumber__internal_alias"))); +#else +#ifndef xmlXPathCastNodeSetToNumber +extern __typeof (xmlXPathCastNodeSetToNumber) xmlXPathCastNodeSetToNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastNodeSetToNumber xmlXPathCastNodeSetToNumber__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastNodeSetToString +extern __typeof (xmlXPathCastNodeSetToString) xmlXPathCastNodeSetToString __attribute((alias("xmlXPathCastNodeSetToString__internal_alias"))); +#else +#ifndef xmlXPathCastNodeSetToString +extern __typeof (xmlXPathCastNodeSetToString) xmlXPathCastNodeSetToString__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastNodeSetToString xmlXPathCastNodeSetToString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastNodeToNumber +extern __typeof (xmlXPathCastNodeToNumber) xmlXPathCastNodeToNumber __attribute((alias("xmlXPathCastNodeToNumber__internal_alias"))); +#else +#ifndef xmlXPathCastNodeToNumber +extern __typeof (xmlXPathCastNodeToNumber) xmlXPathCastNodeToNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastNodeToNumber xmlXPathCastNodeToNumber__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastNodeToString +extern __typeof (xmlXPathCastNodeToString) xmlXPathCastNodeToString __attribute((alias("xmlXPathCastNodeToString__internal_alias"))); +#else +#ifndef xmlXPathCastNodeToString +extern __typeof (xmlXPathCastNodeToString) xmlXPathCastNodeToString__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastNodeToString xmlXPathCastNodeToString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastNumberToBoolean +extern __typeof (xmlXPathCastNumberToBoolean) xmlXPathCastNumberToBoolean __attribute((alias("xmlXPathCastNumberToBoolean__internal_alias"))); +#else +#ifndef xmlXPathCastNumberToBoolean +extern __typeof (xmlXPathCastNumberToBoolean) xmlXPathCastNumberToBoolean__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastNumberToBoolean xmlXPathCastNumberToBoolean__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastNumberToString +extern __typeof (xmlXPathCastNumberToString) xmlXPathCastNumberToString __attribute((alias("xmlXPathCastNumberToString__internal_alias"))); +#else +#ifndef xmlXPathCastNumberToString +extern __typeof (xmlXPathCastNumberToString) xmlXPathCastNumberToString__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastNumberToString xmlXPathCastNumberToString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastStringToBoolean +extern __typeof (xmlXPathCastStringToBoolean) xmlXPathCastStringToBoolean __attribute((alias("xmlXPathCastStringToBoolean__internal_alias"))); +#else +#ifndef xmlXPathCastStringToBoolean +extern __typeof (xmlXPathCastStringToBoolean) xmlXPathCastStringToBoolean__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastStringToBoolean xmlXPathCastStringToBoolean__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastStringToNumber +extern __typeof (xmlXPathCastStringToNumber) xmlXPathCastStringToNumber __attribute((alias("xmlXPathCastStringToNumber__internal_alias"))); +#else +#ifndef xmlXPathCastStringToNumber +extern __typeof (xmlXPathCastStringToNumber) xmlXPathCastStringToNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastStringToNumber xmlXPathCastStringToNumber__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastToBoolean +extern __typeof (xmlXPathCastToBoolean) xmlXPathCastToBoolean __attribute((alias("xmlXPathCastToBoolean__internal_alias"))); +#else +#ifndef xmlXPathCastToBoolean +extern __typeof (xmlXPathCastToBoolean) xmlXPathCastToBoolean__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastToBoolean xmlXPathCastToBoolean__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastToNumber +extern __typeof (xmlXPathCastToNumber) xmlXPathCastToNumber __attribute((alias("xmlXPathCastToNumber__internal_alias"))); +#else +#ifndef xmlXPathCastToNumber +extern __typeof (xmlXPathCastToNumber) xmlXPathCastToNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastToNumber xmlXPathCastToNumber__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCastToString +extern __typeof (xmlXPathCastToString) xmlXPathCastToString __attribute((alias("xmlXPathCastToString__internal_alias"))); +#else +#ifndef xmlXPathCastToString +extern __typeof (xmlXPathCastToString) xmlXPathCastToString__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCastToString xmlXPathCastToString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCeilingFunction +extern __typeof (xmlXPathCeilingFunction) xmlXPathCeilingFunction __attribute((alias("xmlXPathCeilingFunction__internal_alias"))); +#else +#ifndef xmlXPathCeilingFunction +extern __typeof (xmlXPathCeilingFunction) xmlXPathCeilingFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCeilingFunction xmlXPathCeilingFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCmpNodes +extern __typeof (xmlXPathCmpNodes) xmlXPathCmpNodes __attribute((alias("xmlXPathCmpNodes__internal_alias"))); +#else +#ifndef xmlXPathCmpNodes +extern __typeof (xmlXPathCmpNodes) xmlXPathCmpNodes__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCmpNodes xmlXPathCmpNodes__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCompareValues +extern __typeof (xmlXPathCompareValues) xmlXPathCompareValues __attribute((alias("xmlXPathCompareValues__internal_alias"))); +#else +#ifndef xmlXPathCompareValues +extern __typeof (xmlXPathCompareValues) xmlXPathCompareValues__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCompareValues xmlXPathCompareValues__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCompile +extern __typeof (xmlXPathCompile) xmlXPathCompile __attribute((alias("xmlXPathCompile__internal_alias"))); +#else +#ifndef xmlXPathCompile +extern __typeof (xmlXPathCompile) xmlXPathCompile__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCompile xmlXPathCompile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCompiledEval +extern __typeof (xmlXPathCompiledEval) xmlXPathCompiledEval __attribute((alias("xmlXPathCompiledEval__internal_alias"))); +#else +#ifndef xmlXPathCompiledEval +extern __typeof (xmlXPathCompiledEval) xmlXPathCompiledEval__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCompiledEval xmlXPathCompiledEval__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCompiledEvalToBoolean +extern __typeof (xmlXPathCompiledEvalToBoolean) xmlXPathCompiledEvalToBoolean __attribute((alias("xmlXPathCompiledEvalToBoolean__internal_alias"))); +#else +#ifndef xmlXPathCompiledEvalToBoolean +extern __typeof (xmlXPathCompiledEvalToBoolean) xmlXPathCompiledEvalToBoolean__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCompiledEvalToBoolean xmlXPathCompiledEvalToBoolean__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathConcatFunction +extern __typeof (xmlXPathConcatFunction) xmlXPathConcatFunction __attribute((alias("xmlXPathConcatFunction__internal_alias"))); +#else +#ifndef xmlXPathConcatFunction +extern __typeof (xmlXPathConcatFunction) xmlXPathConcatFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathConcatFunction xmlXPathConcatFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathContainsFunction +extern __typeof (xmlXPathContainsFunction) xmlXPathContainsFunction __attribute((alias("xmlXPathContainsFunction__internal_alias"))); +#else +#ifndef xmlXPathContainsFunction +extern __typeof (xmlXPathContainsFunction) xmlXPathContainsFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathContainsFunction xmlXPathContainsFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathContextSetCache +extern __typeof (xmlXPathContextSetCache) xmlXPathContextSetCache __attribute((alias("xmlXPathContextSetCache__internal_alias"))); +#else +#ifndef xmlXPathContextSetCache +extern __typeof (xmlXPathContextSetCache) xmlXPathContextSetCache__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathContextSetCache xmlXPathContextSetCache__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathConvertBoolean +extern __typeof (xmlXPathConvertBoolean) xmlXPathConvertBoolean __attribute((alias("xmlXPathConvertBoolean__internal_alias"))); +#else +#ifndef xmlXPathConvertBoolean +extern __typeof (xmlXPathConvertBoolean) xmlXPathConvertBoolean__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathConvertBoolean xmlXPathConvertBoolean__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathConvertNumber +extern __typeof (xmlXPathConvertNumber) xmlXPathConvertNumber __attribute((alias("xmlXPathConvertNumber__internal_alias"))); +#else +#ifndef xmlXPathConvertNumber +extern __typeof (xmlXPathConvertNumber) xmlXPathConvertNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathConvertNumber xmlXPathConvertNumber__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathConvertString +extern __typeof (xmlXPathConvertString) xmlXPathConvertString __attribute((alias("xmlXPathConvertString__internal_alias"))); +#else +#ifndef xmlXPathConvertString +extern __typeof (xmlXPathConvertString) xmlXPathConvertString__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathConvertString xmlXPathConvertString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCountFunction +extern __typeof (xmlXPathCountFunction) xmlXPathCountFunction __attribute((alias("xmlXPathCountFunction__internal_alias"))); +#else +#ifndef xmlXPathCountFunction +extern __typeof (xmlXPathCountFunction) xmlXPathCountFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCountFunction xmlXPathCountFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathCtxtCompile +extern __typeof (xmlXPathCtxtCompile) xmlXPathCtxtCompile __attribute((alias("xmlXPathCtxtCompile__internal_alias"))); +#else +#ifndef xmlXPathCtxtCompile +extern __typeof (xmlXPathCtxtCompile) xmlXPathCtxtCompile__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathCtxtCompile xmlXPathCtxtCompile__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathDebugDumpCompExpr +extern __typeof (xmlXPathDebugDumpCompExpr) xmlXPathDebugDumpCompExpr __attribute((alias("xmlXPathDebugDumpCompExpr__internal_alias"))); +#else +#ifndef xmlXPathDebugDumpCompExpr +extern __typeof (xmlXPathDebugDumpCompExpr) xmlXPathDebugDumpCompExpr__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathDebugDumpCompExpr xmlXPathDebugDumpCompExpr__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathDebugDumpObject +extern __typeof (xmlXPathDebugDumpObject) xmlXPathDebugDumpObject __attribute((alias("xmlXPathDebugDumpObject__internal_alias"))); +#else +#ifndef xmlXPathDebugDumpObject +extern __typeof (xmlXPathDebugDumpObject) xmlXPathDebugDumpObject__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathDebugDumpObject xmlXPathDebugDumpObject__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathDifference +extern __typeof (xmlXPathDifference) xmlXPathDifference __attribute((alias("xmlXPathDifference__internal_alias"))); +#else +#ifndef xmlXPathDifference +extern __typeof (xmlXPathDifference) xmlXPathDifference__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathDifference xmlXPathDifference__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathDistinct +extern __typeof (xmlXPathDistinct) xmlXPathDistinct __attribute((alias("xmlXPathDistinct__internal_alias"))); +#else +#ifndef xmlXPathDistinct +extern __typeof (xmlXPathDistinct) xmlXPathDistinct__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathDistinct xmlXPathDistinct__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathDistinctSorted +extern __typeof (xmlXPathDistinctSorted) xmlXPathDistinctSorted __attribute((alias("xmlXPathDistinctSorted__internal_alias"))); +#else +#ifndef xmlXPathDistinctSorted +extern __typeof (xmlXPathDistinctSorted) xmlXPathDistinctSorted__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathDistinctSorted xmlXPathDistinctSorted__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathDivValues +extern __typeof (xmlXPathDivValues) xmlXPathDivValues __attribute((alias("xmlXPathDivValues__internal_alias"))); +#else +#ifndef xmlXPathDivValues +extern __typeof (xmlXPathDivValues) xmlXPathDivValues__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathDivValues xmlXPathDivValues__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathEqualValues +extern __typeof (xmlXPathEqualValues) xmlXPathEqualValues __attribute((alias("xmlXPathEqualValues__internal_alias"))); +#else +#ifndef xmlXPathEqualValues +extern __typeof (xmlXPathEqualValues) xmlXPathEqualValues__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathEqualValues xmlXPathEqualValues__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathErr +extern __typeof (xmlXPathErr) xmlXPathErr __attribute((alias("xmlXPathErr__internal_alias"))); +#else +#ifndef xmlXPathErr +extern __typeof (xmlXPathErr) xmlXPathErr__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathErr xmlXPathErr__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathEval +extern __typeof (xmlXPathEval) xmlXPathEval __attribute((alias("xmlXPathEval__internal_alias"))); +#else +#ifndef xmlXPathEval +extern __typeof (xmlXPathEval) xmlXPathEval__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathEval xmlXPathEval__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathEvalExpr +extern __typeof (xmlXPathEvalExpr) xmlXPathEvalExpr __attribute((alias("xmlXPathEvalExpr__internal_alias"))); +#else +#ifndef xmlXPathEvalExpr +extern __typeof (xmlXPathEvalExpr) xmlXPathEvalExpr__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathEvalExpr xmlXPathEvalExpr__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathEvalExpression +extern __typeof (xmlXPathEvalExpression) xmlXPathEvalExpression __attribute((alias("xmlXPathEvalExpression__internal_alias"))); +#else +#ifndef xmlXPathEvalExpression +extern __typeof (xmlXPathEvalExpression) xmlXPathEvalExpression__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathEvalExpression xmlXPathEvalExpression__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathEvalPredicate +extern __typeof (xmlXPathEvalPredicate) xmlXPathEvalPredicate __attribute((alias("xmlXPathEvalPredicate__internal_alias"))); +#else +#ifndef xmlXPathEvalPredicate +extern __typeof (xmlXPathEvalPredicate) xmlXPathEvalPredicate__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathEvalPredicate xmlXPathEvalPredicate__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathEvaluatePredicateResult +extern __typeof (xmlXPathEvaluatePredicateResult) xmlXPathEvaluatePredicateResult __attribute((alias("xmlXPathEvaluatePredicateResult__internal_alias"))); +#else +#ifndef xmlXPathEvaluatePredicateResult +extern __typeof (xmlXPathEvaluatePredicateResult) xmlXPathEvaluatePredicateResult__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathEvaluatePredicateResult xmlXPathEvaluatePredicateResult__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathFalseFunction +extern __typeof (xmlXPathFalseFunction) xmlXPathFalseFunction __attribute((alias("xmlXPathFalseFunction__internal_alias"))); +#else +#ifndef xmlXPathFalseFunction +extern __typeof (xmlXPathFalseFunction) xmlXPathFalseFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathFalseFunction xmlXPathFalseFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathFloorFunction +extern __typeof (xmlXPathFloorFunction) xmlXPathFloorFunction __attribute((alias("xmlXPathFloorFunction__internal_alias"))); +#else +#ifndef xmlXPathFloorFunction +extern __typeof (xmlXPathFloorFunction) xmlXPathFloorFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathFloorFunction xmlXPathFloorFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathFreeCompExpr +extern __typeof (xmlXPathFreeCompExpr) xmlXPathFreeCompExpr __attribute((alias("xmlXPathFreeCompExpr__internal_alias"))); +#else +#ifndef xmlXPathFreeCompExpr +extern __typeof (xmlXPathFreeCompExpr) xmlXPathFreeCompExpr__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathFreeCompExpr xmlXPathFreeCompExpr__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathFreeContext +extern __typeof (xmlXPathFreeContext) xmlXPathFreeContext __attribute((alias("xmlXPathFreeContext__internal_alias"))); +#else +#ifndef xmlXPathFreeContext +extern __typeof (xmlXPathFreeContext) xmlXPathFreeContext__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathFreeContext xmlXPathFreeContext__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathFreeNodeSet +extern __typeof (xmlXPathFreeNodeSet) xmlXPathFreeNodeSet __attribute((alias("xmlXPathFreeNodeSet__internal_alias"))); +#else +#ifndef xmlXPathFreeNodeSet +extern __typeof (xmlXPathFreeNodeSet) xmlXPathFreeNodeSet__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathFreeNodeSet xmlXPathFreeNodeSet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathFreeNodeSetList +extern __typeof (xmlXPathFreeNodeSetList) xmlXPathFreeNodeSetList __attribute((alias("xmlXPathFreeNodeSetList__internal_alias"))); +#else +#ifndef xmlXPathFreeNodeSetList +extern __typeof (xmlXPathFreeNodeSetList) xmlXPathFreeNodeSetList__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathFreeNodeSetList xmlXPathFreeNodeSetList__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathFreeObject +extern __typeof (xmlXPathFreeObject) xmlXPathFreeObject __attribute((alias("xmlXPathFreeObject__internal_alias"))); +#else +#ifndef xmlXPathFreeObject +extern __typeof (xmlXPathFreeObject) xmlXPathFreeObject__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathFreeObject xmlXPathFreeObject__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathFreeParserContext +extern __typeof (xmlXPathFreeParserContext) xmlXPathFreeParserContext __attribute((alias("xmlXPathFreeParserContext__internal_alias"))); +#else +#ifndef xmlXPathFreeParserContext +extern __typeof (xmlXPathFreeParserContext) xmlXPathFreeParserContext__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathFreeParserContext xmlXPathFreeParserContext__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathFunctionLookup +extern __typeof (xmlXPathFunctionLookup) xmlXPathFunctionLookup __attribute((alias("xmlXPathFunctionLookup__internal_alias"))); +#else +#ifndef xmlXPathFunctionLookup +extern __typeof (xmlXPathFunctionLookup) xmlXPathFunctionLookup__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathFunctionLookup xmlXPathFunctionLookup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathFunctionLookupNS +extern __typeof (xmlXPathFunctionLookupNS) xmlXPathFunctionLookupNS __attribute((alias("xmlXPathFunctionLookupNS__internal_alias"))); +#else +#ifndef xmlXPathFunctionLookupNS +extern __typeof (xmlXPathFunctionLookupNS) xmlXPathFunctionLookupNS__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathFunctionLookupNS xmlXPathFunctionLookupNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathHasSameNodes +extern __typeof (xmlXPathHasSameNodes) xmlXPathHasSameNodes __attribute((alias("xmlXPathHasSameNodes__internal_alias"))); +#else +#ifndef xmlXPathHasSameNodes +extern __typeof (xmlXPathHasSameNodes) xmlXPathHasSameNodes__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathHasSameNodes xmlXPathHasSameNodes__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathIdFunction +extern __typeof (xmlXPathIdFunction) xmlXPathIdFunction __attribute((alias("xmlXPathIdFunction__internal_alias"))); +#else +#ifndef xmlXPathIdFunction +extern __typeof (xmlXPathIdFunction) xmlXPathIdFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathIdFunction xmlXPathIdFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathInit +extern __typeof (xmlXPathInit) xmlXPathInit __attribute((alias("xmlXPathInit__internal_alias"))); +#else +#ifndef xmlXPathInit +extern __typeof (xmlXPathInit) xmlXPathInit__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathInit xmlXPathInit__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathIntersection +extern __typeof (xmlXPathIntersection) xmlXPathIntersection __attribute((alias("xmlXPathIntersection__internal_alias"))); +#else +#ifndef xmlXPathIntersection +extern __typeof (xmlXPathIntersection) xmlXPathIntersection__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathIntersection xmlXPathIntersection__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathIsInf +extern __typeof (xmlXPathIsInf) xmlXPathIsInf __attribute((alias("xmlXPathIsInf__internal_alias"))); +#else +#ifndef xmlXPathIsInf +extern __typeof (xmlXPathIsInf) xmlXPathIsInf__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathIsInf xmlXPathIsInf__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathIsNaN +extern __typeof (xmlXPathIsNaN) xmlXPathIsNaN __attribute((alias("xmlXPathIsNaN__internal_alias"))); +#else +#ifndef xmlXPathIsNaN +extern __typeof (xmlXPathIsNaN) xmlXPathIsNaN__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathIsNaN xmlXPathIsNaN__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathIsNodeType +extern __typeof (xmlXPathIsNodeType) xmlXPathIsNodeType __attribute((alias("xmlXPathIsNodeType__internal_alias"))); +#else +#ifndef xmlXPathIsNodeType +extern __typeof (xmlXPathIsNodeType) xmlXPathIsNodeType__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathIsNodeType xmlXPathIsNodeType__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathLangFunction +extern __typeof (xmlXPathLangFunction) xmlXPathLangFunction __attribute((alias("xmlXPathLangFunction__internal_alias"))); +#else +#ifndef xmlXPathLangFunction +extern __typeof (xmlXPathLangFunction) xmlXPathLangFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathLangFunction xmlXPathLangFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathLastFunction +extern __typeof (xmlXPathLastFunction) xmlXPathLastFunction __attribute((alias("xmlXPathLastFunction__internal_alias"))); +#else +#ifndef xmlXPathLastFunction +extern __typeof (xmlXPathLastFunction) xmlXPathLastFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathLastFunction xmlXPathLastFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathLeading +extern __typeof (xmlXPathLeading) xmlXPathLeading __attribute((alias("xmlXPathLeading__internal_alias"))); +#else +#ifndef xmlXPathLeading +extern __typeof (xmlXPathLeading) xmlXPathLeading__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathLeading xmlXPathLeading__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathLeadingSorted +extern __typeof (xmlXPathLeadingSorted) xmlXPathLeadingSorted __attribute((alias("xmlXPathLeadingSorted__internal_alias"))); +#else +#ifndef xmlXPathLeadingSorted +extern __typeof (xmlXPathLeadingSorted) xmlXPathLeadingSorted__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathLeadingSorted xmlXPathLeadingSorted__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathLocalNameFunction +extern __typeof (xmlXPathLocalNameFunction) xmlXPathLocalNameFunction __attribute((alias("xmlXPathLocalNameFunction__internal_alias"))); +#else +#ifndef xmlXPathLocalNameFunction +extern __typeof (xmlXPathLocalNameFunction) xmlXPathLocalNameFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathLocalNameFunction xmlXPathLocalNameFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathModValues +extern __typeof (xmlXPathModValues) xmlXPathModValues __attribute((alias("xmlXPathModValues__internal_alias"))); +#else +#ifndef xmlXPathModValues +extern __typeof (xmlXPathModValues) xmlXPathModValues__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathModValues xmlXPathModValues__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathMultValues +extern __typeof (xmlXPathMultValues) xmlXPathMultValues __attribute((alias("xmlXPathMultValues__internal_alias"))); +#else +#ifndef xmlXPathMultValues +extern __typeof (xmlXPathMultValues) xmlXPathMultValues__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathMultValues xmlXPathMultValues__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNamespaceURIFunction +extern __typeof (xmlXPathNamespaceURIFunction) xmlXPathNamespaceURIFunction __attribute((alias("xmlXPathNamespaceURIFunction__internal_alias"))); +#else +#ifndef xmlXPathNamespaceURIFunction +extern __typeof (xmlXPathNamespaceURIFunction) xmlXPathNamespaceURIFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNamespaceURIFunction xmlXPathNamespaceURIFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNewBoolean +extern __typeof (xmlXPathNewBoolean) xmlXPathNewBoolean __attribute((alias("xmlXPathNewBoolean__internal_alias"))); +#else +#ifndef xmlXPathNewBoolean +extern __typeof (xmlXPathNewBoolean) xmlXPathNewBoolean__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNewBoolean xmlXPathNewBoolean__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNewCString +extern __typeof (xmlXPathNewCString) xmlXPathNewCString __attribute((alias("xmlXPathNewCString__internal_alias"))); +#else +#ifndef xmlXPathNewCString +extern __typeof (xmlXPathNewCString) xmlXPathNewCString__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNewCString xmlXPathNewCString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNewContext +extern __typeof (xmlXPathNewContext) xmlXPathNewContext __attribute((alias("xmlXPathNewContext__internal_alias"))); +#else +#ifndef xmlXPathNewContext +extern __typeof (xmlXPathNewContext) xmlXPathNewContext__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNewContext xmlXPathNewContext__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNewFloat +extern __typeof (xmlXPathNewFloat) xmlXPathNewFloat __attribute((alias("xmlXPathNewFloat__internal_alias"))); +#else +#ifndef xmlXPathNewFloat +extern __typeof (xmlXPathNewFloat) xmlXPathNewFloat__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNewFloat xmlXPathNewFloat__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNewNodeSet +extern __typeof (xmlXPathNewNodeSet) xmlXPathNewNodeSet __attribute((alias("xmlXPathNewNodeSet__internal_alias"))); +#else +#ifndef xmlXPathNewNodeSet +extern __typeof (xmlXPathNewNodeSet) xmlXPathNewNodeSet__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNewNodeSet xmlXPathNewNodeSet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNewNodeSetList +extern __typeof (xmlXPathNewNodeSetList) xmlXPathNewNodeSetList __attribute((alias("xmlXPathNewNodeSetList__internal_alias"))); +#else +#ifndef xmlXPathNewNodeSetList +extern __typeof (xmlXPathNewNodeSetList) xmlXPathNewNodeSetList__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNewNodeSetList xmlXPathNewNodeSetList__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNewParserContext +extern __typeof (xmlXPathNewParserContext) xmlXPathNewParserContext __attribute((alias("xmlXPathNewParserContext__internal_alias"))); +#else +#ifndef xmlXPathNewParserContext +extern __typeof (xmlXPathNewParserContext) xmlXPathNewParserContext__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNewParserContext xmlXPathNewParserContext__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNewString +extern __typeof (xmlXPathNewString) xmlXPathNewString __attribute((alias("xmlXPathNewString__internal_alias"))); +#else +#ifndef xmlXPathNewString +extern __typeof (xmlXPathNewString) xmlXPathNewString__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNewString xmlXPathNewString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNewValueTree +extern __typeof (xmlXPathNewValueTree) xmlXPathNewValueTree __attribute((alias("xmlXPathNewValueTree__internal_alias"))); +#else +#ifndef xmlXPathNewValueTree +extern __typeof (xmlXPathNewValueTree) xmlXPathNewValueTree__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNewValueTree xmlXPathNewValueTree__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextAncestor +extern __typeof (xmlXPathNextAncestor) xmlXPathNextAncestor __attribute((alias("xmlXPathNextAncestor__internal_alias"))); +#else +#ifndef xmlXPathNextAncestor +extern __typeof (xmlXPathNextAncestor) xmlXPathNextAncestor__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextAncestor xmlXPathNextAncestor__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextAncestorOrSelf +extern __typeof (xmlXPathNextAncestorOrSelf) xmlXPathNextAncestorOrSelf __attribute((alias("xmlXPathNextAncestorOrSelf__internal_alias"))); +#else +#ifndef xmlXPathNextAncestorOrSelf +extern __typeof (xmlXPathNextAncestorOrSelf) xmlXPathNextAncestorOrSelf__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextAncestorOrSelf xmlXPathNextAncestorOrSelf__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextAttribute +extern __typeof (xmlXPathNextAttribute) xmlXPathNextAttribute __attribute((alias("xmlXPathNextAttribute__internal_alias"))); +#else +#ifndef xmlXPathNextAttribute +extern __typeof (xmlXPathNextAttribute) xmlXPathNextAttribute__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextAttribute xmlXPathNextAttribute__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextChild +extern __typeof (xmlXPathNextChild) xmlXPathNextChild __attribute((alias("xmlXPathNextChild__internal_alias"))); +#else +#ifndef xmlXPathNextChild +extern __typeof (xmlXPathNextChild) xmlXPathNextChild__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextChild xmlXPathNextChild__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextDescendant +extern __typeof (xmlXPathNextDescendant) xmlXPathNextDescendant __attribute((alias("xmlXPathNextDescendant__internal_alias"))); +#else +#ifndef xmlXPathNextDescendant +extern __typeof (xmlXPathNextDescendant) xmlXPathNextDescendant__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextDescendant xmlXPathNextDescendant__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextDescendantOrSelf +extern __typeof (xmlXPathNextDescendantOrSelf) xmlXPathNextDescendantOrSelf __attribute((alias("xmlXPathNextDescendantOrSelf__internal_alias"))); +#else +#ifndef xmlXPathNextDescendantOrSelf +extern __typeof (xmlXPathNextDescendantOrSelf) xmlXPathNextDescendantOrSelf__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextDescendantOrSelf xmlXPathNextDescendantOrSelf__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextFollowing +extern __typeof (xmlXPathNextFollowing) xmlXPathNextFollowing __attribute((alias("xmlXPathNextFollowing__internal_alias"))); +#else +#ifndef xmlXPathNextFollowing +extern __typeof (xmlXPathNextFollowing) xmlXPathNextFollowing__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextFollowing xmlXPathNextFollowing__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextFollowingSibling +extern __typeof (xmlXPathNextFollowingSibling) xmlXPathNextFollowingSibling __attribute((alias("xmlXPathNextFollowingSibling__internal_alias"))); +#else +#ifndef xmlXPathNextFollowingSibling +extern __typeof (xmlXPathNextFollowingSibling) xmlXPathNextFollowingSibling__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextFollowingSibling xmlXPathNextFollowingSibling__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextNamespace +extern __typeof (xmlXPathNextNamespace) xmlXPathNextNamespace __attribute((alias("xmlXPathNextNamespace__internal_alias"))); +#else +#ifndef xmlXPathNextNamespace +extern __typeof (xmlXPathNextNamespace) xmlXPathNextNamespace__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextNamespace xmlXPathNextNamespace__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextParent +extern __typeof (xmlXPathNextParent) xmlXPathNextParent __attribute((alias("xmlXPathNextParent__internal_alias"))); +#else +#ifndef xmlXPathNextParent +extern __typeof (xmlXPathNextParent) xmlXPathNextParent__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextParent xmlXPathNextParent__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextPreceding +extern __typeof (xmlXPathNextPreceding) xmlXPathNextPreceding __attribute((alias("xmlXPathNextPreceding__internal_alias"))); +#else +#ifndef xmlXPathNextPreceding +extern __typeof (xmlXPathNextPreceding) xmlXPathNextPreceding__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextPreceding xmlXPathNextPreceding__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextPrecedingSibling +extern __typeof (xmlXPathNextPrecedingSibling) xmlXPathNextPrecedingSibling __attribute((alias("xmlXPathNextPrecedingSibling__internal_alias"))); +#else +#ifndef xmlXPathNextPrecedingSibling +extern __typeof (xmlXPathNextPrecedingSibling) xmlXPathNextPrecedingSibling__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextPrecedingSibling xmlXPathNextPrecedingSibling__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNextSelf +extern __typeof (xmlXPathNextSelf) xmlXPathNextSelf __attribute((alias("xmlXPathNextSelf__internal_alias"))); +#else +#ifndef xmlXPathNextSelf +extern __typeof (xmlXPathNextSelf) xmlXPathNextSelf__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNextSelf xmlXPathNextSelf__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeEval +extern __typeof (xmlXPathNodeEval) xmlXPathNodeEval __attribute((alias("xmlXPathNodeEval__internal_alias"))); +#else +#ifndef xmlXPathNodeEval +extern __typeof (xmlXPathNodeEval) xmlXPathNodeEval__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeEval xmlXPathNodeEval__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeLeading +extern __typeof (xmlXPathNodeLeading) xmlXPathNodeLeading __attribute((alias("xmlXPathNodeLeading__internal_alias"))); +#else +#ifndef xmlXPathNodeLeading +extern __typeof (xmlXPathNodeLeading) xmlXPathNodeLeading__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeLeading xmlXPathNodeLeading__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeLeadingSorted +extern __typeof (xmlXPathNodeLeadingSorted) xmlXPathNodeLeadingSorted __attribute((alias("xmlXPathNodeLeadingSorted__internal_alias"))); +#else +#ifndef xmlXPathNodeLeadingSorted +extern __typeof (xmlXPathNodeLeadingSorted) xmlXPathNodeLeadingSorted__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeLeadingSorted xmlXPathNodeLeadingSorted__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeSetAdd +extern __typeof (xmlXPathNodeSetAdd) xmlXPathNodeSetAdd __attribute((alias("xmlXPathNodeSetAdd__internal_alias"))); +#else +#ifndef xmlXPathNodeSetAdd +extern __typeof (xmlXPathNodeSetAdd) xmlXPathNodeSetAdd__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeSetAdd xmlXPathNodeSetAdd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeSetAddNs +extern __typeof (xmlXPathNodeSetAddNs) xmlXPathNodeSetAddNs __attribute((alias("xmlXPathNodeSetAddNs__internal_alias"))); +#else +#ifndef xmlXPathNodeSetAddNs +extern __typeof (xmlXPathNodeSetAddNs) xmlXPathNodeSetAddNs__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeSetAddNs xmlXPathNodeSetAddNs__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeSetAddUnique +extern __typeof (xmlXPathNodeSetAddUnique) xmlXPathNodeSetAddUnique __attribute((alias("xmlXPathNodeSetAddUnique__internal_alias"))); +#else +#ifndef xmlXPathNodeSetAddUnique +extern __typeof (xmlXPathNodeSetAddUnique) xmlXPathNodeSetAddUnique__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeSetAddUnique xmlXPathNodeSetAddUnique__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeSetContains +extern __typeof (xmlXPathNodeSetContains) xmlXPathNodeSetContains __attribute((alias("xmlXPathNodeSetContains__internal_alias"))); +#else +#ifndef xmlXPathNodeSetContains +extern __typeof (xmlXPathNodeSetContains) xmlXPathNodeSetContains__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeSetContains xmlXPathNodeSetContains__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeSetCreate +extern __typeof (xmlXPathNodeSetCreate) xmlXPathNodeSetCreate __attribute((alias("xmlXPathNodeSetCreate__internal_alias"))); +#else +#ifndef xmlXPathNodeSetCreate +extern __typeof (xmlXPathNodeSetCreate) xmlXPathNodeSetCreate__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeSetCreate xmlXPathNodeSetCreate__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeSetDel +extern __typeof (xmlXPathNodeSetDel) xmlXPathNodeSetDel __attribute((alias("xmlXPathNodeSetDel__internal_alias"))); +#else +#ifndef xmlXPathNodeSetDel +extern __typeof (xmlXPathNodeSetDel) xmlXPathNodeSetDel__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeSetDel xmlXPathNodeSetDel__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeSetFreeNs +extern __typeof (xmlXPathNodeSetFreeNs) xmlXPathNodeSetFreeNs __attribute((alias("xmlXPathNodeSetFreeNs__internal_alias"))); +#else +#ifndef xmlXPathNodeSetFreeNs +extern __typeof (xmlXPathNodeSetFreeNs) xmlXPathNodeSetFreeNs__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeSetFreeNs xmlXPathNodeSetFreeNs__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeSetMerge +extern __typeof (xmlXPathNodeSetMerge) xmlXPathNodeSetMerge __attribute((alias("xmlXPathNodeSetMerge__internal_alias"))); +#else +#ifndef xmlXPathNodeSetMerge +extern __typeof (xmlXPathNodeSetMerge) xmlXPathNodeSetMerge__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeSetMerge xmlXPathNodeSetMerge__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeSetRemove +extern __typeof (xmlXPathNodeSetRemove) xmlXPathNodeSetRemove __attribute((alias("xmlXPathNodeSetRemove__internal_alias"))); +#else +#ifndef xmlXPathNodeSetRemove +extern __typeof (xmlXPathNodeSetRemove) xmlXPathNodeSetRemove__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeSetRemove xmlXPathNodeSetRemove__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeSetSort +extern __typeof (xmlXPathNodeSetSort) xmlXPathNodeSetSort __attribute((alias("xmlXPathNodeSetSort__internal_alias"))); +#else +#ifndef xmlXPathNodeSetSort +extern __typeof (xmlXPathNodeSetSort) xmlXPathNodeSetSort__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeSetSort xmlXPathNodeSetSort__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeTrailing +extern __typeof (xmlXPathNodeTrailing) xmlXPathNodeTrailing __attribute((alias("xmlXPathNodeTrailing__internal_alias"))); +#else +#ifndef xmlXPathNodeTrailing +extern __typeof (xmlXPathNodeTrailing) xmlXPathNodeTrailing__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeTrailing xmlXPathNodeTrailing__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNodeTrailingSorted +extern __typeof (xmlXPathNodeTrailingSorted) xmlXPathNodeTrailingSorted __attribute((alias("xmlXPathNodeTrailingSorted__internal_alias"))); +#else +#ifndef xmlXPathNodeTrailingSorted +extern __typeof (xmlXPathNodeTrailingSorted) xmlXPathNodeTrailingSorted__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNodeTrailingSorted xmlXPathNodeTrailingSorted__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNormalizeFunction +extern __typeof (xmlXPathNormalizeFunction) xmlXPathNormalizeFunction __attribute((alias("xmlXPathNormalizeFunction__internal_alias"))); +#else +#ifndef xmlXPathNormalizeFunction +extern __typeof (xmlXPathNormalizeFunction) xmlXPathNormalizeFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNormalizeFunction xmlXPathNormalizeFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNotEqualValues +extern __typeof (xmlXPathNotEqualValues) xmlXPathNotEqualValues __attribute((alias("xmlXPathNotEqualValues__internal_alias"))); +#else +#ifndef xmlXPathNotEqualValues +extern __typeof (xmlXPathNotEqualValues) xmlXPathNotEqualValues__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNotEqualValues xmlXPathNotEqualValues__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNotFunction +extern __typeof (xmlXPathNotFunction) xmlXPathNotFunction __attribute((alias("xmlXPathNotFunction__internal_alias"))); +#else +#ifndef xmlXPathNotFunction +extern __typeof (xmlXPathNotFunction) xmlXPathNotFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNotFunction xmlXPathNotFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNsLookup +extern __typeof (xmlXPathNsLookup) xmlXPathNsLookup __attribute((alias("xmlXPathNsLookup__internal_alias"))); +#else +#ifndef xmlXPathNsLookup +extern __typeof (xmlXPathNsLookup) xmlXPathNsLookup__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNsLookup xmlXPathNsLookup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathNumberFunction +extern __typeof (xmlXPathNumberFunction) xmlXPathNumberFunction __attribute((alias("xmlXPathNumberFunction__internal_alias"))); +#else +#ifndef xmlXPathNumberFunction +extern __typeof (xmlXPathNumberFunction) xmlXPathNumberFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathNumberFunction xmlXPathNumberFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathObjectCopy +extern __typeof (xmlXPathObjectCopy) xmlXPathObjectCopy __attribute((alias("xmlXPathObjectCopy__internal_alias"))); +#else +#ifndef xmlXPathObjectCopy +extern __typeof (xmlXPathObjectCopy) xmlXPathObjectCopy__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathObjectCopy xmlXPathObjectCopy__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathOrderDocElems +extern __typeof (xmlXPathOrderDocElems) xmlXPathOrderDocElems __attribute((alias("xmlXPathOrderDocElems__internal_alias"))); +#else +#ifndef xmlXPathOrderDocElems +extern __typeof (xmlXPathOrderDocElems) xmlXPathOrderDocElems__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathOrderDocElems xmlXPathOrderDocElems__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathParseNCName +extern __typeof (xmlXPathParseNCName) xmlXPathParseNCName __attribute((alias("xmlXPathParseNCName__internal_alias"))); +#else +#ifndef xmlXPathParseNCName +extern __typeof (xmlXPathParseNCName) xmlXPathParseNCName__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathParseNCName xmlXPathParseNCName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathParseName +extern __typeof (xmlXPathParseName) xmlXPathParseName __attribute((alias("xmlXPathParseName__internal_alias"))); +#else +#ifndef xmlXPathParseName +extern __typeof (xmlXPathParseName) xmlXPathParseName__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathParseName xmlXPathParseName__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathPopBoolean +extern __typeof (xmlXPathPopBoolean) xmlXPathPopBoolean __attribute((alias("xmlXPathPopBoolean__internal_alias"))); +#else +#ifndef xmlXPathPopBoolean +extern __typeof (xmlXPathPopBoolean) xmlXPathPopBoolean__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathPopBoolean xmlXPathPopBoolean__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathPopExternal +extern __typeof (xmlXPathPopExternal) xmlXPathPopExternal __attribute((alias("xmlXPathPopExternal__internal_alias"))); +#else +#ifndef xmlXPathPopExternal +extern __typeof (xmlXPathPopExternal) xmlXPathPopExternal__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathPopExternal xmlXPathPopExternal__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathPopNodeSet +extern __typeof (xmlXPathPopNodeSet) xmlXPathPopNodeSet __attribute((alias("xmlXPathPopNodeSet__internal_alias"))); +#else +#ifndef xmlXPathPopNodeSet +extern __typeof (xmlXPathPopNodeSet) xmlXPathPopNodeSet__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathPopNodeSet xmlXPathPopNodeSet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathPopNumber +extern __typeof (xmlXPathPopNumber) xmlXPathPopNumber __attribute((alias("xmlXPathPopNumber__internal_alias"))); +#else +#ifndef xmlXPathPopNumber +extern __typeof (xmlXPathPopNumber) xmlXPathPopNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathPopNumber xmlXPathPopNumber__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathPopString +extern __typeof (xmlXPathPopString) xmlXPathPopString __attribute((alias("xmlXPathPopString__internal_alias"))); +#else +#ifndef xmlXPathPopString +extern __typeof (xmlXPathPopString) xmlXPathPopString__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathPopString xmlXPathPopString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathPositionFunction +extern __typeof (xmlXPathPositionFunction) xmlXPathPositionFunction __attribute((alias("xmlXPathPositionFunction__internal_alias"))); +#else +#ifndef xmlXPathPositionFunction +extern __typeof (xmlXPathPositionFunction) xmlXPathPositionFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathPositionFunction xmlXPathPositionFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRegisterAllFunctions +extern __typeof (xmlXPathRegisterAllFunctions) xmlXPathRegisterAllFunctions __attribute((alias("xmlXPathRegisterAllFunctions__internal_alias"))); +#else +#ifndef xmlXPathRegisterAllFunctions +extern __typeof (xmlXPathRegisterAllFunctions) xmlXPathRegisterAllFunctions__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRegisterAllFunctions xmlXPathRegisterAllFunctions__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRegisterFunc +extern __typeof (xmlXPathRegisterFunc) xmlXPathRegisterFunc __attribute((alias("xmlXPathRegisterFunc__internal_alias"))); +#else +#ifndef xmlXPathRegisterFunc +extern __typeof (xmlXPathRegisterFunc) xmlXPathRegisterFunc__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRegisterFunc xmlXPathRegisterFunc__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRegisterFuncLookup +extern __typeof (xmlXPathRegisterFuncLookup) xmlXPathRegisterFuncLookup __attribute((alias("xmlXPathRegisterFuncLookup__internal_alias"))); +#else +#ifndef xmlXPathRegisterFuncLookup +extern __typeof (xmlXPathRegisterFuncLookup) xmlXPathRegisterFuncLookup__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRegisterFuncLookup xmlXPathRegisterFuncLookup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRegisterFuncNS +extern __typeof (xmlXPathRegisterFuncNS) xmlXPathRegisterFuncNS __attribute((alias("xmlXPathRegisterFuncNS__internal_alias"))); +#else +#ifndef xmlXPathRegisterFuncNS +extern __typeof (xmlXPathRegisterFuncNS) xmlXPathRegisterFuncNS__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRegisterFuncNS xmlXPathRegisterFuncNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRegisterNs +extern __typeof (xmlXPathRegisterNs) xmlXPathRegisterNs __attribute((alias("xmlXPathRegisterNs__internal_alias"))); +#else +#ifndef xmlXPathRegisterNs +extern __typeof (xmlXPathRegisterNs) xmlXPathRegisterNs__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRegisterNs xmlXPathRegisterNs__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRegisterVariable +extern __typeof (xmlXPathRegisterVariable) xmlXPathRegisterVariable __attribute((alias("xmlXPathRegisterVariable__internal_alias"))); +#else +#ifndef xmlXPathRegisterVariable +extern __typeof (xmlXPathRegisterVariable) xmlXPathRegisterVariable__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRegisterVariable xmlXPathRegisterVariable__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRegisterVariableLookup +extern __typeof (xmlXPathRegisterVariableLookup) xmlXPathRegisterVariableLookup __attribute((alias("xmlXPathRegisterVariableLookup__internal_alias"))); +#else +#ifndef xmlXPathRegisterVariableLookup +extern __typeof (xmlXPathRegisterVariableLookup) xmlXPathRegisterVariableLookup__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRegisterVariableLookup xmlXPathRegisterVariableLookup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRegisterVariableNS +extern __typeof (xmlXPathRegisterVariableNS) xmlXPathRegisterVariableNS __attribute((alias("xmlXPathRegisterVariableNS__internal_alias"))); +#else +#ifndef xmlXPathRegisterVariableNS +extern __typeof (xmlXPathRegisterVariableNS) xmlXPathRegisterVariableNS__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRegisterVariableNS xmlXPathRegisterVariableNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRegisteredFuncsCleanup +extern __typeof (xmlXPathRegisteredFuncsCleanup) xmlXPathRegisteredFuncsCleanup __attribute((alias("xmlXPathRegisteredFuncsCleanup__internal_alias"))); +#else +#ifndef xmlXPathRegisteredFuncsCleanup +extern __typeof (xmlXPathRegisteredFuncsCleanup) xmlXPathRegisteredFuncsCleanup__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRegisteredFuncsCleanup xmlXPathRegisteredFuncsCleanup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRegisteredNsCleanup +extern __typeof (xmlXPathRegisteredNsCleanup) xmlXPathRegisteredNsCleanup __attribute((alias("xmlXPathRegisteredNsCleanup__internal_alias"))); +#else +#ifndef xmlXPathRegisteredNsCleanup +extern __typeof (xmlXPathRegisteredNsCleanup) xmlXPathRegisteredNsCleanup__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRegisteredNsCleanup xmlXPathRegisteredNsCleanup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRegisteredVariablesCleanup +extern __typeof (xmlXPathRegisteredVariablesCleanup) xmlXPathRegisteredVariablesCleanup __attribute((alias("xmlXPathRegisteredVariablesCleanup__internal_alias"))); +#else +#ifndef xmlXPathRegisteredVariablesCleanup +extern __typeof (xmlXPathRegisteredVariablesCleanup) xmlXPathRegisteredVariablesCleanup__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRegisteredVariablesCleanup xmlXPathRegisteredVariablesCleanup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRoot +extern __typeof (xmlXPathRoot) xmlXPathRoot __attribute((alias("xmlXPathRoot__internal_alias"))); +#else +#ifndef xmlXPathRoot +extern __typeof (xmlXPathRoot) xmlXPathRoot__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRoot xmlXPathRoot__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathRoundFunction +extern __typeof (xmlXPathRoundFunction) xmlXPathRoundFunction __attribute((alias("xmlXPathRoundFunction__internal_alias"))); +#else +#ifndef xmlXPathRoundFunction +extern __typeof (xmlXPathRoundFunction) xmlXPathRoundFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathRoundFunction xmlXPathRoundFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathSetContextNode +extern __typeof (xmlXPathSetContextNode) xmlXPathSetContextNode __attribute((alias("xmlXPathSetContextNode__internal_alias"))); +#else +#ifndef xmlXPathSetContextNode +extern __typeof (xmlXPathSetContextNode) xmlXPathSetContextNode__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathSetContextNode xmlXPathSetContextNode__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathStartsWithFunction +extern __typeof (xmlXPathStartsWithFunction) xmlXPathStartsWithFunction __attribute((alias("xmlXPathStartsWithFunction__internal_alias"))); +#else +#ifndef xmlXPathStartsWithFunction +extern __typeof (xmlXPathStartsWithFunction) xmlXPathStartsWithFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathStartsWithFunction xmlXPathStartsWithFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathStringEvalNumber +extern __typeof (xmlXPathStringEvalNumber) xmlXPathStringEvalNumber __attribute((alias("xmlXPathStringEvalNumber__internal_alias"))); +#else +#ifndef xmlXPathStringEvalNumber +extern __typeof (xmlXPathStringEvalNumber) xmlXPathStringEvalNumber__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathStringEvalNumber xmlXPathStringEvalNumber__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathStringFunction +extern __typeof (xmlXPathStringFunction) xmlXPathStringFunction __attribute((alias("xmlXPathStringFunction__internal_alias"))); +#else +#ifndef xmlXPathStringFunction +extern __typeof (xmlXPathStringFunction) xmlXPathStringFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathStringFunction xmlXPathStringFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathStringLengthFunction +extern __typeof (xmlXPathStringLengthFunction) xmlXPathStringLengthFunction __attribute((alias("xmlXPathStringLengthFunction__internal_alias"))); +#else +#ifndef xmlXPathStringLengthFunction +extern __typeof (xmlXPathStringLengthFunction) xmlXPathStringLengthFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathStringLengthFunction xmlXPathStringLengthFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathSubValues +extern __typeof (xmlXPathSubValues) xmlXPathSubValues __attribute((alias("xmlXPathSubValues__internal_alias"))); +#else +#ifndef xmlXPathSubValues +extern __typeof (xmlXPathSubValues) xmlXPathSubValues__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathSubValues xmlXPathSubValues__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathSubstringAfterFunction +extern __typeof (xmlXPathSubstringAfterFunction) xmlXPathSubstringAfterFunction __attribute((alias("xmlXPathSubstringAfterFunction__internal_alias"))); +#else +#ifndef xmlXPathSubstringAfterFunction +extern __typeof (xmlXPathSubstringAfterFunction) xmlXPathSubstringAfterFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathSubstringAfterFunction xmlXPathSubstringAfterFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathSubstringBeforeFunction +extern __typeof (xmlXPathSubstringBeforeFunction) xmlXPathSubstringBeforeFunction __attribute((alias("xmlXPathSubstringBeforeFunction__internal_alias"))); +#else +#ifndef xmlXPathSubstringBeforeFunction +extern __typeof (xmlXPathSubstringBeforeFunction) xmlXPathSubstringBeforeFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathSubstringBeforeFunction xmlXPathSubstringBeforeFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathSubstringFunction +extern __typeof (xmlXPathSubstringFunction) xmlXPathSubstringFunction __attribute((alias("xmlXPathSubstringFunction__internal_alias"))); +#else +#ifndef xmlXPathSubstringFunction +extern __typeof (xmlXPathSubstringFunction) xmlXPathSubstringFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathSubstringFunction xmlXPathSubstringFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathSumFunction +extern __typeof (xmlXPathSumFunction) xmlXPathSumFunction __attribute((alias("xmlXPathSumFunction__internal_alias"))); +#else +#ifndef xmlXPathSumFunction +extern __typeof (xmlXPathSumFunction) xmlXPathSumFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathSumFunction xmlXPathSumFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathTrailing +extern __typeof (xmlXPathTrailing) xmlXPathTrailing __attribute((alias("xmlXPathTrailing__internal_alias"))); +#else +#ifndef xmlXPathTrailing +extern __typeof (xmlXPathTrailing) xmlXPathTrailing__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathTrailing xmlXPathTrailing__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathTrailingSorted +extern __typeof (xmlXPathTrailingSorted) xmlXPathTrailingSorted __attribute((alias("xmlXPathTrailingSorted__internal_alias"))); +#else +#ifndef xmlXPathTrailingSorted +extern __typeof (xmlXPathTrailingSorted) xmlXPathTrailingSorted__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathTrailingSorted xmlXPathTrailingSorted__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathTranslateFunction +extern __typeof (xmlXPathTranslateFunction) xmlXPathTranslateFunction __attribute((alias("xmlXPathTranslateFunction__internal_alias"))); +#else +#ifndef xmlXPathTranslateFunction +extern __typeof (xmlXPathTranslateFunction) xmlXPathTranslateFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathTranslateFunction xmlXPathTranslateFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathTrueFunction +extern __typeof (xmlXPathTrueFunction) xmlXPathTrueFunction __attribute((alias("xmlXPathTrueFunction__internal_alias"))); +#else +#ifndef xmlXPathTrueFunction +extern __typeof (xmlXPathTrueFunction) xmlXPathTrueFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathTrueFunction xmlXPathTrueFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathValueFlipSign +extern __typeof (xmlXPathValueFlipSign) xmlXPathValueFlipSign __attribute((alias("xmlXPathValueFlipSign__internal_alias"))); +#else +#ifndef xmlXPathValueFlipSign +extern __typeof (xmlXPathValueFlipSign) xmlXPathValueFlipSign__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathValueFlipSign xmlXPathValueFlipSign__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathVariableLookup +extern __typeof (xmlXPathVariableLookup) xmlXPathVariableLookup __attribute((alias("xmlXPathVariableLookup__internal_alias"))); +#else +#ifndef xmlXPathVariableLookup +extern __typeof (xmlXPathVariableLookup) xmlXPathVariableLookup__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathVariableLookup xmlXPathVariableLookup__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathVariableLookupNS +extern __typeof (xmlXPathVariableLookupNS) xmlXPathVariableLookupNS __attribute((alias("xmlXPathVariableLookupNS__internal_alias"))); +#else +#ifndef xmlXPathVariableLookupNS +extern __typeof (xmlXPathVariableLookupNS) xmlXPathVariableLookupNS__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathVariableLookupNS xmlXPathVariableLookupNS__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathWrapCString +extern __typeof (xmlXPathWrapCString) xmlXPathWrapCString __attribute((alias("xmlXPathWrapCString__internal_alias"))); +#else +#ifndef xmlXPathWrapCString +extern __typeof (xmlXPathWrapCString) xmlXPathWrapCString__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathWrapCString xmlXPathWrapCString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathWrapExternal +extern __typeof (xmlXPathWrapExternal) xmlXPathWrapExternal __attribute((alias("xmlXPathWrapExternal__internal_alias"))); +#else +#ifndef xmlXPathWrapExternal +extern __typeof (xmlXPathWrapExternal) xmlXPathWrapExternal__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathWrapExternal xmlXPathWrapExternal__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathWrapNodeSet +extern __typeof (xmlXPathWrapNodeSet) xmlXPathWrapNodeSet __attribute((alias("xmlXPathWrapNodeSet__internal_alias"))); +#else +#ifndef xmlXPathWrapNodeSet +extern __typeof (xmlXPathWrapNodeSet) xmlXPathWrapNodeSet__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathWrapNodeSet xmlXPathWrapNodeSet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPathWrapString +extern __typeof (xmlXPathWrapString) xmlXPathWrapString __attribute((alias("xmlXPathWrapString__internal_alias"))); +#else +#ifndef xmlXPathWrapString +extern __typeof (xmlXPathWrapString) xmlXPathWrapString__internal_alias __attribute((visibility("hidden"))); +#define xmlXPathWrapString xmlXPathWrapString__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPATH_ENABLED) +#ifdef bottom_xpath +#undef xmlXPatherror +extern __typeof (xmlXPatherror) xmlXPatherror __attribute((alias("xmlXPatherror__internal_alias"))); +#else +#ifndef xmlXPatherror +extern __typeof (xmlXPatherror) xmlXPatherror__internal_alias __attribute((visibility("hidden"))); +#define xmlXPatherror xmlXPatherror__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrBuildNodeList +extern __typeof (xmlXPtrBuildNodeList) xmlXPtrBuildNodeList __attribute((alias("xmlXPtrBuildNodeList__internal_alias"))); +#else +#ifndef xmlXPtrBuildNodeList +extern __typeof (xmlXPtrBuildNodeList) xmlXPtrBuildNodeList__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrBuildNodeList xmlXPtrBuildNodeList__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrEval +extern __typeof (xmlXPtrEval) xmlXPtrEval __attribute((alias("xmlXPtrEval__internal_alias"))); +#else +#ifndef xmlXPtrEval +extern __typeof (xmlXPtrEval) xmlXPtrEval__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrEval xmlXPtrEval__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrEvalRangePredicate +extern __typeof (xmlXPtrEvalRangePredicate) xmlXPtrEvalRangePredicate __attribute((alias("xmlXPtrEvalRangePredicate__internal_alias"))); +#else +#ifndef xmlXPtrEvalRangePredicate +extern __typeof (xmlXPtrEvalRangePredicate) xmlXPtrEvalRangePredicate__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrEvalRangePredicate xmlXPtrEvalRangePredicate__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrFreeLocationSet +extern __typeof (xmlXPtrFreeLocationSet) xmlXPtrFreeLocationSet __attribute((alias("xmlXPtrFreeLocationSet__internal_alias"))); +#else +#ifndef xmlXPtrFreeLocationSet +extern __typeof (xmlXPtrFreeLocationSet) xmlXPtrFreeLocationSet__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrFreeLocationSet xmlXPtrFreeLocationSet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrLocationSetAdd +extern __typeof (xmlXPtrLocationSetAdd) xmlXPtrLocationSetAdd __attribute((alias("xmlXPtrLocationSetAdd__internal_alias"))); +#else +#ifndef xmlXPtrLocationSetAdd +extern __typeof (xmlXPtrLocationSetAdd) xmlXPtrLocationSetAdd__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrLocationSetAdd xmlXPtrLocationSetAdd__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrLocationSetCreate +extern __typeof (xmlXPtrLocationSetCreate) xmlXPtrLocationSetCreate __attribute((alias("xmlXPtrLocationSetCreate__internal_alias"))); +#else +#ifndef xmlXPtrLocationSetCreate +extern __typeof (xmlXPtrLocationSetCreate) xmlXPtrLocationSetCreate__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrLocationSetCreate xmlXPtrLocationSetCreate__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrLocationSetDel +extern __typeof (xmlXPtrLocationSetDel) xmlXPtrLocationSetDel __attribute((alias("xmlXPtrLocationSetDel__internal_alias"))); +#else +#ifndef xmlXPtrLocationSetDel +extern __typeof (xmlXPtrLocationSetDel) xmlXPtrLocationSetDel__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrLocationSetDel xmlXPtrLocationSetDel__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrLocationSetMerge +extern __typeof (xmlXPtrLocationSetMerge) xmlXPtrLocationSetMerge __attribute((alias("xmlXPtrLocationSetMerge__internal_alias"))); +#else +#ifndef xmlXPtrLocationSetMerge +extern __typeof (xmlXPtrLocationSetMerge) xmlXPtrLocationSetMerge__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrLocationSetMerge xmlXPtrLocationSetMerge__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrLocationSetRemove +extern __typeof (xmlXPtrLocationSetRemove) xmlXPtrLocationSetRemove __attribute((alias("xmlXPtrLocationSetRemove__internal_alias"))); +#else +#ifndef xmlXPtrLocationSetRemove +extern __typeof (xmlXPtrLocationSetRemove) xmlXPtrLocationSetRemove__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrLocationSetRemove xmlXPtrLocationSetRemove__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrNewCollapsedRange +extern __typeof (xmlXPtrNewCollapsedRange) xmlXPtrNewCollapsedRange __attribute((alias("xmlXPtrNewCollapsedRange__internal_alias"))); +#else +#ifndef xmlXPtrNewCollapsedRange +extern __typeof (xmlXPtrNewCollapsedRange) xmlXPtrNewCollapsedRange__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrNewCollapsedRange xmlXPtrNewCollapsedRange__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrNewContext +extern __typeof (xmlXPtrNewContext) xmlXPtrNewContext __attribute((alias("xmlXPtrNewContext__internal_alias"))); +#else +#ifndef xmlXPtrNewContext +extern __typeof (xmlXPtrNewContext) xmlXPtrNewContext__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrNewContext xmlXPtrNewContext__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrNewLocationSetNodeSet +extern __typeof (xmlXPtrNewLocationSetNodeSet) xmlXPtrNewLocationSetNodeSet __attribute((alias("xmlXPtrNewLocationSetNodeSet__internal_alias"))); +#else +#ifndef xmlXPtrNewLocationSetNodeSet +extern __typeof (xmlXPtrNewLocationSetNodeSet) xmlXPtrNewLocationSetNodeSet__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrNewLocationSetNodeSet xmlXPtrNewLocationSetNodeSet__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrNewLocationSetNodes +extern __typeof (xmlXPtrNewLocationSetNodes) xmlXPtrNewLocationSetNodes __attribute((alias("xmlXPtrNewLocationSetNodes__internal_alias"))); +#else +#ifndef xmlXPtrNewLocationSetNodes +extern __typeof (xmlXPtrNewLocationSetNodes) xmlXPtrNewLocationSetNodes__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrNewLocationSetNodes xmlXPtrNewLocationSetNodes__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrNewRange +extern __typeof (xmlXPtrNewRange) xmlXPtrNewRange __attribute((alias("xmlXPtrNewRange__internal_alias"))); +#else +#ifndef xmlXPtrNewRange +extern __typeof (xmlXPtrNewRange) xmlXPtrNewRange__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrNewRange xmlXPtrNewRange__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrNewRangeNodeObject +extern __typeof (xmlXPtrNewRangeNodeObject) xmlXPtrNewRangeNodeObject __attribute((alias("xmlXPtrNewRangeNodeObject__internal_alias"))); +#else +#ifndef xmlXPtrNewRangeNodeObject +extern __typeof (xmlXPtrNewRangeNodeObject) xmlXPtrNewRangeNodeObject__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrNewRangeNodeObject xmlXPtrNewRangeNodeObject__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrNewRangeNodePoint +extern __typeof (xmlXPtrNewRangeNodePoint) xmlXPtrNewRangeNodePoint __attribute((alias("xmlXPtrNewRangeNodePoint__internal_alias"))); +#else +#ifndef xmlXPtrNewRangeNodePoint +extern __typeof (xmlXPtrNewRangeNodePoint) xmlXPtrNewRangeNodePoint__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrNewRangeNodePoint xmlXPtrNewRangeNodePoint__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrNewRangeNodes +extern __typeof (xmlXPtrNewRangeNodes) xmlXPtrNewRangeNodes __attribute((alias("xmlXPtrNewRangeNodes__internal_alias"))); +#else +#ifndef xmlXPtrNewRangeNodes +extern __typeof (xmlXPtrNewRangeNodes) xmlXPtrNewRangeNodes__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrNewRangeNodes xmlXPtrNewRangeNodes__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrNewRangePointNode +extern __typeof (xmlXPtrNewRangePointNode) xmlXPtrNewRangePointNode __attribute((alias("xmlXPtrNewRangePointNode__internal_alias"))); +#else +#ifndef xmlXPtrNewRangePointNode +extern __typeof (xmlXPtrNewRangePointNode) xmlXPtrNewRangePointNode__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrNewRangePointNode xmlXPtrNewRangePointNode__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrNewRangePoints +extern __typeof (xmlXPtrNewRangePoints) xmlXPtrNewRangePoints __attribute((alias("xmlXPtrNewRangePoints__internal_alias"))); +#else +#ifndef xmlXPtrNewRangePoints +extern __typeof (xmlXPtrNewRangePoints) xmlXPtrNewRangePoints__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrNewRangePoints xmlXPtrNewRangePoints__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrRangeToFunction +extern __typeof (xmlXPtrRangeToFunction) xmlXPtrRangeToFunction __attribute((alias("xmlXPtrRangeToFunction__internal_alias"))); +#else +#ifndef xmlXPtrRangeToFunction +extern __typeof (xmlXPtrRangeToFunction) xmlXPtrRangeToFunction__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrRangeToFunction xmlXPtrRangeToFunction__internal_alias +#endif +#endif +#endif + +#if defined(LIBXML_XPTR_ENABLED) +#ifdef bottom_xpointer +#undef xmlXPtrWrapLocationSet +extern __typeof (xmlXPtrWrapLocationSet) xmlXPtrWrapLocationSet __attribute((alias("xmlXPtrWrapLocationSet__internal_alias"))); +#else +#ifndef xmlXPtrWrapLocationSet +extern __typeof (xmlXPtrWrapLocationSet) xmlXPtrWrapLocationSet__internal_alias __attribute((visibility("hidden"))); +#define xmlXPtrWrapLocationSet xmlXPtrWrapLocationSet__internal_alias +#endif +#endif +#endif + + +#endif +#endif +#endif +#endif +#endif + diff --git a/gnulib-local/lib/libxml/encoding.c b/gnulib-local/lib/libxml/encoding.c index ee33df1..574e1ae 100644 --- a/gnulib-local/lib/libxml/encoding.c +++ b/gnulib-local/lib/libxml/encoding.c @@ -1,7 +1,7 @@ /* * encoding.c : implements the encoding conversion functions needed for XML * - * Related specs: + * Related specs: * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies * rfc2781 UTF-16, an encoding of ISO 10646, P. Hoffman, F. Yergeau * [ISO-10646] UTF-8 and UTF-16 in Annexes @@ -24,6 +24,7 @@ #include "libxml.h" #include +#include #ifdef HAVE_CTYPE_H #include @@ -44,6 +45,9 @@ #include #include +#include "buf.h" +#include "enc.h" + static xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL; static xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL; @@ -58,7 +62,7 @@ static xmlCharEncodingAliasPtr xmlCharEncodingAliases = NULL; static int xmlCharEncodingAliasesNb = 0; static int xmlCharEncodingAliasesMax = 0; -#ifdef LIBXML_ICONV_ENABLED +#if defined(LIBXML_ICONV_ENABLED) || defined(LIBXML_ICU_ENABLED) #if 0 #define DEBUG_ENCODING /* Define this to get encoding traces */ #endif @@ -97,6 +101,54 @@ xmlEncodingErr(xmlParserErrors error, const char *msg, const char *val) NULL, 0, val, NULL, NULL, 0, 0, msg, val); } +#ifdef LIBXML_ICU_ENABLED +static uconv_t* +openIcuConverter(const char* name, int toUnicode) +{ + UErrorCode status = U_ZERO_ERROR; + uconv_t *conv = (uconv_t *) xmlMalloc(sizeof(uconv_t)); + if (conv == NULL) + return NULL; + + conv->uconv = ucnv_open(name, &status); + if (U_FAILURE(status)) + goto error; + + status = U_ZERO_ERROR; + if (toUnicode) { + ucnv_setToUCallBack(conv->uconv, UCNV_TO_U_CALLBACK_STOP, + NULL, NULL, NULL, &status); + } + else { + ucnv_setFromUCallBack(conv->uconv, UCNV_FROM_U_CALLBACK_STOP, + NULL, NULL, NULL, &status); + } + if (U_FAILURE(status)) + goto error; + + status = U_ZERO_ERROR; + conv->utf8 = ucnv_open("UTF-8", &status); + if (U_SUCCESS(status)) + return conv; + +error: + if (conv->uconv) + ucnv_close(conv->uconv); + xmlFree(conv); + return NULL; +} + +static void +closeIcuConverter(uconv_t *conv) +{ + if (conv != NULL) { + ucnv_close(conv->uconv); + ucnv_close(conv->utf8); + xmlFree(conv); + } +} +#endif /* LIBXML_ICU_ENABLED */ + /************************************************************************ * * * Conversions To/From UTF8 encoding * @@ -135,12 +187,12 @@ asciiToUTF8(unsigned char* out, int *outlen, break; if (c < 0x80) { *out++ = c; - } else { + } else { *outlen = out - outstart; *inlen = processed - base; return(-1); } - + processed = (const unsigned char*) in; } *outlen = out - outstart; @@ -206,7 +258,7 @@ UTF8Toascii(unsigned char* out, int *outlen, if (inend - in < trailing) { break; - } + } for ( ; trailing; trailing--) { if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80)) @@ -263,19 +315,19 @@ isolat1ToUTF8(unsigned char* out, int *outlen, outend = out + *outlen; inend = in + (*inlen); instop = inend; - - while (in < inend && out < outend - 1) { - if (*in >= 0x80) { + + while ((in < inend) && (out < outend - 1)) { + if (*in >= 0x80) { *out++ = (((*in) >> 6) & 0x1F) | 0xC0; - *out++ = ((*in) & 0x3F) | 0x80; + *out++ = ((*in) & 0x3F) | 0x80; ++in; } - if (instop - in > outend - out) instop = in + (outend - out); - while (in < instop && *in < 0x80) { + if ((instop - in) > (outend - out)) instop = in + (outend - out); + while ((in < instop) && (*in < 0x80)) { *out++ = *in++; } - } - if (in < inend && out < outend && *in < 0x80) { + } + if ((in < inend) && (out < outend) && (*in < 0x80)) { *out++ = *in++; } *outlen = out - outstart; @@ -379,7 +431,7 @@ UTF8Toisolat1(unsigned char* out, int *outlen, if (inend - in < trailing) { break; - } + } for ( ; trailing; trailing--) { if (in >= inend) @@ -487,7 +539,7 @@ UTF16LEToUTF8(unsigned char* out, int *outlen, else if (c < 0x800) { *out++= ((c >> 6) & 0x1F) | 0xC0; bits= 0; } else if (c < 0x10000) { *out++= ((c >> 12) & 0x0F) | 0xE0; bits= 6; } else { *out++= ((c >> 18) & 0x07) | 0xF0; bits= 12; } - + for ( ; bits >= 0; bits-= 6) { if (out >= outend) break; @@ -512,7 +564,7 @@ UTF16LEToUTF8(unsigned char* out, int *outlen, * block of chars out. * * Returns the number of bytes written, or -1 if lack of space, or -2 - * if the transcoding failed. + * if the transcoding failed. */ static int UTF8ToUTF16LE(unsigned char* outb, int *outlen, @@ -558,7 +610,7 @@ UTF8ToUTF16LE(unsigned char* outb, int *outlen, if (inend - in < trailing) { break; - } + } for ( ; trailing; trailing--) { if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80)) @@ -621,7 +673,7 @@ UTF8ToUTF16LE(unsigned char* outb, int *outlen, * block of chars out. * * Returns the number of bytes written, or -1 if lack of space, or -2 - * if the transcoding failed. + * if the transcoding failed. */ static int UTF8ToUTF16(unsigned char* outb, int *outlen, @@ -693,7 +745,7 @@ UTF16BEToUTF8(unsigned char* out, int *outlen, in++; } else { c= *in++; - } + } if ((c & 0xFC00) == 0xD800) { /* surrogates */ if (in >= inend) { /* (in > inend) shouldn't happens */ *outlen = out - outstart; @@ -723,15 +775,15 @@ UTF16BEToUTF8(unsigned char* out, int *outlen, } /* assertion: c is a single UTF-4 value */ - if (out >= outend) + if (out >= outend) break; if (c < 0x80) { *out++= c; bits= -6; } else if (c < 0x800) { *out++= ((c >> 6) & 0x1F) | 0xC0; bits= 0; } else if (c < 0x10000) { *out++= ((c >> 12) & 0x0F) | 0xE0; bits= 6; } else { *out++= ((c >> 18) & 0x07) | 0xF0; bits= 12; } - + for ( ; bits >= 0; bits-= 6) { - if (out >= outend) + if (out >= outend) break; *out++= ((c >> bits) & 0x3F) | 0x80; } @@ -754,7 +806,7 @@ UTF16BEToUTF8(unsigned char* out, int *outlen, * block of chars out. * * Returns the number of byte written, or -1 by lack of space, or -2 - * if the transcoding failed. + * if the transcoding failed. */ static int UTF8ToUTF16BE(unsigned char* outb, int *outlen, @@ -800,7 +852,7 @@ UTF8ToUTF16BE(unsigned char* outb, int *outlen, if (inend - in < trailing) { break; - } + } for ( ; trailing; trailing--) { if ((in >= inend) || (((d= *in++) & 0xC0) != 0x80)) break; @@ -864,13 +916,13 @@ UTF8ToUTF16BE(unsigned char* outb, int *outlen, * * Guess the encoding of the entity using the first bytes of the entity content * according to the non-normative appendix F of the XML-1.0 recommendation. - * + * * Returns one of the XML_CHAR_ENCODING_... values. */ xmlCharEncoding xmlDetectCharEncoding(const unsigned char* in, int len) { - if (in == NULL) + if (in == NULL) return(XML_CHAR_ENCODING_NONE); if (len >= 4) { if ((in[0] == 0x00) && (in[1] == 0x00) && @@ -951,7 +1003,7 @@ xmlCleanupEncodingAliases(void) { * @alias: the alias name as parsed, in UTF-8 format (ASCII actually) * * Lookup an encoding name for the given alias. - * + * * Returns NULL if not found, otherwise the original name */ const char * @@ -989,7 +1041,7 @@ xmlGetEncodingAlias(const char *alias) { * * Registers an alias @alias for an encoding named @name. Existing alias * will be overwritten. - * + * * Returns 0 in case of success, -1 in case of error */ int @@ -1009,13 +1061,13 @@ xmlAddEncodingAlias(const char *name, const char *alias) { if (xmlCharEncodingAliases == NULL) { xmlCharEncodingAliasesNb = 0; xmlCharEncodingAliasesMax = 20; - xmlCharEncodingAliases = (xmlCharEncodingAliasPtr) + xmlCharEncodingAliases = (xmlCharEncodingAliasPtr) xmlMalloc(xmlCharEncodingAliasesMax * sizeof(xmlCharEncodingAlias)); if (xmlCharEncodingAliases == NULL) return(-1); } else if (xmlCharEncodingAliasesNb >= xmlCharEncodingAliasesMax) { xmlCharEncodingAliasesMax *= 2; - xmlCharEncodingAliases = (xmlCharEncodingAliasPtr) + xmlCharEncodingAliases = (xmlCharEncodingAliasPtr) xmlRealloc(xmlCharEncodingAliases, xmlCharEncodingAliasesMax * sizeof(xmlCharEncodingAlias)); } @@ -1046,7 +1098,7 @@ xmlAddEncodingAlias(const char *name, const char *alias) { * @alias: the alias name as parsed, in UTF-8 format (ASCII actually) * * Unregisters an encoding alias @alias - * + * * Returns 0 in case of success, -1 in case of error */ int @@ -1081,7 +1133,7 @@ xmlDelEncodingAlias(const char *alias) { * Compare the string to the encoding schemes already known. Note * that the comparison is case insensitive accordingly to the section * [XML] 4.3.3 Character Encoding in Entities. - * + * * Returns one of the XML_CHAR_ENCODING_... values or XML_CHAR_ENCODING_NONE * if not recognized. */ @@ -1118,7 +1170,7 @@ xmlParseCharEncoding(const char* name) */ if (!strcmp(upper, "UTF-16")) return(XML_CHAR_ENCODING_UTF16LE); if (!strcmp(upper, "UTF16")) return(XML_CHAR_ENCODING_UTF16LE); - + if (!strcmp(upper, "ISO-10646-UCS-2")) return(XML_CHAR_ENCODING_UCS2); if (!strcmp(upper, "UCS-2")) return(XML_CHAR_ENCODING_UCS2); if (!strcmp(upper, "UCS2")) return(XML_CHAR_ENCODING_UCS2); @@ -1131,7 +1183,7 @@ xmlParseCharEncoding(const char* name) if (!strcmp(upper, "UCS-4")) return(XML_CHAR_ENCODING_UCS4LE); if (!strcmp(upper, "UCS4")) return(XML_CHAR_ENCODING_UCS4LE); - + if (!strcmp(upper, "ISO-8859-1")) return(XML_CHAR_ENCODING_8859_1); if (!strcmp(upper, "ISO-LATIN-1")) return(XML_CHAR_ENCODING_8859_1); if (!strcmp(upper, "ISO LATIN 1")) return(XML_CHAR_ENCODING_8859_1); @@ -1254,7 +1306,7 @@ static xmlCharEncodingHandlerPtr xmlDefaultCharEncodingHandler = NULL; * Returns the xmlCharEncodingHandlerPtr created (or NULL in case of error). */ xmlCharEncodingHandlerPtr -xmlNewCharEncodingHandler(const char *name, +xmlNewCharEncodingHandler(const char *name, xmlCharEncodingInputFunc input, xmlCharEncodingOutputFunc output) { xmlCharEncodingHandlerPtr handler; @@ -1299,6 +1351,7 @@ xmlNewCharEncodingHandler(const char *name, xmlEncodingErrMemory("xmlNewCharEncodingHandler : out of memory !\n"); return(NULL); } + memset(handler, 0, sizeof(xmlCharEncodingHandler)); handler->input = input; handler->output = output; handler->name = up; @@ -1306,7 +1359,11 @@ xmlNewCharEncodingHandler(const char *name, #ifdef LIBXML_ICONV_ENABLED handler->iconv_in = NULL; handler->iconv_out = NULL; -#endif /* LIBXML_ICONV_ENABLED */ +#endif +#ifdef LIBXML_ICU_ENABLED + handler->uconv_in = NULL; + handler->uconv_out = NULL; +#endif /* * registers and returns the handler. @@ -1330,7 +1387,7 @@ xmlNewCharEncodingHandler(const char *name, void xmlInitCharEncodingHandlers(void) { unsigned short int tst = 0x1234; - unsigned char *ptr = (unsigned char *) &tst; + unsigned char *ptr = (unsigned char *) &tst; if (handlers != NULL) return; @@ -1350,9 +1407,9 @@ xmlInitCharEncodingHandlers(void) { } xmlNewCharEncodingHandler("UTF-8", UTF8ToUTF8, UTF8ToUTF8); #ifdef LIBXML_OUTPUT_ENABLED - xmlUTF16LEHandler = + xmlUTF16LEHandler = xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, UTF8ToUTF16LE); - xmlUTF16BEHandler = + xmlUTF16BEHandler = xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, UTF8ToUTF16BE); xmlNewCharEncodingHandler("UTF-16", UTF16LEToUTF8, UTF8ToUTF16); xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, UTF8Toisolat1); @@ -1362,16 +1419,16 @@ xmlInitCharEncodingHandlers(void) { xmlNewCharEncodingHandler("HTML", NULL, UTF8ToHtml); #endif #else - xmlUTF16LEHandler = + xmlUTF16LEHandler = xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, NULL); - xmlUTF16BEHandler = + xmlUTF16BEHandler = xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, NULL); xmlNewCharEncodingHandler("UTF-16", UTF16LEToUTF8, NULL); xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, NULL); xmlNewCharEncodingHandler("ASCII", asciiToUTF8, NULL); xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, NULL); #endif /* LIBXML_OUTPUT_ENABLED */ -#ifndef LIBXML_ICONV_ENABLED +#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED) #ifdef LIBXML_ISO8859X_ENABLED xmlRegisterCharEncodingHandlersISO8859x (); #endif @@ -1414,7 +1471,7 @@ xmlCleanupCharEncodingHandlers(void) { void xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) { if (handlers == NULL) xmlInitCharEncodingHandlers(); - if (handler == NULL) { + if ((handler == NULL) || (handlers == NULL)) { xmlEncodingErr(XML_I18N_NO_HANDLER, "xmlRegisterCharEncodingHandler: NULL handler !\n", NULL); return; @@ -1458,6 +1515,10 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) { if (handler != NULL) return(handler); handler = xmlFindCharEncodingHandler("ebcdic"); if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("EBCDIC-US"); + if (handler != NULL) return(handler); + handler = xmlFindCharEncodingHandler("IBM-037"); + if (handler != NULL) return(handler); break; case XML_CHAR_ENCODING_UCS4BE: handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4"); @@ -1548,10 +1609,10 @@ xmlGetCharEncodingHandler(xmlCharEncoding enc) { handler = xmlFindCharEncodingHandler("EUC-JP"); if (handler != NULL) return(handler); break; - default: + default: break; } - + #ifdef DEBUG_ENCODING xmlGenericError(xmlGenericErrorContext, "No handler found for encoding %d\n", enc); @@ -1576,6 +1637,10 @@ xmlFindCharEncodingHandler(const char *name) { xmlCharEncodingHandlerPtr enc; iconv_t icv_in, icv_out; #endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + xmlCharEncodingHandlerPtr encu; + uconv_t *ucv_in, *ucv_out; +#endif /* LIBXML_ICU_ENABLED */ char upper[100]; int i; @@ -1600,14 +1665,17 @@ xmlFindCharEncodingHandler(const char *name) { } upper[i] = 0; - for (i = 0;i < nbCharEncodingHandler; i++) - if (!strcmp(upper, handlers[i]->name)) { + if (handlers != NULL) { + for (i = 0;i < nbCharEncodingHandler; i++) { + if (!strcmp(upper, handlers[i]->name)) { #ifdef DEBUG_ENCODING - xmlGenericError(xmlGenericErrorContext, - "Found registered handler for encoding %s\n", name); + xmlGenericError(xmlGenericErrorContext, + "Found registered handler for encoding %s\n", name); #endif - return(handlers[i]); - } + return(handlers[i]); + } + } + } #ifdef LIBXML_ICONV_ENABLED /* check whether iconv can handle this */ @@ -1627,6 +1695,7 @@ xmlFindCharEncodingHandler(const char *name) { iconv_close(icv_out); return(NULL); } + memset(enc, 0, sizeof(xmlCharEncodingHandler)); enc->name = xmlMemStrdup(name); enc->input = NULL; enc->output = NULL; @@ -1642,6 +1711,36 @@ xmlFindCharEncodingHandler(const char *name) { "iconv : problems with filters for '%s'\n", name); } #endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + /* check whether icu can handle this */ + ucv_in = openIcuConverter(name, 1); + ucv_out = openIcuConverter(name, 0); + if (ucv_in != NULL && ucv_out != NULL) { + encu = (xmlCharEncodingHandlerPtr) + xmlMalloc(sizeof(xmlCharEncodingHandler)); + if (encu == NULL) { + closeIcuConverter(ucv_in); + closeIcuConverter(ucv_out); + return(NULL); + } + memset(encu, 0, sizeof(xmlCharEncodingHandler)); + encu->name = xmlMemStrdup(name); + encu->input = NULL; + encu->output = NULL; + encu->uconv_in = ucv_in; + encu->uconv_out = ucv_out; +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "Found ICU converter handler for encoding %s\n", name); +#endif + return encu; + } else if (ucv_in != NULL || ucv_out != NULL) { + closeIcuConverter(ucv_in); + closeIcuConverter(ucv_out); + xmlEncodingErr(XML_ERR_INTERNAL_ERROR, + "ICU converter : problems with filters for '%s'\n", name); + } +#endif /* LIBXML_ICU_ENABLED */ #ifdef DEBUG_ENCODING xmlGenericError(xmlGenericErrorContext, @@ -1679,12 +1778,12 @@ xmlFindCharEncodingHandler(const char *name) { * @in: a pointer to an array of ISO Latin 1 chars * @inlen: the length of @in * - * Returns 0 if success, or + * Returns 0 if success, or * -1 by lack of space, or * -2 if the transcoding fails (for *in is not valid utf8 string or * the result of transformation can't fit into the encoding we want), or * -3 if there the last byte can't form a single output char. - * + * * The value of @inlen after return is the number of octets consumed * as the return value is positive, else unpredictable. * The value of @outlen after return is the number of ocetes consumed. @@ -1703,7 +1802,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, } icv_inlen = *inlen; icv_outlen = *outlen; - ret = iconv(cd, (char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen); + ret = iconv(cd, (ICONV_CONST char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen); *inlen -= icv_inlen; *outlen -= icv_outlen; if ((icv_inlen != 0) || (ret == -1)) { @@ -1730,6 +1829,75 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, } #endif /* LIBXML_ICONV_ENABLED */ +/************************************************************************ + * * + * ICU based generic conversion functions * + * * + ************************************************************************/ + +#ifdef LIBXML_ICU_ENABLED +/** + * xmlUconvWrapper: + * @cd: ICU uconverter data structure + * @toUnicode : non-zero if toUnicode. 0 otherwise. + * @out: a pointer to an array of bytes to store the result + * @outlen: the length of @out + * @in: a pointer to an array of ISO Latin 1 chars + * @inlen: the length of @in + * + * Returns 0 if success, or + * -1 by lack of space, or + * -2 if the transcoding fails (for *in is not valid utf8 string or + * the result of transformation can't fit into the encoding we want), or + * -3 if there the last byte can't form a single output char. + * + * The value of @inlen after return is the number of octets consumed + * as the return value is positive, else unpredictable. + * The value of @outlen after return is the number of ocetes consumed. + */ +static int +xmlUconvWrapper(uconv_t *cd, int toUnicode, unsigned char *out, int *outlen, + const unsigned char *in, int *inlen) { + const char *ucv_in = (const char *) in; + char *ucv_out = (char *) out; + UErrorCode err = U_ZERO_ERROR; + + if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || (in == NULL)) { + if (outlen != NULL) *outlen = 0; + return(-1); + } + + /* + * TODO(jungshik) + * 1. is ucnv_convert(To|From)Algorithmic better? + * 2. had we better use an explicit pivot buffer? + * 3. error returned comes from 'fromUnicode' only even + * when toUnicode is true ! + */ + if (toUnicode) { + /* encoding => UTF-16 => UTF-8 */ + ucnv_convertEx(cd->utf8, cd->uconv, &ucv_out, ucv_out + *outlen, + &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL, + 0, TRUE, &err); + } else { + /* UTF-8 => UTF-16 => encoding */ + ucnv_convertEx(cd->uconv, cd->utf8, &ucv_out, ucv_out + *outlen, + &ucv_in, ucv_in + *inlen, NULL, NULL, NULL, NULL, + 0, TRUE, &err); + } + *inlen = ucv_in - (const char*) in; + *outlen = ucv_out - (char *) out; + if (U_SUCCESS(err)) + return 0; + if (err == U_BUFFER_OVERFLOW_ERROR) + return -1; + if (err == U_INVALID_CHAR_FOUND || err == U_ILLEGAL_CHAR_FOUND) + return -2; + /* if (err == U_TRUNCATED_CHAR_FOUND) */ + return -3; +} +#endif /* LIBXML_ICU_ENABLED */ + /************************************************************************ * * * The real API used by libxml for on-the-fly conversion * @@ -1737,22 +1905,23 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, ************************************************************************/ /** - * xmlCharEncFirstLine: + * xmlCharEncFirstLineInt: * @handler: char enconding transformation data structure * @out: an xmlBuffer for the output. * @in: an xmlBuffer for the input - * + * @len: number of bytes to convert for the first line, or -1 + * * Front-end for the encoding handler input function, but handle only * the very first line, i.e. limit itself to 45 chars. - * - * Returns the number of byte written if success, or + * + * Returns the number of byte written if success, or * -1 general error * -2 if the transcoding fails (for *in is not valid utf8 string or * the result of transformation can't fit into the encoding we want), or */ int -xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, - xmlBufferPtr in) { +xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out, + xmlBufferPtr in, int len) { int ret = -2; int written; int toconv; @@ -1761,19 +1930,28 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, if (out == NULL) return(-1); if (in == NULL) return(-1); - written = out->size - out->use; + /* calculate space available */ + written = out->size - out->use - 1; /* count '\0' */ toconv = in->use; - if (toconv * 2 >= written) { - xmlBufferGrow(out, toconv); - written = out->size - out->use - 1; - } - /* * echo '' | wc -c => 38 * 45 chars should be sufficient to reach the end of the encoding * declaration without going too far inside the document content. + * on UTF-16 this means 90bytes, on UCS4 this means 180 + * The actual value depending on guessed encoding is passed as @len + * if provided */ - written = 45; + if (len >= 0) { + if (toconv > len) + toconv = len; + } else { + if (toconv > 180) + toconv = 180; + } + if (toconv * 2 >= written) { + xmlBufferGrow(out, toconv * 2); + written = out->size - out->use - 1; + } if (handler->input != NULL) { ret = handler->input(&out->content[out->use], &written, @@ -1792,6 +1970,16 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, if (ret == -1) ret = -3; } #endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + else if (handler->uconv_in != NULL) { + ret = xmlUconvWrapper(handler->uconv_in, 1, &out->content[out->use], + &written, in->content, &toconv); + xmlBufferShrink(in, toconv); + out->use += written; + out->content[out->use] = 0; + if (ret == -1) ret = -3; + } +#endif /* LIBXML_ICU_ENABLED */ #ifdef DEBUG_ENCODING switch (ret) { case 0: @@ -1823,15 +2011,281 @@ xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, return(ret); } +/** + * xmlCharEncFirstLine: + * @handler: char enconding transformation data structure + * @out: an xmlBuffer for the output. + * @in: an xmlBuffer for the input + * + * Front-end for the encoding handler input function, but handle only + * the very first line, i.e. limit itself to 45 chars. + * + * Returns the number of byte written if success, or + * -1 general error + * -2 if the transcoding fails (for *in is not valid utf8 string or + * the result of transformation can't fit into the encoding we want), or + */ +int +xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, + xmlBufferPtr in) { + return(xmlCharEncFirstLineInt(handler, out, in, -1)); +} + +/** + * xmlCharEncFirstLineInput: + * @input: a parser input buffer + * @len: number of bytes to convert for the first line, or -1 + * + * Front-end for the encoding handler input function, but handle only + * the very first line. Point is that this is based on autodetection + * of the encoding and once that first line is converted we may find + * out that a different decoder is needed to process the input. + * + * Returns the number of byte written if success, or + * -1 general error + * -2 if the transcoding fails (for *in is not valid utf8 string or + * the result of transformation can't fit into the encoding we want), or + */ +int +xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len) +{ + int ret = -2; + size_t written; + size_t toconv; + int c_in; + int c_out; + xmlBufPtr in; + xmlBufPtr out; + + if ((input == NULL) || (input->encoder == NULL) || + (input->buffer == NULL) || (input->raw == NULL)) + return (-1); + out = input->buffer; + in = input->raw; + + toconv = xmlBufUse(in); + if (toconv == 0) + return (0); + written = xmlBufAvail(out) - 1; /* count '\0' */ + /* + * echo '' | wc -c => 38 + * 45 chars should be sufficient to reach the end of the encoding + * declaration without going too far inside the document content. + * on UTF-16 this means 90bytes, on UCS4 this means 180 + * The actual value depending on guessed encoding is passed as @len + * if provided + */ + if (len >= 0) { + if (toconv > (unsigned int) len) + toconv = len; + } else { + if (toconv > 180) + toconv = 180; + } + if (toconv * 2 >= written) { + xmlBufGrow(out, toconv * 2); + written = xmlBufAvail(out) - 1; + } + if (written > 360) + written = 360; + + c_in = toconv; + c_out = written; + if (input->encoder->input != NULL) { + ret = input->encoder->input(xmlBufEnd(out), &c_out, + xmlBufContent(in), &c_in); + xmlBufShrink(in, c_in); + xmlBufAddLen(out, c_out); + } +#ifdef LIBXML_ICONV_ENABLED + else if (input->encoder->iconv_in != NULL) { + ret = xmlIconvWrapper(input->encoder->iconv_in, xmlBufEnd(out), + &c_out, xmlBufContent(in), &c_in); + xmlBufShrink(in, c_in); + xmlBufAddLen(out, c_out); + if (ret == -1) + ret = -3; + } +#endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + else if (input->encoder->uconv_in != NULL) { + ret = xmlUconvWrapper(input->encoder->uconv_in, 1, xmlBufEnd(out), + &c_out, xmlBufContent(in), &c_in); + xmlBufShrink(in, c_in); + xmlBufAddLen(out, c_out); + if (ret == -1) + ret = -3; + } +#endif /* LIBXML_ICU_ENABLED */ + switch (ret) { + case 0: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "converted %d bytes to %d bytes of input\n", + c_in, c_out); +#endif + break; + case -1: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "converted %d bytes to %d bytes of input, %d left\n", + c_in, c_out, (int)xmlBufUse(in)); +#endif + break; + case -3: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "converted %d bytes to %d bytes of input, %d left\n", + c_in, c_out, (int)xmlBufUse(in)); +#endif + break; + case -2: { + char buf[50]; + const xmlChar *content = xmlBufContent(in); + + snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X", + content[0], content[1], + content[2], content[3]); + buf[49] = 0; + xmlEncodingErr(XML_I18N_CONV_FAILED, + "input conversion failed due to input error, bytes %s\n", + buf); + } + } + /* + * Ignore when input buffer is not on a boundary + */ + if (ret == -3) ret = 0; + if (ret == -1) ret = 0; + return(ret); +} + +/** + * xmlCharEncInput: + * @input: a parser input buffer + * @flush: try to flush all the raw buffer + * + * Generic front-end for the encoding handler on parser input + * + * Returns the number of byte written if success, or + * -1 general error + * -2 if the transcoding fails (for *in is not valid utf8 string or + * the result of transformation can't fit into the encoding we want), or + */ +int +xmlCharEncInput(xmlParserInputBufferPtr input, int flush) +{ + int ret = -2; + size_t written; + size_t toconv; + int c_in; + int c_out; + xmlBufPtr in; + xmlBufPtr out; + + if ((input == NULL) || (input->encoder == NULL) || + (input->buffer == NULL) || (input->raw == NULL)) + return (-1); + out = input->buffer; + in = input->raw; + + toconv = xmlBufUse(in); + if (toconv == 0) + return (0); + if ((toconv > 64 * 1024) && (flush == 0)) + toconv = 64 * 1024; + written = xmlBufAvail(out); + if (written > 0) + written--; /* count '\0' */ + if (toconv * 2 >= written) { + xmlBufGrow(out, toconv * 2); + written = xmlBufAvail(out); + if (written > 0) + written--; /* count '\0' */ + } + if ((written > 128 * 1024) && (flush == 0)) + written = 128 * 1024; + + c_in = toconv; + c_out = written; + if (input->encoder->input != NULL) { + ret = input->encoder->input(xmlBufEnd(out), &c_out, + xmlBufContent(in), &c_in); + xmlBufShrink(in, c_in); + xmlBufAddLen(out, c_out); + } +#ifdef LIBXML_ICONV_ENABLED + else if (input->encoder->iconv_in != NULL) { + ret = xmlIconvWrapper(input->encoder->iconv_in, xmlBufEnd(out), + &c_out, xmlBufContent(in), &c_in); + xmlBufShrink(in, c_in); + xmlBufAddLen(out, c_out); + if (ret == -1) + ret = -3; + } +#endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + else if (input->encoder->uconv_in != NULL) { + ret = xmlUconvWrapper(input->encoder->uconv_in, 1, xmlBufEnd(out), + &c_out, xmlBufContent(in), &c_in); + xmlBufShrink(in, c_in); + xmlBufAddLen(out, c_out); + if (ret == -1) + ret = -3; + } +#endif /* LIBXML_ICU_ENABLED */ + switch (ret) { + case 0: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "converted %d bytes to %d bytes of input\n", + c_in, c_out); +#endif + break; + case -1: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "converted %d bytes to %d bytes of input, %d left\n", + c_in, c_out, (int)xmlBufUse(in)); +#endif + break; + case -3: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "converted %d bytes to %d bytes of input, %d left\n", + c_in, c_out, (int)xmlBufUse(in)); +#endif + break; + case -2: { + char buf[50]; + const xmlChar *content = xmlBufContent(in); + + snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X", + content[0], content[1], + content[2], content[3]); + buf[49] = 0; + xmlEncodingErr(XML_I18N_CONV_FAILED, + "input conversion failed due to input error, bytes %s\n", + buf); + } + } + /* + * Ignore when input buffer is not on a boundary + */ + if (ret == -3) + ret = 0; + return (c_out? c_out : ret); +} + /** * xmlCharEncInFunc: * @handler: char encoding transformation data structure * @out: an xmlBuffer for the output. * @in: an xmlBuffer for the input - * + * * Generic front-end for the encoding handler input function - * - * Returns the number of byte written if success, or + * + * Returns the number of byte written if success, or * -1 general error * -2 if the transcoding fails (for *in is not valid utf8 string or * the result of transformation can't fit into the encoding we want), or @@ -1854,7 +2308,7 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out, toconv = in->use; if (toconv == 0) return (0); - written = out->size - out->use; + written = out->size - out->use -1; /* count '\0' */ if (toconv * 2 >= written) { xmlBufferGrow(out, out->size + toconv * 2); written = out->size - out->use - 1; @@ -1877,6 +2331,17 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out, ret = -3; } #endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + else if (handler->uconv_in != NULL) { + ret = xmlUconvWrapper(handler->uconv_in, 1, &out->content[out->use], + &written, in->content, &toconv); + xmlBufferShrink(in, toconv); + out->use += written; + out->content[out->use] = 0; + if (ret == -1) + ret = -3; + } +#endif /* LIBXML_ICU_ENABLED */ switch (ret) { case 0: #ifdef DEBUG_ENCODING @@ -1902,7 +2367,7 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out, case -2: { char buf[50]; - snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X", + snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X", in->content[0], in->content[1], in->content[2], in->content[3]); buf[49] = 0; @@ -1919,20 +2384,251 @@ xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out, return (written? written : ret); } +#ifdef LIBXML_OUTPUT_ENABLED +/** + * xmlCharEncOutput: + * @output: a parser output buffer + * @init: is this an initialization call without data + * + * Generic front-end for the encoding handler on parser output + * a first call with @init == 1 has to be made first to initiate the + * output in case of non-stateless encoding needing to initiate their + * state or the output (like the BOM in UTF16). + * In case of UTF8 sequence conversion errors for the given encoder, + * the content will be automatically remapped to a CharRef sequence. + * + * Returns the number of byte written if success, or + * -1 general error + * -2 if the transcoding fails (for *in is not valid utf8 string or + * the result of transformation can't fit into the encoding we want), or + */ +int +xmlCharEncOutput(xmlOutputBufferPtr output, int init) +{ + int ret = -2; + size_t written; + size_t writtentot = 0; + size_t toconv; + int c_in; + int c_out; + xmlBufPtr in; + xmlBufPtr out; + int charref_len = 0; + + if ((output == NULL) || (output->encoder == NULL) || + (output->buffer == NULL) || (output->conv == NULL)) + return (-1); + out = output->conv; + in = output->buffer; + +retry: + + written = xmlBufAvail(out); + if (written > 0) + written--; /* count '\0' */ + + /* + * First specific handling of the initialization call + */ + if (init) { + c_in = 0; + c_out = written; + if (output->encoder->output != NULL) { + ret = output->encoder->output(xmlBufEnd(out), &c_out, + NULL, &c_in); + if (ret > 0) /* Gennady: check return value */ + xmlBufAddLen(out, c_out); + } +#ifdef LIBXML_ICONV_ENABLED + else if (output->encoder->iconv_out != NULL) { + ret = xmlIconvWrapper(output->encoder->iconv_out, xmlBufEnd(out), + &c_out, NULL, &c_in); + xmlBufAddLen(out, c_out); + } +#endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + else if (output->encoder->uconv_out != NULL) { + ret = xmlUconvWrapper(output->encoder->uconv_out, 0, xmlBufEnd(out), + &c_out, NULL, &c_in); + xmlBufAddLen(out, c_out); + } +#endif /* LIBXML_ICU_ENABLED */ +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "initialized encoder\n"); +#endif + return(0); + } + + /* + * Conversion itself. + */ + toconv = xmlBufUse(in); + if (toconv == 0) + return (0); + if (toconv > 64 * 1024) + toconv = 64 * 1024; + if (toconv * 4 >= written) { + xmlBufGrow(out, toconv * 4); + written = xmlBufAvail(out) - 1; + } + if (written > 256 * 1024) + written = 256 * 1024; + + c_in = toconv; + c_out = written; + if (output->encoder->output != NULL) { + ret = output->encoder->output(xmlBufEnd(out), &c_out, + xmlBufContent(in), &c_in); + if (c_out > 0) { + xmlBufShrink(in, c_in); + xmlBufAddLen(out, c_out); + writtentot += c_out; + } + } +#ifdef LIBXML_ICONV_ENABLED + else if (output->encoder->iconv_out != NULL) { + ret = xmlIconvWrapper(output->encoder->iconv_out, xmlBufEnd(out), + &c_out, xmlBufContent(in), &c_in); + xmlBufShrink(in, c_in); + xmlBufAddLen(out, c_out); + writtentot += c_out; + if (ret == -1) { + if (c_out > 0) { + /* + * Can be a limitation of iconv + */ + charref_len = 0; + goto retry; + } + ret = -3; + } + } +#endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + else if (output->encoder->uconv_out != NULL) { + ret = xmlUconvWrapper(output->encoder->uconv_out, 0, xmlBufEnd(out), + &c_out, xmlBufContent(in), &c_in); + xmlBufShrink(in, c_in); + xmlBufAddLen(out, c_out); + writtentot += c_out; + if (ret == -1) { + if (c_out > 0) { + /* + * Can be a limitation of uconv + */ + charref_len = 0; + goto retry; + } + ret = -3; + } + } +#endif /* LIBXML_ICU_ENABLED */ + else { + xmlEncodingErr(XML_I18N_NO_OUTPUT, + "xmlCharEncOutFunc: no output function !\n", NULL); + return(-1); + } + + if (ret >= 0) output += ret; + + /* + * Attempt to handle error cases + */ + switch (ret) { + case 0: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "converted %d bytes to %d bytes of output\n", + c_in, c_out); +#endif + break; + case -1: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "output conversion failed by lack of space\n"); +#endif + break; + case -3: +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext,"converted %d bytes to %d bytes of output %d left\n", + c_in, c_out, (int) xmlBufUse(in)); +#endif + break; + case -2: { + int len = (int) xmlBufUse(in); + xmlChar *content = xmlBufContent(in); + int cur; + + cur = xmlGetUTF8Char(content, &len); + if ((charref_len != 0) && (c_out < charref_len)) { + /* + * We attempted to insert a character reference and failed. + * Undo what was written and skip the remaining charref. + */ + xmlBufErase(out, c_out); + writtentot -= c_out; + xmlBufShrink(in, charref_len - c_out); + charref_len = 0; + + ret = -1; + break; + } else if (cur > 0) { + xmlChar charref[20]; + +#ifdef DEBUG_ENCODING + xmlGenericError(xmlGenericErrorContext, + "handling output conversion error\n"); + xmlGenericError(xmlGenericErrorContext, + "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", + content[0], content[1], + content[2], content[3]); +#endif + /* + * Removes the UTF8 sequence, and replace it by a charref + * and continue the transcoding phase, hoping the error + * did not mangle the encoder state. + */ + charref_len = snprintf((char *) &charref[0], sizeof(charref), + "&#%d;", cur); + xmlBufShrink(in, len); + xmlBufAddHead(in, charref, -1); + + goto retry; + } else { + char buf[50]; + + snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X", + content[0], content[1], + content[2], content[3]); + buf[49] = 0; + xmlEncodingErr(XML_I18N_CONV_FAILED, + "output conversion failed due to conv error, bytes %s\n", + buf); + if (xmlBufGetAllocationScheme(in) != XML_BUFFER_ALLOC_IMMUTABLE) + content[0] = ' '; + } + break; + } + } + return(ret); +} +#endif + /** * xmlCharEncOutFunc: * @handler: char enconding transformation data structure * @out: an xmlBuffer for the output. * @in: an xmlBuffer for the input - * + * * Generic front-end for the encoding handler output function - * a first call with @in == NULL has to be made firs to initiate the + * a first call with @in == NULL has to be made firs to initiate the * output in case of non-stateless encoding needing to initiate their * state or the output (like the BOM in UTF16). * In case of UTF8 sequence conversion errors for the given encoder, * the content will be automatically remapped to a CharRef sequence. - * - * Returns the number of byte written if success, or + * + * Returns the number of byte written if success, or * -1 general error * -2 if the transcoding fails (for *in is not valid utf8 string or * the result of transformation can't fit into the encoding we want), or @@ -1945,12 +2641,13 @@ xmlCharEncOutFunc(xmlCharEncodingHandler *handler, xmlBufferPtr out, int writtentot = 0; int toconv; int output = 0; + int charref_len = 0; if (handler == NULL) return(-1); if (out == NULL) return(-1); retry: - + written = out->size - out->use; if (written > 0) @@ -1977,6 +2674,15 @@ retry: out->content[out->use] = 0; } #endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + else if (handler->uconv_out != NULL) { + ret = xmlUconvWrapper(handler->uconv_out, 0, + &out->content[out->use], + &written, NULL, &toconv); + out->use += written; + out->content[out->use] = 0; + } +#endif /* LIBXML_ICU_ENABLED */ #ifdef DEBUG_ENCODING xmlGenericError(xmlGenericErrorContext, "initialized encoder\n"); @@ -1990,16 +2696,18 @@ retry: toconv = in->use; if (toconv == 0) return(0); - if (toconv * 2 >= written) { - xmlBufferGrow(out, toconv * 2); + if (toconv * 4 >= written) { + xmlBufferGrow(out, toconv * 4); written = out->size - out->use - 1; } if (handler->output != NULL) { ret = handler->output(&out->content[out->use], &written, in->content, &toconv); - xmlBufferShrink(in, toconv); - out->use += written; - writtentot += written; + if (written > 0) { + xmlBufferShrink(in, toconv); + out->use += written; + writtentot += written; + } out->content[out->use] = 0; } #ifdef LIBXML_ICONV_ENABLED @@ -2015,12 +2723,34 @@ retry: /* * Can be a limitation of iconv */ + charref_len = 0; goto retry; } ret = -3; } } #endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + else if (handler->uconv_out != NULL) { + ret = xmlUconvWrapper(handler->uconv_out, 0, + &out->content[out->use], + &written, in->content, &toconv); + xmlBufferShrink(in, toconv); + out->use += written; + writtentot += written; + out->content[out->use] = 0; + if (ret == -1) { + if (written > 0) { + /* + * Can be a limitation of iconv + */ + charref_len = 0; + goto retry; + } + ret = -3; + } + } +#endif /* LIBXML_ICU_ENABLED */ else { xmlEncodingErr(XML_I18N_NO_OUTPUT, "xmlCharEncOutFunc: no output function !\n", NULL); @@ -2058,7 +2788,19 @@ retry: int cur; cur = xmlGetUTF8Char(utf, &len); - if (cur > 0) { + if ((charref_len != 0) && (written < charref_len)) { + /* + * We attempted to insert a character reference and failed. + * Undo what was written and skip the remaining charref. + */ + out->use -= written; + writtentot -= written; + xmlBufferShrink(in, charref_len - written); + charref_len = 0; + + ret = -1; + break; + } else if (cur > 0) { xmlChar charref[20]; #ifdef DEBUG_ENCODING @@ -2074,7 +2816,8 @@ retry: * and continue the transcoding phase, hoping the error * did not mangle the encoder state. */ - snprintf((char *) &charref[0], sizeof(charref), "&#%d;", cur); + charref_len = snprintf((char *) &charref[0], sizeof(charref), + "&#%d;", cur); xmlBufferShrink(in, len); xmlBufferAddHead(in, charref, -1); @@ -2082,7 +2825,7 @@ retry: } else { char buf[50]; - snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X", + snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X", in->content[0], in->content[1], in->content[2], in->content[3]); buf[49] = 0; @@ -2101,7 +2844,7 @@ retry: /** * xmlCharEncCloseFunc: * @handler: char enconding transformation data structure - * + * * Generic front-end for encoding handler close function * * Returns 0 if success, or -1 in case of error @@ -2109,17 +2852,27 @@ retry: int xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) { int ret = 0; + int tofree = 0; + int i, handler_in_list = 0; + if (handler == NULL) return(-1); if (handler->name == NULL) return(-1); + if (handlers != NULL) { + for (i = 0;i < nbCharEncodingHandler; i++) { + if (handler == handlers[i]) { + handler_in_list = 1; + break; + } + } + } #ifdef LIBXML_ICONV_ENABLED /* * Iconv handlers can be used only once, free the whole block. * and the associated icon resources. */ - if ((handler->iconv_out != NULL) || (handler->iconv_in != NULL)) { - if (handler->name != NULL) - xmlFree(handler->name); - handler->name = NULL; + if ((handler_in_list == 0) && + ((handler->iconv_out != NULL) || (handler->iconv_in != NULL))) { + tofree = 1; if (handler->iconv_out != NULL) { if (iconv_close(handler->iconv_out)) ret = -1; @@ -2130,9 +2883,29 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) { ret = -1; handler->iconv_in = NULL; } - xmlFree(handler); } #endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + if ((handler_in_list == 0) && + ((handler->uconv_out != NULL) || (handler->uconv_in != NULL))) { + tofree = 1; + if (handler->uconv_out != NULL) { + closeIcuConverter(handler->uconv_out); + handler->uconv_out = NULL; + } + if (handler->uconv_in != NULL) { + closeIcuConverter(handler->uconv_in); + handler->uconv_in = NULL; + } + } +#endif + if (tofree) { + /* free up only dynamic handlers iconv/uconv */ + if (handler->name != NULL) + xmlFree(handler->name); + handler->name = NULL; + xmlFree(handler); + } #ifdef DEBUG_ENCODING if (ret) xmlGenericError(xmlGenericErrorContext, @@ -2162,7 +2935,7 @@ xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) { long xmlByteConsumed(xmlParserCtxtPtr ctxt) { xmlParserInputPtr in; - + if (ctxt == NULL) return(-1); in = ctxt->input; if (in == NULL) return(-1); @@ -2207,6 +2980,23 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) { unused += written; cur += toconv; } while (ret == -2); +#endif +#ifdef LIBXML_ICU_ENABLED + } else if (handler->uconv_out != NULL) { + do { + toconv = in->end - cur; + written = 32000; + ret = xmlUconvWrapper(handler->uconv_out, 0, &convbuf[0], + &written, cur, &toconv); + if (ret < 0) { + if (written > 0) + ret = -2; + else + return(-1); + } + unused += written; + cur += toconv; + } while (ret == -2); #endif } else { /* could not find a converter */ @@ -2220,7 +3010,7 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) { return(in->consumed + (in->cur - in->base)); } -#ifndef LIBXML_ICONV_ENABLED +#if !defined(LIBXML_ICONV_ENABLED) && !defined(LIBXML_ICU_ENABLED) #ifdef LIBXML_ISO8859X_ENABLED /** @@ -2246,6 +3036,7 @@ UTF8ToISO8859x(unsigned char* out, int *outlen, const unsigned char* outstart = out; const unsigned char* inend; const unsigned char* instart = in; + const unsigned char* processed = in; if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || (xlattable == NULL)) @@ -2262,81 +3053,82 @@ UTF8ToISO8859x(unsigned char* out, int *outlen, while (in < inend) { unsigned char d = *in++; if (d < 0x80) { - *out++ = d; + *out++ = d; } else if (d < 0xC0) { /* trailing byte in leading position */ *outlen = out - outstart; - *inlen = in - instart - 1; + *inlen = processed - instart; return(-2); } else if (d < 0xE0) { unsigned char c; if (!(in < inend)) { /* trailing byte not in input buffer */ *outlen = out - outstart; - *inlen = in - instart - 1; - return(-2); + *inlen = processed - instart; + return(-3); } c = *in++; if ((c & 0xC0) != 0x80) { /* not a trailing byte */ *outlen = out - outstart; - *inlen = in - instart - 2; + *inlen = processed - instart; return(-2); } - c = c & 0x3F; + c = c & 0x3F; d = d & 0x1F; d = xlattable [48 + c + xlattable [d] * 64]; if (d == 0) { /* not in character set */ *outlen = out - outstart; - *inlen = in - instart - 2; + *inlen = processed - instart; return(-2); } - *out++ = d; + *out++ = d; } else if (d < 0xF0) { unsigned char c1; unsigned char c2; if (!(in < inend - 1)) { /* trailing bytes not in input buffer */ *outlen = out - outstart; - *inlen = in - instart - 1; - return(-2); + *inlen = processed - instart; + return(-3); } c1 = *in++; if ((c1 & 0xC0) != 0x80) { /* not a trailing byte (c1) */ *outlen = out - outstart; - *inlen = in - instart - 2; + *inlen = processed - instart; return(-2); } c2 = *in++; if ((c2 & 0xC0) != 0x80) { /* not a trailing byte (c2) */ *outlen = out - outstart; - *inlen = in - instart - 2; + *inlen = processed - instart; return(-2); } - c1 = c1 & 0x3F; - c2 = c2 & 0x3F; + c1 = c1 & 0x3F; + c2 = c2 & 0x3F; d = d & 0x0F; - d = xlattable [48 + c2 + xlattable [48 + c1 + - xlattable [32 + d] * 64] * 64]; + d = xlattable [48 + c2 + xlattable [48 + c1 + + xlattable [32 + d] * 64] * 64]; if (d == 0) { /* not in character set */ *outlen = out - outstart; - *inlen = in - instart - 3; + *inlen = processed - instart; return(-2); } - *out++ = d; + *out++ = d; } else { /* cannot transcode >= U+010000 */ *outlen = out - outstart; - *inlen = in - instart - 1; + *inlen = processed - instart; return(-2); } + processed = in; } *outlen = out - outstart; - *inlen = in - instart; + *inlen = processed - instart; return(*outlen); } @@ -2370,16 +3162,16 @@ ISO8859xToUTF8(unsigned char* out, int *outlen, outend = out + *outlen; inend = in + *inlen; instop = inend; - c = *in; - while (in < inend && out < outend - 1) { - if (c >= 0x80) { - c = unicodetable [c - 0x80]; + + while ((in < inend) && (out < outend - 2)) { + if (*in >= 0x80) { + c = unicodetable [*in - 0x80]; if (c == 0) { /* undefined code point */ *outlen = out - outstart; *inlen = in - instart; return (-1); - } + } if (c < 0x800) { *out++ = ((c >> 6) & 0x1F) | 0xC0; *out++ = (c & 0x3F) | 0x80; @@ -2387,48 +3179,47 @@ ISO8859xToUTF8(unsigned char* out, int *outlen, *out++ = ((c >> 12) & 0x0F) | 0xE0; *out++ = ((c >> 6) & 0x3F) | 0x80; *out++ = (c & 0x3F) | 0x80; - } + } ++in; - c = *in; } - if (instop - in > outend - out) instop = in + (outend - out); - while (c < 0x80 && in < instop) { - *out++ = c; - ++in; - c = *in; + if (instop - in > outend - out) instop = in + (outend - out); + while ((*in < 0x80) && (in < instop)) { + *out++ = *in++; } - } - if (in < inend && out < outend && c < 0x80) { - *out++ = c; - ++in; + } + if ((in < inend) && (out < outend) && (*in < 0x80)) { + *out++ = *in++; + } + if ((in < inend) && (out < outend) && (*in < 0x80)) { + *out++ = *in++; } *outlen = out - outstart; *inlen = in - instart; return (*outlen); } - + /************************************************************************ * Lookup tables for ISO-8859-2..ISO-8859-16 transcoding * ************************************************************************/ static unsigned short const xmlunicodetable_ISO8859_2 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, - 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, - 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, - 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, - 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, - 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, - 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, - 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, - 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, - 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, - 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, - 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, + 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, + 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, + 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, + 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, + 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, + 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, + 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, + 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, + 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, }; static unsigned char const xmltranscodetable_ISO8859_2 [48 + 6 * 64] = { @@ -2462,22 +3253,22 @@ static unsigned char const xmltranscodetable_ISO8859_2 [48 + 6 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_3 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7, - 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b, - 0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7, - 0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0x0000, 0x017c, - 0x00c0, 0x00c1, 0x00c2, 0x0000, 0x00c4, 0x010a, 0x0108, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x0000, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7, - 0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x0000, 0x00e4, 0x010b, 0x0109, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, - 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7, + 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b, + 0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7, + 0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0x0000, 0x017c, + 0x00c0, 0x00c1, 0x00c2, 0x0000, 0x00c4, 0x010a, 0x0108, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x0000, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7, + 0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x0000, 0x00e4, 0x010b, 0x0109, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, + 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9, }; static unsigned char const xmltranscodetable_ISO8859_3 [48 + 7 * 64] = { @@ -2515,22 +3306,22 @@ static unsigned char const xmltranscodetable_ISO8859_3 [48 + 7 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_4 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7, - 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, - 0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, - 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b, - 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, - 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a, - 0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, - 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df, - 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, - 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b, - 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, - 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7, + 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, + 0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, + 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b, + 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a, + 0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, + 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df, + 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b, + 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, + 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9, }; static unsigned char const xmltranscodetable_ISO8859_4 [48 + 6 * 64] = { @@ -2564,22 +3355,22 @@ static unsigned char const xmltranscodetable_ISO8859_4 [48 + 6 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_5 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, - 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, + 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, }; static unsigned char const xmltranscodetable_ISO8859_5 [48 + 6 * 64] = { @@ -2613,22 +3404,22 @@ static unsigned char const xmltranscodetable_ISO8859_5 [48 + 6 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_6 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, - 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, - 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, - 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, - 0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, + 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, + 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, + 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, + 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, + 0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; static unsigned char const xmltranscodetable_ISO8859_6 [48 + 5 * 64] = { @@ -2658,22 +3449,22 @@ static unsigned char const xmltranscodetable_ISO8859_6 [48 + 5 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_7 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x2018, 0x2019, 0x00a3, 0x0000, 0x0000, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x0000, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7, - 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, - 0x03a0, 0x03a1, 0x0000, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, - 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, - 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, - 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, - 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x2018, 0x2019, 0x00a3, 0x0000, 0x0000, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x0000, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7, + 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, + 0x03a0, 0x03a1, 0x0000, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, + 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, + 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, + 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, + 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000, }; static unsigned char const xmltranscodetable_ISO8859_7 [48 + 7 * 64] = { @@ -2711,22 +3502,22 @@ static unsigned char const xmltranscodetable_ISO8859_7 [48 + 7 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_8 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017, - 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, - 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, - 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, - 0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017, + 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, + 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, + 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, + 0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000, }; static unsigned char const xmltranscodetable_ISO8859_8 [48 + 7 * 64] = { @@ -2764,22 +3555,22 @@ static unsigned char const xmltranscodetable_ISO8859_8 [48 + 7 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_9 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, - 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, - 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, - 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, }; static unsigned char const xmltranscodetable_ISO8859_9 [48 + 5 * 64] = { @@ -2809,22 +3600,22 @@ static unsigned char const xmltranscodetable_ISO8859_9 [48 + 5 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_10 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7, - 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a, - 0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7, - 0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b, - 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, - 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf, - 0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168, - 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, - 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, - 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef, - 0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, - 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7, + 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a, + 0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7, + 0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b, + 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf, + 0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168, + 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, + 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef, + 0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, + 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138, }; static unsigned char const xmltranscodetable_ISO8859_10 [48 + 7 * 64] = { @@ -2862,22 +3653,22 @@ static unsigned char const xmltranscodetable_ISO8859_10 [48 + 7 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_11 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, - 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, - 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, - 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, - 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, - 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, - 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, - 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0e3f, - 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, - 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, - 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, + 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, + 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, + 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, + 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, + 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, + 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, + 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0e3f, + 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, + 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, + 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000, }; static unsigned char const xmltranscodetable_ISO8859_11 [48 + 6 * 64] = { @@ -2911,22 +3702,22 @@ static unsigned char const xmltranscodetable_ISO8859_11 [48 + 6 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_13 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7, - 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7, - 0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6, - 0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112, - 0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b, - 0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7, - 0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df, - 0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113, - 0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c, - 0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, - 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7, + 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7, + 0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6, + 0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112, + 0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b, + 0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7, + 0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df, + 0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113, + 0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c, + 0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, + 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019, }; static unsigned char const xmltranscodetable_ISO8859_13 [48 + 7 * 64] = { @@ -2964,22 +3755,22 @@ static unsigned char const xmltranscodetable_ISO8859_13 [48 + 7 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_14 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7, - 0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178, - 0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56, - 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, - 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a, - 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b, - 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7, + 0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178, + 0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56, + 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff, }; static unsigned char const xmltranscodetable_ISO8859_14 [48 + 10 * 64] = { @@ -3029,22 +3820,22 @@ static unsigned char const xmltranscodetable_ISO8859_14 [48 + 10 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_15 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, - 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7, - 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf, - 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, - 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, - 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, + 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7, + 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf, + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff, }; static unsigned char const xmltranscodetable_ISO8859_15 [48 + 6 * 64] = { @@ -3078,22 +3869,22 @@ static unsigned char const xmltranscodetable_ISO8859_15 [48 + 6 * 64] = { }; static unsigned short const xmlunicodetable_ISO8859_16 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7, - 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b, - 0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7, - 0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c, - 0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x0110, 0x0143, 0x00d2, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x015a, - 0x0170, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0118, 0x021a, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b, - 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7, + 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b, + 0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7, + 0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c, + 0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + 0x0110, 0x0143, 0x00d2, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x015a, + 0x0170, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0118, 0x021a, 0x00df, + 0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + 0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b, + 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff, }; static unsigned char const xmltranscodetable_ISO8859_16 [48 + 9 * 64] = { @@ -3292,4 +4083,3 @@ xmlRegisterCharEncodingHandlersISO8859x (void) { #define bottom_encoding #include "elfgcchack.h" - diff --git a/gnulib-local/lib/libxml/encoding.in.h b/gnulib-local/lib/libxml/encoding.in.h index c74b25f..7967cc6 100644 --- a/gnulib-local/lib/libxml/encoding.in.h +++ b/gnulib-local/lib/libxml/encoding.in.h @@ -27,6 +27,9 @@ #ifdef LIBXML_ICONV_ENABLED #include #endif +#ifdef LIBXML_ICU_ENABLED +#include +#endif #ifdef __cplusplus extern "C" { #endif @@ -125,6 +128,13 @@ typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, * Block defining the handlers for non UTF-8 encodings. * 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 xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; @@ -136,6 +146,10 @@ struct _xmlCharEncodingHandler { iconv_t iconv_in; iconv_t iconv_out; #endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + uconv_t *uconv_in; + uconv_t *uconv_out; +#endif /* LIBXML_ICU_ENABLED */ }; #ifdef __cplusplus @@ -149,32 +163,32 @@ extern "C" { /* * Interfaces for encoding handlers. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlInitCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlGetCharEncodingHandler (xmlCharEncoding enc); XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL xmlFindCharEncodingHandler (const char *name); XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlNewCharEncodingHandler (const char *name, - xmlCharEncodingInputFunc input, - xmlCharEncodingOutputFunc output); + xmlNewCharEncodingHandler (const char *name, + xmlCharEncodingInputFunc input, + xmlCharEncodingOutputFunc output); /* * Interfaces for encoding names and aliases. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlAddEncodingAlias (const char *name, const char *alias); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlDelEncodingAlias (const char *alias); XMLPUBFUN const char * XMLCALL xmlGetEncodingAlias (const char *alias); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupEncodingAliases (void); XMLPUBFUN xmlCharEncoding XMLCALL xmlParseCharEncoding (const char *name); @@ -188,12 +202,12 @@ XMLPUBFUN xmlCharEncoding XMLCALL xmlDetectCharEncoding (const unsigned char *in, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCharEncOutFunc (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCharEncInFunc (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in); @@ -201,20 +215,20 @@ XMLPUBFUN int XMLCALL xmlCharEncFirstLine (xmlCharEncodingHandler *handler, xmlBufferPtr out, xmlBufferPtr in); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); /* * Export a few useful functions */ #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL UTF8Toisolat1 (unsigned char *out, int *outlen, const unsigned char *in, int *inlen); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL isolat1ToUTF8 (unsigned char *out, int *outlen, const unsigned char *in, diff --git a/gnulib-local/lib/libxml/entities.c b/gnulib-local/lib/libxml/entities.c index 91a3978..a72afb3 100644 --- a/gnulib-local/lib/libxml/entities.c +++ b/gnulib-local/lib/libxml/entities.c @@ -22,41 +22,43 @@ #include #include +#include "save.h" + /* * The XML predefined entities. */ static xmlEntity xmlEntityLt = { NULL, XML_ENTITY_DECL, BAD_CAST "lt", - NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "<", BAD_CAST "<", 1, XML_INTERNAL_PREDEFINED_ENTITY, NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityGt = { NULL, XML_ENTITY_DECL, BAD_CAST "gt", - NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST ">", BAD_CAST ">", 1, XML_INTERNAL_PREDEFINED_ENTITY, NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityAmp = { NULL, XML_ENTITY_DECL, BAD_CAST "amp", - NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "&", BAD_CAST "&", 1, XML_INTERNAL_PREDEFINED_ENTITY, NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityQuot = { NULL, XML_ENTITY_DECL, BAD_CAST "quot", - NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "\"", BAD_CAST "\"", 1, XML_INTERNAL_PREDEFINED_ENTITY, NULL, NULL, NULL, NULL, 0, 1 }; static xmlEntity xmlEntityApos = { NULL, XML_ENTITY_DECL, BAD_CAST "apos", - NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, BAD_CAST "'", BAD_CAST "'", 1, XML_INTERNAL_PREDEFINED_ENTITY, NULL, NULL, NULL, NULL, 0, 1 @@ -139,45 +141,19 @@ xmlFreeEntity(xmlEntityPtr entity) } /* - * xmlAddEntity : register a new entity for an entities table. + * xmlCreateEntity: + * + * internal routine doing the entity node strutures allocations */ static xmlEntityPtr -xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, - const xmlChar *ExternalID, const xmlChar *SystemID, - const xmlChar *content) { - xmlDictPtr dict = NULL; - xmlEntitiesTablePtr table = NULL; +xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type, + const xmlChar *ExternalID, const xmlChar *SystemID, + const xmlChar *content) { xmlEntityPtr ret; - if (name == NULL) - return(NULL); - if (dtd == NULL) - return(NULL); - if (dtd->doc != NULL) - dict = dtd->doc->dict; - - switch (type) { - case XML_INTERNAL_GENERAL_ENTITY: - case XML_EXTERNAL_GENERAL_PARSED_ENTITY: - case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY: - if (dtd->entities == NULL) - dtd->entities = xmlHashCreateDict(0, dict); - table = dtd->entities; - break; - case XML_INTERNAL_PARAMETER_ENTITY: - case XML_EXTERNAL_PARAMETER_ENTITY: - if (dtd->pentities == NULL) - dtd->pentities = xmlHashCreateDict(0, dict); - table = dtd->pentities; - break; - case XML_INTERNAL_PREDEFINED_ENTITY: - return(NULL); - } - if (table == NULL) - return(NULL); ret = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity)); if (ret == NULL) { - xmlEntitiesErrMemory("xmlAddEntity:: malloc failed"); + xmlEntitiesErrMemory("xmlCreateEntity: malloc failed"); return(NULL); } memset(ret, 0, sizeof(xmlEntity)); @@ -216,6 +192,50 @@ xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, the defining entity */ ret->orig = NULL; ret->owner = 0; + + return(ret); +} + +/* + * xmlAddEntity : register a new entity for an entities table. + */ +static xmlEntityPtr +xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, + const xmlChar *ExternalID, const xmlChar *SystemID, + const xmlChar *content) { + xmlDictPtr dict = NULL; + xmlEntitiesTablePtr table = NULL; + xmlEntityPtr ret; + + if (name == NULL) + return(NULL); + if (dtd == NULL) + return(NULL); + if (dtd->doc != NULL) + dict = dtd->doc->dict; + + switch (type) { + case XML_INTERNAL_GENERAL_ENTITY: + case XML_EXTERNAL_GENERAL_PARSED_ENTITY: + case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY: + if (dtd->entities == NULL) + dtd->entities = xmlHashCreateDict(0, dict); + table = dtd->entities; + break; + case XML_INTERNAL_PARAMETER_ENTITY: + case XML_EXTERNAL_PARAMETER_ENTITY: + if (dtd->pentities == NULL) + dtd->pentities = xmlHashCreateDict(0, dict); + table = dtd->pentities; + break; + case XML_INTERNAL_PREDEFINED_ENTITY: + return(NULL); + } + if (table == NULL) + return(NULL); + ret = xmlCreateEntity(dict, name, type, ExternalID, SystemID, content); + if (ret == NULL) + return(NULL); ret->doc = dtd->doc; if (xmlHashAddEntry(table, name, ret)) { @@ -362,6 +382,44 @@ xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type, return(ret); } +/** + * xmlNewEntity: + * @doc: the document + * @name: the entity name + * @type: the entity type XML_xxx_yyy_ENTITY + * @ExternalID: the entity external ID if available + * @SystemID: the entity system ID if available + * @content: the entity content + * + * Create a new entity, this differs from xmlAddDocEntity() that if + * the document is NULL or has no internal subset defined, then an + * unlinked entity structure will be returned, it is then the responsability + * of the caller to link it to the document later or free it when not needed + * anymore. + * + * Returns a pointer to the entity or NULL in case of error + */ +xmlEntityPtr +xmlNewEntity(xmlDocPtr doc, const xmlChar *name, int type, + const xmlChar *ExternalID, const xmlChar *SystemID, + const xmlChar *content) { + xmlEntityPtr ret; + xmlDictPtr dict; + + if ((doc != NULL) && (doc->intSubset != NULL)) { + return(xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content)); + } + if (doc != NULL) + dict = doc->dict; + else + dict = NULL; + ret = xmlCreateEntity(dict, name, type, ExternalID, SystemID, content); + if (ret == NULL) + return(NULL); + ret->doc = doc; + return(ret); +} + /** * xmlGetEntityFromTable: * @table: an entity table @@ -370,7 +428,7 @@ xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type, * * Do an entity lookup in the table. * returns the corresponding parameter entity, if found. - * + * * Returns A pointer to the entity structure or NULL if not found. */ static xmlEntityPtr @@ -385,7 +443,7 @@ xmlGetEntityFromTable(xmlEntitiesTablePtr table, const xmlChar *name) { * * Do an entity lookup in the internal and external subsets and * returns the corresponding parameter entity, if found. - * + * * Returns A pointer to the entity structure or NULL if not found. */ xmlEntityPtr @@ -416,7 +474,7 @@ xmlGetParameterEntity(xmlDocPtr doc, const xmlChar *name) { * Do an entity lookup in the DTD entity hash table and * returns the corresponding entity, if found. * Note: the first argument is the document node, not the DTD node. - * + * * Returns A pointer to the entity structure or NULL if not found. */ xmlEntityPtr @@ -440,11 +498,11 @@ xmlGetDtdEntity(xmlDocPtr doc, const xmlChar *name) { * Do an entity lookup in the document entity hash table and * returns the corresponding entity, otherwise a lookup is done * in the predefined entities too. - * + * * Returns A pointer to the entity structure or NULL if not found. */ xmlEntityPtr -xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) { +xmlGetDocEntity(const xmlDoc *doc, const xmlChar *name) { xmlEntityPtr cur; xmlEntitiesTablePtr table; @@ -472,20 +530,20 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) { * Macro used to grow the current buffer. */ #define growBufferReentrant() { \ - buffer_size *= 2; \ - buffer = (xmlChar *) \ - xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \ - if (buffer == NULL) { \ - xmlEntitiesErrMemory("xmlEncodeEntitiesReentrant: realloc failed");\ - return(NULL); \ - } \ + xmlChar *tmp; \ + size_t new_size = buffer_size * 2; \ + if (new_size < buffer_size) goto mem_error; \ + tmp = (xmlChar *) xmlRealloc(buffer, new_size); \ + if (tmp == NULL) goto mem_error; \ + buffer = tmp; \ + buffer_size = new_size; \ } - /** - * xmlEncodeEntitiesReentrant: + * xmlEncodeEntitiesInternal: * @doc: the document containing the string * @input: A string to convert to XML. + * @attr: are we handling an atrbute value * * Do a global encoding of a string, replacing the predefined entities * and non ASCII values with their entities and CharRef counterparts. @@ -494,12 +552,12 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) { * * Returns A newly allocated string with the substitution done. */ -xmlChar * -xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { +static xmlChar * +xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) { const xmlChar *cur = input; xmlChar *buffer = NULL; xmlChar *out = NULL; - int buffer_size = 0; + size_t buffer_size = 0; int html = 0; if (input == NULL) return(NULL); @@ -512,14 +570,14 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { buffer_size = 1000; buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); if (buffer == NULL) { - xmlEntitiesErrMemory("xmlEncodeEntitiesReentrant: malloc failed"); + xmlEntitiesErrMemory("xmlEncodeEntities: malloc failed"); return(NULL); } out = buffer; while (*cur != '\0') { - if (out - buffer > buffer_size - 100) { - int indx = out - buffer; + size_t indx = out - buffer; + if (indx + 100 > buffer_size) { growBufferReentrant(); out = &buffer[indx]; @@ -529,6 +587,27 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { * By default one have to encode at least '<', '>', '"' and '&' ! */ if (*cur == '<') { + const xmlChar *end; + + /* + * Special handling of server side include in HTML attributes + */ + if (html && attr && + (cur[1] == '!') && (cur[2] == '-') && (cur[3] == '-') && + ((end = xmlStrstr(cur, BAD_CAST "-->")) != NULL)) { + while (cur != end) { + *out++ = *cur++; + indx = out - buffer; + if (indx + 100 > buffer_size) { + growBufferReentrant(); + out = &buffer[indx]; + } + } + *out++ = *cur++; + *out++ = *cur++; + *out++ = *cur++; + continue; + } *out++ = '&'; *out++ = 'l'; *out++ = 't'; @@ -539,6 +618,23 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { *out++ = 't'; *out++ = ';'; } else if (*cur == '&') { + /* + * Special handling of &{...} construct from HTML 4, see + * http://www.w3.org/TR/html401/appendix/notes.html#h-B.7.1 + */ + if (html && attr && (cur[1] == '{') && + (strchr((const char *) cur, '}'))) { + while (*cur != '}') { + *out++ = *cur++; + indx = out - buffer; + if (indx + 100 > buffer_size) { + growBufferReentrant(); + out = &buffer[indx]; + } + } + *out++ = *cur++; + continue; + } *out++ = '&'; *out++ = 'a'; *out++ = 'm'; @@ -553,7 +649,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { } else if (*cur >= 0x80) { if (((doc != NULL) && (doc->encoding != NULL)) || (html)) { /* - * Bjørn Reese provided the patch + * Bjørn Reese provided the patch xmlChar xc; xc = (*cur & 0x3F) << 6; if (cur[1] != 0) { @@ -571,7 +667,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { if (*cur < 0xC0) { xmlEntitiesErr(XML_CHECK_NOT_UTF8, - "xmlEncodeEntitiesReentrant : input not UTF-8"); + "xmlEncodeEntities: input not UTF-8"); if (doc != NULL) doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); snprintf(buf, sizeof(buf), "&#%d;", *cur); @@ -604,7 +700,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { } if ((l == 1) || (!IS_CHAR(val))) { xmlEntitiesErr(XML_ERR_INVALID_CHAR, - "xmlEncodeEntitiesReentrant : char out of range\n"); + "xmlEncodeEntities: char out of range\n"); if (doc != NULL) doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); snprintf(buf, sizeof(buf), "&#%d;", *cur); @@ -634,8 +730,46 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { } cur++; } - *out++ = 0; + *out = 0; return(buffer); + +mem_error: + xmlEntitiesErrMemory("xmlEncodeEntities: realloc failed"); + xmlFree(buffer); + return(NULL); +} + +/** + * xmlEncodeAttributeEntities: + * @doc: the document containing the string + * @input: A string to convert to XML. + * + * Do a global encoding of a string, replacing the predefined entities + * and non ASCII values with their entities and CharRef counterparts for + * attribute values. + * + * Returns A newly allocated string with the substitution done. + */ +xmlChar * +xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input) { + return xmlEncodeEntitiesInternal(doc, input, 1); +} + +/** + * xmlEncodeEntitiesReentrant: + * @doc: the document containing the string + * @input: A string to convert to XML. + * + * Do a global encoding of a string, replacing the predefined entities + * and non ASCII values with their entities and CharRef counterparts. + * Contrary to xmlEncodeEntities, this routine is reentrant, and result + * must be deallocated. + * + * Returns A newly allocated string with the substitution done. + */ +xmlChar * +xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { + return xmlEncodeEntitiesInternal(doc, input, 0); } /** @@ -649,11 +783,11 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { * Returns A newly allocated string with the substitution done. */ xmlChar * -xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) { +xmlEncodeSpecialChars(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlChar *input) { const xmlChar *cur = input; xmlChar *buffer = NULL; xmlChar *out = NULL; - int buffer_size = 0; + size_t buffer_size = 0; if (input == NULL) return(NULL); /* @@ -668,8 +802,8 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) { out = buffer; while (*cur != '\0') { - if (out - buffer > buffer_size - 10) { - int indx = out - buffer; + size_t indx = out - buffer; + if (indx + 10 > buffer_size) { growBufferReentrant(); out = &buffer[indx]; @@ -716,8 +850,13 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) { } cur++; } - *out++ = 0; + *out = 0; return(buffer); + +mem_error: + xmlEntitiesErrMemory("xmlEncodeSpecialChars: realloc failed"); + xmlFree(buffer); + return(NULL); } /** @@ -764,7 +903,7 @@ xmlFreeEntitiesTable(xmlEntitiesTablePtr table) { * @ent: An entity * * Build a copy of an entity - * + * * Returns the new xmlEntitiesPtr or NULL in case of error. */ static xmlEntityPtr @@ -800,7 +939,7 @@ xmlCopyEntity(xmlEntityPtr ent) { * @table: An entity table * * Build a copy of an entity table. - * + * * Returns the new xmlEntitiesTablePtr or NULL in case of error. */ xmlEntitiesTablePtr @@ -949,7 +1088,7 @@ static void xmlDumpEntityDeclScan(xmlEntityPtr ent, xmlBufferPtr buf) { xmlDumpEntityDecl(buf, ent); } - + /** * xmlDumpEntitiesTable: * @buf: An XML buffer. diff --git a/gnulib-local/lib/libxml/entities.in.h b/gnulib-local/lib/libxml/entities.in.h index fdd7222..47b4573 100644 --- a/gnulib-local/lib/libxml/entities.in.h +++ b/gnulib-local/lib/libxml/entities.in.h @@ -57,6 +57,9 @@ struct _xmlEntity { const xmlChar *URI; /* the full URI as computed */ int owner; /* does the entity own the childrens */ int checked; /* was the entity content checked */ + /* this is also used to count entities + * references done from that entity + * and if it contains '<' */ }; /* @@ -72,9 +75,17 @@ typedef xmlEntitiesTable *xmlEntitiesTablePtr; */ #ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlInitializePredefinedEntities (void); #endif /* LIBXML_LEGACY_ENABLED */ + +XMLPUBFUN xmlEntityPtr XMLCALL + xmlNewEntity (xmlDocPtr doc, + const xmlChar *name, + int type, + const xmlChar *ExternalID, + const xmlChar *SystemID, + const xmlChar *content); XMLPUBFUN xmlEntityPtr XMLCALL xmlAddDocEntity (xmlDocPtr doc, const xmlChar *name, @@ -82,53 +93,53 @@ XMLPUBFUN xmlEntityPtr XMLCALL const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlAddDtdEntity (xmlDocPtr doc, const xmlChar *name, int type, const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlGetPredefinedEntity (const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetDocEntity (xmlDocPtr doc, +XMLPUBFUN xmlEntityPtr XMLCALL + xmlGetDocEntity (const xmlDoc *doc, const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlGetDtdEntity (xmlDocPtr doc, const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL +XMLPUBFUN xmlEntityPtr XMLCALL xmlGetParameterEntity (xmlDocPtr doc, const xmlChar *name); #ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlEncodeEntities (xmlDocPtr doc, const xmlChar *input); #endif /* LIBXML_LEGACY_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input); -XMLPUBFUN xmlChar * XMLCALL - xmlEncodeSpecialChars (xmlDocPtr doc, +XMLPUBFUN xmlChar * XMLCALL + xmlEncodeSpecialChars (const xmlDoc *doc, const xmlChar *input); -XMLPUBFUN xmlEntitiesTablePtr XMLCALL +XMLPUBFUN xmlEntitiesTablePtr XMLCALL xmlCreateEntitiesTable (void); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEntitiesTablePtr XMLCALL +XMLPUBFUN xmlEntitiesTablePtr XMLCALL xmlCopyEntitiesTable (xmlEntitiesTablePtr table); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeEntitiesTable (xmlEntitiesTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpEntitiesTable (xmlBufferPtr buf, xmlEntitiesTablePtr table); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpEntityDecl (xmlBufferPtr buf, xmlEntityPtr ent); #endif /* LIBXML_OUTPUT_ENABLED */ #ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupPredefinedEntities(void); #endif /* LIBXML_LEGACY_ENABLED */ diff --git a/gnulib-local/lib/libxml/error.c b/gnulib-local/lib/libxml/error.c index 722ffbb..9c45040 100644 --- a/gnulib-local/lib/libxml/error.c +++ b/gnulib-local/lib/libxml/error.c @@ -31,9 +31,9 @@ void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, \ size = 150; \ \ - while (1) { \ + while (size < 64000) { \ va_start(ap, msg); \ - chars = vsnprintf(str, size, msg, ap); \ + chars = vsnprintf(str, size, msg, ap); \ va_end(ap); \ if ((chars > -1) && (chars < size)) { \ if (prev_size == chars) { \ @@ -54,9 +54,9 @@ void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, } /************************************************************************ - * * - * Handling of out of context errors * - * * + * * + * Handling of out of context errors * + * * ************************************************************************/ /** @@ -64,7 +64,7 @@ void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, * @ctx: an error context * @msg: the message to display/transmit * @...: extra parameters for the message display - * + * * Default handler for out of context error messages. */ void XMLCDECL @@ -82,7 +82,7 @@ xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { /** * initGenericErrorDefaultFunc: * @handler: the handler - * + * * Set or reset (if NULL) the default handler for generic errors * to the builtin error function. */ @@ -132,20 +132,20 @@ xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { */ void xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) { - xmlGenericErrorContext = ctx; + xmlStructuredErrorContext = ctx; xmlStructuredError = handler; } /************************************************************************ - * * - * Handling of parsing errors * - * * + * * + * Handling of parsing errors * + * * ************************************************************************/ /** * xmlParserPrintFileInfo: * @input: an xmlParserInputPtr input - * + * * Displays the associated file and line informations for the current input */ @@ -165,19 +165,21 @@ xmlParserPrintFileInfo(xmlParserInputPtr input) { /** * xmlParserPrintFileContext: * @input: an xmlParserInputPtr input - * + * * Displays current context within the input content for error tracking */ static void -xmlParserPrintFileContextInternal(xmlParserInputPtr input , +xmlParserPrintFileContextInternal(xmlParserInputPtr input , xmlGenericErrorFunc channel, void *data ) { const xmlChar *cur, *base; unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */ xmlChar content[81]; /* space for 80 chars + line terminator */ xmlChar *ctnt; - if (input == NULL) return; + if ((input == NULL) || (input->cur == NULL) || + (*input->cur == 0)) return; + cur = input->cur; base = input->base; /* skip backwards over any end-of-lines */ @@ -186,8 +188,8 @@ xmlParserPrintFileContextInternal(xmlParserInputPtr input , } n = 0; /* search backwards for beginning-of-line (to max buff size) */ - while ((n++ < (sizeof(content)-1)) && (cur > base) && - (*(cur) != '\n') && (*(cur) != '\r')) + while ((n++ < (sizeof(content)-1)) && (cur > base) && + (*(cur) != '\n') && (*(cur) != '\r')) cur--; if ((*(cur) == '\n') || (*(cur) == '\r')) cur++; /* calculate the error position in terms of the current position */ @@ -196,8 +198,8 @@ xmlParserPrintFileContextInternal(xmlParserInputPtr input , n = 0; ctnt = content; /* copy selected text to our buffer */ - while ((*cur != 0) && (*(cur) != '\n') && - (*(cur) != '\r') && (n < sizeof(content)-1)) { + while ((*cur != 0) && (*(cur) != '\n') && + (*(cur) != '\r') && (n < sizeof(content)-1)) { *ctnt++ = *cur++; n++; } @@ -221,7 +223,7 @@ xmlParserPrintFileContextInternal(xmlParserInputPtr input , /** * xmlParserPrintFileContext: * @input: an xmlParserInputPtr input - * + * * Displays current context within the input content for error tracking */ void @@ -292,7 +294,10 @@ xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, const char *str, } else { if (file != NULL) channel(data, "%s:%d: ", file, line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) + else if ((line != 0) && + ((domain == XML_FROM_PARSER) || (domain == XML_FROM_SCHEMASV)|| + (domain == XML_FROM_SCHEMASP)||(domain == XML_FROM_DTD) || + (domain == XML_FROM_RELAXNGP)||(domain == XML_FROM_RELAXNGV))) channel(data, "Entity: line %d: ", line); } if (name != NULL) { @@ -360,6 +365,15 @@ xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, const char *str, case XML_FROM_I18N: channel(data, "encoding "); break; + case XML_FROM_SCHEMATRONV: + channel(data, "schematron "); + break; + case XML_FROM_BUFFER: + channel(data, "internal buffer "); + break; + case XML_FROM_URI: + channel(data, "URI "); + break; default: break; } @@ -429,7 +443,7 @@ xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, const char *str, * @str2: extra string info * @str3: extra string info * @int1: extra int info - * @col: column number of the error or 0 if N/A + * @col: column number of the error or 0 if N/A * @msg: the message to display/transmit * @...: extra parameters for the message display * @@ -452,6 +466,8 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, xmlErrorPtr to = &xmlLastError; xmlNodePtr baseptr = NULL; + if (code == XML_ERR_OK) + return; if ((xmlGetWarningsDefaultValue == 0) && (level == XML_ERR_WARNING)) return; if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) || @@ -459,8 +475,11 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) { ctxt = (xmlParserCtxtPtr) ctx; if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) && - (ctxt->sax->initialized == XML_SAX2_MAGIC)) + (ctxt->sax->initialized == XML_SAX2_MAGIC) && + (ctxt->sax->serror != NULL)) { schannel = ctxt->sax->serror; + data = ctxt->userData; + } } /* * Check if structured error handler set @@ -471,18 +490,8 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, * if user has defined handler, change data ptr to user's choice */ if (schannel != NULL) - data = xmlGenericErrorContext; + data = xmlStructuredErrorContext; } - if ((domain == XML_FROM_VALID) && - ((channel == xmlParserValidityError) || - (channel == xmlParserValidityWarning))) { - ctxt = (xmlParserCtxtPtr) ctx; - if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) && - (ctxt->sax->initialized == XML_SAX2_MAGIC)) - schannel = ctxt->sax->serror; - } - if (code == XML_ERR_OK) - return; /* * Formatting the message */ @@ -526,6 +535,8 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) line = node->line; + if ((line == 0) || (line == 65535)) + line = xmlGetLineNo(node); } /* @@ -573,7 +584,6 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, if ((to->file == NULL) && (node != NULL) && (node->doc != NULL)) { to->file = (char *) xmlStrdup(node->doc->URL); } - file = to->file; } to->line = line; if (str1 != NULL) @@ -590,27 +600,28 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, if (to != &xmlLastError) xmlCopyError(to,&xmlLastError); + if (schannel != NULL) { + schannel(data, to); + return; + } + /* * Find the callback channel if channel param is NULL */ - if ((ctxt != NULL) && (channel == NULL) && (xmlStructuredError == NULL) && (ctxt->sax != NULL)) { + if ((ctxt != NULL) && (channel == NULL) && + (xmlStructuredError == NULL) && (ctxt->sax != NULL)) { if (level == XML_ERR_WARNING) channel = ctxt->sax->warning; else channel = ctxt->sax->error; data = ctxt->userData; } else if (channel == NULL) { - if (xmlStructuredError != NULL) - schannel = xmlStructuredError; - else - channel = xmlGenericError; - if (!data) { - data = xmlGenericErrorContext; - } - } - if (schannel != NULL) { - schannel(data, to); - return; + channel = xmlGenericError; + if (ctxt != NULL) { + data = ctxt; + } else { + data = xmlGenericErrorContext; + } } if (channel == NULL) return; @@ -662,7 +673,7 @@ __xmlSimpleError(int domain, int code, xmlNodePtr node, * @ctx: an XML parser context * @msg: the message to display/transmit * @...: extra parameters for the message display - * + * * Display and format an error messages, gives file, line, position and * extra parameters. */ @@ -705,7 +716,7 @@ xmlParserError(void *ctx, const char *msg, ...) * @ctx: an XML parser context * @msg: the message to display/transmit * @...: extra parameters for the message display - * + * * Display and format a warning messages, gives file, line, position and * extra parameters. */ @@ -726,7 +737,7 @@ xmlParserWarning(void *ctx, const char *msg, ...) } xmlParserPrintFileInfo(input); } - + xmlGenericError(xmlGenericErrorContext, "warning: "); XML_GET_VAR_STR(msg, str); xmlGenericError(xmlGenericErrorContext, "%s", str); @@ -744,9 +755,9 @@ xmlParserWarning(void *ctx, const char *msg, ...) } /************************************************************************ - * * - * Handling of validation errors * - * * + * * + * Handling of validation errors * + * * ************************************************************************/ /** @@ -754,7 +765,7 @@ xmlParserWarning(void *ctx, const char *msg, ...) * @ctx: an XML parser context * @msg: the message to display/transmit * @...: extra parameters for the message display - * + * * Display and format an validity error messages, gives file, * line, position and extra parameters. */ @@ -772,7 +783,7 @@ xmlParserValidityError(void *ctx, const char *msg, ...) input = ctxt->input; if ((input->filename == NULL) && (ctxt->inputNr > 1)) input = ctxt->inputTab[ctxt->inputNr - 2]; - + if (had_info == 0) { xmlParserPrintFileInfo(input); } @@ -798,7 +809,7 @@ xmlParserValidityError(void *ctx, const char *msg, ...) * @ctx: an XML parser context * @msg: the message to display/transmit * @...: extra parameters for the message display - * + * * Display and format a validity warning messages, gives file, line, * position and extra parameters. */ @@ -817,7 +828,7 @@ xmlParserValidityWarning(void *ctx, const char *msg, ...) xmlParserPrintFileInfo(input); } - + xmlGenericError(xmlGenericErrorContext, "validity warning: "); XML_GET_VAR_STR(msg, str); xmlGenericError(xmlGenericErrorContext, "%s", str); @@ -927,6 +938,7 @@ xmlCtxtResetLastError(void *ctx) if (ctxt == NULL) return; + ctxt->errNo = XML_ERR_OK; if (ctxt->lastError.code == XML_ERR_OK) return; xmlResetError(&ctxt->lastError); diff --git a/gnulib-local/lib/libxml/globals.c b/gnulib-local/lib/libxml/globals.c index c104a1a..e351b03 100644 --- a/gnulib-local/lib/libxml/globals.c +++ b/gnulib-local/lib/libxml/globals.c @@ -46,7 +46,8 @@ static xmlMutexPtr xmlThrDefMutex = NULL; */ void xmlInitGlobals(void) { - xmlThrDefMutex = xmlNewMutex(); + if (xmlThrDefMutex == NULL) + xmlThrDefMutex = xmlNewMutex(); } /** @@ -60,12 +61,13 @@ void xmlCleanupGlobals(void) xmlFreeMutex(xmlThrDefMutex); xmlThrDefMutex = NULL; } + __xmlGlobalInitMutexDestroy(); } /************************************************************************ - * * + * * * All the user accessible global variables of the library * - * * + * * ************************************************************************/ /* @@ -147,6 +149,7 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; #undef xmlGenericError #undef xmlStructuredError #undef xmlGenericErrorContext +#undef xmlStructuredErrorContext #undef xmlGetWarningsDefaultValue #undef xmlIndentTreeOutput #undef xmlTreeIndentString @@ -243,7 +246,7 @@ static int xmlPedanticParserDefaultValueThrDef = 0; * xmlLineNumbersDefaultValue: * * Global setting, indicate that the parser should store the line number - * in the content field of elements in the DOM tree. + * in the content field of elements in the DOM tree. * Disabled by default since this may not be safe for old classes of * applicaton. */ @@ -313,6 +316,13 @@ static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL; */ void *xmlGenericErrorContext = NULL; static void *xmlGenericErrorContextThrDef = NULL; +/** + * xmlStructuredErrorContext: + * + * Global setting passed to structured error callbacks + */ +void *xmlStructuredErrorContext = NULL; +static void *xmlStructuredErrorContextThrDef = NULL; xmlError xmlLastError; /* @@ -499,7 +509,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs) #if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED) initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler); #endif -#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) +#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED) inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler); #endif @@ -513,7 +523,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs) gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId; gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber; gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber; - gs->xmlDoValidityCheckingDefaultValue = + gs->xmlDoValidityCheckingDefaultValue = xmlDoValidityCheckingDefaultValueThrDef; #if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY) gs->xmlFree = (xmlFreeFunc) xmlMemFree; @@ -538,12 +548,13 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs) gs->xmlParserVersion = LIBXML_VERSION_STRING; gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef; gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef; - gs->xmlSubstituteEntitiesDefaultValue = + gs->xmlSubstituteEntitiesDefaultValue = xmlSubstituteEntitiesDefaultValueThrDef; gs->xmlGenericError = xmlGenericErrorThrDef; gs->xmlStructuredError = xmlStructuredErrorThrDef; gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef; + gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef; gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef; gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef; @@ -572,7 +583,7 @@ xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { void xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) { xmlMutexLock(xmlThrDefMutex); - xmlGenericErrorContextThrDef = ctx; + xmlStructuredErrorContextThrDef = ctx; xmlStructuredErrorThrDef = handler; xmlMutexUnlock(xmlThrDefMutex); } @@ -589,7 +600,7 @@ xmlRegisterNodeFunc xmlRegisterNodeDefault(xmlRegisterNodeFunc func) { xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue; - + __xmlRegisterCallbacks = 1; xmlRegisterNodeDefaultValue = func; return(old); @@ -599,10 +610,10 @@ xmlRegisterNodeFunc xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func) { xmlRegisterNodeFunc old; - + xmlMutexLock(xmlThrDefMutex); old = xmlRegisterNodeDefaultValueThrDef; - + __xmlRegisterCallbacks = 1; xmlRegisterNodeDefaultValueThrDef = func; xmlMutexUnlock(xmlThrDefMutex); @@ -622,7 +633,7 @@ xmlDeregisterNodeFunc xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func) { xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue; - + __xmlRegisterCallbacks = 1; xmlDeregisterNodeDefaultValue = func; return(old); @@ -635,7 +646,7 @@ xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func) xmlMutexLock(xmlThrDefMutex); old = xmlDeregisterNodeDefaultValueThrDef; - + __xmlRegisterCallbacks = 1; xmlDeregisterNodeDefaultValueThrDef = func; xmlMutexUnlock(xmlThrDefMutex); @@ -647,7 +658,7 @@ xmlParserInputBufferCreateFilenameFunc xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func) { xmlParserInputBufferCreateFilenameFunc old; - + xmlMutexLock(xmlThrDefMutex); old = xmlParserInputBufferCreateFilenameValueThrDef; if (old == NULL) { @@ -664,7 +675,7 @@ xmlOutputBufferCreateFilenameFunc xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func) { xmlOutputBufferCreateFilenameFunc old; - + xmlMutexLock(xmlThrDefMutex); old = xmlOutputBufferCreateFilenameValueThrDef; #ifdef LIBXML_OUTPUT_ENABLED @@ -721,7 +732,7 @@ __xmlMalloc(void){ if (IS_MAIN_THREAD) return (&xmlMalloc); else - return (&xmlGetGlobalState()->xmlMalloc); + return (&xmlGetGlobalState()->xmlMalloc); } #undef xmlMallocAtomic @@ -875,6 +886,15 @@ __xmlGenericErrorContext(void) { return (&xmlGetGlobalState()->xmlGenericErrorContext); } +#undef xmlStructuredErrorContext +void * * +__xmlStructuredErrorContext(void) { + if (IS_MAIN_THREAD) + return (&xmlStructuredErrorContext); + else + return (&xmlGetGlobalState()->xmlStructuredErrorContext); +} + #undef xmlGetWarningsDefaultValue int * __xmlGetWarningsDefaultValue(void) { @@ -909,7 +929,7 @@ int xmlThrDefIndentTreeOutput(int v) { return ret; } -#undef xmlTreeIndentString +#undef xmlTreeIndentString const char * * __xmlTreeIndentString(void) { if (IS_MAIN_THREAD) diff --git a/gnulib-local/lib/libxml/globals.in.h b/gnulib-local/lib/libxml/globals.in.h index 1173a8f..a9305aa 100644 --- a/gnulib-local/lib/libxml/globals.in.h +++ b/gnulib-local/lib/libxml/globals.in.h @@ -28,8 +28,36 @@ extern "C" { XMLPUBFUN void XMLCALL xmlInitGlobals(void); XMLPUBFUN void XMLCALL xmlCleanupGlobals(void); -typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, xmlCharEncoding enc); -typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression); +/** + * xmlParserInputBufferCreateFilenameFunc: + * @URI: the URI to read from + * @enc: the requested source encoding + * + * Signature for the function doing the lookup for a suitable input method + * corresponding to an URI. + * + * Returns the new xmlParserInputBufferPtr in case of success or NULL if no + * method was found. + */ +typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, + xmlCharEncoding enc); + + +/** + * xmlOutputBufferCreateFilenameFunc: + * @URI: the URI to write to + * @enc: the requested target encoding + * + * Signature for the function doing the lookup for a suitable output method + * corresponding to an URI. + * + * Returns the new xmlOutputBufferPtr in case of success or NULL if no + * method was found. + */ +typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, + xmlCharEncodingHandlerPtr encoder, + int compression); + XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func); XMLPUBFUN xmlOutputBufferCreateFilenameFunc @@ -52,6 +80,7 @@ XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc #undef xmlGenericError #undef xmlStructuredError #undef xmlGenericErrorContext +#undef xmlStructuredErrorContext #undef xmlGetWarningsDefaultValue #undef xmlIndentTreeOutput #undef xmlTreeIndentString @@ -73,12 +102,24 @@ XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc #undef xmlParserInputBufferCreateFilenameValue #undef xmlOutputBufferCreateFilenameValue +/** + * xmlRegisterNodeFunc: + * @node: the current node + * + * Signature for the registration callback of a created node + */ typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); +/** + * xmlDeregisterNodeFunc: + * @node: the current node + * + * Signature for the deregistration callback of a discarded node + */ typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); typedef struct _xmlGlobalState xmlGlobalState; typedef xmlGlobalState *xmlGlobalStatePtr; -struct _xmlGlobalState +struct _xmlGlobalState { const char *xmlParserVersion; @@ -114,14 +155,16 @@ struct _xmlGlobalState int xmlIndentTreeOutput; const char *xmlTreeIndentString; - xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; - xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; + xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; + xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; xmlMallocFunc xmlMallocAtomic; xmlError xmlLastError; xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; + + void *xmlStructuredErrorContext; }; #ifdef __cplusplus @@ -143,10 +186,11 @@ XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNo XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func); XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); -XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL +XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func); -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL - xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func); +XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL + xmlThrDefParserInputBufferCreateFilenameDefault( + xmlParserInputBufferCreateFilenameFunc func); /** DOC_DISABLE */ /* @@ -258,7 +302,8 @@ XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void); #else XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme; #endif -XMLPUBFUN xmlBufferAllocationScheme XMLCALL xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v); +XMLPUBFUN xmlBufferAllocationScheme XMLCALL + xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v); XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void); #ifdef LIBXML_THREAD_ENABLED @@ -318,6 +363,14 @@ XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void); XMLPUBVAR void * xmlGenericErrorContext; #endif +XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlStructuredErrorContext \ +(*(__xmlStructuredErrorContext())) +#else +XMLPUBVAR void * xmlStructuredErrorContext; +#endif + XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlGetWarningsDefaultValue \ @@ -432,7 +485,8 @@ XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void); XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; #endif -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL __xmlParserInputBufferCreateFilenameValue(void); +XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \ + __xmlParserInputBufferCreateFilenameValue(void); #ifdef LIBXML_THREAD_ENABLED #define xmlParserInputBufferCreateFilenameValue \ (*(__xmlParserInputBufferCreateFilenameValue())) diff --git a/gnulib-local/lib/libxml/hash.c b/gnulib-local/lib/libxml/hash.c index e92a5a0..f9a2017 100644 --- a/gnulib-local/lib/libxml/hash.c +++ b/gnulib-local/lib/libxml/hash.c @@ -3,7 +3,7 @@ * * Reference: Your favorite introductory book on algorithms * - * Copyright (C) 2000 Bjorn Reese and Daniel Veillard. + * Copyright (C) 2000,2012 Bjorn Reese and Daniel Veillard. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -21,6 +21,22 @@ #include "libxml.h" #include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif + +/* + * Following http://www.ocert.org/advisories/ocert-2011-003.html + * it seems that having hash randomization might be a good idea + * when using XML with untrusted data + */ +#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) +#define HASH_RANDOMIZATION +#endif + #include #include #include @@ -53,6 +69,9 @@ struct _xmlHashTable { int size; int nbElems; xmlDictPtr dict; +#ifdef HASH_RANDOMIZATION + int random_seed; +#endif }; /* @@ -64,18 +83,23 @@ xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3) { unsigned long value = 0L; char ch; - + +#ifdef HASH_RANDOMIZATION + value = table->random_seed; +#endif if (name != NULL) { value += 30 * (*name); while ((ch = *name++) != 0) { value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); } } + value = value ^ ((value << 5) + (value >> 3)); if (name2 != NULL) { while ((ch = *name2++) != 0) { value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); } } + value = value ^ ((value << 5) + (value >> 3)); if (name3 != NULL) { while ((ch = *name3++) != 0) { value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); @@ -91,7 +115,10 @@ xmlHashComputeQKey(xmlHashTablePtr table, const xmlChar *prefix3, const xmlChar *name3) { unsigned long value = 0L; char ch; - + +#ifdef HASH_RANDOMIZATION + value = table->random_seed; +#endif if (prefix != NULL) value += 30 * (*prefix); else @@ -108,6 +135,7 @@ xmlHashComputeQKey(xmlHashTablePtr table, value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); } } + value = value ^ ((value << 5) + (value >> 3)); if (prefix2 != NULL) { while ((ch = *prefix2++) != 0) { value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); @@ -119,6 +147,7 @@ xmlHashComputeQKey(xmlHashTablePtr table, value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); } } + value = value ^ ((value << 5) + (value >> 3)); if (prefix3 != NULL) { while ((ch = *prefix3++) != 0) { value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); @@ -144,10 +173,10 @@ xmlHashComputeQKey(xmlHashTablePtr table, xmlHashTablePtr xmlHashCreate(int size) { xmlHashTablePtr table; - + if (size <= 0) size = 256; - + table = xmlMalloc(sizeof(xmlHashTable)); if (table) { table->dict = NULL; @@ -155,8 +184,11 @@ xmlHashCreate(int size) { table->nbElems = 0; table->table = xmlMalloc(size * sizeof(xmlHashEntry)); if (table->table) { - memset(table->table, 0, size * sizeof(xmlHashEntry)); - return(table); + memset(table->table, 0, size * sizeof(xmlHashEntry)); +#ifdef HASH_RANDOMIZATION + table->random_seed = __xmlRandom(); +#endif + return(table); } xmlFree(table); } @@ -202,7 +234,7 @@ xmlHashGrow(xmlHashTablePtr table, int size) { #ifdef DEBUG_GROW unsigned long nbElem = 0; #endif - + if (table == NULL) return(-1); if (size < 8) @@ -214,7 +246,7 @@ xmlHashGrow(xmlHashTablePtr table, int size) { oldtable = table->table; if (oldtable == NULL) return(-1); - + table->table = xmlMalloc(size * sizeof(xmlHashEntry)); if (table->table == NULL) { table->table = oldtable; @@ -224,13 +256,13 @@ xmlHashGrow(xmlHashTablePtr table, int size) { table->size = size; /* If the two loops are merged, there would be situations where - a new entry needs to allocated and data copied into it from + a new entry needs to allocated and data copied into it from the main table. So instead, we run through the array twice, first copying all the elements in the main array (where we can't get conflicts) and then the rest, so we only free (and don't allocate) */ for (i = 0; i < oldsize; i++) { - if (oldtable[i].valid == 0) + if (oldtable[i].valid == 0) continue; key = xmlHashComputeKey(table, oldtable[i].name, oldtable[i].name2, oldtable[i].name3); @@ -254,8 +286,8 @@ xmlHashGrow(xmlHashTablePtr table, int size) { table->table[key].next = NULL; xmlFree(iter); } else { - iter->next = table->table[key].next; - table->table[key].next = iter; + iter->next = table->table[key].next; + table->table[key].next = iter; } #ifdef DEBUG_GROW @@ -320,7 +352,6 @@ xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) { inside_table = 0; iter = next; } - inside_table = 0; } xmlFree(table->table); } @@ -572,7 +603,7 @@ xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, entry->valid = 1; - if (insert != NULL) + if (insert != NULL) insert->next = entry; table->nbElems++; @@ -721,7 +752,7 @@ xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, * Returns the a pointer to the userdata */ void * -xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, +xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3) { unsigned long key; xmlHashEntryPtr entry; @@ -794,14 +825,14 @@ typedef struct { void *data; } stubData; -static void -stubHashScannerFull (void *payload, void *data, const xmlChar *name, +static void +stubHashScannerFull (void *payload, void *data, const xmlChar *name, const xmlChar *name2 ATTRIBUTE_UNUSED, const xmlChar *name3 ATTRIBUTE_UNUSED) { stubData *stubdata = (stubData *) data; stubdata->hashscanner (payload, stubdata->data, (xmlChar *) name); -} - +} + /** * xmlHashScan: * @table: the hash table @@ -814,7 +845,7 @@ void xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) { stubData stubdata; stubdata.data = data; - stubdata.hashscanner = f; + stubdata.hashscanner = f; xmlHashScanFull (table, stubHashScannerFull, &stubdata); } @@ -828,7 +859,7 @@ xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) { */ void xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) { - int i; + int i, nb; xmlHashEntryPtr iter; xmlHashEntryPtr next; @@ -839,15 +870,26 @@ xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) { if (table->table) { for(i = 0; i < table->size; i++) { - if (table->table[i].valid == 0) + if (table->table[i].valid == 0) continue; iter = &(table->table[i]); while (iter) { next = iter->next; + nb = table->nbElems; if ((f != NULL) && (iter->payload != NULL)) f(iter->payload, data, iter->name, iter->name2, iter->name3); - iter = next; + if (nb != table->nbElems) { + /* table was modified by the callback, be careful */ + if (iter == &(table->table[i])) { + if (table->table[i].valid == 0) + iter = NULL; + if (table->table[i].next != next) + iter = &(table->table[i]); + } else + iter = next; + } else + iter = next; } } } @@ -867,7 +909,7 @@ xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) { * the comparison is considered to match. */ void -xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, +xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScanner f, void *data) { xmlHashScanFull3 (table, name, name2, name3, @@ -888,7 +930,7 @@ xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, * the comparison is considered to match. */ void -xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, +xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScannerFull f, void *data) { int i; @@ -942,6 +984,9 @@ xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) { return(NULL); ret = xmlHashCreate(table->size); + if (ret == NULL) + return(NULL); + if (table->table) { for(i = 0; i < table->size; i++) { if (table->table[i].valid == 0) diff --git a/gnulib-local/lib/libxml/hash.in.h b/gnulib-local/lib/libxml/hash.in.h index 7fe4be7..dc8ab7e 100644 --- a/gnulib-local/lib/libxml/hash.in.h +++ b/gnulib-local/lib/libxml/hash.in.h @@ -1,7 +1,7 @@ /* * Summary: Chained hash tables - * Description: This module implements the hash table support used in - * various places in the library. + * Description: This module implements the hash table support used in + * various places in the library. * * Copy: See Copyright for the status of this software. * @@ -108,40 +108,40 @@ XMLPUBFUN xmlHashTablePtr XMLCALL XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreateDict(int size, xmlDictPtr dict); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlHashFree (xmlHashTablePtr table, xmlHashDeallocator f); /* * Add a new entry to the hash table. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashAddEntry (xmlHashTablePtr table, const xmlChar *name, void *userdata); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, void *userdata); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, @@ -152,13 +152,13 @@ XMLPUBFUN int XMLCALL /* * Remove an entry from the hash table. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator f); @@ -166,29 +166,29 @@ XMLPUBFUN int XMLCALL /* * Retrieve the userdata. */ -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashLookup (xmlHashTablePtr table, const xmlChar *name); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashLookup2 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashLookup3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashQLookup (xmlHashTablePtr table, const xmlChar *name, const xmlChar *prefix); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashQLookup2 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *prefix, const xmlChar *name2, const xmlChar *prefix2); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlHashQLookup3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *prefix, @@ -200,27 +200,27 @@ XMLPUBFUN void * XMLCALL /* * Helpers. */ -XMLPUBFUN xmlHashTablePtr XMLCALL +XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCopy (xmlHashTablePtr table, xmlHashCopier f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlHashSize (xmlHashTablePtr table); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlHashScan (xmlHashTablePtr table, xmlHashScanner f, void *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlHashScan3 (xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScanner f, void *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlHashScanFull (xmlHashTablePtr table, xmlHashScannerFull f, void *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, diff --git a/gnulib-local/lib/libxml/legacy.c b/gnulib-local/lib/libxml/legacy.c index e75178a..86362bf 100644 --- a/gnulib-local/lib/libxml/legacy.c +++ b/gnulib-local/lib/libxml/legacy.c @@ -393,7 +393,7 @@ xmlSetFeature(xmlParserCtxtPtr ctxt, const char *name, void *value) * @end: an end marker xmlChar, 0 if none * @end2: an end marker xmlChar, 0 if none * @end3: an end marker xmlChar, 0 if none - * + * * This function is deprecated, we now always process entities content * through xmlStringDecodeEntities * @@ -456,7 +456,7 @@ xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) /** * xmlNamespaceParseQName: * @ctxt: an XML parser context - * @prefix: a xmlChar ** + * @prefix: a xmlChar ** * * TODO: this seems not in use anymore, the namespace handling is done on * top of the SAX interfaces, i.e. not on raw input. @@ -603,7 +603,7 @@ xmlScanName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) /** * xmlParserHandleReference: * @ctxt: the parser context - * + * * TODO: Remove, now deprecated ... the test is done directly in the * content parsing * routines. @@ -615,7 +615,7 @@ xmlScanName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) * [ WFC: Entity Declared ] * the Name given in the entity reference must match that in an entity * declaration, except that well-formed documents need not declare any - * of the following entities: amp, lt, gt, apos, quot. + * of the following entities: amp, lt, gt, apos, quot. * * [ WFC: Parsed Entity ] * An entity reference must not contain the name of an unparsed entity @@ -624,7 +624,7 @@ xmlScanName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED) * '&#x' [0-9a-fA-F]+ ';' * * A PEReference may have been detected in the current input stream - * the handling is done accordingly to + * the handling is done accordingly to * http://www.w3.org/TR/REC-xml#entproc */ void @@ -693,7 +693,7 @@ xmlNewGlobalNs(xmlDocPtr doc ATTRIBUTE_UNUSED, /** * xmlUpgradeOldNs: * @doc: a document pointer - * + * * Upgrade old style Namespaces (PI) and move them to the root of the document. * DEPRECATED */ @@ -719,7 +719,7 @@ xmlUpgradeOldNs(xmlDocPtr doc ATTRIBUTE_UNUSED) * * People must migrate their code to xmlEncodeEntitiesReentrant ! * This routine will issue a warning when encountered. - * + * * Returns NULL */ const xmlChar * @@ -740,7 +740,7 @@ xmlEncodeEntities(xmlDocPtr doc ATTRIBUTE_UNUSED, /************************************************************************ * * - * Old set of SAXv1 functions * + * Old set of SAXv1 functions * * * ************************************************************************/ static int deprecated_v1_msg = 0; @@ -961,8 +961,8 @@ getParameterEntity(void *ctx, const xmlChar * name) /** * entityDecl: * @ctx: the user data (XML parser context) - * @name: the entity name - * @type: the entity type + * @name: the entity name + * @type: the entity type * @publicId: The public ID of the entity * @systemId: The system ID of the entity * @content: the entity value (without processing). @@ -983,8 +983,8 @@ entityDecl(void *ctx, const xmlChar * name, int type, * attributeDecl: * @ctx: the user data (XML parser context) * @elem: the name of the element - * @fullname: the attribute name - * @type: the attribute type + * @fullname: the attribute name + * @type: the attribute type * @def: the type of default value * @defaultValue: the attribute default value * @tree: the tree of enumerated value set @@ -1005,8 +1005,8 @@ attributeDecl(void *ctx, const xmlChar * elem, const xmlChar * fullname, /** * elementDecl: * @ctx: the user data (XML parser context) - * @name: the element name - * @type: the element type + * @name: the element name + * @type: the element type * @content: the element value tree * * An element definition has been parsed @@ -1151,7 +1151,7 @@ void endElement(void *ctx, const xmlChar * name ATTRIBUTE_UNUSED) { DEPRECATED("endElement") - xmlSAX2EndElement(ctx, name); + xmlSAX2EndElement(ctx, name); } /** @@ -1159,7 +1159,7 @@ endElement(void *ctx, const xmlChar * name ATTRIBUTE_UNUSED) * @ctx: the user data (XML parser context) * @name: The entity name * - * called when an entity reference is detected. + * called when an entity reference is detected. * DEPRECATED: use xmlSAX2Reference() */ void diff --git a/gnulib-local/lib/libxml/libxml.h b/gnulib-local/lib/libxml/libxml.h index 696be62..2da9044 100644 --- a/gnulib-local/lib/libxml/libxml.h +++ b/gnulib-local/lib/libxml/libxml.h @@ -20,7 +20,20 @@ #if defined(macintosh) #include "config-mac.h" +#elif defined(_WIN32_WCE) +/* + * Windows CE compatibility definitions and functions + * This is needed to compile libxml2 for Windows CE. + * At least I tested it with WinCE 5.0 for Emulator and WinCE 4.2/SH4 target + */ +#include +#include #else +/* + * Currently supported platforms use either autoconf or + * copy to config.h own "preset" configuration file. + * As result ifdef HAVE_CONFIG_H is omited here. + */ #include "config.h" #include #endif @@ -64,6 +77,23 @@ void __xmlLoaderErr(void *ctx, const char *msg, const char *filename); void __htmlParseContent(void *ctx); #endif +/* + * internal global initialization critical section routines. + */ +void __xmlGlobalInitMutexLock(void); +void __xmlGlobalInitMutexUnlock(void); +void __xmlGlobalInitMutexDestroy(void); + +int __xmlInitializeDict(void); + +#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) +/* + * internal thread safe random function + */ +int __xmlRandom(void); +#endif + +int xmlNop(void); #ifdef IN_LIBXML #ifdef __GNUC__ @@ -76,4 +106,7 @@ void __htmlParseContent(void *ctx); #endif #endif #endif +#if !defined(PIC) && !defined(NOLIBTOOL) +# define LIBXML_STATIC +#endif #endif /* ! __XML_LIBXML_H__ */ diff --git a/gnulib-local/lib/libxml/list.c b/gnulib-local/lib/libxml/list.c index 2dc6d96..d33d928 100644 --- a/gnulib-local/lib/libxml/list.c +++ b/gnulib-local/lib/libxml/list.c @@ -94,15 +94,15 @@ xmlLinkCompare(const void *data0, const void *data1) * * Returns the link containing the data or NULL */ -static xmlLinkPtr -xmlListLowerSearch(xmlListPtr l, void *data) +static xmlLinkPtr +xmlListLowerSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; if (l == NULL) return(NULL); for(lk = l->sentinel->next;lk != l->sentinel && l->linkCompare(lk->data, data) <0 ;lk = lk->next); - return lk; + return lk; } /** @@ -114,15 +114,15 @@ xmlListLowerSearch(xmlListPtr l, void *data) * * Returns the link containing the data or NULL */ -static xmlLinkPtr -xmlListHigherSearch(xmlListPtr l, void *data) +static xmlLinkPtr +xmlListHigherSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; if (l == NULL) return(NULL); for(lk = l->sentinel->prev;lk != l->sentinel && l->linkCompare(lk->data, data) >0 ;lk = lk->prev); - return lk; + return lk; } /** @@ -134,8 +134,8 @@ xmlListHigherSearch(xmlListPtr l, void *data) * * Returns the link containing the data or NULL */ -static xmlLinkPtr -xmlListLinkSearch(xmlListPtr l, void *data) +static xmlLinkPtr +xmlListLinkSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; if (l == NULL) @@ -159,8 +159,8 @@ xmlListLinkSearch(xmlListPtr l, void *data) * * Returns the link containing the data or NULL */ -static xmlLinkPtr -xmlListLinkReverseSearch(xmlListPtr l, void *data) +static xmlLinkPtr +xmlListLinkReverseSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; if (l == NULL) @@ -189,16 +189,16 @@ xmlListCreate(xmlListDeallocator deallocator, xmlListDataCompare compare) { xmlListPtr l; if (NULL == (l = (xmlListPtr )xmlMalloc( sizeof(xmlList)))) { - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "Cannot initialize memory for list"); return (NULL); } /* Initialize the list to NULL */ memset(l, 0, sizeof(xmlList)); - + /* Add the sentinel */ if (NULL ==(l->sentinel = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) { - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "Cannot initialize memory for sentinel"); xmlFree(l); return (NULL); @@ -206,7 +206,7 @@ xmlListCreate(xmlListDeallocator deallocator, xmlListDataCompare compare) l->sentinel->next = l->sentinel; l->sentinel->prev = l->sentinel; l->sentinel->data = NULL; - + /* If there is a link deallocator, use it */ if (deallocator != NULL) l->linkDeallocator = deallocator; @@ -217,7 +217,7 @@ xmlListCreate(xmlListDeallocator deallocator, xmlListDataCompare compare) l->linkCompare = xmlLinkCompare; return l; } - + /** * xmlListSearch: * @l: a list @@ -228,7 +228,7 @@ xmlListCreate(xmlListDeallocator deallocator, xmlListDataCompare compare) * Returns the value associated to @data or NULL in case of error */ void * -xmlListSearch(xmlListPtr l, void *data) +xmlListSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; if (l == NULL) @@ -249,7 +249,7 @@ xmlListSearch(xmlListPtr l, void *data) * Returns the value associated to @data or NULL in case of error */ void * -xmlListReverseSearch(xmlListPtr l, void *data) +xmlListReverseSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; if (l == NULL) @@ -270,7 +270,7 @@ xmlListReverseSearch(xmlListPtr l, void *data) * Returns 0 in case of success, 1 in case of failure */ int -xmlListInsert(xmlListPtr l, void *data) +xmlListInsert(xmlListPtr l, void *data) { xmlLinkPtr lkPlace, lkNew; @@ -280,7 +280,7 @@ xmlListInsert(xmlListPtr l, void *data) /* Add the new link */ lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink)); if (lkNew == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "Cannot initialize memory for new link"); return (1); } @@ -302,7 +302,7 @@ xmlListInsert(xmlListPtr l, void *data) * * Returns 0 in case of success, 1 in case of failure */ -int xmlListAppend(xmlListPtr l, void *data) +int xmlListAppend(xmlListPtr l, void *data) { xmlLinkPtr lkPlace, lkNew; @@ -312,16 +312,16 @@ int xmlListAppend(xmlListPtr l, void *data) /* Add the new link */ lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink)); if (lkNew == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "Cannot initialize memory for new link"); - return (0); + return (1); } lkNew->data = data; lkNew->next = lkPlace->next; (lkPlace->next)->prev = lkNew; lkPlace->next = lkNew; lkNew->prev = lkPlace; - return 1; + return 0; } /** @@ -353,7 +353,7 @@ int xmlListRemoveFirst(xmlListPtr l, void *data) { xmlLinkPtr lk; - + if (l == NULL) return(0); /*Find the first instance of this data */ @@ -378,7 +378,7 @@ int xmlListRemoveLast(xmlListPtr l, void *data) { xmlLinkPtr lk; - + if (l == NULL) return(0); /*Find the last instance of this data */ @@ -403,7 +403,7 @@ int xmlListRemoveAll(xmlListPtr l, void *data) { int count=0; - + if (l == NULL) return(0); @@ -422,7 +422,7 @@ void xmlListClear(xmlListPtr l) { xmlLinkPtr lk; - + if (l == NULL) return; lk = l->sentinel->next; @@ -458,14 +458,14 @@ xmlListEmpty(xmlListPtr l) * * Returns the first element in the list, or NULL */ -xmlLinkPtr +xmlLinkPtr xmlListFront(xmlListPtr l) { if (l == NULL) return(NULL); return (l->sentinel->next); } - + /** * xmlListEnd: * @l: a list @@ -474,14 +474,14 @@ xmlListFront(xmlListPtr l) * * Returns the last element in the list, or NULL */ -xmlLinkPtr +xmlLinkPtr xmlListEnd(xmlListPtr l) { if (l == NULL) return(NULL); return (l->sentinel->prev); } - + /** * xmlListSize: * @l: a list @@ -539,7 +539,7 @@ xmlListPopBack(xmlListPtr l) * Returns 1 if successful, 0 otherwise */ int -xmlListPushFront(xmlListPtr l, void *data) +xmlListPushFront(xmlListPtr l, void *data) { xmlLinkPtr lkPlace, lkNew; @@ -549,7 +549,7 @@ xmlListPushFront(xmlListPtr l, void *data) /* Add the new link */ lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink)); if (lkNew == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "Cannot initialize memory for new link"); return (0); } @@ -571,7 +571,7 @@ xmlListPushFront(xmlListPtr l, void *data) * Returns 1 if successful, 0 otherwise */ int -xmlListPushBack(xmlListPtr l, void *data) +xmlListPushBack(xmlListPtr l, void *data) { xmlLinkPtr lkPlace, lkNew; @@ -580,7 +580,7 @@ xmlListPushBack(xmlListPtr l, void *data) lkPlace = l->sentinel->prev; /* Add the new link */ if (NULL ==(lkNew = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) { - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "Cannot initialize memory for new link"); return (0); } @@ -643,7 +643,7 @@ void xmlListSort(xmlListPtr l) { xmlListPtr lTemp; - + if (l == NULL) return; if(xmlListEmpty(l)) @@ -725,10 +725,10 @@ xmlListMerge(xmlListPtr l1, xmlListPtr l2) * @old: the list * * Duplicate the list - * + * * Returns a new copy of the list or NULL in case of error */ -xmlListPtr +xmlListPtr xmlListDup(const xmlListPtr old) { xmlListPtr cur; @@ -754,7 +754,7 @@ xmlListDup(const xmlListPtr old) * @old: the old list * * Move all the element from the old list in the new list - * + * * Returns 0 in case of success 1 in case of error */ int @@ -771,7 +771,7 @@ xmlListCopy(xmlListPtr cur, const xmlListPtr old) return (1); } } - return (0); + return (0); } /* xmlListUnique() */ /* xmlListSwap */ diff --git a/gnulib-local/lib/libxml/list.in.h b/gnulib-local/lib/libxml/list.in.h index 1d83482..0504e0c 100644 --- a/gnulib-local/lib/libxml/list.in.h +++ b/gnulib-local/lib/libxml/list.in.h @@ -1,6 +1,6 @@ /* * Summary: lists interfaces - * Description: this module implement the list support used in + * Description: this module implement the list support used in * various place in the library. * * Copy: See Copyright for the status of this software. @@ -55,76 +55,76 @@ typedef int (*xmlListWalker) (const void *data, const void *user); XMLPUBFUN xmlListPtr XMLCALL xmlListCreate (xmlListDeallocator deallocator, xmlListDataCompare compare); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListDelete (xmlListPtr l); /* Basic Operators */ -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlListSearch (xmlListPtr l, void *data); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlListReverseSearch (xmlListPtr l, void *data); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListInsert (xmlListPtr l, void *data) ; -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListAppend (xmlListPtr l, void *data) ; -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListRemoveFirst (xmlListPtr l, void *data); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListRemoveLast (xmlListPtr l, void *data); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListRemoveAll (xmlListPtr l, void *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListClear (xmlListPtr l); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListEmpty (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL +XMLPUBFUN xmlLinkPtr XMLCALL xmlListFront (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL +XMLPUBFUN xmlLinkPtr XMLCALL xmlListEnd (xmlListPtr l); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListSize (xmlListPtr l); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListPopFront (xmlListPtr l); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListPopBack (xmlListPtr l); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListPushFront (xmlListPtr l, void *data); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListPushBack (xmlListPtr l, void *data); /* Advanced Operators */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListReverse (xmlListPtr l); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListSort (xmlListPtr l); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListWalk (xmlListPtr l, xmlListWalker walker, const void *user); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListReverseWalk (xmlListPtr l, xmlListWalker walker, const void *user); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlListMerge (xmlListPtr l1, xmlListPtr l2); -XMLPUBFUN xmlListPtr XMLCALL +XMLPUBFUN xmlListPtr XMLCALL xmlListDup (const xmlListPtr old); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlListCopy (xmlListPtr cur, const xmlListPtr old); /* Link operators */ -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlLinkGetData (xmlLinkPtr lk); /* xmlListUnique() */ diff --git a/gnulib-local/lib/libxml/nanoftp.c b/gnulib-local/lib/libxml/nanoftp.c index c78503b..2135ab9 100644 --- a/gnulib-local/lib/libxml/nanoftp.c +++ b/gnulib-local/lib/libxml/nanoftp.c @@ -41,7 +41,7 @@ #include #endif #ifdef HAVE_FCNTL_H -#include +#include #endif #ifdef HAVE_ERRNO_H #include @@ -77,8 +77,10 @@ #endif -#ifdef __MINGW32__ +#if defined(__MINGW32__) || defined(_WIN32_WCE) +#ifndef _WINSOCKAPI_ #define _WINSOCKAPI_ +#endif #include #include #undef XML_SOCKLEN_T @@ -89,10 +91,9 @@ * A couple portability macros */ #ifndef _WINSOCKAPI_ -#ifndef __BEOS__ +#if !defined(__BEOS__) || defined(__HAIKU__) #define closesocket(s) close(s) #endif -#define SOCKET int #endif #ifdef __BEOS__ @@ -102,8 +103,10 @@ #endif #ifdef _AIX +#ifdef HAVE_BROKEN_SS_FAMILY #define ss_family __ss_family #endif +#endif #ifndef XML_SOCKLEN_T #define XML_SOCKLEN_T unsigned int @@ -185,7 +188,7 @@ void xmlNanoFTPInit(void) { const char *env; #ifdef _WINSOCKAPI_ - WSADATA wsaData; + WSADATA wsaData; #endif if (initialized) @@ -302,15 +305,15 @@ xmlNanoFTPScanURL(void *ctx, const char *URL) { /* * Clear any existing data from the context */ - if (ctxt->protocol != NULL) { + if (ctxt->protocol != NULL) { xmlFree(ctxt->protocol); ctxt->protocol = NULL; } - if (ctxt->hostname != NULL) { + if (ctxt->hostname != NULL) { xmlFree(ctxt->hostname); ctxt->hostname = NULL; } - if (ctxt->path != NULL) { + if (ctxt->path != NULL) { xmlFree(ctxt->path); ctxt->path = NULL; } @@ -324,7 +327,7 @@ xmlNanoFTPScanURL(void *ctx, const char *URL) { xmlFreeURI(uri); return; } - + ctxt->protocol = xmlMemStrdup(uri->scheme); ctxt->hostname = xmlMemStrdup(uri->server); if (uri->path != NULL) @@ -355,7 +358,7 @@ xmlNanoFTPScanURL(void *ctx, const char *URL) { * @URL: The URL used to update the context * * Update an FTP context by parsing the URL and finding - * new path it indicates. If there is an error in the + * new path it indicates. If there is an error in the * protocol, hostname, port or other information, the * error is raised. It indicates a new connection has to * be established. @@ -400,7 +403,7 @@ xmlNanoFTPUpdateURL(void *ctx, const char *URL) { ctxt->path = NULL; } - if (uri->path == NULL) + if (uri->path == NULL) ctxt->path = xmlMemStrdup("/"); else ctxt->path = xmlMemStrdup(uri->path); @@ -424,7 +427,7 @@ void xmlNanoFTPScanProxy(const char *URL) { xmlURIPtr uri; - if (proxy != NULL) { + if (proxy != NULL) { xmlFree(proxy); proxy = NULL; } @@ -448,7 +451,7 @@ xmlNanoFTPScanProxy(const char *URL) { xmlFreeURI(uri); return; } - + proxy = xmlMemStrdup(uri->server); if (uri->port != 0) proxyPort = uri->port; @@ -482,7 +485,7 @@ xmlNanoFTPNewCtxt(const char *URL) { ret->returnValue = 0; ret->controlBufIndex = 0; ret->controlBufUsed = 0; - ret->controlFd = -1; + ret->controlFd = INVALID_SOCKET; unescaped = xmlURIUnescapeString(URL, 0, NULL); if (unescaped != NULL) { @@ -509,8 +512,8 @@ xmlNanoFTPFreeCtxt(void * ctx) { if (ctxt->protocol != NULL) xmlFree(ctxt->protocol); if (ctxt->path != NULL) xmlFree(ctxt->path); ctxt->passive = 1; - if (ctxt->controlFd >= 0) closesocket(ctxt->controlFd); - ctxt->controlFd = -1; + if (ctxt->controlFd != INVALID_SOCKET) closesocket(ctxt->controlFd); + ctxt->controlFd = INVALID_SOCKET; ctxt->controlBufIndex = -1; ctxt->controlBufUsed = -1; xmlFree(ctxt); @@ -520,7 +523,7 @@ xmlNanoFTPFreeCtxt(void * ctx) { * xmlNanoFTPParseResponse: * @buf: the buffer containing the response * @len: the buffer length - * + * * Parsing of the server answer, we just extract the code. * * returns 0 for errors @@ -532,22 +535,22 @@ xmlNanoFTPParseResponse(char *buf, int len) { int val = 0; if (len < 3) return(-1); - if ((*buf >= '0') && (*buf <= '9')) + if ((*buf >= '0') && (*buf <= '9')) val = val * 10 + (*buf - '0'); else return(0); buf++; - if ((*buf >= '0') && (*buf <= '9')) + if ((*buf >= '0') && (*buf <= '9')) val = val * 10 + (*buf - '0'); else return(0); buf++; - if ((*buf >= '0') && (*buf <= '9')) + if ((*buf >= '0') && (*buf <= '9')) val = val * 10 + (*buf - '0'); else return(0); buf++; - if (*buf == '-') + if (*buf == '-') return(-val); return(val); } @@ -565,7 +568,7 @@ xmlNanoFTPGetMore(void *ctx) { int len; 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)) { #ifdef DEBUG_FTP @@ -617,8 +620,8 @@ xmlNanoFTPGetMore(void *ctx) { if ((len = recv(ctxt->controlFd, &ctxt->controlBuf[ctxt->controlBufIndex], size, 0)) < 0) { __xmlIOErr(XML_FROM_FTP, 0, "recv failed"); - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(-1); } #ifdef DEBUG_FTP @@ -646,7 +649,7 @@ xmlNanoFTPReadResponse(void *ctx) { int len; int res = -1, cur = -1; - if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); + if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1); get_more: /* @@ -735,7 +738,7 @@ xmlNanoFTPCheckResponse(void *ctx) { fd_set rfd; 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_usec = 0; FD_ZERO(&rfd); @@ -746,7 +749,7 @@ xmlNanoFTPCheckResponse(void *ctx) { case -1: __xmlIOErr(XML_FROM_FTP, 0, "select"); return(-1); - + } return(xmlNanoFTPReadResponse(ctx)); @@ -772,7 +775,7 @@ xmlNanoFTPSendUser(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); return(res); @@ -800,7 +803,7 @@ xmlNanoFTPSendPasswd(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); return(res); @@ -824,14 +827,14 @@ xmlNanoFTPQuit(void *ctx) { char buf[200]; 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"); len = strlen(buf); #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); /* Just to be consistent, even though we know it can't have a % in it */ #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); return(res); @@ -905,6 +908,8 @@ xmlNanoFTPConnect(void *ctx) { return (-1); } if (tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) { + if (result) + freeaddrinfo (result); __xmlIOErr(XML_FROM_FTP, 0, "gethostbyname address mismatch"); return (-1); } @@ -925,9 +930,9 @@ xmlNanoFTPConnect(void *ctx) { #endif { if (proxy) - hp = gethostbyname (proxy); + hp = gethostbyname (GETHOSTBYNAME_ARG_CAST proxy); else - hp = gethostbyname (ctxt->hostname); + hp = gethostbyname (GETHOSTBYNAME_ARG_CAST ctxt->hostname); if (hp == NULL) { __xmlIOErr(XML_FROM_FTP, 0, "gethostbyname failed"); return (-1); @@ -944,12 +949,13 @@ xmlNanoFTPConnect(void *ctx) { ((struct sockaddr_in *)&ctxt->ftpAddr)->sin_family = AF_INET; memcpy (&((struct sockaddr_in *)&ctxt->ftpAddr)->sin_addr, hp->h_addr_list[0], hp->h_length); - ((struct sockaddr_in *)&ctxt->ftpAddr)->sin_port = (u_short)htons ((unsigned short)port); + ((struct sockaddr_in *)&ctxt->ftpAddr)->sin_port = + (unsigned short)htons ((unsigned short)port); ctxt->controlFd = socket (AF_INET, SOCK_STREAM, 0); addrlen = sizeof (struct sockaddr_in); } - if (ctxt->controlFd < 0) { + if (ctxt->controlFd == INVALID_SOCKET) { __xmlIOErr(XML_FROM_FTP, 0, "socket failed"); return(-1); } @@ -960,8 +966,8 @@ xmlNanoFTPConnect(void *ctx) { if (connect(ctxt->controlFd, (struct sockaddr *) &ctxt->ftpAddr, addrlen) < 0) { __xmlIOErr(XML_FROM_FTP, 0, "Failed to create a connection"); - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(-1); } @@ -970,8 +976,8 @@ xmlNanoFTPConnect(void *ctx) { */ res = xmlNanoFTPGetResponse(ctxt); if (res != 2) { - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(-1); } @@ -1024,11 +1030,11 @@ xmlNanoFTPConnect(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->controlFd); - ctxt->controlFd = -1; + ctxt->controlFd = INVALID_SOCKET; return(res); } res = xmlNanoFTPGetResponse(ctxt); @@ -1046,17 +1052,17 @@ xmlNanoFTPConnect(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); closesocket(ctxt->controlFd); - ctxt->controlFd = -1; + ctxt->controlFd = INVALID_SOCKET; return(res); } res = xmlNanoFTPGetResponse(ctxt); if (res > 3) { closesocket(ctxt->controlFd); - ctxt->controlFd = -1; + ctxt->controlFd = INVALID_SOCKET; return(-1); } break; @@ -1067,7 +1073,7 @@ xmlNanoFTPConnect(void *ctx) { case -1: default: closesocket(ctxt->controlFd); - ctxt->controlFd = -1; + ctxt->controlFd = INVALID_SOCKET; return(-1); } } @@ -1087,11 +1093,11 @@ xmlNanoFTPConnect(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(res); } res = xmlNanoFTPGetResponse(ctxt); @@ -1099,10 +1105,10 @@ xmlNanoFTPConnect(void *ctx) { /* we assume it worked :-\ 1 is error for SITE command */ proxyType = 1; break; - } + } if (proxyType == 1) { - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(-1); } case 2: @@ -1118,11 +1124,11 @@ xmlNanoFTPConnect(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(res); } res = xmlNanoFTPGetResponse(ctxt); @@ -1130,7 +1136,7 @@ xmlNanoFTPConnect(void *ctx) { /* we assume it worked :-\ */ proxyType = 2; return(0); - } + } if (ctxt->passwd == NULL) snprintf(buf, sizeof(buf), "PASS anonymous@\r\n"); else @@ -1140,11 +1146,11 @@ xmlNanoFTPConnect(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(res); } res = xmlNanoFTPGetResponse(ctxt); @@ -1154,8 +1160,8 @@ xmlNanoFTPConnect(void *ctx) { return(0); } if (proxyType == 2) { - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(-1); } case 3: @@ -1164,8 +1170,8 @@ xmlNanoFTPConnect(void *ctx) { * send the code or at least the sequence in use. */ default: - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(-1); } } @@ -1174,8 +1180,8 @@ xmlNanoFTPConnect(void *ctx) { */ res = xmlNanoFTPSendUser(ctxt); if (res < 0) { - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(-1); } res = xmlNanoFTPGetResponse(ctxt); @@ -1189,14 +1195,14 @@ xmlNanoFTPConnect(void *ctx) { case 5: case -1: default: - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(-1); } res = xmlNanoFTPSendPasswd(ctxt); if (res < 0) { - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(-1); } res = xmlNanoFTPGetResponse(ctxt); @@ -1211,8 +1217,8 @@ xmlNanoFTPConnect(void *ctx) { case 5: case -1: default: - closesocket(ctxt->controlFd); ctxt->controlFd = -1; - ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; + ctxt->controlFd = INVALID_SOCKET; return(-1); } @@ -1235,12 +1241,18 @@ xmlNanoFTPConnectTo(const char *server, int port) { int res; xmlNanoFTPInit(); - if (server == NULL) + if (server == NULL) return(NULL); if (port <= 0) return(NULL); ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(NULL); + if (ctxt == NULL) + return(NULL); ctxt->hostname = xmlMemStrdup(server); + if (ctxt->hostname == NULL) { + xmlNanoFTPFreeCtxt(ctxt); + return(NULL); + } if (port != 0) ctxt->port = port; res = xmlNanoFTPConnect(ctxt); @@ -1268,7 +1280,7 @@ xmlNanoFTPCwd(void *ctx, const char *directory) { int len; int res; - if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); + if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET)) return(-1); if (directory == NULL) return 0; /* @@ -1284,7 +1296,7 @@ xmlNanoFTPCwd(void *ctx, const char *directory) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); return(res); @@ -1317,8 +1329,8 @@ xmlNanoFTPDele(void *ctx, const char *file) { int len; int res; - if ((ctxt == NULL) || (ctxt->controlFd < 0) || (file == NULL)) return(-1); - if (file == NULL) return (0); + if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET) || + (file == NULL)) return(-1); /* * Expected response code for DELE: @@ -1328,14 +1340,14 @@ xmlNanoFTPDele(void *ctx, const char *file) { * 450, 550 * 500, 501, 502, 421, 530 */ - + snprintf(buf, sizeof(buf), "DELE %s\r\n", file); buf[sizeof(buf) - 1] = 0; len = strlen(buf); #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); return(res); @@ -1360,7 +1372,7 @@ xmlNanoFTPDele(void *ctx, const char *file) { * Returns -1 incase of error, 0 otherwise */ -int +SOCKET xmlNanoFTPGetConnection(void *ctx) { xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; char buf[200], *cur; @@ -1375,7 +1387,7 @@ xmlNanoFTPGetConnection(void *ctx) { #endif XML_SOCKLEN_T dataAddrLen; - if (ctxt == NULL) return(-1); + if (ctxt == NULL) return INVALID_SOCKET; memset (&dataAddr, 0, sizeof(dataAddr)); #ifdef SUPPORT_IP6 @@ -1391,9 +1403,9 @@ xmlNanoFTPGetConnection(void *ctx) { dataAddrLen = sizeof (struct sockaddr_in); } - if (ctxt->dataFd < 0) { + if (ctxt->dataFd == INVALID_SOCKET) { __xmlIOErr(XML_FROM_FTP, 0, "socket failed"); - return (-1); + return INVALID_SOCKET; } if (ctxt->passive) { @@ -1407,36 +1419,36 @@ xmlNanoFTPGetConnection(void *ctx) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - return(res); + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + return INVALID_SOCKET; } res = xmlNanoFTPReadResponse(ctx); if (res != 2) { if (res == 5) { - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - return(-1); + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + return INVALID_SOCKET; } else { /* * retry with an active connection */ - closesocket(ctxt->dataFd); ctxt->dataFd = -1; + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; ctxt->passive = 0; } } - cur = &ctxt->controlBuf[ctxt->controlBufAnswer]; + cur = &ctxt->controlBuf[ctxt->controlBufAnswer]; while (((*cur < '0') || (*cur > '9')) && *cur != '\0') cur++; #ifdef SUPPORT_IP6 if ((ctxt->ftpAddr).ss_family == AF_INET6) { if (sscanf (cur, "%u", &temp[0]) != 1) { __xmlIOErr(XML_FROM_FTP, XML_FTP_EPSV_ANSWER, "Invalid answer to EPSV\n"); - if (ctxt->dataFd != -1) { - closesocket (ctxt->dataFd); ctxt->dataFd = -1; + if (ctxt->dataFd != INVALID_SOCKET) { + 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)); ((struct sockaddr_in6 *)&dataAddr)->sin6_port = htons (temp[0]); @@ -1448,10 +1460,10 @@ xmlNanoFTPGetConnection(void *ctx) { &temp[3], &temp[4], &temp[5]) != 6) { __xmlIOErr(XML_FROM_FTP, XML_FTP_PASV_ANSWER, "Invalid answer to PASV\n"); - if (ctxt->dataFd != -1) { - closesocket (ctxt->dataFd); ctxt->dataFd = -1; + if (ctxt->dataFd != INVALID_SOCKET) { + 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); memcpy (&((struct sockaddr_in *)&dataAddr)->sin_addr, &ad[0], 4); @@ -1460,8 +1472,8 @@ xmlNanoFTPGetConnection(void *ctx) { if (connect(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) { __xmlIOErr(XML_FROM_FTP, 0, "Failed to create a data connection"); - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - return (-1); + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + return INVALID_SOCKET; } } else { getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen); @@ -1474,15 +1486,15 @@ xmlNanoFTPGetConnection(void *ctx) { if (bind(ctxt->dataFd, (struct sockaddr *) &dataAddr, dataAddrLen) < 0) { __xmlIOErr(XML_FROM_FTP, 0, "bind failed"); - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - return (-1); + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + return INVALID_SOCKET; } getsockname(ctxt->dataFd, (struct sockaddr *) &dataAddr, &dataAddrLen); if (listen(ctxt->dataFd, 1) < 0) { __xmlIOErr(XML_FROM_FTP, 0, "listen failed"); - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - return (-1); + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + return INVALID_SOCKET; } #ifdef SUPPORT_IP6 if ((ctxt->ftpAddr).ss_family == AF_INET6) { @@ -1508,20 +1520,20 @@ xmlNanoFTPGetConnection(void *ctx) { xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - return(res); + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + return INVALID_SOCKET; } res = xmlNanoFTPGetResponse(ctxt); if (res != 2) { - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - return(-1); + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + return INVALID_SOCKET; } } return(ctxt->dataFd); - + } /** @@ -1540,9 +1552,9 @@ xmlNanoFTPCloseConnection(void *ctx) { fd_set rfd, efd; 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_usec = 0; FD_ZERO(&rfd); @@ -1554,7 +1566,7 @@ xmlNanoFTPCloseConnection(void *ctx) { #ifdef DEBUG_FTP perror("select"); #endif - closesocket(ctxt->controlFd); ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; return(-1); } if (res == 0) { @@ -1562,11 +1574,11 @@ xmlNanoFTPCloseConnection(void *ctx) { xmlGenericError(xmlGenericErrorContext, "xmlNanoFTPCloseConnection: timeout\n"); #endif - closesocket(ctxt->controlFd); ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; } else { res = xmlNanoFTPGetResponse(ctxt); if (res != 2) { - closesocket(ctxt->controlFd); ctxt->controlFd = -1; + closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET; return(-1); } } @@ -1579,7 +1591,7 @@ xmlNanoFTPCloseConnection(void *ctx) { * @callback: the user callback * @userData: the user callback data * - * Parse at most one entry from the listing. + * Parse at most one entry from the listing. * * Returns -1 incase of error, the length of data parsed otherwise */ @@ -1616,7 +1628,7 @@ xmlNanoFTPParseList(const char *list, ftpListCallback callback, void *userData) if (*cur == 0) return(0); i = 0; while (*cur != ' ') { - if (i < 10) + if (i < 10) attrib[i++] = *cur; cur++; if (*cur == 0) return(0); @@ -1630,7 +1642,7 @@ xmlNanoFTPParseList(const char *list, ftpListCallback callback, void *userData) if (*cur == 0) return(0); i = 0; while (*cur != ' ') { - if (i < 10) + if (i < 10) owner[i++] = *cur; cur++; if (*cur == 0) return(0); @@ -1640,7 +1652,7 @@ xmlNanoFTPParseList(const char *list, ftpListCallback callback, void *userData) if (*cur == 0) return(0); i = 0; while (*cur != ' ') { - if (i < 10) + if (i < 10) group[i++] = *cur; cur++; if (*cur == 0) return(0); @@ -1727,7 +1739,7 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData, if (xmlNanoFTPCwd(ctxt, ctxt->path) < 1) return(-1); ctxt->dataFd = xmlNanoFTPGetConnection(ctxt); - if (ctxt->dataFd == -1) + if (ctxt->dataFd == INVALID_SOCKET) return(-1); snprintf(buf, sizeof(buf), "LIST -L\r\n"); } else { @@ -1736,7 +1748,7 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData, return(-1); } ctxt->dataFd = xmlNanoFTPGetConnection(ctxt); - if (ctxt->dataFd == -1) + if (ctxt->dataFd == INVALID_SOCKET) return(-1); snprintf(buf, sizeof(buf), "LIST -L %s\r\n", filename); } @@ -1745,15 +1757,15 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData, #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); - closesocket(ctxt->dataFd); ctxt->dataFd = -1; + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; return(res); } res = xmlNanoFTPReadResponse(ctxt); if (res != 1) { - closesocket(ctxt->dataFd); ctxt->dataFd = -1; + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; return(-res); } @@ -1769,18 +1781,18 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData, #ifdef DEBUG_FTP perror("select"); #endif - closesocket(ctxt->dataFd); ctxt->dataFd = -1; + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; return(-1); } if (res == 0) { res = xmlNanoFTPCheckResponse(ctxt); if (res < 0) { - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - ctxt->dataFd = -1; + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + ctxt->dataFd = INVALID_SOCKET; return(-1); } if (res == 2) { - closesocket(ctxt->dataFd); ctxt->dataFd = -1; + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; return(0); } @@ -1789,8 +1801,8 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData, if ((len = recv(ctxt->dataFd, &buf[indx], sizeof(buf) - (indx + 1), 0)) < 0) { __xmlIOErr(XML_FROM_FTP, 0, "recv"); - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - ctxt->dataFd = -1; + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + ctxt->dataFd = INVALID_SOCKET; return(-1); } #ifdef DEBUG_FTP @@ -1822,34 +1834,34 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData, */ -int +SOCKET xmlNanoFTPGetSocket(void *ctx, const char *filename) { xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; char buf[300]; int res, len; if (ctx == NULL) - return(-1); + return INVALID_SOCKET; if ((filename == NULL) && (ctxt->path == NULL)) - return(-1); + return INVALID_SOCKET; ctxt->dataFd = xmlNanoFTPGetConnection(ctxt); - if (ctxt->dataFd == -1) - return(-1); + if (ctxt->dataFd == INVALID_SOCKET) + return INVALID_SOCKET; snprintf(buf, sizeof(buf), "TYPE I\r\n"); len = strlen(buf); #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - return(res); + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + return INVALID_SOCKET; } res = xmlNanoFTPReadResponse(ctxt); if (res != 2) { - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - return(-res); + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + return INVALID_SOCKET; } if (filename == NULL) snprintf(buf, sizeof(buf), "RETR %s\r\n", ctxt->path); @@ -1860,16 +1872,16 @@ xmlNanoFTPGetSocket(void *ctx, const char *filename) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, "%s", buf); #endif - res = send(ctxt->controlFd, buf, len, 0); + res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0); if (res < 0) { __xmlIOErr(XML_FROM_FTP, 0, "send failed"); - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - return(res); + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + return INVALID_SOCKET; } res = xmlNanoFTPReadResponse(ctxt); if (res != 1) { - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - return(-res); + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + return INVALID_SOCKET; } return(ctxt->dataFd); } @@ -1901,7 +1913,7 @@ xmlNanoFTPGet(void *ctx, ftpDataCallback callback, void *userData, return(-1); if (callback == NULL) return(-1); - if (xmlNanoFTPGetSocket(ctxt, filename) < 0) + if (xmlNanoFTPGetSocket(ctxt, filename) == INVALID_SOCKET) return(-1); do { @@ -1914,18 +1926,18 @@ xmlNanoFTPGet(void *ctx, ftpDataCallback callback, void *userData, #ifdef DEBUG_FTP perror("select"); #endif - closesocket(ctxt->dataFd); ctxt->dataFd = -1; + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; return(-1); } if (res == 0) { res = xmlNanoFTPCheckResponse(ctxt); if (res < 0) { - closesocket(ctxt->dataFd); ctxt->dataFd = -1; - ctxt->dataFd = -1; + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; + ctxt->dataFd = INVALID_SOCKET; return(-1); } if (res == 2) { - closesocket(ctxt->dataFd); ctxt->dataFd = -1; + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; return(0); } @@ -1934,7 +1946,7 @@ xmlNanoFTPGet(void *ctx, ftpDataCallback callback, void *userData, if ((len = recv(ctxt->dataFd, buf, sizeof(buf), 0)) < 0) { __xmlIOErr(XML_FROM_FTP, 0, "recv failed"); callback(userData, buf, len); - closesocket(ctxt->dataFd); ctxt->dataFd = -1; + closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET; return(-1); } callback(userData, buf, len); @@ -1960,7 +1972,7 @@ xmlNanoFTPRead(void *ctx, void *dest, int len) { xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; if (ctx == NULL) return(-1); - if (ctxt->dataFd < 0) return(0); + if (ctxt->dataFd == INVALID_SOCKET) return(0); if (dest == NULL) return(-1); if (len <= 0) return(0); @@ -1982,13 +1994,13 @@ xmlNanoFTPRead(void *ctx, void *dest, int len) { * * Start to fetch the given ftp:// resource * - * Returns an FTP context, or NULL + * Returns an FTP context, or NULL */ void* xmlNanoFTPOpen(const char *URL) { xmlNanoFTPCtxtPtr ctxt; - int sock; + SOCKET sock; xmlNanoFTPInit(); if (URL == NULL) return(NULL); @@ -2001,7 +2013,7 @@ xmlNanoFTPOpen(const char *URL) { return(NULL); } sock = xmlNanoFTPGetSocket(ctxt, ctxt->path); - if (sock < 0) { + if (sock == INVALID_SOCKET) { xmlNanoFTPFreeCtxt(ctxt); return(NULL); } @@ -2024,14 +2036,14 @@ xmlNanoFTPClose(void *ctx) { if (ctxt == NULL) return(-1); - if (ctxt->dataFd >= 0) { + if (ctxt->dataFd != INVALID_SOCKET) { closesocket(ctxt->dataFd); - ctxt->dataFd = -1; + ctxt->dataFd = INVALID_SOCKET; } - if (ctxt->controlFd >= 0) { + if (ctxt->controlFd != INVALID_SOCKET) { xmlNanoFTPQuit(ctxt); closesocket(ctxt->controlFd); - ctxt->controlFd = -1; + ctxt->controlFd = INVALID_SOCKET; } xmlNanoFTPFreeCtxt(ctxt); return(0); @@ -2039,9 +2051,9 @@ xmlNanoFTPClose(void *ctx) { #ifdef STANDALONE /************************************************************************ - * * - * Basic test in Standalone mode * - * * + * * + * Basic test in Standalone mode * + * * ************************************************************************/ static void ftpList(void *userData, const char *filename, const char* attrib, @@ -2056,7 +2068,7 @@ void ftpData(void *userData, const char *data, int len) { if (len <= 0) { fclose((FILE*)userData); return; - } + } fwrite(data, len, 1, (FILE*)userData); } @@ -2088,7 +2100,7 @@ int main(int argc, char **argv) { if (xmlNanoFTPGet(ctxt, ftpData, (void *) output, tstfile) < 0) xmlGenericError(xmlGenericErrorContext, "Failed to get file\n"); - + } xmlNanoFTPClose(ctxt); xmlMemoryDump(); diff --git a/gnulib-local/lib/libxml/nanoftp.in.h b/gnulib-local/lib/libxml/nanoftp.in.h index e3c28a0..abb4bf7 100644 --- a/gnulib-local/lib/libxml/nanoftp.in.h +++ b/gnulib-local/lib/libxml/nanoftp.in.h @@ -7,7 +7,7 @@ * * Author: Daniel Veillard */ - + #ifndef __NANO_FTP_H__ #define __NANO_FTP_H__ @@ -15,12 +15,32 @@ #ifdef LIBXML_FTP_ENABLED +/* Needed for portability to Windows 64 bits */ +#if defined(__MINGW32__) || defined(_WIN32_WCE) +#include +#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 + */ +#undef INVALID_SOCKET +#define INVALID_SOCKET (-1) +#endif + #ifdef __cplusplus extern "C" { #endif /** - * ftpListCallback: + * ftpListCallback: * @userData: user provided data for the callback * @filename: the file name (including "->" when links are shown) * @attrib: the attribute string @@ -44,7 +64,7 @@ typedef void (*ftpListCallback) (void *userData, const char *month, int day, int hour, int minute); /** - * ftpDataCallback: + * ftpDataCallback: * @userData: the user provided context * @data: the data received * @len: its size in bytes @@ -60,78 +80,78 @@ typedef void (*ftpDataCallback) (void *userData, */ XMLPUBFUN void XMLCALL xmlNanoFTPInit (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNanoFTPCleanup (void); /* * Creating/freeing contexts. */ -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlNanoFTPNewCtxt (const char *URL); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNanoFTPFreeCtxt (void * ctx); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlNanoFTPConnectTo (const char *server, int port); /* * Opening/closing session connections. */ -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlNanoFTPOpen (const char *URL); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPConnect (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPClose (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPQuit (void *ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNanoFTPScanProxy (const char *URL); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNanoFTPProxy (const char *host, int port, const char *user, const char *passwd, int type); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPUpdateURL (void *ctx, const char *URL); /* * Rather internal commands. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPGetResponse (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPCheckResponse (void *ctx); /* * CD/DIR/GET handlers. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPCwd (void *ctx, const char *directory); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPDele (void *ctx, const char *file); -XMLPUBFUN int XMLCALL +XMLPUBFUN SOCKET XMLCALL xmlNanoFTPGetConnection (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPCloseConnection(void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPList (void *ctx, ftpListCallback callback, void *userData, const char *filename); -XMLPUBFUN int XMLCALL +XMLPUBFUN SOCKET XMLCALL xmlNanoFTPGetSocket (void *ctx, const char *filename); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPGet (void *ctx, ftpDataCallback callback, void *userData, const char *filename); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoFTPRead (void *ctx, void *dest, int len); diff --git a/gnulib-local/lib/libxml/nanohttp.c b/gnulib-local/lib/libxml/nanohttp.c index ae7923f..e109ad7 100644 --- a/gnulib-local/lib/libxml/nanohttp.c +++ b/gnulib-local/lib/libxml/nanohttp.c @@ -10,7 +10,7 @@ * * daniel@veillard.com */ - + #define NEED_SOCKETS #define IN_LIBXML #include "libxml.h" @@ -46,7 +46,7 @@ #include #endif #ifdef HAVE_FCNTL_H -#include +#include #endif #ifdef HAVE_ERRNO_H #include @@ -54,15 +54,16 @@ #ifdef HAVE_SYS_TIME_H #include #endif +#ifndef HAVE_POLL_H #ifdef HAVE_SYS_SELECT_H #include #endif +#else +#include +#endif #ifdef HAVE_STRINGS_H #include #endif -#ifdef SUPPORT_IP6 -#include -#endif #ifdef HAVE_ZLIB_H #include #endif @@ -71,19 +72,18 @@ #ifdef VMS #include #define XML_SOCKLEN_T unsigned int -#define SOCKET int #endif - -#ifdef __MINGW32__ +#if defined(__MINGW32__) || defined(_WIN32_WCE) +#ifndef _WINSOCKAPI_ #define _WINSOCKAPI_ +#endif #include #include #undef XML_SOCKLEN_T #define XML_SOCKLEN_T unsigned int #endif - #include #include #include @@ -96,10 +96,11 @@ * A couple portability macros */ #ifndef _WINSOCKAPI_ -#ifndef __BEOS__ +#if !defined(__BEOS__) || defined(__HAIKU__) #define closesocket(s) close(s) #endif #define SOCKET int +#define INVALID_SOCKET (-1) #endif #ifdef __BEOS__ @@ -111,9 +112,6 @@ #ifndef XML_SOCKLEN_T #define XML_SOCKLEN_T unsigned int #endif -#ifndef SOCKET -#define SOCKET int -#endif #ifdef STANDALONE #define DEBUG_HTTP @@ -147,6 +145,7 @@ typedef struct xmlNanoHTTPCtxt { int inlen; /* len of the input buffer */ int last; /* return code for last operation */ int returnValue; /* the protocol return value */ + int version; /* the protocol version */ int ContentLength; /* specified content length from HTTP header */ char *contentType; /* the MIME type for the input */ char *location; /* the new URL in case of redirect */ @@ -192,10 +191,10 @@ static int socket_errno(void) { #ifdef SUPPORT_IP6 static int have_ipv6(void) { - int s; + SOCKET s; s = socket (AF_INET6, SOCK_STREAM, 0); - if (s != -1) { + if (s != INVALID_SOCKET) { close (s); return (1); } @@ -214,7 +213,7 @@ void xmlNanoHTTPInit(void) { const char *env; #ifdef _WINSOCKAPI_ - WSADATA wsaData; + WSADATA wsaData; #endif if (initialized) @@ -277,22 +276,24 @@ xmlNanoHTTPCleanup(void) { static void xmlNanoHTTPScanURL(xmlNanoHTTPCtxtPtr ctxt, const char *URL) { xmlURIPtr uri; + int len; + /* * Clear any existing data from the context */ - if (ctxt->protocol != NULL) { + if (ctxt->protocol != NULL) { xmlFree(ctxt->protocol); ctxt->protocol = NULL; } - if (ctxt->hostname != NULL) { + if (ctxt->hostname != NULL) { xmlFree(ctxt->hostname); ctxt->hostname = NULL; } - if (ctxt->path != NULL) { + if (ctxt->path != NULL) { xmlFree(ctxt->path); ctxt->path = NULL; } - if (ctxt->query != NULL) { + if (ctxt->query != NULL) { xmlFree(ctxt->query); ctxt->query = NULL; } @@ -306,9 +307,17 @@ xmlNanoHTTPScanURL(xmlNanoHTTPCtxtPtr ctxt, const char *URL) { xmlFreeURI(uri); return; } - + ctxt->protocol = xmlMemStrdup(uri->scheme); - ctxt->hostname = xmlMemStrdup(uri->server); + /* special case of IPv6 addresses, the [] need to be removed */ + if ((uri->server != NULL) && (*uri->server == '[')) { + len = strlen(uri->server); + if ((len > 2) && (uri->server[len - 1] == ']')) { + ctxt->hostname = (char *) xmlCharStrndup(uri->server + 1, len -2); + } else + ctxt->hostname = xmlMemStrdup(uri->server); + } else + ctxt->hostname = xmlMemStrdup(uri->server); if (uri->path != NULL) ctxt->path = xmlMemStrdup(uri->path); else @@ -335,7 +344,7 @@ void xmlNanoHTTPScanProxy(const char *URL) { xmlURIPtr uri; - if (proxy != NULL) { + if (proxy != NULL) { xmlFree(proxy); proxy = NULL; } @@ -359,7 +368,7 @@ xmlNanoHTTPScanProxy(const char *URL) { xmlFreeURI(uri); return; } - + proxy = xmlMemStrdup(uri->server); if (uri->port != 0) proxyPort = uri->port; @@ -389,7 +398,7 @@ xmlNanoHTTPNewCtxt(const char *URL) { memset(ret, 0, sizeof(xmlNanoHTTPCtxt)); ret->port = 80; ret->returnValue = 0; - ret->fd = -1; + ret->fd = INVALID_SOCKET; ret->ContentLength = -1; xmlNanoHTTPScanURL(ret, URL); @@ -426,8 +435,8 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) { #endif ctxt->state = XML_NANO_HTTP_NONE; - if (ctxt->fd >= 0) closesocket(ctxt->fd); - ctxt->fd = -1; + if (ctxt->fd != INVALID_SOCKET) closesocket(ctxt->fd); + ctxt->fd = INVALID_SOCKET; xmlFree(ctxt); } @@ -440,51 +449,64 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) { */ static int -xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt, const char * xmt_ptr, int outlen) { - - int total_sent = 0; +xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt, const char *xmt_ptr, int outlen) +{ + int total_sent = 0; +#ifdef HAVE_POLL_H + struct pollfd p; +#else + struct timeval tv; + fd_set wfd; +#endif - if ( (ctxt->state & XML_NANO_HTTP_WRITE) && (xmt_ptr != NULL ) ) { + if ((ctxt->state & XML_NANO_HTTP_WRITE) && (xmt_ptr != NULL)) { while (total_sent < outlen) { - int nsent = send(ctxt->fd, xmt_ptr + total_sent, - outlen - total_sent, 0); - if (nsent>0) + int nsent = send(ctxt->fd, SEND_ARG2_CAST (xmt_ptr + total_sent), + outlen - total_sent, 0); + + if (nsent > 0) total_sent += nsent; - else if ( ( nsent == -1 ) && + else if ((nsent == -1) && #if defined(EAGAIN) && EAGAIN != EWOULDBLOCK - ( socket_errno( ) != EAGAIN ) && + (socket_errno() != EAGAIN) && +#endif + (socket_errno() != EWOULDBLOCK)) { + __xmlIOErr(XML_FROM_HTTP, 0, "send failed\n"); + if (total_sent == 0) + total_sent = -1; + break; + } else { + /* + * No data sent + * Since non-blocking sockets are used, wait for + * socket to be writable or default timeout prior + * to retrying. + */ +#ifndef HAVE_POLL_H +#ifndef _WINSOCKAPI_ + if (ctxt->fd > FD_SETSIZE) + return -1; #endif - ( socket_errno( ) != EWOULDBLOCK ) ) { - __xmlIOErr(XML_FROM_HTTP, 0, "send failed\n"); - if ( total_sent == 0 ) - total_sent = -1; - break; - } - else { - /* - ** No data sent - ** Since non-blocking sockets are used, wait for - ** socket to be writable or default timeout prior - ** to retrying. - */ - - struct timeval tv; - fd_set wfd; - - tv.tv_sec = timeout; - tv.tv_usec = 0; - FD_ZERO( &wfd ); + + tv.tv_sec = timeout; + tv.tv_usec = 0; + FD_ZERO(&wfd); #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4018) #endif - FD_SET( ctxt->fd, &wfd ); + FD_SET(ctxt->fd, &wfd); #ifdef _MSC_VER #pragma warning(pop) #endif - (void)select( ctxt->fd + 1, NULL, &wfd, NULL, &tv ); - } - } + (void) select(ctxt->fd + 1, NULL, &wfd, NULL, &tv); +#else + p.fd = ctxt->fd; + p.events = POLLOUT; + (void) poll(&p, 1, timeout * 1000); +#endif /* !HAVE_POLL_H */ + } + } } return total_sent; @@ -501,96 +523,119 @@ xmlNanoHTTPSend(xmlNanoHTTPCtxtPtr ctxt, const char * xmt_ptr, int outlen) { */ static int -xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt) { +xmlNanoHTTPRecv(xmlNanoHTTPCtxtPtr ctxt) +{ +#ifdef HAVE_POLL_H + struct pollfd p; +#else fd_set rfd; struct timeval tv; +#endif while (ctxt->state & XML_NANO_HTTP_READ) { - if (ctxt->in == NULL) { - ctxt->in = (char *) xmlMallocAtomic(65000 * sizeof(char)); - if (ctxt->in == NULL) { - xmlHTTPErrMemory("allocating input"); - ctxt->last = -1; - return(-1); - } - ctxt->inlen = 65000; - ctxt->inptr = ctxt->content = ctxt->inrptr = ctxt->in; - } - if (ctxt->inrptr > ctxt->in + XML_NANO_HTTP_CHUNK) { - int delta = ctxt->inrptr - ctxt->in; - int len = ctxt->inptr - ctxt->inrptr; - - memmove(ctxt->in, ctxt->inrptr, len); - ctxt->inrptr -= delta; - ctxt->content -= delta; - ctxt->inptr -= delta; - } + if (ctxt->in == NULL) { + ctxt->in = (char *) xmlMallocAtomic(65000 * sizeof(char)); + if (ctxt->in == NULL) { + xmlHTTPErrMemory("allocating input"); + ctxt->last = -1; + return (-1); + } + ctxt->inlen = 65000; + ctxt->inptr = ctxt->content = ctxt->inrptr = ctxt->in; + } + if (ctxt->inrptr > ctxt->in + XML_NANO_HTTP_CHUNK) { + int delta = ctxt->inrptr - ctxt->in; + int len = ctxt->inptr - ctxt->inrptr; + + memmove(ctxt->in, ctxt->inrptr, len); + ctxt->inrptr -= delta; + ctxt->content -= delta; + ctxt->inptr -= delta; + } if ((ctxt->in + ctxt->inlen) < (ctxt->inptr + XML_NANO_HTTP_CHUNK)) { - int d_inptr = ctxt->inptr - ctxt->in; - int d_content = ctxt->content - ctxt->in; - int d_inrptr = ctxt->inrptr - ctxt->in; - char * tmp_ptr = ctxt->in; + int d_inptr = ctxt->inptr - ctxt->in; + int d_content = ctxt->content - ctxt->in; + int d_inrptr = ctxt->inrptr - ctxt->in; + char *tmp_ptr = ctxt->in; - ctxt->inlen *= 2; + ctxt->inlen *= 2; ctxt->in = (char *) xmlRealloc(tmp_ptr, ctxt->inlen); - if (ctxt->in == NULL) { - xmlHTTPErrMemory("allocating input buffer"); - xmlFree( tmp_ptr ); - ctxt->last = -1; - return(-1); - } + if (ctxt->in == NULL) { + xmlHTTPErrMemory("allocating input buffer"); + xmlFree(tmp_ptr); + ctxt->last = -1; + return (-1); + } ctxt->inptr = ctxt->in + d_inptr; ctxt->content = ctxt->in + d_content; ctxt->inrptr = ctxt->in + d_inrptr; - } - ctxt->last = recv(ctxt->fd, ctxt->inptr, XML_NANO_HTTP_CHUNK, 0); - if (ctxt->last > 0) { - ctxt->inptr += ctxt->last; - return(ctxt->last); - } - if (ctxt->last == 0) { - return(0); - } - if (ctxt->last == -1) { - switch (socket_errno()) { - case EINPROGRESS: - case EWOULDBLOCK: + } + ctxt->last = recv(ctxt->fd, ctxt->inptr, XML_NANO_HTTP_CHUNK, 0); + if (ctxt->last > 0) { + ctxt->inptr += ctxt->last; + return (ctxt->last); + } + if (ctxt->last == 0) { + return (0); + } + if (ctxt->last == -1) { + switch (socket_errno()) { + case EINPROGRESS: + case EWOULDBLOCK: #if defined(EAGAIN) && EAGAIN != EWOULDBLOCK - case EAGAIN: + case EAGAIN: +#endif + break; + + case ECONNRESET: + case ESHUTDOWN: + return (0); + + default: + __xmlIOErr(XML_FROM_HTTP, 0, "recv failed\n"); + return (-1); + } + } +#ifdef HAVE_POLL_H + p.fd = ctxt->fd; + p.events = POLLIN; + if ((poll(&p, 1, timeout * 1000) < 1) +#if defined(EINTR) + && (errno != EINTR) +#endif + ) + return (0); +#else /* !HAVE_POLL_H */ +#ifndef _WINSOCKAPI_ + if (ctxt->fd > FD_SETSIZE) + return 0; #endif - break; - case ECONNRESET: - case ESHUTDOWN: - return ( 0 ); + tv.tv_sec = timeout; + tv.tv_usec = 0; + FD_ZERO(&rfd); - default: - __xmlIOErr(XML_FROM_HTTP, 0, "recv failed\n"); - return(-1); - } - } - - tv.tv_sec = timeout; - tv.tv_usec = 0; - FD_ZERO(&rfd); #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4018) #endif - FD_SET(ctxt->fd, &rfd); + + FD_SET(ctxt->fd, &rfd); + #ifdef _MSC_VER #pragma warning(pop) #endif - - if ( (select(ctxt->fd+1, &rfd, NULL, NULL, &tv)<1) + + if ((select(ctxt->fd + 1, &rfd, NULL, NULL, &tv) < 1) #if defined(EINTR) - && (errno != EINTR) + && (errno != EINTR) #endif - ) - return(0); + ) + return (0); +#endif /* !HAVE_POLL_H */ } - return(0); + return (0); } /** @@ -609,7 +654,7 @@ xmlNanoHTTPReadLine(xmlNanoHTTPCtxtPtr ctxt) { char buf[4096]; char *bp = buf; int rc; - + while (bp - buf < 4095) { if (ctxt->inrptr == ctxt->inptr) { if ( (rc = xmlNanoHTTPRecv(ctxt)) == 0) { @@ -687,6 +732,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) { } if ((*cur != 0) && (*cur != ' ') && (*cur != '\t')) return; ctxt->returnValue = ret; + ctxt->version = version; } else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"Content-Type:", 13)) { const xmlChar *charset, *last, *mime; cur += 13; @@ -745,9 +791,9 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) { xmlFree(ctxt->location); if (*cur == '/') { xmlChar *tmp_http = xmlStrdup(BAD_CAST "http://"); - xmlChar *tmp_loc = + xmlChar *tmp_loc = xmlStrcat(tmp_http, (const xmlChar *) ctxt->hostname); - ctxt->location = + ctxt->location = (char *) xmlStrcat (tmp_loc, (const xmlChar *) cur); } else { ctxt->location = xmlMemStrdup(cur); @@ -801,154 +847,183 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) { * Returns -1 in case of failure, the file descriptor number otherwise */ -static int +static SOCKET xmlNanoHTTPConnectAttempt(struct sockaddr *addr) { +#ifndef HAVE_POLL_H fd_set wfd; #ifdef _WINSOCKAPI_ fd_set xfd; #endif struct timeval tv; +#else /* !HAVE_POLL_H */ + struct pollfd p; +#endif /* !HAVE_POLL_H */ int status; + int addrlen; + SOCKET s; - + #ifdef SUPPORT_IP6 if (addr->sa_family == AF_INET6) { - s = socket (PF_INET6, SOCK_STREAM, IPPROTO_TCP); - addrlen = sizeof (struct sockaddr_in6); - } - else + s = socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP); + addrlen = sizeof(struct sockaddr_in6); + } else #endif { - s = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP); - addrlen = sizeof (struct sockaddr_in); + s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + addrlen = sizeof(struct sockaddr_in); } - if (s==-1) { + if (s == INVALID_SOCKET) { #ifdef DEBUG_HTTP - perror("socket"); + perror("socket"); #endif - __xmlIOErr(XML_FROM_HTTP, 0, "socket failed\n"); - return(-1); + __xmlIOErr(XML_FROM_HTTP, 0, "socket failed\n"); + return INVALID_SOCKET; } - #ifdef _WINSOCKAPI_ { - u_long one = 1; + u_long one = 1; - status = ioctlsocket(s, FIONBIO, &one) == SOCKET_ERROR ? -1 : 0; + status = ioctlsocket(s, FIONBIO, &one) == SOCKET_ERROR ? -1 : 0; } #else /* _WINSOCKAPI_ */ #if defined(VMS) { - int enable = 1; - status = ioctl(s, FIONBIO, &enable); + int enable = 1; + + status = ioctl(s, FIONBIO, &enable); } #else /* VMS */ -#if defined(__BEOS__) - { - bool noblock = true; - status = setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &noblock, sizeof(noblock)); - } +#if defined(__BEOS__) && !defined(__HAIKU__) + { + bool noblock = true; + + status = + setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &noblock, + sizeof(noblock)); + } #else /* __BEOS__ */ if ((status = fcntl(s, F_GETFL, 0)) != -1) { #ifdef O_NONBLOCK - status |= O_NONBLOCK; + status |= O_NONBLOCK; #else /* O_NONBLOCK */ #ifdef F_NDELAY - status |= F_NDELAY; + status |= F_NDELAY; #endif /* F_NDELAY */ #endif /* !O_NONBLOCK */ - status = fcntl(s, F_SETFL, status); + status = fcntl(s, F_SETFL, status); } if (status < 0) { #ifdef DEBUG_HTTP - perror("nonblocking"); + perror("nonblocking"); #endif - __xmlIOErr(XML_FROM_HTTP, 0, "error setting non-blocking IO\n"); - closesocket(s); - return(-1); + __xmlIOErr(XML_FROM_HTTP, 0, "error setting non-blocking IO\n"); + closesocket(s); + return INVALID_SOCKET; } #endif /* !__BEOS__ */ #endif /* !VMS */ #endif /* !_WINSOCKAPI_ */ - if (connect (s, addr, addrlen) == -1) { - switch (socket_errno()) { - case EINPROGRESS: - case EWOULDBLOCK: - break; - default: - __xmlIOErr(XML_FROM_HTTP, 0, "error connecting to HTTP server"); - closesocket(s); - return(-1); - } - } - + if (connect(s, addr, addrlen) == -1) { + switch (socket_errno()) { + case EINPROGRESS: + case EWOULDBLOCK: + break; + default: + __xmlIOErr(XML_FROM_HTTP, 0, + "error connecting to HTTP server"); + closesocket(s); + return INVALID_SOCKET; + } + } +#ifndef HAVE_POLL_H tv.tv_sec = timeout; tv.tv_usec = 0; #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4018) +#endif +#ifndef _WINSOCKAPI_ + if (s > FD_SETSIZE) + return INVALID_SOCKET; #endif FD_ZERO(&wfd); FD_SET(s, &wfd); -#ifdef _WINSOCKAPI_ +#ifdef _WINSOCKAPI_ FD_ZERO(&xfd); FD_SET(s, &xfd); - - switch(select(s+1, NULL, &wfd, &xfd, &tv)) + + switch (select(s + 1, NULL, &wfd, &xfd, &tv)) #else - switch(select(s+1, NULL, &wfd, NULL, &tv)) + switch (select(s + 1, NULL, &wfd, NULL, &tv)) #endif #ifdef _MSC_VER #pragma warning(pop) #endif + +#else /* !HAVE_POLL_H */ + p.fd = s; + p.events = POLLOUT; + switch (poll(&p, 1, timeout * 1000)) +#endif /* !HAVE_POLL_H */ + { - case 0: - /* Time out */ - __xmlIOErr(XML_FROM_HTTP, 0, "Connect attempt timed out"); - closesocket(s); - return(-1); - case -1: - /* Ermm.. ?? */ - __xmlIOErr(XML_FROM_HTTP, 0, "Connect failed"); - closesocket(s); - return(-1); + case 0: + /* Time out */ + __xmlIOErr(XML_FROM_HTTP, 0, "Connect attempt timed out"); + closesocket(s); + return INVALID_SOCKET; + case -1: + /* Ermm.. ?? */ + __xmlIOErr(XML_FROM_HTTP, 0, "Connect failed"); + closesocket(s); + return INVALID_SOCKET; } - if ( FD_ISSET(s, &wfd) +#ifndef HAVE_POLL_H + if (FD_ISSET(s, &wfd) #ifdef _WINSOCKAPI_ - || FD_ISSET(s, &xfd) + || FD_ISSET(s, &xfd) #endif - ) { - XML_SOCKLEN_T len; - len = sizeof(status); + ) +#else /* !HAVE_POLL_H */ + if (p.revents == POLLOUT) +#endif /* !HAVE_POLL_H */ + { + XML_SOCKLEN_T len; + + len = sizeof(status); #ifdef SO_ERROR - if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*)&status, &len) < 0 ) { - /* Solaris error code */ - __xmlIOErr(XML_FROM_HTTP, 0, "getsockopt failed\n"); - return (-1); - } -#endif - if ( status ) { - __xmlIOErr(XML_FROM_HTTP, 0, "Error connecting to remote host"); - closesocket(s); - errno = status; - return (-1); - } + if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &status, &len) < + 0) { + /* Solaris error code */ + __xmlIOErr(XML_FROM_HTTP, 0, "getsockopt failed\n"); + closesocket(s); + return INVALID_SOCKET; + } +#endif + if (status) { + __xmlIOErr(XML_FROM_HTTP, 0, + "Error connecting to remote host"); + closesocket(s); + errno = status; + return INVALID_SOCKET; + } } else { - /* pbm */ - __xmlIOErr(XML_FROM_HTTP, 0, "select failed\n"); - closesocket(s); - return (-1); + /* pbm */ + __xmlIOErr(XML_FROM_HTTP, 0, "select failed\n"); + closesocket(s); + return INVALID_SOCKET; } - - return(s); + + return (s); } - + /** * xmlNanoHTTPConnectHost: * @host: the host name @@ -960,7 +1035,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr) * Returns -1 in case of failure, the file descriptor number otherwise */ -static int +static SOCKET xmlNanoHTTPConnectHost(const char *host, int port) { struct hostent *h; @@ -973,7 +1048,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) struct sockaddr_in6 sockin6; #endif int i; - int s; + SOCKET s; memset (&sockin, 0, sizeof(sockin)); #ifdef SUPPORT_IP6 @@ -1004,7 +1079,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) status = getaddrinfo (host, NULL, &hints, &result); if (status) { __xmlIOErr(XML_FROM_HTTP, 0, "getaddrinfo failed\n"); - return (-1); + return INVALID_SOCKET; } for (res = result; res; res = res->ai_next) { @@ -1012,7 +1087,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) if (res->ai_addrlen > sizeof(sockin)) { __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); freeaddrinfo (result); - return (-1); + return INVALID_SOCKET; } memcpy (&sockin, res->ai_addr, res->ai_addrlen); sockin.sin_port = htons (port); @@ -1022,7 +1097,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) if (res->ai_addrlen > sizeof(sockin6)) { __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); freeaddrinfo (result); - return (-1); + return INVALID_SOCKET; } memcpy (&sockin6, res->ai_addr, res->ai_addrlen); sockin6.sin6_port = htons (port); @@ -1032,7 +1107,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) continue; /* for */ s = xmlNanoHTTPConnectAttempt (addr); - if (s != -1) { + if (s != INVALID_SOCKET) { freeaddrinfo (result); return (s); } @@ -1047,7 +1122,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) #endif #if !defined(HAVE_GETADDRINFO) || !defined(_WIN32) { - h = gethostbyname (host); + h = gethostbyname (GETHOSTBYNAME_ARG_CAST host); if (h == NULL) { /* @@ -1073,10 +1148,12 @@ xmlNanoHTTPConnectHost(const char *host, int port) "Non-recoverable errors: FORMERR, REFUSED, or NOTIMP."; break; +#ifdef NO_ADDRESS case NO_ADDRESS: h_err_txt = "Valid name, no data record of requested type."; break; +#endif default: h_err_txt = "No error text defined."; @@ -1086,7 +1163,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) #else __xmlIOErr(XML_FROM_HTTP, 0, "Failed to resolve host"); #endif - return (-1); + return INVALID_SOCKET; } for (i = 0; h->h_addr_list[i]; i++) { @@ -1094,19 +1171,19 @@ xmlNanoHTTPConnectHost(const char *host, int port) /* A records (IPv4) */ if ((unsigned int) h->h_length > sizeof(ia)) { __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); - return (-1); + return INVALID_SOCKET; } memcpy (&ia, h->h_addr_list[i], h->h_length); sockin.sin_family = h->h_addrtype; sockin.sin_addr = ia; - sockin.sin_port = (u_short)htons ((unsigned short)port); + sockin.sin_port = (unsigned short)htons ((unsigned short)port); addr = (struct sockaddr *) &sockin; #ifdef SUPPORT_IP6 } else if (have_ipv6 () && (h->h_addrtype == AF_INET6)) { /* AAAA records (IPv6) */ if ((unsigned int) h->h_length > sizeof(ia6)) { __xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n"); - return (-1); + return INVALID_SOCKET; } memcpy (&ia6, h->h_addr_list[i], h->h_length); sockin6.sin6_family = h->h_addrtype; @@ -1118,7 +1195,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) break; /* for */ s = xmlNanoHTTPConnectAttempt (addr); - if (s != -1) + if (s != INVALID_SOCKET) return (s); } } @@ -1129,7 +1206,7 @@ xmlNanoHTTPConnectHost(const char *host, int port) "xmlNanoHTTPConnectHost: unable to connect to '%s'.\n", host); #endif - return (-1); + return INVALID_SOCKET; } @@ -1201,19 +1278,22 @@ xmlNanoHTTPRead(void *ctx, void *dest, int len) { #ifdef HAVE_ZLIB_H if (ctxt->usesGzip == 1) { if (ctxt->strm == NULL) return(0); - + ctxt->strm->next_out = dest; ctxt->strm->avail_out = len; + ctxt->strm->avail_in = ctxt->inptr - ctxt->inrptr; - do { - orig_avail_in = ctxt->strm->avail_in = ctxt->inptr - ctxt->inrptr - bytes_read; + while (ctxt->strm->avail_out > 0 && + (ctxt->strm->avail_in > 0 || xmlNanoHTTPRecv(ctxt) > 0)) { + orig_avail_in = ctxt->strm->avail_in = + ctxt->inptr - ctxt->inrptr - bytes_read; ctxt->strm->next_in = BAD_CAST (ctxt->inrptr + bytes_read); z_ret = inflate(ctxt->strm, Z_NO_FLUSH); bytes_read += orig_avail_in - ctxt->strm->avail_in; if (z_ret != Z_OK) break; - } while (ctxt->strm->avail_out > 0 && xmlNanoHTTPRecv(ctxt) > 0); + } ctxt->inrptr += bytes_read; return(len - ctxt->strm->avail_out); @@ -1270,30 +1350,30 @@ xmlNanoHTTPMethodRedir(const char *URL, const char *method, const char *input, const char *headers, int ilen ) { xmlNanoHTTPCtxtPtr ctxt; char *bp, *p; - int blen, ret; - int head; + int blen; + SOCKET ret; int nbRedirects = 0; char *redirURL = NULL; #ifdef DEBUG_HTTP int xmt_bytes; #endif - + if (URL == NULL) return(NULL); if (method == NULL) method = "GET"; xmlNanoHTTPInit(); retry: - if (redirURL == NULL) + if (redirURL == NULL) { ctxt = xmlNanoHTTPNewCtxt(URL); - else { + if (ctxt == NULL) + return(NULL); + } else { ctxt = xmlNanoHTTPNewCtxt(redirURL); + if (ctxt == NULL) + return(NULL); ctxt->location = xmlMemStrdup(redirURL); } - if ( ctxt == NULL ) { - return ( NULL ); - } - if ((ctxt->protocol == NULL) || (strcmp(ctxt->protocol, "http"))) { __xmlIOErr(XML_FROM_HTTP, XML_HTTP_URL_SYNTAX, "Not a valid HTTP URI"); xmlNanoHTTPFreeCtxt(ctxt); @@ -1315,7 +1395,7 @@ retry: blen = strlen(ctxt->hostname); ret = xmlNanoHTTPConnectHost(ctxt->hostname, ctxt->port); } - if (ret < 0) { + if (ret == INVALID_SOCKET) { xmlNanoHTTPFreeCtxt(ctxt); if (redirURL != NULL) xmlFree(redirURL); return(NULL); @@ -1330,13 +1410,23 @@ retry: if (headers != NULL) blen += strlen(headers) + 2; if (contentType && *contentType) + /* reserve for string plus 'Content-Type: \r\n" */ blen += strlen(*contentType) + 16; if (ctxt->query != NULL) + /* 1 for '?' */ blen += strlen(ctxt->query) + 1; blen += strlen(method) + strlen(ctxt->path) + 24; #ifdef HAVE_ZLIB_H + /* reserve for possible 'Accept-Encoding: gzip' string */ blen += 23; #endif + if (ctxt->port != 80) { + /* reserve space for ':xxxxx', incl. potential proxy */ + if (proxy) + blen += 12; + else + blen += 6; + } bp = (char*)xmlMallocAtomic(blen); if ( bp == NULL ) { xmlNanoHTTPFreeCtxt( ctxt ); @@ -1348,13 +1438,13 @@ retry: if (proxy) { if (ctxt->port != 80) { - p += snprintf( p, blen - (p - bp), "%s http://%s:%d%s", + p += snprintf( p, blen - (p - bp), "%s http://%s:%d%s", method, ctxt->hostname, - ctxt->port, ctxt->path ); + ctxt->port, ctxt->path ); } - else + else p += snprintf( p, blen - (p - bp), "%s http://%s%s", method, - ctxt->hostname, ctxt->path); + ctxt->hostname, ctxt->path); } else p += snprintf( p, blen - (p - bp), "%s %s", method, ctxt->path); @@ -1362,14 +1452,19 @@ retry: if (ctxt->query != NULL) p += snprintf( p, blen - (p - bp), "?%s", ctxt->query); - p += snprintf( p, blen - (p - bp), " HTTP/1.0\r\nHost: %s\r\n", + if (ctxt->port == 80) { + p += snprintf( p, blen - (p - bp), " HTTP/1.0\r\nHost: %s\r\n", ctxt->hostname); + } else { + p += snprintf( p, blen - (p - bp), " HTTP/1.0\r\nHost: %s:%d\r\n", + ctxt->hostname, ctxt->port); + } #ifdef HAVE_ZLIB_H p += snprintf(p, blen - (p - bp), "Accept-Encoding: gzip\r\n"); #endif - if (contentType != NULL && *contentType) + if (contentType != NULL && *contentType) p += snprintf(p, blen - (p - bp), "Content-Type: %s\r\n", *contentType); if (headers != NULL) @@ -1408,7 +1503,7 @@ retry: if ( xmt_bytes != ilen ) xmlGenericError( xmlGenericErrorContext, - "xmlNanoHTTPMethodRedir: Only %d of %d %s %s\n", + "xmlNanoHTTPMethodRedir: Only %d of %d %s %s\n", xmt_bytes, ilen, "bytes of HTTP content sent to host", ctxt->hostname ); @@ -1418,11 +1513,9 @@ retry: } ctxt->state = XML_NANO_HTTP_READ; - head = 1; while ((p = xmlNanoHTTPReadLine(ctxt)) != NULL) { - if (head && (*p == 0)) { - head = 0; + if (*p == 0) { ctxt->content = ctxt->inrptr; xmlFree(p); break; @@ -1532,12 +1625,13 @@ xmlNanoHTTPFetch(const char *URL, const char *filename, char **contentType) { char *buf = NULL; int fd; int len; - + int ret = 0; + if (filename == NULL) return(-1); ctxt = xmlNanoHTTPOpen(URL, contentType); if (ctxt == NULL) return(-1); - if (!strcmp(filename, "-")) + if (!strcmp(filename, "-")) fd = 0; else { fd = open(filename, O_CREAT | O_WRONLY, 00644); @@ -1553,12 +1647,14 @@ xmlNanoHTTPFetch(const char *URL, const char *filename, char **contentType) { xmlNanoHTTPFetchContent( ctxt, &buf, &len ); if ( len > 0 ) { - write(fd, buf, len); + if (write(fd, buf, len) == -1) { + ret = -1; + } } xmlNanoHTTPClose(ctxt); close(fd); - return(0); + return(ret); } #ifdef LIBXML_OUTPUT_ENABLED @@ -1577,13 +1673,14 @@ xmlNanoHTTPSave(void *ctxt, const char *filename) { char *buf = NULL; int fd; int len; - + int ret = 0; + if ((ctxt == NULL) || (filename == NULL)) return(-1); - if (!strcmp(filename, "-")) + if (!strcmp(filename, "-")) fd = 0; else { - fd = open(filename, O_CREAT | O_WRONLY); + fd = open(filename, O_CREAT | O_WRONLY, 0666); if (fd < 0) { xmlNanoHTTPClose(ctxt); return(-1); @@ -1592,12 +1689,14 @@ xmlNanoHTTPSave(void *ctxt, const char *filename) { xmlNanoHTTPFetchContent( ctxt, &buf, &len ); if ( len > 0 ) { - write(fd, buf, len); + if (write(fd, buf, len) == -1) { + ret = -1; + } } xmlNanoHTTPClose(ctxt); close(fd); - return(0); + return(ret); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -1707,7 +1806,7 @@ xmlNanoHTTPMimeType( void * ctx ) { * Check if all the content was read * * Returns 0 if all the content was read and available, returns - * -1 if received content length was less than specified or an error + * -1 if received content length was less than specified or an error * occurred. */ static int @@ -1761,7 +1860,7 @@ int main(int argc, char **argv) { char *contentType = NULL; if (argv[1] != NULL) { - if (argv[2] != NULL) + if (argv[2] != NULL) xmlNanoHTTPFetch(argv[1], argv[2], &contentType); else xmlNanoHTTPFetch(argv[1], "-", &contentType); diff --git a/gnulib-local/lib/libxml/nanohttp.in.h b/gnulib-local/lib/libxml/nanohttp.in.h index 1d8ac24..22b8fb4 100644 --- a/gnulib-local/lib/libxml/nanohttp.in.h +++ b/gnulib-local/lib/libxml/nanohttp.in.h @@ -7,7 +7,7 @@ * * Author: Daniel Veillard */ - + #ifndef __NANO_HTTP_H__ #define __NANO_HTTP_H__ @@ -20,22 +20,22 @@ extern "C" { #endif XMLPUBFUN void XMLCALL xmlNanoHTTPInit (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNanoHTTPCleanup (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNanoHTTPScanProxy (const char *URL); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoHTTPFetch (const char *URL, const char *filename, char **contentType); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlNanoHTTPMethod (const char *URL, const char *method, const char *input, char **contentType, const char *headers, int ilen); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlNanoHTTPMethodRedir (const char *URL, const char *method, const char *input, @@ -43,16 +43,16 @@ XMLPUBFUN void * XMLCALL char **redir, const char *headers, int ilen); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlNanoHTTPOpen (const char *URL, char **contentType); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlNanoHTTPOpenRedir (const char *URL, char **contentType, char **redir); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoHTTPReturnCode (void *ctx); -XMLPUBFUN const char * XMLCALL +XMLPUBFUN const char * XMLCALL xmlNanoHTTPAuthHeader (void *ctx); XMLPUBFUN const char * XMLCALL xmlNanoHTTPRedir (void *ctx); @@ -62,16 +62,16 @@ XMLPUBFUN const char * XMLCALL xmlNanoHTTPEncoding (void *ctx); XMLPUBFUN const char * XMLCALL xmlNanoHTTPMimeType (void *ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoHTTPRead (void *ctx, void *dest, int len); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNanoHTTPSave (void *ctxt, const char *filename); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNanoHTTPClose (void *ctx); #ifdef __cplusplus } diff --git a/gnulib-local/lib/libxml/parser.c b/gnulib-local/lib/libxml/parser.c index bd44585..c5741e3 100644 --- a/gnulib-local/lib/libxml/parser.c +++ b/gnulib-local/lib/libxml/parser.c @@ -17,7 +17,7 @@ * parserInternals.c to reduce this file size. * As much as possible the functions are associated with their relative * production in the XML specification. A few productions defining the - * different ranges of character are actually implanted either in + * different ranges of character are actually implanted either in * parserInternals.h or parserInternals.c * The DOM tree build is realized from the default SAX callbacks in * the module SAX.c. @@ -40,6 +40,7 @@ #endif #include +#include #include #include #include @@ -79,36 +80,193 @@ #ifdef HAVE_ZLIB_H #include #endif +#ifdef HAVE_LZMA_H +#include +#endif + +#include "buf.h" +#include "enc.h" + +static void +xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info); + +static xmlParserCtxtPtr +xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID, + const xmlChar *base, xmlParserCtxtPtr pctx); + +static void xmlHaltParser(xmlParserCtxtPtr ctxt); + +/************************************************************************ + * * + * Arbitrary limits set in the parser. See XML_PARSE_HUGE * + * * + ************************************************************************/ + +#define XML_PARSER_BIG_ENTITY 1000 +#define XML_PARSER_LOT_ENTITY 5000 + +/* + * XML_PARSER_NON_LINEAR is the threshold where the ratio of parsed entity + * replacement over the size in byte of the input indicates that you have + * and eponential behaviour. A value of 10 correspond to at least 3 entity + * replacement per byte of input. + */ +#define XML_PARSER_NON_LINEAR 10 + +/* + * xmlParserEntityCheck + * + * Function to check non-linear entity expansion behaviour + * This is here to detect and stop exponential linear entity expansion + * This is not a limitation of the parser but a safety + * boundary feature. It can be disabled with the XML_PARSE_HUGE + * parser option. + */ +static int +xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size, + xmlEntityPtr ent, size_t replacement) +{ + size_t consumed = 0; + + if ((ctxt == NULL) || (ctxt->options & XML_PARSE_HUGE)) + return (0); + if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) + return (1); + + /* + * This may look absurd but is needed to detect + * entities problems + */ + if ((ent != NULL) && (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && + (ent->content != NULL) && (ent->checked == 0)) { + unsigned long oldnbent = ctxt->nbentities; + xmlChar *rep; + + ent->checked = 1; + + rep = xmlStringDecodeEntities(ctxt, ent->content, + XML_SUBSTITUTE_REF, 0, 0, 0); + + ent->checked = (ctxt->nbentities - oldnbent + 1) * 2; + if (rep != NULL) { + if (xmlStrchr(rep, '<')) + ent->checked |= 1; + xmlFree(rep); + rep = NULL; + } + } + if (replacement != 0) { + if (replacement < XML_MAX_TEXT_LENGTH) + return(0); + + /* + * If the volume of entity copy reaches 10 times the + * amount of parsed data and over the large text threshold + * then that's very likely to be an abuse. + */ + if (ctxt->input != NULL) { + consumed = ctxt->input->consumed + + (ctxt->input->cur - ctxt->input->base); + } + consumed += ctxt->sizeentities; + + if (replacement < XML_PARSER_NON_LINEAR * consumed) + return(0); + } else if (size != 0) { + /* + * Do the check based on the replacement size of the entity + */ + if (size < XML_PARSER_BIG_ENTITY) + return(0); + + /* + * A limit on the amount of text data reasonably used + */ + if (ctxt->input != NULL) { + consumed = ctxt->input->consumed + + (ctxt->input->cur - ctxt->input->base); + } + consumed += ctxt->sizeentities; + + if ((size < XML_PARSER_NON_LINEAR * consumed) && + (ctxt->nbentities * 3 < XML_PARSER_NON_LINEAR * consumed)) + return (0); + } else if (ent != NULL) { + /* + * use the number of parsed entities in the replacement + */ + size = ent->checked / 2; + + /* + * The amount of data parsed counting entities size only once + */ + if (ctxt->input != NULL) { + consumed = ctxt->input->consumed + + (ctxt->input->cur - ctxt->input->base); + } + consumed += ctxt->sizeentities; + + /* + * Check the density of entities for the amount of data + * knowing an entity reference will take at least 3 bytes + */ + if (size * 3 < consumed * XML_PARSER_NON_LINEAR) + return (0); + } else { + /* + * strange we got no data for checking + */ + if (((ctxt->lastError.code != XML_ERR_UNDECLARED_ENTITY) && + (ctxt->lastError.code != XML_WAR_UNDECLARED_ENTITY)) || + (ctxt->nbentities <= 10000)) + return (0); + } + xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); + return (1); +} /** * xmlParserMaxDepth: * - * arbitrary depth limit for the XML documents that we allow to - * process. This is not a limitation of the parser but a safety - * boundary feature. + * arbitrary depth limit for the XML documents that we allow to + * process. This is not a limitation of the parser but a safety + * boundary feature. It can be disabled with the XML_PARSE_HUGE + * parser option. */ -unsigned int xmlParserMaxDepth = 1024; +unsigned int xmlParserMaxDepth = 256; -#define SAX2 1 + +#define SAX2 1 #define XML_PARSER_BIG_BUFFER_SIZE 300 #define XML_PARSER_BUFFER_SIZE 100 - #define SAX_COMPAT_MODE BAD_CAST "SAX compatibility mode document" +/** + * XML_PARSER_CHUNK_SIZE + * + * When calling GROW that's the minimal amount of data + * the parser expected to have received. It is not a hard + * limit but an optimization when reading strings like Names + * It is not strictly needed as long as inputs available characters + * are followed by 0, which should be provided by the I/O level + */ +#define XML_PARSER_CHUNK_SIZE 100 + /* * List of XML prefixed PI allowed by W3C specs */ static const char *xmlW3CPIs[] = { "xml-stylesheet", + "xml-model", NULL }; /* DEPR void xmlParserHandleReference(xmlParserCtxtPtr ctxt); */ -xmlEntityPtr xmlParseStringPEReference(xmlParserCtxtPtr ctxt, - const xmlChar **str); +static xmlEntityPtr xmlParseStringPEReference(xmlParserCtxtPtr ctxt, + const xmlChar **str); static xmlParserErrors xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, @@ -116,6 +274,9 @@ xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, void *user_data, int depth, const xmlChar *URL, const xmlChar *ID, xmlNodePtr *list); +static int +xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, + const char *encoding); #ifdef LIBXML_LEGACY_ENABLED static void xmlAddEntityReference(xmlEntityPtr ent, xmlNodePtr firstNode, @@ -126,9 +287,12 @@ static xmlParserErrors xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, const xmlChar *string, void *user_data, xmlNodePtr *lst); +static int +xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity); + /************************************************************************ * * - * Some factorized error routines * + * Some factorized error routines * * * ************************************************************************/ @@ -149,14 +313,15 @@ xmlErrAttributeDup(xmlParserCtxtPtr ctxt, const xmlChar * prefix, return; if (ctxt != NULL) ctxt->errNo = XML_ERR_ATTRIBUTE_REDEFINED; + if (prefix == NULL) __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, - ctxt->errNo, XML_ERR_FATAL, NULL, 0, + XML_ERR_ATTRIBUTE_REDEFINED, XML_ERR_FATAL, NULL, 0, (const char *) localname, NULL, NULL, 0, 0, "Attribute %s redefined\n", localname); else __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, - ctxt->errNo, XML_ERR_FATAL, NULL, 0, + XML_ERR_ATTRIBUTE_REDEFINED, XML_ERR_FATAL, NULL, 0, (const char *) prefix, (const char *) localname, NULL, 0, 0, "Attribute %s:%s redefined\n", prefix, localname); @@ -179,193 +344,201 @@ static void xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info) { const char *errmsg; + char errstr[129] = ""; if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; switch (error) { case XML_ERR_INVALID_HEX_CHARREF: - errmsg = "CharRef: invalid hexadecimal value\n"; + errmsg = "CharRef: invalid hexadecimal value"; break; case XML_ERR_INVALID_DEC_CHARREF: - errmsg = "CharRef: invalid decimal value\n"; + errmsg = "CharRef: invalid decimal value"; break; case XML_ERR_INVALID_CHARREF: - errmsg = "CharRef: invalid value\n"; + errmsg = "CharRef: invalid value"; break; case XML_ERR_INTERNAL_ERROR: errmsg = "internal error"; break; case XML_ERR_PEREF_AT_EOF: - errmsg = "PEReference at end of document\n"; + errmsg = "PEReference at end of document"; break; case XML_ERR_PEREF_IN_PROLOG: - errmsg = "PEReference in prolog\n"; + errmsg = "PEReference in prolog"; break; case XML_ERR_PEREF_IN_EPILOG: - errmsg = "PEReference in epilog\n"; + errmsg = "PEReference in epilog"; break; case XML_ERR_PEREF_NO_NAME: - errmsg = "PEReference: no name\n"; + errmsg = "PEReference: no name"; break; case XML_ERR_PEREF_SEMICOL_MISSING: - errmsg = "PEReference: expecting ';'\n"; + errmsg = "PEReference: expecting ';'"; break; case XML_ERR_ENTITY_LOOP: - errmsg = "Detected an entity reference loop\n"; + errmsg = "Detected an entity reference loop"; break; case XML_ERR_ENTITY_NOT_STARTED: - errmsg = "EntityValue: \" or ' expected\n"; + errmsg = "EntityValue: \" or ' expected"; break; case XML_ERR_ENTITY_PE_INTERNAL: - errmsg = "PEReferences forbidden in internal subset\n"; + errmsg = "PEReferences forbidden in internal subset"; break; case XML_ERR_ENTITY_NOT_FINISHED: - errmsg = "EntityValue: \" or ' expected\n"; + errmsg = "EntityValue: \" or ' expected"; break; case XML_ERR_ATTRIBUTE_NOT_STARTED: - errmsg = "AttValue: \" or ' expected\n"; + errmsg = "AttValue: \" or ' expected"; break; case XML_ERR_LT_IN_ATTRIBUTE: - errmsg = "Unescaped '<' not allowed in attributes values\n"; + errmsg = "Unescaped '<' not allowed in attributes values"; break; case XML_ERR_LITERAL_NOT_STARTED: - errmsg = "SystemLiteral \" or ' expected\n"; + errmsg = "SystemLiteral \" or ' expected"; break; case XML_ERR_LITERAL_NOT_FINISHED: - errmsg = "Unfinished System or Public ID \" or ' expected\n"; + errmsg = "Unfinished System or Public ID \" or ' expected"; break; case XML_ERR_MISPLACED_CDATA_END: - errmsg = "Sequence ']]>' not allowed in content\n"; + errmsg = "Sequence ']]>' not allowed in content"; break; case XML_ERR_URI_REQUIRED: - errmsg = "SYSTEM or PUBLIC, the URI is missing\n"; + errmsg = "SYSTEM or PUBLIC, the URI is missing"; break; case XML_ERR_PUBID_REQUIRED: - errmsg = "PUBLIC, the Public Identifier is missing\n"; + errmsg = "PUBLIC, the Public Identifier is missing"; break; case XML_ERR_HYPHEN_IN_COMMENT: - errmsg = "Comment must not contain '--' (double-hyphen)\n"; + errmsg = "Comment must not contain '--' (double-hyphen)"; break; case XML_ERR_PI_NOT_STARTED: - errmsg = "xmlParsePI : no target name\n"; + errmsg = "xmlParsePI : no target name"; break; case XML_ERR_RESERVED_XML_NAME: - errmsg = "Invalid PI name\n"; + errmsg = "Invalid PI name"; break; case XML_ERR_NOTATION_NOT_STARTED: - errmsg = "NOTATION: Name expected here\n"; + errmsg = "NOTATION: Name expected here"; break; case XML_ERR_NOTATION_NOT_FINISHED: - errmsg = "'>' required to close NOTATION declaration\n"; + errmsg = "'>' required to close NOTATION declaration"; break; case XML_ERR_VALUE_REQUIRED: - errmsg = "Entity value required\n"; + errmsg = "Entity value required"; break; case XML_ERR_URI_FRAGMENT: errmsg = "Fragment not allowed"; break; case XML_ERR_ATTLIST_NOT_STARTED: - errmsg = "'(' required to start ATTLIST enumeration\n"; + errmsg = "'(' required to start ATTLIST enumeration"; break; case XML_ERR_NMTOKEN_REQUIRED: - errmsg = "NmToken expected in ATTLIST enumeration\n"; + errmsg = "NmToken expected in ATTLIST enumeration"; break; case XML_ERR_ATTLIST_NOT_FINISHED: - errmsg = "')' required to finish ATTLIST enumeration\n"; + errmsg = "')' required to finish ATTLIST enumeration"; break; case XML_ERR_MIXED_NOT_STARTED: - errmsg = "MixedContentDecl : '|' or ')*' expected\n"; + errmsg = "MixedContentDecl : '|' or ')*' expected"; break; case XML_ERR_PCDATA_REQUIRED: - errmsg = "MixedContentDecl : '#PCDATA' expected\n"; + errmsg = "MixedContentDecl : '#PCDATA' expected"; break; case XML_ERR_ELEMCONTENT_NOT_STARTED: - errmsg = "ContentDecl : Name or '(' expected\n"; + errmsg = "ContentDecl : Name or '(' expected"; break; case XML_ERR_ELEMCONTENT_NOT_FINISHED: - errmsg = "ContentDecl : ',' '|' or ')' expected\n"; + errmsg = "ContentDecl : ',' '|' or ')' expected"; break; case XML_ERR_PEREF_IN_INT_SUBSET: errmsg = - "PEReference: forbidden within markup decl in internal subset\n"; + "PEReference: forbidden within markup decl in internal subset"; break; case XML_ERR_GT_REQUIRED: - errmsg = "expected '>'\n"; + errmsg = "expected '>'"; break; case XML_ERR_CONDSEC_INVALID: - errmsg = "XML conditional section '[' expected\n"; + errmsg = "XML conditional section '[' expected"; break; case XML_ERR_EXT_SUBSET_NOT_FINISHED: - errmsg = "Content error in the external subset\n"; + errmsg = "Content error in the external subset"; break; case XML_ERR_CONDSEC_INVALID_KEYWORD: errmsg = - "conditional section INCLUDE or IGNORE keyword expected\n"; + "conditional section INCLUDE or IGNORE keyword expected"; break; case XML_ERR_CONDSEC_NOT_FINISHED: - errmsg = "XML conditional section not closed\n"; + errmsg = "XML conditional section not closed"; break; case XML_ERR_XMLDECL_NOT_STARTED: - errmsg = "Text declaration '' expected\n"; + errmsg = "parsing XML declaration: '?>' expected"; break; case XML_ERR_EXT_ENTITY_STANDALONE: - errmsg = "external parsed entities cannot be standalone\n"; + errmsg = "external parsed entities cannot be standalone"; break; case XML_ERR_ENTITYREF_SEMICOL_MISSING: - errmsg = "EntityRef: expecting ';'\n"; + errmsg = "EntityRef: expecting ';'"; break; case XML_ERR_DOCTYPE_NOT_FINISHED: - errmsg = "DOCTYPE improperly terminated\n"; + errmsg = "DOCTYPE improperly terminated"; break; case XML_ERR_LTSLASH_REQUIRED: - errmsg = "EndTag: 'errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, - XML_ERR_FATAL, NULL, 0, info, NULL, NULL, 0, 0, errmsg, + XML_ERR_FATAL, NULL, 0, info, NULL, NULL, 0, 0, &errstr[0], info); if (ctxt != NULL) { ctxt->wellFormed = 0; @@ -392,7 +565,7 @@ xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, if (ctxt != NULL) ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, - XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, msg); + XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg); if (ctxt != NULL) { ctxt->wellFormed = 0; if (ctxt->recovery == 0) @@ -415,20 +588,28 @@ xmlWarningMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, const xmlChar *str1, const xmlChar *str2) { xmlStructuredErrorFunc schannel = NULL; - + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; if ((ctxt != NULL) && (ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) schannel = ctxt->sax->serror; - __xmlRaiseError(schannel, + if (ctxt != NULL) { + __xmlRaiseError(schannel, (ctxt->sax) ? ctxt->sax->warning : NULL, ctxt->userData, ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_WARNING, NULL, 0, (const char *) str1, (const char *) str2, NULL, 0, 0, msg, (const char *) str1, (const char *) str2); + } else { + __xmlRaiseError(schannel, NULL, NULL, + ctxt, NULL, XML_FROM_PARSER, error, + XML_ERR_WARNING, NULL, 0, + (const char *) str1, (const char *) str2, NULL, 0, 0, + msg, (const char *) str1, (const char *) str2); + } } /** @@ -442,7 +623,7 @@ xmlWarningMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, */ static void xmlValidityError(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar *str1) + const char *msg, const xmlChar *str1, const xmlChar *str2) { xmlStructuredErrorFunc schannel = NULL; @@ -454,14 +635,20 @@ xmlValidityError(xmlParserCtxtPtr ctxt, xmlParserErrors error, if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) schannel = ctxt->sax->serror; } - __xmlRaiseError(schannel, + if (ctxt != NULL) { + __xmlRaiseError(schannel, ctxt->vctxt.error, ctxt->vctxt.userData, ctxt, NULL, XML_FROM_DTD, error, XML_ERR_ERROR, NULL, 0, (const char *) str1, - NULL, NULL, 0, 0, - msg, (const char *) str1); - if (ctxt != NULL) { + (const char *) str2, NULL, 0, 0, + msg, (const char *) str1, (const char *) str2); ctxt->valid = 0; + } else { + __xmlRaiseError(schannel, NULL, NULL, + ctxt, NULL, XML_FROM_DTD, error, + XML_ERR_ERROR, NULL, 0, (const char *) str1, + (const char *) str2, NULL, 0, 0, + msg, (const char *) str1, (const char *) str2); } } @@ -506,7 +693,7 @@ xmlFatalErrMsgInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, */ static void xmlFatalErrMsgStrIntStr(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar *str1, int val, + const char *msg, const xmlChar *str1, int val, const xmlChar *str2) { if ((ctxt != NULL) && (ctxt->disableSAX != 0) && @@ -607,9 +794,34 @@ xmlNsErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, ctxt->nsWellFormed = 0; } +/** + * xmlNsWarn + * @ctxt: an XML parser context + * @error: the error number + * @msg: the message + * @info1: extra information string + * @info2: extra information string + * + * Handle a namespace warning error + */ +static void +xmlNsWarn(xmlParserCtxtPtr ctxt, xmlParserErrors error, + const char *msg, + const xmlChar * info1, const xmlChar * info2, + const xmlChar * info3) +{ + if ((ctxt != NULL) && (ctxt->disableSAX != 0) && + (ctxt->instate == XML_PARSER_EOF)) + return; + __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, + XML_ERR_WARNING, NULL, 0, (const char *) info1, + (const char *) info2, (const char *) info3, 0, 0, msg, + info1, info2, info3); +} + /************************************************************************ * * - * Library wide options * + * Library wide options * * * ************************************************************************/ @@ -806,12 +1018,24 @@ xmlHasFeature(xmlFeature feature) return(1); #else return(0); -#endif +#endif case XML_WITH_ZLIB: #ifdef LIBXML_ZLIB_ENABLED return(1); #else return(0); +#endif + case XML_WITH_LZMA: +#ifdef LIBXML_LZMA_ENABLED + return(1); +#else + return(0); +#endif + case XML_WITH_ICU: +#ifdef LIBXML_ICU_ENABLED + return(1); +#else + return(0); #endif default: break; @@ -821,7 +1045,7 @@ xmlHasFeature(xmlFeature feature) /************************************************************************ * * - * SAX2 defaulted attributes handling * + * SAX2 defaulted attributes handling * * * ************************************************************************/ @@ -845,8 +1069,8 @@ xmlDetectSAX2(xmlParserCtxtPtr ctxt) { ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3); ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5); ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); - if ((ctxt->str_xml==NULL) || (ctxt->str_xmlns==NULL) || - (ctxt->str_xml_ns == NULL)) { + if ((ctxt->str_xml==NULL) || (ctxt->str_xmlns==NULL) || + (ctxt->str_xml_ns == NULL)) { xmlErrMemory(ctxt, NULL); } } @@ -856,9 +1080,107 @@ typedef xmlDefAttrs *xmlDefAttrsPtr; struct _xmlDefAttrs { int nbAttrs; /* number of defaulted attributes on that element */ int maxAttrs; /* the size of the array */ - const xmlChar *values[4]; /* array of localname/prefix/values */ + const xmlChar *values[5]; /* array of localname/prefix/values/external */ }; +/** + * xmlAttrNormalizeSpace: + * @src: the source string + * @dst: the target string + * + * Normalize the space in non CDATA attribute values: + * If the attribute type is not CDATA, then the XML processor MUST further + * process the normalized attribute value by discarding any leading and + * trailing space (#x20) characters, and by replacing sequences of space + * (#x20) characters by a single space (#x20) character. + * Note that the size of dst need to be at least src, and if one doesn't need + * to preserve dst (and it doesn't come from a dictionary or read-only) then + * passing src as dst is just fine. + * + * Returns a pointer to the normalized value (dst) or NULL if no conversion + * is needed. + */ +static xmlChar * +xmlAttrNormalizeSpace(const xmlChar *src, xmlChar *dst) +{ + if ((src == NULL) || (dst == NULL)) + return(NULL); + + while (*src == 0x20) src++; + while (*src != 0) { + if (*src == 0x20) { + while (*src == 0x20) src++; + if (*src != 0) + *dst++ = 0x20; + } else { + *dst++ = *src++; + } + } + *dst = 0; + if (dst == src) + return(NULL); + return(dst); +} + +/** + * xmlAttrNormalizeSpace2: + * @src: the source string + * + * Normalize the space in non CDATA attribute values, a slightly more complex + * front end to avoid allocation problems when running on attribute values + * coming from the input. + * + * Returns a pointer to the normalized value (dst) or NULL if no conversion + * is needed. + */ +static const xmlChar * +xmlAttrNormalizeSpace2(xmlParserCtxtPtr ctxt, xmlChar *src, int *len) +{ + int i; + int remove_head = 0; + int need_realloc = 0; + const xmlChar *cur; + + if ((ctxt == NULL) || (src == NULL) || (len == NULL)) + return(NULL); + i = *len; + if (i <= 0) + return(NULL); + + cur = src; + while (*cur == 0x20) { + cur++; + remove_head++; + } + while (*cur != 0) { + if (*cur == 0x20) { + cur++; + if ((*cur == 0x20) || (*cur == 0)) { + need_realloc = 1; + break; + } + } else + cur++; + } + if (need_realloc) { + xmlChar *ret; + + ret = xmlStrndup(src + remove_head, i - remove_head + 1); + if (ret == NULL) { + xmlErrMemory(ctxt, NULL); + return(NULL); + } + xmlAttrNormalizeSpace(ret, ret); + *len = (int) strlen((const char *)ret); + return(ret); + } else if (remove_head) { + *len -= remove_head; + memmove(src, src + remove_head, 1 + *len); + return(src); + } + return(NULL); +} + /** * xmlAddDefAttrs: * @ctxt: an XML parser context @@ -878,6 +1200,14 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt, const xmlChar *name; const xmlChar *prefix; + /* + * Allows to detect attribute redefinitions + */ + if (ctxt->attsSpecial != NULL) { + if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL) + return; + } + if (ctxt->attsDefault == NULL) { ctxt->attsDefault = xmlHashCreateDict(10, ctxt->dict); if (ctxt->attsDefault == NULL) @@ -903,22 +1233,30 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt, defaults = xmlHashLookup2(ctxt->attsDefault, name, prefix); if (defaults == NULL) { defaults = (xmlDefAttrsPtr) xmlMalloc(sizeof(xmlDefAttrs) + - (4 * 4) * sizeof(const xmlChar *)); + (4 * 5) * sizeof(const xmlChar *)); if (defaults == NULL) goto mem_error; defaults->nbAttrs = 0; defaults->maxAttrs = 4; - xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, defaults, NULL); + if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, + defaults, NULL) < 0) { + xmlFree(defaults); + goto mem_error; + } } else if (defaults->nbAttrs >= defaults->maxAttrs) { xmlDefAttrsPtr temp; temp = (xmlDefAttrsPtr) xmlRealloc(defaults, sizeof(xmlDefAttrs) + - (2 * defaults->maxAttrs * 4) * sizeof(const xmlChar *)); + (2 * defaults->maxAttrs * 5) * sizeof(const xmlChar *)); if (temp == NULL) goto mem_error; defaults = temp; defaults->maxAttrs *= 2; - xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, defaults, NULL); + if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, + defaults, NULL) < 0) { + xmlFree(defaults); + goto mem_error; + } } /* @@ -934,13 +1272,17 @@ xmlAddDefAttrs(xmlParserCtxtPtr ctxt, prefix = xmlDictLookup(ctxt->dict, fullattr, len); } - defaults->values[4 * defaults->nbAttrs] = name; - defaults->values[4 * defaults->nbAttrs + 1] = prefix; + defaults->values[5 * defaults->nbAttrs] = name; + defaults->values[5 * defaults->nbAttrs + 1] = prefix; /* intern the string and precompute the end */ len = xmlStrlen(value); value = xmlDictLookup(ctxt->dict, value, len); - defaults->values[4 * defaults->nbAttrs + 2] = value; - defaults->values[4 * defaults->nbAttrs + 3] = value + len; + defaults->values[5 * defaults->nbAttrs + 2] = value; + defaults->values[5 * defaults->nbAttrs + 3] = value + len; + if (ctxt->external) + defaults->values[5 * defaults->nbAttrs + 4] = BAD_CAST "external"; + else + defaults->values[5 * defaults->nbAttrs + 4] = NULL; defaults->nbAttrs++; return; @@ -957,7 +1299,7 @@ mem_error: * @fullattr: the attribute fullname * @type: the attribute type * - * Register that this attribute is not CDATA + * Register this attribute type */ static void xmlAddSpecialAttr(xmlParserCtxtPtr ctxt, @@ -971,6 +1313,9 @@ xmlAddSpecialAttr(xmlParserCtxtPtr ctxt, goto mem_error; } + if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL) + return; + xmlHashAddEntry2(ctxt->attsSpecial, fullname, fullattr, (void *) (long) type); return; @@ -980,6 +1325,45 @@ mem_error: return; } +/** + * xmlCleanSpecialAttrCallback: + * + * Removes CDATA attributes from the special attribute table + */ +static void +xmlCleanSpecialAttrCallback(void *payload, void *data, + const xmlChar *fullname, const xmlChar *fullattr, + const xmlChar *unused ATTRIBUTE_UNUSED) { + xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) data; + + if (((long) payload) == XML_ATTRIBUTE_CDATA) { + xmlHashRemoveEntry2(ctxt->attsSpecial, fullname, fullattr, NULL); + } +} + +/** + * xmlCleanSpecialAttr: + * @ctxt: an XML parser context + * + * Trim the list of attributes defined to remove all those of type + * CDATA as they are not special. This call should be done when finishing + * to parse the DTD and before starting to parse the document root. + */ +static void +xmlCleanSpecialAttr(xmlParserCtxtPtr ctxt) +{ + if (ctxt->attsSpecial == NULL) + return; + + xmlHashScanFull(ctxt->attsSpecial, xmlCleanSpecialAttrCallback, ctxt); + + if (xmlHashSize(ctxt->attsSpecial) == 0) { + xmlHashFree(ctxt->attsSpecial, NULL); + ctxt->attsSpecial = NULL; + } + return; +} + /** * xmlCheckLanguageID: * @lang: pointer to the string value @@ -996,70 +1380,192 @@ mem_error: * [37] UserCode ::= ('x' | 'X') '-' ([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 **/ int xmlCheckLanguageID(const xmlChar * lang) { - const xmlChar *cur = lang; + const xmlChar *cur = lang, *nxt; if (cur == NULL) return (0); if (((cur[0] == 'i') && (cur[1] == '-')) || - ((cur[0] == 'I') && (cur[1] == '-'))) { - /* - * IANA code - */ - cur += 2; - while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */ - ((cur[0] >= 'a') && (cur[0] <= 'z'))) - cur++; - } else if (((cur[0] == 'x') && (cur[1] == '-')) || - ((cur[0] == 'X') && (cur[1] == '-'))) { + ((cur[0] == 'I') && (cur[1] == '-')) || + ((cur[0] == 'x') && (cur[1] == '-')) || + ((cur[0] == 'X') && (cur[1] == '-'))) { /* - * User 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; - 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] >= 'A') && (cur[0] <= 'Z')) || - ((cur[0] >= 'a') && (cur[0] <= 'z'))) { + return(cur[0] == 0); + } + nxt = cur; + while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) || + ((nxt[0] >= 'a') && (nxt[0] <= 'z'))) + nxt++; + if (nxt - cur >= 4) { /* - * ISO639 + * Reserved */ - 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++; + 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); + +region_m49: + if (((nxt[1] >= '0') && (nxt[1] <= '9')) && + ((nxt[2] >= '0') && (nxt[2] <= '9'))) { + nxt += 3; + goto region; + } + return(0); } /************************************************************************ * * - * Parser stacks related functions and macros * + * Parser stacks related functions and macros * * * ************************************************************************/ -xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, - const xmlChar ** str); +static xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, + const xmlChar ** str); #ifdef SAX2 /** @@ -1078,7 +1584,7 @@ nsPush(xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *URL) { if (ctxt->options & XML_PARSE_NSCLEAN) { int i; - for (i = 0;i < ctxt->nsNr;i += 2) { + for (i = ctxt->nsNr - 2;i >= 0;i -= 2) { if (ctxt->nsTab[i] == prefix) { /* in scope */ if (ctxt->nsTab[i + 1] == URL) @@ -1099,15 +1605,16 @@ nsPush(xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *URL) return (-1); } } else if (ctxt->nsNr >= ctxt->nsMax) { + const xmlChar ** tmp; ctxt->nsMax *= 2; - ctxt->nsTab = (const xmlChar **) - xmlRealloc((char *) ctxt->nsTab, - ctxt->nsMax * sizeof(ctxt->nsTab[0])); - if (ctxt->nsTab == NULL) { + tmp = (const xmlChar **) xmlRealloc((char *) ctxt->nsTab, + ctxt->nsMax * sizeof(ctxt->nsTab[0])); + if (tmp == NULL) { xmlErrMemory(ctxt, NULL); ctxt->nsMax /= 2; return (-1); } + ctxt->nsTab = tmp; } ctxt->nsTab[ctxt->nsNr++] = prefix; ctxt->nsTab[ctxt->nsNr++] = URL; @@ -1134,7 +1641,7 @@ nsPop(xmlParserCtxtPtr ctxt, int nr) } if (ctxt->nsNr <= 0) return (0); - + for (i = 0;i < nr;i++) { ctxt->nsNr--; ctxt->nsTab[ctxt->nsNr] = NULL; @@ -1184,13 +1691,13 @@ mem_error: * * Pushes a new parser input on top of the input stack * - * Returns 0 in case of error, the index in the stack otherwise + * Returns -1 in case of error, the index in the stack otherwise */ int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value) { if ((ctxt == NULL) || (value == NULL)) - return(0); + return(-1); if (ctxt->inputNr >= ctxt->inputMax) { ctxt->inputMax *= 2; ctxt->inputTab = @@ -1199,7 +1706,10 @@ inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value) sizeof(ctxt->inputTab[0])); if (ctxt->inputTab == NULL) { xmlErrMemory(ctxt, NULL); - return (0); + xmlFreeInputStream(value); + ctxt->inputMax /= 2; + value = NULL; + return (-1); } } ctxt->inputTab[ctxt->inputNr] = value; @@ -1239,7 +1749,7 @@ inputPop(xmlParserCtxtPtr ctxt) * * Pushes a new element node on top of the node stack * - * Returns 0 in case of error, the index in the stack otherwise + * Returns -1 in case of error, the index in the stack otherwise */ int nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value) @@ -1253,22 +1763,24 @@ nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value) sizeof(ctxt->nodeTab[0])); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); - return (0); + return (-1); } ctxt->nodeTab = tmp; ctxt->nodeMax *= 2; } - if (((unsigned int) ctxt->nodeNr) > xmlParserMaxDepth) { + if ((((unsigned int) ctxt->nodeNr) > xmlParserMaxDepth) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR, - "Excessive depth in document: change xmlParserMaxDepth = %d\n", + "Excessive depth in document: %d use XML_PARSE_HUGE option\n", xmlParserMaxDepth); - ctxt->instate = XML_PARSER_EOF; - return(0); + xmlHaltParser(ctxt); + return(-1); } ctxt->nodeTab[ctxt->nodeNr] = value; ctxt->node = value; return (ctxt->nodeNr++); } + /** * nodePop: * @ctxt: an XML parser context @@ -1384,15 +1896,14 @@ namePush(xmlParserCtxtPtr ctxt, const xmlChar * value) if (ctxt->nameNr >= ctxt->nameMax) { const xmlChar * *tmp; - ctxt->nameMax *= 2; tmp = (const xmlChar * *) xmlRealloc((xmlChar * *)ctxt->nameTab, - ctxt->nameMax * + ctxt->nameMax * 2 * sizeof(ctxt->nameTab[0])); if (tmp == NULL) { - ctxt->nameMax /= 2; goto mem_error; } ctxt->nameTab = tmp; + ctxt->nameMax *= 2; } ctxt->nameTab[ctxt->nameNr] = value; ctxt->name = value; @@ -1428,13 +1939,17 @@ namePop(xmlParserCtxtPtr ctxt) static int spacePush(xmlParserCtxtPtr ctxt, int val) { if (ctxt->spaceNr >= ctxt->spaceMax) { + int *tmp; + ctxt->spaceMax *= 2; - ctxt->spaceTab = (int *) xmlRealloc(ctxt->spaceTab, - ctxt->spaceMax * sizeof(ctxt->spaceTab[0])); - if (ctxt->spaceTab == NULL) { + tmp = (int *) xmlRealloc(ctxt->spaceTab, + ctxt->spaceMax * sizeof(ctxt->spaceTab[0])); + if (tmp == NULL) { xmlErrMemory(ctxt, NULL); - return(0); + ctxt->spaceMax /=2; + return(-1); } + ctxt->spaceTab = tmp; } ctxt->spaceTab[ctxt->spaceNr] = val; ctxt->space = &ctxt->spaceTab[ctxt->spaceNr]; @@ -1474,7 +1989,7 @@ static int spacePop(xmlParserCtxtPtr ctxt) { * to compare on ASCII based substring. * SKIP(n) Skip n xmlChar, and must also be used only to skip ASCII defined * strings without newlines within the parser. - * NEXT1(l) Skip 1 xmlChar, and must also be used only to skip 1 non-newline ASCII + * NEXT1(l) Skip 1 xmlChar, and must also be used only to skip 1 non-newline ASCII * defined char within the parser. * Clean macros, not dependent of an ASCII context, expect UTF-8 encoding * @@ -1523,10 +2038,10 @@ static int spacePop(xmlParserCtxtPtr ctxt) { #define SKIPL(val) do { \ int skipl; \ for(skipl=0; skiplinput->cur) == '\n') { \ + if (*(ctxt->input->cur) == '\n') { \ ctxt->input->line++; ctxt->input->col = 1; \ - } else ctxt->input->col++; \ - ctxt->nbChars++; \ + } else ctxt->input->col++; \ + ctxt->nbChars++; \ ctxt->input->cur++; \ } \ if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \ @@ -1552,8 +2067,25 @@ static void xmlSHRINK (xmlParserCtxtPtr ctxt) { xmlGROW (ctxt); static void xmlGROW (xmlParserCtxtPtr ctxt) { + unsigned long curEnd = ctxt->input->end - ctxt->input->cur; + unsigned long curBase = ctxt->input->cur - ctxt->input->base; + + if (((curEnd > (unsigned long) XML_MAX_LOOKUP_LIMIT) || + (curBase > (unsigned long) XML_MAX_LOOKUP_LIMIT)) && + ((ctxt->input->buf) && (ctxt->input->buf->readcallback != (xmlInputReadCallback) xmlNop)) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "Huge input lookup"); + xmlHaltParser(ctxt); + return; + } xmlParserInputGrow(ctxt->input, INPUT_CHUNK); - if ((*ctxt->input->cur == 0) && + if ((ctxt->input->cur > ctxt->input->end) || + (ctxt->input->cur < ctxt->input->base)) { + xmlHaltParser(ctxt); + xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, "cur index out of bound"); + return; + } + if ((ctxt->input->cur != NULL) && (*ctxt->input->cur == 0) && (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) xmlPopInput(ctxt); } @@ -1612,6 +2144,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) { while (IS_BLANK_CH(*cur)) { if (*cur == '\n') { ctxt->input->line++; ctxt->input->col = 1; + } else { + ctxt->input->col++; } cur++; res++; @@ -1626,7 +2160,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) { int cur; do { cur = CUR; - while (IS_BLANK_CH(cur)) { /* CHECKED tstblanks.xml */ + while ((IS_BLANK_CH(cur) && /* CHECKED tstblanks.xml */ + (ctxt->instate != XML_PARSER_EOF))) { NEXT; cur = CUR; res++; @@ -1640,7 +2175,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) { * Need to handle support of entities branching here */ if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); - } while (IS_BLANK(cur)); /* CHECKED tstblanks.xml */ + } while ((IS_BLANK(cur)) && /* CHECKED tstblanks.xml */ + (ctxt->instate != XML_PARSER_EOF)); } return(res); } @@ -1680,10 +2216,12 @@ xmlPopInput(xmlParserCtxtPtr ctxt) { * * xmlPushInput: switch to a new input stream which is stacked on top * of the previous one(s). + * Returns -1 in case of error or the index in the input stack */ -void +int xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) { - if (input == NULL) return; + int ret; + if (input == NULL) return(-1); if (xmlParserDebugEntities) { if ((ctxt->input != NULL) && (ctxt->input->filename)) @@ -1693,8 +2231,11 @@ xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) { xmlGenericError(xmlGenericErrorContext, "Pushing input %d : %.30s\n", ctxt->inputNr+1, input->cur); } - inputPush(ctxt, input); + ret = inputPush(ctxt, input); + if (ctxt->instate == XML_PARSER_EOF) + return(-1); GROW; + return(ret); } /** @@ -1708,7 +2249,7 @@ xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) { * * [ WFC: Legal Character ] * Characters referred to using character references must match the - * production for Char. + * production for Char. * * Returns the value parsed (as an int), 0 in case of error */ @@ -1729,8 +2270,10 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) { if (count++ > 20) { count = 0; GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(0); } - if ((RAW >= '0') && (RAW <= '9')) + if ((RAW >= '0') && (RAW <= '9')) val = val * 16 + (CUR - '0'); else if ((RAW >= 'a') && (RAW <= 'f') && (count < 20)) val = val * 16 + (CUR - 'a') + 10; @@ -1760,8 +2303,10 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) { if (count++ > 20) { count = 0; GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(0); } - if ((RAW >= '0') && (RAW <= '9')) + if ((RAW >= '0') && (RAW <= '9')) val = val * 10 + (CUR - '0'); else { xmlFatalErr(ctxt, XML_ERR_INVALID_DEC_CHARREF, NULL); @@ -1787,7 +2332,7 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) { /* * [ WFC: Legal Character ] * Characters referred to using character references must match the - * production for Char. + * production for Char. */ if ((IS_CHAR(val) && (outofrange == 0))) { return(val); @@ -1812,7 +2357,7 @@ xmlParseCharRef(xmlParserCtxtPtr ctxt) { * * [ WFC: Legal Character ] * Characters referred to using character references must match the - * production for Char. + * production for Char. * * Returns the value parsed (as an int), 0 in case of error, str will be * updated to the current value of the index @@ -1831,7 +2376,7 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) { ptr += 3; cur = *ptr; while (cur != ';') { /* Non input consuming loop */ - if ((cur >= '0') && (cur <= '9')) + if ((cur >= '0') && (cur <= '9')) val = val * 16 + (cur - '0'); else if ((cur >= 'a') && (cur <= 'f')) val = val * 16 + (cur - 'a') + 10; @@ -1854,7 +2399,7 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) { ptr += 2; cur = *ptr; while (cur != ';') { /* Non input consuming loops */ - if ((cur >= '0') && (cur <= '9')) + if ((cur >= '0') && (cur <= '9')) val = val * 10 + (cur - '0'); else { xmlFatalErr(ctxt, XML_ERR_INVALID_DEC_CHARREF, NULL); @@ -1878,7 +2423,7 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) { /* * [ WFC: Legal Character ] * Characters referred to using character references must match the - * production for Char. + * production for Char. */ if ((IS_CHAR(val) && (outofrange == 0))) { return(val); @@ -1900,9 +2445,9 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) { * * Returns the new input stream or NULL */ - + static void deallocblankswrapper (xmlChar *str) {xmlFree(str);} - + static xmlParserInputPtr xmlNewBlanksWrapperInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { xmlParserInputPtr input; @@ -1924,7 +2469,8 @@ xmlNewBlanksWrapperInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { buffer = xmlMallocAtomic(length); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); - return(NULL); + xmlFree(input); + return(NULL); } buffer [0] = ' '; buffer [1] = '%'; @@ -1943,12 +2489,12 @@ xmlNewBlanksWrapperInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { /** * xmlParserHandlePEReference: * @ctxt: the parser context - * + * * [69] PEReference ::= '%' Name ';' * * [ WFC: No Recursion ] * A parsed entity must not contain a recursive - * reference to itself, either directly or indirectly. + * reference to itself, either directly or indirectly. * * [ WFC: Entity Declared ] * In a document without any DTD, a document with only an internal DTD @@ -1966,9 +2512,9 @@ xmlNewBlanksWrapperInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { * NOTE: misleading but this is handled. * * A PEReference may have been detected in the current input stream - * the handling is done accordingly to + * the handling is done accordingly to * http://www.w3.org/TR/REC-xml#entproc - * i.e. + * i.e. * - Included in literal in entity values * - Included as Parameter Entity reference within DTDs */ @@ -2045,8 +2591,10 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { NEXT; if ((ctxt->sax != NULL) && (ctxt->sax->getParameterEntity != NULL)) entity = ctxt->sax->getParameterEntity(ctxt->userData, name); + if (ctxt->instate == XML_PARSER_EOF) + return; if (entity == NULL) { - + /* * [ WFC: Entity Declared ] * In a document without any DTD, a document with only an @@ -2071,31 +2619,51 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { if ((ctxt->validate) && (ctxt->vctxt.error != NULL)) { xmlValidityError(ctxt, XML_WAR_UNDECLARED_ENTITY, "PEReference: %%%s; not found\n", - name); - } else + name, NULL); + } else xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, "PEReference: %%%s; not found\n", name, NULL); ctxt->valid = 0; } + xmlParserEntityCheck(ctxt, 0, NULL, 0); } else if (ctxt->input->free != deallocblankswrapper) { input = xmlNewBlanksWrapperInputStream(ctxt, entity); - xmlPushInput(ctxt, input); + if (xmlPushInput(ctxt, input) < 0) + return; } else { if ((entity->etype == XML_INTERNAL_PARAMETER_ENTITY) || (entity->etype == XML_EXTERNAL_PARAMETER_ENTITY)) { xmlChar start[4]; xmlCharEncoding enc; + /* + * Note: external parameter entities will not be loaded, it + * is not required for a non-validating parser, unless the + * option of validating, or substituting entities were + * given. Doing so is far more secure as the parser will + * only process data coming from the document entity by + * default. + */ + if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) && + ((ctxt->options & XML_PARSE_NOENT) == 0) && + ((ctxt->options & XML_PARSE_DTDVALID) == 0) && + ((ctxt->options & XML_PARSE_DTDLOAD) == 0) && + ((ctxt->options & XML_PARSE_DTDATTR) == 0) && + (ctxt->replaceEntities == 0) && + (ctxt->validate == 0)) + return; + /* * handle the extra spaces added before and after * c.f. http://www.w3.org/TR/REC-xml#as-PE * this is done independently. */ input = xmlNewEntityInputStream(ctxt, entity); - xmlPushInput(ctxt, input); + if (xmlPushInput(ctxt, input) < 0) + return; - /* + /* * Get the 4 first bytes and decode the charset * if enc != XML_CHAR_ENCODING_NONE * plug some encoding conversion routines. @@ -2105,6 +2673,8 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { * the amount of data in the buffer. */ GROW + if (ctxt->instate == XML_PARSER_EOF) + return; if ((ctxt->input->end - ctxt->input->cur)>=4) { start[0] = RAW; start[1] = NXT(1); @@ -2135,14 +2705,17 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { /* * Macro used to grow the current buffer. + * buffer##_size is expected to be a size_t + * mem_error: is expected to handle memory allocation failures */ -#define growBuffer(buffer) { \ +#define growBuffer(buffer, n) { \ xmlChar *tmp; \ - buffer##_size *= 2; \ - tmp = (xmlChar *) \ - xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \ + size_t new_size = buffer##_size * 2 + n; \ + if (new_size < buffer##_size) goto mem_error; \ + tmp = (xmlChar *) xmlRealloc(buffer, new_size); \ if (tmp == NULL) goto mem_error; \ buffer = tmp; \ + buffer##_size = new_size; \ } /** @@ -2154,7 +2727,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { * @end: an end marker xmlChar, 0 if none * @end2: an end marker xmlChar, 0 if none * @end3: an end marker xmlChar, 0 if none - * + * * Takes a entity string content and process to do the adequate substitutions. * * [67] Reference ::= EntityRef | CharRef @@ -2168,19 +2741,22 @@ xmlChar * xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int what, xmlChar end, xmlChar end2, xmlChar end3) { xmlChar *buffer = NULL; - int buffer_size = 0; + size_t buffer_size = 0; + size_t nbchars = 0; xmlChar *current = NULL; + xmlChar *rep = NULL; const xmlChar *last; xmlEntityPtr ent; int c,l; - int nbchars = 0; if ((ctxt == NULL) || (str == NULL) || (len < 0)) return(NULL); last = str + len; - if (ctxt->depth > 40) { + if (((ctxt->depth > 40) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) || + (ctxt->depth > 1024)) { xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); return(NULL); } @@ -2189,7 +2765,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, * allocate a translation buffer. */ buffer_size = XML_PARSER_BIG_BUFFER_SIZE; - buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar)); + buffer = (xmlChar *) xmlMallocAtomic(buffer_size); if (buffer == NULL) goto mem_error; /* @@ -2209,8 +2785,8 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, if (val != 0) { COPY_BUF(0,buffer,nbchars,val); } - if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { + growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } else if ((c == '&') && (what & XML_SUBSTITUTE_REF)) { if (xmlParserDebugEntities) @@ -2218,42 +2794,53 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, "String decoding Entity Reference: %.30s\n", str); ent = xmlParseStringEntityRef(ctxt, &str); + if ((ctxt->lastError.code == XML_ERR_ENTITY_LOOP) || + (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR)) + goto int_error; + xmlParserEntityCheck(ctxt, 0, ent, 0); + if (ent != NULL) + ctxt->nbentities += ent->checked / 2; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (ent->content != NULL) { COPY_BUF(0,buffer,nbchars,ent->content[0]); - if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { + growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } else { xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, "predefined entity has no content\n"); } } else if ((ent != NULL) && (ent->content != NULL)) { - xmlChar *rep; - ctxt->depth++; rep = xmlStringDecodeEntities(ctxt, ent->content, what, 0, 0, 0); ctxt->depth--; + + if ((ctxt->lastError.code == XML_ERR_ENTITY_LOOP) || + (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR)) + goto int_error; + if (rep != NULL) { current = rep; while (*current != 0) { /* non input consuming loop */ buffer[nbchars++] = *current++; - if (nbchars > - buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { + if (xmlParserEntityCheck(ctxt, nbchars, ent, 0)) + goto int_error; + growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } xmlFree(rep); + rep = NULL; } } else if (ent != NULL) { int i = xmlStrlen(ent->name); const xmlChar *cur = ent->name; buffer[nbchars++] = '&'; - if (nbchars > buffer_size - i - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + if (nbchars + i + XML_PARSER_BUFFER_SIZE > buffer_size) { + growBuffer(buffer, i + XML_PARSER_BUFFER_SIZE); } for (;i > 0;i--) buffer[nbchars++] = *cur++; @@ -2264,9 +2851,15 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, xmlGenericError(xmlGenericErrorContext, "String decoding PE Reference: %.30s\n", str); ent = xmlParseStringPEReference(ctxt, &str); + if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) + goto int_error; + xmlParserEntityCheck(ctxt, 0, ent, 0); + if (ent != NULL) + ctxt->nbentities += ent->checked / 2; if (ent != NULL) { - xmlChar *rep; - + if (ent->content == NULL) { + xmlLoadEntityContent(ctxt, ent); + } ctxt->depth++; rep = xmlStringDecodeEntities(ctxt, ent->content, what, 0, 0, 0); @@ -2275,19 +2868,21 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, current = rep; while (*current != 0) { /* non input consuming loop */ buffer[nbchars++] = *current++; - if (nbchars > - buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { + if (xmlParserEntityCheck(ctxt, nbchars, ent, 0)) + goto int_error; + growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } xmlFree(rep); + rep = NULL; } } } else { COPY_BUF(l,buffer,nbchars,c); str += l; - if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer); + if (nbchars + XML_PARSER_BUFFER_SIZE > buffer_size) { + growBuffer(buffer, XML_PARSER_BUFFER_SIZE); } } if (str < last) @@ -2295,11 +2890,16 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, else c = 0; } - buffer[nbchars++] = 0; + buffer[nbchars] = 0; return(buffer); mem_error: xmlErrMemory(ctxt, NULL); +int_error: + if (rep != NULL) + xmlFree(rep); + if (buffer != NULL) + xmlFree(buffer); return(NULL); } @@ -2311,7 +2911,7 @@ mem_error: * @end: an end marker xmlChar, 0 if none * @end2: an end marker xmlChar, 0 if none * @end3: an end marker xmlChar, 0 if none - * + * * Takes a entity string content and process to do the adequate substitutions. * * [67] Reference ::= EntityRef | CharRef @@ -2414,7 +3014,7 @@ static int areBlanks(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, * xmlSplitQName: * @ctxt: an XML parser context * @name: an XML parser context - * @prefix: a xmlChar ** + * @prefix: a xmlChar ** * * parse an UTF8 encoded XML qualified name string * @@ -2465,7 +3065,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { * for the processing speed. */ max = len * 2; - + buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); @@ -2480,7 +3080,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { tmp = (xmlChar *) xmlRealloc(buffer, max * sizeof(xmlChar)); if (tmp == NULL) { - xmlFree(tmp); + xmlFree(buffer); xmlErrMemory(ctxt, NULL); return(NULL); } @@ -2491,7 +3091,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { } buffer[len] = 0; } - + if ((c == ':') && (*cur == 0)) { if (buffer != NULL) xmlFree(buffer); @@ -2544,7 +3144,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { * for the processing speed. */ max = len * 2; - + buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); @@ -2570,7 +3170,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { } buffer[len] = 0; } - + if (buffer == NULL) ret = xmlStrndup(buf, len); else { @@ -2588,10 +3188,221 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { * * ************************************************************************/ -static const xmlChar * xmlParseNameComplex(xmlParserCtxtPtr ctxt); +/************************************************************************ + * * + * Routines to parse Name, NCName and NmToken * + * * + ************************************************************************/ +#ifdef DEBUG +static unsigned long nbParseName = 0; +static unsigned long nbParseNmToken = 0; +static unsigned long nbParseNCName = 0; +static unsigned long nbParseNCNameComplex = 0; +static unsigned long nbParseNameComplex = 0; +static unsigned long nbParseStringName = 0; +#endif + +/* + * The two following functions are related to the change of accepted + * characters for Name and NmToken in the Revision 5 of XML-1.0 + * They correspond to the modified production [4] and the new production [4a] + * changes in that revision. Also note that the macros used for the + * productions Letter, Digit, CombiningChar and Extender are not needed + * anymore. + * We still keep compatibility to pre-revision5 parsing semantic if the + * new XML_PARSE_OLD10 option is given to the parser. + */ +static int +xmlIsNameStartChar(xmlParserCtxtPtr ctxt, int c) { + if ((ctxt->options & XML_PARSE_OLD10) == 0) { + /* + * Use the new checks of production [4] [4a] amd [5] of the + * Update 5 of XML-1.0 + */ + if ((c != ' ') && (c != '>') && (c != '/') && /* accelerators */ + (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + (c == '_') || (c == ':') || + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF)))) + return(1); + } else { + if (IS_LETTER(c) || (c == '_') || (c == ':')) + return(1); + } + return(0); +} + +static int +xmlIsNameChar(xmlParserCtxtPtr ctxt, int c) { + if ((ctxt->options & XML_PARSE_OLD10) == 0) { + /* + * Use the new checks of production [4] [4a] amd [5] of the + * Update 5 of XML-1.0 + */ + if ((c != ' ') && (c != '>') && (c != '/') && /* accelerators */ + (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + ((c >= '0') && (c <= '9')) || /* !start */ + (c == '_') || (c == ':') || + (c == '-') || (c == '.') || (c == 0xB7) || /* !start */ + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x300) && (c <= 0x36F)) || /* !start */ + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x203F) && (c <= 0x2040)) || /* !start */ + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF)))) + return(1); + } else { + if ((IS_LETTER(c)) || (IS_DIGIT(c)) || + (c == '.') || (c == '-') || + (c == '_') || (c == ':') || + (IS_COMBINING(c)) || + (IS_EXTENDER(c))) + return(1); + } + return(0); +} + static xmlChar * xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc, int normalize); +static const xmlChar * +xmlParseNameComplex(xmlParserCtxtPtr ctxt) { + int len = 0, l; + int c; + int count = 0; + +#ifdef DEBUG + nbParseNameComplex++; +#endif + + /* + * Handler for more complex cases + */ + GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); + c = CUR_CHAR(l); + if ((ctxt->options & XML_PARSE_OLD10) == 0) { + /* + * Use the new checks of production [4] [4a] amd [5] of the + * Update 5 of XML-1.0 + */ + if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ + (!(((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + (c == '_') || (c == ':') || + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF))))) { + return(NULL); + } + len += l; + NEXTL(l); + c = CUR_CHAR(l); + while ((c != ' ') && (c != '>') && (c != '/') && /* accelerators */ + (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + ((c >= '0') && (c <= '9')) || /* !start */ + (c == '_') || (c == ':') || + (c == '-') || (c == '.') || (c == 0xB7) || /* !start */ + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x300) && (c <= 0x36F)) || /* !start */ + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x203F) && (c <= 0x2040)) || /* !start */ + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF)) + )) { + if (count++ > XML_PARSER_CHUNK_SIZE) { + count = 0; + GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); + } + len += l; + NEXTL(l); + c = CUR_CHAR(l); + } + } else { + if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ + (!IS_LETTER(c) && (c != '_') && + (c != ':'))) { + return(NULL); + } + len += l; + NEXTL(l); + c = CUR_CHAR(l); + + while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ + ((IS_LETTER(c)) || (IS_DIGIT(c)) || + (c == '.') || (c == '-') || + (c == '_') || (c == ':') || + (IS_COMBINING(c)) || + (IS_EXTENDER(c)))) { + if (count++ > XML_PARSER_CHUNK_SIZE) { + count = 0; + GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); + } + len += l; + NEXTL(l); + c = CUR_CHAR(l); + if (c == 0) { + count = 0; + GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); + c = CUR_CHAR(l); + } + } + } + if ((len > XML_MAX_NAME_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name"); + return(NULL); + } + if ((*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r')) + return(xmlDictLookup(ctxt->dict, ctxt->input->cur - (len + 1), len)); + return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); +} + /** * xmlParseName: * @ctxt: an XML parser context @@ -2616,6 +3427,10 @@ xmlParseName(xmlParserCtxtPtr ctxt) { GROW; +#ifdef DEBUG + nbParseName++; +#endif + /* * Accelerator for simple ASCII names */ @@ -2632,6 +3447,11 @@ xmlParseName(xmlParserCtxtPtr ctxt) { in++; if ((*in > 0) && (*in < 0x80)) { count = in - ctxt->input->cur; + if ((count > XML_MAX_NAME_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Name"); + return(NULL); + } ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); ctxt->input->cur = in; ctxt->nbChars += count; @@ -2641,9 +3461,136 @@ xmlParseName(xmlParserCtxtPtr ctxt) { return(ret); } } + /* accelerator for special cases */ return(xmlParseNameComplex(ctxt)); } +static const xmlChar * +xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { + int len = 0, l; + int c; + int count = 0; + const xmlChar *end; /* needed because CUR_CHAR() can move cur on \r\n */ + +#ifdef DEBUG + nbParseNCNameComplex++; +#endif + + /* + * Handler for more complex cases + */ + GROW; + end = ctxt->input->cur; + c = CUR_CHAR(l); + if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ + (!xmlIsNameStartChar(ctxt, c) || (c == ':'))) { + return(NULL); + } + + while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ + (xmlIsNameChar(ctxt, c) && (c != ':'))) { + if (count++ > XML_PARSER_CHUNK_SIZE) { + if ((len > XML_MAX_NAME_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName"); + return(NULL); + } + count = 0; + GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); + } + len += l; + NEXTL(l); + end = ctxt->input->cur; + c = CUR_CHAR(l); + if (c == 0) { + count = 0; + /* + * when shrinking to extend the buffer we really need to preserve + * the part of the name we already parsed. Hence rolling back + * by current lenght. + */ + ctxt->input->cur -= l; + GROW; + ctxt->input->cur += l; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); + end = ctxt->input->cur; + c = CUR_CHAR(l); + } + } + if ((len > XML_MAX_NAME_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName"); + return(NULL); + } + return(xmlDictLookup(ctxt->dict, end - len, len)); +} + +/** + * xmlParseNCName: + * @ctxt: an XML parser context + * @len: length of the string parsed + * + * parse an XML name. + * + * [4NS] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | + * CombiningChar | Extender + * + * [5NS] NCName ::= (Letter | '_') (NCNameChar)* + * + * Returns the Name parsed or NULL + */ + +static const xmlChar * +xmlParseNCName(xmlParserCtxtPtr ctxt) { + const xmlChar *in, *e; + const xmlChar *ret; + int count = 0; + +#ifdef DEBUG + nbParseNCName++; +#endif + + /* + * Accelerator for simple ASCII names + */ + in = ctxt->input->cur; + e = ctxt->input->end; + if ((((*in >= 0x61) && (*in <= 0x7A)) || + ((*in >= 0x41) && (*in <= 0x5A)) || + (*in == '_')) && (in < e)) { + in++; + while ((((*in >= 0x61) && (*in <= 0x7A)) || + ((*in >= 0x41) && (*in <= 0x5A)) || + ((*in >= 0x30) && (*in <= 0x39)) || + (*in == '_') || (*in == '-') || + (*in == '.')) && (in < e)) + in++; + if (in >= e) + goto complex; + if ((*in > 0) && (*in < 0x80)) { + count = in - ctxt->input->cur; + if ((count > XML_MAX_NAME_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName"); + return(NULL); + } + ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); + ctxt->input->cur = in; + ctxt->nbChars += count; + ctxt->input->col += count; + if (ret == NULL) { + xmlErrMemory(ctxt, NULL); + } + return(ret); + } + } +complex: + return(xmlParseNCNameComplex(ctxt)); +} + /** * xmlParseNameAndCompare: * @ctxt: an XML parser context @@ -2662,15 +3609,17 @@ xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) { const xmlChar *ret; GROW; - + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); + in = ctxt->input->cur; while (*in != 0 && *in == *cmp) { - ++in; + ++in; ++cmp; ctxt->input->col++; } if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) { - /* success */ + /* success */ ctxt->input->cur = in; return (const xmlChar*) 1; } @@ -2683,42 +3632,6 @@ xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) { return ret; } -static const xmlChar * -xmlParseNameComplex(xmlParserCtxtPtr ctxt) { - int len = 0, l; - int c; - int count = 0; - - /* - * Handler for more complex cases - */ - GROW; - c = CUR_CHAR(l); - if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ - (!IS_LETTER(c) && (c != '_') && - (c != ':'))) { - return(NULL); - } - - while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ - ((IS_LETTER(c)) || (IS_DIGIT(c)) || - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c)))) { - if (count++ > 100) { - count = 0; - GROW; - } - len += l; - NEXTL(l); - c = CUR_CHAR(l); - } - if ((*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r')) - return(xmlDictLookup(ctxt->dict, ctxt->input->cur - (len + 1), len)); - return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); -} - /** * xmlParseStringName: * @ctxt: an XML parser context @@ -2733,7 +3646,7 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) { * * [6] Names ::= Name (#x20 Name)* * - * Returns the Name parsed or NULL. The @str pointer + * Returns the Name parsed or NULL. The @str pointer * is updated to the current location in the string. */ @@ -2744,17 +3657,19 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { int len = 0, l; int c; +#ifdef DEBUG + nbParseStringName++; +#endif + c = CUR_SCHAR(cur, l); - if (!IS_LETTER(c) && (c != '_') && - (c != ':')) { + if (!xmlIsNameStartChar(ctxt, c)) { return(NULL); } - while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigentname.xml */ - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c))) { + COPY_BUF(l,buf,len,c); + cur += l; + c = CUR_SCHAR(cur, l); + while (xmlIsNameChar(ctxt, c)) { COPY_BUF(l,buf,len,c); cur += l; c = CUR_SCHAR(cur, l); @@ -2765,21 +3680,23 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { */ xmlChar *buffer; int max = len * 2; - + buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } memcpy(buffer, buf, len); - while ((IS_LETTER(c)) || (IS_DIGIT(c)) || - /* test bigentname.xml */ - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c))) { + while (xmlIsNameChar(ctxt, c)) { if (len + 10 > max) { xmlChar *tmp; + + if ((len > XML_MAX_NAME_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName"); + xmlFree(buffer); + return(NULL); + } max *= 2; tmp = (xmlChar *) xmlRealloc(buffer, max * sizeof(xmlChar)); @@ -2799,6 +3716,11 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { return(buffer); } } + if ((len > XML_MAX_NAME_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NCName"); + return(NULL); + } *str = cur; return(xmlStrndup(buf, len)); } @@ -2806,7 +3728,7 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { /** * xmlParseNmtoken: * @ctxt: an XML parser context - * + * * parse an XML Nmtoken. * * [7] Nmtoken ::= (NameChar)+ @@ -2823,21 +3745,30 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { int c; int count = 0; +#ifdef DEBUG + nbParseNmToken++; +#endif + GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); c = CUR_CHAR(l); - while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigtoken.xml */ - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c))) { - if (count++ > 100) { + while (xmlIsNameChar(ctxt, c)) { + if (count++ > XML_PARSER_CHUNK_SIZE) { count = 0; GROW; } COPY_BUF(l,buf,len,c); NEXTL(l); c = CUR_CHAR(l); + if (c == 0) { + count = 0; + GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); + c = CUR_CHAR(l); + } if (len >= XML_MAX_NAMELEN) { /* * Okay someone managed to make a huge token, so he's ready to pay @@ -2845,25 +3776,31 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { */ xmlChar *buffer; int max = len * 2; - + buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); if (buffer == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } memcpy(buffer, buf, len); - while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigtoken.xml */ - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c))) { - if (count++ > 100) { + while (xmlIsNameChar(ctxt, c)) { + if (count++ > XML_PARSER_CHUNK_SIZE) { count = 0; GROW; + if (ctxt->instate == XML_PARSER_EOF) { + xmlFree(buffer); + return(NULL); + } } if (len + 10 > max) { xmlChar *tmp; + if ((max > XML_MAX_NAME_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NmToken"); + xmlFree(buffer); + return(NULL); + } max *= 2; tmp = (xmlChar *) xmlRealloc(buffer, max * sizeof(xmlChar)); @@ -2884,6 +3821,11 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { } if (len == 0) return(NULL); + if ((len > XML_MAX_NAME_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "NmToken"); + return(NULL); + } return(xmlStrndup(buf, len)); } @@ -2930,6 +3872,10 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) { ctxt->instate = XML_PARSER_ENTITY_VALUE; input = ctxt->input; GROW; + if (ctxt->instate == XML_PARSER_EOF) { + xmlFree(buf); + return(NULL); + } NEXT; c = CUR_CHAR(l); /* @@ -2937,12 +3883,12 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) { * When a parameter entity reference appears in a literal entity * value, ... a single or double quote character in the replacement * text is always treated as a normal data character and will not - * terminate the literal. + * terminate the literal. * In practice it means we stop the loop only when back at parsing * the initial entity and the quote is found */ - while ((IS_CHAR(c)) && ((c != stop) || /* checked */ - (ctxt->input != input))) { + while (((IS_CHAR(c)) && ((c != stop) || /* checked */ + (ctxt->input != input))) && (ctxt->instate != XML_PARSER_EOF)) { if (len + 5 >= size) { xmlChar *tmp; @@ -2971,6 +3917,10 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) { } } buf[len] = 0; + if (ctxt->instate == XML_PARSER_EOF) { + xmlFree(buf); + return(NULL); + } /* * Raise problem w.r.t. '&' and '%' being used in non-entities @@ -3018,12 +3968,12 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) { */ ret = xmlStringDecodeEntities(ctxt, buf, XML_SUBSTITUTE_PEREF, 0, 0, 0); - if (orig != NULL) + if (orig != NULL) *orig = buf; else xmlFree(buf); } - + return(ret); } @@ -3043,8 +3993,9 @@ static xmlChar * xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { xmlChar limit = 0; xmlChar *buf = NULL; - int len = 0; - int buf_size = 0; + xmlChar *rep = NULL; + size_t len = 0; + size_t buf_size = 0; int c, l, in_space = 0; xmlChar *current = NULL; xmlEntityPtr ent; @@ -3061,20 +4012,31 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL); return(NULL); } - + /* * allocate a translation buffer. */ buf_size = XML_PARSER_BUFFER_SIZE; - buf = (xmlChar *) xmlMallocAtomic(buf_size * sizeof(xmlChar)); + buf = (xmlChar *) xmlMallocAtomic(buf_size); if (buf == NULL) goto mem_error; /* * OK loop until we reach one of the ending char or a size limit. */ c = CUR_CHAR(l); - while ((NXT(0) != limit) && /* checked */ - (c != '<')) { + while (((NXT(0) != limit) && /* checked */ + (IS_CHAR(c)) && (c != '<')) && + (ctxt->instate != XML_PARSER_EOF)) { + /* + * Impose a reasonable limit on attribute size, unless XML_PARSE_HUGE + * special option is given + */ + if ((len > XML_MAX_TEXT_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, + "AttValue length too long\n"); + goto mem_error; + } if (c == 0) break; if (c == '&') { in_space = 0; @@ -3083,8 +4045,8 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { if (val == '&') { if (ctxt->replaceEntities) { - if (len > buf_size - 10) { - growBuffer(buf); + if (len + 10 > buf_size) { + growBuffer(buf, 10); } buf[len++] = '&'; } else { @@ -3092,8 +4054,8 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { * The reparsing will be done in xmlStringGetNodeList() * called by the attribute() function in SAX.c */ - if (len > buf_size - 10) { - growBuffer(buf); + if (len + 10 > buf_size) { + growBuffer(buf, 10); } buf[len++] = '&'; buf[len++] = '#'; @@ -3101,18 +4063,21 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { buf[len++] = '8'; buf[len++] = ';'; } - } else { - if (len > buf_size - 10) { - growBuffer(buf); + } else if (val != 0) { + if (len + 10 > buf_size) { + growBuffer(buf, 10); } len += xmlCopyChar(0, &buf[len], val); } } else { ent = xmlParseEntityRef(ctxt); + ctxt->nbentities++; + if (ent != NULL) + ctxt->nbentities += ent->owner; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { - if (len > buf_size - 10) { - growBuffer(buf); + if (len + 10 > buf_size) { + growBuffer(buf, 10); } if ((ctxt->replaceEntities == 0) && (ent->content[0] == '&')) { @@ -3124,10 +4089,8 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { } else { buf[len++] = ent->content[0]; } - } else if ((ent != NULL) && + } else if ((ent != NULL) && (ctxt->replaceEntities != 0)) { - xmlChar *rep; - if (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) { rep = xmlStringDecodeEntities(ctxt, ent->content, XML_SUBSTITUTE_REF, @@ -3135,16 +4098,22 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { if (rep != NULL) { current = rep; while (*current != 0) { /* non input consuming */ - buf[len++] = *current++; - if (len > buf_size - 10) { - growBuffer(buf); + if ((*current == 0xD) || (*current == 0xA) || + (*current == 0x9)) { + buf[len++] = 0x20; + current++; + } else + buf[len++] = *current++; + if (len + 10 > buf_size) { + growBuffer(buf, 10); } } xmlFree(rep); + rep = NULL; } } else { - if (len > buf_size - 10) { - growBuffer(buf); + if (len + 10 > buf_size) { + growBuffer(buf, 10); } if (ent->content != NULL) buf[len++] = ent->content[0]; @@ -3158,20 +4127,27 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { * entities problems */ if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && - (ent->content != NULL)) { - xmlChar *rep; + (ent->content != NULL) && (ent->checked == 0)) { + unsigned long oldnbent = ctxt->nbentities; + rep = xmlStringDecodeEntities(ctxt, ent->content, - XML_SUBSTITUTE_REF, 0, 0, 0); - if (rep != NULL) + XML_SUBSTITUTE_REF, 0, 0, 0); + + ent->checked = (ctxt->nbentities - oldnbent + 1) * 2; + if (rep != NULL) { + if (xmlStrchr(rep, '<')) + ent->checked |= 1; xmlFree(rep); + rep = NULL; + } } /* * Just output the reference */ buf[len++] = '&'; - if (len > buf_size - i - 10) { - growBuffer(buf); + while (len + i + 10 > buf_size) { + growBuffer(buf, i + 10); } for (;i > 0;i--) buf[len++] = *cur++; @@ -3183,8 +4159,8 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { if ((len != 0) || (!normalize)) { if ((!normalize) || (!in_space)) { COPY_BUF(l,buf,len,0x20); - if (len > buf_size - 10) { - growBuffer(buf); + while (len + 10 > buf_size) { + growBuffer(buf, 10); } } in_space = 1; @@ -3192,8 +4168,8 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { } else { in_space = 0; COPY_BUF(l,buf,len,c); - if (len > buf_size - 10) { - growBuffer(buf); + if (len + 10 > buf_size) { + growBuffer(buf, 10); } } NEXTL(l); @@ -3201,22 +4177,46 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { GROW; c = CUR_CHAR(l); } + if (ctxt->instate == XML_PARSER_EOF) + goto error; + if ((in_space) && (normalize)) { - while (buf[len - 1] == 0x20) len--; + while ((len > 0) && (buf[len - 1] == 0x20)) len--; } buf[len] = 0; if (RAW == '<') { xmlFatalErr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, NULL); } else if (RAW != limit) { - xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue: ' expected\n"); + if ((c != 0) && (!IS_CHAR(c))) { + xmlFatalErrMsg(ctxt, XML_ERR_INVALID_CHAR, + "invalid character in attribute value\n"); + } else { + xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, + "AttValue: ' expected\n"); + } } else NEXT; - if (attlen != NULL) *attlen = len; + + /* + * There we potentially risk an overflow, don't allow attribute value of + * length more than INT_MAX it is a very reasonnable assumption ! + */ + if (len >= INT_MAX) { + xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, + "AttValue length too long\n"); + goto mem_error; + } + + if (attlen != NULL) *attlen = (int) len; return(buf); mem_error: xmlErrMemory(ctxt, NULL); +error: + if (buf != NULL) + xmlFree(buf); + if (rep != NULL) + xmlFree(rep); return(NULL); } @@ -3233,20 +4233,20 @@ mem_error: * * 3.3.3 Attribute-Value Normalization: * Before the value of an attribute is passed to the application or - * checked for validity, the XML processor must normalize it as follows: + * checked for validity, the XML processor must normalize it as follows: * - a character reference is processed by appending the referenced * character to the attribute value * - an entity reference is processed by recursively processing the - * replacement text of the entity + * replacement text of the entity * - a whitespace character (#x20, #xD, #xA, #x9) is processed by * appending #x20 to the normalized value, except that only a single * #x20 is appended for a "#xD#xA" sequence that is part of an external - * parsed entity or the literal entity value of an internal parsed entity - * - other characters are processed by appending them to the normalized value + * parsed entity or the literal entity value of an internal parsed entity + * - other characters are processed by appending them to the normalized value * If the declared value is not CDATA, then the XML processor must further * process the normalized attribute value by discarding any leading and * trailing space (#x20) characters, and by replacing sequences of space - * (#x20) characters by a single space (#x20) character. + * (#x20) characters by a single space (#x20) character. * All attributes for which no declaration has been read should be treated * by a non-validating parser as if declared CDATA. * @@ -3263,7 +4263,7 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) { /** * xmlParseSystemLiteral: * @ctxt: an XML parser context - * + * * parse an XML Literal * * [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") @@ -3292,7 +4292,7 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL); return(NULL); } - + buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf == NULL) { xmlErrMemory(ctxt, NULL); @@ -3304,6 +4304,13 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { if (len + 5 >= size) { xmlChar *tmp; + if ((size > XML_MAX_NAME_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "SystemLiteral"); + xmlFree(buf); + ctxt->instate = (xmlParserInputState) state; + return(NULL); + } size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { @@ -3318,6 +4325,10 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { if (count > 50) { GROW; count = 0; + if (ctxt->instate == XML_PARSER_EOF) { + xmlFree(buf); + return(NULL); + } } COPY_BUF(l,buf,len,cur); NEXTL(l); @@ -3381,6 +4392,12 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { if (len + 1 >= size) { xmlChar *tmp; + if ((size > XML_MAX_NAME_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErr(ctxt, XML_ERR_NAME_TOO_LONG, "Public ID"); + xmlFree(buf); + return(NULL); + } size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { @@ -3395,6 +4412,10 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { if (count > 50) { GROW; count = 0; + if (ctxt->instate == XML_PARSER_EOF) { + xmlFree(buf); + return(NULL); + } } NEXT; cur = CUR; @@ -3414,7 +4435,7 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { return(buf); } -void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata); +static void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata); /* * used for the test in the inner loop of the char data testing @@ -3465,7 +4486,7 @@ static const unsigned char test_char_data[256] = { * The right angle bracket (>) may be represented using the string ">", * and must, for compatibility, be escaped using ">" or a character * reference when it appears in the string "]]>" in content, when that - * string is not marking the end of a CDATA section. + * string is not marking the end of a CDATA section. * * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) */ @@ -3488,7 +4509,7 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) { in = ctxt->input->cur; do { get_more_space: - while (*in == 0x20) in++; + while (*in == 0x20) { in++; ctxt->input->col++; } if (*in == 0xA) { do { ctxt->input->line++; ctxt->input->col = 1; @@ -3578,6 +4599,9 @@ get_more: line = ctxt->input->line; col = ctxt->input->col; } + /* something really bad happened in the SAX callback */ + if (ctxt->instate != XML_PARSER_CONTENT) + return; } ctxt->input->cur = in; if (*in == 0xD) { @@ -3598,6 +4622,8 @@ get_more: } SHRINK; GROW; + if (ctxt->instate == XML_PARSER_EOF) + return; in = ctxt->input->cur; } while (((*in >= 0x20) && (*in <= 0x7F)) || (*in == 0x09)); nbchar = 0; @@ -3616,7 +4642,7 @@ get_more: * of xmlParseCharData() when the parsing requires handling * of non-ASCII characters. */ -void +static void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) { xmlChar buf[XML_PARSER_BIG_BUFFER_SIZE + 5]; int nbchar = 0; @@ -3627,7 +4653,7 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) { GROW; cur = CUR_CHAR(l); while ((cur != '<') && /* checked */ - (cur != '&') && + (cur != '&') && (IS_CHAR(cur))) /* test also done in xmlCurrentChar() */ { if ((cur == ']') && (NXT(1) == ']') && (NXT(2) == '>')) { @@ -3658,11 +4684,16 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) { } } nbchar = 0; + /* something really bad happened in the SAX callback */ + if (ctxt->instate != XML_PARSER_CONTENT) + return; } count++; if (count > 50) { GROW; count = 0; + if (ctxt->instate == XML_PARSER_EOF) + return; } NEXTL(l); cur = CUR_CHAR(l); @@ -3755,7 +4786,7 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) { } } else { /* - * We handle [83] so we return immediately, if + * We handle [83] so we return immediately, if * "S SystemLiteral" is not detected. From a purely parsing * point of view that's a nice mess. */ @@ -3764,7 +4795,7 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) { ptr = CUR_PTR; if (!IS_BLANK_CH(*ptr)) return(NULL); - + while (IS_BLANK_CH(*ptr)) ptr++; /* TODO: dangerous, fix ! */ if ((*ptr != '\'') && (*ptr != '"')) return(NULL); } @@ -3792,12 +4823,15 @@ xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) { * [15] Comment ::= '' */ static void -xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) { +xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, + size_t len, size_t size) { int q, ql; int r, rl; int cur, l; - xmlParserInputPtr input = ctxt->input; - int count = 0; + size_t count = 0; + int inputid; + + inputid = ctxt->input->id; if (buf == NULL) { len = 0; @@ -3808,13 +4842,28 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) { return; } } + GROW; /* Assure there's enough input data */ q = CUR_CHAR(ql); if (q == 0) goto not_terminated; + if (!IS_CHAR(q)) { + xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, + "xmlParseComment: invalid xmlChar value %d\n", + q); + xmlFree (buf); + return; + } NEXTL(ql); r = CUR_CHAR(rl); if (r == 0) goto not_terminated; + if (!IS_CHAR(r)) { + xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, + "xmlParseComment: invalid xmlChar value %d\n", + q); + xmlFree (buf); + return; + } NEXTL(rl); cur = CUR_CHAR(l); if (cur == 0) @@ -3825,16 +4874,26 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) { if ((r == '-') && (q == '-')) { xmlFatalErr(ctxt, XML_ERR_HYPHEN_IN_COMMENT, NULL); } + if ((len > XML_MAX_TEXT_LENGTH) && + ((ctxt->options & XML_PARSE_HUGE) == 0)) { + xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, + "Comment too big found", NULL); + xmlFree (buf); + return; + } if (len + 5 >= size) { xmlChar *new_buf; - size *= 2; - new_buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); + size_t new_size; + + new_size = size * 2; + new_buf = (xmlChar *) xmlRealloc(buf, new_size); if (new_buf == NULL) { xmlFree (buf); xmlErrMemory(ctxt, NULL); return; } buf = new_buf; + size = new_size; } COPY_BUF(ql,buf,len,q); q = r; @@ -3846,6 +4905,10 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) { if (count > 50) { GROW; count = 0; + if (ctxt->instate == XML_PARSER_EOF) { + xmlFree(buf); + return; + } } NEXTL(l); cur = CUR_CHAR(l); @@ -3856,12 +4919,15 @@ xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) { } } buf[len] = 0; - if (!IS_CHAR(cur)) { + if (cur == 0) { xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, "Comment not terminated \n next; */ @@ -9246,14 +9827,14 @@ leave_node: } else { /* This is for attributes only. */ clone = clone->parent; - parentClone = clone->parent; + parentClone = clone->parent; /* * Process parent-element --> children. */ cur = cur->parent; - goto into_content; + goto into_content; } - } + } goto exit; internal_error: @@ -9274,7 +9855,7 @@ exit: nsMap->pool = nsMap->first; nsMap->first = NULL; } - } else + } else xmlDOMWrapNsMapFree(nsMap); } /* @@ -9314,7 +9895,7 @@ xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt, if ((attr == NULL) || (destDoc == NULL)) return (-1); - + attr->doc = destDoc; if (attr->ns != NULL) { xmlNsPtr ns = NULL; @@ -9341,13 +9922,13 @@ xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt, ns = xmlDOMWrapNSNormDeclareNsForced(destDoc, destParent, attr->ns->href, attr->ns->prefix, 1); } - } + } if (ns == NULL) goto internal_error; attr->ns = ns; - } - - XML_TREE_ADOPT_STR(attr->name); + } + + XML_TREE_ADOPT_STR(attr->name); attr->atype = 0; attr->psvi = NULL; /* @@ -9356,13 +9937,15 @@ xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt, if (attr->children == NULL) return (0); cur = attr->children; + if ((cur != NULL) && (cur->type == XML_NAMESPACE_DECL)) + goto internal_error; while (cur != NULL) { cur->doc = destDoc; switch (cur->type) { case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: XML_TREE_ADOPT_STR_2(cur->content) - break; + break; case XML_ENTITY_REF_NODE: /* * Remove reference to the entitity-node. @@ -9380,7 +9963,7 @@ xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt, cur->content = ent->content; cur->children = (xmlNodePtr) ent; cur->last = (xmlNodePtr) ent; - } + } } break; default: @@ -9417,9 +10000,9 @@ internal_error: * References of out-of scope ns-decls are remapped to point to @destDoc: * 1) If @destParent is given, then nsDef entries on element-nodes are used * 2) If *no* @destParent is given, then @destDoc->oldNs entries are used -* This is the case when you have an unliked node and just want to move it -* to the context of -* +* This is the case when you have an unlinked node and just want to move it +* to the context of +* * If @destParent is given, it ensures that the tree is namespace * wellformed by creating additional ns-decls where needed. * Note that, since prefixes of already existent ns-decls can be @@ -9436,16 +10019,17 @@ int xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, xmlDocPtr sourceDoc, xmlNodePtr node, - xmlDocPtr destDoc, + xmlDocPtr destDoc, xmlNodePtr destParent, int options) { - if ((node == NULL) || (destDoc == NULL) || + if ((node == NULL) || (node->type == XML_NAMESPACE_DECL) || + (destDoc == NULL) || ((destParent != NULL) && (destParent->doc != destDoc))) return(-1); /* * Check node->doc sanity. - */ + */ if ((node->doc != NULL) && (sourceDoc != NULL) && (node->doc != sourceDoc)) { /* @@ -9458,7 +10042,7 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, if (sourceDoc == destDoc) return (-1); switch (node->type) { - case XML_ELEMENT_NODE: + case XML_ELEMENT_NODE: case XML_ATTRIBUTE_NODE: case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: @@ -9484,7 +10068,7 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, } else if (node->type == XML_ATTRIBUTE_NODE) { return (xmlDOMWrapAdoptAttr(ctxt, sourceDoc, (xmlAttrPtr) node, destDoc, destParent, options)); - } else { + } else { xmlNodePtr cur = node; int adoptStr = 1; @@ -9496,7 +10080,7 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, (sourceDoc->dict == destDoc->dict)) adoptStr = 0; switch (node->type) { - case XML_TEXT_NODE: + case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: XML_TREE_ADOPT_STR_2(node->content) break; @@ -9529,7 +10113,7 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, default: break; } - } + } return (0); } diff --git a/gnulib-local/lib/libxml/tree.in.h b/gnulib-local/lib/libxml/tree.in.h index 321280e..4a9b3bc 100644 --- a/gnulib-local/lib/libxml/tree.in.h +++ b/gnulib-local/lib/libxml/tree.in.h @@ -13,6 +13,7 @@ #define __XML_TREE_H__ #include +#include #include #include @@ -71,15 +72,19 @@ typedef xmlEntity *xmlEntityPtr; */ typedef enum { - XML_BUFFER_ALLOC_DOUBLEIT, - XML_BUFFER_ALLOC_EXACT, - XML_BUFFER_ALLOC_IMMUTABLE + XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ + XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ + XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ + XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */ + XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */ + XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */ } xmlBufferAllocationScheme; /** * xmlBuffer: * - * A buffer structure. + * A buffer structure, this old construct is limited to 2GB and + * is being deprecated, use API with xmlBuf instead */ typedef struct _xmlBuffer xmlBuffer; typedef xmlBuffer *xmlBufferPtr; @@ -88,8 +93,44 @@ struct _xmlBuffer { unsigned int use; /* The buffer size used */ unsigned int size; /* The buffer size */ xmlBufferAllocationScheme alloc; /* The realloc method */ + xmlChar *contentIO; /* in IO mode we may have a different base */ }; +/** + * xmlBuf: + * + * A buffer structure, new one, the actual structure internals are not public + */ + +typedef struct _xmlBuf xmlBuf; + +/** + * xmlBufPtr: + * + * A pointer to a buffer structure, the actual structure internals are not + * public + */ + +typedef xmlBuf *xmlBufPtr; + +/* + * A few public routines for xmlBuf. As those are expected to be used + * mostly internally the bulk of the routines are internal in buf.h + */ +XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBuf* buf); +XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (xmlBufPtr buf); +XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf); +XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len); + +/* + * LIBXML2_NEW_BUFFER: + * + * Macro used to express that the API use the new buffers for + * xmlParserInputBuffer and xmlOutputBuffer. The change was + * introduced in 2.9.0. + */ +#define LIBXML2_NEW_BUFFER + /** * XML_XML_NAMESPACE: * @@ -477,11 +518,28 @@ struct _xmlNode { /** * XML_GET_LINE: * - * Macro to extract the line number of an element node. + * Macro to extract the line number of an element node. */ #define XML_GET_LINE(n) \ (xmlGetLineNo(n)) +/** + * xmlDocProperty + * + * Set of properties of the document as found by the parser + * Some of them are linked to similary named xmlParserOption + */ +typedef enum { + XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ + XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */ + XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */ + XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */ + XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */ + XML_DOC_USERBUILT = 1<<5, /* Document was built using the API + and not by parsing an instance */ + XML_DOC_INTERNAL = 1<<6, /* built for internal processing */ + XML_DOC_HTML = 1<<7 /* parsed or built HTML document */ +} xmlDocProperties; /** * xmlDoc: @@ -503,7 +561,12 @@ struct _xmlDoc { /* End of common part */ int compression;/* level of zlib compression */ - int standalone; /* standalone document (no external refs) */ + int standalone; /* standalone document (no external refs) + 1 if standalone="yes" + 0 if standalone="no" + -1 if there is no XML declaration + -2 if there is an XML declaration, but no + standalone attribute was specified */ struct _xmlDtd *intSubset; /* the document internal subset */ struct _xmlDtd *extSubset; /* the document external subset */ struct _xmlNs *oldNs; /* Global namespace, the old way */ @@ -516,6 +579,10 @@ struct _xmlDoc { actually an xmlCharEncoding */ struct _xmlDict *dict; /* dict used to allocate names or NULL */ void *psvi; /* for type/PSVI informations */ + int parseFlags; /* set of xmlParserOption used to parse the + document */ + int properties; /* set of xmlDocProperties for this document + set at the end of parsing */ }; @@ -525,9 +592,9 @@ typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; /** * xmlDOMWrapAcquireNsFunction: * @ctxt: a DOM wrapper context - * @node: the context node (element or attribute) + * @node: the context node (element or attribute) * @nsName: the requested namespace name - * @nsPrefix: the requested namespace prefix + * @nsPrefix: the requested namespace prefix * * A function called to acquire namespaces (xmlNs) from the wrapper. * @@ -574,7 +641,7 @@ struct _xmlDOMWrapCtxt { /** * xmlRootNode: * - * Macro for compatibility naming layer with libxml1. Maps + * Macro for compatibility naming layer with libxml1. Maps * to "children". */ #ifndef xmlRootNode @@ -588,436 +655,450 @@ struct _xmlDOMWrapCtxt { /* * Some helper functions */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || \ + defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || \ + defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || \ + defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) XMLPUBFUN int XMLCALL xmlValidateNCName (const xmlChar *value, int space); #endif #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateQName (const xmlChar *value, int space); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateName (const xmlChar *value, int space); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNMToken (const xmlChar *value, int space); #endif -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlBuildQName (const xmlChar *ncname, const xmlChar *prefix, xmlChar *memory, int len); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlSplitQName2 (const xmlChar *name, xmlChar **prefix); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlSplitQName3 (const xmlChar *name, int *len); /* - * Handling Buffers. + * Handling Buffers, the old ones see @xmlBuf for the new ones. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); -XMLPUBFUN xmlBufferAllocationScheme XMLCALL +XMLPUBFUN xmlBufferAllocationScheme XMLCALL xmlGetBufferAllocationScheme(void); -XMLPUBFUN xmlBufferPtr XMLCALL +XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreate (void); -XMLPUBFUN xmlBufferPtr XMLCALL +XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreateSize (size_t size); -XMLPUBFUN xmlBufferPtr XMLCALL +XMLPUBFUN xmlBufferPtr XMLCALL xmlBufferCreateStatic (void *mem, size_t size); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferResize (xmlBufferPtr buf, unsigned int size); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlBufferFree (xmlBufferPtr buf); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferDump (FILE *file, xmlBufferPtr buf); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferAdd (xmlBufferPtr buf, const xmlChar *str, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferAddHead (xmlBufferPtr buf, const xmlChar *str, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferCat (xmlBufferPtr buf, const xmlChar *str); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferCCat (xmlBufferPtr buf, const char *str); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferShrink (xmlBufferPtr buf, unsigned int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlBufferGrow (xmlBufferPtr buf, unsigned int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlBufferEmpty (xmlBufferPtr buf); -XMLPUBFUN const xmlChar* XMLCALL - xmlBufferContent (const xmlBufferPtr buf); -XMLPUBFUN void XMLCALL +XMLPUBFUN const xmlChar* XMLCALL + xmlBufferContent (const xmlBuffer *buf); +XMLPUBFUN xmlChar* XMLCALL + xmlBufferDetach (xmlBufferPtr buf); +XMLPUBFUN void XMLCALL xmlBufferSetAllocationScheme(xmlBufferPtr buf, xmlBufferAllocationScheme scheme); -XMLPUBFUN int XMLCALL - xmlBufferLength (const xmlBufferPtr buf); +XMLPUBFUN int XMLCALL + xmlBufferLength (const xmlBuffer *buf); /* * Creating/freeing new structures. */ -XMLPUBFUN xmlDtdPtr XMLCALL +XMLPUBFUN xmlDtdPtr XMLCALL xmlCreateIntSubset (xmlDocPtr doc, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL +XMLPUBFUN xmlDtdPtr XMLCALL xmlNewDtd (xmlDocPtr doc, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlGetIntSubset (xmlDocPtr doc); -XMLPUBFUN void XMLCALL +XMLPUBFUN xmlDtdPtr XMLCALL + xmlGetIntSubset (const xmlDoc *doc); +XMLPUBFUN void XMLCALL xmlFreeDtd (xmlDtdPtr cur); #ifdef LIBXML_LEGACY_ENABLED -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlNewGlobalNs (xmlDocPtr doc, const xmlChar *href, const xmlChar *prefix); #endif /* LIBXML_LEGACY_ENABLED */ -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlNewNs (xmlNodePtr node, const xmlChar *href, const xmlChar *prefix); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeNs (xmlNsPtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeNsList (xmlNsPtr cur); -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlNewDoc (const xmlChar *version); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeDoc (xmlDocPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlNewDocProp (xmlDocPtr doc, const xmlChar *name, const xmlChar *value); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlNewProp (xmlNodePtr node, const xmlChar *name, const xmlChar *value); #endif -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlNewNsProp (xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, const xmlChar *value); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlNewNsPropEatName (xmlNodePtr node, xmlNsPtr ns, xmlChar *name, const xmlChar *value); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreePropList (xmlAttrPtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeProp (xmlAttrPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlCopyProp (xmlNodePtr target, xmlAttrPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlCopyPropList (xmlNodePtr target, xmlAttrPtr cur); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlDtdPtr XMLCALL +XMLPUBFUN xmlDtdPtr XMLCALL xmlCopyDtd (xmlDtdPtr dtd); #endif /* LIBXML_TREE_ENABLED */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlCopyDoc (xmlDocPtr doc, int recursive); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ /* * Creating new nodes. */ -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocNode (xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocNodeEatName (xmlDocPtr doc, xmlNsPtr ns, xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewNode (xmlNsPtr ns, const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewNodeEatName (xmlNsPtr ns, xmlChar *name); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewChild (xmlNodePtr parent, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); #endif -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocText (xmlDocPtr doc, +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocText (const xmlDoc *doc, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewText (const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocPI (xmlDocPtr doc, const xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewPI (const xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocTextLen (xmlDocPtr doc, const xmlChar *content, int len); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewTextLen (const xmlChar *content, int len); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocComment (xmlDocPtr doc, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewComment (const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewCDataBlock (xmlDocPtr doc, const xmlChar *content, int len); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewCharRef (xmlDocPtr doc, const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewReference (xmlDocPtr doc, +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewReference (const xmlDoc *doc, const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL - xmlCopyNode (const xmlNodePtr node, +XMLPUBFUN xmlNodePtr XMLCALL + xmlCopyNode (xmlNodePtr node, int recursive); -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocCopyNode (const xmlNodePtr node, +XMLPUBFUN xmlNodePtr XMLCALL + xmlDocCopyNode (xmlNodePtr node, xmlDocPtr doc, int recursive); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlDocCopyNodeList (xmlDocPtr doc, - const xmlNodePtr node); -XMLPUBFUN xmlNodePtr XMLCALL - xmlCopyNodeList (const xmlNodePtr node); + xmlNodePtr node); +XMLPUBFUN xmlNodePtr XMLCALL + xmlCopyNodeList (xmlNodePtr node); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewTextChild (xmlNodePtr parent, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocRawNode (xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocFragment (xmlDocPtr doc); #endif /* LIBXML_TREE_ENABLED */ /* * Navigating. */ -XMLPUBFUN long XMLCALL - xmlGetLineNo (xmlNodePtr node); +XMLPUBFUN long XMLCALL + xmlGetLineNo (const xmlNode *node); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) -XMLPUBFUN xmlChar * XMLCALL - xmlGetNodePath (xmlNodePtr node); +XMLPUBFUN xmlChar * XMLCALL + xmlGetNodePath (const xmlNode *node); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocGetRootElement (xmlDocPtr doc); -XMLPUBFUN xmlNodePtr XMLCALL - xmlGetLastChild (xmlNodePtr parent); -XMLPUBFUN int XMLCALL - xmlNodeIsText (xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlIsBlankNode (xmlNodePtr node); +XMLPUBFUN xmlNodePtr XMLCALL + xmlDocGetRootElement (const xmlDoc *doc); +XMLPUBFUN xmlNodePtr XMLCALL + xmlGetLastChild (const xmlNode *parent); +XMLPUBFUN int XMLCALL + xmlNodeIsText (const xmlNode *node); +XMLPUBFUN int XMLCALL + xmlIsBlankNode (const xmlNode *node); /* * Changing the structure. */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlDocSetRootElement (xmlDocPtr doc, xmlNodePtr root); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetName (xmlNodePtr cur, const xmlChar *name); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild (xmlNodePtr parent, xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlAddChildList (xmlNodePtr parent, xmlNodePtr cur); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlReplaceNode (xmlNodePtr old, xmlNodePtr cur); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL + defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) +XMLPUBFUN xmlNodePtr XMLCALL xmlAddPrevSibling (xmlNodePtr cur, xmlNodePtr elem); #endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */ -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlAddSibling (xmlNodePtr cur, xmlNodePtr elem); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlAddNextSibling (xmlNodePtr cur, xmlNodePtr elem); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlUnlinkNode (xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlTextMerge (xmlNodePtr first, xmlNodePtr second); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextConcat (xmlNodePtr node, const xmlChar *content, int len); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeNodeList (xmlNodePtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeNode (xmlNodePtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetTreeDoc (xmlNodePtr tree, xmlDocPtr doc); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetListDoc (xmlNodePtr list, xmlDocPtr doc); /* * Namespaces. */ -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs (xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace); -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNsByHref (xmlDocPtr doc, xmlNodePtr node, const xmlChar *href); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN xmlNsPtr * XMLCALL - xmlGetNsList (xmlDocPtr doc, - xmlNodePtr node); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN xmlNsPtr * XMLCALL + xmlGetNsList (const xmlDoc *doc, + const xmlNode *node); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetNs (xmlNodePtr node, xmlNsPtr ns); -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlCopyNamespace (xmlNsPtr cur); -XMLPUBFUN xmlNsPtr XMLCALL +XMLPUBFUN xmlNsPtr XMLCALL xmlCopyNamespaceList (xmlNsPtr cur); /* * Changing the content. */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) -XMLPUBFUN xmlAttrPtr XMLCALL +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) +XMLPUBFUN xmlAttrPtr XMLCALL xmlSetProp (xmlNodePtr node, const xmlChar *name, const xmlChar *value); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlSetNsProp (xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, const xmlChar *value); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ -XMLPUBFUN xmlChar * XMLCALL - xmlGetNoNsProp (xmlNodePtr node, +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ +XMLPUBFUN xmlChar * XMLCALL + xmlGetNoNsProp (const xmlNode *node, const xmlChar *name); -XMLPUBFUN xmlChar * XMLCALL - xmlGetProp (xmlNodePtr node, +XMLPUBFUN xmlChar * XMLCALL + xmlGetProp (const xmlNode *node, const xmlChar *name); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlHasProp (xmlNodePtr node, +XMLPUBFUN xmlAttrPtr XMLCALL + xmlHasProp (const xmlNode *node, const xmlChar *name); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlHasNsProp (xmlNodePtr node, +XMLPUBFUN xmlAttrPtr XMLCALL + xmlHasNsProp (const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace); -XMLPUBFUN xmlChar * XMLCALL - xmlGetNsProp (xmlNodePtr node, +XMLPUBFUN xmlChar * XMLCALL + xmlGetNsProp (const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace); -XMLPUBFUN xmlNodePtr XMLCALL - xmlStringGetNodeList (xmlDocPtr doc, +XMLPUBFUN xmlNodePtr XMLCALL + xmlStringGetNodeList (const xmlDoc *doc, const xmlChar *value); -XMLPUBFUN xmlNodePtr XMLCALL - xmlStringLenGetNodeList (xmlDocPtr doc, +XMLPUBFUN xmlNodePtr XMLCALL + xmlStringLenGetNodeList (const xmlDoc *doc, const xmlChar *value, int len); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlNodeListGetString (xmlDocPtr doc, - xmlNodePtr list, + const xmlNode *list, int inLine); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlChar * XMLCALL - xmlNodeListGetRawString (xmlDocPtr doc, - xmlNodePtr list, +XMLPUBFUN xmlChar * XMLCALL + xmlNodeListGetRawString (const xmlDoc *doc, + const xmlNode *list, int inLine); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetContent (xmlNodePtr cur, const xmlChar *content); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetContentLen (xmlNodePtr cur, const xmlChar *content, int len); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeAddContent (xmlNodePtr cur, const xmlChar *content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeAddContentLen (xmlNodePtr cur, const xmlChar *content, int len); -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetContent (xmlNodePtr cur); +XMLPUBFUN xmlChar * XMLCALL + xmlNodeGetContent (const xmlNode *cur); + XMLPUBFUN int XMLCALL xmlNodeBufGetContent (xmlBufferPtr buffer, - xmlNodePtr cur); -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetLang (xmlNodePtr cur); -XMLPUBFUN int XMLCALL - xmlNodeGetSpacePreserve (xmlNodePtr cur); + const xmlNode *cur); +XMLPUBFUN int XMLCALL + xmlBufGetNodeContent (xmlBufPtr buf, + const xmlNode *cur); + +XMLPUBFUN xmlChar * XMLCALL + xmlNodeGetLang (const xmlNode *cur); +XMLPUBFUN int XMLCALL + xmlNodeGetSpacePreserve (const xmlNode *cur); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetLang (xmlNodePtr cur, const xmlChar *lang); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetSpacePreserve (xmlNodePtr cur, int val); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetBase (xmlDocPtr doc, - xmlNodePtr cur); +XMLPUBFUN xmlChar * XMLCALL + xmlNodeGetBase (const xmlDoc *doc, + const xmlNode *cur); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeSetBase (xmlNodePtr cur, const xmlChar *uri); #endif @@ -1025,14 +1106,14 @@ XMLPUBFUN void XMLCALL /* * Removing content. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRemoveProp (xmlAttrPtr cur); #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlUnsetNsProp (xmlNodePtr node, xmlNsPtr ns, const xmlChar *name); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlUnsetProp (xmlNodePtr node, const xmlChar *name); #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ @@ -1040,13 +1121,13 @@ XMLPUBFUN int XMLCALL /* * Internal, don't use. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlBufferWriteCHAR (xmlBufferPtr buf, const xmlChar *string); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlBufferWriteChar (xmlBufferPtr buf, const char *string); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string); @@ -1061,7 +1142,7 @@ XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, /* * Namespace handling. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlReconciliateNs (xmlDocPtr doc, xmlNodePtr tree); #endif @@ -1070,61 +1151,67 @@ XMLPUBFUN int XMLCALL /* * Saving. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDocDumpFormatMemory (xmlDocPtr cur, xmlChar **mem, int *size, int format); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDocDumpMemory (xmlDocPtr cur, xmlChar **mem, int *size); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDocDumpMemoryEnc (xmlDocPtr out_doc, xmlChar **doc_txt_ptr, int * doc_txt_len, const char *txt_encoding); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr, int * doc_txt_len, const char *txt_encoding, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlDocFormatDump (FILE *f, xmlDocPtr cur, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlDocDump (FILE *f, xmlDocPtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlElemDump (FILE *f, xmlDocPtr doc, xmlNodePtr cur); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFile (const char *filename, xmlDocPtr cur); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFormatFile (const char *filename, xmlDocPtr cur, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN size_t XMLCALL + xmlBufNodeDump (xmlBufPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format); +XMLPUBFUN int XMLCALL xmlNodeDump (xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFileTo (xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFormatFileTo (xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding, int format); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlNodeDumpOutput (xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, @@ -1132,13 +1219,13 @@ XMLPUBFUN void XMLCALL int format, const char *encoding); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFormatFileEnc (const char *filename, xmlDocPtr cur, const char *encoding, int format); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSaveFileEnc (const char *filename, xmlDocPtr cur, const char *encoding); @@ -1147,21 +1234,21 @@ XMLPUBFUN int XMLCALL /* * XHTML */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlIsXHTML (const xmlChar *systemID, const xmlChar *publicID); /* * Compression. */ -XMLPUBFUN int XMLCALL - xmlGetDocCompressMode (xmlDocPtr doc); -XMLPUBFUN void XMLCALL +XMLPUBFUN int XMLCALL + xmlGetDocCompressMode (const xmlDoc *doc); +XMLPUBFUN void XMLCALL xmlSetDocCompressMode (xmlDocPtr doc, int mode); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlGetCompressMode (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetCompressMode (int mode); /* @@ -1179,7 +1266,7 @@ XMLPUBFUN int XMLCALL xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt, xmlDocPtr sourceDoc, xmlNodePtr node, - xmlDocPtr destDoc, + xmlDocPtr destDoc, xmlNodePtr destParent, int options); XMLPUBFUN int XMLCALL @@ -1197,6 +1284,22 @@ XMLPUBFUN int XMLCALL int deep, int options); +#ifdef LIBXML_TREE_ENABLED +/* + * 5 interfaces from DOM ElementTraversal, but different in entities + * traversal. + */ +XMLPUBFUN unsigned long XMLCALL + xmlChildElementCount (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNextElementSibling (xmlNodePtr node); +XMLPUBFUN xmlNodePtr XMLCALL + xmlFirstElementChild (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr XMLCALL + xmlLastElementChild (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr XMLCALL + xmlPreviousElementSibling (xmlNodePtr node); +#endif #ifdef __cplusplus } #endif diff --git a/gnulib-local/lib/libxml/uri.c b/gnulib-local/lib/libxml/uri.c index 1e29223..ff47abb 100644 --- a/gnulib-local/lib/libxml/uri.c +++ b/gnulib-local/lib/libxml/uri.c @@ -1,7 +1,7 @@ /** - * uri.c: set of generic URI related routines + * uri.c: set of generic URI related routines * - * Reference: RFCs 2396, 2732 and 2373 + * Reference: RFCs 3986, 2732 and 2373 * * See Copyright for the status of this software. * @@ -18,14 +18,41 @@ #include #include -/************************************************************************ - * * - * Macros to differentiate various character type * - * directly extracted from RFC 2396 * - * * - ************************************************************************/ +/** + * MAX_URI_LENGTH: + * + * The definition of the URI regexp in the above RFC has no size limit + * In practice they are usually relativey short except for the + * data URI scheme as defined in RFC 2397. Even for data URI the usual + * maximum size before hitting random practical limits is around 64 KB + * and 4KB is usually a maximum admitted limit for proper operations. + * The value below is more a security limit than anything else and + * really should never be hit by 'normal' operations + * Set to 1 MByte in 2012, this is only enforced on output + */ +#define MAX_URI_LENGTH 1024 * 1024 + +static void +xmlURIErrMemory(const char *extra) +{ + if (extra) + __xmlRaiseError(NULL, NULL, NULL, + NULL, NULL, XML_FROM_URI, + XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, + extra, NULL, NULL, 0, 0, + "Memory allocation failed : %s\n", extra); + else + __xmlRaiseError(NULL, NULL, NULL, + NULL, NULL, XML_FROM_URI, + XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, + NULL, NULL, NULL, 0, 0, + "Memory allocation failed\n"); +} + +static void xmlCleanURI(xmlURIPtr uri); /* + * Old rule from 2396 used in legacy handling code * alpha = lowalpha | upalpha */ #define IS_ALPHA(x) (IS_LOWALPHA(x) || IS_UPALPHA(x)) @@ -60,32 +87,31 @@ #define IS_ALPHANUM(x) (IS_ALPHA(x) || IS_DIGIT(x)) -/* - * hex = digit | "A" | "B" | "C" | "D" | "E" | "F" | - * "a" | "b" | "c" | "d" | "e" | "f" - */ - -#define IS_HEX(x) ((IS_DIGIT(x)) || (((x) >= 'a') && ((x) <= 'f')) || \ - (((x) >= 'A') && ((x) <= 'F'))) - /* * mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" */ -#define IS_MARK(x) (((x) == '-') || ((x) == '_') || ((x) == '.') || \ - ((x) == '!') || ((x) == '~') || ((x) == '*') || ((x) == '\'') || \ +#define IS_MARK(x) (((x) == '-') || ((x) == '_') || ((x) == '.') || \ + ((x) == '!') || ((x) == '~') || ((x) == '*') || ((x) == '\'') || \ ((x) == '(') || ((x) == ')')) +/* + * unwise = "{" | "}" | "|" | "\" | "^" | "`" + */ +#define IS_UNWISE(p) \ + (((*(p) == '{')) || ((*(p) == '}')) || ((*(p) == '|')) || \ + ((*(p) == '\\')) || ((*(p) == '^')) || ((*(p) == '[')) || \ + ((*(p) == ']')) || ((*(p) == '`'))) /* * reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," | - * "[" | "]" + * "[" | "]" */ -#define IS_RESERVED(x) (((x) == ';') || ((x) == '/') || ((x) == '?') || \ - ((x) == ':') || ((x) == '@') || ((x) == '&') || ((x) == '=') || \ - ((x) == '+') || ((x) == '$') || ((x) == ',') || ((x) == '[') || \ - ((x) == ']')) +#define IS_RESERVED(x) (((x) == ';') || ((x) == '/') || ((x) == '?') || \ + ((x) == ':') || ((x) == '@') || ((x) == '&') || ((x) == '=') || \ + ((x) == '+') || ((x) == '$') || ((x) == ',') || ((x) == '[') || \ + ((x) == ']')) /* * unreserved = alphanum | mark @@ -94,1741 +120,1740 @@ #define IS_UNRESERVED(x) (IS_ALPHANUM(x) || IS_MARK(x)) /* - * escaped = "%" hex hex + * Skip to next pointer char, handle escaped sequences */ -#define IS_ESCAPED(p) ((*(p) == '%') && (IS_HEX((p)[1])) && \ - (IS_HEX((p)[2]))) +#define NEXT(p) ((*p == '%')? p += 3 : p++) /* - * uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" | - * "&" | "=" | "+" | "$" | "," + * Productions from the spec. + * + * authority = server | reg_name + * reg_name = 1*( unreserved | escaped | "$" | "," | + * ";" | ":" | "@" | "&" | "=" | "+" ) + * + * path = [ abs_path | opaque_part ] */ -#define IS_URIC_NO_SLASH(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) ||\ - ((*(p) == ';')) || ((*(p) == '?')) || ((*(p) == ':')) ||\ - ((*(p) == '@')) || ((*(p) == '&')) || ((*(p) == '=')) ||\ - ((*(p) == '+')) || ((*(p) == '$')) || ((*(p) == ','))) + +#define STRNDUP(s, n) (char *) xmlStrndup((const xmlChar *)(s), (n)) + +/************************************************************************ + * * + * RFC 3986 parser * + * * + ************************************************************************/ + +#define ISA_DIGIT(p) ((*(p) >= '0') && (*(p) <= '9')) +#define ISA_ALPHA(p) (((*(p) >= 'a') && (*(p) <= 'z')) || \ + ((*(p) >= 'A') && (*(p) <= 'Z'))) +#define ISA_HEXDIG(p) \ + (ISA_DIGIT(p) || ((*(p) >= 'a') && (*(p) <= 'f')) || \ + ((*(p) >= 'A') && (*(p) <= 'F'))) /* - * pchar = unreserved | escaped | ":" | "@" | "&" | "=" | "+" | "$" | "," + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + * / "*" / "+" / "," / ";" / "=" */ -#define IS_PCHAR(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \ - ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) ||\ - ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) ||\ - ((*(p) == ','))) +#define ISA_SUB_DELIM(p) \ + (((*(p) == '!')) || ((*(p) == '$')) || ((*(p) == '&')) || \ + ((*(p) == '(')) || ((*(p) == ')')) || ((*(p) == '*')) || \ + ((*(p) == '+')) || ((*(p) == ',')) || ((*(p) == ';')) || \ + ((*(p) == '=')) || ((*(p) == '\''))) /* - * rel_segment = 1*( unreserved | escaped | - * ";" | "@" | "&" | "=" | "+" | "$" | "," ) + * gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" */ - -#define IS_SEGMENT(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \ - ((*(p) == ';')) || ((*(p) == '@')) || ((*(p) == '&')) || \ - ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) || \ - ((*(p) == ','))) +#define ISA_GEN_DELIM(p) \ + (((*(p) == ':')) || ((*(p) == '/')) || ((*(p) == '?')) || \ + ((*(p) == '#')) || ((*(p) == '[')) || ((*(p) == ']')) || \ + ((*(p) == '@'))) /* - * scheme = alpha *( alpha | digit | "+" | "-" | "." ) + * reserved = gen-delims / sub-delims */ - -#define IS_SCHEME(x) ((IS_ALPHA(x)) || (IS_DIGIT(x)) || \ - ((x) == '+') || ((x) == '-') || ((x) == '.')) +#define ISA_RESERVED(p) (ISA_GEN_DELIM(p) || (ISA_SUB_DELIM(p))) /* - * reg_name = 1*( unreserved | escaped | "$" | "," | - * ";" | ":" | "@" | "&" | "=" | "+" ) + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" */ - -#define IS_REG_NAME(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \ - ((*(p) == '$')) || ((*(p) == ',')) || ((*(p) == ';')) || \ - ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) || \ - ((*(p) == '=')) || ((*(p) == '+'))) +#define ISA_UNRESERVED(p) \ + ((ISA_ALPHA(p)) || (ISA_DIGIT(p)) || ((*(p) == '-')) || \ + ((*(p) == '.')) || ((*(p) == '_')) || ((*(p) == '~'))) /* - * userinfo = *( unreserved | escaped | ";" | ":" | "&" | "=" | - * "+" | "$" | "," ) + * pct-encoded = "%" HEXDIG HEXDIG */ -#define IS_USERINFO(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \ - ((*(p) == ';')) || ((*(p) == ':')) || ((*(p) == '&')) || \ - ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) || \ - ((*(p) == ','))) +#define ISA_PCT_ENCODED(p) \ + ((*(p) == '%') && (ISA_HEXDIG(p + 1)) && (ISA_HEXDIG(p + 2))) /* - * uric = reserved | unreserved | escaped + * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" */ +#define ISA_PCHAR(p) \ + (ISA_UNRESERVED(p) || ISA_PCT_ENCODED(p) || ISA_SUB_DELIM(p) || \ + ((*(p) == ':')) || ((*(p) == '@'))) -#define IS_URIC(p) ((IS_UNRESERVED(*(p))) || (IS_ESCAPED(p)) || \ - (IS_RESERVED(*(p)))) +/** + * xmlParse3986Scheme: + * @uri: pointer to an URI structure + * @str: pointer to the string to analyze + * + * Parse an URI scheme + * + * ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) + * + * Returns 0 or the error code + */ +static int +xmlParse3986Scheme(xmlURIPtr uri, const char **str) { + const char *cur; -/* -* unwise = "{" | "}" | "|" | "\" | "^" | "`" -*/ + if (str == NULL) + return(-1); -#define IS_UNWISE(p) \ - (((*(p) == '{')) || ((*(p) == '}')) || ((*(p) == '|')) || \ - ((*(p) == '\\')) || ((*(p) == '^')) || ((*(p) == '[')) || \ - ((*(p) == ']')) || ((*(p) == '`'))) + cur = *str; + if (!ISA_ALPHA(cur)) + return(2); + cur++; + while (ISA_ALPHA(cur) || ISA_DIGIT(cur) || + (*cur == '+') || (*cur == '-') || (*cur == '.')) cur++; + if (uri != NULL) { + if (uri->scheme != NULL) xmlFree(uri->scheme); + uri->scheme = STRNDUP(*str, cur - *str); + } + *str = cur; + return(0); +} -/* - * Skip to next pointer char, handle escaped sequences +/** + * xmlParse3986Fragment: + * @uri: pointer to an URI structure + * @str: pointer to the string to analyze + * + * Parse the query part of an URI + * + * fragment = *( pchar / "/" / "?" ) + * NOTE: the strict syntax as defined by 3986 does not allow '[' and ']' + * in the fragment identifier but this is used very broadly for + * xpointer scheme selection, so we are allowing it here to not break + * for example all the DocBook processing chains. + * + * Returns 0 or the error code */ +static int +xmlParse3986Fragment(xmlURIPtr uri, const char **str) +{ + const char *cur; -#define NEXT(p) ((*p == '%')? p += 3 : p++) + if (str == NULL) + return (-1); -/* - * Productions from the spec. + cur = *str; + + while ((ISA_PCHAR(cur)) || (*cur == '/') || (*cur == '?') || + (*cur == '[') || (*cur == ']') || + ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) + NEXT(cur); + if (uri != NULL) { + if (uri->fragment != NULL) + xmlFree(uri->fragment); + if (uri->cleanup & 2) + uri->fragment = STRNDUP(*str, cur - *str); + else + uri->fragment = xmlURIUnescapeString(*str, cur - *str, NULL); + } + *str = cur; + return (0); +} + +/** + * xmlParse3986Query: + * @uri: pointer to an URI structure + * @str: pointer to the string to analyze * - * authority = server | reg_name - * reg_name = 1*( unreserved | escaped | "$" | "," | - * ";" | ":" | "@" | "&" | "=" | "+" ) + * Parse the query part of an URI * - * path = [ abs_path | opaque_part ] + * query = *uric + * + * Returns 0 or the error code */ +static int +xmlParse3986Query(xmlURIPtr uri, const char **str) +{ + const char *cur; -#define STRNDUP(s, n) (char *) xmlStrndup((const xmlChar *)(s), (n)) + if (str == NULL) + return (-1); -/************************************************************************ - * * - * Generic URI structure functions * - * * - ************************************************************************/ + cur = *str; + + while ((ISA_PCHAR(cur)) || (*cur == '/') || (*cur == '?') || + ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) + NEXT(cur); + if (uri != NULL) { + if (uri->query != NULL) + xmlFree(uri->query); + if (uri->cleanup & 2) + uri->query = STRNDUP(*str, cur - *str); + else + uri->query = xmlURIUnescapeString(*str, cur - *str, NULL); + + /* Save the raw bytes of the query as well. + * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00114 + */ + if (uri->query_raw != NULL) + xmlFree (uri->query_raw); + uri->query_raw = STRNDUP (*str, cur - *str); + } + *str = cur; + return (0); +} /** - * xmlCreateURI: + * xmlParse3986Port: + * @uri: pointer to an URI structure + * @str: the string to analyze * - * Simply creates an empty xmlURI + * Parse a port part and fills in the appropriate fields + * of the @uri structure * - * Returns the new structure or NULL in case of error + * port = *DIGIT + * + * Returns 0 or the error code */ -xmlURIPtr -xmlCreateURI(void) { - xmlURIPtr ret; +static int +xmlParse3986Port(xmlURIPtr uri, const char **str) +{ + const char *cur = *str; - ret = (xmlURIPtr) xmlMalloc(sizeof(xmlURI)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlCreateURI: out of memory\n"); - return(NULL); + if (ISA_DIGIT(cur)) { + if (uri != NULL) + uri->port = 0; + while (ISA_DIGIT(cur)) { + if (uri != NULL) + uri->port = uri->port * 10 + (*cur - '0'); + cur++; + } + *str = cur; + return(0); } - memset(ret, 0, sizeof(xmlURI)); - return(ret); + return(1); } /** - * xmlSaveUri: - * @uri: pointer to an xmlURI + * xmlParse3986Userinfo: + * @uri: pointer to an URI structure + * @str: the string to analyze * - * Save the URI as an escaped string + * Parse an user informations part and fills in the appropriate fields + * of the @uri structure * - * Returns a new string (to be deallocated by caller) + * userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) + * + * Returns 0 or the error code */ -xmlChar * -xmlSaveUri(xmlURIPtr uri) { - xmlChar *ret = NULL; - const char *p; - int len; - int max; +static int +xmlParse3986Userinfo(xmlURIPtr uri, const char **str) +{ + const char *cur; - if (uri == NULL) return(NULL); + cur = *str; + while (ISA_UNRESERVED(cur) || ISA_PCT_ENCODED(cur) || + ISA_SUB_DELIM(cur) || (*cur == ':')) + NEXT(cur); + if (*cur == '@') { + if (uri != NULL) { + if (uri->user != NULL) xmlFree(uri->user); + if (uri->cleanup & 2) + uri->user = STRNDUP(*str, cur - *str); + else + uri->user = xmlURIUnescapeString(*str, cur - *str, NULL); + } + *str = cur; + return(0); + } + return(1); +} +/** + * xmlParse3986DecOctet: + * @str: the string to analyze + * + * dec-octet = DIGIT ; 0-9 + * / %x31-39 DIGIT ; 10-99 + * / "1" 2DIGIT ; 100-199 + * / "2" %x30-34 DIGIT ; 200-249 + * / "25" %x30-35 ; 250-255 + * + * Skip a dec-octet. + * + * Returns 0 if found and skipped, 1 otherwise + */ +static int +xmlParse3986DecOctet(const char **str) { + const char *cur = *str; - max = 80; - ret = (xmlChar *) xmlMallocAtomic((max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - len = 0; + if (!(ISA_DIGIT(cur))) + return(1); + if (!ISA_DIGIT(cur+1)) + cur++; + else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur+2))) + cur += 2; + else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2))) + cur += 3; + else if ((*cur == '2') && (*(cur + 1) >= '0') && + (*(cur + 1) <= '4') && (ISA_DIGIT(cur + 2))) + cur += 3; + else if ((*cur == '2') && (*(cur + 1) == '5') && + (*(cur + 2) >= '0') && (*(cur + 1) <= '5')) + cur += 3; + else + return(1); + *str = cur; + return(0); +} +/** + * xmlParse3986Host: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an host part and fills in the appropriate fields + * of the @uri structure + * + * host = IP-literal / IPv4address / reg-name + * IP-literal = "[" ( IPv6address / IPvFuture ) "]" + * IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet + * reg-name = *( unreserved / pct-encoded / sub-delims ) + * + * Returns 0 or the error code + */ +static int +xmlParse3986Host(xmlURIPtr uri, const char **str) +{ + const char *cur = *str; + const char *host; - if (uri->scheme != NULL) { - p = uri->scheme; - while (*p != 0) { - if (len >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = *p++; - } - if (len >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = ':'; + host = cur; + /* + * IPv6 and future adressing scheme are enclosed between brackets + */ + if (*cur == '[') { + cur++; + while ((*cur != ']') && (*cur != 0)) + cur++; + if (*cur != ']') + return(1); + cur++; + goto found; } - if (uri->opaque != NULL) { - p = uri->opaque; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if (IS_RESERVED(*(p)) || IS_UNRESERVED(*(p))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } else { - if (uri->server != NULL) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '/'; - ret[len++] = '/'; - if (uri->user != NULL) { - p = uri->user; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if ((IS_UNRESERVED(*(p))) || - ((*(p) == ';')) || ((*(p) == ':')) || - ((*(p) == '&')) || ((*(p) == '=')) || - ((*(p) == '+')) || ((*(p) == '$')) || - ((*(p) == ','))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '@'; - } - p = uri->server; - while (*p != 0) { - if (len >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = *p++; - } - if (uri->port > 0) { - if (len + 10 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - len += snprintf((char *) &ret[len], max - len, ":%d", uri->port); - } - } else if (uri->authority != NULL) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '/'; - ret[len++] = '/'; - p = uri->authority; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if ((IS_UNRESERVED(*(p))) || - ((*(p) == '$')) || ((*(p) == ',')) || ((*(p) == ';')) || - ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) || - ((*(p) == '=')) || ((*(p) == '+'))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } else if (uri->scheme != NULL) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '/'; - ret[len++] = '/'; - } - if (uri->path != NULL) { - p = uri->path; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if ((IS_UNRESERVED(*(p))) || ((*(p) == '/')) || - ((*(p) == ';')) || ((*(p) == '@')) || ((*(p) == '&')) || - ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) || - ((*(p) == ','))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } - if (uri->query != NULL) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '?'; - p = uri->query; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p)))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } - } - if (uri->fragment != NULL) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = '#'; - p = uri->fragment; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p)))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } - if (len >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = 0; - return(ret); -} - -/** - * xmlPrintURI: - * @stream: a FILE* for the output - * @uri: pointer to an xmlURI - * - * Prints the URI in the stream @stream. - */ -void -xmlPrintURI(FILE *stream, xmlURIPtr uri) { - xmlChar *out; - - out = xmlSaveUri(uri); - if (out != NULL) { - fprintf(stream, "%s", (char *) out); - xmlFree(out); - } -} - -/** - * xmlCleanURI: - * @uri: pointer to an xmlURI - * - * Make sure the xmlURI struct is free of content - */ -static void -xmlCleanURI(xmlURIPtr uri) { - if (uri == NULL) return; - - if (uri->scheme != NULL) xmlFree(uri->scheme); - uri->scheme = NULL; - if (uri->server != NULL) xmlFree(uri->server); - uri->server = NULL; - if (uri->user != NULL) xmlFree(uri->user); - uri->user = NULL; - if (uri->path != NULL) xmlFree(uri->path); - uri->path = NULL; - if (uri->fragment != NULL) xmlFree(uri->fragment); - uri->fragment = NULL; - if (uri->opaque != NULL) xmlFree(uri->opaque); - uri->opaque = NULL; - if (uri->authority != NULL) xmlFree(uri->authority); - uri->authority = NULL; - if (uri->query != NULL) xmlFree(uri->query); - uri->query = NULL; -} - -/** - * xmlFreeURI: - * @uri: pointer to an xmlURI - * - * Free up the xmlURI struct - */ -void -xmlFreeURI(xmlURIPtr uri) { - if (uri == NULL) return; - - if (uri->scheme != NULL) xmlFree(uri->scheme); - if (uri->server != NULL) xmlFree(uri->server); - if (uri->user != NULL) xmlFree(uri->user); - if (uri->path != NULL) xmlFree(uri->path); - if (uri->fragment != NULL) xmlFree(uri->fragment); - if (uri->opaque != NULL) xmlFree(uri->opaque); - if (uri->authority != NULL) xmlFree(uri->authority); - if (uri->query != NULL) xmlFree(uri->query); - xmlFree(uri); -} - -/************************************************************************ - * * - * Helper functions * - * * - ************************************************************************/ - -/** - * xmlNormalizeURIPath: - * @path: pointer to the path string - * - * Applies the 5 normalization steps to a path string--that is, RFC 2396 - * Section 5.2, steps 6.c through 6.g. - * - * Normalization occurs directly on the string, no new allocation is done - * - * Returns 0 or an error code - */ -int -xmlNormalizeURIPath(char *path) { - char *cur, *out; - - if (path == NULL) - return(-1); - - /* Skip all initial "/" chars. We want to get to the beginning of the - * first non-empty segment. - */ - cur = path; - while (cur[0] == '/') - ++cur; - if (cur[0] == '\0') - return(0); - - /* Keep everything we've seen so far. */ - out = cur; - - /* - * Analyze each segment in sequence for cases (c) and (d). - */ - while (cur[0] != '\0') { - /* - * c) All occurrences of "./", where "." is a complete path segment, - * are removed from the buffer string. - */ - if ((cur[0] == '.') && (cur[1] == '/')) { - cur += 2; - /* '//' normalization should be done at this point too */ - while (cur[0] == '/') - cur++; - continue; - } - - /* - * d) If the buffer string ends with "." as a complete path segment, - * that "." is removed. - */ - if ((cur[0] == '.') && (cur[1] == '\0')) - break; - - /* Otherwise keep the segment. */ - while (cur[0] != '/') { - if (cur[0] == '\0') - goto done_cd; - (out++)[0] = (cur++)[0]; - } - /* nomalize // */ - while ((cur[0] == '/') && (cur[1] == '/')) - cur++; - - (out++)[0] = (cur++)[0]; - } - done_cd: - out[0] = '\0'; - - /* Reset to the beginning of the first segment for the next sequence. */ - cur = path; - while (cur[0] == '/') - ++cur; - if (cur[0] == '\0') - return(0); - - /* - * Analyze each segment in sequence for cases (e) and (f). - * - * e) All occurrences of "/../", where is a - * complete path segment not equal to "..", are removed from the - * buffer string. Removal of these path segments is performed - * iteratively, removing the leftmost matching pattern on each - * iteration, until no matching pattern remains. - * - * f) If the buffer string ends with "/..", where - * is a complete path segment not equal to "..", that - * "/.." is removed. - * - * To satisfy the "iterative" clause in (e), we need to collapse the - * string every time we find something that needs to be removed. Thus, - * we don't need to keep two pointers into the string: we only need a - * "current position" pointer. - */ - while (1) { - char *segp, *tmp; - - /* At the beginning of each iteration of this loop, "cur" points to - * the first character of the segment we want to examine. - */ - - /* Find the end of the current segment. */ - segp = cur; - while ((segp[0] != '/') && (segp[0] != '\0')) - ++segp; - - /* If this is the last segment, we're done (we need at least two - * segments to meet the criteria for the (e) and (f) cases). - */ - if (segp[0] == '\0') - break; - - /* If the first segment is "..", or if the next segment _isn't_ "..", - * keep this segment and try the next one. - */ - ++segp; - if (((cur[0] == '.') && (cur[1] == '.') && (segp == cur+3)) - || ((segp[0] != '.') || (segp[1] != '.') - || ((segp[2] != '/') && (segp[2] != '\0')))) { - cur = segp; - continue; - } - - /* If we get here, remove this segment and the next one and back up - * to the previous segment (if there is one), to implement the - * "iteratively" clause. It's pretty much impossible to back up - * while maintaining two pointers into the buffer, so just compact - * the whole buffer now. - */ - - /* If this is the end of the buffer, we're done. */ - if (segp[2] == '\0') { - cur[0] = '\0'; - break; - } - /* Valgrind complained, strcpy(cur, segp + 3); */ - /* string will overlap, do not use strcpy */ - tmp = cur; - segp += 3; - while ((*tmp++ = *segp++) != 0); - - /* If there are no previous segments, then keep going from here. */ - segp = cur; - while ((segp > path) && ((--segp)[0] == '/')) - ; - if (segp == path) - continue; - - /* "segp" is pointing to the end of a previous segment; find it's - * start. We need to back up to the previous segment and start - * over with that to handle things like "foo/bar/../..". If we - * don't do this, then on the first pass we'll remove the "bar/..", - * but be pointing at the second ".." so we won't realize we can also - * remove the "foo/..". - */ - cur = segp; - while ((cur > path) && (cur[-1] != '/')) - --cur; + /* + * try to parse an IPv4 + */ + if (ISA_DIGIT(cur)) { + if (xmlParse3986DecOctet(&cur) != 0) + goto not_ipv4; + if (*cur != '.') + goto not_ipv4; + cur++; + if (xmlParse3986DecOctet(&cur) != 0) + goto not_ipv4; + if (*cur != '.') + goto not_ipv4; + if (xmlParse3986DecOctet(&cur) != 0) + goto not_ipv4; + if (*cur != '.') + goto not_ipv4; + if (xmlParse3986DecOctet(&cur) != 0) + goto not_ipv4; + goto found; +not_ipv4: + cur = *str; } - out[0] = '\0'; - /* - * g) If the resulting buffer string still begins with one or more - * complete path segments of "..", then the reference is - * considered to be in error. Implementations may handle this - * error by retaining these components in the resolved path (i.e., - * treating them as part of the final URI), by removing them from - * the resolved path (i.e., discarding relative levels above the - * root), or by avoiding traversal of the reference. - * - * We discard them from the final path. + * then this should be a hostname which can be empty */ - if (path[0] == '/') { - cur = path; - while ((cur[0] == '/') && (cur[1] == '.') && (cur[2] == '.') - && ((cur[3] == '/') || (cur[3] == '\0'))) - cur += 3; - - if (cur != path) { - out = path; - while (cur[0] != '\0') - (out++)[0] = (cur++)[0]; - out[0] = 0; - } + while (ISA_UNRESERVED(cur) || ISA_PCT_ENCODED(cur) || ISA_SUB_DELIM(cur)) + NEXT(cur); +found: + if (uri != NULL) { + if (uri->authority != NULL) xmlFree(uri->authority); + uri->authority = NULL; + if (uri->server != NULL) xmlFree(uri->server); + if (cur != host) { + if (uri->cleanup & 2) + uri->server = STRNDUP(host, cur - host); + else + uri->server = xmlURIUnescapeString(host, cur - host, NULL); + } else + uri->server = NULL; } - + *str = cur; return(0); } -static int is_hex(char c) { - if (((c >= '0') && (c <= '9')) || - ((c >= 'a') && (c <= 'f')) || - ((c >= 'A') && (c <= 'F'))) - return(1); +/** + * xmlParse3986Authority: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an authority part and fills in the appropriate fields + * of the @uri structure + * + * authority = [ userinfo "@" ] host [ ":" port ] + * + * Returns 0 or the error code + */ +static int +xmlParse3986Authority(xmlURIPtr uri, const char **str) +{ + const char *cur; + int ret; + + cur = *str; + /* + * try to parse an userinfo and check for the trailing @ + */ + ret = xmlParse3986Userinfo(uri, &cur); + if ((ret != 0) || (*cur != '@')) + cur = *str; + else + cur++; + ret = xmlParse3986Host(uri, &cur); + if (ret != 0) return(ret); + if (*cur == ':') { + cur++; + ret = xmlParse3986Port(uri, &cur); + if (ret != 0) return(ret); + } + *str = cur; return(0); } /** - * xmlURIUnescapeString: - * @str: the string to unescape - * @len: the length in bytes to unescape (or <= 0 to indicate full string) - * @target: optional destination buffer + * xmlParse3986Segment: + * @str: the string to analyze + * @forbid: an optional forbidden character + * @empty: allow an empty segment + * + * Parse a segment and fills in the appropriate fields + * of the @uri structure * - * Unescaping routine, does not do validity checks ! - * Output is direct unsigned char translation of %XX values (no encoding) + * segment = *pchar + * segment-nz = 1*pchar + * segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" ) + * ; non-zero-length segment without any colon ":" * - * Returns an copy of the string, but unescaped + * Returns 0 or the error code */ -char * -xmlURIUnescapeString(const char *str, int len, char *target) { - char *ret, *out; - const char *in; - - if (str == NULL) - return(NULL); - if (len <= 0) len = strlen(str); - if (len < 0) return(NULL); +static int +xmlParse3986Segment(const char **str, char forbid, int empty) +{ + const char *cur; - if (target == NULL) { - ret = (char *) xmlMallocAtomic(len + 1); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlURIUnescapeString: out of memory\n"); - return(NULL); - } - } else - ret = target; - in = str; - out = ret; - while(len > 0) { - if ((len > 2) && (*in == '%') && (is_hex(in[1])) && (is_hex(in[2]))) { - in++; - if ((*in >= '0') && (*in <= '9')) - *out = (*in - '0'); - else if ((*in >= 'a') && (*in <= 'f')) - *out = (*in - 'a') + 10; - else if ((*in >= 'A') && (*in <= 'F')) - *out = (*in - 'A') + 10; - in++; - if ((*in >= '0') && (*in <= '9')) - *out = *out * 16 + (*in - '0'); - else if ((*in >= 'a') && (*in <= 'f')) - *out = *out * 16 + (*in - 'a') + 10; - else if ((*in >= 'A') && (*in <= 'F')) - *out = *out * 16 + (*in - 'A') + 10; - in++; - len -= 3; - out++; - } else { - *out++ = *in++; - len--; - } + cur = *str; + if (!ISA_PCHAR(cur)) { + if (empty) + return(0); + return(1); } - *out = 0; - return(ret); + while (ISA_PCHAR(cur) && (*cur != forbid)) + NEXT(cur); + *str = cur; + return (0); } /** - * xmlURIEscapeStr: - * @str: string to escape - * @list: exception list string of chars not to escape + * xmlParse3986PathAbEmpty: + * @uri: pointer to an URI structure + * @str: the string to analyze * - * This routine escapes a string to hex, ignoring reserved characters (a-z) - * and the characters in the exception list. + * Parse an path absolute or empty and fills in the appropriate fields + * of the @uri structure * - * Returns a new escaped string or NULL in case of error. + * path-abempty = *( "/" segment ) + * + * Returns 0 or the error code */ -xmlChar * -xmlURIEscapeStr(const xmlChar *str, const xmlChar *list) { - xmlChar *ret, ch; - const xmlChar *in; - - unsigned int len, out; +static int +xmlParse3986PathAbEmpty(xmlURIPtr uri, const char **str) +{ + const char *cur; + int ret; - if (str == NULL) - return(NULL); - if (str[0] == 0) - return(xmlStrdup(str)); - len = xmlStrlen(str); - if (!(len > 0)) return(NULL); + cur = *str; - len += 20; - ret = (xmlChar *) xmlMallocAtomic(len); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlURIEscapeStr: out of memory\n"); - return(NULL); + while (*cur == '/') { + cur++; + ret = xmlParse3986Segment(&cur, 0, 1); + if (ret != 0) return(ret); } - in = (const xmlChar *) str; - out = 0; - while(*in != 0) { - if (len - out <= 3) { - len += 20; - ret = (xmlChar *) xmlRealloc(ret, len); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlURIEscapeStr: out of memory\n"); - return(NULL); - } - } + if (uri != NULL) { + if (uri->path != NULL) xmlFree(uri->path); + if (*str != cur) { + if (uri->cleanup & 2) + uri->path = STRNDUP(*str, cur - *str); + else + uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); + } else { + uri->path = NULL; + } + } + *str = cur; + return (0); +} - ch = *in; +/** + * xmlParse3986PathAbsolute: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an path absolute and fills in the appropriate fields + * of the @uri structure + * + * path-absolute = "/" [ segment-nz *( "/" segment ) ] + * + * Returns 0 or the error code + */ +static int +xmlParse3986PathAbsolute(xmlURIPtr uri, const char **str) +{ + const char *cur; + int ret; - if ((ch != '@') && (!IS_UNRESERVED(ch)) && (!xmlStrchr(list, ch))) { - unsigned char val; - ret[out++] = '%'; - val = ch >> 4; - if (val <= 9) - ret[out++] = '0' + val; - else - ret[out++] = 'A' + val - 0xA; - val = ch & 0xF; - if (val <= 9) - ret[out++] = '0' + val; - else - ret[out++] = 'A' + val - 0xA; - in++; - } else { - ret[out++] = *in++; + cur = *str; + + if (*cur != '/') + return(1); + cur++; + ret = xmlParse3986Segment(&cur, 0, 0); + if (ret == 0) { + while (*cur == '/') { + cur++; + ret = xmlParse3986Segment(&cur, 0, 1); + if (ret != 0) return(ret); } + } + if (uri != NULL) { + if (uri->path != NULL) xmlFree(uri->path); + if (cur != *str) { + if (uri->cleanup & 2) + uri->path = STRNDUP(*str, cur - *str); + else + uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); + } else { + uri->path = NULL; + } + } + *str = cur; + return (0); +} + +/** + * xmlParse3986PathRootless: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an path without root and fills in the appropriate fields + * of the @uri structure + * + * path-rootless = segment-nz *( "/" segment ) + * + * Returns 0 or the error code + */ +static int +xmlParse3986PathRootless(xmlURIPtr uri, const char **str) +{ + const char *cur; + int ret; + cur = *str; + + ret = xmlParse3986Segment(&cur, 0, 0); + if (ret != 0) return(ret); + while (*cur == '/') { + cur++; + ret = xmlParse3986Segment(&cur, 0, 1); + if (ret != 0) return(ret); } - ret[out] = 0; - return(ret); + if (uri != NULL) { + if (uri->path != NULL) xmlFree(uri->path); + if (cur != *str) { + if (uri->cleanup & 2) + uri->path = STRNDUP(*str, cur - *str); + else + uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); + } else { + uri->path = NULL; + } + } + *str = cur; + return (0); } /** - * xmlURIEscape: - * @str: the string of the URI to escape + * xmlParse3986PathNoScheme: + * @uri: pointer to an URI structure + * @str: the string to analyze * - * Escaping routine, does not do validity checks ! - * It will try to escape the chars needing this, but this is heuristic - * based it's impossible to be sure. + * Parse an path which is not a scheme and fills in the appropriate fields + * of the @uri structure * - * Returns an copy of the string, but escaped + * path-noscheme = segment-nz-nc *( "/" segment ) * - * 25 May 2001 - * Uses xmlParseURI and xmlURIEscapeStr to try to escape correctly - * according to RFC2396. - * - Carl Douglas + * Returns 0 or the error code */ -xmlChar * -xmlURIEscape(const xmlChar * str) +static int +xmlParse3986PathNoScheme(xmlURIPtr uri, const char **str) { - xmlChar *ret, *segment = NULL; - xmlURIPtr uri; - int ret2; - -#define NULLCHK(p) if(!p) { \ - xmlGenericError(xmlGenericErrorContext, \ - "xmlURIEscape: out of memory\n"); \ - return NULL; } + const char *cur; + int ret; - if (str == NULL) - return (NULL); + cur = *str; - uri = xmlCreateURI(); + ret = xmlParse3986Segment(&cur, ':', 0); + if (ret != 0) return(ret); + while (*cur == '/') { + cur++; + ret = xmlParse3986Segment(&cur, 0, 1); + if (ret != 0) return(ret); + } if (uri != NULL) { - /* - * Allow escaping errors in the unescaped form - */ - uri->cleanup = 1; - ret2 = xmlParseURIReference(uri, (const char *)str); - if (ret2) { - xmlFreeURI(uri); - return (NULL); + if (uri->path != NULL) xmlFree(uri->path); + if (cur != *str) { + if (uri->cleanup & 2) + uri->path = STRNDUP(*str, cur - *str); + else + uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); + } else { + uri->path = NULL; } } + *str = cur; + return (0); +} - if (!uri) - return NULL; +/** + * xmlParse3986HierPart: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an hierarchical part and fills in the appropriate fields + * of the @uri structure + * + * hier-part = "//" authority path-abempty + * / path-absolute + * / path-rootless + * / path-empty + * + * Returns 0 or the error code + */ +static int +xmlParse3986HierPart(xmlURIPtr uri, const char **str) +{ + const char *cur; + int ret; - ret = NULL; + cur = *str; - if (uri->scheme) { - segment = xmlURIEscapeStr(BAD_CAST uri->scheme, BAD_CAST "+-."); - NULLCHK(segment) - ret = xmlStrcat(ret, segment); - ret = xmlStrcat(ret, BAD_CAST ":"); - xmlFree(segment); + if ((*cur == '/') && (*(cur + 1) == '/')) { + cur += 2; + ret = xmlParse3986Authority(uri, &cur); + if (ret != 0) return(ret); + if (uri->server == NULL) + uri->port = -1; + ret = xmlParse3986PathAbEmpty(uri, &cur); + if (ret != 0) return(ret); + *str = cur; + return(0); + } else if (*cur == '/') { + ret = xmlParse3986PathAbsolute(uri, &cur); + if (ret != 0) return(ret); + } else if (ISA_PCHAR(cur)) { + ret = xmlParse3986PathRootless(uri, &cur); + if (ret != 0) return(ret); + } else { + /* path-empty is effectively empty */ + if (uri != NULL) { + if (uri->path != NULL) xmlFree(uri->path); + uri->path = NULL; + } } + *str = cur; + return (0); +} - if (uri->authority) { - segment = - xmlURIEscapeStr(BAD_CAST uri->authority, BAD_CAST "/?;:@"); - NULLCHK(segment) - ret = xmlStrcat(ret, BAD_CAST "//"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } +/** + * xmlParse3986RelativeRef: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an URI string and fills in the appropriate fields + * of the @uri structure + * + * relative-ref = relative-part [ "?" query ] [ "#" fragment ] + * relative-part = "//" authority path-abempty + * / path-absolute + * / path-noscheme + * / path-empty + * + * Returns 0 or the error code + */ +static int +xmlParse3986RelativeRef(xmlURIPtr uri, const char *str) { + int ret; - if (uri->user) { - segment = xmlURIEscapeStr(BAD_CAST uri->user, BAD_CAST ";:&=+$,"); - NULLCHK(segment) - ret = xmlStrcat(ret,BAD_CAST "//"); - ret = xmlStrcat(ret, segment); - ret = xmlStrcat(ret, BAD_CAST "@"); - xmlFree(segment); + if ((*str == '/') && (*(str + 1) == '/')) { + str += 2; + ret = xmlParse3986Authority(uri, &str); + if (ret != 0) return(ret); + ret = xmlParse3986PathAbEmpty(uri, &str); + if (ret != 0) return(ret); + } else if (*str == '/') { + ret = xmlParse3986PathAbsolute(uri, &str); + if (ret != 0) return(ret); + } else if (ISA_PCHAR(str)) { + ret = xmlParse3986PathNoScheme(uri, &str); + if (ret != 0) return(ret); + } else { + /* path-empty is effectively empty */ + if (uri != NULL) { + if (uri->path != NULL) xmlFree(uri->path); + uri->path = NULL; + } } - if (uri->server) { - segment = xmlURIEscapeStr(BAD_CAST uri->server, BAD_CAST "/?;:@"); - NULLCHK(segment) - if (uri->user == NULL) - ret = xmlStrcat(ret, BAD_CAST "//"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); + if (*str == '?') { + str++; + ret = xmlParse3986Query(uri, &str); + if (ret != 0) return(ret); + } + if (*str == '#') { + str++; + ret = xmlParse3986Fragment(uri, &str); + if (ret != 0) return(ret); + } + if (*str != 0) { + xmlCleanURI(uri); + return(1); } + return(0); +} - if (uri->port) { - xmlChar port[10]; - snprintf((char *) port, 10, "%d", uri->port); - ret = xmlStrcat(ret, BAD_CAST ":"); - ret = xmlStrcat(ret, port); - } +/** + * xmlParse3986URI: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an URI string and fills in the appropriate fields + * of the @uri structure + * + * scheme ":" hier-part [ "?" query ] [ "#" fragment ] + * + * Returns 0 or the error code + */ +static int +xmlParse3986URI(xmlURIPtr uri, const char *str) { + int ret; - if (uri->path) { - segment = - xmlURIEscapeStr(BAD_CAST uri->path, BAD_CAST ":@&=+$,/?;"); - NULLCHK(segment) - ret = xmlStrcat(ret, segment); - xmlFree(segment); + ret = xmlParse3986Scheme(uri, &str); + if (ret != 0) return(ret); + if (*str != ':') { + return(1); } - - if (uri->query) { - segment = - xmlURIEscapeStr(BAD_CAST uri->query, BAD_CAST ";/?:@&=+,$"); - NULLCHK(segment) - ret = xmlStrcat(ret, BAD_CAST "?"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); + str++; + ret = xmlParse3986HierPart(uri, &str); + if (ret != 0) return(ret); + if (*str == '?') { + str++; + ret = xmlParse3986Query(uri, &str); + if (ret != 0) return(ret); + } + if (*str == '#') { + str++; + ret = xmlParse3986Fragment(uri, &str); + if (ret != 0) return(ret); + } + if (*str != 0) { + xmlCleanURI(uri); + return(1); } + return(0); +} - if (uri->opaque) { - segment = xmlURIEscapeStr(BAD_CAST uri->opaque, BAD_CAST ""); - NULLCHK(segment) - ret = xmlStrcat(ret, segment); - xmlFree(segment); +/** + * xmlParse3986URIReference: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an URI reference string and fills in the appropriate fields + * of the @uri structure + * + * URI-reference = URI / relative-ref + * + * Returns 0 or the error code + */ +static int +xmlParse3986URIReference(xmlURIPtr uri, const char *str) { + int ret; + + if (str == NULL) + return(-1); + xmlCleanURI(uri); + + /* + * Try first to parse absolute refs, then fallback to relative if + * it fails. + */ + ret = xmlParse3986URI(uri, str); + if (ret != 0) { + xmlCleanURI(uri); + ret = xmlParse3986RelativeRef(uri, str); + if (ret != 0) { + xmlCleanURI(uri); + return(ret); + } } + return(0); +} - if (uri->fragment) { - segment = xmlURIEscapeStr(BAD_CAST uri->fragment, BAD_CAST "#"); - NULLCHK(segment) - ret = xmlStrcat(ret, BAD_CAST "#"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); +/** + * xmlParseURI: + * @str: the URI string to analyze + * + * Parse an URI based on RFC 3986 + * + * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] + * + * Returns a newly built xmlURIPtr or NULL in case of error + */ +xmlURIPtr +xmlParseURI(const char *str) { + xmlURIPtr uri; + int ret; + + if (str == NULL) + return(NULL); + uri = xmlCreateURI(); + if (uri != NULL) { + ret = xmlParse3986URIReference(uri, str); + if (ret) { + xmlFreeURI(uri); + return(NULL); + } } + return(uri); +} + +/** + * xmlParseURIReference: + * @uri: pointer to an URI structure + * @str: the string to analyze + * + * Parse an URI reference string based on RFC 3986 and fills in the + * appropriate fields of the @uri structure + * + * URI-reference = URI / relative-ref + * + * Returns 0 or the error code + */ +int +xmlParseURIReference(xmlURIPtr uri, const char *str) { + return(xmlParse3986URIReference(uri, str)); +} - xmlFreeURI(uri); -#undef NULLCHK +/** + * xmlParseURIRaw: + * @str: the URI string to analyze + * @raw: if 1 unescaping of URI pieces are disabled + * + * Parse an URI but allows to keep intact the original fragments. + * + * URI-reference = URI / relative-ref + * + * Returns a newly built xmlURIPtr or NULL in case of error + */ +xmlURIPtr +xmlParseURIRaw(const char *str, int raw) { + xmlURIPtr uri; + int ret; - return (ret); + if (str == NULL) + return(NULL); + uri = xmlCreateURI(); + if (uri != NULL) { + if (raw) { + uri->cleanup |= 2; + } + ret = xmlParseURIReference(uri, str); + if (ret) { + xmlFreeURI(uri); + return(NULL); + } + } + return(uri); } /************************************************************************ * * - * Escaped URI parsing * + * Generic URI structure functions * * * ************************************************************************/ /** - * xmlParseURIFragment: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze + * xmlCreateURI: * - * Parse an URI fragment string and fills in the appropriate fields - * of the @uri structure. - * - * fragment = *uric + * Simply creates an empty xmlURI * - * Returns 0 or the error code + * Returns the new structure or NULL in case of error */ -static int -xmlParseURIFragment(xmlURIPtr uri, const char **str) -{ - const char *cur; - - if (str == NULL) - return (-1); +xmlURIPtr +xmlCreateURI(void) { + xmlURIPtr ret; - cur = *str; + ret = (xmlURIPtr) xmlMalloc(sizeof(xmlURI)); + if (ret == NULL) { + xmlURIErrMemory("creating URI structure\n"); + return(NULL); + } + memset(ret, 0, sizeof(xmlURI)); + return(ret); +} - while (IS_URIC(cur) || IS_UNWISE(cur)) - NEXT(cur); - if (uri != NULL) { - if (uri->fragment != NULL) - xmlFree(uri->fragment); - if (uri->cleanup & 2) - uri->fragment = STRNDUP(*str, cur - *str); - else - uri->fragment = xmlURIUnescapeString(*str, cur - *str, NULL); +/** + * xmlSaveUriRealloc: + * + * Function to handle properly a reallocation when saving an URI + * Also imposes some limit on the length of an URI string output + */ +static xmlChar * +xmlSaveUriRealloc(xmlChar *ret, int *max) { + xmlChar *temp; + int tmp; + + if (*max > MAX_URI_LENGTH) { + xmlURIErrMemory("reaching arbitrary MAX_URI_LENGTH limit\n"); + return(NULL); } - *str = cur; - return (0); + tmp = *max * 2; + temp = (xmlChar *) xmlRealloc(ret, (tmp + 1)); + if (temp == NULL) { + xmlURIErrMemory("saving URI\n"); + return(NULL); + } + *max = tmp; + return(temp); } /** - * xmlParseURIQuery: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze + * xmlSaveUri: + * @uri: pointer to an xmlURI * - * Parse the query part of an URI - * - * query = *uric + * Save the URI as an escaped string * - * Returns 0 or the error code + * Returns a new string (to be deallocated by caller) */ -static int -xmlParseURIQuery(xmlURIPtr uri, const char **str) -{ - const char *cur; +xmlChar * +xmlSaveUri(xmlURIPtr uri) { + xmlChar *ret = NULL; + xmlChar *temp; + const char *p; + int len; + int max; + + if (uri == NULL) return(NULL); + + + max = 80; + ret = (xmlChar *) xmlMallocAtomic((max + 1) * sizeof(xmlChar)); + if (ret == NULL) { + xmlURIErrMemory("saving URI\n"); + return(NULL); + } + len = 0; + + if (uri->scheme != NULL) { + p = uri->scheme; + while (*p != 0) { + if (len >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len++] = *p++; + } + if (len >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len++] = ':'; + } + if (uri->opaque != NULL) { + p = uri->opaque; + while (*p != 0) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + if (IS_RESERVED(*(p)) || IS_UNRESERVED(*(p))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } + } else { + if ((uri->server != NULL) || (uri->port == -1)) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len++] = '/'; + ret[len++] = '/'; + if (uri->user != NULL) { + p = uri->user; + while (*p != 0) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + if ((IS_UNRESERVED(*(p))) || + ((*(p) == ';')) || ((*(p) == ':')) || + ((*(p) == '&')) || ((*(p) == '=')) || + ((*(p) == '+')) || ((*(p) == '$')) || + ((*(p) == ','))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len++] = '@'; + } + if (uri->server != NULL) { + p = uri->server; + while (*p != 0) { + if (len >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len++] = *p++; + } + if (uri->port > 0) { + if (len + 10 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + len += snprintf((char *) &ret[len], max - len, ":%d", uri->port); + } + } + } else if (uri->authority != NULL) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len++] = '/'; + ret[len++] = '/'; + p = uri->authority; + while (*p != 0) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + if ((IS_UNRESERVED(*(p))) || + ((*(p) == '$')) || ((*(p) == ',')) || ((*(p) == ';')) || + ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) || + ((*(p) == '=')) || ((*(p) == '+'))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } + } else if (uri->scheme != NULL) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + } + if (uri->path != NULL) { + p = uri->path; + /* + * the colon in file:///d: should not be escaped or + * Windows accesses fail later. + */ + if ((uri->scheme != NULL) && + (p[0] == '/') && + (((p[1] >= 'a') && (p[1] <= 'z')) || + ((p[1] >= 'A') && (p[1] <= 'Z'))) && + (p[2] == ':') && + (xmlStrEqual(BAD_CAST uri->scheme, BAD_CAST "file"))) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len++] = *p++; + ret[len++] = *p++; + ret[len++] = *p++; + } + while (*p != 0) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + if ((IS_UNRESERVED(*(p))) || ((*(p) == '/')) || + ((*(p) == ';')) || ((*(p) == '@')) || ((*(p) == '&')) || + ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) || + ((*(p) == ','))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } + } + if (uri->query_raw != NULL) { + if (len + 1 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len++] = '?'; + p = uri->query_raw; + while (*p != 0) { + if (len + 1 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len++] = *p++; + } + } else if (uri->query != NULL) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len++] = '?'; + p = uri->query; + while (*p != 0) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p)))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } + } + } + if (uri->fragment != NULL) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len++] = '#'; + p = uri->fragment; + while (*p != 0) { + if (len + 3 >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p)))) + ret[len++] = *p++; + else { + int val = *(unsigned char *)p++; + int hi = val / 0x10, lo = val % 0x10; + ret[len++] = '%'; + ret[len++] = hi + (hi > 9? 'A'-10 : '0'); + ret[len++] = lo + (lo > 9? 'A'-10 : '0'); + } + } + } + if (len >= max) { + temp = xmlSaveUriRealloc(ret, &max); + if (temp == NULL) goto mem_error; + ret = temp; + } + ret[len] = 0; + return(ret); - if (str == NULL) - return (-1); +mem_error: + xmlFree(ret); + return(NULL); +} - cur = *str; +/** + * xmlPrintURI: + * @stream: a FILE* for the output + * @uri: pointer to an xmlURI + * + * Prints the URI in the stream @stream. + */ +void +xmlPrintURI(FILE *stream, xmlURIPtr uri) { + xmlChar *out; - while ((IS_URIC(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - NEXT(cur); - if (uri != NULL) { - if (uri->query != NULL) - xmlFree(uri->query); - if (uri->cleanup & 2) - uri->query = STRNDUP(*str, cur - *str); - else - uri->query = xmlURIUnescapeString(*str, cur - *str, NULL); + out = xmlSaveUri(uri); + if (out != NULL) { + fprintf(stream, "%s", (char *) out); + xmlFree(out); } - *str = cur; - return (0); } /** - * xmlParseURIScheme: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI scheme - * - * scheme = alpha *( alpha | digit | "+" | "-" | "." ) + * xmlCleanURI: + * @uri: pointer to an xmlURI * - * Returns 0 or the error code + * Make sure the xmlURI struct is free of content */ -static int -xmlParseURIScheme(xmlURIPtr uri, const char **str) { - const char *cur; +static void +xmlCleanURI(xmlURIPtr uri) { + if (uri == NULL) return; - if (str == NULL) - return(-1); - - cur = *str; - if (!IS_ALPHA(*cur)) - return(2); - cur++; - while (IS_SCHEME(*cur)) cur++; - if (uri != NULL) { - if (uri->scheme != NULL) xmlFree(uri->scheme); - uri->scheme = STRNDUP(*str, cur - *str); - } - *str = cur; - return(0); + if (uri->scheme != NULL) xmlFree(uri->scheme); + uri->scheme = NULL; + if (uri->server != NULL) xmlFree(uri->server); + uri->server = NULL; + if (uri->user != NULL) xmlFree(uri->user); + uri->user = NULL; + if (uri->path != NULL) xmlFree(uri->path); + uri->path = NULL; + if (uri->fragment != NULL) xmlFree(uri->fragment); + uri->fragment = NULL; + if (uri->opaque != NULL) xmlFree(uri->opaque); + uri->opaque = NULL; + if (uri->authority != NULL) xmlFree(uri->authority); + uri->authority = NULL; + if (uri->query != NULL) xmlFree(uri->query); + uri->query = NULL; + if (uri->query_raw != NULL) xmlFree(uri->query_raw); + uri->query_raw = NULL; } /** - * xmlParseURIOpaquePart: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI opaque part - * - * opaque_part = uric_no_slash *uric + * xmlFreeURI: + * @uri: pointer to an xmlURI * - * Returns 0 or the error code + * Free up the xmlURI struct */ -static int -xmlParseURIOpaquePart(xmlURIPtr uri, const char **str) -{ - const char *cur; - - if (str == NULL) - return (-1); +void +xmlFreeURI(xmlURIPtr uri) { + if (uri == NULL) return; - cur = *str; - if (!((IS_URIC_NO_SLASH(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))) { - return (3); - } - NEXT(cur); - while ((IS_URIC(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - NEXT(cur); - if (uri != NULL) { - if (uri->opaque != NULL) - xmlFree(uri->opaque); - if (uri->cleanup & 2) - uri->opaque = STRNDUP(*str, cur - *str); - else - uri->opaque = xmlURIUnescapeString(*str, cur - *str, NULL); - } - *str = cur; - return (0); + if (uri->scheme != NULL) xmlFree(uri->scheme); + if (uri->server != NULL) xmlFree(uri->server); + if (uri->user != NULL) xmlFree(uri->user); + if (uri->path != NULL) xmlFree(uri->path); + if (uri->fragment != NULL) xmlFree(uri->fragment); + if (uri->opaque != NULL) xmlFree(uri->opaque); + if (uri->authority != NULL) xmlFree(uri->authority); + if (uri->query != NULL) xmlFree(uri->query); + if (uri->query_raw != NULL) xmlFree(uri->query_raw); + xmlFree(uri); } +/************************************************************************ + * * + * Helper functions * + * * + ************************************************************************/ + /** - * xmlParseURIServer: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze + * xmlNormalizeURIPath: + * @path: pointer to the path string + * + * Applies the 5 normalization steps to a path string--that is, RFC 2396 + * Section 5.2, steps 6.c through 6.g. * - * Parse a server subpart of an URI, it's a finer grain analysis - * of the authority part. - * - * server = [ [ userinfo "@" ] hostport ] - * userinfo = *( unreserved | escaped | - * ";" | ":" | "&" | "=" | "+" | "$" | "," ) - * hostport = host [ ":" port ] - * host = hostname | IPv4address | IPv6reference - * hostname = *( domainlabel "." ) toplabel [ "." ] - * domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum - * toplabel = alpha | alpha *( alphanum | "-" ) alphanum - * IPv6reference = "[" IPv6address "]" - * IPv6address = hexpart [ ":" IPv4address ] - * IPv4address = 1*3digit "." 1*3digit "." 1*3digit "." 1*3digit - * hexpart = hexseq | hexseq "::" [ hexseq ]| "::" [ hexseq ] - * hexseq = hex4 *( ":" hex4) - * hex4 = 1*4hexdig - * port = *digit + * Normalization occurs directly on the string, no new allocation is done * - * Returns 0 or the error code + * Returns 0 or an error code */ -static int -xmlParseURIServer(xmlURIPtr uri, const char **str) { - const char *cur; - const char *host, *tmp; - const int IPV4max = 4; - const int IPV6max = 8; - int oct; +int +xmlNormalizeURIPath(char *path) { + char *cur, *out; - if (str == NULL) + if (path == NULL) return(-1); - - cur = *str; - /* - * is there a userinfo ? - */ - while (IS_USERINFO(cur)) NEXT(cur); - if (*cur == '@') { - if (uri != NULL) { - if (uri->user != NULL) xmlFree(uri->user); - if (uri->cleanup & 2) - uri->path = STRNDUP(*str, cur - *str); - else - uri->user = xmlURIUnescapeString(*str, cur - *str, NULL); - } - cur++; - } else { - if (uri != NULL) { - if (uri->user != NULL) xmlFree(uri->user); - uri->user = NULL; - } - cur = *str; - } - /* - * This can be empty in the case where there is no server + /* Skip all initial "/" chars. We want to get to the beginning of the + * first non-empty segment. */ - host = cur; - if (*cur == '/') { - if (uri != NULL) { - if (uri->authority != NULL) xmlFree(uri->authority); - uri->authority = NULL; - if (uri->server != NULL) xmlFree(uri->server); - uri->server = NULL; - uri->port = 0; - } - return(0); - } + cur = path; + while (cur[0] == '/') + ++cur; + if (cur[0] == '\0') + return(0); + + /* Keep everything we've seen so far. */ + out = cur; + /* - * host part of hostport can denote an IPV4 address, an IPV6 address - * or an unresolved name. Check the IP first, its easier to detect - * errors if wrong one. - * An IPV6 address must start with a '[' and end with a ']'. + * Analyze each segment in sequence for cases (c) and (d). */ - if (*cur == '[') { - int compress=0; - cur++; - for (oct = 0; oct < IPV6max; ++oct) { - if (*cur == ':') { - if (compress) - return(3); /* multiple compression attempted */ - if (!oct) { /* initial char is compression */ - if (*++cur != ':') - return(3); - } - compress = 1; /* set compression-encountered flag */ - cur++; /* skip over the second ':' */ - continue; - } - while(IS_HEX(*cur)) cur++; - if (oct == (IPV6max-1)) - continue; - if (*cur != ':') - break; - cur++; - } - if ((!compress) && (oct != IPV6max)) - return(3); - if (*cur != ']') - return(3); - if (uri != NULL) { - if (uri->server != NULL) xmlFree(uri->server); - uri->server = (char *)xmlStrndup((xmlChar *)host+1, - (cur-host)-1); - } - cur++; - } else { + while (cur[0] != '\0') { /* - * Not IPV6, maybe IPV4 + * c) All occurrences of "./", where "." is a complete path segment, + * are removed from the buffer string. */ - for (oct = 0; oct < IPV4max; ++oct) { - if (*cur == '.') - return(3); /* e.g. http://.xml/ or http://18.29..30/ */ - while(IS_DIGIT(*cur)) cur++; - if (oct == (IPV4max-1)) - continue; - if (*cur != '.') - break; - cur++; - } - } - if ((host[0] != '[') && (oct < IPV4max || (*cur == '.' && cur++) || - IS_ALPHA(*cur))) { - /* maybe host_name */ - if (!IS_ALPHANUM(*cur)) - return(4); /* e.g. http://xml.$oft */ - do { - do ++cur; while (IS_ALPHANUM(*cur)); - if (*cur == '-') { - --cur; - if (*cur == '.') - return(5); /* e.g. http://xml.-soft */ - ++cur; - continue; - } - if (*cur == '.') { - --cur; - if (*cur == '-') - return(6); /* e.g. http://xml-.soft */ - if (*cur == '.') - return(7); /* e.g. http://xml..soft */ - ++cur; - continue; - } - break; - } while (1); - tmp = cur; - if (tmp[-1] == '.') - --tmp; /* e.g. http://xml.$Oft/ */ - do --tmp; while (tmp >= host && IS_ALPHANUM(*tmp)); - if ((++tmp == host || tmp[-1] == '.') && !IS_ALPHA(*tmp)) - return(8); /* e.g. http://xmlsOft.0rg/ */ - } - if (uri != NULL) { - if (uri->authority != NULL) xmlFree(uri->authority); - uri->authority = NULL; - if (host[0] != '[') { /* it's not an IPV6 addr */ - if (uri->server != NULL) xmlFree(uri->server); - if (uri->cleanup & 2) - uri->server = STRNDUP(host, cur - host); - else - uri->server = xmlURIUnescapeString(host, cur - host, NULL); - } - } - /* - * finish by checking for a port presence. - */ - if (*cur == ':') { - cur++; - if (IS_DIGIT(*cur)) { - if (uri != NULL) - uri->port = 0; - while (IS_DIGIT(*cur)) { - if (uri != NULL) - uri->port = uri->port * 10 + (*cur - '0'); + if ((cur[0] == '.') && (cur[1] == '/')) { + cur += 2; + /* '//' normalization should be done at this point too */ + while (cur[0] == '/') cur++; - } + continue; } - } - *str = cur; - return(0); -} -/** - * xmlParseURIRelSegment: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI relative segment - * - * rel_segment = 1*( unreserved | escaped | ";" | "@" | "&" | "=" | - * "+" | "$" | "," ) - * - * Returns 0 or the error code - */ -static int -xmlParseURIRelSegment(xmlURIPtr uri, const char **str) -{ - const char *cur; + /* + * d) If the buffer string ends with "." as a complete path segment, + * that "." is removed. + */ + if ((cur[0] == '.') && (cur[1] == '\0')) + break; - if (str == NULL) - return (-1); + /* Otherwise keep the segment. */ + while (cur[0] != '/') { + if (cur[0] == '\0') + goto done_cd; + (out++)[0] = (cur++)[0]; + } + /* nomalize // */ + while ((cur[0] == '/') && (cur[1] == '/')) + cur++; - cur = *str; - if (!((IS_SEGMENT(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur))))) { - return (3); - } - NEXT(cur); - while ((IS_SEGMENT(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - NEXT(cur); - if (uri != NULL) { - if (uri->path != NULL) - xmlFree(uri->path); - if (uri->cleanup & 2) - uri->path = STRNDUP(*str, cur - *str); - else - uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); + (out++)[0] = (cur++)[0]; } - *str = cur; - return (0); -} + done_cd: + out[0] = '\0'; + + /* Reset to the beginning of the first segment for the next sequence. */ + cur = path; + while (cur[0] == '/') + ++cur; + if (cur[0] == '\0') + return(0); -/** - * xmlParseURIPathSegments: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * @slash: should we add a leading slash - * - * Parse an URI set of path segments - * - * path_segments = segment *( "/" segment ) - * segment = *pchar *( ";" param ) - * param = *pchar - * - * Returns 0 or the error code - */ -static int -xmlParseURIPathSegments(xmlURIPtr uri, const char **str, int slash) -{ - const char *cur; + /* + * Analyze each segment in sequence for cases (e) and (f). + * + * e) All occurrences of "/../", where is a + * complete path segment not equal to "..", are removed from the + * buffer string. Removal of these path segments is performed + * iteratively, removing the leftmost matching pattern on each + * iteration, until no matching pattern remains. + * + * f) If the buffer string ends with "/..", where + * is a complete path segment not equal to "..", that + * "/.." is removed. + * + * To satisfy the "iterative" clause in (e), we need to collapse the + * string every time we find something that needs to be removed. Thus, + * we don't need to keep two pointers into the string: we only need a + * "current position" pointer. + */ + while (1) { + char *segp, *tmp; - if (str == NULL) - return (-1); + /* At the beginning of each iteration of this loop, "cur" points to + * the first character of the segment we want to examine. + */ - cur = *str; + /* Find the end of the current segment. */ + segp = cur; + while ((segp[0] != '/') && (segp[0] != '\0')) + ++segp; + + /* If this is the last segment, we're done (we need at least two + * segments to meet the criteria for the (e) and (f) cases). + */ + if (segp[0] == '\0') + break; - do { - while ((IS_PCHAR(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - NEXT(cur); - while (*cur == ';') { - cur++; - while ((IS_PCHAR(cur)) || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - NEXT(cur); + /* If the first segment is "..", or if the next segment _isn't_ "..", + * keep this segment and try the next one. + */ + ++segp; + if (((cur[0] == '.') && (cur[1] == '.') && (segp == cur+3)) + || ((segp[0] != '.') || (segp[1] != '.') + || ((segp[2] != '/') && (segp[2] != '\0')))) { + cur = segp; + continue; } - if (*cur != '/') - break; - cur++; - } while (1); - if (uri != NULL) { - int len, len2 = 0; - char *path; - /* - * Concat the set of path segments to the current path + /* If we get here, remove this segment and the next one and back up + * to the previous segment (if there is one), to implement the + * "iteratively" clause. It's pretty much impossible to back up + * while maintaining two pointers into the buffer, so just compact + * the whole buffer now. */ - len = cur - *str; - if (slash) - len++; - if (uri->path != NULL) { - len2 = strlen(uri->path); - len += len2; - } - path = (char *) xmlMallocAtomic(len + 1); - if (path == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlParseURIPathSegments: out of memory\n"); - *str = cur; - return (-1); - } - if (uri->path != NULL) - memcpy(path, uri->path, len2); - if (slash) { - path[len2] = '/'; - len2++; + /* If this is the end of the buffer, we're done. */ + if (segp[2] == '\0') { + cur[0] = '\0'; + break; } - path[len2] = 0; - if (cur - *str > 0) { - if (uri->cleanup & 2) { - memcpy(&path[len2], *str, cur - *str); - path[len2 + (cur - *str)] = 0; - } else - xmlURIUnescapeString(*str, cur - *str, &path[len2]); - } - if (uri->path != NULL) - xmlFree(uri->path); - uri->path = path; - } - *str = cur; - return (0); -} + /* Valgrind complained, strcpy(cur, segp + 3); */ + /* string will overlap, do not use strcpy */ + tmp = cur; + segp += 3; + while ((*tmp++ = *segp++) != 0) + ; -/** - * xmlParseURIAuthority: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse the authority part of an URI. - * - * authority = server | reg_name - * server = [ [ userinfo "@" ] hostport ] - * reg_name = 1*( unreserved | escaped | "$" | "," | ";" | ":" | - * "@" | "&" | "=" | "+" ) - * - * Note : this is completely ambiguous since reg_name is allowed to - * use the full set of chars in use by server: - * - * 3.2.1. Registry-based Naming Authority - * - * The structure of a registry-based naming authority is specific - * to the URI scheme, but constrained to the allowed characters - * for an authority component. - * - * Returns 0 or the error code - */ -static int -xmlParseURIAuthority(xmlURIPtr uri, const char **str) { - const char *cur; - int ret; + /* If there are no previous segments, then keep going from here. */ + segp = cur; + while ((segp > path) && ((--segp)[0] == '/')) + ; + if (segp == path) + continue; - if (str == NULL) - return(-1); - - cur = *str; + /* "segp" is pointing to the end of a previous segment; find it's + * start. We need to back up to the previous segment and start + * over with that to handle things like "foo/bar/../..". If we + * don't do this, then on the first pass we'll remove the "bar/..", + * but be pointing at the second ".." so we won't realize we can also + * remove the "foo/..". + */ + cur = segp; + while ((cur > path) && (cur[-1] != '/')) + --cur; + } + out[0] = '\0'; /* - * try first to parse it as a server string. + * g) If the resulting buffer string still begins with one or more + * complete path segments of "..", then the reference is + * considered to be in error. Implementations may handle this + * error by retaining these components in the resolved path (i.e., + * treating them as part of the final URI), by removing them from + * the resolved path (i.e., discarding relative levels above the + * root), or by avoiding traversal of the reference. + * + * We discard them from the final path. */ - ret = xmlParseURIServer(uri, str); - if ((ret == 0) && (*str != NULL) && - ((**str == 0) || (**str == '/') || (**str == '?'))) - return(0); - *str = cur; + if (path[0] == '/') { + cur = path; + while ((cur[0] == '/') && (cur[1] == '.') && (cur[2] == '.') + && ((cur[3] == '/') || (cur[3] == '\0'))) + cur += 3; - /* - * failed, fallback to reg_name - */ - if (!IS_REG_NAME(cur)) { - return(5); - } - NEXT(cur); - while (IS_REG_NAME(cur)) NEXT(cur); - if (uri != NULL) { - if (uri->server != NULL) xmlFree(uri->server); - uri->server = NULL; - if (uri->user != NULL) xmlFree(uri->user); - uri->user = NULL; - if (uri->authority != NULL) xmlFree(uri->authority); - if (uri->cleanup & 2) - uri->authority = STRNDUP(*str, cur - *str); - else - uri->authority = xmlURIUnescapeString(*str, cur - *str, NULL); + if (cur != path) { + out = path; + while (cur[0] != '\0') + (out++)[0] = (cur++)[0]; + out[0] = 0; + } } - *str = cur; - return(0); -} - -/** - * xmlParseURIHierPart: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI hierarchical part - * - * hier_part = ( net_path | abs_path ) [ "?" query ] - * abs_path = "/" path_segments - * net_path = "//" authority [ abs_path ] - * - * Returns 0 or the error code - */ -static int -xmlParseURIHierPart(xmlURIPtr uri, const char **str) { - int ret; - const char *cur; - - if (str == NULL) - return(-1); - - cur = *str; - if ((cur[0] == '/') && (cur[1] == '/')) { - cur += 2; - ret = xmlParseURIAuthority(uri, &cur); - if (ret != 0) - return(ret); - if (cur[0] == '/') { - cur++; - ret = xmlParseURIPathSegments(uri, &cur, 1); - } - } else if (cur[0] == '/') { - cur++; - ret = xmlParseURIPathSegments(uri, &cur, 1); - } else { - return(4); - } - if (ret != 0) - return(ret); - if (*cur == '?') { - cur++; - ret = xmlParseURIQuery(uri, &cur); - if (ret != 0) - return(ret); - } - *str = cur; return(0); } -/** - * xmlParseAbsoluteURI: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI reference string and fills in the appropriate fields - * of the @uri structure - * - * absoluteURI = scheme ":" ( hier_part | opaque_part ) - * - * Returns 0 or the error code - */ -static int -xmlParseAbsoluteURI(xmlURIPtr uri, const char **str) { - int ret; - const char *cur; - - if (str == NULL) - return(-1); - - cur = *str; - - ret = xmlParseURIScheme(uri, str); - if (ret != 0) return(ret); - if (**str != ':') { - *str = cur; +static int is_hex(char c) { + if (((c >= '0') && (c <= '9')) || + ((c >= 'a') && (c <= 'f')) || + ((c >= 'A') && (c <= 'F'))) return(1); - } - (*str)++; - if (**str == '/') - return(xmlParseURIHierPart(uri, str)); - return(xmlParseURIOpaquePart(uri, str)); + return(0); } /** - * xmlParseRelativeURI: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze + * xmlURIUnescapeString: + * @str: the string to unescape + * @len: the length in bytes to unescape (or <= 0 to indicate full string) + * @target: optional destination buffer * - * Parse an relative URI string and fills in the appropriate fields - * of the @uri structure - * - * relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ] - * abs_path = "/" path_segments - * net_path = "//" authority [ abs_path ] - * rel_path = rel_segment [ abs_path ] + * Unescaping routine, but does not check that the string is an URI. The + * output is a direct unsigned char translation of %XX values (no encoding) + * Note that the length of the result can only be smaller or same size as + * the input string. * - * Returns 0 or the error code + * Returns a copy of the string, but unescaped, will return NULL only in case + * of error */ -static int -xmlParseRelativeURI(xmlURIPtr uri, const char **str) { - int ret = 0; - const char *cur; +char * +xmlURIUnescapeString(const char *str, int len, char *target) { + char *ret, *out; + const char *in; if (str == NULL) - return(-1); - - cur = *str; - if ((cur[0] == '/') && (cur[1] == '/')) { - cur += 2; - ret = xmlParseURIAuthority(uri, &cur); - if (ret != 0) - return(ret); - if (cur[0] == '/') { - cur++; - ret = xmlParseURIPathSegments(uri, &cur, 1); + return(NULL); + if (len <= 0) len = strlen(str); + if (len < 0) return(NULL); + + if (target == NULL) { + ret = (char *) xmlMallocAtomic(len + 1); + if (ret == NULL) { + xmlURIErrMemory("unescaping URI value\n"); + return(NULL); } - } else if (cur[0] == '/') { - cur++; - ret = xmlParseURIPathSegments(uri, &cur, 1); - } else if (cur[0] != '#' && cur[0] != '?') { - ret = xmlParseURIRelSegment(uri, &cur); - if (ret != 0) - return(ret); - if (cur[0] == '/') { - cur++; - ret = xmlParseURIPathSegments(uri, &cur, 1); + } else + ret = target; + in = str; + out = ret; + while(len > 0) { + if ((len > 2) && (*in == '%') && (is_hex(in[1])) && (is_hex(in[2]))) { + in++; + if ((*in >= '0') && (*in <= '9')) + *out = (*in - '0'); + else if ((*in >= 'a') && (*in <= 'f')) + *out = (*in - 'a') + 10; + else if ((*in >= 'A') && (*in <= 'F')) + *out = (*in - 'A') + 10; + in++; + if ((*in >= '0') && (*in <= '9')) + *out = *out * 16 + (*in - '0'); + else if ((*in >= 'a') && (*in <= 'f')) + *out = *out * 16 + (*in - 'a') + 10; + else if ((*in >= 'A') && (*in <= 'F')) + *out = *out * 16 + (*in - 'A') + 10; + in++; + len -= 3; + out++; + } else { + *out++ = *in++; + len--; } } - if (ret != 0) - return(ret); - if (*cur == '?') { - cur++; - ret = xmlParseURIQuery(uri, &cur); - if (ret != 0) - return(ret); - } - *str = cur; + *out = 0; return(ret); } /** - * xmlParseURIReference: - * @uri: pointer to an URI structure - * @str: the string to analyze + * xmlURIEscapeStr: + * @str: string to escape + * @list: exception list string of chars not to escape * - * Parse an URI reference string and fills in the appropriate fields - * of the @uri structure - * - * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] + * This routine escapes a string to hex, ignoring reserved characters (a-z) + * and the characters in the exception list. * - * Returns 0 or the error code + * Returns a new escaped string or NULL in case of error. */ -int -xmlParseURIReference(xmlURIPtr uri, const char *str) { - int ret; - const char *tmp = str; +xmlChar * +xmlURIEscapeStr(const xmlChar *str, const xmlChar *list) { + xmlChar *ret, ch; + xmlChar *temp; + const xmlChar *in; + int len, out; if (str == NULL) - return(-1); - xmlCleanURI(uri); + return(NULL); + if (str[0] == 0) + return(xmlStrdup(str)); + len = xmlStrlen(str); + if (!(len > 0)) return(NULL); - /* - * Try first to parse absolute refs, then fallback to relative if - * it fails. - */ - ret = xmlParseAbsoluteURI(uri, &str); - if (ret != 0) { - xmlCleanURI(uri); - str = tmp; - ret = xmlParseRelativeURI(uri, &str); - } - if (ret != 0) { - xmlCleanURI(uri); - return(ret); + len += 20; + ret = (xmlChar *) xmlMallocAtomic(len); + if (ret == NULL) { + xmlURIErrMemory("escaping URI value\n"); + return(NULL); } + in = (const xmlChar *) str; + out = 0; + while(*in != 0) { + if (len - out <= 3) { + temp = xmlSaveUriRealloc(ret, &len); + if (temp == NULL) { + xmlURIErrMemory("escaping URI value\n"); + xmlFree(ret); + return(NULL); + } + ret = temp; + } + + ch = *in; + + if ((ch != '@') && (!IS_UNRESERVED(ch)) && (!xmlStrchr(list, ch))) { + unsigned char val; + ret[out++] = '%'; + val = ch >> 4; + if (val <= 9) + ret[out++] = '0' + val; + else + ret[out++] = 'A' + val - 0xA; + val = ch & 0xF; + if (val <= 9) + ret[out++] = '0' + val; + else + ret[out++] = 'A' + val - 0xA; + in++; + } else { + ret[out++] = *in++; + } - if (*str == '#') { - str++; - ret = xmlParseURIFragment(uri, &str); - if (ret != 0) return(ret); - } - if (*str != 0) { - xmlCleanURI(uri); - return(1); } - return(0); + ret[out] = 0; + return(ret); } /** - * xmlParseURI: - * @str: the URI string to analyze + * xmlURIEscape: + * @str: the string of the URI to escape * - * Parse an URI - * - * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] + * Escaping routine, does not do validity checks ! + * It will try to escape the chars needing this, but this is heuristic + * based it's impossible to be sure. * - * Returns a newly built xmlURIPtr or NULL in case of error + * Returns an copy of the string, but escaped + * + * 25 May 2001 + * Uses xmlParseURI and xmlURIEscapeStr to try to escape correctly + * according to RFC2396. + * - Carl Douglas */ -xmlURIPtr -xmlParseURI(const char *str) { +xmlChar * +xmlURIEscape(const xmlChar * str) +{ + xmlChar *ret, *segment = NULL; xmlURIPtr uri; - int ret; + int ret2; + +#define NULLCHK(p) if(!p) { \ + xmlURIErrMemory("escaping URI value\n"); \ + xmlFreeURI(uri); \ + return NULL; } \ if (str == NULL) - return(NULL); + return (NULL); + uri = xmlCreateURI(); if (uri != NULL) { - ret = xmlParseURIReference(uri, str); - if (ret) { - xmlFreeURI(uri); - return(NULL); - } + /* + * Allow escaping errors in the unescaped form + */ + uri->cleanup = 1; + ret2 = xmlParseURIReference(uri, (const char *)str); + if (ret2) { + xmlFreeURI(uri); + return (NULL); + } } - return(uri); -} -/** - * xmlParseURIRaw: - * @str: the URI string to analyze - * @raw: if 1 unescaping of URI pieces are disabled - * - * Parse an URI but allows to keep intact the original fragments. - * - * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] - * - * Returns a newly built xmlURIPtr or NULL in case of error - */ -xmlURIPtr -xmlParseURIRaw(const char *str, int raw) { - xmlURIPtr uri; - int ret; + if (!uri) + return NULL; - if (str == NULL) - return(NULL); - uri = xmlCreateURI(); - if (uri != NULL) { - if (raw) { - uri->cleanup |= 2; - } - ret = xmlParseURIReference(uri, str); - if (ret) { - xmlFreeURI(uri); - return(NULL); - } + ret = NULL; + + if (uri->scheme) { + segment = xmlURIEscapeStr(BAD_CAST uri->scheme, BAD_CAST "+-."); + NULLCHK(segment) + ret = xmlStrcat(ret, segment); + ret = xmlStrcat(ret, BAD_CAST ":"); + xmlFree(segment); } - return(uri); + + if (uri->authority) { + segment = + xmlURIEscapeStr(BAD_CAST uri->authority, BAD_CAST "/?;:@"); + NULLCHK(segment) + ret = xmlStrcat(ret, BAD_CAST "//"); + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + if (uri->user) { + segment = xmlURIEscapeStr(BAD_CAST uri->user, BAD_CAST ";:&=+$,"); + NULLCHK(segment) + ret = xmlStrcat(ret,BAD_CAST "//"); + ret = xmlStrcat(ret, segment); + ret = xmlStrcat(ret, BAD_CAST "@"); + xmlFree(segment); + } + + if (uri->server) { + segment = xmlURIEscapeStr(BAD_CAST uri->server, BAD_CAST "/?;:@"); + NULLCHK(segment) + if (uri->user == NULL) + ret = xmlStrcat(ret, BAD_CAST "//"); + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + if (uri->port) { + xmlChar port[10]; + + snprintf((char *) port, 10, "%d", uri->port); + ret = xmlStrcat(ret, BAD_CAST ":"); + ret = xmlStrcat(ret, port); + } + + if (uri->path) { + segment = + xmlURIEscapeStr(BAD_CAST uri->path, BAD_CAST ":@&=+$,/?;"); + NULLCHK(segment) + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + if (uri->query_raw) { + ret = xmlStrcat(ret, BAD_CAST "?"); + ret = xmlStrcat(ret, BAD_CAST uri->query_raw); + } + else if (uri->query) { + segment = + xmlURIEscapeStr(BAD_CAST uri->query, BAD_CAST ";/?:@&=+,$"); + NULLCHK(segment) + ret = xmlStrcat(ret, BAD_CAST "?"); + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + if (uri->opaque) { + segment = xmlURIEscapeStr(BAD_CAST uri->opaque, BAD_CAST ""); + NULLCHK(segment) + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + if (uri->fragment) { + segment = xmlURIEscapeStr(BAD_CAST uri->fragment, BAD_CAST "#"); + NULLCHK(segment) + ret = xmlStrcat(ret, BAD_CAST "#"); + ret = xmlStrcat(ret, segment); + xmlFree(segment); + } + + xmlFreeURI(uri); +#undef NULLCHK + + return (ret); } /************************************************************************ @@ -1844,7 +1869,7 @@ xmlParseURIRaw(const char *str, int raw) { * * Computes he final URI of the reference done by checking that * the given URI is valid, and building the final URI using the - * base URI. This is processed according to section 5.2 of the + * base URI. This is processed according to section 5.2 of the * RFC 2396 * * 5.2. Resolving Relative References to Absolute Form @@ -1868,7 +1893,7 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) { * as a reference to "." rather than as a synonym for the current * URI. Should we do that here? */ - if (URI == NULL) + if (URI == NULL) ret = -1; else { if (*URI) { @@ -1939,12 +1964,16 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) { res->server = xmlMemStrdup(bas->server); if (bas->user != NULL) res->user = xmlMemStrdup(bas->user); - res->port = bas->port; + res->port = bas->port; } if (bas->path != NULL) res->path = xmlMemStrdup(bas->path); - if (ref->query != NULL) + if (ref->query_raw != NULL) + res->query_raw = xmlMemStrdup (ref->query_raw); + else if (ref->query != NULL) res->query = xmlMemStrdup(ref->query); + else if (bas->query_raw != NULL) + res->query_raw = xmlMemStrdup(bas->query_raw); else if (bas->query != NULL) res->query = xmlMemStrdup(bas->query); if (ref->fragment != NULL) @@ -1964,8 +1993,10 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) { } if (bas->scheme != NULL) res->scheme = xmlMemStrdup(bas->scheme); - - if (ref->query != NULL) + + if (ref->query_raw != NULL) + res->query_raw = xmlMemStrdup(ref->query_raw); + else if (ref->query != NULL) res->query = xmlMemStrdup(ref->query); if (ref->fragment != NULL) res->fragment = xmlMemStrdup(ref->fragment); @@ -1984,7 +2015,7 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) { res->server = xmlMemStrdup(ref->server); if (ref->user != NULL) res->user = xmlMemStrdup(ref->user); - res->port = ref->port; + res->port = ref->port; } if (ref->path != NULL) res->path = xmlMemStrdup(ref->path); @@ -1996,7 +2027,7 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) { res->server = xmlMemStrdup(bas->server); if (bas->user != NULL) res->user = xmlMemStrdup(bas->user); - res->port = bas->port; + res->port = bas->port; } /* @@ -2024,8 +2055,7 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) { len += strlen(bas->path); res->path = (char *) xmlMallocAtomic(len); if (res->path == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlBuildURI: out of memory\n"); + xmlURIErrMemory("resolving URI against base\n"); goto done; } res->path[0] = 0; @@ -2209,7 +2239,8 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) uptr = (xmlChar *) ref->path; if (*uptr == '/') uptr++; - val = xmlStrdup(uptr); + /* exception characters from xmlSaveUri */ + val = xmlURIEscapeStr(uptr, BAD_CAST "/;&=+$,"); } goto done; } @@ -2270,10 +2301,11 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) } len = xmlStrlen (uptr) + 1; } - + if (nbslash == 0) { if (uptr != NULL) - val = xmlStrdup (uptr); + /* exception characters from xmlSaveUri */ + val = xmlURIEscapeStr(uptr, BAD_CAST "/;&=+$,"); goto done; } @@ -2284,8 +2316,7 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) */ val = (xmlChar *) xmlMalloc (len + 3 * nbslash); if (val == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlBuildRelativeURI: out of memory\n"); + xmlURIErrMemory("building relative URI\n"); goto done; } vptr = val; @@ -2313,6 +2344,12 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) vptr[len - 1] = 0; } + /* escape the freshly-built path */ + vptr = val; + /* exception characters from xmlSaveUri */ + val = xmlURIEscapeStr(vptr, BAD_CAST "/;&=+$,"); + xmlFree(vptr); + done: /* * Free the working variables @@ -2331,14 +2368,14 @@ done: * xmlCanonicPath: * @path: the resource locator in a filesystem notation * - * Constructs a canonic path from the specified path. + * Constructs a canonic path from the specified path. * - * Returns a new canonic path, or a duplicate of the path parameter if the + * Returns a new canonic path, or a duplicate of the path parameter if the * construction fails. The caller is responsible for freeing the memory occupied - * by the returned string. If there is insufficient memory available, or the + * by the returned string. If there is insufficient memory available, or the * argument is NULL, the function returns NULL. */ -#define IS_WINDOWS_PATH(p) \ +#define IS_WINDOWS_PATH(p) \ ((p != NULL) && \ (((p[0] >= 'a') && (p[0] <= 'z')) || \ ((p[0] >= 'A') && (p[0] <= 'Z'))) && \ @@ -2346,7 +2383,11 @@ done: xmlChar * xmlCanonicPath(const xmlChar *path) { -#if defined(_WIN32) && !defined(__CYGWIN__) +/* + * For Windows implementations, additional work needs to be done to + * replace backslashes in pathnames with "forward slashes" + */ +#if defined(_WIN32) && !defined(__CYGWIN__) int len = 0; int i = 0; xmlChar *p = NULL; @@ -2357,11 +2398,30 @@ xmlCanonicPath(const xmlChar *path) if (path == NULL) return(NULL); + +#if defined(_WIN32) + /* + * We must not change the backslashes to slashes if the the path + * starts with \\?\ + * Those paths can be up to 32k characters long. + * Was added specifically for OpenOffice, those paths can't be converted + * to URIs anyway. + */ + if ((path[0] == '\\') && (path[1] == '\\') && (path[2] == '?') && + (path[3] == '\\') ) + return xmlStrdup((const xmlChar *) path); +#endif + + /* sanitize filename starting with // so it can be used as URI */ + if ((path[0] == '/') && (path[1] == '/') && (path[2] != '/')) + path++; + if ((uri = xmlParseURI((const char *) path)) != NULL) { xmlFreeURI(uri); return xmlStrdup(path); } + /* Check if this is an "absolute uri" */ absuri = xmlStrstr(path, BAD_CAST "://"); if (absuri != NULL) { int l, j; @@ -2370,47 +2430,55 @@ xmlCanonicPath(const xmlChar *path) /* * this looks like an URI where some parts have not been - * escaped leading to a parsing problem check that the first + * escaped leading to a parsing problem. Check that the first * part matches a protocol. */ l = absuri - path; + /* Bypass if first part (part before the '://') is > 20 chars */ if ((l <= 0) || (l > 20)) goto path_processing; + /* Bypass if any non-alpha characters are present in first part */ for (j = 0;j < l;j++) { c = path[j]; if (!(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')))) goto path_processing; } + /* Escape all except the characters specified in the supplied path */ escURI = xmlURIEscapeStr(path, BAD_CAST ":/?_.#&;="); if (escURI != NULL) { + /* Try parsing the escaped path */ uri = xmlParseURI((const char *) escURI); + /* If successful, return the escaped string */ if (uri != NULL) { xmlFreeURI(uri); return escURI; } - xmlFreeURI(uri); } } path_processing: -#if defined(_WIN32) && !defined(__CYGWIN__) +/* For Windows implementations, replace backslashes with 'forward slashes' */ +#if defined(_WIN32) && !defined(__CYGWIN__) /* - * This really need to be cleaned up by someone with a Windows box + * Create a URI structure */ uri = xmlCreateURI(); - if (uri == NULL) { + if (uri == NULL) { /* Guard against 'out of memory' */ return(NULL); } len = xmlStrlen(path); if ((len > 2) && IS_WINDOWS_PATH(path)) { + /* make the scheme 'file' */ uri->scheme = xmlStrdup(BAD_CAST "file"); + /* allocate space for leading '/' + path + string terminator */ uri->path = xmlMallocAtomic(len + 2); if (uri->path == NULL) { - xmlFreeURI(uri); + xmlFreeURI(uri); /* Guard agains 'out of memory' */ return(NULL); } + /* Put in leading '/' plus path */ uri->path[0] = '/'; p = uri->path + 1; strncpy(p, path, len + 1); @@ -2422,18 +2490,15 @@ path_processing: } p = uri->path; } + /* Now change all occurences of '\' to '/' */ while (*p != '\0') { if (*p == '\\') *p = '/'; p++; } - if (uri->path == NULL) { - xmlFreeURI(uri); - return(NULL); - } if (uri->scheme == NULL) { - ret = xmlStrdup((const xmlChar *) path); + ret = xmlStrdup((const xmlChar *) uri->path); } else { ret = xmlSaveUri(uri); } @@ -2451,7 +2516,7 @@ path_processing: * * Constructs an URI expressing the existing path * - * Returns a new URI, or a duplicate of the path parameter if the + * Returns a new URI, or a duplicate of the path parameter if the * construction fails. The caller is responsible for freeing the memory * occupied by the returned string. If there is insufficient memory available, * or the argument is NULL, the function returns NULL. @@ -2473,6 +2538,24 @@ xmlPathToURI(const xmlChar *path) cal = xmlCanonicPath(path); if (cal == NULL) return(NULL); +#if defined(_WIN32) && !defined(__CYGWIN__) + /* xmlCanonicPath can return an URI on Windows (is that the intended behaviour?) + If 'cal' is a valid URI allready then we are done here, as continuing would make + it invalid. */ + if ((uri = xmlParseURI((const char *) cal)) != NULL) { + xmlFreeURI(uri); + return cal; + } + /* 'cal' can contain a relative path with backslashes. If that is processed + by xmlSaveURI, they will be escaped and the external entity loader machinery + will fail. So convert them to slashes. Misuse 'ret' for walking. */ + ret = cal; + while (*ret != '\0') { + if (*ret == '\\') + *ret = '/'; + ret++; + } +#endif memset(&temp, 0, sizeof(temp)); temp.path = (char *) cal; ret = xmlSaveUri(&temp); diff --git a/gnulib-local/lib/libxml/uri.in.h b/gnulib-local/lib/libxml/uri.in.h index 5e29671..db48262 100644 --- a/gnulib-local/lib/libxml/uri.in.h +++ b/gnulib-local/lib/libxml/uri.in.h @@ -23,6 +23,10 @@ extern "C" { * * A parsed URI reference. This is a struct containing the various fields * as described in RFC 2396 but separated for further processing. + * + * Note: query is a deprecated field which is incorrectly unescaped. + * query_raw takes precedence over query if the former is set. + * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127 */ typedef struct _xmlURI xmlURI; typedef xmlURI *xmlURIPtr; @@ -34,9 +38,10 @@ struct _xmlURI { char *user; /* the user part */ int port; /* the port number */ char *path; /* the path string */ - char *query; /* the query string */ + char *query; /* the query string (deprecated - use with caution) */ char *fragment; /* the fragment identifier */ int cleanup; /* parsing potentially unclean URI */ + char *query_raw; /* the query string (as it appears in the URI) */ }; /* @@ -44,43 +49,43 @@ struct _xmlURI { * xmlChar * xmlNodeGetBase (xmlDocPtr doc, * xmlNodePtr cur); */ -XMLPUBFUN xmlURIPtr XMLCALL +XMLPUBFUN xmlURIPtr XMLCALL xmlCreateURI (void); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlBuildURI (const xmlChar *URI, - const xmlChar *base); -XMLPUBFUN xmlChar * XMLCALL + const xmlChar *base); +XMLPUBFUN xmlChar * XMLCALL xmlBuildRelativeURI (const xmlChar *URI, - const xmlChar *base); -XMLPUBFUN xmlURIPtr XMLCALL + const xmlChar *base); +XMLPUBFUN xmlURIPtr XMLCALL xmlParseURI (const char *str); -XMLPUBFUN xmlURIPtr XMLCALL +XMLPUBFUN xmlURIPtr XMLCALL xmlParseURIRaw (const char *str, int raw); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParseURIReference (xmlURIPtr uri, const char *str); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlSaveUri (xmlURIPtr uri); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlPrintURI (FILE *stream, xmlURIPtr uri); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlURIEscapeStr (const xmlChar *str, - const xmlChar *list); -XMLPUBFUN char * XMLCALL + const xmlChar *list); +XMLPUBFUN char * XMLCALL xmlURIUnescapeString (const char *str, int len, char *target); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlNormalizeURIPath (char *path); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlURIEscape (const xmlChar *str); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeURI (xmlURIPtr uri); -XMLPUBFUN xmlChar* XMLCALL +XMLPUBFUN xmlChar* XMLCALL xmlCanonicPath (const xmlChar *path); -XMLPUBFUN xmlChar* XMLCALL +XMLPUBFUN xmlChar* XMLCALL xmlPathToURI (const xmlChar *path); #ifdef __cplusplus diff --git a/gnulib-local/lib/libxml/valid.c b/gnulib-local/lib/libxml/valid.c index a239e68..45a3f70 100644 --- a/gnulib-local/lib/libxml/valid.c +++ b/gnulib-local/lib/libxml/valid.c @@ -31,11 +31,16 @@ static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, /* #define DEBUG_VALID_ALGO */ /* #define DEBUG_REGEXP_ALGO */ -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); +#ifdef LIBXML_VALID_ENABLED +static int +xmlValidateAttributeValueInternal(xmlDocPtr doc, xmlAttributeType type, + const xmlChar *value); +#endif /************************************************************************ * * * Error handling routines * @@ -117,7 +122,7 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error, __xmlRaiseError(NULL, channel, data, pctxt, NULL, XML_FROM_VALID, error, XML_ERR_ERROR, NULL, 0, NULL, NULL, NULL, 0, 0, - msg); + "%s", msg); } #if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) @@ -296,7 +301,7 @@ vstateVPush(xmlValidCtxtPtr ctxt, xmlElementPtr elemDecl, xmlNodePtr node) { if (elemDecl->contModel == NULL) xmlValidBuildContentModel(ctxt, elemDecl); if (elemDecl->contModel != NULL) { - ctxt->vstateTab[ctxt->vstateNr].exec = + ctxt->vstateTab[ctxt->vstateNr].exec = xmlRegNewExecCtxt(elemDecl->contModel, NULL, NULL); } else { ctxt->vstateTab[ctxt->vstateNr].exec = NULL; @@ -618,7 +623,7 @@ xmlValidStateDebug(xmlValidCtxtPtr ctxt) { #define DEBUG_VALID_STATE(n,c) xmlValidStateDebug(ctxt); #define DEBUG_VALID_MSG(m) \ xmlGenericError(xmlGenericErrorContext, "%s\n", m); - + #else #define DEBUG_VALID_STATE(n,c) #define DEBUG_VALID_MSG(m) @@ -632,8 +637,6 @@ xmlValidStateDebug(xmlValidCtxtPtr ctxt) { else if ((doc->intSubset == NULL) && \ (doc->extSubset == NULL)) return(0) -xmlAttributePtr xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem); - #ifdef LIBXML_REGEXP_ENABLED /************************************************************************ @@ -673,7 +676,7 @@ xmlValidBuildAContentModel(xmlElementContentPtr content, xmlAutomataStatePtr oldstate = ctxt->state; xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(content->name, content->prefix, fn, 50); if (fullname == NULL) { xmlVErrMemory(ctxt, "Building content model"); @@ -698,9 +701,9 @@ xmlValidBuildAContentModel(xmlElementContentPtr content, break; case XML_ELEMENT_CONTENT_MULT: ctxt->state = xmlAutomataNewEpsilon(ctxt->am, - ctxt->state, NULL); + ctxt->state, NULL); xmlAutomataNewTransition(ctxt->am, - ctxt->state, ctxt->state, fullname, NULL); + ctxt->state, ctxt->state, fullname, NULL); break; } if ((fullname != fn) && (fullname != content->name)) @@ -749,7 +752,7 @@ xmlValidBuildAContentModel(xmlElementContentPtr content, xmlElementContentOccur ocur; ocur = content->ocur; - if ((ocur == XML_ELEMENT_CONTENT_PLUS) || + if ((ocur == XML_ELEMENT_CONTENT_PLUS) || (ocur == XML_ELEMENT_CONTENT_MULT)) { ctxt->state = xmlAutomataNewEpsilon(ctxt->am, ctxt->state, NULL); @@ -941,7 +944,7 @@ xmlNewDocElementContent(xmlDocPtr doc, const xmlChar *name, } break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ELEMENT content corrupted invalid type\n", NULL); return(NULL); @@ -998,7 +1001,7 @@ xmlNewElementContent(const xmlChar *name, xmlElementContentType type) { * @cur: An element content pointer. * * Build a copy of an element content description. - * + * * Returns the new xmlElementContentPtr or NULL in case of error. */ xmlElementContentPtr @@ -1025,7 +1028,7 @@ xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) { else ret->name = xmlStrdup(cur->name); } - + if (cur->prefix != NULL) { if (dict) ret->prefix = xmlDictLookup(dict, cur->prefix, -1); @@ -1055,7 +1058,7 @@ xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) { else tmp->name = xmlStrdup(cur->name); } - + if (cur->prefix != NULL) { if (dict) tmp->prefix = xmlDictLookup(dict, cur->prefix, -1); @@ -1079,7 +1082,7 @@ xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) { * * Build a copy of an element content description. * Deprecated, use xmlCopyDocElementContent instead - * + * * Returns the new xmlElementContentPtr or NULL in case of error. */ xmlElementContentPtr @@ -1111,7 +1114,7 @@ xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) { case XML_ELEMENT_CONTENT_OR: break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ELEMENT content corrupted invalid type\n", NULL); return; @@ -1197,7 +1200,7 @@ xmlDumpElementContent(xmlBufferPtr buf, xmlElementContentPtr content, int glob) xmlDumpElementContent(buf, content->c2, 0); break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ELEMENT content corrupted invalid type\n", NULL); } @@ -1394,7 +1397,7 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, switch (type) { case XML_ELEMENT_TYPE_EMPTY: if (content != NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "xmlAddElementDecl: content != NULL for EMPTY\n", NULL); return(NULL); @@ -1402,7 +1405,7 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, break; case XML_ELEMENT_TYPE_ANY: if (content != NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "xmlAddElementDecl: content != NULL for ANY\n", NULL); return(NULL); @@ -1410,7 +1413,7 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, break; case XML_ELEMENT_TYPE_MIXED: if (content == NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "xmlAddElementDecl: content == NULL for MIXED\n", NULL); return(NULL); @@ -1418,14 +1421,14 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, break; case XML_ELEMENT_TYPE_ELEMENT: if (content == NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "xmlAddElementDecl: content == NULL for ELEMENT\n", NULL); return(NULL); } break; default: - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "Internal: ELEMENT decl corrupted invalid type\n", NULL); return(NULL); @@ -1605,7 +1608,7 @@ xmlFreeElementTable(xmlElementTablePtr table) { * @elem: An element * * Build a copy of an element. - * + * * Returns the new xmlElementPtr or NULL in case of error. */ static xmlElementPtr @@ -1639,7 +1642,7 @@ xmlCopyElement(xmlElementPtr elem) { * @table: An element table * * Build a copy of an element table. - * + * * Returns the new xmlElementTablePtr or NULL in case of error. */ xmlElementTablePtr @@ -1704,7 +1707,7 @@ xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) { xmlBufferWriteChar(buf, ">\n"); break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ELEMENT struct corrupted invalid type\n", NULL); } @@ -1795,6 +1798,7 @@ xmlCopyEnumeration(xmlEnumerationPtr cur) { if (cur == NULL) return(NULL); ret = xmlCreateEnumeration((xmlChar *) cur->name); + if (ret == NULL) return(NULL); if (cur->next != NULL) ret->next = xmlCopyEnumeration(cur->next); else ret->next = NULL; @@ -1815,7 +1819,7 @@ static void xmlDumpEnumeration(xmlBufferPtr buf, xmlEnumerationPtr cur) { if ((buf == NULL) || (cur == NULL)) return; - + xmlBufferWriteCHAR(buf, cur->name); if (cur->next == NULL) xmlBufferWriteChar(buf, ")"); @@ -1827,53 +1831,6 @@ xmlDumpEnumeration(xmlBufferPtr buf, xmlEnumerationPtr cur) { #endif /* LIBXML_OUTPUT_ENABLED */ #ifdef LIBXML_VALID_ENABLED -/** - * xmlScanAttributeDeclCallback: - * @attr: the attribute decl - * @list: the list to update - * - * Callback called by xmlScanAttributeDecl when a new attribute - * has to be entered in the list. - */ -static void -xmlScanAttributeDeclCallback(xmlAttributePtr attr, xmlAttributePtr *list, - const xmlChar* name ATTRIBUTE_UNUSED) { - attr->nexth = *list; - *list = attr; -} - -/** - * xmlScanAttributeDecl: - * @dtd: pointer to the DTD - * @elem: the element name - * - * When inserting a new element scan the DtD for existing attributes - * for that element and initialize the Attribute chain - * - * Returns the pointer to the first attribute decl in the chain, - * possibly NULL. - */ -xmlAttributePtr -xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem) { - xmlAttributePtr ret = NULL; - xmlAttributeTablePtr table; - - if (dtd == NULL) { - return(NULL); - } - if (elem == NULL) { - return(NULL); - } - table = (xmlAttributeTablePtr) dtd->attributes; - if (table == NULL) - return(NULL); - - /* WRONG !!! */ - xmlHashScan3(table, NULL, NULL, elem, - (xmlHashScanner) xmlScanAttributeDeclCallback, &ret); - return(ret); -} - /** * xmlScanIDAttributeDecl: * @ctxt: the validation context @@ -2017,14 +1974,14 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, case XML_ATTRIBUTE_NOTATION: break; default: - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "Internal: ATTRIBUTE struct corrupted invalid type\n", NULL); xmlFreeEnumeration(tree); return(NULL); } - if ((defaultValue != NULL) && - (!xmlValidateAttributeValue(type, defaultValue))) { + if ((defaultValue != NULL) && + (!xmlValidateAttributeValueInternal(dtd->doc, type, defaultValue))) { xmlErrValidNode(ctxt, (xmlNodePtr) dtd, XML_DTD_ATTRIBUTE_DEFAULT, "Attribute %s of %s: invalid default value\n", elem, name, defaultValue); @@ -2042,8 +1999,10 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, (dtd->doc->intSubset != NULL) && (dtd->doc->intSubset->attributes != NULL)) { ret = xmlHashLookup3(dtd->doc->intSubset->attributes, name, ns, elem); - if (ret != NULL) + if (ret != NULL) { + xmlFreeEnumeration(tree); return(NULL); + } } /* @@ -2057,6 +2016,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, if (table == NULL) { xmlVErrMemory(ctxt, "xmlAddAttributeDecl: Table creation failed!\n"); + xmlFreeEnumeration(tree); return(NULL); } @@ -2064,6 +2024,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, ret = (xmlAttributePtr) xmlMalloc(sizeof(xmlAttribute)); if (ret == NULL) { xmlVErrMemory(ctxt, "malloc failed"); + xmlFreeEnumeration(tree); return(NULL); } memset(ret, 0, sizeof(xmlAttribute)); @@ -2193,7 +2154,7 @@ xmlFreeAttributeTable(xmlAttributeTablePtr table) { * @attr: An attribute * * Build a copy of an attribute. - * + * * Returns the new xmlAttributePtr or NULL in case of error. */ static xmlAttributePtr @@ -2226,7 +2187,7 @@ xmlCopyAttribute(xmlAttributePtr attr) { * @table: An attribute table * * Build a copy of an attribute table. - * + * * Returns the new xmlAttributeTablePtr or NULL in case of error. */ xmlAttributeTablePtr @@ -2291,7 +2252,7 @@ xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr attr) { xmlDumpEnumeration(buf, attr->tree); break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ATTRIBUTE struct corrupted invalid type\n", NULL); } @@ -2308,7 +2269,7 @@ xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr attr) { xmlBufferWriteChar(buf, " #FIXED"); break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ATTRIBUTE struct corrupted invalid def\n", NULL); } @@ -2438,7 +2399,7 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, */ if (xmlHashAddEntry(table, name, ret)) { #ifdef LIBXML_VALID_ENABLED - xmlErrValid(NULL, XML_DTD_NOTATION_REDEFINED, + xmlErrValid(NULL, XML_DTD_NOTATION_REDEFINED, "xmlAddNotationDecl: %s already defined\n", (const char *) name); #endif /* LIBXML_VALID_ENABLED */ @@ -2465,7 +2426,7 @@ xmlFreeNotationTable(xmlNotationTablePtr table) { * @nota: A notation * * Build a copy of a notation. - * + * * Returns the new xmlNotationPtr or NULL in case of error. */ static xmlNotationPtr @@ -2497,7 +2458,7 @@ xmlCopyNotation(xmlNotationPtr nota) { * @table: A notation table * * Build a copy of a notation table. - * + * * Returns the new xmlNotationTablePtr or NULL in case of error. */ xmlNotationTablePtr @@ -2575,7 +2536,7 @@ xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) { * current scope */ #define DICT_FREE(str) \ - if ((str) && ((!dict) || \ + if ((str) && ((!dict) || \ (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \ xmlFree((char *)(str)); @@ -2613,7 +2574,7 @@ xmlFreeID(xmlIDPtr id) { * * Returns NULL if not, otherwise the new xmlIDPtr */ -xmlIDPtr +xmlIDPtr xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr) { xmlIDPtr ret; @@ -2673,10 +2634,9 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, /* * The id is already defined in this DTD. */ - if ((ctxt != NULL) && (ctxt->error != NULL)) { + if (ctxt != NULL) { xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED, - "ID %s already defined\n", - value, NULL, NULL); + "ID %s already defined\n", value, NULL, NULL); } #endif /* LIBXML_VALID_ENABLED */ xmlFreeID(ret); @@ -2719,14 +2679,15 @@ xmlIsID(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) { (!strcmp((char *) attr->ns->prefix, "xml"))) return(1); if (doc == NULL) return(0); - if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) { + if ((doc->intSubset == NULL) && (doc->extSubset == NULL) && + (doc->type != XML_HTML_DOCUMENT_NODE)) { return(0); } else if (doc->type == XML_HTML_DOCUMENT_NODE) { if ((xmlStrEqual(BAD_CAST "id", attr->name)) || ((xmlStrEqual(BAD_CAST "name", attr->name)) && - ((elem == NULL) || (!xmlStrEqual(elem->name, BAD_CAST "input"))))) + ((elem == NULL) || (xmlStrEqual(elem->name, BAD_CAST "a"))))) return(1); - return(0); + return(0); } else if (elem == NULL) { return(0); } else { @@ -2779,23 +2740,24 @@ xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) { if (doc == NULL) return(-1); if (attr == NULL) return(-1); + table = (xmlIDTablePtr) doc->ids; - if (table == NULL) + if (table == NULL) return(-1); - if (attr == NULL) - return(-1); ID = xmlNodeListGetString(doc, attr->children, 1); if (ID == NULL) - return(-1); + return(-1); + id = xmlHashLookup(table, ID); if (id == NULL || id->attr != attr) { - xmlFree(ID); - return(-1); + xmlFree(ID); + return(-1); } + xmlHashRemoveEntry(table, ID, (xmlHashDeallocator) xmlFreeID); xmlFree(ID); - attr->atype = 0; + attr->atype = 0; return(0); } @@ -2808,7 +2770,7 @@ xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) { * * Returns NULL if not found, otherwise the xmlAttrPtr defining the ID */ -xmlAttrPtr +xmlAttrPtr xmlGetID(xmlDocPtr doc, const xmlChar *ID) { xmlIDTablePtr table; xmlIDPtr id; @@ -2822,7 +2784,7 @@ xmlGetID(xmlDocPtr doc, const xmlChar *ID) { } table = (xmlIDTablePtr) doc->ids; - if (table == NULL) + if (table == NULL) return(NULL); id = xmlHashLookup(table, ID); @@ -2843,7 +2805,7 @@ xmlGetID(xmlDocPtr doc, const xmlChar *ID) { * Refs * * * ************************************************************************/ -typedef struct xmlRemoveMemo_t +typedef struct xmlRemoveMemo_t { xmlListPtr l; xmlAttrPtr ap; @@ -2851,7 +2813,7 @@ typedef struct xmlRemoveMemo_t typedef xmlRemoveMemo *xmlRemoveMemoPtr; -typedef struct xmlValidateMemo_t +typedef struct xmlValidateMemo_t { xmlValidCtxtPtr ctxt; const xmlChar *name; @@ -2934,7 +2896,7 @@ xmlDummyCompare(const void *data0 ATTRIBUTE_UNUSED, * * Returns NULL if not, otherwise the new xmlRefPtr */ -xmlRefPtr +xmlRefPtr xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr) { xmlRefPtr ret; @@ -2998,19 +2960,32 @@ xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "xmlAddRef: Reference list creation failed!\n", NULL); - return(NULL); + goto failed; } if (xmlHashAddEntry(table, value, ref_list) < 0) { xmlListDelete(ref_list); xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "xmlAddRef: Reference list insertion failed!\n", NULL); - return(NULL); + goto failed; } } -/* xmlListInsert(ref_list, ret); */ - xmlListAppend(ref_list, ret); + if (xmlListAppend(ref_list, ret) != 0) { + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + "xmlAddRef: Reference list insertion failed!\n", + NULL); + goto failed; + } return(ret); +failed: + if (ret != NULL) { + if (ret->value != NULL) + xmlFree((char *)ret->value); + if (ret->name != NULL) + xmlFree((char *)ret->name); + xmlFree(ret); + } + return(NULL); } /** @@ -3049,7 +3024,7 @@ xmlIsRef(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) { return(0); } else if (doc->type == XML_HTML_DOCUMENT_NODE) { /* TODO @@@ */ - return(0); + return(0); } else { xmlAttributePtr attrDecl; @@ -3085,21 +3060,21 @@ xmlRemoveRef(xmlDocPtr doc, xmlAttrPtr attr) { if (doc == NULL) return(-1); if (attr == NULL) return(-1); + table = (xmlRefTablePtr) doc->refs; - if (table == NULL) + if (table == NULL) return(-1); - if (attr == NULL) - return(-1); ID = xmlNodeListGetString(doc, attr->children, 1); if (ID == NULL) return(-1); - ref_list = xmlHashLookup(table, ID); + ref_list = xmlHashLookup(table, ID); if(ref_list == NULL) { xmlFree(ID); return (-1); } + /* At this point, ref_list refers to a list of references which * have the same key as the supplied attr. Our list of references * is ordered by reference address and we don't have that information @@ -3112,7 +3087,7 @@ xmlRemoveRef(xmlDocPtr doc, xmlAttrPtr attr) { */ target.l = ref_list; target.ap = attr; - + /* Remove the supplied attr from our list */ xmlListWalk(ref_list, xmlWalkRemoveRef, &target); @@ -3129,11 +3104,11 @@ xmlRemoveRef(xmlDocPtr doc, xmlAttrPtr attr) { * @doc: pointer to the document * @ID: the ID value * - * Find the set of references for the supplied ID. + * Find the set of references for the supplied ID. * * Returns NULL if not found, otherwise node set for the ID. */ -xmlListPtr +xmlListPtr xmlGetRefs(xmlDocPtr doc, const xmlChar *ID) { xmlRefTablePtr table; @@ -3146,7 +3121,7 @@ xmlGetRefs(xmlDocPtr doc, const xmlChar *ID) { } table = (xmlRefTablePtr) doc->refs; - if (table == NULL) + if (table == NULL) return(NULL); return (xmlHashLookup(table, ID)); @@ -3211,7 +3186,7 @@ xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) { if (dtd->doc != NULL) dict = dtd->doc->dict; - if (!create) + if (!create) return(NULL); /* * Create the Element table if needed. @@ -3377,7 +3352,8 @@ int xmlValidateNotationUse(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *notationName) { xmlNotationPtr notaDecl; - if ((doc == NULL) || (doc->intSubset == NULL)) return(-1); + if ((doc == NULL) || (doc->intSubset == NULL) || + (notationName == NULL)) return(-1); notaDecl = xmlGetDtdNotationDesc(doc->intSubset, notationName); if ((notaDecl == NULL) && (doc->extSubset != NULL)) @@ -3432,8 +3408,78 @@ xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name) { } #ifdef LIBXML_VALID_ENABLED + +static int +xmlIsDocNameStartChar(xmlDocPtr doc, int c) { + if ((doc == NULL) || (doc->properties & XML_DOC_OLD10) == 0) { + /* + * Use the new checks of production [4] [4a] amd [5] of the + * Update 5 of XML-1.0 + */ + if (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + (c == '_') || (c == ':') || + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF))) + return(1); + } else { + if (IS_LETTER(c) || (c == '_') || (c == ':')) + return(1); + } + return(0); +} + +static int +xmlIsDocNameChar(xmlDocPtr doc, int c) { + if ((doc == NULL) || (doc->properties & XML_DOC_OLD10) == 0) { + /* + * Use the new checks of production [4] [4a] amd [5] of the + * Update 5 of XML-1.0 + */ + if (((c >= 'a') && (c <= 'z')) || + ((c >= 'A') && (c <= 'Z')) || + ((c >= '0') && (c <= '9')) || /* !start */ + (c == '_') || (c == ':') || + (c == '-') || (c == '.') || (c == 0xB7) || /* !start */ + ((c >= 0xC0) && (c <= 0xD6)) || + ((c >= 0xD8) && (c <= 0xF6)) || + ((c >= 0xF8) && (c <= 0x2FF)) || + ((c >= 0x300) && (c <= 0x36F)) || /* !start */ + ((c >= 0x370) && (c <= 0x37D)) || + ((c >= 0x37F) && (c <= 0x1FFF)) || + ((c >= 0x200C) && (c <= 0x200D)) || + ((c >= 0x203F) && (c <= 0x2040)) || /* !start */ + ((c >= 0x2070) && (c <= 0x218F)) || + ((c >= 0x2C00) && (c <= 0x2FEF)) || + ((c >= 0x3001) && (c <= 0xD7FF)) || + ((c >= 0xF900) && (c <= 0xFDCF)) || + ((c >= 0xFDF0) && (c <= 0xFFFD)) || + ((c >= 0x10000) && (c <= 0xEFFFF))) + return(1); + } else { + if ((IS_LETTER(c)) || (IS_DIGIT(c)) || + (c == '.') || (c == '-') || + (c == '_') || (c == ':') || + (IS_COMBINING(c)) || + (IS_EXTENDER(c))) + return(1); + } + return(0); +} + /** * xmlValidateNameValue: + * @doc: pointer to the document or NULL * @value: an Name value * * Validate that the given value match Name production @@ -3441,8 +3487,8 @@ xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name) { * returns 1 if valid or 0 otherwise */ -int -xmlValidateNameValue(const xmlChar *value) { +static int +xmlValidateNameValueInternal(xmlDocPtr doc, const xmlChar *value) { const xmlChar *cur; int val, len; @@ -3450,18 +3496,12 @@ xmlValidateNameValue(const xmlChar *value) { cur = value; val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - if (!IS_LETTER(val) && (val != '_') && - (val != ':')) { + if (!xmlIsDocNameStartChar(doc, val)) return(0); - } val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3472,7 +3512,22 @@ xmlValidateNameValue(const xmlChar *value) { } /** - * xmlValidateNamesValue: + * xmlValidateNameValue: + * @value: an Name value + * + * Validate that the given value match Name production + * + * returns 1 if valid or 0 otherwise + */ + +int +xmlValidateNameValue(const xmlChar *value) { + return(xmlValidateNameValueInternal(NULL, value)); +} + +/** + * xmlValidateNamesValueInternal: + * @doc: pointer to the document or NULL * @value: an Names value * * Validate that the given value match Names production @@ -3480,8 +3535,8 @@ xmlValidateNameValue(const xmlChar *value) { * returns 1 if valid or 0 otherwise */ -int -xmlValidateNamesValue(const xmlChar *value) { +static int +xmlValidateNamesValueInternal(xmlDocPtr doc, const xmlChar *value) { const xmlChar *cur; int val, len; @@ -3489,19 +3544,13 @@ xmlValidateNamesValue(const xmlChar *value) { cur = value; val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - - if (!IS_LETTER(val) && (val != '_') && - (val != ':')) { + + if (!xmlIsDocNameStartChar(doc, val)) return(0); - } val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3513,18 +3562,13 @@ xmlValidateNamesValue(const xmlChar *value) { cur += len; } - if (!IS_LETTER(val) && (val != '_') && - (val != ':')) { + if (!xmlIsDocNameStartChar(doc, val)) return(0); - } + val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3536,18 +3580,33 @@ xmlValidateNamesValue(const xmlChar *value) { } /** - * xmlValidateNmtokenValue: + * xmlValidateNamesValue: + * @value: an Names value + * + * Validate that the given value match Names production + * + * returns 1 if valid or 0 otherwise + */ + +int +xmlValidateNamesValue(const xmlChar *value) { + return(xmlValidateNamesValueInternal(NULL, value)); +} + +/** + * xmlValidateNmtokenValueInternal: + * @doc: pointer to the document or NULL * @value: an Nmtoken value * * Validate that the given value match Nmtoken production * * [ VC: Name Token ] - * + * * returns 1 if valid or 0 otherwise */ -int -xmlValidateNmtokenValue(const xmlChar *value) { +static int +xmlValidateNmtokenValueInternal(xmlDocPtr doc, const xmlChar *value) { const xmlChar *cur; int val, len; @@ -3555,19 +3614,13 @@ xmlValidateNmtokenValue(const xmlChar *value) { cur = value; val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - - if (!IS_LETTER(val) && !IS_DIGIT(val) && - (val != '.') && (val != '-') && - (val != '_') && (val != ':') && - (!IS_COMBINING(val)) && - (!IS_EXTENDER(val))) + + if (!xmlIsDocNameChar(doc, val)) return(0); - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + val = xmlStringCurrentChar(NULL, cur, &len); + cur += len; + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3578,18 +3631,35 @@ xmlValidateNmtokenValue(const xmlChar *value) { } /** - * xmlValidateNmtokensValue: + * xmlValidateNmtokenValue: + * @value: an Nmtoken value + * + * Validate that the given value match Nmtoken production + * + * [ VC: Name Token ] + * + * returns 1 if valid or 0 otherwise + */ + +int +xmlValidateNmtokenValue(const xmlChar *value) { + return(xmlValidateNmtokenValueInternal(NULL, value)); +} + +/** + * xmlValidateNmtokensValueInternal: + * @doc: pointer to the document or NULL * @value: an Nmtokens value * * Validate that the given value match Nmtokens production * * [ VC: Name Token ] - * + * * returns 1 if valid or 0 otherwise */ -int -xmlValidateNmtokensValue(const xmlChar *value) { +static int +xmlValidateNmtokensValueInternal(xmlDocPtr doc, const xmlChar *value) { const xmlChar *cur; int val, len; @@ -3597,24 +3667,16 @@ xmlValidateNmtokensValue(const xmlChar *value) { cur = value; val = xmlStringCurrentChar(NULL, cur, &len); cur += len; - + while (IS_BLANK(val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } - if (!IS_LETTER(val) && !IS_DIGIT(val) && - (val != '.') && (val != '-') && - (val != '_') && (val != ':') && - (!IS_COMBINING(val)) && - (!IS_EXTENDER(val))) + if (!xmlIsDocNameChar(doc, val)) return(0); - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3627,18 +3689,13 @@ xmlValidateNmtokensValue(const xmlChar *value) { } if (val == 0) return(1); - if (!IS_LETTER(val) && !IS_DIGIT(val) && - (val != '.') && (val != '-') && - (val != '_') && (val != ':') && - (!IS_COMBINING(val)) && - (!IS_EXTENDER(val))) + if (!xmlIsDocNameChar(doc, val)) return(0); - while ((IS_LETTER(val)) || (IS_DIGIT(val)) || - (val == '.') || (val == '-') || - (val == '_') || (val == ':') || - (IS_COMBINING(val)) || - (IS_EXTENDER(val))) { + val = xmlStringCurrentChar(NULL, cur, &len); + cur += len; + + while (xmlIsDocNameChar(doc, val)) { val = xmlStringCurrentChar(NULL, cur, &len); cur += len; } @@ -3649,6 +3706,22 @@ xmlValidateNmtokensValue(const xmlChar *value) { return(1); } +/** + * xmlValidateNmtokensValue: + * @value: an Nmtokens value + * + * Validate that the given value match Nmtokens production + * + * [ VC: Name Token ] + * + * returns 1 if valid or 0 otherwise + */ + +int +xmlValidateNmtokensValue(const xmlChar *value) { + return(xmlValidateNmtokensValueInternal(NULL, value)); +} + /** * xmlValidateNotationDecl: * @ctxt: the validation context @@ -3672,6 +3745,40 @@ xmlValidateNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc ATT return(ret); } +/** + * xmlValidateAttributeValueInternal: + * @doc: the document + * @type: an attribute type + * @value: an attribute value + * + * Validate that the given attribute value match the proper production + * + * returns 1 if valid or 0 otherwise + */ + +static int +xmlValidateAttributeValueInternal(xmlDocPtr doc, xmlAttributeType type, + const xmlChar *value) { + switch (type) { + case XML_ATTRIBUTE_ENTITIES: + case XML_ATTRIBUTE_IDREFS: + return(xmlValidateNamesValueInternal(doc, value)); + case XML_ATTRIBUTE_ENTITY: + case XML_ATTRIBUTE_IDREF: + case XML_ATTRIBUTE_ID: + case XML_ATTRIBUTE_NOTATION: + return(xmlValidateNameValueInternal(doc, value)); + case XML_ATTRIBUTE_NMTOKENS: + case XML_ATTRIBUTE_ENUMERATION: + return(xmlValidateNmtokensValueInternal(doc, value)); + case XML_ATTRIBUTE_NMTOKEN: + return(xmlValidateNmtokenValueInternal(doc, value)); + case XML_ATTRIBUTE_CDATA: + break; + } + return(1); +} + /** * xmlValidateAttributeValue: * @type: an attribute type @@ -3692,31 +3799,13 @@ xmlValidateNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc ATT * * [ VC: Name Token ] * Values of type NMTOKEN must match the Nmtoken production; values - * of type NMTOKENS must match Nmtokens. + * of type NMTOKENS must match Nmtokens. * * returns 1 if valid or 0 otherwise */ - int xmlValidateAttributeValue(xmlAttributeType type, const xmlChar *value) { - switch (type) { - case XML_ATTRIBUTE_ENTITIES: - case XML_ATTRIBUTE_IDREFS: - return(xmlValidateNamesValue(value)); - case XML_ATTRIBUTE_ENTITY: - case XML_ATTRIBUTE_IDREF: - case XML_ATTRIBUTE_ID: - case XML_ATTRIBUTE_NOTATION: - return(xmlValidateNameValue(value)); - case XML_ATTRIBUTE_NMTOKENS: - case XML_ATTRIBUTE_ENUMERATION: - return(xmlValidateNmtokensValue(value)); - case XML_ATTRIBUTE_NMTOKEN: - return(xmlValidateNmtokenValue(value)); - case XML_ATTRIBUTE_CDATA: - break; - } - return(1); + return(xmlValidateAttributeValueInternal(NULL, type, value)); } /** @@ -3769,7 +3858,7 @@ xmlValidateAttributeValue2(xmlValidCtxtPtr ctxt, xmlDocPtr doc, if ((ent == NULL) && (doc->standalone == 1)) { doc->standalone = 0; ent = xmlGetDocEntity(doc, value); - } + } if (ent == NULL) { xmlErrValidNode(ctxt, (xmlNodePtr) doc, XML_DTD_UNKNOWN_ENTITY, @@ -3880,7 +3969,7 @@ xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, xmlDocPtr doc, if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50); if (fullname == NULL) return(NULL); @@ -3965,13 +4054,10 @@ xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem, if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50); if (fullname == NULL) return(NULL); - attrDecl = xmlGetDtdAttrDesc(doc->intSubset, fullname, name); - if ((attrDecl == NULL) && (doc->extSubset != NULL)) - attrDecl = xmlGetDtdAttrDesc(doc->extSubset, fullname, name); if ((fullname != fn) && (fullname != elem->name)) xmlFree(fullname); } @@ -4034,11 +4120,12 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, int val; CHECK_DTD; if(attr == NULL) return(1); - + /* Attribute Default Legal */ /* Enumeration */ if (attr->defaultValue != NULL) { - val = xmlValidateAttributeValue(attr->atype, attr->defaultValue); + val = xmlValidateAttributeValueInternal(doc, attr->atype, + attr->defaultValue); if (val == 0) { xmlErrValidNode(ctxt, (xmlNodePtr) attr, XML_DTD_ATTRIBUTE_DEFAULT, "Syntax of default value for attribute %s of %s is not valid\n", @@ -4081,7 +4168,7 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, } } if (nbId > 1) { - + xmlErrValidNodeNr(ctxt, (xmlNodePtr) attr, XML_DTD_ID_SUBSET, "Element %s has %d ID attribute defined in the internal subset : %s\n", attr->elem, nbId, attr->name); @@ -4144,7 +4231,7 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlElementPtr tst; CHECK_DTD; - + if (elem == NULL) return(1); #if 0 @@ -4169,15 +4256,15 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, while (next != NULL) { if (next->type == XML_ELEMENT_CONTENT_ELEMENT) { if ((xmlStrEqual(next->name, name)) && - (xmlStrEqual(next->prefix, cur->prefix))) { - if (cur->prefix == NULL) { + (xmlStrEqual(next->prefix, cur->c1->prefix))) { + if (cur->c1->prefix == NULL) { xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR, "Definition of %s has duplicate references of %s\n", elem->name, name, NULL); } else { xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR, "Definition of %s has duplicate references of %s:%s\n", - elem->name, cur->prefix, name); + elem->name, cur->c1->prefix, name); } ret = 0; } @@ -4186,15 +4273,15 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, if (next->c1 == NULL) break; if (next->c1->type != XML_ELEMENT_CONTENT_ELEMENT) break; if ((xmlStrEqual(next->c1->name, name)) && - (xmlStrEqual(next->c1->prefix, cur->prefix))) { - if (cur->prefix == NULL) { + (xmlStrEqual(next->c1->prefix, cur->c1->prefix))) { + if (cur->c1->prefix == NULL) { xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR, "Definition of %s has duplicate references to %s\n", elem->name, name, NULL); } else { xmlErrValidNode(ctxt, (xmlNodePtr) elem, XML_DTD_CONTENT_ERROR, "Definition of %s has duplicate references to %s:%s\n", - elem->name, cur->prefix, name); + elem->name, cur->c1->prefix, name); } ret = 0; } @@ -4261,7 +4348,7 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, int xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc, - xmlNodePtr elem, xmlAttrPtr attr, const xmlChar *value) + xmlNodePtr elem, xmlAttrPtr attr, const xmlChar *value) { xmlAttributePtr attrDecl = NULL; int val; @@ -4274,7 +4361,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc, if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50); if (fullname == NULL) return(0); @@ -4319,7 +4406,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc, } attr->atype = attrDecl->atype; - val = xmlValidateAttributeValue(attrDecl->atype, value); + val = xmlValidateAttributeValueInternal(doc, attrDecl->atype, value); if (val == 0) { xmlErrValidNode(ctxt, elem, XML_DTD_ATTRIBUTE_VALUE, "Syntax of value for attribute %s of %s is not valid\n", @@ -4358,7 +4445,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc, nota = xmlGetDtdNotationDesc(doc->intSubset, value); if (nota == NULL) nota = xmlGetDtdNotationDesc(doc->extSubset, value); - + if (nota == NULL) { xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_NOTATION, "Value \"%s\" for attribute %s of %s is not a declared Notation\n", @@ -4451,7 +4538,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) { if (prefix != NULL) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(elem->name, prefix, fn, 50); if (fullname == NULL) { xmlVErrMemory(ctxt, "Validating namespace"); @@ -4504,7 +4591,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) { return(0); } - val = xmlValidateAttributeValue(attrDecl->atype, value); + val = xmlValidateAttributeValueInternal(doc, attrDecl->atype, value); if (val == 0) { if (ns->prefix != NULL) { xmlErrValidNode(ctxt, elem, XML_DTD_INVALID_DEFAULT, @@ -4555,7 +4642,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) { nota = xmlGetDtdNotationDesc(doc->intSubset, value); if (nota == NULL) nota = xmlGetDtdNotationDesc(doc->extSubset, value); - + if (nota == NULL) { if (ns->prefix != NULL) { xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_NOTATION, @@ -4691,7 +4778,7 @@ xmlValidateElementType(xmlValidCtxtPtr ctxt) { NODE = xmlValidateSkipIgnorable(NODE); if ((NODE == NULL) && (CONT == NULL)) return(1); - if ((NODE == NULL) && + if ((NODE == NULL) && ((CONT->ocur == XML_ELEMENT_CONTENT_MULT) || (CONT->ocur == XML_ELEMENT_CONTENT_OPT))) { return(1); @@ -5150,7 +5237,7 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child, xmlElementContentPtr cont; const xmlChar *name; - if (elemDecl == NULL) + if ((elemDecl == NULL) || (parent == NULL) || (ctxt == NULL)) return(-1); cont = elemDecl->content; name = elemDecl->name; @@ -5200,7 +5287,7 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child, if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(cur->name, cur->ns->prefix, fn, 50); if (fullname == NULL) { @@ -5314,7 +5401,7 @@ fail: last = tmp; } if (cur->type == XML_CDATA_SECTION_NODE) { - /* + /* * E59 spaces in CDATA does not match the * nonterminal S */ @@ -5431,7 +5518,8 @@ xmlValidateOneCdataElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, int ret = 1; xmlNodePtr cur, child; - if ((ctxt == NULL) || (doc == NULL) || (elem == NULL)) + if ((ctxt == NULL) || (doc == NULL) || (elem == NULL) || + (elem->type != XML_ELEMENT_NODE)) return(0); child = elem->children; @@ -5512,7 +5600,7 @@ xmlValidateCheckMixed(xmlValidCtxtPtr ctxt, } else if ((cont->type != XML_ELEMENT_CONTENT_OR) || (cont->c1 == NULL) || (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){ - xmlErrValid(NULL, XML_DTD_MIXED_CORRUPT, + xmlErrValid(NULL, XML_DTD_MIXED_CORRUPT, "Internal: MIXED struct corrupted\n", NULL); break; @@ -5536,7 +5624,7 @@ xmlValidateCheckMixed(xmlValidCtxtPtr ctxt, } else if ((cont->type != XML_ELEMENT_CONTENT_OR) || (cont->c1 == NULL) || (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){ - xmlErrValid(ctxt, XML_DTD_MIXED_CORRUPT, + xmlErrValid(ctxt, XML_DTD_MIXED_CORRUPT, "Internal: MIXED struct corrupted\n", NULL); break; @@ -5565,7 +5653,7 @@ xmlValidGetElemDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlElementPtr elemDecl = NULL; const xmlChar *prefix = NULL; - if ((ctxt == NULL) || (doc == NULL) || + if ((ctxt == NULL) || (doc == NULL) || (elem == NULL) || (elem->name == NULL)) return(NULL); if (extsubset != NULL) @@ -5709,7 +5797,7 @@ xmlValidatePushElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, * xmlValidatePushCData: * @ctxt: the validation context * @data: some character data read - * @len: the lenght of the data + * @len: the length of the data * * check the CData parsed for validation in the current stack * @@ -5931,7 +6019,7 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, return(0); /* - * If vstateNr is not zero that means continuous validation is + * If vstateNr is not zero that means continuous validation is * activated, do not try to check the content model at that level. */ if (ctxt->vstateNr == 0) { @@ -5974,7 +6062,7 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, if ((child->ns != NULL) && (child->ns->prefix != NULL)) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(child->name, child->ns->prefix, fn, 50); if (fullname == NULL) @@ -5992,7 +6080,7 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, } else if ((cont->type != XML_ELEMENT_CONTENT_OR) || (cont->c1 == NULL) || (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){ - xmlErrValid(NULL, XML_DTD_MIXED_CORRUPT, + xmlErrValid(NULL, XML_DTD_MIXED_CORRUPT, "Internal: MIXED struct corrupted\n", NULL); break; @@ -6015,7 +6103,7 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, } else if ((cont->type != XML_ELEMENT_CONTENT_OR) || (cont->c1 == NULL) || (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)) { - xmlErrValid(ctxt, XML_DTD_MIXED_CORRUPT, + xmlErrValid(ctxt, XML_DTD_MIXED_CORRUPT, "Internal: MIXED struct corrupted\n", NULL); break; @@ -6095,7 +6183,7 @@ child_ok: } } else { xmlAttrPtr attrib; - + attrib = elem->properties; while (attrib != NULL) { if (xmlStrEqual(attrib->name, attr->name)) { @@ -6110,18 +6198,18 @@ child_ok: * allow to define the URI instead of the prefix :-( */ if (nameSpace == NULL) { - if (qualified < 0) + if (qualified < 0) qualified = 0; } else if (!xmlStrEqual(nameSpace->prefix, attr->prefix)) { - if (qualified < 1) + if (qualified < 1) qualified = 1; } else goto found; } else { /* * We should allow applications to define namespaces - * for their application even if the DTD doesn't + * for their application even if the DTD doesn't * carry one, otherwise, basically we would always * break. */ @@ -6194,7 +6282,7 @@ child_ok: } } } -found: +found: attr = attr->nexth; } return(ret); @@ -6241,7 +6329,7 @@ xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { if ((root->ns != NULL) && (root->ns->prefix != NULL)) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(root->name, root->ns->prefix, fn, 50); if (fullname == NULL) { xmlVErrMemory(ctxt, NULL); @@ -6252,7 +6340,7 @@ xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { xmlFree(fullname); if (ret == 1) goto name_ok; - } + } if ((xmlStrEqual(doc->intSubset->name, BAD_CAST "HTML")) && (xmlStrEqual(root->name, BAD_CAST "html"))) goto name_ok; @@ -6273,7 +6361,7 @@ name_ok: * @doc: a document instance * @elem: an element instance * - * Try to validate the subtree under an element + * Try to validate the subtree under an element * * returns 1 if valid or 0 otherwise */ @@ -6293,7 +6381,8 @@ xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem) { * they don't really mean anything validation wise. */ if ((elem->type == XML_XINCLUDE_START) || - (elem->type == XML_XINCLUDE_END)) + (elem->type == XML_XINCLUDE_END) || + (elem->type == XML_NAMESPACE_DECL)) return(1); CHECK_DTD; @@ -6452,7 +6541,7 @@ xmlValidateCheckRefCallback(xmlListPtr ref_list, xmlValidCtxtPtr ctxt, memo.name = name; xmlListWalk(ref_list, xmlWalkValidateList, &memo); - + } /** @@ -6464,7 +6553,7 @@ xmlValidateCheckRefCallback(xmlListPtr ref_list, xmlValidCtxtPtr ctxt, * incremental validation steps have been completed * * basically it does the following checks described by the XML Rec - * + * * Check all the IDREF/IDREFS attributes definition for validity * * returns 1 if valid or 0 otherwise @@ -6473,15 +6562,20 @@ xmlValidateCheckRefCallback(xmlListPtr ref_list, xmlValidCtxtPtr ctxt, int xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { xmlRefTablePtr table; + unsigned int save; if (ctxt == NULL) return(0); if (doc == NULL) { - xmlErrValid(ctxt, XML_DTD_NO_DOC, + xmlErrValid(ctxt, XML_DTD_NO_DOC, "xmlValidateDocumentFinal: doc == NULL\n", NULL); return(0); } + /* trick to get correct line id report */ + save = ctxt->finishDtd; + ctxt->finishDtd = 0; + /* * Check all the NOTATION/NOTATIONS attributes */ @@ -6495,6 +6589,8 @@ xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { ctxt->doc = doc; ctxt->valid = 1; xmlHashScan(table, (xmlHashScanner) xmlValidateCheckRefCallback, ctxt); + + ctxt->finishDtd = save; return(ctxt->valid); } @@ -6589,7 +6685,7 @@ xmlValidateAttributeCallback(xmlAttributePtr cur, xmlValidCtxtPtr ctxt, case XML_ATTRIBUTE_ENTITIES: case XML_ATTRIBUTE_NOTATION: if (cur->defaultValue != NULL) { - + ret = xmlValidateAttributeValue2(ctxt, ctxt->doc, cur->name, cur->atype, cur->defaultValue); if ((ret == 0) && (ctxt->valid == 1)) @@ -6646,9 +6742,9 @@ xmlValidateAttributeCallback(xmlAttributePtr cur, xmlValidCtxtPtr ctxt, * subsets have been parsed * * basically it does the following checks described by the XML Rec - * - check that ENTITY and ENTITIES type attributes default or + * - check that ENTITY and ENTITIES type attributes default or * possible values matches one of the defined entities. - * - check that NOTATION type attributes default or + * - check that NOTATION type attributes default or * possible values matches one of the defined notations. * * returns 1 if valid or 0 if invalid and -1 if not well-formed @@ -6660,7 +6756,7 @@ xmlValidateDtdFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { xmlAttributeTablePtr table; xmlEntitiesTablePtr entities; - if (doc == NULL) return(0); + if ((doc == NULL) || (ctxt == NULL)) return(0); if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) return(0); ctxt->doc = doc; @@ -6719,7 +6815,7 @@ xmlValidateDocument(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { xmlChar *sysID; if (doc->intSubset->SystemID != NULL) { sysID = xmlBuildURI(doc->intSubset->SystemID, - doc->URL); + doc->URL); if (sysID == NULL) { xmlErrValid(ctxt, XML_DTD_LOAD_ERROR, "Could not build URI for external subset \"%s\"\n", @@ -6792,17 +6888,17 @@ xmlValidGetPotentialChildren(xmlElementContent *ctree, if (*len >= max) return(*len); switch (ctree->type) { - case XML_ELEMENT_CONTENT_PCDATA: + case XML_ELEMENT_CONTENT_PCDATA: for (i = 0; i < *len;i++) if (xmlStrEqual(BAD_CAST "#PCDATA", names[i])) return(*len); names[(*len)++] = BAD_CAST "#PCDATA"; break; - case XML_ELEMENT_CONTENT_ELEMENT: + case XML_ELEMENT_CONTENT_ELEMENT: for (i = 0; i < *len;i++) if (xmlStrEqual(ctree->name, names[i])) return(*len); names[(*len)++] = ctree->name; break; - case XML_ELEMENT_CONTENT_SEQ: + case XML_ELEMENT_CONTENT_SEQ: xmlValidGetPotentialChildren(ctree->c1, names, len, max); xmlValidGetPotentialChildren(ctree->c2, names, len, max); break; @@ -6811,7 +6907,7 @@ xmlValidGetPotentialChildren(xmlElementContent *ctree, xmlValidGetPotentialChildren(ctree->c2, names, len, max); break; } - + return(*len); } @@ -6853,19 +6949,19 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names, int max) { xmlValidCtxt vctxt; int nb_valid_elements = 0; - const xmlChar *elements[256]; + const xmlChar *elements[256]={0}; int nb_elements = 0, i; const xmlChar *name; - + xmlNode *ref_node; xmlNode *parent; xmlNode *test_node; - + xmlNode *prev_next; xmlNode *next_prev; xmlNode *parent_childs; xmlNode *parent_last; - + xmlElement *element_desc; if (prev == NULL && next == NULL) @@ -6890,7 +6986,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names, element_desc = xmlGetDtdElementDesc(parent->doc->extSubset, parent->name); if (element_desc == NULL) return(-1); - + /* * Do a backup of the current tree structure */ @@ -6901,16 +6997,19 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names, /* * Creates a dummy node and insert it into the tree - */ + */ test_node = xmlNewDocNode (ref_node->doc, NULL, BAD_CAST "", NULL); + if (test_node == NULL) + return(-1); + test_node->parent = parent; test_node->prev = prev; test_node->next = next; name = test_node->name; - + if (prev) prev->next = test_node; else parent->children = test_node; - + if (next) next->prev = test_node; else parent->last = test_node; @@ -6920,7 +7019,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names, */ nb_elements = xmlValidGetPotentialChildren(element_desc->content, elements, &nb_elements, 256); - + for (i = 0;i < nb_elements;i++) { test_node->name = elements[i]; if (xmlValidateOneElement(&vctxt, parent->doc, parent)) { diff --git a/gnulib-local/lib/libxml/valid.in.h b/gnulib-local/lib/libxml/valid.in.h index 7492d28..2bc7b38 100644 --- a/gnulib-local/lib/libxml/valid.in.h +++ b/gnulib-local/lib/libxml/valid.in.h @@ -41,7 +41,7 @@ typedef xmlValidState *xmlValidStatePtr; */ typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx, const char *msg, - ...); + ...) LIBXML_ATTR_FORMAT(2,3); /** * xmlValidityWarningFunc: @@ -56,7 +56,7 @@ typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx, */ typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx, const char *msg, - ...); + ...) LIBXML_ATTR_FORMAT(2,3); #ifdef IN_LIBXML /** @@ -150,55 +150,55 @@ typedef struct _xmlHashTable xmlRefTable; typedef xmlRefTable *xmlRefTablePtr; /* Notation */ -XMLPUBFUN xmlNotationPtr XMLCALL +XMLPUBFUN xmlNotationPtr XMLCALL xmlAddNotationDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name, const xmlChar *PublicID, const xmlChar *SystemID); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlNotationTablePtr XMLCALL +XMLPUBFUN xmlNotationTablePtr XMLCALL xmlCopyNotationTable (xmlNotationTablePtr table); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeNotationTable (xmlNotationTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpNotationDecl (xmlBufferPtr buf, xmlNotationPtr nota); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpNotationTable (xmlBufferPtr buf, xmlNotationTablePtr table); #endif /* LIBXML_OUTPUT_ENABLED */ /* Element Content */ /* the non Doc version are being deprecated */ -XMLPUBFUN xmlElementContentPtr XMLCALL +XMLPUBFUN xmlElementContentPtr XMLCALL xmlNewElementContent (const xmlChar *name, xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL +XMLPUBFUN xmlElementContentPtr XMLCALL xmlCopyElementContent (xmlElementContentPtr content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeElementContent (xmlElementContentPtr cur); /* the new versions with doc argument */ -XMLPUBFUN xmlElementContentPtr XMLCALL +XMLPUBFUN xmlElementContentPtr XMLCALL xmlNewDocElementContent (xmlDocPtr doc, const xmlChar *name, xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL +XMLPUBFUN xmlElementContentPtr XMLCALL xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr content); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int englob); #ifdef LIBXML_OUTPUT_ENABLED /* DEPRECATED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSprintfElementContent(char *buf, xmlElementContentPtr content, int englob); @@ -206,39 +206,39 @@ XMLPUBFUN void XMLCALL /* DEPRECATED */ /* Element */ -XMLPUBFUN xmlElementPtr XMLCALL +XMLPUBFUN xmlElementPtr XMLCALL xmlAddElementDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name, xmlElementTypeVal type, xmlElementContentPtr content); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlElementTablePtr XMLCALL +XMLPUBFUN xmlElementTablePtr XMLCALL xmlCopyElementTable (xmlElementTablePtr table); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeElementTable (xmlElementTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpElementTable (xmlBufferPtr buf, xmlElementTablePtr table); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpElementDecl (xmlBufferPtr buf, xmlElementPtr elem); #endif /* LIBXML_OUTPUT_ENABLED */ /* Enumeration */ -XMLPUBFUN xmlEnumerationPtr XMLCALL +XMLPUBFUN xmlEnumerationPtr XMLCALL xmlCreateEnumeration (const xmlChar *name); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeEnumeration (xmlEnumerationPtr cur); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEnumerationPtr XMLCALL +XMLPUBFUN xmlEnumerationPtr XMLCALL xmlCopyEnumeration (xmlEnumerationPtr cur); #endif /* LIBXML_TREE_ENABLED */ /* Attribute */ -XMLPUBFUN xmlAttributePtr XMLCALL +XMLPUBFUN xmlAttributePtr XMLCALL xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem, @@ -249,55 +249,55 @@ XMLPUBFUN xmlAttributePtr XMLCALL const xmlChar *defaultValue, xmlEnumerationPtr tree); #ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlAttributeTablePtr XMLCALL +XMLPUBFUN xmlAttributeTablePtr XMLCALL xmlCopyAttributeTable (xmlAttributeTablePtr table); #endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeAttributeTable (xmlAttributeTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpAttributeTable (xmlBufferPtr buf, xmlAttributeTablePtr table); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlDumpAttributeDecl (xmlBufferPtr buf, xmlAttributePtr attr); #endif /* LIBXML_OUTPUT_ENABLED */ /* IDs */ -XMLPUBFUN xmlIDPtr XMLCALL +XMLPUBFUN xmlIDPtr XMLCALL xmlAddID (xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeIDTable (xmlIDTablePtr table); -XMLPUBFUN xmlAttrPtr XMLCALL +XMLPUBFUN xmlAttrPtr XMLCALL xmlGetID (xmlDocPtr doc, const xmlChar *ID); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlIsID (xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveID (xmlDocPtr doc, +XMLPUBFUN int XMLCALL + xmlRemoveID (xmlDocPtr doc, xmlAttrPtr attr); /* IDREFs */ -XMLPUBFUN xmlRefPtr XMLCALL +XMLPUBFUN xmlRefPtr XMLCALL xmlAddRef (xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeRefTable (xmlRefTablePtr table); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlIsRef (xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveRef (xmlDocPtr doc, +XMLPUBFUN int XMLCALL + xmlRemoveRef (xmlDocPtr doc, xmlAttrPtr attr); -XMLPUBFUN xmlListPtr XMLCALL +XMLPUBFUN xmlListPtr XMLCALL xmlGetRefs (xmlDocPtr doc, const xmlChar *ID); @@ -306,146 +306,146 @@ XMLPUBFUN xmlListPtr XMLCALL */ #ifdef LIBXML_VALID_ENABLED /* Allocate/Release Validation Contexts */ -XMLPUBFUN xmlValidCtxtPtr XMLCALL +XMLPUBFUN xmlValidCtxtPtr XMLCALL xmlNewValidCtxt(void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeValidCtxt(xmlValidCtxtPtr); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateRoot (xmlValidCtxtPtr ctxt, xmlDocPtr doc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateElementDecl (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlElementPtr elem); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem, const xmlChar *name, const xmlChar *value); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, const xmlChar *name, const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlAttributePtr attr); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateAttributeValue(xmlAttributeType type, const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNotationDecl (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNotationPtr nota); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateDtd (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlDtdPtr dtd); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateDtdFinal (xmlValidCtxtPtr ctxt, xmlDocPtr doc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateDocument (xmlValidCtxtPtr ctxt, xmlDocPtr doc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateOneElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateOneAttribute (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr, const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateOneNamespace (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc); #endif /* LIBXML_VALID_ENABLED */ #if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNotationUse (xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *notationName); #endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlIsMixedElement (xmlDocPtr doc, const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL +XMLPUBFUN xmlAttributePtr XMLCALL xmlGetDtdAttrDesc (xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL +XMLPUBFUN xmlAttributePtr XMLCALL xmlGetDtdQAttrDesc (xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name, const xmlChar *prefix); -XMLPUBFUN xmlNotationPtr XMLCALL +XMLPUBFUN xmlNotationPtr XMLCALL xmlGetDtdNotationDesc (xmlDtdPtr dtd, const xmlChar *name); -XMLPUBFUN xmlElementPtr XMLCALL +XMLPUBFUN xmlElementPtr XMLCALL xmlGetDtdQElementDesc (xmlDtdPtr dtd, const xmlChar *name, const xmlChar *prefix); -XMLPUBFUN xmlElementPtr XMLCALL +XMLPUBFUN xmlElementPtr XMLCALL xmlGetDtdElementDesc (xmlDtdPtr dtd, const xmlChar *name); #ifdef LIBXML_VALID_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidGetPotentialChildren(xmlElementContent *ctree, const xmlChar **names, int *len, int max); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **names, int max); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNameValue (const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNamesValue (const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNmtokenValue (const xmlChar *value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidateNmtokensValue(const xmlChar *value); #ifdef LIBXML_REGEXP_ENABLED /* * Validation based on the regexp support */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidatePushElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, const xmlChar *qname); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidatePushCData (xmlValidCtxtPtr ctxt, const xmlChar *data, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlValidatePopElement (xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr elem, diff --git a/gnulib-local/lib/libxml/xinclude.c b/gnulib-local/lib/libxml/xinclude.c index c58bbcf..ff3dafb 100644 --- a/gnulib-local/lib/libxml/xinclude.c +++ b/gnulib-local/lib/libxml/xinclude.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,7 @@ #ifdef LIBXML_XINCLUDE_ENABLED #include +#include "buf.h" #define XINCLUDE_MAX_DEPTH 40 @@ -92,7 +94,7 @@ xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree); /************************************************************************ * * - * XInclude error handler * + * XInclude error handler * * * ************************************************************************/ @@ -412,14 +414,13 @@ xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) { * xmlXIncludeParseFile: * @ctxt: the XInclude context * @URL: the URL or file path - * + * * parse a document for XInclude */ static xmlDocPtr xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) { xmlDocPtr ret; xmlParserCtxtPtr pctxt; - char *directory = NULL; xmlParserInputPtr inputStream; xmlInitParser(); @@ -434,20 +435,20 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) { * pass in the application data to the parser context. */ pctxt->_private = ctxt->_private; - + /* * try to ensure that new documents included are actually * built with the same dictionary as the including document. */ - if ((ctxt->doc != NULL) && (ctxt->doc->dict != NULL) && - (pctxt->dict != NULL)) { - xmlDictFree(pctxt->dict); + if ((ctxt->doc != NULL) && (ctxt->doc->dict != NULL)) { + if (pctxt->dict != NULL) + xmlDictFree(pctxt->dict); pctxt->dict = ctxt->doc->dict; xmlDictReference(pctxt->dict); } xmlCtxtUseOptions(pctxt, ctxt->parseFlags | XML_PARSE_DTDLOAD); - + inputStream = xmlLoadExternalEntity(URL, NULL, pctxt); if (inputStream == NULL) { xmlFreeParserCtxt(pctxt); @@ -456,10 +457,8 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) { inputPush(pctxt, inputStream); - if ((pctxt->directory == NULL) && (directory == NULL)) - directory = xmlParserGetDirectory(URL); - if ((pctxt->directory == NULL) && (directory != NULL)) - pctxt->directory = (char *) xmlStrdup((xmlChar *) directory); + if (pctxt->directory == NULL) + pctxt->directory = xmlParserGetDirectory(URL); pctxt->loadsubset |= XML_DETECT_IDS; @@ -475,7 +474,7 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) { pctxt->myDoc = NULL; } xmlFreeParserCtxt(pctxt); - + return(ret); } @@ -483,7 +482,7 @@ xmlXIncludeParseFile(xmlXIncludeCtxtPtr ctxt, const char *URL) { * xmlXIncludeAddNode: * @ctxt: the XInclude context * @cur: the new node - * + * * Add a new node to process to an XInclude context */ static int @@ -514,11 +513,10 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) { href = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_HREF); if (href == NULL) { href = xmlStrdup(BAD_CAST ""); /* @@@@ href is now optional */ - if (href == NULL) + if (href == NULL) return(-1); - local = 1; } - if (href[0] == '#') + if ((href[0] == '#') || (href[0] == 0)) local = 1; parse = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE); if (parse != NULL) { @@ -616,6 +614,19 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) { return(-1); } + /* + * If local and xml then we need a fragment + */ + if ((local == 1) && (xml == 1) && + ((fragment == NULL) || (fragment[0] == 0))) { + xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_RECURSION, + "detected a local recursion with no xpointer in %s\n", + URL); + if (fragment != NULL) + xmlFree(fragment); + return(-1); + } + /* * Check the URL against the stack for recursions */ @@ -646,7 +657,7 @@ xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) { * @ctxt: the XInclude context * @doc: the new document * @url: the associated URL - * + * * The XInclude recursive nature is handled at this point. */ static void @@ -672,6 +683,10 @@ xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, newctxt = xmlXIncludeNewContext(doc); if (newctxt != NULL) { + /* + * Copy the private user data + */ + newctxt->_private = ctxt->_private; /* * Copy the existing document set */ @@ -736,7 +751,7 @@ xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, * @ctxt: the XInclude context * @txt: the new text node * @url: the associated URL - * + * * Add a new txtument to the list */ static void @@ -785,13 +800,17 @@ xmlXIncludeAddTxt(xmlXIncludeCtxtPtr ctxt, xmlNodePtr txt, const xmlURL url) { * * ************************************************************************/ +static xmlNodePtr +xmlXIncludeCopyNodeList(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, + xmlDocPtr source, xmlNodePtr elem); + /** * xmlXIncludeCopyNode: * @ctxt: the XInclude context * @target: the document target * @source: the document source * @elem: the element - * + * * Make a copy of the node while preserving the XInclude semantic * of the Infoset copy */ @@ -805,7 +824,10 @@ xmlXIncludeCopyNode(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, return(NULL); if (elem->type == XML_DTD_NODE) return(NULL); - result = xmlDocCopyNode(elem, target, 1); + if (elem->type == XML_DOCUMENT_NODE) + result = xmlXIncludeCopyNodeList(ctxt, target, source, elem->children); + else + result = xmlDocCopyNode(elem, target, 1); return(result); } @@ -815,7 +837,7 @@ xmlXIncludeCopyNode(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, * @target: the document target * @source: the document source * @elem: the element list - * + * * Make a copy of the node list while preserving the XInclude semantic * of the Infoset copy */ @@ -854,11 +876,11 @@ xmlXIncludeCopyNodeList(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, static xmlNodePtr xmlXIncludeGetNthChild(xmlNodePtr cur, int no) { int i; - if (cur == NULL) - return(cur); + if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL)) + return(NULL); cur = cur->children; for (i = 0;i <= no;cur = cur->next) { - if (cur == NULL) + if (cur == NULL) return(cur); if ((cur->type == XML_ELEMENT_NODE) || (cur->type == XML_DOCUMENT_NODE) || @@ -902,11 +924,13 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, return(NULL); start = (xmlNodePtr) range->user; - if (start == NULL) + if ((start == NULL) || (start->type == XML_NAMESPACE_DECL)) return(NULL); end = range->user2; if (end == NULL) return(xmlDocCopyNode(start, target, 1)); + if (end->type == XML_NAMESPACE_DECL) + return(NULL); cur = start; index1 = range->index; @@ -954,7 +978,6 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, if ((cur == start) && (index1 > 1)) { content += (index1 - 1); len -= (index1 - 1); - index1 = 0; } else { len = index2; } @@ -966,7 +989,7 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, /* prune and return full set */ if (level == lastLevel) xmlAddNextSibling(last, tmp); - else + else xmlAddChild(last, tmp); return(list); } else { /* ending node not a text node */ @@ -1185,6 +1208,7 @@ xmlXIncludeCopyXPointer(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, } break; } +#ifdef LIBXML_XPTR_ENABLED case XPATH_LOCATIONSET: { xmlLocationSetPtr set = (xmlLocationSetPtr) obj->user; if (set == NULL) @@ -1204,7 +1228,6 @@ xmlXIncludeCopyXPointer(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target, } break; } -#ifdef LIBXML_XPTR_ENABLED case XPATH_RANGE: return(xmlXIncludeCopyRange(ctxt, target, source, obj)); #endif @@ -1270,7 +1293,7 @@ xmlXIncludeMergeEntity(xmlEntityPtr ent, xmlXIncludeMergeDataPtr data, if (prev != NULL) { if (ent->etype != prev->etype) goto error; - + if ((ent->SystemID != NULL) && (prev->SystemID != NULL)) { if (!xmlStrEqual(ent->SystemID, prev->SystemID)) goto error; @@ -1370,7 +1393,7 @@ xmlXIncludeMergeEntities(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, * @ctxt: the XInclude context * @url: the associated URL * @nr: the xinclude node number - * + * * Load the document, and store the result in the XInclude context * * Returns 0 in case of success, -1 in case of failure @@ -1394,7 +1417,7 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) { */ uri = xmlParseURI((const char *)url); if (uri == NULL) { - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_HREF_URI, "invalid value URI %s\n", url); return(-1); @@ -1412,7 +1435,7 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) { xmlFreeURI(uri); if (URL == NULL) { if (ctxt->incTab != NULL) - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_HREF_URI, "invalid value URI %s\n", url); else @@ -1531,7 +1554,7 @@ loaded: ctxt->incTab[nr]->inc = xmlXIncludeCopyNodeList(ctxt, ctxt->doc, doc, doc->children); } - } + } #ifdef LIBXML_XPTR_ENABLED else { /* @@ -1549,7 +1572,7 @@ loaded: xptrctxt = xmlXPtrNewContext(doc, NULL, NULL); } if (xptrctxt == NULL) { - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_XPTR_FAILED, "could not create XPointer context\n", NULL); xmlFree(URL); @@ -1575,7 +1598,7 @@ loaded: case XPATH_POINT: case XPATH_USERS: case XPATH_XSLT_TREE: - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_XPTR_RESULT, "XPointer is not a range: #%s\n", fragment); @@ -1602,6 +1625,7 @@ loaded: if (set->nodeTab[i] == NULL) continue; switch (set->nodeTab[i]->type) { + case XML_ELEMENT_NODE: case XML_TEXT_NODE: case XML_CDATA_SECTION_NODE: case XML_ENTITY_REF_NODE: @@ -1614,28 +1638,16 @@ loaded: case XML_DOCB_DOCUMENT_NODE: #endif continue; - case XML_ELEMENT_NODE: { - xmlChar *nodeBase; - xmlNodePtr el = set->nodeTab[i]; - - nodeBase = xmlNodeGetBase(el->doc, el); - if (nodeBase != NULL) { - if (!xmlStrEqual(nodeBase, el->doc->URL)) - xmlNodeSetBase(el, nodeBase); - xmlFree(nodeBase); - } - continue; - } case XML_ATTRIBUTE_NODE: - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_XPTR_RESULT, "XPointer selects an attribute: #%s\n", fragment); set->nodeTab[i] = NULL; continue; case XML_NAMESPACE_DECL: - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_XPTR_RESULT, "XPointer selects a namespace: #%s\n", fragment); @@ -1650,7 +1662,7 @@ loaded: case XML_ENTITY_DECL: case XML_XINCLUDE_START: case XML_XINCLUDE_END: - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_XPTR_RESULT, "XPointer selects unexpected nodes: #%s\n", fragment); @@ -1676,7 +1688,9 @@ loaded: /* * Do the xml:base fixup if needed */ - if ((doc != NULL) && (URL != NULL) && (xmlStrchr(URL, (xmlChar) '/'))) { + if ((doc != NULL) && (URL != NULL) && + (!(ctxt->parseFlags & XML_PARSE_NOBASEFIX)) && + (!(doc->parseFlags & XML_PARSE_NOBASEFIX))) { xmlNodePtr node; xmlChar *base; xmlChar *curBase; @@ -1694,7 +1708,7 @@ loaded: */ curBase = xmlBuildRelativeURI(URL, ctxt->base); if (curBase == NULL) { /* Error return */ - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_HREF_URI, "trying to build relative URI from %s\n", URL); } else { @@ -1735,7 +1749,7 @@ loaded: xmlChar *relBase; relBase = xmlBuildURI(xmlBase, base); if (relBase == NULL) { /* error */ - xmlXIncludeErr(ctxt, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_HREF_URI, "trying to rebuild base from %s\n", @@ -1772,7 +1786,7 @@ loaded: * @ctxt: the XInclude context * @url: the associated URL * @nr: the xinclude node number - * + * * Load the content, and store the result in the XInclude context * * Returns 0 in case of success, -1 in case of failure @@ -1786,6 +1800,9 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) { int i; xmlChar *encoding = NULL; xmlCharEncoding enc = (xmlCharEncoding) 0; + xmlParserCtxtPtr pctxt; + xmlParserInputPtr inputStream; + int xinclude_multibyte_fallback_used = 0; /* * Check the URL and remove any fragment identifier @@ -1816,7 +1833,7 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) { * directly through ctxt->doc. */ if (URL[0] == 0) { - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_TEXT_DOCUMENT, "text serialization of document not available\n", NULL); xmlFree(URL); @@ -1860,40 +1877,65 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) { /* * Load it. */ - buf = xmlParserInputBufferCreateFilename((const char *)URL, enc); + pctxt = xmlNewParserCtxt(); + inputStream = xmlLoadExternalEntity((const char*)URL, NULL, pctxt); + if(inputStream == NULL) { + xmlFreeParserCtxt(pctxt); + xmlFree(URL); + return(-1); + } + buf = inputStream->buf; if (buf == NULL) { + xmlFreeInputStream (inputStream); + xmlFreeParserCtxt(pctxt); xmlFree(URL); return(-1); } + if (buf->encoder) + xmlCharEncCloseFunc(buf->encoder); + buf->encoder = xmlGetCharEncodingHandler(enc); node = xmlNewText(NULL); /* * Scan all chars from the resource and add the to the node */ +xinclude_multibyte_fallback: while (xmlParserInputBufferRead(buf, 128) > 0) { int len; const xmlChar *content; - content = xmlBufferContent(buf->buffer); - len = xmlBufferLength(buf->buffer); + content = xmlBufContent(buf->buffer); + len = xmlBufLength(buf->buffer); for (i = 0;i < len;) { int cur; int l; cur = xmlStringCurrentChar(NULL, &content[i], &l); if (!IS_CHAR(cur)) { - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, - XML_XINCLUDE_INVALID_CHAR, - "%s contains invalid char\n", URL); + /* Handle splitted multibyte char at buffer boundary */ + if (((len - i) < 4) && (!xinclude_multibyte_fallback_used)) { + xinclude_multibyte_fallback_used = 1; + xmlBufShrink(buf->buffer, i); + goto xinclude_multibyte_fallback; + } else { + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + XML_XINCLUDE_INVALID_CHAR, + "%s contains invalid char\n", URL); + xmlFreeParserInputBuffer(buf); + xmlFree(URL); + return(-1); + } } else { + xinclude_multibyte_fallback_used = 0; xmlNodeAddContentLen(node, &content[i], l); } i += l; } - xmlBufferShrink(buf->buffer, len); + xmlBufShrink(buf->buffer, len); } - xmlFreeParserInputBuffer(buf); + xmlFreeParserCtxt(pctxt); xmlXIncludeAddTxt(ctxt, node, URL); + xmlFreeInputStream(inputStream); loaded: /* @@ -1909,7 +1951,7 @@ loaded: * @ctxt: the XInclude context * @fallback: the fallback node * @nr: the xinclude node number - * + * * Load the content of the fallback node, and store the result * in the XInclude context * @@ -1919,8 +1961,9 @@ static int xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) { xmlXIncludeCtxtPtr newctxt; int ret = 0; - - if ((fallback == NULL) || (ctxt == NULL)) + + if ((fallback == NULL) || (fallback->type == XML_NAMESPACE_DECL) || + (ctxt == NULL)) return(-1); if (fallback->children != NULL) { /* @@ -1930,6 +1973,7 @@ xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) { newctxt = xmlXIncludeNewContext(ctxt->doc); if (newctxt == NULL) return (-1); + newctxt->_private = ctxt->_private; newctxt->base = xmlStrdup(ctxt->base); /* Inherit the base from the existing context */ xmlXIncludeSetFlags(newctxt, ctxt->parseFlags); ret = xmlXIncludeDoProcess(newctxt, ctxt->doc, fallback->children); @@ -2004,7 +2048,7 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) { href = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_HREF); if (href == NULL) { href = xmlStrdup(BAD_CAST ""); /* @@@@ href is now optional */ - if (href == NULL) + if (href == NULL) return(-1); } parse = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE); @@ -2049,7 +2093,7 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) { xmlFree(eschref); } if (URI == NULL) { - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_HREF_URI, "failed build URL\n", NULL); if (parse != NULL) xmlFree(parse); @@ -2082,7 +2126,7 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) { * Restore the original base before checking for fallback */ ctxt->base = oldBase; - + if (ret < 0) { xmlNodePtr children; @@ -2100,14 +2144,14 @@ xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, int nr) { ((xmlStrEqual(children->ns->href, XINCLUDE_NS)) || (xmlStrEqual(children->ns->href, XINCLUDE_OLD_NS)))) { ret = xmlXIncludeLoadFallback(ctxt, children, nr); - if (ret == 0) + if (ret == 0) break; } children = children->next; } } if (ret < 0) { - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_NO_FALLBACK, "could not load %s, and no fallback was found\n", URI); @@ -2145,7 +2189,7 @@ xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) { if ((nr < 0) || (nr >= ctxt->incNr)) return(-1); cur = ctxt->incTab[nr]->ref; - if (cur == NULL) + if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL)) return(-1); /* @@ -2176,7 +2220,7 @@ xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) { tmp = tmp->next; } if (nb_elem > 1) { - xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, + xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref, XML_XINCLUDE_MULTIPLE_ROOT, "XInclude error: would result in multiple root nodes\n", NULL); @@ -2223,7 +2267,7 @@ xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) { } } - + return(0); } @@ -2320,7 +2364,7 @@ xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree) { int ret = 0; int i, start; - if ((doc == NULL) || (tree == NULL)) + if ((doc == NULL) || (tree == NULL) || (tree->type == XML_NAMESPACE_DECL)) return(-1); if (ctxt == NULL) return(-1); @@ -2415,7 +2459,43 @@ xmlXIncludeSetFlags(xmlXIncludeCtxtPtr ctxt, int flags) { ctxt->parseFlags = flags; return(0); } - + +/** + * xmlXIncludeProcessTreeFlagsData: + * @tree: an XML node + * @flags: a set of xmlParserOption used for parsing XML includes + * @data: application data that will be passed to the parser context + * in the _private field of the parser context(s) + * + * Implement the XInclude substitution on the XML node @tree + * + * Returns 0 if no substitution were done, -1 if some processing failed + * or the number of substitutions done. + */ + +int +xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree, int flags, void *data) { + xmlXIncludeCtxtPtr ctxt; + int ret = 0; + + if ((tree == NULL) || (tree->type == XML_NAMESPACE_DECL) || + (tree->doc == NULL)) + return(-1); + + ctxt = xmlXIncludeNewContext(tree->doc); + if (ctxt == NULL) + return(-1); + ctxt->_private = data; + ctxt->base = xmlStrdup((xmlChar *)tree->doc->URL); + xmlXIncludeSetFlags(ctxt, flags); + ret = xmlXIncludeDoProcess(ctxt, tree->doc, tree); + if ((ret >= 0) && (ctxt->nbErrors > 0)) + ret = -1; + + xmlXIncludeFreeContext(ctxt); + return(ret); +} + /** * xmlXIncludeProcessFlagsData: * @doc: an XML document @@ -2430,27 +2510,14 @@ xmlXIncludeSetFlags(xmlXIncludeCtxtPtr ctxt, int flags) { */ int xmlXIncludeProcessFlagsData(xmlDocPtr doc, int flags, void *data) { - xmlXIncludeCtxtPtr ctxt; xmlNodePtr tree; - int ret = 0; if (doc == NULL) return(-1); tree = xmlDocGetRootElement(doc); if (tree == NULL) return(-1); - ctxt = xmlXIncludeNewContext(doc); - if (ctxt == NULL) - return(-1); - ctxt->_private = data; - ctxt->base = xmlStrdup((xmlChar *)doc->URL); - xmlXIncludeSetFlags(ctxt, flags); - ret = xmlXIncludeDoProcess(ctxt, doc, tree); - if ((ret >= 0) && (ctxt->nbErrors > 0)) - ret = -1; - - xmlXIncludeFreeContext(ctxt); - return(ret); + return(xmlXIncludeProcessTreeFlagsData(tree, flags, data)); } /** @@ -2497,7 +2564,8 @@ xmlXIncludeProcessTreeFlags(xmlNodePtr tree, int flags) { xmlXIncludeCtxtPtr ctxt; int ret = 0; - if ((tree == NULL) || (tree->doc == NULL)) + if ((tree == NULL) || (tree->type == XML_NAMESPACE_DECL) || + (tree->doc == NULL)) return(-1); ctxt = xmlXIncludeNewContext(tree->doc); if (ctxt == NULL) @@ -2541,7 +2609,8 @@ int xmlXIncludeProcessNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node) { int ret = 0; - if ((node == NULL) || (node->doc == NULL) || (ctxt == NULL)) + if ((node == NULL) || (node->type == XML_NAMESPACE_DECL) || + (node->doc == NULL) || (ctxt == NULL)) return(-1); ret = xmlXIncludeDoProcess(ctxt, node->doc, node); if ((ret >= 0) && (ctxt->nbErrors > 0)) diff --git a/gnulib-local/lib/libxml/xinclude.in.h b/gnulib-local/lib/libxml/xinclude.in.h index ba9c9b5..863ab25 100644 --- a/gnulib-local/lib/libxml/xinclude.in.h +++ b/gnulib-local/lib/libxml/xinclude.in.h @@ -89,18 +89,22 @@ typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr; /* * standalone processing */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXIncludeProcess (xmlDocPtr doc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXIncludeProcessFlags (xmlDocPtr doc, int flags); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXIncludeProcessFlagsData(xmlDocPtr doc, int flags, void *data); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL + xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree, + int flags, + void *data); +XMLPUBFUN int XMLCALL xmlXIncludeProcessTree (xmlNodePtr tree); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXIncludeProcessTreeFlags(xmlNodePtr tree, int flags); /* diff --git a/gnulib-local/lib/libxml/xlink.c b/gnulib-local/lib/libxml/xlink.c index 0d9be73..c0e4ff3 100644 --- a/gnulib-local/lib/libxml/xlink.c +++ b/gnulib-local/lib/libxml/xlink.c @@ -47,7 +47,7 @@ * Default setting and related functions * * * ****************************************************************/ - + static xlinkHandlerPtr xlinkDefaultHandler = NULL; static xlinkNodeDetectFunc xlinkDefaultDetect = NULL; @@ -93,7 +93,7 @@ xlinkGetDefaultDetect (void) { * * Set the default xlink detection routine */ -void +void xlinkSetDefaultDetect (xlinkNodeDetectFunc func) { xlinkDefaultDetect = func; } @@ -104,7 +104,7 @@ xlinkSetDefaultDetect (xlinkNodeDetectFunc func) { * * ****************************************************************/ - + /** * xlinkIsLink: * @doc: the document containing the node @@ -119,7 +119,7 @@ xlinkSetDefaultDetect (xlinkNodeDetectFunc func) { * Returns the xlinkType of the node (XLINK_TYPE_NONE if there is no * link detected. */ -xlinkType +xlinkType xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) { xmlChar *type = NULL, *role = NULL; xlinkType ret = XLINK_TYPE_NONE; @@ -150,14 +150,14 @@ xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) { if (type != NULL) { if (xmlStrEqual(type, BAD_CAST "simple")) { ret = XLINK_TYPE_SIMPLE; - } if (xmlStrEqual(type, BAD_CAST "extended")) { + } else if (xmlStrEqual(type, BAD_CAST "extended")) { role = xmlGetNsProp(node, BAD_CAST "role", XLINK_NAMESPACE); if (role != NULL) { xmlNsPtr xlink; xlink = xmlSearchNs(doc, node, XLINK_NAMESPACE); if (xlink == NULL) { /* Humm, fallback method */ - if (xmlStrEqual(role, BAD_CAST"xlink:external-linkset")) + if (xmlStrEqual(role, BAD_CAST"xlink:external-linkset")) ret = XLINK_TYPE_EXTENDED_SET; } else { xmlChar buf[200]; diff --git a/gnulib-local/lib/libxml/xlink.in.h b/gnulib-local/lib/libxml/xlink.in.h index 083c7ed..a209a99 100644 --- a/gnulib-local/lib/libxml/xlink.in.h +++ b/gnulib-local/lib/libxml/xlink.in.h @@ -57,7 +57,7 @@ typedef enum { * xlinkNodeDetectFunc: * @ctx: user data pointer * @node: the node to check - * + * * This is the prototype for the link detection routine. * It calls the default link detection callbacks upon link detection. */ @@ -157,26 +157,26 @@ struct _xlinkHandler { /* * The default detection routine, can be overridden, they call the default - * detection callbacks. + * detection callbacks. */ -XMLPUBFUN xlinkNodeDetectFunc XMLCALL +XMLPUBFUN xlinkNodeDetectFunc XMLCALL xlinkGetDefaultDetect (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xlinkSetDefaultDetect (xlinkNodeDetectFunc func); /* * Routines to set/get the default handlers. */ -XMLPUBFUN xlinkHandlerPtr XMLCALL +XMLPUBFUN xlinkHandlerPtr XMLCALL xlinkGetDefaultHandler (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xlinkSetDefaultHandler (xlinkHandlerPtr handler); /* * Link detection module itself. */ -XMLPUBFUN xlinkType XMLCALL +XMLPUBFUN xlinkType XMLCALL xlinkIsLink (xmlDocPtr doc, xmlNodePtr node); diff --git a/gnulib-local/lib/libxml/xmlIO.c b/gnulib-local/lib/libxml/xmlIO.c index 90db848..8b13184 100644 --- a/gnulib-local/lib/libxml/xmlIO.c +++ b/gnulib-local/lib/libxml/xmlIO.c @@ -35,11 +35,18 @@ #ifdef HAVE_ZLIB_H #include #endif +#ifdef HAVE_LZMA_H +#include +#endif -#ifdef WIN32 +#if defined(WIN32) || defined(_WIN32) #include #endif +#if defined(_WIN32_WCE) +#include /* for CP_UTF8 */ +#endif + /* Figure a portable way to know if a file is a directory. */ #ifndef HAVE_STAT # ifdef HAVE__STAT @@ -89,6 +96,9 @@ #endif #include +#include "buf.h" +#include "enc.h" + /* #define VERBOSE_FAILURE */ /* #define DEBUG_EXTERNAL_ENTITIES */ /* #define DEBUG_INPUT */ @@ -131,11 +141,14 @@ typedef struct _xmlOutputCallback { static xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK]; static int xmlOutputCallbackNr = 0; static int xmlOutputCallbackInitialized = 0; + +xmlOutputBufferPtr +xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder); #endif /* LIBXML_OUTPUT_ENABLED */ /************************************************************************ * * - * Tree memory error handler * + * Tree memory error handler * * * ************************************************************************/ @@ -418,7 +431,7 @@ __xmlIOErr(int domain, int code, const char *extra) idx = 0; if (code >= XML_IO_UNKNOWN) idx = code - XML_IO_UNKNOWN; if (idx >= (sizeof(IOerr) / sizeof(IOerr[0]))) idx = 0; - + __xmlSimpleError(domain, code, NULL, IOerr[idx], extra); } @@ -470,12 +483,12 @@ __xmlLoaderErr(void *ctx, const char *msg, const char *filename) XML_IO_LOAD_ERROR, level, NULL, 0, filename, NULL, NULL, 0, 0, msg, filename); - + } /************************************************************************ * * - * Tree memory error handler * + * Tree memory error handler * * * ************************************************************************/ /** @@ -497,7 +510,7 @@ xmlNormalizeWindowsPath(const xmlChar *path) * xmlCleanupInputCallbacks: * * clears the entire input callback table. this includes the - * compiled-in I/O. + * compiled-in I/O. */ void xmlCleanupInputCallbacks(void) @@ -522,7 +535,7 @@ xmlCleanupInputCallbacks(void) * xmlPopInputCallbacks: * * Clear the top input callback from the input stack. this includes the - * compiled-in I/O. + * compiled-in I/O. * * Returns the number of input callback registered or -1 in case of error. */ @@ -534,7 +547,7 @@ xmlPopInputCallbacks(void) if (xmlInputCallbackNr <= 0) return(-1); - + xmlInputCallbackNr--; xmlInputCallbackTable[xmlInputCallbackNr].matchcallback = NULL; xmlInputCallbackTable[xmlInputCallbackNr].opencallback = NULL; @@ -549,7 +562,7 @@ xmlPopInputCallbacks(void) * xmlCleanupOutputCallbacks: * * clears the entire output callback table. this includes the - * compiled-in I/O callbacks. + * compiled-in I/O callbacks. */ void xmlCleanupOutputCallbacks(void) @@ -606,6 +619,34 @@ xmlWrapOpenUtf8(const char *path,int mode) return fd; } +#ifdef HAVE_ZLIB_H +static gzFile +xmlWrapGzOpenUtf8(const char *path, const char *mode) +{ + gzFile fd; + wchar_t *wPath; + + fd = gzopen (path, mode); + if (fd) + return fd; + + wPath = __xmlIOWin32UTF8ToWChar(path); + if(wPath) + { + int d, m = (strstr(mode, "r") ? O_RDONLY : O_RDWR); +#ifdef _O_BINARY + m |= (strstr(mode, "b") ? _O_BINARY : 0); +#endif + d = _wopen(wPath, m); + if (d >= 0) + fd = gzdopen(d, mode); + xmlFree(wPath); + } + + return fd; +} +#endif + /** * xmlWrapStatUtf8: * @path: the path in utf-8 encoding @@ -672,7 +713,10 @@ typedef int (* xmlWrapStatFunc) (const char *f, struct stat *s); static xmlWrapStatFunc xmlWrapStat = xmlWrapStatNative; typedef FILE* (* xmlWrapOpenFunc)(const char *f,int mode); static xmlWrapOpenFunc xmlWrapOpen = xmlWrapOpenNative; - +#ifdef HAVE_ZLIB_H +typedef gzFile (* xmlWrapGzOpenFunc) (const char *f, const char *mode); +static xmlWrapGzOpenFunc xmlWrapGzOpen = gzopen; +#endif /** * xmlInitPlatformSpecificIo: * @@ -692,9 +736,15 @@ xmlInitPlatformSpecificIo(void) if(GetVersionEx(&osvi) && (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)) { xmlWrapStat = xmlWrapStatUtf8; xmlWrapOpen = xmlWrapOpenUtf8; +#ifdef HAVE_ZLIB_H + xmlWrapGzOpen = xmlWrapGzOpenUtf8; +#endif } else { xmlWrapStat = xmlWrapStatNative; xmlWrapOpen = xmlWrapOpenNative; +#ifdef HAVE_ZLIB_H + xmlWrapGzOpen = gzopen; +#endif } xmlPlatformIoInitialized = 1; @@ -721,13 +771,21 @@ int xmlCheckFilename (const char *path) { #ifdef HAVE_STAT - struct stat stat_buffer; + struct stat stat_buffer; #endif - if (path == NULL) - return(0); + if (path == NULL) + return(0); #ifdef HAVE_STAT #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) + /* + * On Windows stat and wstat do not work with long pathname, + * which start with '\\?\' + */ + if ((path[0] == '\\') && (path[1] == '\\') && (path[2] == '?') && + (path[3] == '\\') ) + return 1; + if (xmlWrapStat(path, &stat_buffer) == -1) return 0; #else @@ -742,7 +800,14 @@ xmlCheckFilename (const char *path) return 1; } -static int +/** + * xmlNop: + * + * No Operation function, does nothing, no input + * + * Returns zero + */ +int xmlNop(void) { return(0); } @@ -829,7 +894,7 @@ xmlFileMatch (const char *filename ATTRIBUTE_UNUSED) { */ static void * xmlFileOpen_real (const char *filename) { - const char *path = NULL; + const char *path = filename; FILE *fd; if (filename == NULL) @@ -840,23 +905,27 @@ xmlFileOpen_real (const char *filename) { return((void *) fd); } - if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17)) + if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17)) { #if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) path = &filename[17]; #else path = &filename[16]; #endif - else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) { + } else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) { #if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) path = &filename[8]; #else path = &filename[7]; #endif - } else - path = filename; + } else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:/", 6)) { + /* lots of generators seems to lazy to read RFC 1738 */ +#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) + path = &filename[6]; +#else + path = &filename[5]; +#endif + } - if (path == NULL) - return(NULL); if (!xmlCheckFilename(path)) return(NULL); @@ -883,13 +952,15 @@ xmlFileOpen (const char *filename) { char *unescaped; void *retval; - unescaped = xmlURIUnescapeString(filename, 0, NULL); - if (unescaped != NULL) { - retval = xmlFileOpen_real(unescaped); - xmlFree(unescaped); - } else { - retval = xmlFileOpen_real(filename); + retval = xmlFileOpen_real(filename); + if (retval == NULL) { + unescaped = xmlURIUnescapeString(filename, 0, NULL); + if (unescaped != NULL) { + retval = xmlFileOpen_real(unescaped); + xmlFree(unescaped); + } } + return retval; } @@ -925,7 +996,7 @@ xmlFileOpenW (const char *filename) { #else path = &filename[7]; #endif - } else + } else path = filename; if (path == NULL) @@ -934,7 +1005,7 @@ xmlFileOpenW (const char *filename) { #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) fd = xmlWrapOpen(path, 1); #else - fd = fopen(path, "wb"); + fd = fopen(path, "wb"); #endif /* WIN32 */ if (fd == NULL) xmlIOErr(0, path); @@ -955,7 +1026,7 @@ xmlFileOpenW (const char *filename) { int xmlFileRead (void * context, char * buffer, int len) { int ret; - if ((context == NULL) || (buffer == NULL)) + if ((context == NULL) || (buffer == NULL)) return(-1); ret = fread(&buffer[0], 1, len, (FILE *) context); if (ret < 0) xmlIOErr(0, "fread()"); @@ -977,7 +1048,7 @@ static int xmlFileWrite (void * context, const char * buffer, int len) { int items; - if ((context == NULL) || (buffer == NULL)) + if ((context == NULL) || (buffer == NULL)) return(-1); items = fwrite(&buffer[0], len, 1, (FILE *) context); if ((items == 0) && (ferror((FILE *) context))) { @@ -1092,7 +1163,12 @@ xmlGzfileOpen_real (const char *filename) { gzFile fd; if (!strcmp(filename, "-")) { - fd = gzdopen(dup(0), "rb"); + int duped_fd = dup(fileno(stdin)); + fd = gzdopen(duped_fd, "rb"); + if (fd == Z_NULL && duped_fd >= 0) { + close(duped_fd); /* gzdOpen() does not close on failure */ + } + return((void *) fd); } @@ -1108,7 +1184,7 @@ xmlGzfileOpen_real (const char *filename) { #else path = &filename[7]; #endif - } else + } else path = filename; if (path == NULL) @@ -1116,7 +1192,11 @@ xmlGzfileOpen_real (const char *filename) { if (!xmlCheckFilename(path)) return(NULL); +#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) + fd = xmlWrapGzOpen(path, "rb"); +#else fd = gzopen(path, "rb"); +#endif return((void *) fd); } @@ -1162,7 +1242,12 @@ xmlGzfileOpenW (const char *filename, int compression) { snprintf(mode, sizeof(mode), "wb%d", compression); if (!strcmp(filename, "-")) { - fd = gzdopen(dup(1), mode); + int duped_fd = dup(fileno(stdout)); + fd = gzdopen(duped_fd, "rb"); + if (fd == Z_NULL && duped_fd >= 0) { + close(duped_fd); /* gzdOpen() does not close on failure */ + } + return((void *) fd); } @@ -1178,13 +1263,17 @@ xmlGzfileOpenW (const char *filename, int compression) { #else path = &filename[7]; #endif - } else + } else path = filename; if (path == NULL) return(NULL); +#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) + fd = xmlWrapGzOpen(path, mode); +#else fd = gzopen(path, mode); +#endif return((void *) fd); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -1245,6 +1334,125 @@ xmlGzfileClose (void * context) { } #endif /* HAVE_ZLIB_H */ +#ifdef LIBXML_LZMA_ENABLED +/************************************************************************ + * * + * I/O for compressed file accesses * + * * + ************************************************************************/ +#include "xzlib.h" +/** + * xmlXzfileMatch: + * @filename: the URI for matching + * + * input from compressed file test + * + * Returns 1 if matches, 0 otherwise + */ +static int +xmlXzfileMatch (const char *filename ATTRIBUTE_UNUSED) { + return(1); +} + +/** + * xmlXzFileOpen_real: + * @filename: the URI for matching + * + * input from compressed file open + * if @filename is " " then the standard input is used + * + * Returns an I/O context or NULL in case of error + */ +static void * +xmlXzfileOpen_real (const char *filename) { + const char *path = NULL; + xzFile fd; + + if (!strcmp(filename, "-")) { + fd = __libxml2_xzdopen(dup(fileno(stdin)), "rb"); + return((void *) fd); + } + + if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17)) { + path = &filename[16]; + } else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) { + path = &filename[7]; + } else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:/", 6)) { + /* lots of generators seems to lazy to read RFC 1738 */ + path = &filename[5]; + } else + path = filename; + + if (path == NULL) + return(NULL); + if (!xmlCheckFilename(path)) + return(NULL); + + fd = __libxml2_xzopen(path, "rb"); + return((void *) fd); +} + +/** + * xmlXzfileOpen: + * @filename: the URI for matching + * + * Wrapper around xmlXzfileOpen_real that try it with an unescaped + * version of @filename, if this fails fallback to @filename + * + * Returns a handler or NULL in case or failure + */ +static void * +xmlXzfileOpen (const char *filename) { + char *unescaped; + void *retval; + + retval = xmlXzfileOpen_real(filename); + if (retval == NULL) { + unescaped = xmlURIUnescapeString(filename, 0, NULL); + if (unescaped != NULL) { + retval = xmlXzfileOpen_real(unescaped); + } + xmlFree(unescaped); + } + + return retval; +} + +/** + * xmlXzfileRead: + * @context: the I/O context + * @buffer: where to drop data + * @len: number of bytes to write + * + * Read @len bytes to @buffer from the compressed I/O channel. + * + * Returns the number of bytes written + */ +static int +xmlXzfileRead (void * context, char * buffer, int len) { + int ret; + + ret = __libxml2_xzread((xzFile) context, &buffer[0], len); + if (ret < 0) xmlIOErr(0, "xzread()"); + return(ret); +} + +/** + * xmlXzfileClose: + * @context: the I/O context + * + * Close a compressed I/O channel + */ +static int +xmlXzfileClose (void * context) { + int ret; + + ret = (__libxml2_xzclose((xzFile) context) == LZMA_OK ) ? 0 : -1; + if (ret < 0) xmlIOErr(0, "xzclose()"); + return(ret); +} +#endif /* LIBXML_LZMA_ENABLED */ + #ifdef LIBXML_HTTP_ENABLED /************************************************************************ * * @@ -1306,7 +1514,7 @@ append_reverse_ulong( xmlZMemBuff * buff, unsigned long data ) { /* ** This is plagiarized from putLong in gzio.c (zlib source) where - ** the number "4" is hardcoded. If zlib is ever patched to + ** the number "4" is hardcoded. If zlib is ever patched to ** support 64 bit file sizes, this code would need to be patched ** as well. */ @@ -1358,7 +1566,7 @@ xmlFreeZMemBuff( xmlZMemBuffPtr buff ) { * * Create a memory buffer to hold the compressed XML document. The * compressed document in memory will end up being identical to what - * would be created if gzopen/gzwrite/gzclose were being used to + * would be created if gzopen/gzwrite/gzclose were being used to * write the document to disk. The code for the header/trailer data to * the compression is plagiarized from the zlib source files. */ @@ -1407,7 +1615,7 @@ xmlCreateZMemBuff( int compression ) { buff->crc = crc32( 0L, NULL, 0 ); hdr_lgth = snprintf( (char *)buff->zbuff, buff->size, "%c%c%c%c%c%c%c%c%c%c", - GZ_MAGIC1, GZ_MAGIC2, Z_DEFLATED, + GZ_MAGIC1, GZ_MAGIC2, Z_DEFLATED, 0, 0, 0, 0, 0, 0, LXML_ZLIB_OS_CODE ); buff->zctrl.next_out = buff->zbuff + hdr_lgth; buff->zctrl.avail_out = buff->size - hdr_lgth; @@ -1445,11 +1653,11 @@ xmlZMemBuffExtend( xmlZMemBuffPtr buff, size_t ext_amt ) { new_size = buff->size + ext_amt; #ifdef DEBUG_HTTP - if ( cur_used > new_size ) + if ( cur_used > new_size ) xmlGenericError( xmlGenericErrorContext, "xmlZMemBuffExtend: %s\n%s %d bytes.\n", "Buffer overwrite detected during compressed memory", - "buffer extension. Overflowed by", + "buffer extension. Overflowed by", (cur_used - new_size ) ); #endif @@ -1587,7 +1795,7 @@ xmlZMemBuffGetContent( xmlZMemBuffPtr buff, char ** data_ref ) { "Error flushing zlib buffers. Error code", z_err ); xmlIOErr(XML_IO_WRITE, (const char *) msg); } - + return ( zlgth ); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -1707,7 +1915,7 @@ xmlIOHTTPOpenW(const char *post_uri, int compression) { /* Any character conversions should have been done before this */ - ctxt->doc_buff = xmlAllocOutputBuffer(NULL); + ctxt->doc_buff = xmlAllocOutputBufferInternal(NULL); } if (ctxt->doc_buff == NULL) { @@ -1718,7 +1926,7 @@ xmlIOHTTPOpenW(const char *post_uri, int compression) return (ctxt); } #endif /* LIBXML_OUTPUT_ENABLED */ - + #ifdef LIBXML_OUTPUT_ENABLED /** * xmlIOHTTPDfltOpenW @@ -1746,7 +1954,7 @@ xmlIOHTTPDfltOpenW( const char * post_uri ) { * * Returns the number of bytes written */ -int +int xmlIOHTTPRead(void * context, char * buffer, int len) { if ((buffer == NULL) || (len < 0)) return(-1); return(xmlNanoHTTPRead(context, &buffer[0], len)); @@ -1766,7 +1974,7 @@ xmlIOHTTPRead(void * context, char * buffer, int len) { */ static int -xmlIOHTTPWrite( void * context, const char * buffer, int len ) { +xmlIOHTTPWrite( void * context, const char * buffer, int len ) { xmlIOHTTPWriteCtxtPtr ctxt = context; @@ -1778,7 +1986,7 @@ xmlIOHTTPWrite( void * context, const char * buffer, int len ) { /* Use gzwrite or fwrite as previously setup in the open call */ #ifdef HAVE_ZLIB_H - if ( ctxt->compression > 0 ) + if ( ctxt->compression > 0 ) len = xmlZMemBuffAppend( ctxt->doc_buff, buffer, len ); else @@ -1853,8 +2061,8 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) { /* Pull the data out of the memory output buffer */ xmlOutputBufferPtr dctxt = ctxt->doc_buff; - http_content = (char *)dctxt->buffer->content; - content_lgth = dctxt->buffer->use; + http_content = (char *) xmlBufContent(dctxt->buffer); + content_lgth = xmlBufUse(dctxt->buffer); } if ( http_content == NULL ) { @@ -1869,7 +2077,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) { else { http_ctxt = xmlNanoHTTPMethod( ctxt->uri, http_mthd, http_content, - &content_type, content_encoding, + &content_type, content_encoding, content_lgth ); if ( http_ctxt != NULL ) { @@ -1888,7 +2096,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) { /* ** Since either content or reply may be gzipped, - ** dump them to separate files instead of the + ** dump them to separate files instead of the ** standard error context. */ @@ -2025,7 +2233,7 @@ xmlIOFTPOpen (const char *filename) { * * Returns the number of bytes written */ -int +int xmlIOFTPRead(void * context, char * buffer, int len) { if ((buffer == NULL) || (len < 0)) return(-1); return(xmlNanoFTPRead(context, &buffer[0], len)); @@ -2088,7 +2296,7 @@ int xmlRegisterOutputCallbacks(xmlOutputMatchCallback matchFunc, xmlOutputOpenCallback openFunc, xmlOutputWriteCallback writeFunc, xmlOutputCloseCallback closeFunc) { - if (xmlOutputCallbackNr >= MAX_INPUT_CALLBACK) { + if (xmlOutputCallbackNr >= MAX_OUTPUT_CALLBACK) { return(-1); } xmlOutputCallbackTable[xmlOutputCallbackNr].matchcallback = matchFunc; @@ -2120,6 +2328,10 @@ xmlRegisterDefaultInputCallbacks(void) { xmlRegisterInputCallbacks(xmlGzfileMatch, xmlGzfileOpen, xmlGzfileRead, xmlGzfileClose); #endif /* HAVE_ZLIB_H */ +#ifdef LIBXML_LZMA_ENABLED + xmlRegisterInputCallbacks(xmlXzfileMatch, xmlXzfileOpen, + xmlXzfileRead, xmlXzfileClose); +#endif /* LIBXML_LZMA_ENABLED */ #ifdef LIBXML_HTTP_ENABLED xmlRegisterInputCallbacks(xmlIOHTTPMatch, xmlIOHTTPOpen, @@ -2217,15 +2429,15 @@ xmlAllocParserInputBuffer(xmlCharEncoding enc) { return(NULL); } memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer)); - ret->buffer = xmlBufferCreateSize(2 * xmlDefaultBufferSize); + ret->buffer = xmlBufCreateSize(2 * xmlDefaultBufferSize); if (ret->buffer == NULL) { xmlFree(ret); return(NULL); } - ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT; + xmlBufSetAllocationScheme(ret->buffer, XML_BUFFER_ALLOC_DOUBLEIT); ret->encoder = xmlGetCharEncodingHandler(enc); if (ret->encoder != NULL) - ret->raw = xmlBufferCreateSize(2 * xmlDefaultBufferSize); + ret->raw = xmlBufCreateSize(2 * xmlDefaultBufferSize); else ret->raw = NULL; ret->readcallback = NULL; @@ -2256,19 +2468,80 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) { return(NULL); } memset(ret, 0, (size_t) sizeof(xmlOutputBuffer)); - ret->buffer = xmlBufferCreate(); + ret->buffer = xmlBufCreate(); + if (ret->buffer == NULL) { + xmlFree(ret); + return(NULL); + } + + /* try to avoid a performance problem with Windows realloc() */ + if (xmlBufGetAllocationScheme(ret->buffer) == XML_BUFFER_ALLOC_EXACT) + xmlBufSetAllocationScheme(ret->buffer, XML_BUFFER_ALLOC_DOUBLEIT); + + ret->encoder = encoder; + if (encoder != NULL) { + ret->conv = xmlBufCreateSize(4000); + if (ret->conv == NULL) { + xmlFree(ret); + return(NULL); + } + + /* + * This call is designed to initiate the encoder state + */ + xmlCharEncOutput(ret, 1); + } else + ret->conv = NULL; + ret->writecallback = NULL; + ret->closecallback = NULL; + ret->context = NULL; + ret->written = 0; + + return(ret); +} + +/** + * xmlAllocOutputBufferInternal: + * @encoder: the encoding converter or NULL + * + * Create a buffered parser output + * + * Returns the new parser output or NULL + */ +xmlOutputBufferPtr +xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder) { + xmlOutputBufferPtr ret; + + ret = (xmlOutputBufferPtr) xmlMalloc(sizeof(xmlOutputBuffer)); + if (ret == NULL) { + xmlIOErrMemory("creating output buffer"); + return(NULL); + } + memset(ret, 0, (size_t) sizeof(xmlOutputBuffer)); + ret->buffer = xmlBufCreate(); if (ret->buffer == NULL) { xmlFree(ret); return(NULL); } - ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT; + + + /* + * For conversion buffers we use the special IO handling + */ + xmlBufSetAllocationScheme(ret->buffer, XML_BUFFER_ALLOC_IO); + ret->encoder = encoder; if (encoder != NULL) { - ret->conv = xmlBufferCreateSize(4000); + ret->conv = xmlBufCreateSize(4000); + if (ret->conv == NULL) { + xmlFree(ret); + return(NULL); + } + /* * This call is designed to initiate the encoder state */ - xmlCharEncOutFunc(encoder, ret->conv, NULL); + xmlCharEncOutput(ret, 1); } else ret->conv = NULL; ret->writecallback = NULL; @@ -2278,6 +2551,7 @@ xmlAllocOutputBuffer(xmlCharEncodingHandlerPtr encoder) { return(ret); } + #endif /* LIBXML_OUTPUT_ENABLED */ /** @@ -2291,7 +2565,7 @@ xmlFreeParserInputBuffer(xmlParserInputBufferPtr in) { if (in == NULL) return; if (in->raw) { - xmlBufferFree(in->raw); + xmlBufFree(in->raw); in->raw = NULL; } if (in->encoder != NULL) { @@ -2301,7 +2575,7 @@ xmlFreeParserInputBuffer(xmlParserInputBufferPtr in) { in->closecallback(in->context); } if (in->buffer != NULL) { - xmlBufferFree(in->buffer); + xmlBufFree(in->buffer); in->buffer = NULL; } @@ -2333,14 +2607,14 @@ xmlOutputBufferClose(xmlOutputBufferPtr out) } written = out->written; if (out->conv) { - xmlBufferFree(out->conv); + xmlBufFree(out->conv); out->conv = NULL; } if (out->encoder != NULL) { xmlCharEncCloseFunc(out->encoder); } if (out->buffer != NULL) { - xmlBufferFree(out->buffer); + xmlBufFree(out->buffer); out->buffer = NULL; } @@ -2392,6 +2666,9 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) { #ifdef HAVE_ZLIB_H if ((xmlInputCallbackTable[i].opencallback == xmlGzfileOpen) && (strcmp(URI, "-") != 0)) { +#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1230 + ret->compressed = !gzdirect(context); +#else if (((z_stream *)context)->avail_in > 4) { char *cptr, buff4[4]; cptr = (char *) ((z_stream *)context)->next_in; @@ -2403,6 +2680,13 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) { gzrewind(context); } } +#endif + } +#endif +#ifdef LIBXML_LZMA_ENABLED + if ((xmlInputCallbackTable[i].opencallback == xmlXzfileOpen) && + (strcmp(URI, "-") != 0)) { + ret->compressed = __libxml2_xzcompressed(context); } #endif } @@ -2478,7 +2762,7 @@ __xmlOutputBufferCreateFilename(const char *URI, if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) { context = xmlGzfileOpenW(unescaped, compression); if (context != NULL) { - ret = xmlAllocOutputBuffer(encoder); + ret = xmlAllocOutputBufferInternal(encoder); if (ret != NULL) { ret->context = context; ret->writecallback = xmlGzfileWrite; @@ -2515,7 +2799,7 @@ __xmlOutputBufferCreateFilename(const char *URI, if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) { context = xmlGzfileOpenW(URI, compression); if (context != NULL) { - ret = xmlAllocOutputBuffer(encoder); + ret = xmlAllocOutputBufferInternal(encoder); if (ret != NULL) { ret->context = context; ret->writecallback = xmlGzfileWrite; @@ -2548,7 +2832,7 @@ __xmlOutputBufferCreateFilename(const char *URI, /* * Allocate the Output buffer front-end. */ - ret = xmlAllocOutputBuffer(encoder); + ret = xmlAllocOutputBufferInternal(encoder); if (ret != NULL) { ret->context = context; ret->writecallback = xmlOutputCallbackTable[i].writecallback; @@ -2585,7 +2869,7 @@ xmlOutputBufferCreateFilename(const char *URI, /** * xmlParserInputBufferCreateFile: - * @file: a FILE* + * @file: a FILE* * @enc: the charset encoding if known * * Create a buffered parser input for the progressive parsing of a FILE * @@ -2615,7 +2899,7 @@ xmlParserInputBufferCreateFile(FILE *file, xmlCharEncoding enc) { #ifdef LIBXML_OUTPUT_ENABLED /** * xmlOutputBufferCreateFile: - * @file: a FILE* + * @file: a FILE* * @encoder: the encoding converter or NULL * * Create a buffered output for the progressive saving to a FILE * @@ -2632,7 +2916,7 @@ xmlOutputBufferCreateFile(FILE *file, xmlCharEncodingHandlerPtr encoder) { if (file == NULL) return(NULL); - ret = xmlAllocOutputBuffer(encoder); + ret = xmlAllocOutputBufferInternal(encoder); if (ret != NULL) { ret->context = file; ret->writecallback = xmlFileWrite; @@ -2666,6 +2950,39 @@ xmlOutputBufferCreateBuffer(xmlBufferPtr buffer, return(ret); } +/** + * xmlOutputBufferGetContent: + * @out: an xmlOutputBufferPtr + * + * Gives a pointer to the data currently held in the output buffer + * + * Returns a pointer to the data or NULL in case of error + */ +const xmlChar * +xmlOutputBufferGetContent(xmlOutputBufferPtr out) { + if ((out == NULL) || (out->buffer == NULL)) + return(NULL); + + return(xmlBufContent(out->buffer)); +} + +/** + * xmlOutputBufferGetSize: + * @out: an xmlOutputBufferPtr + * + * Gives the length of the data currently held in the output buffer + * + * Returns 0 in case or error or no data is held, the size otherwise + */ +size_t +xmlOutputBufferGetSize(xmlOutputBufferPtr out) { + if ((out == NULL) || (out->buffer == NULL)) + return(0); + + return(xmlBufUse(out->buffer)); +} + + #endif /* LIBXML_OUTPUT_ENABLED */ /** @@ -2718,7 +3035,7 @@ xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) { ret->context = (void *) mem; ret->readcallback = (xmlInputReadCallback) xmlNop; ret->closecallback = NULL; - errcode = xmlBufferAdd(ret->buffer, (const xmlChar *) mem, size); + errcode = xmlBufAdd(ret->buffer, (const xmlChar *) mem, size); if (errcode != 0) { xmlFree(ret); return(NULL); @@ -2755,14 +3072,14 @@ xmlParserInputBufferCreateStatic(const char *mem, int size, return(NULL); } memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer)); - ret->buffer = xmlBufferCreateStatic((void *)mem, (size_t) size); + ret->buffer = xmlBufCreateStatic((void *)mem, (size_t) size); if (ret->buffer == NULL) { xmlFree(ret); return(NULL); } ret->encoder = xmlGetCharEncodingHandler(enc); if (ret->encoder != NULL) - ret->raw = xmlBufferCreateSize(2 * xmlDefaultBufferSize); + ret->raw = xmlBufCreateSize(2 * xmlDefaultBufferSize); else ret->raw = NULL; ret->compressed = -1; @@ -2779,7 +3096,7 @@ xmlParserInputBufferCreateStatic(const char *mem, int size, * @fd: a file descriptor number * @encoder: the encoding converter or NULL * - * Create a buffered output for the progressive saving + * Create a buffered output for the progressive saving * to a file descriptor * * Returns the new parser output or NULL @@ -2790,7 +3107,7 @@ xmlOutputBufferCreateFd(int fd, xmlCharEncodingHandlerPtr encoder) { if (fd < 0) return(NULL); - ret = xmlAllocOutputBuffer(encoder); + ret = xmlAllocOutputBufferInternal(encoder); if (ret != NULL) { ret->context = (void *) (long) fd; ret->writecallback = xmlFdWrite; @@ -2851,7 +3168,7 @@ xmlOutputBufferCreateIO(xmlOutputWriteCallback iowrite, if (iowrite == NULL) return(NULL); - ret = xmlAllocOutputBuffer(encoder); + ret = xmlAllocOutputBufferInternal(encoder); if (ret != NULL) { ret->context = (void *) ioctx; ret->writecallback = iowrite; @@ -2931,33 +3248,33 @@ xmlParserInputBufferPush(xmlParserInputBufferPtr in, * Store the data in the incoming raw buffer */ if (in->raw == NULL) { - in->raw = xmlBufferCreate(); + in->raw = xmlBufCreate(); } - ret = xmlBufferAdd(in->raw, (const xmlChar *) buf, len); + ret = xmlBufAdd(in->raw, (const xmlChar *) buf, len); if (ret != 0) return(-1); /* * convert as much as possible to the parser reading buffer. */ - use = in->raw->use; - nbchars = xmlCharEncInFunc(in->encoder, in->buffer, in->raw); + use = xmlBufUse(in->raw); + nbchars = xmlCharEncInput(in, 1); if (nbchars < 0) { xmlIOErr(XML_IO_ENCODER, NULL); in->error = XML_IO_ENCODER; return(-1); } - in->rawconsumed += (use - in->raw->use); + in->rawconsumed += (use - xmlBufUse(in->raw)); } else { nbchars = len; - ret = xmlBufferAdd(in->buffer, (xmlChar *) buf, nbchars); + ret = xmlBufAdd(in->buffer, (xmlChar *) buf, nbchars); if (ret != 0) return(-1); } #ifdef DEBUG_INPUT xmlGenericError(xmlGenericErrorContext, "I/O: pushed %d chars, buffer %d/%d\n", - nbchars, in->buffer->use, in->buffer->size); + nbchars, xmlBufUse(in->buffer), xmlBufLength(in->buffer)); #endif return(nbchars); } @@ -2995,29 +3312,23 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) { char *buffer = NULL; int res = 0; int nbchars = 0; - int buffree; - unsigned int needSize; if ((in == NULL) || (in->error)) return(-1); if ((len <= MINLEN) && (len != 4)) len = MINLEN; - buffree = in->buffer->size - in->buffer->use; - if (buffree <= 0) { + if (xmlBufAvail(in->buffer) <= 0) { xmlIOErr(XML_IO_BUFFER_FULL, NULL); in->error = XML_IO_BUFFER_FULL; return(-1); } - needSize = in->buffer->use + len + 1; - if (needSize > in->buffer->size){ - if (!xmlBufferResize(in->buffer, needSize)){ - xmlIOErrMemory("growing input buffer"); - in->error = XML_ERR_NO_MEMORY; - return(-1); - } + if (xmlBufGrow(in->buffer, len + 1) < 0) { + xmlIOErrMemory("growing input buffer"); + in->error = XML_ERR_NO_MEMORY; + return(-1); } - buffer = (char *)&in->buffer->content[in->buffer->use]; + buffer = (char *)xmlBufEnd(in->buffer); /* * Call the read method for this I/O type. @@ -3034,6 +3345,17 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) { if (res < 0) { return(-1); } + + /* + * try to establish compressed status of input if not done already + */ + if (in->compressed == -1) { +#ifdef LIBXML_LZMA_ENABLED + if (in->readcallback == xmlXzfileRead) + in->compressed = __libxml2_xzcompressed(in->context); +#endif + } + len = res; if (in->encoder != NULL) { unsigned int use; @@ -3042,32 +3364,31 @@ xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) { * Store the data in the incoming raw buffer */ if (in->raw == NULL) { - in->raw = xmlBufferCreate(); + in->raw = xmlBufCreate(); } - res = xmlBufferAdd(in->raw, (const xmlChar *) buffer, len); + res = xmlBufAdd(in->raw, (const xmlChar *) buffer, len); if (res != 0) return(-1); /* * convert as much as possible to the parser reading buffer. */ - use = in->raw->use; - nbchars = xmlCharEncInFunc(in->encoder, in->buffer, in->raw); + use = xmlBufUse(in->raw); + nbchars = xmlCharEncInput(in, 1); if (nbchars < 0) { xmlIOErr(XML_IO_ENCODER, NULL); in->error = XML_IO_ENCODER; return(-1); } - in->rawconsumed += (use - in->raw->use); + in->rawconsumed += (use - xmlBufUse(in->raw)); } else { nbchars = len; - in->buffer->use += nbchars; - buffer[nbchars] = 0; + xmlBufAddLen(in->buffer, nbchars); } #ifdef DEBUG_INPUT xmlGenericError(xmlGenericErrorContext, - "I/O: read %d chars, buffer %d/%d\n", - nbchars, in->buffer->use, in->buffer->size); + "I/O: read %d chars, buffer %d\n", + nbchars, xmlBufUse(in->buffer)); #endif return(nbchars); } @@ -3089,8 +3410,7 @@ xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len) { if ((in == NULL) || (in->error)) return(-1); if (in->readcallback != NULL) return(xmlParserInputBufferGrow(in, len)); - else if ((in->buffer != NULL) && - (in->buffer->alloc == XML_BUFFER_ALLOC_IMMUTABLE)) + else if (xmlBufGetAllocationScheme(in->buffer) == XML_BUFFER_ALLOC_IMMUTABLE) return(0); else return(-1); @@ -3135,30 +3455,30 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) { * Store the data in the incoming raw buffer */ if (out->conv == NULL) { - out->conv = xmlBufferCreate(); + out->conv = xmlBufCreate(); } - ret = xmlBufferAdd(out->buffer, (const xmlChar *) buf, chunk); + ret = xmlBufAdd(out->buffer, (const xmlChar *) buf, chunk); if (ret != 0) return(-1); - if ((out->buffer->use < MINLEN) && (chunk == len)) + if ((xmlBufUse(out->buffer) < MINLEN) && (chunk == len)) goto done; /* * convert as much as possible to the parser reading buffer. */ - ret = xmlCharEncOutFunc(out->encoder, out->conv, out->buffer); + ret = xmlCharEncOutput(out, 0); if ((ret < 0) && (ret != -3)) { xmlIOErr(XML_IO_ENCODER, NULL); out->error = XML_IO_ENCODER; return(-1); } - nbchars = out->conv->use; + nbchars = xmlBufUse(out->conv); } else { - ret = xmlBufferAdd(out->buffer, (const xmlChar *) buf, chunk); + ret = xmlBufAdd(out->buffer, (const xmlChar *) buf, chunk); if (ret != 0) return(-1); - nbchars = out->buffer->use; + nbchars = xmlBufUse(out->buffer); } buf += chunk; len -= chunk; @@ -3171,15 +3491,15 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) { * second write the stuff to the I/O channel */ if (out->encoder != NULL) { - ret = out->writecallback(out->context, - (const char *)out->conv->content, nbchars); + ret = out->writecallback(out->context, + (const char *)xmlBufContent(out->conv), nbchars); if (ret >= 0) - xmlBufferShrink(out->conv, ret); + xmlBufShrink(out->conv, ret); } else { - ret = out->writecallback(out->context, - (const char *)out->buffer->content, nbchars); + ret = out->writecallback(out->context, + (const char *)xmlBufContent(out->buffer), nbchars); if (ret >= 0) - xmlBufferShrink(out->buffer, ret); + xmlBufShrink(out->buffer, ret); } if (ret < 0) { xmlIOErr(XML_IO_WRITE, NULL); @@ -3221,9 +3541,9 @@ xmlEscapeContent(unsigned char* out, int *outlen, const unsigned char* inend; inend = in + (*inlen); - + while ((in < inend) && (out < outend)) { - if (*in == '<') { + if (*in == '<') { if (outend - out < 4) break; *out++ = '&'; *out++ = 'l'; @@ -3253,7 +3573,7 @@ xmlEscapeContent(unsigned char* out, int *outlen, *out++ = (unsigned char) *in; } ++in; - } + } *outlen = out - outstart; *inlen = in - base; return(0); @@ -3287,7 +3607,8 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, if ((out == NULL) || (out->error) || (str == NULL) || (out->buffer == NULL) || - (out->buffer->alloc == XML_BUFFER_ALLOC_IMMUTABLE)) return(-1); + (xmlBufGetAllocationScheme(out->buffer) == XML_BUFFER_ALLOC_IMMUTABLE)) + return(-1); len = strlen((const char *)str); if (len < 0) return(0); if (out->error) return(-1); @@ -3300,7 +3621,18 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, * how many bytes to consume and how many bytes to store. */ cons = len; - chunk = (out->buffer->size - out->buffer->use) - 1; + chunk = xmlBufAvail(out->buffer) - 1; + + /* + * make sure we have enough room to save first, if this is + * not the case force a flush, but make sure we stay in the loop + */ + if (chunk < 40) { + if (xmlBufGrow(out->buffer, 100) < 0) + return(-1); + oldwritten = -1; + continue; + } /* * first handle encoding stuff. @@ -3310,36 +3642,33 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, * Store the data in the incoming raw buffer */ if (out->conv == NULL) { - out->conv = xmlBufferCreate(); + out->conv = xmlBufCreate(); } - ret = escaping(out->buffer->content + out->buffer->use , + ret = escaping(xmlBufEnd(out->buffer) , &chunk, str, &cons); if ((ret < 0) || (chunk == 0)) /* chunk==0 => nothing done */ return(-1); - out->buffer->use += chunk; - out->buffer->content[out->buffer->use] = 0; + xmlBufAddLen(out->buffer, chunk); - if ((out->buffer->use < MINLEN) && (cons == len)) + if ((xmlBufUse(out->buffer) < MINLEN) && (cons == len)) goto done; /* * convert as much as possible to the output buffer. */ - ret = xmlCharEncOutFunc(out->encoder, out->conv, out->buffer); + ret = xmlCharEncOutput(out, 0); if ((ret < 0) && (ret != -3)) { xmlIOErr(XML_IO_ENCODER, NULL); out->error = XML_IO_ENCODER; return(-1); } - nbchars = out->conv->use; + nbchars = xmlBufUse(out->conv); } else { - ret = escaping(out->buffer->content + out->buffer->use , - &chunk, str, &cons); + ret = escaping(xmlBufEnd(out->buffer), &chunk, str, &cons); if ((ret < 0) || (chunk == 0)) /* chunk==0 => nothing done */ return(-1); - out->buffer->use += chunk; - out->buffer->content[out->buffer->use] = 0; - nbchars = out->buffer->use; + xmlBufAddLen(out->buffer, chunk); + nbchars = xmlBufUse(out->buffer); } str += cons; len -= cons; @@ -3352,15 +3681,15 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, * second write the stuff to the I/O channel */ if (out->encoder != NULL) { - ret = out->writecallback(out->context, - (const char *)out->conv->content, nbchars); + ret = out->writecallback(out->context, + (const char *)xmlBufContent(out->conv), nbchars); if (ret >= 0) - xmlBufferShrink(out->conv, ret); + xmlBufShrink(out->conv, ret); } else { - ret = out->writecallback(out->context, - (const char *)out->buffer->content, nbchars); + ret = out->writecallback(out->context, + (const char *)xmlBufContent(out->buffer), nbchars); if (ret >= 0) - xmlBufferShrink(out->buffer, ret); + xmlBufShrink(out->buffer, ret); } if (ret < 0) { xmlIOErr(XML_IO_WRITE, NULL); @@ -3368,8 +3697,8 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, return(ret); } out->written += ret; - } else if (out->buffer->size - out->buffer->use < MINLEN) { - xmlBufferResize(out->buffer, out->buffer->size + MINLEN); + } else if (xmlBufAvail(out->buffer) < MINLEN) { + xmlBufGrow(out->buffer, MINLEN); } written += nbchars; } while ((len > 0) && (oldwritten != written)); @@ -3398,7 +3727,7 @@ done: int xmlOutputBufferWriteString(xmlOutputBufferPtr out, const char *str) { int len; - + if ((out == NULL) || (out->error)) return(-1); if (str == NULL) return(-1); @@ -3427,14 +3756,16 @@ xmlOutputBufferFlush(xmlOutputBufferPtr out) { */ if ((out->conv != NULL) && (out->encoder != NULL)) { /* - * convert as much as possible to the parser reading buffer. + * convert as much as possible to the parser output buffer. */ - nbchars = xmlCharEncOutFunc(out->encoder, out->conv, out->buffer); - if (nbchars < 0) { - xmlIOErr(XML_IO_ENCODER, NULL); - out->error = XML_IO_ENCODER; - return(-1); - } + do { + nbchars = xmlCharEncOutput(out, 0); + if (nbchars < 0) { + xmlIOErr(XML_IO_ENCODER, NULL); + out->error = XML_IO_ENCODER; + return(-1); + } + } while (nbchars); } /* @@ -3443,14 +3774,16 @@ xmlOutputBufferFlush(xmlOutputBufferPtr out) { if ((out->conv != NULL) && (out->encoder != NULL) && (out->writecallback != NULL)) { ret = out->writecallback(out->context, - (const char *)out->conv->content, out->conv->use); + (const char *)xmlBufContent(out->conv), + xmlBufUse(out->conv)); if (ret >= 0) - xmlBufferShrink(out->conv, ret); + xmlBufShrink(out->conv, ret); } else if (out->writecallback != NULL) { ret = out->writecallback(out->context, - (const char *)out->buffer->content, out->buffer->use); + (const char *)xmlBufContent(out->buffer), + xmlBufUse(out->buffer)); if (ret >= 0) - xmlBufferShrink(out->buffer, ret); + xmlBufShrink(out->buffer, ret); } if (ret < 0) { xmlIOErr(XML_IO_FLUSH, NULL); @@ -3480,7 +3813,6 @@ xmlParserGetDirectory(const char *filename) { char *ret = NULL; char dir[1024]; char *cur; - char sep = '/'; #ifdef _WIN32_WCE /* easy way by now ... wince does not have dirs! */ return NULL; @@ -3490,18 +3822,21 @@ xmlParserGetDirectory(const char *filename) { xmlRegisterDefaultInputCallbacks(); if (filename == NULL) return(NULL); + #if defined(WIN32) && !defined(__CYGWIN__) - sep = '\\'; +# define IS_XMLPGD_SEP(ch) ((ch=='/')||(ch=='\\')) +#else +# define IS_XMLPGD_SEP(ch) (ch=='/') #endif strncpy(dir, filename, 1023); dir[1023] = 0; cur = &dir[strlen(dir)]; while (cur > dir) { - if (*cur == sep) break; + if (IS_XMLPGD_SEP(*cur)) break; cur --; } - if (*cur == sep) { + if (IS_XMLPGD_SEP(*cur)) { if (cur == dir) dir[1] = 0; else *cur = 0; ret = xmlMemStrdup(dir); @@ -3512,6 +3847,7 @@ xmlParserGetDirectory(const char *filename) { } } return(ret); +#undef IS_XMLPGD_SEP } /**************************************************************** @@ -3612,9 +3948,9 @@ static int xmlNoNetExists(const char *URL) { #else path = &URL[7]; #endif - } else + } else path = URL; - + return xmlCheckFilename(path); } @@ -3632,7 +3968,7 @@ static int xmlNoNetExists(const char *URL) { * * Returns a new allocated URL, or NULL. */ -xmlChar * +static xmlChar * xmlResolveResourceFromCatalog(const char *URL, const char *ID, xmlParserCtxtPtr ctxt) { xmlChar *resource = NULL; @@ -3802,9 +4138,9 @@ xmlLoadExternalEntity(const char *URL, const char *ID, } /************************************************************************ - * * - * Disabling Network access * - * * + * * + * Disabling Network access * + * * ************************************************************************/ /** diff --git a/gnulib-local/lib/libxml/xmlIO.in.h b/gnulib-local/lib/libxml/xmlIO.in.h index eea9ed6..3e41744 100644 --- a/gnulib-local/lib/libxml/xmlIO.in.h +++ b/gnulib-local/lib/libxml/xmlIO.in.h @@ -26,7 +26,7 @@ extern "C" { * xmlInputMatchCallback: * @filename: the filename or URI * - * Callback used in the I/O Input API to detect if the current handler + * Callback used in the I/O Input API to detect if the current handler * can provide input fonctionnalities for this resource. * * Returns 1 if yes and 0 if another Input module should be used @@ -72,7 +72,7 @@ typedef int (XMLCALL *xmlInputCloseCallback) (void * context); * xmlOutputMatchCallback: * @filename: the filename or URI * - * Callback used in the I/O Output API to detect if the current handler + * Callback used in the I/O Output API to detect if the current handler * can provide output fonctionnalities for this resource. * * Returns 1 if yes and 0 if another Output module should be used @@ -126,11 +126,11 @@ struct _xmlParserInputBuffer { void* context; xmlInputReadCallback readcallback; xmlInputCloseCallback closecallback; - + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ - - xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */ - xmlBufferPtr raw; /* if encoder != NULL buffer for raw input */ + + xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */ + xmlBufPtr raw; /* if encoder != NULL buffer for raw input */ int compressed; /* -1=unknown, 0=not compressed, 1=compressed */ int error; unsigned long rawconsumed;/* amount consumed from raw */ @@ -142,11 +142,11 @@ struct _xmlOutputBuffer { void* context; xmlOutputWriteCallback writecallback; xmlOutputCloseCallback closecallback; - + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ - - xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ - xmlBufferPtr conv; /* if encoder != NULL buffer for output */ + + xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ + xmlBufPtr conv; /* if encoder != NULL buffer for output */ int written; /* total number of byte written */ int error; }; @@ -155,13 +155,13 @@ struct _xmlOutputBuffer { /* * Interfaces for input */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupInputCallbacks (void); XMLPUBFUN int XMLCALL xmlPopInputCallbacks (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRegisterDefaultInputCallbacks (void); XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlAllocParserInputBuffer (xmlCharEncoding enc); @@ -186,22 +186,22 @@ XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParserInputBufferRead (xmlParserInputBufferPtr in, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParserInputBufferGrow (xmlParserInputBufferPtr in, int len); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlParserInputBufferPush (xmlParserInputBufferPtr in, int len, const char *buf); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); -XMLPUBFUN char * XMLCALL +XMLPUBFUN char * XMLCALL xmlParserGetDirectory (const char *filename); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc, xmlInputOpenCallback openFunc, xmlInputReadCallback readFunc, @@ -209,15 +209,15 @@ XMLPUBFUN int XMLCALL xmlParserInputBufferPtr __xmlParserInputBufferCreateFilename(const char *URI, - xmlCharEncoding enc); + xmlCharEncoding enc); #ifdef LIBXML_OUTPUT_ENABLED /* * Interfaces for output */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupOutputCallbacks (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRegisterDefaultOutputCallbacks(void); XMLPUBFUN xmlOutputBufferPtr XMLCALL xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); @@ -245,24 +245,30 @@ XMLPUBFUN xmlOutputBufferPtr XMLCALL void *ioctx, xmlCharEncodingHandlerPtr encoder); -XMLPUBFUN int XMLCALL +/* Couple of APIs to get the output without digging into the buffers */ +XMLPUBFUN const xmlChar * XMLCALL + xmlOutputBufferGetContent (xmlOutputBufferPtr out); +XMLPUBFUN size_t XMLCALL + xmlOutputBufferGetSize (xmlOutputBufferPtr out); + +XMLPUBFUN int XMLCALL xmlOutputBufferWrite (xmlOutputBufferPtr out, int len, const char *buf); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlOutputBufferWriteString (xmlOutputBufferPtr out, const char *str); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlOutputBufferWriteEscape (xmlOutputBufferPtr out, const xmlChar *str, xmlCharEncodingOutputFunc escaping); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlOutputBufferFlush (xmlOutputBufferPtr out); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlOutputBufferClose (xmlOutputBufferPtr out); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc, xmlOutputOpenCallback openFunc, xmlOutputWriteCallback writeFunc, @@ -275,10 +281,10 @@ xmlOutputBufferPtr #ifdef LIBXML_HTTP_ENABLED /* This function only exists if HTTP support built into the library */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRegisterHTTPPostCallbacks (void ); #endif /* LIBXML_HTTP_ENABLED */ - + #endif /* LIBXML_OUTPUT_ENABLED */ XMLPUBFUN xmlParserInputPtr XMLCALL @@ -288,69 +294,69 @@ XMLPUBFUN xmlParserInputPtr XMLCALL /* * A predefined entity loader disabling network accesses */ -XMLPUBFUN xmlParserInputPtr XMLCALL +XMLPUBFUN xmlParserInputPtr XMLCALL xmlNoNetExternalEntityLoader (const char *URL, const char *ID, xmlParserCtxtPtr ctxt); -/* - * xmlNormalizeWindowsPath is obsolete, don't use it. +/* + * xmlNormalizeWindowsPath is obsolete, don't use it. * Check xmlCanonicPath in uri.h for a better alternative. */ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlNormalizeWindowsPath (const xmlChar *path); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlCheckFilename (const char *path); /** - * Default 'file://' protocol callbacks + * Default 'file://' protocol callbacks */ -XMLPUBFUN int XMLCALL - xmlFileMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlFileOpen (const char *filename); -XMLPUBFUN int XMLCALL - xmlFileRead (void * context, - char * buffer, +XMLPUBFUN int XMLCALL + xmlFileMatch (const char *filename); +XMLPUBFUN void * XMLCALL + xmlFileOpen (const char *filename); +XMLPUBFUN int XMLCALL + xmlFileRead (void * context, + char * buffer, int len); -XMLPUBFUN int XMLCALL - xmlFileClose (void * context); +XMLPUBFUN int XMLCALL + xmlFileClose (void * context); /** - * Default 'http://' protocol callbacks + * Default 'http://' protocol callbacks */ #ifdef LIBXML_HTTP_ENABLED -XMLPUBFUN int XMLCALL - xmlIOHTTPMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlIOHTTPOpen (const char *filename); +XMLPUBFUN int XMLCALL + xmlIOHTTPMatch (const char *filename); +XMLPUBFUN void * XMLCALL + xmlIOHTTPOpen (const char *filename); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL xmlIOHTTPOpenW (const char * post_uri, int compression ); #endif /* LIBXML_OUTPUT_ENABLED */ -XMLPUBFUN int XMLCALL - xmlIOHTTPRead (void * context, - char * buffer, +XMLPUBFUN int XMLCALL + xmlIOHTTPRead (void * context, + char * buffer, int len); -XMLPUBFUN int XMLCALL - xmlIOHTTPClose (void * context); +XMLPUBFUN int XMLCALL + xmlIOHTTPClose (void * context); #endif /* LIBXML_HTTP_ENABLED */ /** - * Default 'ftp://' protocol callbacks + * Default 'ftp://' protocol callbacks */ -#ifdef LIBXML_FTP_ENABLED -XMLPUBFUN int XMLCALL - xmlIOFTPMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlIOFTPOpen (const char *filename); -XMLPUBFUN int XMLCALL - xmlIOFTPRead (void * context, - char * buffer, +#ifdef LIBXML_FTP_ENABLED +XMLPUBFUN int XMLCALL + xmlIOFTPMatch (const char *filename); +XMLPUBFUN void * XMLCALL + xmlIOFTPOpen (const char *filename); +XMLPUBFUN int XMLCALL + xmlIOFTPRead (void * context, + char * buffer, int len); -XMLPUBFUN int XMLCALL - xmlIOFTPClose (void * context); +XMLPUBFUN int XMLCALL + xmlIOFTPClose (void * context); #endif /* LIBXML_FTP_ENABLED */ #ifdef __cplusplus diff --git a/gnulib-local/lib/libxml/xmlautomata.in.h b/gnulib-local/lib/libxml/xmlautomata.in.h index f98b55e..bf1b131 100644 --- a/gnulib-local/lib/libxml/xmlautomata.in.h +++ b/gnulib-local/lib/libxml/xmlautomata.in.h @@ -40,25 +40,25 @@ typedef xmlAutomataState *xmlAutomataStatePtr; /* * Building API */ -XMLPUBFUN xmlAutomataPtr XMLCALL +XMLPUBFUN xmlAutomataPtr XMLCALL xmlNewAutomata (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlFreeAutomata (xmlAutomataPtr am); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataGetInitState (xmlAutomataPtr am); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlAutomataSetFinalState (xmlAutomataPtr am, xmlAutomataStatePtr state); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewState (xmlAutomataPtr am); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewTransition (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, const xmlChar *token, void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewTransition2 (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, @@ -73,7 +73,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL const xmlChar *token2, void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCountTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, @@ -81,7 +81,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL int min, int max, void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCountTrans2 (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, @@ -90,7 +90,7 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL int min, int max, void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewOnceTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, @@ -99,46 +99,46 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL int max, void *data); XMLPUBFUN xmlAutomataStatePtr XMLCALL - xmlAutomataNewOnceTrans2 (xmlAutomataPtr am, + xmlAutomataNewOnceTrans2 (xmlAutomataPtr am, xmlAutomataStatePtr from, - xmlAutomataStatePtr to, + xmlAutomataStatePtr to, const xmlChar *token, const xmlChar *token2, - int min, - int max, + int min, + int max, void *data); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewAllTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, int lax); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewEpsilon (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCountedTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, int counter); -XMLPUBFUN xmlAutomataStatePtr XMLCALL +XMLPUBFUN xmlAutomataStatePtr XMLCALL xmlAutomataNewCounterTrans (xmlAutomataPtr am, xmlAutomataStatePtr from, xmlAutomataStatePtr to, int counter); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlAutomataNewCounter (xmlAutomataPtr am, int min, int max); -XMLPUBFUN xmlRegexpPtr XMLCALL +XMLPUBFUN xmlRegexpPtr XMLCALL xmlAutomataCompile (xmlAutomataPtr am); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlAutomataIsDeterminist (xmlAutomataPtr am); #ifdef __cplusplus } -#endif +#endif #endif /* LIBXML_AUTOMATA_ENABLED */ #endif /* LIBXML_REGEXP_ENABLED */ diff --git a/gnulib-local/lib/libxml/xmlerror.in.h b/gnulib-local/lib/libxml/xmlerror.in.h index c5f2164..43e68ca 100644 --- a/gnulib-local/lib/libxml/xmlerror.in.h +++ b/gnulib-local/lib/libxml/xmlerror.in.h @@ -61,7 +61,10 @@ typedef enum { XML_FROM_CHECK, /* The error checking module */ XML_FROM_WRITER, /* The xmlwriter module */ XML_FROM_MODULE, /* The dynamically loaded module module*/ - XML_FROM_I18N /* The module handling character conversion */ + XML_FROM_I18N, /* The module handling character conversion */ + XML_FROM_SCHEMATRONV,/* The Schematron validator module */ + XML_FROM_BUFFER, /* The buffers module */ + XML_FROM_URI /* The URI module */ } xmlErrorDomain; /** @@ -83,7 +86,7 @@ struct _xmlError { char *str2; /* extra string information */ char *str3; /* extra string information */ int int1; /* extra number information */ - int int2; /* column number of the error or 0 if N/A (todo: rename this field when we would break ABI) */ + int int2; /* error column # or 0 if N/A (todo: rename field when we would brk ABI) */ void *ctxt; /* the parser context if available */ void *node; /* the node in the tree */ }; @@ -202,11 +205,16 @@ typedef enum { XML_ERR_NOTATION_PROCESSING, /* 105 */ XML_WAR_NS_COLUMN, /* 106 */ XML_WAR_ENTITY_REDEFINED, /* 107 */ + XML_ERR_UNKNOWN_VERSION, /* 108 */ + XML_ERR_VERSION_MISMATCH, /* 109 */ + XML_ERR_NAME_TOO_LONG, /* 110 */ + XML_ERR_USER_STOP, /* 111 */ XML_NS_ERR_XML_NAMESPACE = 200, XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */ XML_NS_ERR_QNAME, /* 202 */ XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */ XML_NS_ERR_EMPTY, /* 204 */ + XML_NS_ERR_COLON, /* 205 */ XML_DTD_ATTRIBUTE_DEFAULT = 500, XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */ XML_DTD_ATTRIBUTE_VALUE, /* 502 */ @@ -248,6 +256,7 @@ typedef enum { XML_DTD_STANDALONE_DEFAULTED, /* 538 */ XML_DTD_XMLID_VALUE, /* 539 */ XML_DTD_XMLID_TYPE, /* 540 */ + XML_DTD_DUP_TOKEN, /* 541 */ XML_HTML_STRUCURE_ERROR = 800, XML_HTML_UNKNOWN_TAG, /* 801 */ XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000, @@ -398,6 +407,7 @@ typedef enum { XML_TREE_INVALID_HEX = 1300, XML_TREE_INVALID_DEC, /* 1301 */ XML_TREE_UNTERMINATED_ENTITY, /* 1302 */ + XML_TREE_NOT_UTF8, /* 1303 */ XML_SAVE_NOT_UTF8 = 1400, XML_SAVE_CHAR_INVALID, /* 1401 */ XML_SAVE_NO_DOCTYPE, /* 1402 */ @@ -639,7 +649,7 @@ typedef enum { XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */ XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */ XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */ - XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */ + XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */ XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */ XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */ XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */ @@ -664,7 +674,7 @@ typedef enum { XML_SCHEMAV_CVC_IDC, /* 1877 */ XML_SCHEMAV_CVC_WILDCARD, /* 1878 */ XML_SCHEMAV_MISC, /* 1879 */ - XML_XPTR_UNKNOWN_SCHEME = 1900, + XML_XPTR_UNKNOWN_SCHEME = 1900, XML_XPTR_CHILDSEQ_START, /* 1901 */ XML_XPTR_EVAL_FAILED, /* 1902 */ XML_XPTR_EXTRA_OBJECTS, /* 1903 */ @@ -685,15 +695,15 @@ typedef enum { XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */ XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */ XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */ - XML_SCHEMAP_SRC_RESOLVE, /* 3004 */ + XML_SCHEMAP_SRC_RESOLVE, /* 3004 */ XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */ XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */ XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */ XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */ XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */ - XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */ + XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */ XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */ + XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */ XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */ XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */ XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */ @@ -712,7 +722,7 @@ typedef enum { XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */ XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */ XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */ - XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */ + XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */ XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */ XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */ XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */ @@ -731,14 +741,14 @@ typedef enum { XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */ XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */ XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */ - XML_SCHEMAP_SRC_INCLUDE, /* 3050 */ + XML_SCHEMAP_SRC_INCLUDE, /* 3050 */ XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */ XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */ XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */ XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */ XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */ XML_SCHEMAP_NO_XMLNS, /* 3056 */ - XML_SCHEMAP_NO_XSI, /* 3057 */ + XML_SCHEMAP_NO_XSI, /* 3057 */ XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */ XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */ XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */ @@ -773,6 +783,8 @@ typedef enum { XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */ XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */ XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */ + XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */ + XML_SCHEMATRONV_REPORT, XML_MODULE_OPEN = 4900, /* 4900 */ XML_MODULE_CLOSE, /* 4901 */ XML_CHECK_FOUND_ELEMENT = 5000, @@ -817,11 +829,8 @@ typedef enum { XML_I18N_NO_HANDLER, /* 6001 */ XML_I18N_EXCESS_HANDLER, /* 6002 */ XML_I18N_CONV_FAILED, /* 6003 */ - XML_I18N_NO_OUTPUT /* 6004 */ -#if 0 - XML_CHECK_, /* 5033 */ - XML_CHECK_X /* 503 */ -#endif + XML_I18N_NO_OUTPUT, /* 6004 */ + XML_BUF_OVERFLOW = 7000 } xmlParserErrors; /** @@ -835,7 +844,7 @@ typedef enum { */ typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx, const char *msg, - ...); + ...) LIBXML_ATTR_FORMAT(2,3); /** * xmlStructuredErrorFunc: * @userData: user provided data for the error callback @@ -850,38 +859,38 @@ typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr erro * Use the following function to reset the two global variables * xmlGenericError and xmlGenericErrorContext. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetGenericErrorFunc (void *ctx, xmlGenericErrorFunc handler); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSetStructuredErrorFunc (void *ctx, xmlStructuredErrorFunc handler); /* * Default message routines used by SAX and Valid context for error * and warning reporting. */ -XMLPUBFUN void XMLCDECL +XMLPUBFUN void XMLCDECL xmlParserError (void *ctx, const char *msg, - ...); -XMLPUBFUN void XMLCDECL + ...) LIBXML_ATTR_FORMAT(2,3); +XMLPUBFUN void XMLCDECL xmlParserWarning (void *ctx, const char *msg, - ...); -XMLPUBFUN void XMLCDECL + ...) LIBXML_ATTR_FORMAT(2,3); +XMLPUBFUN void XMLCDECL xmlParserValidityError (void *ctx, const char *msg, - ...); -XMLPUBFUN void XMLCDECL + ...) LIBXML_ATTR_FORMAT(2,3); +XMLPUBFUN void XMLCDECL xmlParserValidityWarning (void *ctx, const char *msg, - ...); -XMLPUBFUN void XMLCALL + ...) LIBXML_ATTR_FORMAT(2,3); +XMLPUBFUN void XMLCALL xmlParserPrintFileInfo (xmlParserInputPtr input); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlParserPrintFileContext (xmlParserInputPtr input); /* @@ -899,19 +908,19 @@ XMLPUBFUN void XMLCALL xmlResetError (xmlErrorPtr err); XMLPUBFUN int XMLCALL xmlCopyError (xmlErrorPtr from, - xmlErrorPtr to); + xmlErrorPtr to); #ifdef IN_LIBXML /* * Internal callback reporting routine */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL __xmlRaiseError (xmlStructuredErrorFunc schannel, - xmlGenericErrorFunc channel, - void *data, + xmlGenericErrorFunc channel, + void *data, void *ctx, - void *node, - int domain, + void *node, + int domain, int code, xmlErrorLevel level, const char *file, @@ -922,10 +931,10 @@ XMLPUBFUN void XMLCALL int int1, int col, const char *msg, - ...); -XMLPUBFUN void XMLCALL + ...) LIBXML_ATTR_FORMAT(16,17); +XMLPUBFUN void XMLCALL __xmlSimpleError (int domain, - int code, + int code, xmlNodePtr node, const char *msg, const char *extra); diff --git a/gnulib-local/lib/libxml/xmlexports.in.h b/gnulib-local/lib/libxml/xmlexports.in.h index 29a6f54..2c79f81 100644 --- a/gnulib-local/lib/libxml/xmlexports.in.h +++ b/gnulib-local/lib/libxml/xmlexports.in.h @@ -43,7 +43,7 @@ /** * XMLCDECL: * - * Macro which declares the calling convention for exported functions that + * Macro which declares the calling convention for exported functions that * use '...'. */ #define XMLCDECL @@ -108,9 +108,14 @@ #undef XMLPUBVAR #undef XMLCALL #undef XMLCDECL + /* + * if defined(IN_LIBXML) this raises problems on mingw with msys + * _imp__xmlFree listed as missing. Try to workaround the problem + * by also making that declaration when compiling client code. + */ #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) + #define XMLPUBVAR __declspec(dllexport) extern #else #define XMLPUBFUN #if !defined(LIBXML_STATIC) diff --git a/gnulib-local/lib/libxml/xmlmemory.c b/gnulib-local/lib/libxml/xmlmemory.c index 362a0b0..f24fd6d 100644 --- a/gnulib-local/lib/libxml/xmlmemory.c +++ b/gnulib-local/lib/libxml/xmlmemory.c @@ -34,7 +34,7 @@ /** * MEM_LIST: * - * keep track of all allocated blocks for error reporting + * keep track of all allocated blocks for error reporting * Always build the memory list ! */ #ifdef DEBUG_MEMORY_LOCATION @@ -58,7 +58,7 @@ void xmlMallocBreakpoint(void); /************************************************************************ * * - * Macros, variables and associated types * + * Macros, variables and associated types * * * ************************************************************************/ @@ -162,7 +162,7 @@ xmlMallocLoc(size_t size, const char * file, int line) { MEMHDR *p; void *ret; - + if (!xmlMemInitialized) xmlInitMemory(); #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, @@ -170,7 +170,7 @@ xmlMallocLoc(size_t size, const char * file, int line) #endif TEST_POINT - + p = (MEMHDR *) malloc(RESERVE_SIZE+size); if (!p) { @@ -178,7 +178,7 @@ xmlMallocLoc(size_t size, const char * file, int line) "xmlMallocLoc : Out of free space\n"); xmlMemoryDump(); return(NULL); - } + } p->mh_tag = MEMTAG; p->mh_size = size; p->mh_type = MALLOC_TYPE; @@ -193,19 +193,20 @@ xmlMallocLoc(size_t size, const char * file, int line) debugmem_list_add(p); #endif xmlMutexUnlock(xmlMemMutex); - + #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "Malloc(%d) Ok\n",size); #endif - + if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); ret = HDR_2_CLIENT(p); if (xmlMemTraceBlockAt == ret) { xmlGenericError(xmlGenericErrorContext, - "%p : Malloc(%d) Ok\n", xmlMemTraceBlockAt, size); + "%p : Malloc(%lu) Ok\n", xmlMemTraceBlockAt, + (long unsigned)size); xmlMallocBreakpoint(); } @@ -230,7 +231,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line) { MEMHDR *p; void *ret; - + if (!xmlMemInitialized) xmlInitMemory(); #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, @@ -238,7 +239,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line) #endif TEST_POINT - + p = (MEMHDR *) malloc(RESERVE_SIZE+size); if (!p) { @@ -246,7 +247,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line) "xmlMallocLoc : Out of free space\n"); xmlMemoryDump(); return(NULL); - } + } p->mh_tag = MEMTAG; p->mh_size = size; p->mh_type = MALLOC_ATOMIC_TYPE; @@ -266,14 +267,15 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line) xmlGenericError(xmlGenericErrorContext, "Malloc(%d) Ok\n",size); #endif - + if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); ret = HDR_2_CLIENT(p); if (xmlMemTraceBlockAt == ret) { xmlGenericError(xmlGenericErrorContext, - "%p : Malloc(%d) Ok\n", xmlMemTraceBlockAt, size); + "%p : Malloc(%lu) Ok\n", xmlMemTraceBlockAt, + (long unsigned)size); xmlMallocBreakpoint(); } @@ -311,7 +313,7 @@ xmlMemMalloc(size_t size) void * xmlReallocLoc(void *ptr,size_t size, const char * file, int line) { - MEMHDR *p; + MEMHDR *p, *tmp; unsigned long number; #ifdef DEBUG_MEMORY size_t oldsize; @@ -341,15 +343,18 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line) debugmem_list_delete(p); #endif xmlMutexUnlock(xmlMemMutex); - - p = (MEMHDR *) realloc(p,RESERVE_SIZE+size); - if (!p) { + + tmp = (MEMHDR *) realloc(p,RESERVE_SIZE+size); + if (!tmp) { + free(p); goto error; } + p = tmp; if (xmlMemTraceBlockAt == ptr) { xmlGenericError(xmlGenericErrorContext, - "%p : Realloced(%d -> %d) Ok\n", - xmlMemTraceBlockAt, p->mh_size, size); + "%p : Realloced(%lu -> %lu) Ok\n", + xmlMemTraceBlockAt, (long unsigned)p->mh_size, + (long unsigned)size); xmlMallocBreakpoint(); } p->mh_tag = MEMTAG; @@ -374,8 +379,8 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line) "Realloced(%d to %d) Ok\n", oldsize, size); #endif return(HDR_2_CLIENT(p)); - -error: + +error: return(NULL); } @@ -409,6 +414,9 @@ xmlMemFree(void *ptr) size_t size; #endif + if (ptr == NULL) + return; + if (ptr == (void *) -1) { xmlGenericError(xmlGenericErrorContext, "trying to free pointer from freed area\n"); @@ -452,10 +460,10 @@ xmlMemFree(void *ptr) xmlGenericError(xmlGenericErrorContext, "Freed(%d) Ok\n", size); #endif - + return; - -error: + +error: xmlGenericError(xmlGenericErrorContext, "xmlMemFree(%lX) error\n", (unsigned long) ptr); xmlMallocBreakpoint(); @@ -501,16 +509,13 @@ xmlMemStrdupLoc(const char *str, const char *file, int line) debugmem_list_add(p); #endif xmlMutexUnlock(xmlMemMutex); - + s = (char *) HDR_2_CLIENT(p); - + if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); - if (s != NULL) - strcpy(s,str); - else - goto error; - + strcpy(s,str); + TEST_POINT if (xmlMemTraceBlockAt == s) { @@ -549,7 +554,12 @@ xmlMemoryStrdup(const char *str) { int xmlMemUsed(void) { - return(debugMemSize); + int res; + + xmlMutexLock(xmlMemMutex); + res = debugMemSize; + xmlMutexUnlock(xmlMemMutex); + return(res); } /** @@ -562,7 +572,12 @@ xmlMemUsed(void) { int xmlMemBlocks(void) { - return(debugMemBlocks); + int res; + + xmlMutexLock(xmlMemMutex); + res = debugMemBlocks; + xmlMutexUnlock(xmlMemMutex); + return(res); } #ifdef MEM_LIST @@ -577,13 +592,15 @@ xmlMemBlocks(void) { static void xmlMemContentShow(FILE *fp, MEMHDR *p) { - int i,j,k,len = p->mh_size; - const char *buf = (const char *) HDR_2_CLIENT(p); + int i,j,k,len; + const char *buf; if (p == NULL) { fprintf(fp, " NULL"); return; } + len = p->mh_size; + buf = (const char *) HDR_2_CLIENT(p); for (i = 0;i < len;i++) { if (buf[i] == 0) break; @@ -614,7 +631,7 @@ xmlMemContentShow(FILE *fp, MEMHDR *p) } else if ((i == 0) && (buf[i] == 0)) { fprintf(fp," null"); } else { - if (buf[i] == 0) fprintf(fp," \"%.25s\"", buf); + if (buf[i] == 0) fprintf(fp," \"%.25s\"", buf); else { fprintf(fp," ["); for (j = 0;j < i;j++) @@ -625,6 +642,79 @@ xmlMemContentShow(FILE *fp, MEMHDR *p) } #endif +/** + * xmlMemDisplayLast: + * @fp: a FILE descriptor used as the output file, if NULL, the result is + * written to the file .memorylist + * @nbBytes: the amount of memory to dump + * + * the last nbBytes of memory allocated and not freed, useful for dumping + * the memory left allocated between two places at runtime. + */ + +void +xmlMemDisplayLast(FILE *fp, long nbBytes) +{ +#ifdef MEM_LIST + MEMHDR *p; + unsigned idx; + int nb = 0; +#endif + FILE *old_fp = fp; + + if (nbBytes <= 0) + return; + + if (fp == NULL) { + fp = fopen(".memorylist", "w"); + if (fp == NULL) + return; + } + +#ifdef MEM_LIST + fprintf(fp," Last %li MEMORY ALLOCATED : %lu, MAX was %lu\n", + nbBytes, debugMemSize, debugMaxMemSize); + fprintf(fp,"BLOCK NUMBER SIZE TYPE\n"); + idx = 0; + xmlMutexLock(xmlMemMutex); + p = memlist; + while ((p) && (nbBytes > 0)) { + fprintf(fp,"%-5u %6lu %6lu ",idx++,p->mh_number, + (unsigned long)p->mh_size); + switch (p->mh_type) { + case STRDUP_TYPE:fprintf(fp,"strdup() in ");break; + case MALLOC_TYPE:fprintf(fp,"malloc() in ");break; + case REALLOC_TYPE:fprintf(fp,"realloc() in ");break; + case MALLOC_ATOMIC_TYPE:fprintf(fp,"atomicmalloc() in ");break; + case REALLOC_ATOMIC_TYPE:fprintf(fp,"atomicrealloc() in ");break; + default: + fprintf(fp,"Unknown memory block, may be corrupted"); + xmlMutexUnlock(xmlMemMutex); + if (old_fp == NULL) + fclose(fp); + return; + } + if (p->mh_file != NULL) fprintf(fp,"%s(%u)", p->mh_file, p->mh_line); + if (p->mh_tag != MEMTAG) + fprintf(fp," INVALID"); + nb++; + if (nb < 100) + xmlMemContentShow(fp, p); + else + fprintf(fp," skip"); + + fprintf(fp,"\n"); + nbBytes -= (unsigned long)p->mh_size; + p = p->mh_next; + } + xmlMutexUnlock(xmlMemMutex); +#else + fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n"); +#endif + if (old_fp == NULL) + fclose(fp); +} + /** * xmlMemDisplay: * @fp: a FILE descriptor used as the output file, if NULL, the result is @@ -662,7 +752,7 @@ xmlMemDisplay(FILE *fp) fprintf(fp," %s\n\n", buf); #endif - + fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n", debugMemSize, debugMaxMemSize); fprintf(fp,"BLOCK NUMBER SIZE TYPE\n"); @@ -739,7 +829,7 @@ static void debugmem_list_delete(MEMHDR *p) * * internal error function. */ - + static void debugmem_tag_error(void *p) { xmlGenericError(xmlGenericErrorContext, @@ -799,7 +889,7 @@ xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED) } } xmlMutexUnlock(xmlMemMutex); -#endif /* MEM_LIST */ +#endif /* MEM_LIST */ } /** @@ -846,11 +936,11 @@ xmlInitMemory(void) { #ifdef HAVE_STDLIB_H char *breakpoint; -#endif +#endif #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlInitMemory()\n"); -#endif +#endif /* This is really not good code (see Bug 130419). Suggestions for improvement will be welcome! @@ -864,18 +954,18 @@ xmlInitMemory(void) if (breakpoint != NULL) { sscanf(breakpoint, "%ud", &xmlMemStopAtBlock); } -#endif +#endif #ifdef HAVE_STDLIB_H breakpoint = getenv("XML_MEM_TRACE"); if (breakpoint != NULL) { sscanf(breakpoint, "%p", &xmlMemTraceBlockAt); } -#endif - +#endif + #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlInitMemory() Ok\n"); -#endif +#endif return(0); } @@ -890,7 +980,7 @@ xmlCleanupMemory(void) { #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlCleanupMemory()\n"); -#endif +#endif if (xmlMemInitialized == 0) return; @@ -900,7 +990,7 @@ xmlCleanupMemory(void) { #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlCleanupMemory() Ok\n"); -#endif +#endif } /** @@ -924,7 +1014,7 @@ xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlMemSetup()\n"); -#endif +#endif if (freeFunc == NULL) return(-1); if (mallocFunc == NULL) @@ -941,7 +1031,7 @@ xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlMemSetup() Ok\n"); -#endif +#endif return(0); } @@ -991,7 +1081,7 @@ xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlGcMemSetup()\n"); -#endif +#endif if (freeFunc == NULL) return(-1); if (mallocFunc == NULL) @@ -1010,7 +1100,7 @@ xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, #ifdef DEBUG_MEMORY xmlGenericError(xmlGenericErrorContext, "xmlGcMemSetup() Ok\n"); -#endif +#endif return(0); } diff --git a/gnulib-local/lib/libxml/xmlmemory.in.h b/gnulib-local/lib/libxml/xmlmemory.in.h index 235721c..17e375a 100644 --- a/gnulib-local/lib/libxml/xmlmemory.in.h +++ b/gnulib-local/lib/libxml/xmlmemory.in.h @@ -20,7 +20,7 @@ * * DEBUG_MEMORY replaces the allocator with a collect and debug * shell to the libc allocator. - * DEBUG_MEMORY should only be activated when debugging + * DEBUG_MEMORY should only be activated when debugging * libxml i.e. if libxml has been configured with --with-debug-mem too. */ /* #define DEBUG_MEMORY_FREED */ @@ -35,7 +35,7 @@ /** * DEBUG_MEMORY_LOCATION: * - * DEBUG_MEMORY_LOCATION should be activated only when debugging + * DEBUG_MEMORY_LOCATION should be activated only when debugging * libxml i.e. if libxml has been configured with --with-debug-mem too. */ #ifdef DEBUG_MEMORY_LOCATION @@ -63,7 +63,7 @@ typedef void (XMLCALL *xmlFreeFunc)(void *mem); * * Returns a pointer to the newly allocated block or NULL in case of error. */ -typedef void *(XMLCALL *xmlMallocFunc)(size_t size); +typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size); /** * xmlReallocFunc: @@ -88,11 +88,11 @@ typedef char *(XMLCALL *xmlStrdupFunc)(const char *str); /* * The 4 interfaces used for all memory handling within libxml. -LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree; -LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc; -LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMallocAtomic; -LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc; -LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup; +LIBXML_DLL_IMPORT xmlFreeFunc xmlFree; +LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc; +LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic; +LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc; +LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup; */ /* @@ -105,18 +105,18 @@ XMLPUBFUN int XMLCALL xmlMallocFunc mallocFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlMemGet (xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlGcMemSetup (xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlGcMemGet (xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, xmlMallocFunc *mallocAtomicFunc, @@ -126,42 +126,44 @@ XMLPUBFUN int XMLCALL /* * Initialization of the memory layer. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlInitMemory (void); -/* +/* * Cleanup of the memory layer. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlCleanupMemory (void); /* * These are specific to the XML debug memory wrapper. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlMemUsed (void); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlMemBlocks (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlMemDisplay (FILE *fp); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL + xmlMemDisplayLast(FILE *fp, long nbBytes); +XMLPUBFUN void XMLCALL xmlMemShow (FILE *fp, int nr); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlMemoryDump (void); -XMLPUBFUN void * XMLCALL - xmlMemMalloc (size_t size); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL + xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1); +XMLPUBFUN void * XMLCALL xmlMemRealloc (void *ptr,size_t size); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlMemFree (void *ptr); -XMLPUBFUN char * XMLCALL +XMLPUBFUN char * XMLCALL xmlMemoryStrdup (const char *str); -XMLPUBFUN void * XMLCALL - xmlMallocLoc (size_t size, const char *file, int line); -XMLPUBFUN void * XMLCALL +XMLPUBFUN void * XMLCALL + xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); +XMLPUBFUN void * XMLCALL xmlReallocLoc (void *ptr, size_t size, const char *file, int line); -XMLPUBFUN void * XMLCALL - xmlMallocAtomicLoc (size_t size, const char *file, int line); -XMLPUBFUN char * XMLCALL +XMLPUBFUN void * XMLCALL + xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); +XMLPUBFUN char * XMLCALL xmlMemStrdupLoc (const char *str, const char *file, int line); diff --git a/gnulib-local/lib/libxml/xmlmodule.c b/gnulib-local/lib/libxml/xmlmodule.c index 15bcf07..50ed666 100644 --- a/gnulib-local/lib/libxml/xmlmodule.c +++ b/gnulib-local/lib/libxml/xmlmodule.c @@ -30,7 +30,7 @@ static int xmlModulePlatformSymbol(void *handle, const char *name, void **result /************************************************************************ * * - * module memory error handler * + * module memory error handler * * * ************************************************************************/ @@ -61,6 +61,10 @@ xmlModuleErrMemory(xmlModulePtr module, const char *extra) * @options: a set of xmlModuleOption * * Opens a module/shared library given its name or path + * NOTE: that due to portability issues, behaviour can only be + * guaranteed with @name using ASCII. We canot guarantee that + * an UTF-8 string would work, which is why name is a const char * + * and not a const xmlChar * . * TODO: options are not yet implemented. * * Returns a handle for the module or NULL in case of error @@ -99,6 +103,10 @@ xmlModuleOpen(const char *name, int options ATTRIBUTE_UNUSED) * @symbol: the resulting symbol address * * Lookup for a symbol address in the given module + * NOTE: that due to portability issues, behaviour can only be + * guaranteed with @name using ASCII. We canot guarantee that + * an UTF-8 string would work, which is why name is a const char * + * and not a const xmlChar * . * * Returns 0 if the symbol was found, or -1 in case of error */ @@ -106,8 +114,8 @@ int xmlModuleSymbol(xmlModulePtr module, const char *name, void **symbol) { int rc = -1; - - if ((NULL == module) || (symbol == NULL)) { + + if ((NULL == module) || (symbol == NULL) || (name == NULL)) { __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_MODULE, XML_MODULE_OPEN, XML_ERR_FATAL, NULL, 0, 0, NULL, NULL, 0, 0, "null parameter\n"); @@ -190,7 +198,7 @@ xmlModuleFree(xmlModulePtr module) return (0); } -#ifdef HAVE_DLOPEN +#if defined(HAVE_DLOPEN) && !defined(_WIN32) #ifdef HAVE_DLFCN_H #include #endif @@ -300,7 +308,7 @@ xmlModulePlatformSymbol(void *handle, const char *name, void **symbol) static void * xmlModulePlatformOpen(const char *name) { - return LoadLibrary(name); + return LoadLibraryA(name); } /* @@ -326,7 +334,14 @@ xmlModulePlatformClose(void *handle) static int xmlModulePlatformSymbol(void *handle, const char *name, void **symbol) { +#ifdef _WIN32_WCE + /* + * GetProcAddressA seems only available on WinCE + */ + *symbol = GetProcAddressA(handle, name); +#else *symbol = GetProcAddress(handle, name); +#endif return (NULL == *symbol) ? -1 : 0; } diff --git a/gnulib-local/lib/libxml/xmlmodule.in.h b/gnulib-local/lib/libxml/xmlmodule.in.h index 8f4a560..9667820 100644 --- a/gnulib-local/lib/libxml/xmlmodule.in.h +++ b/gnulib-local/lib/libxml/xmlmodule.in.h @@ -50,7 +50,7 @@ XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module); #ifdef __cplusplus } -#endif +#endif #endif /* LIBXML_MODULES_ENABLED */ diff --git a/gnulib-local/lib/libxml/xmlreader.c b/gnulib-local/lib/libxml/xmlreader.c index c8bcf7b..471e7e2 100644 --- a/gnulib-local/lib/libxml/xmlreader.c +++ b/gnulib-local/lib/libxml/xmlreader.c @@ -1,7 +1,7 @@ /* * xmlreader.c: implements the xmlTextReader streaming node API * - * NOTE: + * NOTE: * XmlTextReader.Normalization Property won't be supported, since * it makes the parser non compliant to the XML recommendation * @@ -44,6 +44,33 @@ #include #endif +#include "buf.h" + +#define MAX_ERR_MSG_SIZE 64000 + +/* + * The following VA_COPY was coded following an example in + * the Samba project. It may not be sufficient for some + * esoteric implementations of va_list but (hopefully) will + * be sufficient for libxml2. + */ +#ifndef VA_COPY + #ifdef HAVE_VA_COPY + #define VA_COPY(dest, src) va_copy(dest, src) + #else + #ifdef HAVE___VA_COPY + #define VA_COPY(dest,src) __va_copy(dest, src) + #else + #ifndef VA_LIST_IS_ARRAY + #define VA_COPY(dest,src) (dest) = (src) + #else + #include + #define VA_COPY(dest,src) memcpy((char *)(dest),(char *)(src),sizeof(va_list)) + #endif + #endif + #endif +#endif + /* #define DEBUG_CALLBACKS */ /* #define DEBUG_READER */ @@ -52,7 +79,7 @@ * * macro to flag unimplemented blocks */ -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); @@ -107,14 +134,14 @@ struct _xmlTextReader { endElementNsSAX2Func endElementNs; /* idem */ charactersSAXFunc characters; cdataBlockSAXFunc cdataBlock; - unsigned int base; /* base of the segment in the input */ - unsigned int cur; /* current position in the input */ + unsigned int base; /* base of the segment in the input */ + unsigned int cur; /* current position in the input */ xmlNodePtr node; /* current node */ xmlNodePtr curnode;/* current attribute node */ int depth; /* depth of the current node */ xmlNodePtr faketext;/* fake xmlNs chld */ int preserve;/* preserve the resulting document */ - xmlBufferPtr buffer; /* used to return const xmlChar * */ + xmlBufPtr buffer; /* used to return const xmlChar * */ xmlDictPtr dict; /* the context dictionnary */ /* entity stack when traversing entities content */ @@ -131,6 +158,7 @@ struct _xmlTextReader { /* Handling of RelaxNG validation */ xmlRelaxNGPtr rngSchemas; /* The Relax NG schemas */ xmlRelaxNGValidCtxtPtr rngValidCtxt;/* The Relax NG validation context */ + int rngPreserveCtxt; /* 1 if the context was provided by the user */ int rngValidErrors;/* The number of errors detected */ xmlNodePtr rngFullNode; /* the node if RNG not progressive */ /* Handling of Schemas validation */ @@ -186,7 +214,7 @@ static int xmlTextReaderNextTree(xmlTextReaderPtr reader); * current scope */ #define DICT_FREE(str) \ - if ((str) && ((!dict) || \ + if ((str) && ((!dict) || \ (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \ xmlFree((char *)(str)); @@ -231,11 +259,9 @@ xmlTextReaderRemoveID(xmlDocPtr doc, xmlAttrPtr attr) { if (doc == NULL) return(-1); if (attr == NULL) return(-1); table = (xmlIDTablePtr) doc->ids; - if (table == NULL) + if (table == NULL) return(-1); - if (attr == NULL) - return(-1); ID = xmlNodeListGetString(doc, attr->children, 1); if (ID == NULL) return(-1); @@ -260,7 +286,10 @@ static void xmlTextReaderFreeProp(xmlTextReaderPtr reader, xmlAttrPtr cur) { xmlDictPtr dict; - dict = reader->ctxt->dict; + if ((reader != NULL) && (reader->ctxt != NULL)) + dict = reader->ctxt->dict; + else + dict = NULL; if (cur == NULL) return; if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue)) @@ -297,7 +326,7 @@ xmlTextReaderFreeProp(xmlTextReaderPtr reader, xmlAttrPtr cur) { static void xmlTextReaderFreePropList(xmlTextReaderPtr reader, xmlAttrPtr cur) { xmlAttrPtr next; - if (cur == NULL) return; + while (cur != NULL) { next = cur->next; xmlTextReaderFreeProp(reader, cur); @@ -318,7 +347,10 @@ xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur) { xmlNodePtr next; xmlDictPtr dict; - dict = reader->ctxt->dict; + if ((reader != NULL) && (reader->ctxt != NULL)) + dict = reader->ctxt->dict; + else + dict = NULL; if (cur == NULL) return; if (cur->type == XML_NAMESPACE_DECL) { xmlFreeNsList((xmlNsPtr) cur); @@ -395,7 +427,10 @@ static void xmlTextReaderFreeNode(xmlTextReaderPtr reader, xmlNodePtr cur) { xmlDictPtr dict; - dict = reader->ctxt->dict; + if ((reader != NULL) && (reader->ctxt != NULL)) + dict = reader->ctxt->dict; + else + dict = NULL; if (cur->type == XML_DTD_NODE) { xmlFreeDtd((xmlDtdPtr) cur); return; @@ -787,9 +822,10 @@ xmlTextReaderCDataBlock(void *ctx, const xmlChar *ch, int len) */ static int xmlTextReaderPushData(xmlTextReaderPtr reader) { - xmlBufferPtr inbuf; + xmlBufPtr inbuf; int val, s; xmlTextReaderState oldstate; + int alloc; if ((reader->input == NULL) || (reader->input->buffer == NULL)) return(-1); @@ -797,17 +833,18 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) { oldstate = reader->state; reader->state = XML_TEXTREADER_NONE; inbuf = reader->input->buffer; + alloc = xmlBufGetAllocationScheme(inbuf); while (reader->state == XML_TEXTREADER_NONE) { - if (inbuf->use < reader->cur + CHUNK_SIZE) { + if (xmlBufUse(inbuf) < reader->cur + CHUNK_SIZE) { /* * Refill the buffer unless we are at the end of the stream */ if (reader->mode != XML_TEXTREADER_MODE_EOF) { val = xmlParserInputBufferRead(reader->input, 4096); if ((val == 0) && - (inbuf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)) { - if (inbuf->use == reader->cur) { + (alloc == XML_BUFFER_ALLOC_IMMUTABLE)) { + if (xmlBufUse(inbuf) == reader->cur) { reader->mode = XML_TEXTREADER_MODE_EOF; reader->state = oldstate; } @@ -823,28 +860,30 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) { break; } - } else + } else break; } /* * parse by block of CHUNK_SIZE bytes, various tests show that * it's the best tradeoff at least on a 1.2GH Duron */ - if (inbuf->use >= reader->cur + CHUNK_SIZE) { + if (xmlBufUse(inbuf) >= reader->cur + CHUNK_SIZE) { val = xmlParseChunk(reader->ctxt, - (const char *) &inbuf->content[reader->cur], - CHUNK_SIZE, 0); + (const char *) xmlBufContent(inbuf) + reader->cur, + CHUNK_SIZE, 0); reader->cur += CHUNK_SIZE; - if ((val != 0) || (reader->ctxt->wellFormed == 0)) - return(-1); + if (val != 0) + reader->ctxt->wellFormed = 0; + if (reader->ctxt->wellFormed == 0) + break; } else { - s = inbuf->use - reader->cur; + s = xmlBufUse(inbuf) - reader->cur; val = xmlParseChunk(reader->ctxt, - (const char *) &inbuf->content[reader->cur], - s, 0); + (const char *) xmlBufContent(inbuf) + reader->cur, + s, 0); reader->cur += s; - if ((val != 0) || (reader->ctxt->wellFormed == 0)) - return(-1); + if (val != 0) + reader->ctxt->wellFormed = 0; break; } } @@ -853,10 +892,10 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) { * Discard the consumed input when needed and possible */ if (reader->mode == XML_TEXTREADER_MODE_INTERACTIVE) { - if (inbuf->alloc != XML_BUFFER_ALLOC_IMMUTABLE) { + if (alloc != XML_BUFFER_ALLOC_IMMUTABLE) { if ((reader->cur >= 4096) && - (inbuf->use - reader->cur <= CHUNK_SIZE)) { - val = xmlBufferShrink(inbuf, reader->cur); + (xmlBufUse(inbuf) - reader->cur <= CHUNK_SIZE)) { + val = xmlBufShrink(inbuf, reader->cur); if (val >= 0) { reader->cur -= val; } @@ -869,18 +908,27 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) { * parser. */ else if (reader->mode == XML_TEXTREADER_MODE_EOF) { - if (reader->mode != XML_TEXTREADER_DONE) { - s = inbuf->use - reader->cur; + if (reader->state != XML_TEXTREADER_DONE) { + s = xmlBufUse(inbuf) - reader->cur; val = xmlParseChunk(reader->ctxt, - (const char *) &inbuf->content[reader->cur], - s, 1); - reader->cur = inbuf->use; - reader->mode = XML_TEXTREADER_DONE; - if ((val != 0) || (reader->ctxt->wellFormed == 0)) - return(-1); + (const char *) xmlBufContent(inbuf) + reader->cur, + s, 1); + reader->cur = xmlBufUse(inbuf); + reader->state = XML_TEXTREADER_DONE; + if (val != 0) { + if (reader->ctxt->wellFormed) + reader->ctxt->wellFormed = 0; + else + return(-1); + } } } reader->state = oldstate; + if (reader->ctxt->wellFormed == 0) { + reader->mode = XML_TEXTREADER_MODE_EOF; + return(-1); + } + return(0); } @@ -949,7 +997,7 @@ printf("Expand failed !\n"); * xmlTextReaderValidateCData: * @reader: the xmlTextReaderPtr used * @data: pointer to the CData - * @len: lenght of the CData block in bytes. + * @len: length of the CData block in bytes. * * Push some CData for validation */ @@ -1012,7 +1060,7 @@ xmlTextReaderValidatePop(xmlTextReaderPtr reader) { int ret; if (reader->rngFullNode != NULL) { - if (node == reader->rngFullNode) + if (node == reader->rngFullNode) reader->rngFullNode = NULL; return; } @@ -1047,7 +1095,7 @@ xmlTextReaderValidateEntity(xmlTextReaderPtr reader) { */ if ((node->children == NULL) && (ctxt->sax != NULL) && (ctxt->sax->getEntity != NULL)) { - node->children = (xmlNodePtr) + node->children = (xmlNodePtr) ctxt->sax->getEntity(ctxt, node->name); } @@ -1169,8 +1217,10 @@ xmlTextReaderDoExpand(xmlTextReaderPtr reader) { if (reader->mode == XML_TEXTREADER_MODE_EOF) return(1); val = xmlTextReaderPushData(reader); - if (val < 0) + if (val < 0){ + reader->mode = XML_TEXTREADER_MODE_ERROR; return(-1); + } } while(reader->mode != XML_TEXTREADER_MODE_EOF); return(1); } @@ -1191,6 +1241,9 @@ xmlTextReaderCollectSiblings(xmlNodePtr node) xmlBufferPtr buffer; xmlChar *ret; + if ((node == NULL) || (node->type == XML_NAMESPACE_DECL)) + return(NULL); + buffer = xmlBufferCreate(); if (buffer == NULL) return NULL; @@ -1235,7 +1288,7 @@ xmlTextReaderRead(xmlTextReaderPtr reader) { xmlTextReaderState oldstate = XML_TEXTREADER_START; xmlNodePtr oldnode = NULL; - + if (reader == NULL) return(-1); reader->curnode = NULL; @@ -1243,8 +1296,6 @@ xmlTextReaderRead(xmlTextReaderPtr reader) { return(xmlTextReaderReadTree(reader)); if (reader->ctxt == NULL) return(-1); - if (reader->ctxt->wellFormed != 1) - return(-1); #ifdef DEBUG_READER fprintf(stderr, "\nREAD "); @@ -1257,17 +1308,23 @@ xmlTextReaderRead(xmlTextReaderPtr reader) { */ do { val = xmlTextReaderPushData(reader); - if (val < 0) + if (val < 0){ + reader->mode = XML_TEXTREADER_MODE_ERROR; + reader->state = XML_TEXTREADER_ERROR; return(-1); + } } while ((reader->ctxt->node == NULL) && ((reader->mode != XML_TEXTREADER_MODE_EOF) && - (reader->mode != XML_TEXTREADER_DONE))); + (reader->state != XML_TEXTREADER_DONE))); if (reader->ctxt->node == NULL) { if (reader->ctxt->myDoc != NULL) { reader->node = reader->ctxt->myDoc->children; } - if (reader->node == NULL) + if (reader->node == NULL){ + reader->mode = XML_TEXTREADER_MODE_ERROR; + reader->state = XML_TEXTREADER_ERROR; return(-1); + } reader->state = XML_TEXTREADER_ELEMENT; } else { if (reader->ctxt->myDoc != NULL) { @@ -1287,7 +1344,7 @@ xmlTextReaderRead(xmlTextReaderPtr reader) { get_next_node: if (reader->node == NULL) { - if (reader->mode == XML_TEXTREADER_DONE) + if (reader->mode == XML_TEXTREADER_MODE_EOF) return(0); else return(-1); @@ -1314,8 +1371,11 @@ get_next_node: (reader->ctxt->node == reader->node->parent)) && (reader->ctxt->instate != XML_PARSER_EOF)) { val = xmlTextReaderPushData(reader); - if (val < 0) + if (val < 0){ + reader->mode = XML_TEXTREADER_MODE_ERROR; + reader->state = XML_TEXTREADER_ERROR; return(-1); + } if (reader->node == NULL) goto node_end; } @@ -1362,8 +1422,7 @@ get_next_node: #endif (reader->entNr == 0) && (reader->node->prev != NULL) && - (reader->node->prev->type != XML_DTD_NODE) && - (reader->entNr == 0)) { + (reader->node->prev->type != XML_DTD_NODE)) { xmlNodePtr tmp = reader->node->prev; if ((tmp->extra & NODE_IS_PRESERVED) == 0) { xmlUnlinkNode(tmp); @@ -1381,7 +1440,7 @@ get_next_node: goto node_found; } #ifdef LIBXML_REGEXP_ENABLED - if ((reader->validate) && (reader->node->type == XML_ELEMENT_NODE)) + if ((reader->validate != XML_TEXTREADER_NOT_VALIDATE) && (reader->node->type == XML_ELEMENT_NODE)) xmlTextReaderValidatePop(reader); #endif /* LIBXML_REGEXP_ENABLED */ if ((reader->preserves > 0) && @@ -1394,9 +1453,9 @@ get_next_node: (reader->node->type == XML_DOCB_DOCUMENT_NODE) || #endif (reader->node->type == XML_HTML_DOCUMENT_NODE)) { - if (reader->mode != XML_TEXTREADER_DONE) { + if (reader->mode != XML_TEXTREADER_MODE_EOF) { val = xmlParseChunk(reader->ctxt, "", 0, 1); - reader->mode = XML_TEXTREADER_DONE; + reader->state = XML_TEXTREADER_DONE; if (val != 0) return(-1); } @@ -1406,14 +1465,13 @@ get_next_node: /* * Cleanup of the old node */ - if ((reader->preserves == 0) && + if ((oldnode != NULL) && (reader->preserves == 0) && #ifdef LIBXML_XINCLUDE_ENABLED (reader->in_xinclude == 0) && #endif (reader->entNr == 0) && (oldnode->type != XML_DTD_NODE) && - ((oldnode->extra & NODE_IS_PRESERVED) == 0) && - (reader->entNr == 0)) { + ((oldnode->extra & NODE_IS_PRESERVED) == 0)) { xmlUnlinkNode(oldnode); xmlTextReaderFreeNode(reader, oldnode); } @@ -1459,7 +1517,7 @@ node_found: (xmlStrEqual(reader->node->ns->href, XINCLUDE_OLD_NS)))) { if (reader->xincctxt == NULL) { reader->xincctxt = xmlXIncludeNewContext(reader->ctxt->myDoc); - xmlXIncludeSetFlags(reader->xincctxt, + xmlXIncludeSetFlags(reader->xincctxt, reader->parserFlags & (~XML_PARSE_NOXINCNODE)); } /* @@ -1472,7 +1530,7 @@ node_found: if ((reader->node != NULL) && (reader->node->type == XML_XINCLUDE_START)) { reader->in_xinclude++; goto get_next_node; - } + } if ((reader->node != NULL) && (reader->node->type == XML_XINCLUDE_END)) { reader->in_xinclude--; goto get_next_node; @@ -1490,7 +1548,7 @@ node_found: */ if ((reader->node->children == NULL) && (reader->ctxt->sax != NULL) && (reader->ctxt->sax->getEntity != NULL)) { - reader->node->children = (xmlNodePtr) + reader->node->children = (xmlNodePtr) reader->ctxt->sax->getEntity(reader->ctxt, reader->node->name); } @@ -1515,10 +1573,10 @@ node_found: goto get_next_node; } #ifdef LIBXML_REGEXP_ENABLED - if ((reader->validate) && (reader->node != NULL)) { + if ((reader->validate != XML_TEXTREADER_NOT_VALIDATE) && (reader->node != NULL)) { xmlNodePtr node = reader->node; - if ((node->type == XML_ELEMENT_NODE) && + if ((node->type == XML_ELEMENT_NODE) && ((reader->state != XML_TEXTREADER_END) && (reader->state != XML_TEXTREADER_BACKTRACK))) { xmlTextReaderValidatePush(reader); @@ -1543,14 +1601,14 @@ node_found: #endif /* LIBXML_PATTERN_ENABLED */ #ifdef LIBXML_SCHEMAS_ENABLED if ((reader->validate == XML_TEXTREADER_VALIDATE_XSD) && - (reader->xsdValidErrors == 0) && + (reader->xsdValidErrors == 0) && (reader->xsdValidCtxt != NULL)) { reader->xsdValidErrors = !xmlSchemaIsValid(reader->xsdValidCtxt); } #endif /* LIBXML_PATTERN_ENABLED */ return(1); node_end: - reader->mode = XML_TEXTREADER_DONE; + reader->state = XML_TEXTREADER_DONE; return(0); } @@ -1634,7 +1692,7 @@ xmlTextReaderNext(xmlTextReaderPtr reader) { * 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 - * is neither an element nor attribute, or has no child nodes. The + * is neither an element nor attribute, or has no child nodes. The * string must be deallocated by the caller. */ xmlChar * @@ -1679,9 +1737,9 @@ xmlTextReaderReadInnerXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) * * 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 - * is neither an element nor attribute, or has no child nodes. The - * string must be deallocated by the caller. + * Returns a string containing the node and any XML content, or NULL if the + * current node cannot be serialized. The string must be deallocated + * by the caller. */ xmlChar * xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) @@ -1696,7 +1754,11 @@ xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) if (xmlTextReaderExpand(reader) == 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(); if (xmlNodeDump(buff, doc, node, 0, 0) == -1) { xmlFreeNode(node); @@ -1741,6 +1803,7 @@ xmlTextReaderReadString(xmlTextReaderPtr reader) if (xmlTextReaderDoExpand(reader) != -1) { return xmlTextReaderCollectSiblings(node->children); } + break; case XML_ATTRIBUTE_NODE: TODO break; @@ -1838,17 +1901,22 @@ xmlTextReaderNextTree(xmlTextReaderPtr reader) } if (reader->state != XML_TEXTREADER_BACKTRACK) { - if (reader->node->children != 0) { - reader->node = reader->node->children; - reader->depth++; + /* Here removed traversal to child, because we want to skip the subtree, + replace with traversal to sibling to skip subtree */ + if (reader->node->next != 0) { + /* Move to sibling if present,skipping sub-tree */ + reader->node = reader->node->next; reader->state = XML_TEXTREADER_START; return(1); } + /* if reader->node->next is NULL mean no subtree for current node, + so need to move to sibling of parent node if present */ if ((reader->node->type == XML_ELEMENT_NODE) || (reader->node->type == XML_ATTRIBUTE_NODE)) { reader->state = XML_TEXTREADER_BACKTRACK; - return(1); + /* This will move to parent if present */ + xmlTextReaderRead(reader); } } @@ -1867,7 +1935,8 @@ xmlTextReaderNextTree(xmlTextReaderPtr reader) reader->node = reader->node->parent; reader->depth--; reader->state = XML_TEXTREADER_BACKTRACK; - return(1); + /* Repeat process to move to sibling of parent node if present */ + xmlTextReaderNextTree(reader); } reader->state = XML_TEXTREADER_END; @@ -2015,16 +2084,19 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) { ret->entMax = 0; ret->entNr = 0; ret->input = input; - ret->buffer = xmlBufferCreateSize(100); + ret->buffer = xmlBufCreateSize(100); if (ret->buffer == NULL) { xmlFree(ret); xmlGenericError(xmlGenericErrorContext, "xmlNewTextReader : malloc failed\n"); return(NULL); } + /* no operation on a reader should require a huge buffer */ + xmlBufSetAllocationScheme(ret->buffer, + XML_BUFFER_ALLOC_BOUNDED); ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler)); if (ret->sax == NULL) { - xmlBufferFree(ret->buffer); + xmlBufFree(ret->buffer); xmlFree(ret); xmlGenericError(xmlGenericErrorContext, "xmlNewTextReader : malloc failed\n"); @@ -2057,12 +2129,13 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) { ret->mode = XML_TEXTREADER_MODE_INITIAL; ret->node = NULL; ret->curnode = NULL; - if (ret->input->buffer->use < 4) { + if (xmlBufUse(ret->input->buffer) < 4) { xmlParserInputBufferRead(input, 4); } - if (ret->input->buffer->use >= 4) { + if (xmlBufUse(ret->input->buffer) >= 4) { ret->ctxt = xmlCreatePushParserCtxt(ret->sax, NULL, - (const char *) ret->input->buffer->content, 4, URI); + (const char *) xmlBufContent(ret->input->buffer), + 4, URI); ret->base = 0; ret->cur = 4; } else { @@ -2070,11 +2143,11 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) { ret->base = 0; ret->cur = 0; } - + if (ret->ctxt == NULL) { xmlGenericError(xmlGenericErrorContext, "xmlNewTextReader : malloc failed\n"); - xmlBufferFree(ret->buffer); + xmlBufFree(ret->buffer); xmlFree(ret->sax); xmlFree(ret); return(NULL); @@ -2147,7 +2220,8 @@ xmlFreeTextReader(xmlTextReaderPtr reader) { reader->rngSchemas = NULL; } if (reader->rngValidCtxt != NULL) { - xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt); + if (! reader->rngPreserveCtxt) + xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt); reader->rngValidCtxt = NULL; } if (reader->xsdPlug != NULL) { @@ -2178,6 +2252,9 @@ xmlFreeTextReader(xmlTextReaderPtr reader) { xmlFree(reader->patternTab); } #endif + if (reader->faketext != NULL) { + xmlFreeNode(reader->faketext); + } if (reader->ctxt != NULL) { if (reader->dict == reader->ctxt->dict) reader->dict = NULL; @@ -2199,11 +2276,8 @@ xmlFreeTextReader(xmlTextReaderPtr reader) { xmlFree(reader->sax); if ((reader->input != NULL) && (reader->allocs & XML_TEXTREADER_INPUT)) xmlFreeParserInputBuffer(reader->input); - if (reader->faketext != NULL) { - xmlFreeNode(reader->faketext); - } if (reader->buffer != NULL) - xmlBufferFree(reader->buffer); + xmlBufFree(reader->buffer); if (reader->entTab != NULL) xmlFree(reader->entTab); if (reader->dict != NULL) @@ -2272,7 +2346,7 @@ xmlTextReaderGetAttributeNo(xmlTextReaderPtr reader, int no) { if (reader->curnode != NULL) return(NULL); /* TODO: handle the xmlDecl */ - if (reader->node->type != XML_ELEMENT_NODE) + if (reader->node->type != XML_ELEMENT_NODE) return(NULL); ns = reader->node->nsDef; @@ -2402,7 +2476,7 @@ xmlTextReaderGetAttributeNs(xmlTextReaderPtr reader, const xmlChar *localName, } ns = reader->node->nsDef; while (ns != NULL) { - if ((prefix == NULL && ns->prefix == NULL) || + if ((prefix == NULL && ns->prefix == NULL) || ((ns->prefix != NULL) && (xmlStrEqual(ns->prefix, localName)))) { return xmlStrdup(ns->href); } @@ -2514,7 +2588,7 @@ xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, int no) { if (reader->node == NULL) return(-1); /* TODO: handle the xmlDecl */ - if (reader->node->type != XML_ELEMENT_NODE) + if (reader->node->type != XML_ELEMENT_NODE) return(-1); reader->curnode = NULL; @@ -2601,7 +2675,7 @@ xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, const xmlChar *name) { } return(0); } - + /* * Namespace default decl */ @@ -2678,7 +2752,7 @@ xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, } ns = reader->node->nsDef; while (ns != NULL) { - if ((prefix == NULL && ns->prefix == NULL) || + if ((prefix == NULL && ns->prefix == NULL) || ((ns->prefix != NULL) && (xmlStrEqual(ns->prefix, localName)))) { reader->curnode = (xmlNodePtr) ns; return(1); @@ -2824,7 +2898,7 @@ xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader) { xmlNsPtr ns = (xmlNsPtr) reader->curnode; if (reader->faketext == NULL) { - reader->faketext = xmlNewDocText(reader->node->doc, + reader->faketext = xmlNewDocText(reader->node->doc, ns->href); } else { if ((reader->faketext->content != NULL) && @@ -2862,7 +2936,7 @@ xmlTextReaderConstEncoding(xmlTextReaderPtr reader) { doc = reader->ctxt->myDoc; if (doc == NULL) return(NULL); - + if (doc->encoding == NULL) return(NULL); else @@ -2894,7 +2968,7 @@ xmlTextReaderAttributeCount(xmlTextReaderPtr reader) { return(-1); if (reader->node == NULL) return(0); - + if (reader->curnode != NULL) node = reader->curnode; else @@ -2925,14 +2999,14 @@ xmlTextReaderAttributeCount(xmlTextReaderPtr reader) { * * Get the node type of the current node * Reference: - * http://dotgnu.org/pnetlib-doc/System/Xml/XmlNodeType.html + * http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/XmlNodeType.html * * Returns the xmlNodeType of the current node or -1 in case of error */ int xmlTextReaderNodeType(xmlTextReaderPtr reader) { xmlNodePtr node; - + if (reader == NULL) return(-1); if (reader->node == NULL) @@ -3028,7 +3102,8 @@ xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader) { * * The local name of the node. * - * Returns the local name or NULL if not available + * Returns the local name or NULL if not available, + * if non NULL it need to be freed by the caller. */ xmlChar * xmlTextReaderLocalName(xmlTextReaderPtr reader) { @@ -3089,7 +3164,8 @@ xmlTextReaderConstLocalName(xmlTextReaderPtr reader) { * * The qualified name of the node, equal to Prefix :LocalName. * - * Returns the local name or NULL if not available + * Returns the local name or NULL if not available, + * if non NULL it need to be freed by the caller. */ xmlChar * xmlTextReaderName(xmlTextReaderPtr reader) { @@ -3108,7 +3184,7 @@ xmlTextReaderName(xmlTextReaderPtr reader) { if ((node->ns == NULL) || (node->ns->prefix == NULL)) return(xmlStrdup(node->name)); - + ret = xmlStrdup(node->ns->prefix); ret = xmlStrcat(ret, BAD_CAST ":"); ret = xmlStrcat(ret, node->name); @@ -3232,7 +3308,8 @@ xmlTextReaderConstName(xmlTextReaderPtr reader) { * * A shorthand reference to the namespace associated with the node. * - * Returns the prefix or NULL if not available + * Returns the prefix or NULL if not available, + * if non NULL it need to be freed by the caller. */ xmlChar * xmlTextReaderPrefix(xmlTextReaderPtr reader) { @@ -3295,7 +3372,8 @@ xmlTextReaderConstPrefix(xmlTextReaderPtr reader) { * * The URI defining the namespace associated with the node. * - * Returns the namespace URI or NULL if not available + * Returns the namespace URI or NULL if not available, + * if non NULL it need to be freed by the caller. */ xmlChar * xmlTextReaderNamespaceUri(xmlTextReaderPtr reader) { @@ -3350,7 +3428,8 @@ xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader) { * * The base URI of the node. * - * Returns the base URI or NULL if not available + * Returns the base URI or NULL if not available, + * if non NULL it need to be freed by the caller. */ xmlChar * xmlTextReaderBaseUri(xmlTextReaderPtr reader) { @@ -3540,22 +3619,35 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) { return(((xmlNsPtr) node)->href); case XML_ATTRIBUTE_NODE:{ xmlAttrPtr attr = (xmlAttrPtr) node; + const xmlChar *ret; if ((attr->children != NULL) && (attr->children->type == XML_TEXT_NODE) && (attr->children->next == NULL)) return(attr->children->content); else { - if (reader->buffer == NULL) - reader->buffer = xmlBufferCreateSize(100); if (reader->buffer == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlTextReaderSetup : malloc failed\n"); - return (NULL); + reader->buffer = xmlBufCreateSize(100); + if (reader->buffer == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xmlTextReaderSetup : malloc failed\n"); + return (NULL); + } + xmlBufSetAllocationScheme(reader->buffer, + XML_BUFFER_ALLOC_BOUNDED); + } else + xmlBufEmpty(reader->buffer); + xmlBufGetNodeContent(reader->buffer, node); + ret = xmlBufContent(reader->buffer); + if (ret == NULL) { + /* error on the buffer best to reallocate */ + xmlBufFree(reader->buffer); + reader->buffer = xmlBufCreateSize(100); + xmlBufSetAllocationScheme(reader->buffer, + XML_BUFFER_ALLOC_BOUNDED); + ret = BAD_CAST ""; } - reader->buffer->use = 0; - xmlNodeBufGetContent(reader->buffer, node); - return(reader->buffer->content); + return(ret); } break; } @@ -3608,7 +3700,8 @@ xmlTextReaderQuoteChar(xmlTextReaderPtr reader) { * * The xml:lang scope within which the node resides. * - * Returns the xml:lang value or NULL if none exists. + * Returns the xml:lang value or NULL if none exists., + * if non NULL it need to be freed by the caller. */ xmlChar * xmlTextReaderXmlLang(xmlTextReaderPtr reader) { @@ -3833,7 +3926,7 @@ xmlNodePtr xmlTextReaderCurrentNode(xmlTextReaderPtr reader) { if (reader == NULL) return(NULL); - + if (reader->curnode != NULL) return(reader->curnode); return(reader->node); @@ -3855,7 +3948,7 @@ xmlTextReaderPreserve(xmlTextReaderPtr reader) { if (reader == NULL) return(NULL); - + if (reader->curnode != NULL) cur = reader->curnode; else @@ -3868,7 +3961,7 @@ xmlTextReaderPreserve(xmlTextReaderPtr reader) { cur->extra |= NODE_IS_SPRESERVED; } reader->preserves++; - + parent = cur->parent;; while (parent != NULL) { if (parent->type == XML_ELEMENT_NODE) @@ -3884,7 +3977,7 @@ xmlTextReaderPreserve(xmlTextReaderPtr reader) { * @reader: the xmlTextReaderPtr used * @pattern: an XPath subset pattern * @namespaces: the prefix definitions, array of [URI, prefix] or NULL - * + * * This tells the XML Reader to preserve all nodes matched by the * pattern. The caller must also use xmlTextReaderCurrentDoc() to * keep an handle on the resulting document once parsing has finished @@ -3899,7 +3992,7 @@ xmlTextReaderPreservePattern(xmlTextReaderPtr reader, const xmlChar *pattern, if ((reader == NULL) || (pattern == NULL)) return(-1); - + comp = xmlPatterncompile(pattern, reader->dict, 0, namespaces); if (comp == NULL) return(-1); @@ -3936,7 +4029,7 @@ xmlTextReaderPreservePattern(xmlTextReaderPtr reader, const xmlChar *pattern, * @reader: the xmlTextReaderPtr used * * Hacking interface allowing to get the xmlDocPtr correponding to the - * current document being accessed by the xmlTextReader. + * current document being accessed by the xmlTextReader. * NOTE: as a result of this call, the reader will not destroy the * associated XML document and calling xmlFreeDoc() on the result * is needed once the reader parsing has finished. @@ -3949,75 +4042,82 @@ xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) { return(NULL); if (reader->doc != NULL) return(reader->doc); - if ((reader == NULL) || (reader->ctxt == NULL) || - (reader->ctxt->myDoc == NULL)) + if ((reader->ctxt == NULL) || (reader->ctxt->myDoc == NULL)) return(NULL); - + reader->preserve = 1; return(reader->ctxt->myDoc); } #ifdef LIBXML_SCHEMAS_ENABLED +static char *xmlTextReaderBuildMessage(const char *msg, va_list ap); -static char * -xmlTextReaderBuildMessage(const char *msg, va_list ap); - -static void XMLCDECL +static void XMLCDECL xmlTextReaderValidityError(void *ctxt, const char *msg, ...); -static void XMLCDECL +static void XMLCDECL xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...); -static void XMLCDECL xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...) +static void XMLCDECL +xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...) { - xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx; - char * str; - va_list ap; - - va_start(ap,msg); - str = xmlTextReaderBuildMessage(msg,ap); - if (!reader->errorFunc) { - xmlTextReaderValidityError(ctx, "%s", str); - } else { - reader->errorFunc(reader->errorFuncArg, str, XML_PARSER_SEVERITY_VALIDITY_ERROR, NULL /* locator */); - } - if (str != NULL) - xmlFree(str); - va_end(ap); + xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx; + + char *str; + + va_list ap; + + va_start(ap, msg); + str = xmlTextReaderBuildMessage(msg, ap); + if (!reader->errorFunc) { + xmlTextReaderValidityError(ctx, "%s", str); + } else { + reader->errorFunc(reader->errorFuncArg, str, + XML_PARSER_SEVERITY_VALIDITY_ERROR, + NULL /* locator */ ); + } + if (str != NULL) + xmlFree(str); + va_end(ap); } -static void XMLCDECL xmlTextReaderValidityWarningRelay(void *ctx, const char *msg, ...) +static void XMLCDECL +xmlTextReaderValidityWarningRelay(void *ctx, const char *msg, ...) { - xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx; - char * str; - va_list ap; - - va_start(ap,msg); - str = xmlTextReaderBuildMessage(msg,ap); - if (!reader->errorFunc) { - xmlTextReaderValidityWarning(ctx, "%s", str); - } else { - reader->errorFunc(reader->errorFuncArg, str, XML_PARSER_SEVERITY_VALIDITY_WARNING, NULL /* locator */); - } - if (str != NULL) - xmlFree(str); - va_end(ap); + xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx; + + char *str; + + va_list ap; + + va_start(ap, msg); + str = xmlTextReaderBuildMessage(msg, ap); + if (!reader->errorFunc) { + xmlTextReaderValidityWarning(ctx, "%s", str); + } else { + reader->errorFunc(reader->errorFuncArg, str, + XML_PARSER_SEVERITY_VALIDITY_WARNING, + NULL /* locator */ ); + } + if (str != NULL) + xmlFree(str); + va_end(ap); } -static void -xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error); +static void + xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error); -static void xmlTextReaderValidityStructuredRelay(void * userData, xmlErrorPtr error) +static void +xmlTextReaderValidityStructuredRelay(void *userData, xmlErrorPtr error) { - xmlTextReaderPtr reader = (xmlTextReaderPtr) userData; + xmlTextReaderPtr reader = (xmlTextReaderPtr) userData; - if (reader->sErrorFunc) { - reader->sErrorFunc(reader->errorFuncArg, error); - } else { - xmlTextReaderStructuredError(reader, error); - } + if (reader->sErrorFunc) { + reader->sErrorFunc(reader->errorFuncArg, error); + } else { + xmlTextReaderStructuredError(reader, error); + } } - /** * xmlTextReaderRelaxNGSetSchema: * @reader: the xmlTextReaderPtr used @@ -4042,9 +4142,11 @@ xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema) { reader->rngSchemas = NULL; } if (reader->rngValidCtxt != NULL) { - xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt); + if (! reader->rngPreserveCtxt) + xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt); reader->rngValidCtxt = NULL; } + reader->rngPreserveCtxt = 0; return(0); } if (reader->mode != XML_TEXTREADER_MODE_INITIAL) @@ -4054,9 +4156,11 @@ xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema) { reader->rngSchemas = NULL; } if (reader->rngValidCtxt != NULL) { - xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt); + if (! reader->rngPreserveCtxt) + xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt); reader->rngValidCtxt = NULL; } + reader->rngPreserveCtxt = 0; reader->rngValidCtxt = xmlRelaxNGNewValidCtxt(schema); if (reader->rngValidCtxt == NULL) return(-1); @@ -4067,7 +4171,7 @@ xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema) { reader); } if (reader->sErrorFunc != NULL) { - xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, xmlTextReaderValidityStructuredRelay, reader); } @@ -4077,6 +4181,60 @@ xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema) { return(0); } +/** + * xmlTextReaderLocator: + * @ctx: the xmlTextReaderPtr used + * @file: returned file information + * @line: returned line information + * + * Internal locator function for the readers + * + * Returns 0 in case the Schema validation could be (des)activated and + * -1 in case of error. + */ +static int +xmlTextReaderLocator(void *ctx, const char **file, unsigned long *line) { + xmlTextReaderPtr reader; + + if ((ctx == NULL) || ((file == NULL) && (line == NULL))) + return(-1); + + if (file != NULL) + *file = NULL; + if (line != NULL) + *line = 0; + + reader = (xmlTextReaderPtr) ctx; + if ((reader->ctxt != NULL) && (reader->ctxt->input != NULL)) { + if (file != NULL) + *file = reader->ctxt->input->filename; + if (line != NULL) + *line = reader->ctxt->input->line; + return(0); + } + if (reader->node != NULL) { + long res; + int ret = 0; + + if (line != NULL) { + res = xmlGetLineNo(reader->node); + if (res > 0) + *line = (unsigned long) res; + else + ret = -1; + } + if (file != NULL) { + xmlDocPtr doc = reader->node->doc; + if ((doc != NULL) && (doc->URL != NULL)) + *file = (const char *) doc->URL; + else + ret = -1; + } + return(ret); + } + return(-1); +} + /** * xmlTextReaderSetSchema: * @reader: the xmlTextReaderPtr used @@ -4103,15 +4261,15 @@ xmlTextReaderSetSchema(xmlTextReaderPtr reader, xmlSchemaPtr schema) { if (reader->xsdValidCtxt != NULL) { if (! reader->xsdPreserveCtxt) xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); - reader->xsdValidCtxt = NULL; + reader->xsdValidCtxt = NULL; } reader->xsdPreserveCtxt = 0; if (reader->xsdSchemas != NULL) { xmlSchemaFree(reader->xsdSchemas); reader->xsdSchemas = NULL; - } + } return(0); - } + } if (reader->mode != XML_TEXTREADER_MODE_INITIAL) return(-1); if (reader->xsdPlug != NULL) { @@ -4120,7 +4278,7 @@ xmlTextReaderSetSchema(xmlTextReaderPtr reader, xmlSchemaPtr schema) { } if (reader->xsdValidCtxt != NULL) { if (! reader->xsdPreserveCtxt) - xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); + xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); reader->xsdValidCtxt = NULL; } reader->xsdPreserveCtxt = 0; @@ -4144,6 +4302,10 @@ xmlTextReaderSetSchema(xmlTextReaderPtr reader, xmlSchemaPtr schema) { reader->xsdValidCtxt = NULL; return(-1); } + xmlSchemaValidateSetLocator(reader->xsdValidCtxt, + xmlTextReaderLocator, + (void *) reader); + if (reader->errorFunc != NULL) { xmlSchemaSetValidErrors(reader->xsdValidCtxt, xmlTextReaderValidityErrorRelay, @@ -4161,67 +4323,91 @@ xmlTextReaderSetSchema(xmlTextReaderPtr reader, xmlSchemaPtr schema) { } /** - * xmlTextReaderRelaxNGValidate: + * xmlTextReaderRelaxNGValidateInternal: * @reader: the xmlTextReaderPtr used * @rng: the path to a RelaxNG schema or NULL + * @ctxt: the RelaxNG schema validation context or NULL + * @options: options (not yet used) * * Use RelaxNG to validate the document as it is processed. * Activation is only possible before the first Read(). - * if @rng is NULL, then RelaxNG validation is desactivated. + * If both @rng and @ctxt are NULL, then RelaxNG validation is deactivated. * - * Returns 0 in case the RelaxNG validation could be (des)activated and - * -1 in case of error. + * Returns 0 in case the RelaxNG validation could be (de)activated and + * -1 in case of error. */ -int -xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng) { - xmlRelaxNGParserCtxtPtr ctxt; - +static int +xmlTextReaderRelaxNGValidateInternal(xmlTextReaderPtr reader, + const char *rng, + xmlRelaxNGValidCtxtPtr ctxt, + int options ATTRIBUTE_UNUSED) +{ if (reader == NULL) - return(-1); - - if (rng == NULL) { - if (reader->rngValidCtxt != NULL) { + return(-1); + + if ((rng != NULL) && (ctxt != NULL)) + return (-1); + + if (((rng != NULL) || (ctxt != NULL)) && + ((reader->mode != XML_TEXTREADER_MODE_INITIAL) || + (reader->ctxt == NULL))) + return(-1); + + /* Cleanup previous validation stuff. */ + if (reader->rngValidCtxt != NULL) { + if ( !reader->rngPreserveCtxt) xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt); - reader->rngValidCtxt = NULL; - } - if (reader->rngSchemas != NULL) { - xmlRelaxNGFree(reader->rngSchemas); - reader->rngSchemas = NULL; - } - return(0); + reader->rngValidCtxt = NULL; } - if (reader->mode != XML_TEXTREADER_MODE_INITIAL) - return(-1); + reader->rngPreserveCtxt = 0; if (reader->rngSchemas != NULL) { xmlRelaxNGFree(reader->rngSchemas); reader->rngSchemas = NULL; } - if (reader->rngValidCtxt != NULL) { - xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt); - reader->rngValidCtxt = NULL; - } - ctxt = xmlRelaxNGNewParserCtxt(rng); - if (reader->errorFunc != NULL) { - xmlRelaxNGSetParserErrors(ctxt, - xmlTextReaderValidityErrorRelay, - xmlTextReaderValidityWarningRelay, - reader); + + if ((rng == NULL) && (ctxt == NULL)) { + /* We just want to deactivate the validation, so get out. */ + return(0); } + + + if (rng != NULL) { + xmlRelaxNGParserCtxtPtr pctxt; + /* Parse the schema and create validation environment. */ + + pctxt = xmlRelaxNGNewParserCtxt(rng); + if (reader->errorFunc != NULL) { + xmlRelaxNGSetParserErrors(pctxt, + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); + } if (reader->sErrorFunc != NULL) { - xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, - xmlTextReaderValidityStructuredRelay, - reader); - } - reader->rngSchemas = xmlRelaxNGParse(ctxt); - xmlRelaxNGFreeParserCtxt(ctxt); - if (reader->rngSchemas == NULL) - return(-1); - reader->rngValidCtxt = xmlRelaxNGNewValidCtxt(reader->rngSchemas); - if (reader->rngValidCtxt == NULL) { - xmlRelaxNGFree(reader->rngSchemas); - reader->rngSchemas = NULL; - return(-1); + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, + xmlTextReaderValidityStructuredRelay, + reader); + } + reader->rngSchemas = xmlRelaxNGParse(pctxt); + xmlRelaxNGFreeParserCtxt(pctxt); + if (reader->rngSchemas == NULL) + return(-1); + reader->rngValidCtxt = xmlRelaxNGNewValidCtxt(reader->rngSchemas); + if (reader->rngValidCtxt == NULL) { + xmlRelaxNGFree(reader->rngSchemas); + reader->rngSchemas = NULL; + return(-1); + } + } else { + /* Use the given validation context. */ + reader->rngValidCtxt = ctxt; + reader->rngPreserveCtxt = 1; } + /* + * Redirect the validation context's error channels to use + * the reader channels. + * TODO: In case the user provides the validation context we + * could make this redirection optional. + */ if (reader->errorFunc != NULL) { xmlRelaxNGSetValidErrors(reader->rngValidCtxt, xmlTextReaderValidityErrorRelay, @@ -4229,7 +4415,7 @@ xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng) { reader); } if (reader->sErrorFunc != NULL) { - xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, xmlTextReaderValidityStructuredRelay, reader); } @@ -4258,7 +4444,7 @@ xmlTextReaderSchemaValidateInternal(xmlTextReaderPtr reader, const char *xsd, xmlSchemaValidCtxtPtr ctxt, int options ATTRIBUTE_UNUSED) -{ +{ if (reader == NULL) return(-1); @@ -4269,7 +4455,7 @@ xmlTextReaderSchemaValidateInternal(xmlTextReaderPtr reader, ((reader->mode != XML_TEXTREADER_MODE_INITIAL) || (reader->ctxt == NULL))) return(-1); - + /* Cleanup previous validation stuff. */ if (reader->xsdPlug != NULL) { xmlSchemaSAXUnplug(reader->xsdPlug); @@ -4277,20 +4463,20 @@ xmlTextReaderSchemaValidateInternal(xmlTextReaderPtr reader, } if (reader->xsdValidCtxt != NULL) { if (! reader->xsdPreserveCtxt) - xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); + xmlSchemaFreeValidCtxt(reader->xsdValidCtxt); reader->xsdValidCtxt = NULL; } reader->xsdPreserveCtxt = 0; if (reader->xsdSchemas != NULL) { xmlSchemaFree(reader->xsdSchemas); reader->xsdSchemas = NULL; - } + } if ((xsd == NULL) && (ctxt == NULL)) { /* We just want to deactivate the validation, so get out. */ return(0); - } - + } + if (xsd != NULL) { xmlSchemaParserCtxtPtr pctxt; /* Parse the schema and create validation environment. */ @@ -4322,18 +4508,21 @@ xmlTextReaderSchemaValidateInternal(xmlTextReaderPtr reader, return(-1); } } else { - /* Use the given validation context. */ + /* Use the given validation context. */ reader->xsdValidCtxt = ctxt; reader->xsdPreserveCtxt = 1; reader->xsdPlug = xmlSchemaSAXPlug(reader->xsdValidCtxt, &(reader->ctxt->sax), &(reader->ctxt->userData)); - if (reader->xsdPlug == NULL) { + if (reader->xsdPlug == NULL) { reader->xsdValidCtxt = NULL; reader->xsdPreserveCtxt = 0; return(-1); } } + xmlSchemaValidateSetLocator(reader->xsdValidCtxt, + xmlTextReaderLocator, + (void *) reader); /* * Redirect the validation context's error channels to use * the reader channels. @@ -4347,7 +4536,7 @@ xmlTextReaderSchemaValidateInternal(xmlTextReaderPtr reader, reader); } if (reader->sErrorFunc != NULL) { - xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, + xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, xmlTextReaderValidityStructuredRelay, reader); } @@ -4394,6 +4583,46 @@ xmlTextReaderSchemaValidate(xmlTextReaderPtr reader, const char *xsd) { return(xmlTextReaderSchemaValidateInternal(reader, xsd, NULL, 0)); } + +/** + * xmlTextReaderRelaxNGValidateCtxt: + * @reader: the xmlTextReaderPtr used + * @ctxt: the RelaxNG schema validation context or NULL + * @options: options (not used yet) + * + * Use RelaxNG schema context to validate the document as it is processed. + * Activation is only possible before the first Read(). + * If @ctxt is NULL, then RelaxNG schema validation is deactivated. + * + * Returns 0 in case the schemas validation could be (de)activated and + * -1 in case of error. + */ +int +xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader, + xmlRelaxNGValidCtxtPtr ctxt, + int options) +{ + return(xmlTextReaderRelaxNGValidateInternal(reader, NULL, ctxt, options)); +} + +/** + * xmlTextReaderRelaxNGValidate: + * @reader: the xmlTextReaderPtr used + * @rng: the path to a RelaxNG schema or NULL + * + * Use RelaxNG schema to validate the document as it is processed. + * Activation is only possible before the first Read(). + * If @rng is NULL, then RelaxNG schema validation is deactivated. + * + * Returns 0 in case the schemas validation could be (de)activated and + * -1 in case of error. + */ +int +xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng) +{ + return(xmlTextReaderRelaxNGValidateInternal(reader, rng, NULL, 0)); +} + #endif /** @@ -4418,7 +4647,7 @@ xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader) { node = reader->curnode; else node = reader->node; - + if (XML_NAMESPACE_DECL == node->type) return(1); else @@ -4442,10 +4671,10 @@ xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader) { if (reader->doc != NULL) doc = reader->doc; else if (reader->ctxt != NULL) - doc = reader->ctxt->myDoc; + doc = reader->ctxt->myDoc; if (doc == NULL) return(NULL); - + if (doc->version == NULL) return(NULL); else @@ -4486,30 +4715,32 @@ xmlTextReaderStandalone(xmlTextReaderPtr reader) { /* helper to build a xmlMalloc'ed string from a format and va_list */ static char * xmlTextReaderBuildMessage(const char *msg, va_list ap) { - int size; + int size = 0; int chars; char *larger; - char *str; - - str = (char *) xmlMallocAtomic(150); - if (str == NULL) { - xmlGenericError(xmlGenericErrorContext, "xmlMalloc failed !\n"); - return NULL; - } - - size = 150; + char *str = NULL; + va_list aq; while (1) { - chars = vsnprintf(str, size, msg, ap); - if ((chars > -1) && (chars < size)) + VA_COPY(aq, ap); + chars = vsnprintf(str, size, msg, aq); + va_end(aq); + if (chars < 0) { + xmlGenericError(xmlGenericErrorContext, "vsnprintf failed !\n"); + if (str) + xmlFree(str); + return NULL; + } + if ((chars < size) || (size == MAX_ERR_MSG_SIZE)) break; - if (chars > -1) - size += chars + 1; - else - size += 100; + if (chars < MAX_ERR_MSG_SIZE) + size = chars + 1; + else + size = MAX_ERR_MSG_SIZE; if ((larger = (char *) xmlRealloc(str, size)) == NULL) { xmlGenericError(xmlGenericErrorContext, "xmlRealloc failed !\n"); - xmlFree(str); + if (str) + xmlFree(str); return NULL; } str = larger; @@ -4545,7 +4776,7 @@ xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator) { input = ctx->inputTab[ctx->inputNr - 2]; if (input != NULL) { ret = input->line; - } + } else { ret = -1; } @@ -4560,7 +4791,8 @@ xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator) { * * Obtain the base URI for the given locator. * - * Returns the base URI or NULL in case of error. + * Returns the base URI or NULL in case of error, + * if non NULL it need to be freed by the caller. */ xmlChar * xmlTextReaderLocatorBaseURI(xmlTextReaderLocatorPtr locator) { @@ -4581,7 +4813,7 @@ xmlTextReaderLocatorBaseURI(xmlTextReaderLocatorPtr locator) { input = ctx->inputTab[ctx->inputNr - 2]; if (input != NULL) { ret = xmlStrdup(BAD_CAST input->filename); - } + } else { ret = NULL; } @@ -4591,87 +4823,95 @@ xmlTextReaderLocatorBaseURI(xmlTextReaderLocatorPtr locator) { } static void -xmlTextReaderGenericError(void *ctxt, xmlParserSeverities severity, char *str) { - xmlParserCtxtPtr ctx = (xmlParserCtxtPtr)ctxt; - xmlTextReaderPtr reader = (xmlTextReaderPtr)ctx->_private; +xmlTextReaderGenericError(void *ctxt, xmlParserSeverities severity, + char *str) +{ + xmlParserCtxtPtr ctx = (xmlParserCtxtPtr) ctxt; + + xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private; if (str != NULL) { - if (reader->errorFunc) - reader->errorFunc(reader->errorFuncArg, - str, - severity, - (xmlTextReaderLocatorPtr)ctx); - xmlFree(str); + if (reader->errorFunc) + reader->errorFunc(reader->errorFuncArg, str, severity, + (xmlTextReaderLocatorPtr) ctx); + xmlFree(str); } } -static void -xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error) { - xmlParserCtxtPtr ctx = (xmlParserCtxtPtr) ctxt; - xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private; +static void +xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error) +{ + xmlParserCtxtPtr ctx = (xmlParserCtxtPtr) ctxt; + + xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private; - if (error && reader->sErrorFunc) { - reader->sErrorFunc(reader->errorFuncArg, - (xmlErrorPtr) error); - } + if (error && reader->sErrorFunc) { + reader->sErrorFunc(reader->errorFuncArg, (xmlErrorPtr) error); + } } -static void XMLCDECL -xmlTextReaderError(void *ctxt, const char *msg, ...) { +static void XMLCDECL +xmlTextReaderError(void *ctxt, const char *msg, ...) +{ va_list ap; - va_start(ap,msg); + va_start(ap, msg); xmlTextReaderGenericError(ctxt, XML_PARSER_SEVERITY_ERROR, - xmlTextReaderBuildMessage(msg,ap)); + xmlTextReaderBuildMessage(msg, ap)); va_end(ap); } -static void XMLCDECL -xmlTextReaderWarning(void *ctxt, const char *msg, ...) { +static void XMLCDECL +xmlTextReaderWarning(void *ctxt, const char *msg, ...) +{ va_list ap; - va_start(ap,msg); + va_start(ap, msg); xmlTextReaderGenericError(ctxt, XML_PARSER_SEVERITY_WARNING, - xmlTextReaderBuildMessage(msg,ap)); + xmlTextReaderBuildMessage(msg, ap)); va_end(ap); } -static void XMLCDECL -xmlTextReaderValidityError(void *ctxt, const char *msg, ...) { +static void XMLCDECL +xmlTextReaderValidityError(void *ctxt, const char *msg, ...) +{ va_list ap; + int len = xmlStrlen((const xmlChar *) msg); if ((len > 1) && (msg[len - 2] != ':')) { - /* - * some callbacks only report locator information: - * skip them (mimicking behaviour in error.c) - */ - va_start(ap,msg); - xmlTextReaderGenericError(ctxt, - XML_PARSER_SEVERITY_VALIDITY_ERROR, - xmlTextReaderBuildMessage(msg,ap)); - va_end(ap); + /* + * some callbacks only report locator information: + * skip them (mimicking behaviour in error.c) + */ + va_start(ap, msg); + xmlTextReaderGenericError(ctxt, + XML_PARSER_SEVERITY_VALIDITY_ERROR, + xmlTextReaderBuildMessage(msg, ap)); + va_end(ap); } } -static void XMLCDECL -xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...) { +static void XMLCDECL +xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...) +{ va_list ap; + int len = xmlStrlen((const xmlChar *) msg); if ((len != 0) && (msg[len - 1] != ':')) { - /* - * some callbacks only report locator information: - * skip them (mimicking behaviour in error.c) - */ - va_start(ap,msg); - xmlTextReaderGenericError(ctxt, - XML_PARSER_SEVERITY_VALIDITY_WARNING, - xmlTextReaderBuildMessage(msg,ap)); - va_end(ap); + /* + * some callbacks only report locator information: + * skip them (mimicking behaviour in error.c) + */ + va_start(ap, msg); + xmlTextReaderGenericError(ctxt, + XML_PARSER_SEVERITY_VALIDITY_WARNING, + xmlTextReaderBuildMessage(msg, ap)); + va_end(ap); } } @@ -4686,53 +4926,58 @@ xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...) { * If @f is NULL, the default error and warning handlers are restored. */ void -xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc f, - void *arg) { +xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc f, void *arg) +{ if (f != NULL) { - reader->ctxt->sax->error = xmlTextReaderError; - reader->ctxt->sax->serror = NULL; - reader->ctxt->vctxt.error = xmlTextReaderValidityError; - reader->ctxt->sax->warning = xmlTextReaderWarning; - reader->ctxt->vctxt.warning = xmlTextReaderValidityWarning; - reader->errorFunc = f; - reader->sErrorFunc = NULL; - reader->errorFuncArg = arg; + reader->ctxt->sax->error = xmlTextReaderError; + reader->ctxt->sax->serror = NULL; + reader->ctxt->vctxt.error = xmlTextReaderValidityError; + reader->ctxt->sax->warning = xmlTextReaderWarning; + reader->ctxt->vctxt.warning = xmlTextReaderValidityWarning; + reader->errorFunc = f; + reader->sErrorFunc = NULL; + reader->errorFuncArg = arg; #ifdef LIBXML_SCHEMAS_ENABLED - if (reader->rngValidCtxt) { - xmlRelaxNGSetValidErrors(reader->rngValidCtxt, - xmlTextReaderValidityErrorRelay, - xmlTextReaderValidityWarningRelay, - reader); - xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, reader); - } - if (reader->xsdValidCtxt) { - xmlSchemaSetValidErrors(reader->xsdValidCtxt, - xmlTextReaderValidityErrorRelay, - xmlTextReaderValidityWarningRelay, - reader); - xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, reader); - } + if (reader->rngValidCtxt) { + xmlRelaxNGSetValidErrors(reader->rngValidCtxt, + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, + reader); + } + if (reader->xsdValidCtxt) { + xmlSchemaSetValidErrors(reader->xsdValidCtxt, + xmlTextReaderValidityErrorRelay, + xmlTextReaderValidityWarningRelay, + reader); + xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, + reader); + } #endif - } - else { - /* restore defaults */ - reader->ctxt->sax->error = xmlParserError; - reader->ctxt->vctxt.error = xmlParserValidityError; - reader->ctxt->sax->warning = xmlParserWarning; - reader->ctxt->vctxt.warning = xmlParserValidityWarning; - reader->errorFunc = NULL; - reader->sErrorFunc = NULL; - reader->errorFuncArg = NULL; + } else { + /* restore defaults */ + reader->ctxt->sax->error = xmlParserError; + reader->ctxt->vctxt.error = xmlParserValidityError; + reader->ctxt->sax->warning = xmlParserWarning; + reader->ctxt->vctxt.warning = xmlParserValidityWarning; + reader->errorFunc = NULL; + reader->sErrorFunc = NULL; + reader->errorFuncArg = NULL; #ifdef LIBXML_SCHEMAS_ENABLED - if (reader->rngValidCtxt) { - xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, reader); - xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, reader); - } - if (reader->xsdValidCtxt) { - xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, reader); - xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, reader); - } + if (reader->rngValidCtxt) { + xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, + reader); + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, + reader); + } + if (reader->xsdValidCtxt) { + xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, + reader); + xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, + reader); + } #endif } } @@ -4748,54 +4993,59 @@ xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, * If @f is NULL, the default error and warning handlers are restored. */ void -xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, - xmlStructuredErrorFunc f, - void *arg) { - if (f != NULL) { - reader->ctxt->sax->error = NULL; - reader->ctxt->sax->serror = xmlTextReaderStructuredError; - reader->ctxt->vctxt.error = xmlTextReaderValidityError; - reader->ctxt->sax->warning = xmlTextReaderWarning; - reader->ctxt->vctxt.warning = xmlTextReaderValidityWarning; - reader->sErrorFunc = f; - reader->errorFunc = NULL; - reader->errorFuncArg = arg; +xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, + xmlStructuredErrorFunc f, void *arg) +{ + if (f != NULL) { + reader->ctxt->sax->error = NULL; + reader->ctxt->sax->serror = xmlTextReaderStructuredError; + reader->ctxt->vctxt.error = xmlTextReaderValidityError; + reader->ctxt->sax->warning = xmlTextReaderWarning; + reader->ctxt->vctxt.warning = xmlTextReaderValidityWarning; + reader->sErrorFunc = f; + reader->errorFunc = NULL; + reader->errorFuncArg = arg; #ifdef LIBXML_SCHEMAS_ENABLED - if (reader->rngValidCtxt) { - xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, reader); - xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, - xmlTextReaderValidityStructuredRelay, - reader); - } - if (reader->xsdValidCtxt) { - xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, reader); - xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, - xmlTextReaderValidityStructuredRelay, - reader); - } + if (reader->rngValidCtxt) { + xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, + reader); + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, + xmlTextReaderValidityStructuredRelay, + reader); + } + if (reader->xsdValidCtxt) { + xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, + reader); + xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, + xmlTextReaderValidityStructuredRelay, + reader); + } #endif - } - else { - /* restore defaults */ - reader->ctxt->sax->error = xmlParserError; - reader->ctxt->sax->serror = NULL; - reader->ctxt->vctxt.error = xmlParserValidityError; - reader->ctxt->sax->warning = xmlParserWarning; - reader->ctxt->vctxt.warning = xmlParserValidityWarning; - reader->errorFunc = NULL; - reader->sErrorFunc = NULL; - reader->errorFuncArg = NULL; + } else { + /* restore defaults */ + reader->ctxt->sax->error = xmlParserError; + reader->ctxt->sax->serror = NULL; + reader->ctxt->vctxt.error = xmlParserValidityError; + reader->ctxt->sax->warning = xmlParserWarning; + reader->ctxt->vctxt.warning = xmlParserValidityWarning; + reader->errorFunc = NULL; + reader->sErrorFunc = NULL; + reader->errorFuncArg = NULL; #ifdef LIBXML_SCHEMAS_ENABLED - if (reader->rngValidCtxt) { - xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, reader); - xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, reader); - } - if (reader->xsdValidCtxt) { - xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, reader); - xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, reader); - } + if (reader->rngValidCtxt) { + xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL, + reader); + xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL, + reader); + } + if (reader->xsdValidCtxt) { + xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL, + reader); + xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL, + reader); + } #endif - } + } } /** @@ -4807,17 +5057,19 @@ xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, * Returns the flag value 1 if valid, 0 if no, and -1 in case of error */ int -xmlTextReaderIsValid(xmlTextReaderPtr reader) { - if (reader == NULL) return(-1); +xmlTextReaderIsValid(xmlTextReaderPtr reader) +{ + if (reader == NULL) + return (-1); #ifdef LIBXML_SCHEMAS_ENABLED if (reader->validate == XML_TEXTREADER_VALIDATE_RNG) - return(reader->rngValidErrors == 0); + return (reader->rngValidErrors == 0); if (reader->validate == XML_TEXTREADER_VALIDATE_XSD) - return(reader->xsdValidErrors == 0); + return (reader->xsdValidErrors == 0); #endif if ((reader->ctxt != NULL) && (reader->ctxt->validate == 1)) - return(reader->ctxt->valid); - return(0); + return (reader->ctxt->valid); + return (0); } /** @@ -4829,14 +5081,14 @@ xmlTextReaderIsValid(xmlTextReaderPtr reader) { * Retrieve the error callback function and user argument. */ void -xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc *f, - void **arg) { - if (f != NULL) *f = reader->errorFunc; - if (arg != NULL) *arg = reader->errorFuncArg; +xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc * f, void **arg) +{ + if (f != NULL) + *f = reader->errorFunc; + if (arg != NULL) + *arg = reader->errorFuncArg; } - - /************************************************************************ * * * New set (2.6.0) of simpler and more flexible APIs * @@ -4846,22 +5098,26 @@ xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, /** * xmlTextReaderSetup: * @reader: an XML reader + * @input: xmlParserInputBufferPtr used to feed the reader, will + * be destroyed with it. * @URL: the base URL to use for the document * @encoding: the document encoding, or NULL * @options: a combination of xmlParserOption - * @reuse: keep the context for reuse * * Setup an XML reader with new options - * + * * Returns 0 in case of success and -1 in case of error. */ -static int +int xmlTextReaderSetup(xmlTextReaderPtr reader, xmlParserInputBufferPtr input, const char *URL, const char *encoding, int options) { - if (reader == NULL) + if (reader == NULL) { + if (input != NULL) + xmlFreeParserInputBuffer(input); return (-1); + } /* * we force the generation of compact text nodes on the reader @@ -4884,12 +5140,15 @@ xmlTextReaderSetup(xmlTextReaderPtr reader, reader->allocs |= XML_TEXTREADER_INPUT; } if (reader->buffer == NULL) - reader->buffer = xmlBufferCreateSize(100); + reader->buffer = xmlBufCreateSize(100); if (reader->buffer == NULL) { xmlGenericError(xmlGenericErrorContext, "xmlTextReaderSetup : malloc failed\n"); return (-1); } + /* no operation on a reader should require a huge buffer */ + xmlBufSetAllocationScheme(reader->buffer, + XML_BUFFER_ALLOC_BOUNDED); if (reader->sax == NULL) reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler)); if (reader->sax == NULL) { @@ -4925,13 +5184,14 @@ xmlTextReaderSetup(xmlTextReaderPtr reader, reader->node = NULL; reader->curnode = NULL; if (input != NULL) { - if (reader->input->buffer->use < 4) { + if (xmlBufUse(reader->input->buffer) < 4) { xmlParserInputBufferRead(input, 4); } if (reader->ctxt == NULL) { - if (reader->input->buffer->use >= 4) { + if (xmlBufUse(reader->input->buffer) >= 4) { reader->ctxt = xmlCreatePushParserCtxt(reader->sax, NULL, - (const char *) reader->input->buffer->content, 4, URL); + (const char *) xmlBufContent(reader->input->buffer), + 4, URL); reader->base = 0; reader->cur = 4; } else { @@ -4960,10 +5220,7 @@ xmlTextReaderSetup(xmlTextReaderPtr reader, inputStream->filename = (char *) xmlCanonicPath((const xmlChar *) URL); inputStream->buf = buf; - inputStream->base = inputStream->buf->buffer->content; - inputStream->cur = inputStream->buf->buffer->content; - inputStream->end = - &inputStream->buf->buffer->content[inputStream->buf->buffer->use]; + xmlBufResetInput(buf->buffer, inputStream); inputPush(reader->ctxt, inputStream); reader->cur = 0; @@ -5064,14 +5321,14 @@ xmlTextReaderByteConsumed(xmlTextReaderPtr reader) { return(-1); return(xmlByteConsumed(reader->ctxt)); } - + /** * xmlReaderWalker: * @doc: a preparsed document * * Create an xmltextReader for a preparsed document. - * + * * Returns the new reader or NULL in case of error. */ xmlTextReaderPtr @@ -5112,7 +5369,7 @@ xmlReaderWalker(xmlDocPtr doc) * * Create an xmltextReader for an XML in-memory document. * The parsing flags @options are a combination of xmlParserOption. - * + * * Returns the new reader or NULL in case of error. */ xmlTextReaderPtr @@ -5137,7 +5394,7 @@ xmlReaderForDoc(const xmlChar * cur, const char *URL, const char *encoding, * * parse an XML file from the filesystem or the network. * The parsing flags @options are a combination of xmlParserOption. - * + * * Returns the new reader or NULL in case of error. */ xmlTextReaderPtr @@ -5162,7 +5419,7 @@ xmlReaderForFile(const char *filename, const char *encoding, int options) * * Create an xmltextReader for an XML in-memory document. * The parsing flags @options are a combination of xmlParserOption. - * + * * Returns the new reader or NULL in case of error. */ xmlTextReaderPtr @@ -5198,7 +5455,7 @@ xmlReaderForMemory(const char *buffer, int size, const char *URL, * The parsing flags @options are a combination of xmlParserOption. * NOTE that the file descriptor will not be closed when the * reader is closed or reset. - * + * * Returns the new reader or NULL in case of error. */ xmlTextReaderPtr @@ -5235,7 +5492,7 @@ xmlReaderForFd(int fd, const char *URL, const char *encoding, int options) * * Create an xmltextReader for an XML document from I/O functions and source. * The parsing flags @options are a combination of xmlParserOption. - * + * * Returns the new reader or NULL in case of error. */ xmlTextReaderPtr @@ -5251,8 +5508,11 @@ xmlReaderForIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, XML_CHAR_ENCODING_NONE); - if (input == NULL) + if (input == NULL) { + if (ioclose != NULL) + ioclose(ioctx); return (NULL); + } reader = xmlNewTextReader(input, URL); if (reader == NULL) { xmlFreeParserInputBuffer(input); @@ -5270,7 +5530,7 @@ xmlReaderForIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, * * Setup an xmltextReader to parse a preparsed XML document. * This reuses the existing @reader xmlTextReader. - * + * * Returns 0 in case of success and -1 in case of error */ int @@ -5318,7 +5578,7 @@ xmlReaderNewWalker(xmlTextReaderPtr reader, xmlDocPtr doc) * Setup an xmltextReader to parse an XML in-memory document. * The parsing flags @options are a combination of xmlParserOption. * This reuses the existing @reader xmlTextReader. - * + * * Returns 0 in case of success and -1 in case of error */ int @@ -5348,7 +5608,7 @@ xmlReaderNewDoc(xmlTextReaderPtr reader, const xmlChar * cur, * parse an XML file from the filesystem or the network. * The parsing flags @options are a combination of xmlParserOption. * This reuses the existing @reader xmlTextReader. - * + * * Returns 0 in case of success and -1 in case of error */ int @@ -5382,7 +5642,7 @@ xmlReaderNewFile(xmlTextReaderPtr reader, const char *filename, * Setup an xmltextReader to parse an XML in-memory document. * The parsing flags @options are a combination of xmlParserOption. * This reuses the existing @reader xmlTextReader. - * + * * Returns 0 in case of success and -1 in case of error */ int @@ -5417,7 +5677,7 @@ xmlReaderNewMemory(xmlTextReaderPtr reader, const char *buffer, int size, * reader is closed or reset. * The parsing flags @options are a combination of xmlParserOption. * This reuses the existing @reader xmlTextReader. - * + * * Returns 0 in case of success and -1 in case of error */ int @@ -5452,7 +5712,7 @@ xmlReaderNewFd(xmlTextReaderPtr reader, int fd, * and source. * The parsing flags @options are a combination of xmlParserOption. * This reuses the existing @reader xmlTextReader. - * + * * Returns 0 in case of success and -1 in case of error */ int @@ -5469,16 +5729,21 @@ xmlReaderNewIO(xmlTextReaderPtr reader, xmlInputReadCallback ioread, input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, XML_CHAR_ENCODING_NONE); - if (input == NULL) + if (input == NULL) { + if (ioclose != NULL) + ioclose(ioctx); return (-1); + } return (xmlTextReaderSetup(reader, input, URL, encoding, options)); } + /************************************************************************ * * * Utilities * * * ************************************************************************/ #ifdef NOT_USED_YET + /** * xmlBase64Decode: * @in: the input buffer @@ -5494,22 +5759,34 @@ xmlReaderNewIO(xmlTextReaderPtr reader, xmlInputReadCallback ioread, */ static int xmlBase64Decode(const unsigned char *in, unsigned long *inlen, - unsigned char *to, unsigned long *tolen) { - unsigned long incur; /* current index in in[] */ - unsigned long inblk; /* last block index in in[] */ - unsigned long outcur; /* current index in out[] */ - unsigned long inmax; /* size of in[] */ - unsigned long outmax; /* size of out[] */ - unsigned char cur; /* the current value read from in[] */ - unsigned char intmp[4], outtmp[4]; /* temporary buffers for the convert */ - int nbintmp; /* number of byte in intmp[] */ - int is_ignore; /* cur should be ignored */ - int is_end = 0; /* the end of the base64 was found */ + unsigned char *to, unsigned long *tolen) +{ + unsigned long incur; /* current index in in[] */ + + unsigned long inblk; /* last block index in in[] */ + + unsigned long outcur; /* current index in out[] */ + + unsigned long inmax; /* size of in[] */ + + unsigned long outmax; /* size of out[] */ + + unsigned char cur; /* the current value read from in[] */ + + unsigned char intmp[4], outtmp[4]; /* temporary buffers for the convert */ + + int nbintmp; /* number of byte in intmp[] */ + + int is_ignore; /* cur should be ignored */ + + int is_end = 0; /* the end of the base64 was found */ + int retval = 1; + int i; if ((in == NULL) || (inlen == NULL) || (to == NULL) || (tolen == NULL)) - return(-1); + return (-1); incur = 0; inblk = 0; @@ -5535,16 +5812,17 @@ xmlBase64Decode(const unsigned char *in, unsigned long *inlen, cur = 63; else if (cur == '.') cur = 0; - else if (cur == '=') /*no op , end of the base64 stream */ + else if (cur == '=') /*no op , end of the base64 stream */ is_end = 1; else { is_ignore = 1; - if (nbintmp == 0) - inblk = incur; - } + if (nbintmp == 0) + inblk = incur; + } if (!is_ignore) { int nbouttmp = 3; + int is_break = 0; if (is_end) { @@ -5558,30 +5836,30 @@ xmlBase64Decode(const unsigned char *in, unsigned long *inlen, is_break = 1; } intmp[nbintmp++] = cur; - /* - * if intmp is full, push the 4byte sequence as a 3 byte - * sequence out - */ + /* + * if intmp is full, push the 4byte sequence as a 3 byte + * sequence out + */ if (nbintmp == 4) { nbintmp = 0; outtmp[0] = (intmp[0] << 2) | ((intmp[1] & 0x30) >> 4); outtmp[1] = ((intmp[1] & 0x0F) << 4) | ((intmp[2] & 0x3C) >> 2); outtmp[2] = ((intmp[2] & 0x03) << 6) | (intmp[3] & 0x3F); - if (outcur + 3 >= outmax) { - retval = 2; - break; - } + if (outcur + 3 >= outmax) { + retval = 2; + break; + } for (i = 0; i < nbouttmp; i++) - to[outcur++] = outtmp[i]; - inblk = incur; + to[outcur++] = outtmp[i]; + inblk = incur; } if (is_break) { - retval = 0; + retval = 0; break; - } + } } } @@ -5594,14 +5872,23 @@ xmlBase64Decode(const unsigned char *in, unsigned long *inlen, * Test routine for the xmlBase64Decode function */ #if 0 -int main(int argc, char **argv) { +int +main(int argc, char **argv) +{ char *input = " VW4 gcGV0 \n aXQgdGVzdCAuCg== "; + char output[100]; + char output2[100]; + char output3[100]; + unsigned long inlen = strlen(input); + unsigned long outlen = 100; + int ret; + unsigned long cons, tmp, tmp2, prod; /* @@ -5610,25 +5897,28 @@ int main(int argc, char **argv) { ret = xmlBase64Decode(input, &inlen, output, &outlen); output[outlen] = 0; - printf("ret: %d, inlen: %ld , outlen: %ld, output: '%s'\n", ret, inlen, outlen, output); - + printf("ret: %d, inlen: %ld , outlen: %ld, output: '%s'\n", ret, inlen, + outlen, output)indent: Standard input:179: Error:Unmatched #endif +; + /* * output chunking */ cons = 0; prod = 0; while (cons < inlen) { - tmp = 5; - tmp2 = inlen - cons; + tmp = 5; + tmp2 = inlen - cons; - printf("%ld %ld\n", cons, prod); - ret = xmlBase64Decode(&input[cons], &tmp2, &output2[prod], &tmp); - cons += tmp2; - prod += tmp; - printf("%ld %ld\n", cons, prod); + printf("%ld %ld\n", cons, prod); + ret = xmlBase64Decode(&input[cons], &tmp2, &output2[prod], &tmp); + cons += tmp2; + prod += tmp; + printf("%ld %ld\n", cons, prod); } output2[outlen] = 0; - printf("ret: %d, cons: %ld , prod: %ld, output: '%s'\n", ret, cons, prod, output2); + printf("ret: %d, cons: %ld , prod: %ld, output: '%s'\n", ret, cons, + prod, output2); /* * input chunking @@ -5636,20 +5926,21 @@ int main(int argc, char **argv) { cons = 0; prod = 0; while (cons < inlen) { - tmp = 100 - prod; - tmp2 = inlen - cons; - if (tmp2 > 5) - tmp2 = 5; + tmp = 100 - prod; + tmp2 = inlen - cons; + if (tmp2 > 5) + tmp2 = 5; - printf("%ld %ld\n", cons, prod); - ret = xmlBase64Decode(&input[cons], &tmp2, &output3[prod], &tmp); - cons += tmp2; - prod += tmp; - printf("%ld %ld\n", cons, prod); + printf("%ld %ld\n", cons, prod); + ret = xmlBase64Decode(&input[cons], &tmp2, &output3[prod], &tmp); + cons += tmp2; + prod += tmp; + printf("%ld %ld\n", cons, prod); } output3[outlen] = 0; - printf("ret: %d, cons: %ld , prod: %ld, output: '%s'\n", ret, cons, prod, output3); - return(0); + printf("ret: %d, cons: %ld , prod: %ld, output: '%s'\n", ret, cons, + prod, output3); + return (0); } #endif diff --git a/gnulib-local/lib/libxml/xmlreader.in.h b/gnulib-local/lib/libxml/xmlreader.in.h index 1d12988..2c99e3a 100644 --- a/gnulib-local/lib/libxml/xmlreader.in.h +++ b/gnulib-local/lib/libxml/xmlreader.in.h @@ -18,12 +18,25 @@ #include #endif -#ifdef LIBXML_READER_ENABLED - #ifdef __cplusplus extern "C" { #endif +/** + * xmlParserSeverities: + * + * How severe an error callback is when the per-reader error callback API + * is used. + */ +typedef enum { + XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, + XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, + XML_PARSER_SEVERITY_WARNING = 3, + XML_PARSER_SEVERITY_ERROR = 4 +} xmlParserSeverities; + +#ifdef LIBXML_READER_ENABLED + /** * xmlTextReaderMode: * @@ -42,7 +55,7 @@ typedef enum { * xmlParserProperties: * * Some common options to use with xmlTextReaderSetParserProp, but it - * is better to use xmlParserOption and the xmlReaderNewxxx and + * is better to use xmlParserOption and the xmlReaderNewxxx and * xmlReaderForxxx APIs now. */ typedef enum { @@ -52,19 +65,6 @@ typedef enum { XML_PARSER_SUBST_ENTITIES = 4 } xmlParserProperties; -/** - * xmlParserSeverities: - * - * How severe an error callback is when the per-reader error callback API - * is used. - */ -typedef enum { - XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, - XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, - XML_PARSER_SEVERITY_WARNING = 3, - XML_PARSER_SEVERITY_ERROR = 4 -} xmlParserSeverities; - /** * xmlReaderTypes: * @@ -111,128 +111,134 @@ typedef xmlTextReader *xmlTextReaderPtr; XMLPUBFUN xmlTextReaderPtr XMLCALL xmlNewTextReader (xmlParserInputBufferPtr input, const char *URI); -XMLPUBFUN xmlTextReaderPtr XMLCALL +XMLPUBFUN xmlTextReaderPtr XMLCALL xmlNewTextReaderFilename(const char *URI); -XMLPUBFUN void XMLCALL + +XMLPUBFUN void XMLCALL xmlFreeTextReader (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderSetup(xmlTextReaderPtr reader, + xmlParserInputBufferPtr input, const char *URL, + const char *encoding, int options); + /* * Iterators */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderRead (xmlTextReaderPtr reader); #ifdef LIBXML_WRITER_ENABLED -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadInnerXml (xmlTextReaderPtr reader); - -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadOuterXml (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderReadInnerXml(xmlTextReaderPtr reader); + +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderReadOuterXml(xmlTextReaderPtr reader); #endif -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadString (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderReadString (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader); /* * Attributes of the node */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderAttributeCount(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderDepth (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderHasAttributes(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderHasValue(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderIsDefault (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderNodeType (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderQuoteChar (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderReadState (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstLocalName (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstName (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstPrefix (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstString (xmlTextReaderPtr reader, - const xmlChar *str); -XMLPUBFUN const xmlChar * XMLCALL + const xmlChar *str); +XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstValue (xmlTextReaderPtr reader); /* * use the Const version of the routine for * better performance and simpler code */ -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderBaseUri (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderLocalName (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderName (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderNamespaceUri(xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderPrefix (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderXmlLang (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderValue (xmlTextReaderPtr reader); /* * Methods of the XmlTextReader */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderClose (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, int no); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderGetAttribute (xmlTextReaderPtr reader, const xmlChar *name); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, const xmlChar *localName, const xmlChar *namespaceURI); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL +XMLPUBFUN xmlParserInputBufferPtr XMLCALL xmlTextReaderGetRemainder (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, const xmlChar *prefix); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, int no); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, const xmlChar *name); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, const xmlChar *localName, const xmlChar *namespaceURI); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderMoveToElement (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderNormalization (xmlTextReaderPtr reader); XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstEncoding (xmlTextReaderPtr reader); @@ -240,14 +246,14 @@ XMLPUBFUN const xmlChar * XMLCALL /* * Extensions */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderSetParserProp (xmlTextReaderPtr reader, int prop, int value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderGetParserProp (xmlTextReaderPtr reader, int prop); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlTextReaderCurrentNode (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL @@ -256,41 +262,46 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlTextReaderPreserve (xmlTextReaderPtr reader); #ifdef LIBXML_PATTERN_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderPreservePattern(xmlTextReaderPtr reader, - const xmlChar *pattern, + const xmlChar *pattern, const xmlChar **namespaces); #endif /* LIBXML_PATTERN_ENABLED */ -XMLPUBFUN xmlDocPtr XMLCALL +XMLPUBFUN xmlDocPtr XMLCALL xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); -XMLPUBFUN xmlNodePtr XMLCALL +XMLPUBFUN xmlNodePtr XMLCALL xmlTextReaderExpand (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderNext (xmlTextReaderPtr reader); XMLPUBFUN int XMLCALL xmlTextReaderNextSibling (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderIsValid (xmlTextReaderPtr reader); #ifdef LIBXML_SCHEMAS_ENABLED -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL + xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader, + xmlRelaxNGValidCtxtPtr ctxt, + int options); + +XMLPUBFUN int XMLCALL xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema); XMLPUBFUN int XMLCALL xmlTextReaderSchemaValidate (xmlTextReaderPtr reader, - const char *xsd); + const char *xsd); XMLPUBFUN int XMLCALL xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader, xmlSchemaValidCtxtPtr ctxt, int options); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlTextReaderSetSchema (xmlTextReaderPtr reader, - xmlSchemaPtr schema); + xmlSchemaPtr schema); #endif XMLPUBFUN const xmlChar * XMLCALL xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader); @@ -376,33 +387,42 @@ XMLPUBFUN int XMLCALL * Error handling extensions */ typedef void * xmlTextReaderLocatorPtr; -typedef void (XMLCALL *xmlTextReaderErrorFunc) (void *arg, - const char *msg, - xmlParserSeverities severity, - xmlTextReaderLocatorPtr locator); -XMLPUBFUN int XMLCALL - xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); -/*int xmlTextReaderLocatorLinePosition(xmlTextReaderLocatorPtr locator);*/ -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); -XMLPUBFUN void XMLCALL - xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc f, - void *arg); + +/** + * xmlTextReaderErrorFunc: + * @arg: the user argument + * @msg: the message + * @severity: the severity of the error + * @locator: a locator indicating where the error occured + * + * Signature of an error callback from a reader parser + */ +typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg, + const char *msg, + xmlParserSeverities severity, + xmlTextReaderLocatorPtr locator); +XMLPUBFUN int XMLCALL + xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); +XMLPUBFUN void XMLCALL + xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc f, + void *arg); XMLPUBFUN void XMLCALL - xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, - xmlStructuredErrorFunc f, - void *arg); -XMLPUBFUN void XMLCALL - xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc *f, - void **arg); + xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, + xmlStructuredErrorFunc f, + void *arg); +XMLPUBFUN void XMLCALL + xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc *f, + void **arg); + +#endif /* LIBXML_READER_ENABLED */ #ifdef __cplusplus } #endif -#endif /* LIBXML_READER_ENABLED */ - #endif /* __XML_XMLREADER_H__ */ diff --git a/gnulib-local/lib/libxml/xmlregexp.c b/gnulib-local/lib/libxml/xmlregexp.c index e7d519e..3e912ab 100644 --- a/gnulib-local/lib/libxml/xmlregexp.c +++ b/gnulib-local/lib/libxml/xmlregexp.c @@ -1,7 +1,7 @@ /* * regexp.c: generic and extensible Regular Expression engine * - * Basically designed with the purpose of compiling regexps for + * Basically designed with the purpose of compiling regexps for * the variety of validation/shemas mechanisms now available in * XML related specifications these include: * - XML-1.0 DTD validation @@ -44,6 +44,9 @@ #define MAX_PUSH 10000000 +#ifdef ERROR +#undef ERROR +#endif #define ERROR(str) \ ctxt->error = XML_REGEXP_COMPILE_ERROR; \ xmlRegexpErrCompile(ctxt, str); @@ -54,21 +57,26 @@ #define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l) #define NEXTL(l) ctxt->cur += l; #define XML_REG_STRING_SEPARATOR '|' +/* + * Need PREV to check on a '-' within a Character Group. May only be used + * when it's guaranteed that cur is not at the beginning of ctxt->string! + */ +#define PREV (ctxt->cur[-1]) /** * TODO: * * macro to flag unimplemented blocks */ -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); /************************************************************************ - * * - * Datatypes and structures * - * * + * * + * Datatypes and structures * + * * ************************************************************************/ /* @@ -145,7 +153,8 @@ typedef enum { XML_REGEXP_START_STATE = 1, XML_REGEXP_FINAL_STATE, XML_REGEXP_TRANS_STATE, - XML_REGEXP_SINK_STATE + XML_REGEXP_SINK_STATE, + XML_REGEXP_UNREACH_STATE } xmlRegStateType; typedef enum { @@ -183,6 +192,7 @@ struct _xmlRegAtom { int neg; int codepoint; xmlRegStatePtr start; + xmlRegStatePtr start0; xmlRegStatePtr stop; int maxRanges; int nbRanges; @@ -212,6 +222,7 @@ struct _xmlRegTrans { struct _xmlAutomataState { xmlRegStateType type; xmlRegMarkedType mark; + xmlRegMarkedType markd; xmlRegMarkedType reached; int no; int maxTrans; @@ -226,6 +237,8 @@ struct _xmlAutomataState { typedef struct _xmlAutomata xmlRegParserCtxt; typedef xmlRegParserCtxt *xmlRegParserCtxtPtr; +#define AM_AUTOMATA_RNG 1 + struct _xmlAutomata { xmlChar *string; xmlChar *cur; @@ -253,6 +266,7 @@ struct _xmlAutomata { int determinist; int negs; + int flags; }; struct _xmlRegexp { @@ -264,6 +278,7 @@ struct _xmlRegexp { int nbCounters; xmlRegCounter *counters; int determinist; + int flags; /* * That's the compact form for determinists automatas */ @@ -346,9 +361,11 @@ static int xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint); static int xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg, int start, int end, const xmlChar *blockName); +void xmlAutomataSetFlags(xmlAutomataPtr am, int flags); + /************************************************************************ * * - * Regexp memory error handler * + * Regexp memory error handler * * * ************************************************************************/ /** @@ -395,9 +412,9 @@ xmlRegexpErrCompile(xmlRegParserCtxtPtr ctxt, const char *extra) } /************************************************************************ - * * - * Allocation/Deallocation * - * * + * * + * Allocation/Deallocation * + * * ************************************************************************/ static int xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt); @@ -427,6 +444,7 @@ xmlRegEpxFromParse(xmlRegParserCtxtPtr ctxt) { ret->nbCounters = ctxt->nbCounters; ret->counters = ctxt->counters; ret->determinist = ctxt->determinist; + ret->flags = ctxt->flags; if (ret->determinist == -1) { xmlRegexpIsDeterminist(ret); } @@ -726,12 +744,42 @@ xmlRegFreeRange(xmlRegRangePtr range) { xmlFree(range); } +/** + * xmlRegCopyRange: + * @range: the regexp range + * + * Copy a regexp range + * + * Returns the new copy or NULL in case of error. + */ +static xmlRegRangePtr +xmlRegCopyRange(xmlRegParserCtxtPtr ctxt, xmlRegRangePtr range) { + xmlRegRangePtr ret; + + if (range == NULL) + return(NULL); + + ret = xmlRegNewRange(ctxt, range->neg, range->type, range->start, + range->end); + if (ret == NULL) + return(NULL); + if (range->blockName != NULL) { + ret->blockName = xmlStrdup(range->blockName); + if (ret->blockName == NULL) { + xmlRegexpErrMemory(ctxt, "allocating range"); + xmlRegFreeRange(ret); + return(NULL); + } + } + return(ret); +} + /** * xmlRegNewAtom: * @ctxt: the regexp parser context * @type: the type of atom * - * Allocate a new regexp range + * Allocate a new atom * * Returns the new atom or NULL in case of error */ @@ -778,6 +826,52 @@ xmlRegFreeAtom(xmlRegAtomPtr atom) { xmlFree(atom); } +/** + * xmlRegCopyAtom: + * @ctxt: the regexp parser context + * @atom: the oiginal atom + * + * Allocate a new regexp range + * + * Returns the new atom or NULL in case of error + */ +static xmlRegAtomPtr +xmlRegCopyAtom(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) { + xmlRegAtomPtr ret; + + ret = (xmlRegAtomPtr) xmlMalloc(sizeof(xmlRegAtom)); + if (ret == NULL) { + xmlRegexpErrMemory(ctxt, "copying atom"); + return(NULL); + } + memset(ret, 0, sizeof(xmlRegAtom)); + ret->type = atom->type; + ret->quant = atom->quant; + ret->min = atom->min; + ret->max = atom->max; + if (atom->nbRanges > 0) { + int i; + + ret->ranges = (xmlRegRangePtr *) xmlMalloc(sizeof(xmlRegRangePtr) * + atom->nbRanges); + if (ret->ranges == NULL) { + xmlRegexpErrMemory(ctxt, "copying atom"); + goto error; + } + for (i = 0;i < atom->nbRanges;i++) { + ret->ranges[i] = xmlRegCopyRange(ctxt, atom->ranges[i]); + if (ret->ranges[i] == NULL) + goto error; + ret->nbRanges = i + 1; + } + } + return(ret); + +error: + xmlRegFreeAtom(ret); + return(NULL); +} + static xmlRegStatePtr xmlRegNewState(xmlRegParserCtxtPtr ctxt) { xmlRegStatePtr ret; @@ -841,9 +935,9 @@ xmlRegFreeParserCtxt(xmlRegParserCtxtPtr ctxt) { } /************************************************************************ - * * - * Display of Data structures * - * * + * * + * Display of Data structures * + * * ************************************************************************/ static void @@ -1050,7 +1144,7 @@ xmlRegPrintTrans(FILE *output, xmlRegTransPtr trans) { fprintf(output, "char %c ", trans->atom->codepoint); fprintf(output, "atom %d, to %d\n", trans->atom->no, trans->to); } - + static void xmlRegPrintState(FILE *output, xmlRegStatePtr state) { int i; @@ -1064,7 +1158,7 @@ xmlRegPrintState(FILE *output, xmlRegStatePtr state) { fprintf(output, "START "); if (state->type == XML_REGEXP_FINAL_STATE) fprintf(output, "FINAL "); - + fprintf(output, "%d, %d transitions:\n", state->no, state->nbTrans); for (i = 0;i < state->nbTrans; i++) { xmlRegPrintTrans(output, &(state->trans[i])); @@ -1114,12 +1208,12 @@ xmlRegPrintCtxt(FILE *output, xmlRegParserCtxtPtr ctxt) { #endif /************************************************************************ - * * + * * * Finite Automata structures manipulations * - * * + * * ************************************************************************/ -static void +static void xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom, int neg, xmlRegAtomType type, int start, int end, xmlChar *blockName) { @@ -1159,7 +1253,7 @@ xmlRegAtomAddRange(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom, return; range->blockName = blockName; atom->ranges[atom->nbRanges++] = range; - + } static int @@ -1190,7 +1284,7 @@ xmlRegGetCounter(xmlRegParserCtxtPtr ctxt) { return(ctxt->nbCounters++); } -static int +static int xmlRegAtomPush(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) { if (atom == NULL) { ERROR("atom push: atom is NULL"); @@ -1222,7 +1316,7 @@ xmlRegAtomPush(xmlRegParserCtxtPtr ctxt, xmlRegAtomPtr atom) { return(0); } -static void +static void xmlRegStateAddTransTo(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr target, int from) { if (target->maxTransTo == 0) { @@ -1250,7 +1344,7 @@ xmlRegStateAddTransTo(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr target, target->nbTransTo++; } -static void +static void xmlRegStateAddTrans(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, xmlRegAtomPtr atom, xmlRegStatePtr target, int counter, int count) { @@ -1316,7 +1410,7 @@ xmlRegStateAddTrans(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, printf("counted %d\n", counter); else if (atom == NULL) printf("epsilon transition\n"); - else if (atom != NULL) + else if (atom != NULL) xmlRegPrintAtom(stdout, atom); #endif @@ -1449,6 +1543,8 @@ xmlFAGenerateCountedTransition(xmlRegParserCtxtPtr ctxt, static int xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, xmlRegStatePtr to, xmlRegAtomPtr atom) { + xmlRegStatePtr end; + if (atom == NULL) { ERROR("genrate transition: atom == NULL"); return(-1); @@ -1468,7 +1564,7 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, */ xmlFAGenerateEpsilonTransition(ctxt, atom->stop, to); #ifdef DV - } else if ((to == NULL) && (atom->quant != XML_REGEXP_QUANT_RANGE) && + } else if ((to == NULL) && (atom->quant != XML_REGEXP_QUANT_RANGE) && (atom->quant != XML_REGEXP_QUANT_ONCE)) { to = xmlRegNewState(ctxt); xmlRegStatePush(ctxt, to); @@ -1482,10 +1578,15 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, /* * transition done to the state after end of atom. * 1. set transition from atom start to new state - * 2. set transition from atom end to this state. + * 2. set transition from atom end to this state. */ - xmlFAGenerateEpsilonTransition(ctxt, atom->start, 0); - xmlFAGenerateEpsilonTransition(ctxt, atom->stop, ctxt->state); + if (to == NULL) { + xmlFAGenerateEpsilonTransition(ctxt, atom->start, 0); + xmlFAGenerateEpsilonTransition(ctxt, atom->stop, + ctxt->state); + } else { + xmlFAGenerateEpsilonTransition(ctxt, atom->start, to); + } break; case XML_REGEXP_QUANT_MULT: atom->quant = XML_REGEXP_QUANT_ONCE; @@ -1498,58 +1599,89 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, break; case XML_REGEXP_QUANT_RANGE: { int counter; - xmlRegStatePtr newstate; + xmlRegStatePtr inter, newstate; /* - * This one is nasty: - * 1/ if range has minOccurs == 0, create a new state - * and create epsilon transitions from atom->start - * to atom->stop, as well as atom->start to the new - * state - * 2/ register a new counter - * 3/ register an epsilon transition associated to - * this counter going from atom->stop to atom->start - * 4/ create a new state - * 5/ generate a counted transition from atom->stop to - * that state + * create the final state now if needed */ - if (atom->min == 0) { - xmlFAGenerateEpsilonTransition(ctxt, atom->start, - atom->stop); + if (to != NULL) { + newstate = to; + } else { newstate = xmlRegNewState(ctxt); xmlRegStatePush(ctxt, newstate); - ctxt->state = newstate; + } + + /* + * The principle here is to use counted transition + * to avoid explosion in the number of states in the + * graph. This is clearly more complex but should not + * be exploitable at runtime. + */ + if ((atom->min == 0) && (atom->start0 == NULL)) { + xmlRegAtomPtr copy; + /* + * duplicate a transition based on atom to count next + * occurences after 1. We cannot loop to atom->start + * directly because we need an epsilon transition to + * newstate. + */ + /* ???? For some reason it seems we never reach that + case, I suppose this got optimized out before when + building the automata */ + copy = xmlRegCopyAtom(ctxt, atom); + if (copy == NULL) + return(-1); + copy->quant = XML_REGEXP_QUANT_ONCE; + copy->min = 0; + copy->max = 0; + + if (xmlFAGenerateTransitions(ctxt, atom->start, NULL, copy) + < 0) + return(-1); + inter = ctxt->state; + counter = xmlRegGetCounter(ctxt); + ctxt->counters[counter].min = atom->min - 1; + ctxt->counters[counter].max = atom->max - 1; + /* count the number of times we see it again */ + xmlFAGenerateCountedEpsilonTransition(ctxt, inter, + atom->stop, counter); + /* allow a way out based on the count */ + xmlFAGenerateCountedTransition(ctxt, inter, + newstate, counter); + /* and also allow a direct exit for 0 */ xmlFAGenerateEpsilonTransition(ctxt, atom->start, - newstate); + newstate); + } else { + /* + * either we need the atom at least once or there + * is an atom->start0 allowing to easilly plug the + * epsilon transition. + */ + counter = xmlRegGetCounter(ctxt); + ctxt->counters[counter].min = atom->min - 1; + ctxt->counters[counter].max = atom->max - 1; + /* count the number of times we see it again */ + xmlFAGenerateCountedEpsilonTransition(ctxt, atom->stop, + atom->start, counter); + /* allow a way out based on the count */ + xmlFAGenerateCountedTransition(ctxt, atom->stop, + newstate, counter); + /* and if needed allow a direct exit for 0 */ + if (atom->min == 0) + xmlFAGenerateEpsilonTransition(ctxt, atom->start0, + newstate); + } - counter = xmlRegGetCounter(ctxt); - ctxt->counters[counter].min = atom->min - 1; - ctxt->counters[counter].max = atom->max - 1; atom->min = 0; atom->max = 0; atom->quant = XML_REGEXP_QUANT_ONCE; - if (to != NULL) { - newstate = to; - } else { - newstate = xmlRegNewState(ctxt); - xmlRegStatePush(ctxt, newstate); - } ctxt->state = newstate; - xmlFAGenerateCountedTransition(ctxt, atom->stop, - newstate, counter); - - /* - * first check count and if OK jump forward; - * if checking fail increment count and jump back - */ - xmlFAGenerateCountedEpsilonTransition(ctxt, atom->stop, - atom->start, counter); } default: break; } return(0); - } + } if ((atom->min == 0) && (atom->max == 0) && (atom->quant == XML_REGEXP_QUANT_RANGE)) { /* @@ -1576,11 +1708,30 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, return(-1); } } + end = to; + if ((atom->quant == XML_REGEXP_QUANT_MULT) || + (atom->quant == XML_REGEXP_QUANT_PLUS)) { + /* + * Do not pollute the target state by adding transitions from + * it as it is likely to be the shared target of multiple branches. + * So isolate with an epsilon transition. + */ + xmlRegStatePtr tmp; + + tmp = xmlRegNewState(ctxt); + if (tmp != NULL) + xmlRegStatePush(ctxt, tmp); + else { + return(-1); + } + xmlFAGenerateEpsilonTransition(ctxt, tmp, to); + to = tmp; + } if (xmlRegAtomPush(ctxt, atom) < 0) { return(-1); } xmlRegStateAddTrans(ctxt, from, atom, to, -1, -1); - ctxt->state = to; + ctxt->state = end; switch (atom->quant) { case XML_REGEXP_QUANT_OPT: atom->quant = XML_REGEXP_QUANT_ONCE; @@ -1595,6 +1746,13 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, atom->quant = XML_REGEXP_QUANT_ONCE; xmlRegStateAddTrans(ctxt, to, atom, to, -1, -1); break; + case XML_REGEXP_QUANT_RANGE: +#if DV_test + if (atom->min == 0) { + xmlFAGenerateEpsilonTransition(ctxt, from, to); + } +#endif + break; default: break; } @@ -1605,7 +1763,7 @@ xmlFAGenerateTransitions(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr from, * xmlFAReduceEpsilonTransitions: * @ctxt: a regexp parser context * @fromnr: the from state - * @tonr: the to state + * @tonr: the to state * @counter: should that transition be associated to a counted * */ @@ -1649,7 +1807,7 @@ xmlFAReduceEpsilonTransitions(xmlRegParserCtxtPtr ctxt, int fromnr, int newto = to->trans[transnr].to; xmlRegStateAddTrans(ctxt, from, NULL, - ctxt->states[newto], + ctxt->states[newto], -1, to->trans[transnr].count); } else { #ifdef DEBUG_REGEXP_GRAPH @@ -1671,11 +1829,11 @@ xmlFAReduceEpsilonTransitions(xmlRegParserCtxtPtr ctxt, int fromnr, int newto = to->trans[transnr].to; if (to->trans[transnr].counter >= 0) { - xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom, - ctxt->states[newto], + xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom, + ctxt->states[newto], to->trans[transnr].counter, -1); } else { - xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom, + xmlRegStateAddTrans(ctxt, from, to->trans[transnr].atom, ctxt->states[newto], counter, -1); } } @@ -1687,7 +1845,7 @@ xmlFAReduceEpsilonTransitions(xmlRegParserCtxtPtr ctxt, int fromnr, * xmlFAEliminateSimpleEpsilonTransitions: * @ctxt: a regexp parser context * - * Eliminating general epsilon transitions can get costly in the general + * Eliminating general epsilon transitions can get costly in the general * algorithm due to the large amount of generated new transitions and * associated comparisons. However for simple epsilon transition used just * to separate building blocks when generating the automata this can be @@ -1709,6 +1867,8 @@ xmlFAEliminateSimpleEpsilonTransitions(xmlRegParserCtxtPtr ctxt) { continue; if (state->nbTrans != 1) continue; + if (state->type == XML_REGEXP_UNREACH_STATE) + continue; /* is the only transition out a basic transition */ if ((state->trans[0].atom == NULL) && (state->trans[0].to >= 0) && @@ -1721,48 +1881,37 @@ xmlFAEliminateSimpleEpsilonTransitions(xmlRegParserCtxtPtr ctxt) { #ifdef DEBUG_REGEXP_GRAPH printf("Found simple epsilon trans from start %d to %d\n", statenr, newto); -#endif +#endif } else { #ifdef DEBUG_REGEXP_GRAPH printf("Found simple epsilon trans from %d to %d\n", statenr, newto); -#endif +#endif for (i = 0;i < state->nbTransTo;i++) { tmp = ctxt->states[state->transTo[i]]; for (j = 0;j < tmp->nbTrans;j++) { if (tmp->trans[j].to == statenr) { - tmp->trans[j].to = newto; -#ifdef DEBUG_REGEXP_GRAPH - printf("Changed transition %d on %d to go to %d\n", - j, tmp->no, newto); -#endif - xmlRegStateAddTransTo(ctxt, ctxt->states[newto], - tmp->no); - } - } - } -#if 0 - for (i = 0;i < ctxt->nbStates;i++) { - tmp = ctxt->states[i]; - for (j = 0;j < tmp->nbTrans;j++) { - if (tmp->trans[j].to == statenr) { - tmp->trans[j].to = newto; #ifdef DEBUG_REGEXP_GRAPH printf("Changed transition %d on %d to go to %d\n", j, tmp->no, newto); -#endif +#endif + tmp->trans[j].to = -1; + xmlRegStateAddTrans(ctxt, tmp, tmp->trans[j].atom, + ctxt->states[newto], + tmp->trans[j].counter, + tmp->trans[j].count); } } } -#endif if (state->type == XML_REGEXP_FINAL_STATE) ctxt->states[newto]->type = XML_REGEXP_FINAL_STATE; /* eliminate the transition completely */ state->nbTrans = 0; + state->type = XML_REGEXP_UNREACH_STATE; } - + } } } @@ -1779,16 +1928,33 @@ xmlFAEliminateEpsilonTransitions(xmlRegParserCtxtPtr ctxt) { if (ctxt->states == NULL) return; + /* + * Eliminate simple epsilon transition and the associated unreachable + * states. + */ xmlFAEliminateSimpleEpsilonTransitions(ctxt); + for (statenr = 0;statenr < ctxt->nbStates;statenr++) { + state = ctxt->states[statenr]; + if ((state != NULL) && (state->type == XML_REGEXP_UNREACH_STATE)) { +#ifdef DEBUG_REGEXP_GRAPH + printf("Removed unreachable state %d\n", statenr); +#endif + xmlRegFreeState(state); + ctxt->states[statenr] = NULL; + } + } has_epsilon = 0; /* - * build the completed transitions bypassing the epsilons + * Build the completed transitions bypassing the epsilons * Use a marking algorithm to avoid loops - * mark sink states too. + * Mark sink states too. + * Process from the latests states backward to the start when + * there is long cascading epsilon chains this minimize the + * recursions and transition compares when adding the new ones */ - for (statenr = 0;statenr < ctxt->nbStates;statenr++) { + for (statenr = ctxt->nbStates - 1;statenr >= 0;statenr--) { state = ctxt->states[statenr]; if (state == NULL) continue; @@ -1812,8 +1978,9 @@ xmlFAEliminateEpsilonTransitions(xmlRegParserCtxtPtr ctxt) { printf("Found epsilon trans %d from %d to %d\n", transnr, statenr, newto); #endif - state->mark = XML_REGEXP_MARK_START; has_epsilon = 1; + state->trans[transnr].to = -2; + state->mark = XML_REGEXP_MARK_START; xmlFAReduceEpsilonTransitions(ctxt, statenr, newto, state->trans[transnr].counter); state->mark = XML_REGEXP_MARK_NORMAL; @@ -1932,12 +2099,13 @@ xmlFACompareRanges(xmlRegRangePtr range1, xmlRegRangePtr range2) { (range2->type == XML_REGEXP_EPSILON)) { return(0); } else if (range1->type == range2->type) { - if ((range1->type != XML_REGEXP_CHARVAL) || - (range1->end < range2->start) || - (range2->end < range1->start)) - ret = 1; - else + if (range1->type != XML_REGEXP_CHARVAL) + ret = 1; + else if ((range1->end < range2->start) || + (range2->end < range1->start)) ret = 0; + else + ret = 1; } else if (range1->type == XML_REGEXP_CHARVAL) { int codepoint; int neg = 0; @@ -1945,7 +2113,7 @@ xmlFACompareRanges(xmlRegRangePtr range1, xmlRegRangePtr range2) { /* * just check all codepoints in the range for acceptance, * this is usually way cheaper since done only once at - * compilation than testing over and over at runtime or + * compilation than testing over and over at runtime or * pushing too many states when evaluating. */ if (((range1->neg == 0) && (range2->neg != 0)) || @@ -2064,7 +2232,7 @@ xmlFACompareRanges(xmlRegRangePtr range1, xmlRegRangePtr range2) { if (((range1->neg == 0) && (range2->neg != 0)) || ((range1->neg != 0) && (range2->neg == 0))) ret = !ret; - return(1); + return(ret); } /** @@ -2272,6 +2440,7 @@ xmlFACompareAtomTypes(xmlRegAtomType type1, xmlRegAtomType type2) { * xmlFAEqualAtoms: * @atom1: an atom * @atom2: an atom + * @deep: if not set only compare string pointers * * Compares two atoms to check whether they are the same exactly * this is used to remove equivalent transitions @@ -2279,7 +2448,7 @@ xmlFACompareAtomTypes(xmlRegAtomType type1, xmlRegAtomType type2) { * Returns 1 if same and 0 otherwise */ static int -xmlFAEqualAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) { +xmlFAEqualAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2, int deep) { int ret = 0; if (atom1 == atom2) @@ -2294,8 +2463,11 @@ xmlFAEqualAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) { ret = 0; break; case XML_REGEXP_STRING: - ret = xmlStrEqual((xmlChar *)atom1->valuep, - (xmlChar *)atom2->valuep); + if (!deep) + ret = (atom1->valuep == atom2->valuep); + else + ret = xmlStrEqual((xmlChar *)atom1->valuep, + (xmlChar *)atom2->valuep); break; case XML_REGEXP_CHARVAL: ret = (atom1->codepoint == atom2->codepoint); @@ -2313,6 +2485,7 @@ xmlFAEqualAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) { * xmlFACompareAtoms: * @atom1: an atom * @atom2: an atom + * @deep: if not set only compare string pointers * * Compares two atoms to check whether they intersect in some ways, * this is used by xmlFAComputesDeterminism and xmlFARecurseDeterminism only @@ -2320,7 +2493,7 @@ xmlFAEqualAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) { * Returns 1 if yes and 0 otherwise */ static int -xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) { +xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2, int deep) { int ret = 1; if (atom1 == atom2) @@ -2346,8 +2519,11 @@ xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) { } switch (atom1->type) { case XML_REGEXP_STRING: - ret = xmlRegStrEqualWildcard((xmlChar *)atom1->valuep, - (xmlChar *)atom2->valuep); + if (!deep) + ret = (atom1->valuep != atom2->valuep); + else + ret = xmlRegStrEqualWildcard((xmlChar *)atom1->valuep, + (xmlChar *)atom2->valuep); break; case XML_REGEXP_EPSILON: goto not_determinist; @@ -2410,9 +2586,16 @@ xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, int res; int transnr, nbTrans; xmlRegTransPtr t1; + int deep = 1; if (state == NULL) return(ret); + if (state->markd == XML_REGEXP_MARK_VISITED) + return(ret); + + if (ctxt->flags & AM_AUTOMATA_RNG) + deep = 0; + /* * don't recurse on transitions potentially added in the course of * the elimination. @@ -2424,10 +2607,12 @@ xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, * check transitions conflicting with the one looked at */ if (t1->atom == NULL) { - if (t1->to == -1) + if (t1->to < 0) continue; + state->markd = XML_REGEXP_MARK_VISITED; res = xmlFARecurseDeterminism(ctxt, ctxt->states[t1->to], to, atom); + state->markd = 0; if (res == 0) { ret = 0; /* t1->nd = 1; */ @@ -2436,7 +2621,7 @@ xmlFARecurseDeterminism(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr state, } if (t1->to != to) continue; - if (xmlFACompareAtoms(t1->atom, atom)) { + if (xmlFACompareAtoms(t1->atom, atom, deep)) { ret = 0; /* mark the transition as non-deterministic */ t1->nd = 1; @@ -2460,6 +2645,7 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { xmlRegTransPtr t1, t2, last; int i; int ret = 1; + int deep = 1; #ifdef DEBUG_REGEXP_GRAPH printf("xmlFAComputesDeterminism\n"); @@ -2468,6 +2654,9 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { if (ctxt->determinist != -1) return(ctxt->determinist); + if (ctxt->flags & AM_AUTOMATA_RNG) + deep = 0; + /* * First cleanup the automata removing cancelled transitions */ @@ -2495,7 +2684,13 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { continue; if (t2->atom != NULL) { if (t1->to == t2->to) { - if (xmlFAEqualAtoms(t1->atom, t2->atom)) + /* + * Here we use deep because we want to keep the + * transitions which indicate a conflict + */ + if (xmlFAEqualAtoms(t1->atom, t2->atom, deep) && + (t1->counter == t2->counter) && + (t1->count == t2->count)) t2->to = -1; /* eliminated */ } } @@ -2530,8 +2725,11 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { if (t2->to == -1) /* eliminated */ continue; if (t2->atom != NULL) { - /* not determinist ! */ - if (xmlFACompareAtoms(t1->atom, t2->atom)) { + /* + * But here we don't use deep because we want to + * find transitions which indicate a conflict + */ + if (xmlFACompareAtoms(t1->atom, t2->atom, 1)) { ret = 0; /* mark the transitions as non-deterministic ones */ t1->nd = 1; @@ -2583,9 +2781,9 @@ xmlFAComputesDeterminism(xmlRegParserCtxtPtr ctxt) { } /************************************************************************ - * * + * * * Routines to check input against transition atoms * - * * + * * ************************************************************************/ static int @@ -2614,7 +2812,7 @@ xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg, case XML_REGEXP_NOTINITNAME: neg = !neg; case XML_REGEXP_INITNAME: - ret = (IS_LETTER(codepoint) || + ret = (IS_LETTER(codepoint) || (codepoint == '_') || (codepoint == ':')); break; case XML_REGEXP_NOTNAMECHAR: @@ -2862,9 +3060,9 @@ xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint) { } /************************************************************************ - * * + * * * Saving and restoring state of an execution context * - * * + * * ************************************************************************/ #ifdef DEBUG_REGEXP_EXEC @@ -2875,7 +3073,8 @@ xmlFARegDebugExec(xmlRegExecCtxtPtr exec) { int i; printf(": "); for (i = 0;(i < 3) && (i < exec->inputStackNr);i++) - printf("%s ", exec->inputStack[exec->inputStackNr - (i + 1)]); + printf("%s ", (const char *) + exec->inputStack[exec->inputStackNr - (i + 1)].value); } else { printf(": %s", &(exec->inputString[exec->index])); } @@ -2963,8 +3162,10 @@ xmlFARegExecRollBack(xmlRegExecCtxtPtr exec) { exec->status = -6; return; } - memcpy(exec->counts, exec->rollbacks[exec->nbRollbacks].counts, + if (exec->counts) { + memcpy(exec->counts, exec->rollbacks[exec->nbRollbacks].counts, exec->comp->nbCounters * sizeof(int)); + } } #ifdef DEBUG_REGEXP_EXEC @@ -2974,9 +3175,9 @@ xmlFARegExecRollBack(xmlRegExecCtxtPtr exec) { } /************************************************************************ - * * + * * * Verifier, running an input against a compiled regexp * - * * + * * ************************************************************************/ static int @@ -3008,9 +3209,10 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) { memset(exec->counts, 0, comp->nbCounters * sizeof(int)); } else exec->counts = NULL; - while ((exec->status == 0) && + while ((exec->status == 0) && (exec->state != NULL) && ((exec->inputString[exec->index] != 0) || - (exec->state->type != XML_REGEXP_FINAL_STATE))) { + ((exec->state != NULL) && + (exec->state->type != XML_REGEXP_FINAL_STATE)))) { xmlRegTransPtr trans; xmlRegAtomPtr atom; @@ -3081,12 +3283,22 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) { * this is a multiple input sequence * If there is a counter associated increment it now. * before potentially saving and rollback + * do not increment if the counter is already over the + * maximum limit in which case get to next transition */ if (trans->counter >= 0) { - if (exec->counts == NULL) { + xmlRegCounterPtr counter; + + if ((exec->counts == NULL) || + (exec->comp == NULL) || + (exec->comp->counters == NULL)) { exec->status = -1; goto error; } + counter = &exec->comp->counters[trans->counter]; + if (exec->counts[trans->counter] >= counter->max) + continue; /* for loop on transitions */ + #ifdef DEBUG_REGEXP_EXEC printf("Increasing count %d\n", trans->counter); #endif @@ -3182,10 +3394,18 @@ xmlFARegExec(xmlRegexpPtr comp, const xmlChar *content) { xmlFARegExecSave(exec); } if (trans->counter >= 0) { - if (exec->counts == NULL) { - exec->status = -1; + xmlRegCounterPtr counter; + + /* make sure we don't go over the counter maximum value */ + if ((exec->counts == NULL) || + (exec->comp == NULL) || + (exec->comp->counters == NULL)) { + exec->status = -1; goto error; } + counter = &exec->comp->counters[trans->counter]; + if (exec->counts[trans->counter] >= counter->max) + continue; /* for loop on transitions */ #ifdef DEBUG_REGEXP_EXEC printf("Increasing count %d\n", trans->counter); #endif @@ -3243,6 +3463,8 @@ error: } xmlFree(exec->rollbacks); } + if (exec->state == NULL) + return(-1); if (exec->counts != NULL) xmlFree(exec->counts); if (exec->status == 0) @@ -3256,9 +3478,9 @@ error: } /************************************************************************ - * * + * * * Progressive interface to the verifier one atom at a time * - * * + * * ************************************************************************/ #ifdef DEBUG_ERR static void testerr(xmlRegExecCtxtPtr exec); @@ -3375,7 +3597,7 @@ xmlFARegExecSaveInputString(xmlRegExecCtxtPtr exec, const xmlChar *value, #endif if (exec->inputStackMax == 0) { exec->inputStackMax = 4; - exec->inputStack = (xmlRegInputTokenPtr) + exec->inputStack = (xmlRegInputTokenPtr) xmlMalloc(exec->inputStackMax * sizeof(xmlRegInputToken)); if (exec->inputStack == NULL) { xmlRegexpErrMemory(NULL, "pushing input string"); @@ -3404,11 +3626,11 @@ xmlFARegExecSaveInputString(xmlRegExecCtxtPtr exec, const xmlChar *value, /** * xmlRegStrEqualWildcard: - * @expStr: the string to be evaluated + * @expStr: the string to be evaluated * @valStr: the validation string * * Checks if both strings are equal or have the same content. "*" - * can be used as a wildcard in @valStr; "|" is used as a seperator of + * can be used as a wildcard in @valStr; "|" is used as a seperator of * substrings in both @expStr and @valStr. * * Returns 1 if the comparison is satisfied and the number of substrings @@ -3474,7 +3696,7 @@ xmlRegCompactPushString(xmlRegExecCtxtPtr exec, if ((comp == NULL) || (comp->compact == NULL) || (comp->stringMap == NULL)) return(-1); - + if (value == NULL) { /* * are we at a final state ? @@ -3495,9 +3717,9 @@ xmlRegCompactPushString(xmlRegExecCtxtPtr exec, for (i = 0;i < comp->nbstrings;i++) { target = comp->compact[state * (comp->nbstrings + 1) + i + 1]; if ((target > 0) && (target <= comp->nbstates)) { - target--; /* to avoid 0 */ + target--; /* to avoid 0 */ if (xmlRegStrEqualWildcard(comp->stringMap[i], value)) { - exec->index = target; + exec->index = target; if ((exec->callback != NULL) && (comp->transdata != NULL)) { exec->callback(exec->data, value, comp->transdata[state * comp->nbstrings + i], data); @@ -3631,7 +3853,7 @@ xmlRegExecPushStringInternal(xmlRegExecCtxtPtr exec, const xmlChar *value, continue; counter = &exec->comp->counters[t->counter]; count = exec->counts[t->counter]; - if ((count < counter->max) && + if ((count < counter->max) && (t->atom != NULL) && (xmlStrEqual(value, t->atom->valuep))) { ret = 0; @@ -3871,7 +4093,7 @@ rollback: */ exec->determinist = 0; xmlFARegExecRollBack(exec); - if (exec->status == 0) { + if ((exec->inputStack != NULL ) && (exec->status == 0)) { value = exec->inputStack[exec->index].value; data = exec->inputStack[exec->index].data; #ifdef DEBUG_PUSH @@ -3989,7 +4211,7 @@ xmlRegExecGetValues(xmlRegExecCtxtPtr exec, int err, int maxval; int nb = 0; - if ((exec == NULL) || (nbval == NULL) || (nbneg == NULL) || + if ((exec == NULL) || (nbval == NULL) || (nbneg == NULL) || (values == NULL) || (*nbval <= 0)) return(-1); @@ -4086,7 +4308,7 @@ xmlRegExecGetValues(xmlRegExecCtxtPtr exec, int err, (*nbval)++; } } else { - if ((exec->comp->states[trans->to] != NULL) && + if ((exec->comp != NULL) && (exec->comp->states[trans->to] != NULL) && (exec->comp->states[trans->to]->type != XML_REGEXP_SINK_STATE)) { if (atom->neg) @@ -4095,7 +4317,7 @@ xmlRegExecGetValues(xmlRegExecCtxtPtr exec, int err, values[nb++] = (xmlChar *) atom->valuep; (*nbval)++; } - } + } } for (transno = 0; (transno < state->nbTrans) && (nb < maxval); @@ -4122,7 +4344,7 @@ xmlRegExecGetValues(xmlRegExecCtxtPtr exec, int err, values[nb++] = (xmlChar *) atom->valuep; (*nbneg)++; } - } + } } } return(0); @@ -4353,10 +4575,10 @@ progress: } #endif /************************************************************************ - * * + * * * Parser for the Schemas Datatype Regular Expressions * * http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#regexs * - * * + * * ************************************************************************/ /** @@ -4385,7 +4607,7 @@ xmlFAIsChar(xmlRegParserCtxtPtr ctxt) { * * [27] charProp ::= IsCategory | IsBlock * [28] IsCategory ::= Letters | Marks | Numbers | Punctuation | - * Separators | Symbols | Others + * Separators | Symbols | Others * [29] Letters ::= 'L' [ultmo]? * [30] Marks ::= 'M' [nce]? * [31] Numbers ::= 'N' [dlo]? @@ -4400,7 +4622,7 @@ xmlFAParseCharProp(xmlRegParserCtxtPtr ctxt) { int cur; xmlRegAtomType type = (xmlRegAtomType) 0; xmlChar *blockName = NULL; - + cur = CUR; if (cur == 'L') { NEXT; @@ -4572,15 +4794,15 @@ xmlFAParseCharProp(xmlRegParserCtxtPtr ctxt) { NEXT; start = ctxt->cur; cur = CUR; - if (((cur >= 'a') && (cur <= 'z')) || - ((cur >= 'A') && (cur <= 'Z')) || - ((cur >= '0') && (cur <= '9')) || + if (((cur >= 'a') && (cur <= 'z')) || + ((cur >= 'A') && (cur <= 'Z')) || + ((cur >= '0') && (cur <= '9')) || (cur == 0x2D)) { NEXT; cur = CUR; - while (((cur >= 'a') && (cur <= 'z')) || - ((cur >= 'A') && (cur <= 'Z')) || - ((cur >= '0') && (cur <= '9')) || + while (((cur >= 'a') && (cur <= 'z')) || + ((cur >= 'A') && (cur <= 'Z')) || + ((cur >= '0') && (cur <= '9')) || (cur == 0x2D)) { NEXT; cur = CUR; @@ -4606,7 +4828,7 @@ xmlFAParseCharProp(xmlRegParserCtxtPtr ctxt) { * xmlFAParseCharClassEsc: * @ctxt: a regexp parser context * - * [23] charClassEsc ::= ( SingleCharEsc | MultiCharEsc | catEsc | complEsc ) + * [23] charClassEsc ::= ( SingleCharEsc | MultiCharEsc | catEsc | complEsc ) * [24] SingleCharEsc ::= '\' [nrt\|.?*+(){}#x2D#x5B#x5D#x5E] * [25] catEsc ::= '\p{' charProp '}' * [26] complEsc ::= '\P{' charProp '}' @@ -4682,6 +4904,17 @@ xmlFAParseCharClassEsc(xmlRegParserCtxtPtr ctxt) { } } } else if (ctxt->atom->type == XML_REGEXP_RANGES) { + switch (cur) { + case 'n': + cur = '\n'; + break; + case 'r': + cur = '\r'; + break; + case 't': + cur = '\t'; + break; + } xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, XML_REGEXP_CHARVAL, cur, cur, NULL); } @@ -4692,34 +4925,34 @@ xmlFAParseCharClassEsc(xmlRegParserCtxtPtr ctxt) { xmlRegAtomType type = XML_REGEXP_ANYSPACE; switch (cur) { - case 's': + case 's': type = XML_REGEXP_ANYSPACE; break; - case 'S': + case 'S': type = XML_REGEXP_NOTSPACE; break; - case 'i': + case 'i': type = XML_REGEXP_INITNAME; break; - case 'I': + case 'I': type = XML_REGEXP_NOTINITNAME; break; - case 'c': + case 'c': type = XML_REGEXP_NAMECHAR; break; - case 'C': + case 'C': type = XML_REGEXP_NOTNAMECHAR; break; - case 'd': + case 'd': type = XML_REGEXP_DECIMAL; break; - case 'D': + case 'D': type = XML_REGEXP_NOTDECIMAL; break; - case 'w': + case 'w': type = XML_REGEXP_REALCHAR; break; - case 'W': + case 'W': type = XML_REGEXP_NOTREALCHAR; break; } @@ -4730,72 +4963,16 @@ xmlFAParseCharClassEsc(xmlRegParserCtxtPtr ctxt) { xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, type, 0, 0, NULL); } - } -} - -/** - * xmlFAParseCharRef: - * @ctxt: a regexp parser context - * - * [19] XmlCharRef ::= ( '&#' [0-9]+ ';' ) | (' &#x' [0-9a-fA-F]+ ';' ) - */ -static int -xmlFAParseCharRef(xmlRegParserCtxtPtr ctxt) { - int ret = 0, cur; - - if ((CUR != '&') || (NXT(1) != '#')) - return(-1); - NEXT; - NEXT; - cur = CUR; - if (cur == 'x') { - NEXT; - cur = CUR; - if (((cur >= '0') && (cur <= '9')) || - ((cur >= 'a') && (cur <= 'f')) || - ((cur >= 'A') && (cur <= 'F'))) { - while (((cur >= '0') && (cur <= '9')) || - ((cur >= 'a') && (cur <= 'f')) || - ((cur >= 'A') && (cur <= 'F'))) { - if ((cur >= '0') && (cur <= '9')) - ret = ret * 16 + cur - '0'; - else if ((cur >= 'a') && (cur <= 'f')) - ret = ret * 16 + 10 + (cur - 'a'); - else - ret = ret * 16 + 10 + (cur - 'A'); - NEXT; - cur = CUR; - } - } else { - ERROR("Char ref: expecting [0-9A-F]"); - return(-1); - } - } else { - if ((cur >= '0') && (cur <= '9')) { - while ((cur >= '0') && (cur <= '9')) { - ret = ret * 10 + cur - '0'; - NEXT; - cur = CUR; - } - } else { - ERROR("Char ref: expecting [0-9]"); - return(-1); - } - } - if (cur != ';') { - ERROR("Char ref: expecting ';'"); - return(-1); } else { - NEXT; + ERROR("Wrong escape sequence, misuse of character '\\'"); } - return(ret); } /** * xmlFAParseCharRange: * @ctxt: a regexp parser context * - * [17] charRange ::= seRange | XmlCharRef | XmlCharIncDash + * [17] charRange ::= seRange | XmlCharRef | XmlCharIncDash * [18] seRange ::= charOrEsc '-' charOrEsc * [20] charOrEsc ::= XmlChar | SingleCharEsc * [21] XmlChar ::= [^\#x2D#x5B#x5D] @@ -4812,12 +4989,6 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) { return; } - if ((CUR == '&') && (NXT(1) == '#')) { - end = start = xmlFAParseCharRef(ctxt); - xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, - XML_REGEXP_CHARVAL, start, end, NULL); - return; - } cur = CUR; if (cur == '\\') { NEXT; @@ -4842,10 +5013,15 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) { ERROR("Expecting a char range"); return; } - NEXTL(len); - if (start == '-') { + /* + * Since we are "inside" a range, we can assume ctxt->cur is past + * the start of ctxt->string, and PREV should be safe + */ + if ((start == '-') && (NXT(1) != ']') && (PREV != '[') && (PREV != '^')) { + NEXTL(len); return; } + NEXTL(len); cur = CUR; if ((cur != '-') || (NXT(1) == ']')) { xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg, @@ -4896,7 +5072,7 @@ xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) { static void xmlFAParsePosCharGroup(xmlRegParserCtxtPtr ctxt) { do { - if ((CUR == '\\') || (CUR == '.')) { + if (CUR == '\\') { xmlFAParseCharClassEsc(ctxt); } else { xmlFAParseCharRange(ctxt); @@ -4911,7 +5087,7 @@ xmlFAParsePosCharGroup(xmlRegParserCtxtPtr ctxt) { * * [13] charGroup ::= posCharGroup | negCharGroup | charClassSub * [15] negCharGroup ::= '^' posCharGroup - * [16] charClassSub ::= ( posCharGroup | negCharGroup ) '-' charClassExpr + * [16] charClassSub ::= ( posCharGroup | negCharGroup ) '-' charClassExpr * [12] charClassExpr ::= '[' charGroup ']' */ static void @@ -5085,9 +5261,15 @@ xmlFAParseAtom(xmlRegParserCtxtPtr ctxt) { } else if (CUR == ')') { return(0); } else if (CUR == '(') { - xmlRegStatePtr start, oldend; + xmlRegStatePtr start, oldend, start0; NEXT; + /* + * this extra Epsilon transition is needed if we count with 0 allowed + * unfortunately this can't be known at that point + */ + xmlFAGenerateEpsilonTransition(ctxt, ctxt->state, NULL); + start0 = ctxt->state; xmlFAGenerateEpsilonTransition(ctxt, ctxt->state, NULL); start = ctxt->state; oldend = ctxt->end; @@ -5103,6 +5285,7 @@ xmlFAParseAtom(xmlRegParserCtxtPtr ctxt) { if (ctxt->atom == NULL) return(-1); ctxt->atom->start = start; + ctxt->atom->start0 = start0; ctxt->atom->stop = ctxt->state; ctxt->end = oldend; return(1); @@ -5152,7 +5335,7 @@ xmlFAParseBranch(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr to) { previous = ctxt->state; ret = xmlFAParsePiece(ctxt); if (ret != 0) { - if (xmlFAGenerateTransitions(ctxt, previous, + if (xmlFAGenerateTransitions(ctxt, previous, (CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0) return(-1); previous = ctxt->state; @@ -5161,7 +5344,7 @@ xmlFAParseBranch(xmlRegParserCtxtPtr ctxt, xmlRegStatePtr to) { while ((ret != 0) && (ctxt->error == 0)) { ret = xmlFAParsePiece(ctxt); if (ret != 0) { - if (xmlFAGenerateTransitions(ctxt, previous, + if (xmlFAGenerateTransitions(ctxt, previous, (CUR=='|' || CUR==')') ? to : NULL, ctxt->atom) < 0) return(-1); previous = ctxt->state; @@ -5199,6 +5382,10 @@ xmlFAParseRegExp(xmlRegParserCtxtPtr ctxt, int top) { end = ctxt->state; while ((CUR == '|') && (ctxt->error == 0)) { NEXT; + if (CUR == 0) { + ERROR("expecting a branch after |") + return; + } ctxt->state = start; ctxt->end = NULL; xmlFAParseBranch(ctxt, end); @@ -5210,9 +5397,9 @@ xmlFAParseRegExp(xmlRegParserCtxtPtr ctxt, int top) { } /************************************************************************ - * * - * The basic API * - * * + * * + * The basic API * + * * ************************************************************************/ /** @@ -5281,6 +5468,10 @@ xmlRegexpCompile(const xmlChar *regexp) { if (CUR != 0) { ERROR("xmlFAParseRegExp: extra characters"); } + if (ctxt->error != 0) { + xmlRegFreeParserCtxt(ctxt); + return(NULL); + } ctxt->end = ctxt->state; ctxt->start->type = XML_REGEXP_START_STATE; ctxt->end->type = XML_REGEXP_FINAL_STATE; @@ -5345,10 +5536,12 @@ xmlRegexpIsDeterminist(xmlRegexpPtr comp) { am->nbStates = comp->nbStates; am->states = comp->states; am->determinist = -1; + am->flags = comp->flags; ret = xmlFAComputesDeterminism(am); am->atoms = NULL; am->states = NULL; xmlFreeAutomata(am); + comp->determinist = ret; return(ret); } @@ -5393,9 +5586,9 @@ xmlRegFreeRegexp(xmlRegexpPtr regexp) { #ifdef LIBXML_AUTOMATA_ENABLED /************************************************************************ - * * - * The Automata interface * - * * + * * + * The Automata interface * + * * ************************************************************************/ /** @@ -5426,6 +5619,7 @@ xmlNewAutomata(void) { xmlFreeAutomata(ctxt); return(NULL); } + ctxt->flags = 0; return(ctxt); } @@ -5443,6 +5637,20 @@ xmlFreeAutomata(xmlAutomataPtr am) { xmlRegFreeParserCtxt(am); } +/** + * xmlAutomataSetFlags: + * @am: an automata + * @flags: a set of internal flags + * + * Set some flags on the automata + */ +void +xmlAutomataSetFlags(xmlAutomataPtr am, int flags) { + if (am == NULL) + return; + am->flags |= flags; +} + /** * xmlAutomataGetInitState: * @am: an automata @@ -5501,8 +5709,6 @@ xmlAutomataNewTransition(xmlAutomataPtr am, xmlAutomataStatePtr from, if (atom == NULL) return(NULL); atom->data = data; - if (atom == NULL) - return(NULL); atom->valuep = xmlStrdup(token); if (xmlFAGenerateTransitions(am, from, to, atom) < 0) { @@ -5651,7 +5857,7 @@ xmlAutomataNewNegTrans(xmlAutomataPtr am, xmlAutomataStatePtr from, * * If @to is NULL, this creates first a new target state in the automata * and then adds a transition from the @from state to the target state - * activated by a succession of input of value @token and @token2 and + * activated by a succession of input of value @token and @token2 and * whose number is between @min and @max * * Returns the target state or NULL in case of error @@ -5805,8 +6011,8 @@ xmlAutomataNewCountTrans(xmlAutomataPtr am, xmlAutomataStatePtr from, * * If @to is NULL, this creates first a new target state in the automata * and then adds a transition from the @from state to the target state - * activated by a succession of input of value @token and @token2 and whose - * number is between @min and @max, moreover that transition can only be + * activated by a succession of input of value @token and @token2 and whose + * number is between @min and @max, moreover that transition can only be * crossed once. * * Returns the target state or NULL in case of error @@ -5848,7 +6054,7 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from, str[lenn + lenp + 1] = 0; atom->valuep = str; - } + } atom->data = data; atom->quant = XML_REGEXP_QUANT_ONCEONLY; atom->min = min; @@ -5871,7 +6077,7 @@ xmlAutomataNewOnceTrans2(xmlAutomataPtr am, xmlAutomataStatePtr from, return(to); } - + /** * xmlAutomataNewOnceTrans: @@ -5940,7 +6146,7 @@ xmlAutomataNewOnceTrans(xmlAutomataPtr am, xmlAutomataStatePtr from, */ xmlAutomataStatePtr xmlAutomataNewState(xmlAutomataPtr am) { - xmlAutomataStatePtr to; + xmlAutomataStatePtr to; if (am == NULL) return(NULL); @@ -6007,7 +6213,7 @@ xmlAutomataNewAllTrans(xmlAutomataPtr am, xmlAutomataStatePtr from, * * Returns the counter number or -1 in case of error */ -int +int xmlAutomataNewCounter(xmlAutomataPtr am, int min, int max) { int ret; @@ -6079,7 +6285,7 @@ xmlAutomataNewCounterTrans(xmlAutomataPtr am, xmlAutomataStatePtr from, * * Returns the compiled regexp or NULL in case of error */ -xmlRegexpPtr +xmlRegexpPtr xmlAutomataCompile(xmlAutomataPtr am) { xmlRegexpPtr ret; @@ -6099,7 +6305,7 @@ xmlAutomataCompile(xmlAutomataPtr am) { * * Returns 1 if true, 0 if not, and -1 in case of error */ -int +int xmlAutomataIsDeterminist(xmlAutomataPtr am) { int ret; @@ -6129,6 +6335,7 @@ struct _xmlExpCtxt { int size; int nbElems; int nb_nodes; + int maxNodes; const char *expr; const char *cur; int nb_cons; @@ -6151,13 +6358,14 @@ xmlExpNewCtxt(int maxNodes, xmlDictPtr dict) { if (maxNodes <= 4096) maxNodes = 4096; - + ret = (xmlExpCtxtPtr) xmlMalloc(sizeof(xmlExpCtxt)); if (ret == NULL) return(NULL); memset(ret, 0, sizeof(xmlExpCtxt)); ret->size = size; ret->nbElems = 0; + ret->maxNodes = maxNodes; ret->table = xmlMalloc(size * sizeof(xmlExpNodePtr)); if (ret->table == NULL) { xmlFree(ret); @@ -6204,7 +6412,7 @@ xmlExpFreeCtxt(xmlExpCtxtPtr ctxt) { /* #define DEBUG_DERIV */ /* - * TODO: + * TODO: * - Wildcards * - public API for creation * @@ -6272,7 +6480,7 @@ static unsigned short xmlExpHashNameComputeKey(const xmlChar *name) { unsigned short value = 0L; char ch; - + if (name != NULL) { value += 30 * (*name); while ((ch = *name++) != 0) { @@ -6291,7 +6499,7 @@ xmlExpHashComputeKey(xmlExpNodeType type, xmlExpNodePtr left, xmlExpNodePtr right) { unsigned long value; unsigned short ret; - + switch (type) { case XML_EXP_SEQ: value = left->key; @@ -6432,7 +6640,7 @@ xmlExpHashGetEntry(xmlExpCtxtPtr ctxt, xmlExpNodeType type, left->exp_left->ref++; tmp = xmlExpHashGetEntry(ctxt, XML_EXP_OR, left->exp_left, tmp, NULL, 0, 0); - + xmlExpFree(ctxt, left); return(tmp); } @@ -6489,7 +6697,7 @@ xmlExpHashGetEntry(xmlExpCtxtPtr ctxt, xmlExpNodeType type, return(right); } kbase = xmlExpHashComputeKey(type, left, right); - } else + } else return(NULL); key = kbase % ctxt->size; @@ -6630,7 +6838,7 @@ xmlExpRef(xmlExpNodePtr exp) { * xmlExpNewAtom: * @ctxt: the expression context * @name: the atom name - * @len: the atom name lenght in byte (or -1); + * @len: the atom name length in byte (or -1); * * Get the atom associated to this name from that context * @@ -6730,7 +6938,7 @@ xmlExpNewRange(xmlExpCtxtPtr ctxt, xmlExpNodePtr subset, int min, int max) { ************************************************************************/ static int -xmlExpGetLanguageInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, +xmlExpGetLanguageInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, const xmlChar**list, int len, int nb) { int tmp, tmp2; tail: @@ -6743,7 +6951,7 @@ tail: return(0); if (nb >= len) return(-2); - list[nb++] = exp->exp_str; + list[nb] = exp->exp_str; return(1); case XML_EXP_COUNT: exp = exp->exp_left; @@ -6767,7 +6975,7 @@ tail: * @ctxt: the expression context * @exp: the expression * @langList: where to store the tokens - * @len: the allocated lenght of @list + * @len: the allocated length of @list * * Find all the strings used in @exp and store them in @list * @@ -6775,7 +6983,7 @@ tail: * -2 if there is more than @len strings */ int -xmlExpGetLanguage(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, +xmlExpGetLanguage(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, const xmlChar**langList, int len) { if ((ctxt == NULL) || (exp == NULL) || (langList == NULL) || (len <= 0)) return(-1); @@ -6783,7 +6991,7 @@ xmlExpGetLanguage(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, } static int -xmlExpGetStartInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, +xmlExpGetStartInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, const xmlChar**list, int len, int nb) { int tmp, tmp2; tail: @@ -6798,7 +7006,7 @@ tail: return(0); if (nb >= len) return(-2); - list[nb++] = exp->exp_str; + list[nb] = exp->exp_str; return(1); case XML_EXP_COUNT: exp = exp->exp_left; @@ -6833,7 +7041,7 @@ tail: * @ctxt: the expression context * @exp: the expression * @tokList: where to store the tokens - * @len: the allocated lenght of @list + * @len: the allocated length of @list * * Find all the strings that appears at the start of the languages * accepted by @exp and store them in @list. E.g. for (a, b) | c @@ -6843,7 +7051,7 @@ tail: * -2 if there is more than @len strings */ int -xmlExpGetStart(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, +xmlExpGetStart(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, const xmlChar**tokList, int len) { if ((ctxt == NULL) || (exp == NULL) || (tokList == NULL) || (len <= 0)) return(-1); @@ -7540,7 +7748,7 @@ xmlExpExpDeriveInt(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { xmlFree((xmlChar **) tab); return(ret); } - + /** * xmlExpExpDerive: * @ctxt: the expressions context @@ -7592,7 +7800,7 @@ xmlExpExpDerive(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { int xmlExpSubsume(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { xmlExpNodePtr tmp; - + if ((exp == NULL) || (ctxt == NULL) || (sub == NULL)) return(-1); @@ -7636,7 +7844,7 @@ xmlExpSubsume(xmlExpCtxtPtr ctxt, xmlExpNodePtr exp, xmlExpNodePtr sub) { /************************************************************************ * * - * Parsing expression * + * Parsing expression * * * ************************************************************************/ @@ -7740,7 +7948,7 @@ parse_quantifier: ret = xmlExpHashGetEntry(ctxt, XML_EXP_COUNT, ret, NULL, NULL, 0, -1); SKIP_BLANKS - } + } return(ret); } @@ -7862,7 +8070,7 @@ xmlExpDumpInt(xmlBufferPtr buf, xmlExpNodePtr expr, int glob) { break; case XML_EXP_COUNT: { char rep[40]; - + c = expr->exp_left; if ((c->type == XML_EXP_SEQ) || (c->type == XML_EXP_OR)) xmlExpDumpInt(buf, c, 1); diff --git a/gnulib-local/lib/libxml/xmlregexp.in.h b/gnulib-local/lib/libxml/xmlregexp.in.h index 022cd6a..7009645 100644 --- a/gnulib-local/lib/libxml/xmlregexp.in.h +++ b/gnulib-local/lib/libxml/xmlregexp.in.h @@ -38,7 +38,7 @@ typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; #ifdef __cplusplus } -#endif +#endif #include #include #ifdef __cplusplus @@ -51,16 +51,22 @@ extern "C" { XMLPUBFUN xmlRegexpPtr XMLCALL xmlRegexpCompile (const xmlChar *regexp); XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRegexpExec (xmlRegexpPtr comp, const xmlChar *value); -XMLPUBFUN void XMLCALL - xmlRegexpPrint (FILE *output, +XMLPUBFUN void XMLCALL + xmlRegexpPrint (FILE *output, xmlRegexpPtr regexp); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRegexpIsDeterminist(xmlRegexpPtr comp); -/* +/** + * xmlRegExecCallbacks: + * @exec: the regular expression context + * @token: the current token string + * @transdata: transition data + * @inputdata: input data + * * Callback function when doing a transition in the automata */ typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, @@ -71,17 +77,17 @@ typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, /* * The progressive API */ -XMLPUBFUN xmlRegExecCtxtPtr XMLCALL - xmlRegNewExecCtxt (xmlRegexpPtr comp, +XMLPUBFUN xmlRegExecCtxtPtr XMLCALL + xmlRegNewExecCtxt (xmlRegexpPtr comp, xmlRegExecCallbacks callback, void *data); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); -XMLPUBFUN int XMLCALL - xmlRegExecPushString(xmlRegExecCtxtPtr exec, +XMLPUBFUN int XMLCALL + xmlRegExecPushString(xmlRegExecCtxtPtr exec, const xmlChar *value, void *data); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlRegExecPushString2(xmlRegExecCtxtPtr exec, const xmlChar *value, const xmlChar *value2, @@ -89,15 +95,15 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlRegExecNextValues(xmlRegExecCtxtPtr exec, - int *nbval, - int *nbneg, + int *nbval, + int *nbneg, xmlChar **values, int *terminal); XMLPUBFUN int XMLCALL xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, - const xmlChar **string, + const xmlChar **string, int *nbval, - int *nbneg, + int *nbneg, xmlChar **values, int *terminal); #ifdef LIBXML_EXPR_ENABLED @@ -135,7 +141,7 @@ typedef enum { } xmlExpNodeType; /* - * 2 core expressions shared by all for the empty language set + * 2 core expressions shared by all for the empty language set * and for the set with just the empty token */ XMLPUBVAR xmlExpNodePtr forbiddenExp; @@ -209,7 +215,7 @@ XMLPUBFUN void XMLCALL #endif /* LIBXML_EXPR_ENABLED */ #ifdef __cplusplus } -#endif +#endif #endif /* LIBXML_REGEXP_ENABLED */ diff --git a/gnulib-local/lib/libxml/xmlsave.c b/gnulib-local/lib/libxml/xmlsave.c index 6963e7b..774404b 100644 --- a/gnulib-local/lib/libxml/xmlsave.c +++ b/gnulib-local/lib/libxml/xmlsave.c @@ -19,6 +19,10 @@ #include +#include "buf.h" +#include "enc.h" +#include "save.h" + /************************************************************************ * * * XHTML detection * @@ -66,7 +70,7 @@ xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) { #ifdef LIBXML_OUTPUT_ENABLED -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); @@ -92,7 +96,7 @@ struct _xmlSaveCtxt { /************************************************************************ * * - * Output error handlers * + * Output error handlers * * * ************************************************************************/ /** @@ -210,9 +214,9 @@ xmlEscapeEntities(unsigned char* out, int *outlen, int val; inend = in + (*inlen); - + while ((in < inend) && (out < outend)) { - if (*in == '<') { + if (*in == '<') { if (outend - out < 4) break; *out++ = '&'; *out++ = 'l'; @@ -248,7 +252,7 @@ xmlEscapeEntities(unsigned char* out, int *outlen, /* * We assume we have UTF-8 input. */ - if (outend - out < 10) break; + if (outend - out < 11) break; if (*in < 0xC0) { xmlSaveErr(XML_SAVE_NOT_UTF8, NULL, NULL); @@ -408,13 +412,15 @@ xmlNewSaveCtxt(const char *encoding, int options) ret->options = options; if (options & XML_SAVE_FORMAT) ret->format = 1; + else if (options & XML_SAVE_WSNONSIG) + ret->format = 2; return(ret); } /************************************************************************ * * - * Dumping XML tree content to a simple buffer * + * Dumping XML tree content to a simple buffer * * * ************************************************************************/ /** @@ -434,14 +440,14 @@ xmlAttrSerializeContent(xmlOutputBufferPtr buf, xmlAttrPtr attr) while (children != NULL) { switch (children->type) { case XML_TEXT_NODE: - xmlAttrSerializeTxtContent(buf->buffer, attr->doc, - attr, children->content); + xmlBufAttrSerializeTxtContent(buf->buffer, attr->doc, + attr, children->content); break; case XML_ENTITY_REF_NODE: - xmlBufferAdd(buf->buffer, BAD_CAST "&", 1); - xmlBufferAdd(buf->buffer, children->name, + xmlBufAdd(buf->buffer, BAD_CAST "&", 1); + xmlBufAdd(buf->buffer, children->name, xmlStrlen(children->name)); - xmlBufferAdd(buf->buffer, BAD_CAST ";", 1); + xmlBufAdd(buf->buffer, BAD_CAST ";", 1); break; default: /* should not happen unless we have a badly built tree */ @@ -451,12 +457,136 @@ xmlAttrSerializeContent(xmlOutputBufferPtr buf, xmlAttrPtr attr) } } +/** + * xmlBufDumpNotationTable: + * @buf: an xmlBufPtr output + * @table: A notation table + * + * This will dump the content of the notation table as an XML DTD definition + */ +void +xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) { + xmlBufferPtr buffer; + + buffer = xmlBufferCreate(); + if (buffer == NULL) { + /* + * TODO set the error in buf + */ + return; + } + xmlDumpNotationTable(buffer, table); + xmlBufMergeBuffer(buf, buffer); +} + +/** + * xmlBufDumpElementDecl: + * @buf: an xmlBufPtr output + * @elem: An element table + * + * This will dump the content of the element declaration as an XML + * DTD definition + */ +void +xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) { + xmlBufferPtr buffer; + + buffer = xmlBufferCreate(); + if (buffer == NULL) { + /* + * TODO set the error in buf + */ + return; + } + xmlDumpElementDecl(buffer, elem); + xmlBufMergeBuffer(buf, buffer); +} + +/** + * xmlBufDumpAttributeDecl: + * @buf: an xmlBufPtr output + * @attr: An attribute declaration + * + * This will dump the content of the attribute declaration as an XML + * DTD definition + */ +void +xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) { + xmlBufferPtr buffer; + + buffer = xmlBufferCreate(); + if (buffer == NULL) { + /* + * TODO set the error in buf + */ + return; + } + xmlDumpAttributeDecl(buffer, attr); + xmlBufMergeBuffer(buf, buffer); +} + +/** + * xmlBufDumpEntityDecl: + * @buf: an xmlBufPtr output + * @ent: An entity table + * + * This will dump the content of the entity table as an XML DTD definition + */ +void +xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent) { + xmlBufferPtr buffer; + + buffer = xmlBufferCreate(); + if (buffer == NULL) { + /* + * TODO set the error in buf + */ + return; + } + xmlDumpEntityDecl(buffer, ent); + xmlBufMergeBuffer(buf, buffer); +} + /************************************************************************ * * - * Dumping XML tree content to an I/O output buffer * + * Dumping XML tree content to an I/O output buffer * * * ************************************************************************/ +static int xmlSaveSwitchEncoding(xmlSaveCtxtPtr ctxt, const char *encoding) { + xmlOutputBufferPtr buf = ctxt->buf; + + if ((encoding != NULL) && (buf->encoder == NULL) && (buf->conv == NULL)) { + buf->encoder = xmlFindCharEncodingHandler((const char *)encoding); + if (buf->encoder == NULL) { + xmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, + (const char *)encoding); + return(-1); + } + buf->conv = xmlBufCreate(); + if (buf->conv == NULL) { + xmlCharEncCloseFunc(buf->encoder); + xmlSaveErrMemory("creating encoding buffer"); + return(-1); + } + /* + * initialize the state, e.g. if outputting a BOM + */ + xmlCharEncOutput(buf, 1); + } + return(0); +} + +static int xmlSaveClearEncoding(xmlSaveCtxtPtr ctxt) { + xmlOutputBufferPtr buf = ctxt->buf; + xmlOutputBufferFlush(buf); + xmlCharEncCloseFunc(buf->encoder); + xmlBufFree(buf->conv); + buf->encoder = NULL; + buf->conv = NULL; + return(0); +} + #ifdef LIBXML_HTML_ENABLED static void xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); @@ -466,29 +596,87 @@ static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr 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: * @buf: the XML buffer output * @cur: a namespace + * @ctxt: the output save context. Optional. * * Dump a local Namespace definition. * Should be called in the context of attributes dumps. + * If @ctxt is supplied, @buf should be its buffer. */ static void -xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) { +xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur, xmlSaveCtxtPtr ctxt) { if ((cur == NULL) || (buf == NULL)) return; if ((cur->type == XML_LOCAL_NAMESPACE) && (cur->href != NULL)) { if (xmlStrEqual(cur->prefix, BAD_CAST "xml")) return; + if (ctxt != NULL && ctxt->format == 2) + xmlOutputBufferWriteWSNonSig(ctxt, 2); + else + xmlOutputBufferWrite(buf, 1, " "); + /* Within the context of an element attributes */ if (cur->prefix != NULL) { - xmlOutputBufferWrite(buf, 7, " xmlns:"); + xmlOutputBufferWrite(buf, 6, "xmlns:"); xmlOutputBufferWriteString(buf, (const char *)cur->prefix); } else - xmlOutputBufferWrite(buf, 6, " xmlns"); + xmlOutputBufferWrite(buf, 5, "xmlns"); xmlOutputBufferWrite(buf, 1, "="); - xmlBufferWriteQuotedString(buf->buffer, cur->href); + xmlBufWriteQuotedString(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; } } @@ -503,7 +691,7 @@ xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) { void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) { while (cur != NULL) { - xmlNsDumpOutput(buf, cur); + xmlNsDumpOutput(buf, cur, NULL); cur = cur->next; } } @@ -512,7 +700,7 @@ xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) { * xmlDtdDumpOutput: * @buf: the XML buffer output * @dtd: the pointer to the DTD - * + * * Dump the XML document DTD, if any. */ static void @@ -529,12 +717,12 @@ xmlDtdDumpOutput(xmlSaveCtxtPtr ctxt, xmlDtdPtr dtd) { xmlOutputBufferWriteString(buf, (const char *)dtd->name); if (dtd->ExternalID != NULL) { xmlOutputBufferWrite(buf, 8, " PUBLIC "); - xmlBufferWriteQuotedString(buf->buffer, dtd->ExternalID); + xmlBufWriteQuotedString(buf->buffer, dtd->ExternalID); xmlOutputBufferWrite(buf, 1, " "); - xmlBufferWriteQuotedString(buf->buffer, dtd->SystemID); + xmlBufWriteQuotedString(buf->buffer, dtd->SystemID); } else if (dtd->SystemID != NULL) { xmlOutputBufferWrite(buf, 8, " SYSTEM "); - xmlBufferWriteQuotedString(buf->buffer, dtd->SystemID); + xmlBufWriteQuotedString(buf->buffer, dtd->SystemID); } if ((dtd->entities == NULL) && (dtd->elements == NULL) && (dtd->attributes == NULL) && (dtd->notations == NULL) && @@ -549,7 +737,8 @@ xmlDtdDumpOutput(xmlSaveCtxtPtr ctxt, xmlDtdPtr dtd) { */ if ((dtd->notations != NULL) && ((dtd->doc == NULL) || (dtd->doc->intSubset == dtd))) { - xmlDumpNotationTable(buf->buffer, (xmlNotationTablePtr) dtd->notations); + xmlBufDumpNotationTable(buf->buffer, + (xmlNotationTablePtr) dtd->notations); } format = ctxt->format; level = ctxt->level; @@ -578,7 +767,10 @@ xmlAttrDumpOutput(xmlSaveCtxtPtr ctxt, xmlAttrPtr cur) { if (cur == NULL) return; buf = ctxt->buf; 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)) { xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix); xmlOutputBufferWrite(buf, 1, ":"); @@ -622,20 +814,82 @@ xmlNodeListDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { if (cur == NULL) return; buf = ctxt->buf; while (cur != NULL) { - if ((ctxt->format) && (xmlIndentTreeOutput) && - (cur->type == XML_ELEMENT_NODE)) + if ((ctxt->format == 1) && (xmlIndentTreeOutput) && + ((cur->type == XML_ELEMENT_NODE) || + (cur->type == XML_COMMENT_NODE) || + (cur->type == XML_PI_NODE))) xmlOutputBufferWrite(buf, ctxt->indent_size * - (ctxt->level > ctxt->indent_nr ? + (ctxt->level > ctxt->indent_nr ? ctxt->indent_nr : ctxt->level), ctxt->indent); xmlNodeDumpOutputInternal(ctxt, cur); - if (ctxt->format) { + if (ctxt->format == 1) { xmlOutputBufferWrite(buf, 1, "\n"); } cur = cur->next; } } +#ifdef LIBXML_HTML_ENABLED +/** + * xmlNodeDumpOutputInternal: + * @cur: the current node + * + * Dump an HTML node, recursive behaviour, children are printed too. + */ +static int +htmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { + const xmlChar *oldenc = NULL; + const xmlChar *oldctxtenc = ctxt->encoding; + const xmlChar *encoding = ctxt->encoding; + xmlOutputBufferPtr buf = ctxt->buf; + int switched_encoding = 0; + xmlDocPtr doc; + + xmlInitParser(); + + doc = cur->doc; + if (doc != NULL) { + oldenc = doc->encoding; + if (ctxt->encoding != NULL) { + doc->encoding = BAD_CAST ctxt->encoding; + } else if (doc->encoding != NULL) { + encoding = doc->encoding; + } + } + + if ((encoding != NULL) && (doc != NULL)) + htmlSetMetaEncoding(doc, (const xmlChar *) encoding); + if ((encoding == NULL) && (doc != NULL)) + encoding = htmlGetMetaEncoding(doc); + if (encoding == NULL) + encoding = BAD_CAST "HTML"; + if ((encoding != NULL) && (oldctxtenc == NULL) && + (buf->encoder == NULL) && (buf->conv == NULL)) { + if (xmlSaveSwitchEncoding(ctxt, (const char*) encoding) < 0) { + doc->encoding = oldenc; + return(-1); + } + switched_encoding = 1; + } + if (ctxt->options & XML_SAVE_FORMAT) + htmlNodeDumpFormatOutput(buf, doc, cur, + (const char *)encoding, 1); + else + htmlNodeDumpFormatOutput(buf, doc, cur, + (const char *)encoding, 0); + /* + * Restore the state of the saving context at the end of the document + */ + if ((switched_encoding) && (oldctxtenc == NULL)) { + xmlSaveClearEncoding(ctxt); + } + if (doc != NULL) + doc->encoding = oldenc; + return(0); +} +#endif + /** * xmlNodeDumpOutputInternal: * @cur: the current node @@ -660,6 +914,19 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { xmlDocContentDumpOutput(ctxt, (xmlDocPtr) cur); return; } +#ifdef LIBXML_HTML_ENABLED + if (ctxt->options & XML_SAVE_XHTML) { + xhtmlNodeDumpOutput(ctxt, cur); + return; + } + if (((cur->type != XML_NAMESPACE_DECL) && (cur->doc != NULL) && + (cur->doc->type == XML_HTML_DOCUMENT_NODE) && + ((ctxt->options & XML_SAVE_AS_XML) == 0)) || + (ctxt->options & XML_SAVE_AS_HTML)) { + htmlNodeDumpOutputInternal(ctxt, cur); + return; + } +#endif if (cur->type == XML_DTD_NODE) { xmlDtdDumpOutput(ctxt, (xmlDtdPtr) cur); return; @@ -669,15 +936,15 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { return; } if (cur->type == XML_ELEMENT_DECL) { - xmlDumpElementDecl(buf->buffer, (xmlElementPtr) cur); + xmlBufDumpElementDecl(buf->buffer, (xmlElementPtr) cur); return; } if (cur->type == XML_ATTRIBUTE_DECL) { - xmlDumpAttributeDecl(buf->buffer, (xmlAttributePtr) cur); + xmlBufDumpAttributeDecl(buf->buffer, (xmlAttributePtr) cur); return; } if (cur->type == XML_ENTITY_DECL) { - xmlDumpEntityDecl(buf->buffer, (xmlEntityPtr) cur); + xmlBufDumpEntityDecl(buf->buffer, (xmlEntityPtr) cur); return; } if (cur->type == XML_TEXT_NODE) { @@ -699,13 +966,18 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { xmlOutputBufferWrite(buf, 2, "name); if (cur->content != NULL) { - xmlOutputBufferWrite(buf, 1, " "); + if (ctxt->format == 2) + xmlOutputBufferWriteWSNonSig(ctxt, 0); + else + xmlOutputBufferWrite(buf, 1, " "); xmlOutputBufferWriteString(buf, (const char *)cur->content); } xmlOutputBufferWrite(buf, 2, "?>"); } else { xmlOutputBufferWrite(buf, 2, "name); + if (ctxt->format == 2) + xmlOutputBufferWriteWSNonSig(ctxt, 0); xmlOutputBufferWrite(buf, 2, "?>"); } return; @@ -725,8 +997,8 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { return; } if (cur->type == XML_CDATA_SECTION_NODE) { - if (cur->content == NULL) { - xmlOutputBufferWrite(buf, 12, ""); + if (cur->content == NULL || *cur->content == '\0') { + xmlOutputBufferWrite(buf, 12, ""); } else { start = end = cur->content; while (*end != '\0') { @@ -753,7 +1025,7 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { return; } if (cur->type == XML_NAMESPACE_DECL) { - xmlNsDumpOutput(buf, (xmlNsPtr) cur); + xmlNsDumpOutputCtxt(ctxt, (xmlNsPtr) cur); return; } @@ -778,28 +1050,32 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { xmlOutputBufferWriteString(buf, (const char *)cur->name); if (cur->nsDef) - xmlNsListDumpOutput(buf, cur->nsDef); + xmlNsListDumpOutputCtxt(ctxt, cur->nsDef); if (cur->properties != NULL) xmlAttrListDumpOutput(ctxt, cur->properties); if (((cur->type == XML_ELEMENT_NODE) || (cur->content == NULL)) && (cur->children == NULL) && ((ctxt->options & XML_SAVE_NO_EMPTY) == 0)) { + if (ctxt->format == 2) + xmlOutputBufferWriteWSNonSig(ctxt, 0); xmlOutputBufferWrite(buf, 2, "/>"); ctxt->format = format; return; } + if (ctxt->format == 2) + xmlOutputBufferWriteWSNonSig(ctxt, 1); xmlOutputBufferWrite(buf, 1, ">"); if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) { xmlOutputBufferWriteEscape(buf, cur->content, ctxt->escape); } 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++; xmlNodeListDumpOutput(ctxt, cur->children); if (ctxt->level > 0) ctxt->level--; - if ((xmlIndentTreeOutput) && (ctxt->format)) + if ((xmlIndentTreeOutput) && (ctxt->format == 1)) xmlOutputBufferWrite(buf, ctxt->indent_size * - (ctxt->level > ctxt->indent_nr ? + (ctxt->level > ctxt->indent_nr ? ctxt->indent_nr : ctxt->level), ctxt->indent); } @@ -810,6 +1086,8 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { } xmlOutputBufferWriteString(buf, (const char *)cur->name); + if (ctxt->format == 2) + xmlOutputBufferWriteWSNonSig(ctxt, 0); xmlOutputBufferWrite(buf, 1, ">"); ctxt->format = format; } @@ -832,11 +1110,15 @@ xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur) { xmlCharEncodingOutputFunc oldescape = ctxt->escape; xmlCharEncodingOutputFunc oldescapeAttr = ctxt->escapeAttr; xmlOutputBufferPtr buf = ctxt->buf; - xmlCharEncodingHandlerPtr handler = NULL; xmlCharEncoding enc; + int switched_encoding = 0; xmlInitParser(); + if ((cur->type != XML_HTML_DOCUMENT_NODE) && + (cur->type != XML_DOCUMENT_NODE)) + return(-1); + if (ctxt->encoding != NULL) { cur->encoding = BAD_CAST ctxt->encoding; } else if (cur->encoding != NULL) { @@ -846,110 +1128,125 @@ xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur) { xmlGetCharEncodingName((xmlCharEncoding) cur->charset); } - enc = xmlParseCharEncoding((const char*) encoding); - if ((encoding != NULL) && (oldctxtenc == NULL) && - (buf->encoder == NULL) && (buf->conv == NULL) && - ((ctxt->options & XML_SAVE_NO_DECL) == 0)) { - if ((enc != XML_CHAR_ENCODING_UTF8) && - (enc != XML_CHAR_ENCODING_NONE) && - (enc != XML_CHAR_ENCODING_ASCII)) { - /* - * we need to switch to this encoding but just for this document - * since we output the XMLDecl the conversion must be done to not - * generate not well formed documents. - */ - buf->encoder = xmlFindCharEncodingHandler((const char *)encoding); - if (buf->encoder == NULL) { - xmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, - (const char *)encoding); + if (((cur->type == XML_HTML_DOCUMENT_NODE) && + ((ctxt->options & XML_SAVE_AS_XML) == 0) && + ((ctxt->options & XML_SAVE_XHTML) == 0)) || + (ctxt->options & XML_SAVE_AS_HTML)) { +#ifdef LIBXML_HTML_ENABLED + if (encoding != NULL) + htmlSetMetaEncoding(cur, (const xmlChar *) encoding); + if (encoding == NULL) + encoding = htmlGetMetaEncoding(cur); + if (encoding == NULL) + encoding = BAD_CAST "HTML"; + if ((encoding != NULL) && (oldctxtenc == NULL) && + (buf->encoder == NULL) && (buf->conv == NULL)) { + if (xmlSaveSwitchEncoding(ctxt, (const char*) encoding) < 0) { + cur->encoding = oldenc; return(-1); } - buf->conv = xmlBufferCreate(); - if (buf->conv == NULL) { - xmlCharEncCloseFunc(buf->encoder); - xmlSaveErrMemory("creating encoding buffer"); - return(-1); + } + if (ctxt->options & XML_SAVE_FORMAT) + htmlDocContentDumpFormatOutput(buf, cur, + (const char *)encoding, 1); + else + htmlDocContentDumpFormatOutput(buf, cur, + (const char *)encoding, 0); + if (ctxt->encoding != NULL) + cur->encoding = oldenc; + return(0); +#else + return(-1); +#endif + } else if ((cur->type == XML_DOCUMENT_NODE) || + (ctxt->options & XML_SAVE_AS_XML) || + (ctxt->options & XML_SAVE_XHTML)) { + enc = xmlParseCharEncoding((const char*) encoding); + if ((encoding != NULL) && (oldctxtenc == NULL) && + (buf->encoder == NULL) && (buf->conv == NULL) && + ((ctxt->options & XML_SAVE_NO_DECL) == 0)) { + if ((enc != XML_CHAR_ENCODING_UTF8) && + (enc != XML_CHAR_ENCODING_NONE) && + (enc != XML_CHAR_ENCODING_ASCII)) { + /* + * we need to switch to this encoding but just for this + * document since we output the XMLDecl the conversion + * must be done to not generate not well formed documents. + */ + if (xmlSaveSwitchEncoding(ctxt, (const char*) encoding) < 0) { + cur->encoding = oldenc; + return(-1); + } + switched_encoding = 1; } - /* - * initialize the state, e.g. if outputting a BOM - */ - xmlCharEncOutFunc(buf->encoder, buf->conv, NULL); + if (ctxt->escape == xmlEscapeEntities) + ctxt->escape = NULL; + if (ctxt->escapeAttr == xmlEscapeEntities) + ctxt->escapeAttr = NULL; } - if (ctxt->escape == xmlEscapeEntities) - ctxt->escape = NULL; - if (ctxt->escapeAttr == xmlEscapeEntities) - ctxt->escapeAttr = NULL; - } - /* - * Save the XML declaration - */ - if ((ctxt->options & XML_SAVE_NO_DECL) == 0) { - xmlOutputBufferWrite(buf, 14, "version != NULL) - xmlBufferWriteQuotedString(buf->buffer, cur->version); - else - xmlOutputBufferWrite(buf, 5, "\"1.0\""); - if (encoding != NULL) { - xmlOutputBufferWrite(buf, 10, " encoding="); - xmlBufferWriteQuotedString(buf->buffer, (xmlChar *) encoding); - } - switch (cur->standalone) { - case 0: - xmlOutputBufferWrite(buf, 16, " standalone=\"no\""); - break; - case 1: - xmlOutputBufferWrite(buf, 17, " standalone=\"yes\""); - break; + /* + * Save the XML declaration + */ + if ((ctxt->options & XML_SAVE_NO_DECL) == 0) { + xmlOutputBufferWrite(buf, 14, "version != NULL) + xmlBufWriteQuotedString(buf->buffer, cur->version); + else + xmlOutputBufferWrite(buf, 5, "\"1.0\""); + if (encoding != NULL) { + xmlOutputBufferWrite(buf, 10, " encoding="); + xmlBufWriteQuotedString(buf->buffer, (xmlChar *) encoding); + } + switch (cur->standalone) { + case 0: + xmlOutputBufferWrite(buf, 16, " standalone=\"no\""); + break; + case 1: + xmlOutputBufferWrite(buf, 17, " standalone=\"yes\""); + break; + } + xmlOutputBufferWrite(buf, 3, "?>\n"); } - xmlOutputBufferWrite(buf, 3, "?>\n"); - } #ifdef LIBXML_HTML_ENABLED - if ((ctxt->options & XML_SAVE_NO_XHTML) == 0) { - dtd = xmlGetIntSubset(cur); - if (dtd != NULL) { - is_xhtml = xmlIsXHTML(dtd->SystemID, dtd->ExternalID); - if (is_xhtml < 0) is_xhtml = 0; + if (ctxt->options & XML_SAVE_XHTML) + is_xhtml = 1; + if ((ctxt->options & XML_SAVE_NO_XHTML) == 0) { + dtd = xmlGetIntSubset(cur); + if (dtd != NULL) { + is_xhtml = xmlIsXHTML(dtd->SystemID, dtd->ExternalID); + if (is_xhtml < 0) is_xhtml = 0; + } } - } #endif - if (cur->children != NULL) { - xmlNodePtr child = cur->children; + if (cur->children != NULL) { + xmlNodePtr child = cur->children; - while (child != NULL) { - ctxt->level = 0; + while (child != NULL) { + ctxt->level = 0; #ifdef LIBXML_HTML_ENABLED - if (is_xhtml) - xhtmlNodeDumpOutput(ctxt, child); - else + if (is_xhtml) + xhtmlNodeDumpOutput(ctxt, child); + else #endif - xmlNodeDumpOutputInternal(ctxt, child); - xmlOutputBufferWrite(buf, 1, "\n"); - child = child->next; + xmlNodeDumpOutputInternal(ctxt, child); + xmlOutputBufferWrite(buf, 1, "\n"); + child = child->next; + } } } - if (ctxt->encoding != NULL) - cur->encoding = oldenc; - + /* * Restore the state of the saving context at the end of the document */ - if ((encoding != NULL) && (oldctxtenc == NULL) && - ((ctxt->options & XML_SAVE_NO_DECL) == 0)) { - if ((enc != XML_CHAR_ENCODING_UTF8) && - (enc != XML_CHAR_ENCODING_NONE) && - (enc != XML_CHAR_ENCODING_ASCII)) { - xmlOutputBufferFlush(buf); - xmlCharEncCloseFunc(buf->encoder); - xmlBufferFree(buf->conv); - buf->encoder = NULL; - buf->conv = NULL; - } + if ((switched_encoding) && (oldctxtenc == NULL)) { + xmlSaveClearEncoding(ctxt); ctxt->escape = oldescape; ctxt->escapeAttr = oldescapeAttr; } + cur->encoding = oldenc; return(0); } @@ -1058,7 +1355,7 @@ xhtmlAttrListDumpOutput(xmlSaveCtxtPtr ctxt, xmlAttrPtr cur) { if ((cur->ns != NULL) && (xmlStrEqual(cur->name, BAD_CAST "lang")) && (xmlStrEqual(cur->ns->prefix, BAD_CAST "xml"))) xml_lang = cur; - else if ((cur->ns == NULL) && + else if ((cur->ns == NULL) && ((cur->children == NULL) || (cur->children->content == NULL) || (cur->children->content[0] == 0)) && @@ -1098,7 +1395,7 @@ xhtmlAttrListDumpOutput(xmlSaveCtxtPtr ctxt, xmlAttrPtr cur) { xmlOutputBufferWrite(buf, 11, " xml:lang=\""); xmlAttrSerializeContent(buf, lang); xmlOutputBufferWrite(buf, 1, "\""); - } else + } else if ((xml_lang != NULL) && (lang == NULL)) { xmlOutputBufferWrite(buf, 7, " lang=\""); xmlAttrSerializeContent(buf, xml_lang); @@ -1126,14 +1423,14 @@ xhtmlNodeListDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { if (cur == NULL) return; buf = ctxt->buf; while (cur != NULL) { - if ((ctxt->format) && (xmlIndentTreeOutput) && + if ((ctxt->format == 1) && (xmlIndentTreeOutput) && (cur->type == XML_ELEMENT_NODE)) xmlOutputBufferWrite(buf, ctxt->indent_size * - (ctxt->level > ctxt->indent_nr ? + (ctxt->level > ctxt->indent_nr ? ctxt->indent_nr : ctxt->level), ctxt->indent); xhtmlNodeDumpOutput(ctxt, cur); - if (ctxt->format) { + if (ctxt->format == 1) { xmlOutputBufferWrite(buf, 1, "\n"); } cur = cur->next; @@ -1168,6 +1465,10 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { return; if (cur->type == XML_XINCLUDE_END) return; + if (cur->type == XML_NAMESPACE_DECL) { + xmlNsDumpOutputCtxt(ctxt, (xmlNsPtr) cur); + return; + } if (cur->type == XML_DTD_NODE) { xmlDtdDumpOutput(ctxt, (xmlDtdPtr) cur); return; @@ -1178,15 +1479,15 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { } buf = ctxt->buf; if (cur->type == XML_ELEMENT_DECL) { - xmlDumpElementDecl(buf->buffer, (xmlElementPtr) cur); + xmlBufDumpElementDecl(buf->buffer, (xmlElementPtr) cur); return; } if (cur->type == XML_ATTRIBUTE_DECL) { - xmlDumpAttributeDecl(buf->buffer, (xmlAttributePtr) cur); + xmlBufDumpAttributeDecl(buf->buffer, (xmlAttributePtr) cur); return; } if (cur->type == XML_ENTITY_DECL) { - xmlDumpEntityDecl(buf->buffer, (xmlEntityPtr) cur); + xmlBufDumpEntityDecl(buf->buffer, (xmlEntityPtr) cur); return; } if (cur->type == XML_TEXT_NODE) { @@ -1235,30 +1536,38 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { return; } if (cur->type == XML_CDATA_SECTION_NODE) { - start = end = cur->content; - while (*end != '\0') { - if (*end == ']' && *(end + 1) == ']' && *(end + 2) == '>') { - end = end + 2; + if (cur->content == NULL || *cur->content == '\0') { + xmlOutputBufferWrite(buf, 12, ""); + } else { + start = end = cur->content; + while (*end != '\0') { + if (*end == ']' && *(end + 1) == ']' && *(end + 2) == '>') { + end = end + 2; + xmlOutputBufferWrite(buf, 9, ""); + start = end; + } + end++; + } + if (start != end) { xmlOutputBufferWrite(buf, 9, ""); - start = end; } - end++; - } - if (start != end) { - xmlOutputBufferWrite(buf, 9, ""); } return; } + if (cur->type == XML_ATTRIBUTE_NODE) { + xmlAttrDumpOutput(ctxt, (xmlAttrPtr) cur); + return; + } format = ctxt->format; if (format == 1) { tmp = cur->children; while (tmp != NULL) { - if ((tmp->type == XML_TEXT_NODE) || + if ((tmp->type == XML_TEXT_NODE) || (tmp->type == XML_ENTITY_REF_NODE)) { format = 0; break; @@ -1274,7 +1583,7 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { xmlOutputBufferWriteString(buf, (const char *)cur->name); if (cur->nsDef) - xmlNsListDumpOutput(buf, cur->nsDef); + xmlNsListDumpOutputCtxt(ctxt, cur->nsDef); if ((xmlStrEqual(cur->name, BAD_CAST "html") && (cur->ns == NULL) && (cur->nsDef == NULL))) { /* @@ -1286,10 +1595,10 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { if (cur->properties != NULL) xhtmlAttrListDumpOutput(ctxt, cur->properties); - if ((cur->type == XML_ELEMENT_NODE) && - (cur->parent != NULL) && - (cur->parent->parent == (xmlNodePtr) cur->doc) && - xmlStrEqual(cur->name, BAD_CAST"head") && + if ((cur->type == XML_ELEMENT_NODE) && + (cur->parent != NULL) && + (cur->parent->parent == (xmlNodePtr) cur->doc) && + xmlStrEqual(cur->name, BAD_CAST"head") && xmlStrEqual(cur->parent->name, BAD_CAST"html")) { tmp = cur->children; @@ -1322,11 +1631,11 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { } else { if (addmeta == 1) { xmlOutputBufferWrite(buf, 1, ">"); - if (ctxt->format) { + if (ctxt->format == 1) { xmlOutputBufferWrite(buf, 1, "\n"); if (xmlIndentTreeOutput) xmlOutputBufferWrite(buf, ctxt->indent_size * - (ctxt->level + 1 > ctxt->indent_nr ? + (ctxt->level + 1 > ctxt->indent_nr ? ctxt->indent_nr : ctxt->level + 1), ctxt->indent); } xmlOutputBufferWriteString(buf, @@ -1337,7 +1646,7 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { xmlOutputBufferWrite(buf, 5, "UTF-8"); } xmlOutputBufferWrite(buf, 4, "\" />"); - if (ctxt->format) + if (ctxt->format == 1) xmlOutputBufferWrite(buf, 1, "\n"); } else { xmlOutputBufferWrite(buf, 1, ">"); @@ -1357,11 +1666,11 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { } xmlOutputBufferWrite(buf, 1, ">"); if (addmeta == 1) { - if (ctxt->format) { + if (ctxt->format == 1) { xmlOutputBufferWrite(buf, 1, "\n"); if (xmlIndentTreeOutput) xmlOutputBufferWrite(buf, ctxt->indent_size * - (ctxt->level + 1 > ctxt->indent_nr ? + (ctxt->level + 1 > ctxt->indent_nr ? ctxt->indent_nr : ctxt->level + 1), ctxt->indent); } xmlOutputBufferWriteString(buf, @@ -1451,16 +1760,16 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { if (cur->children != NULL) { int indent = ctxt->format; - - if (format) xmlOutputBufferWrite(buf, 1, "\n"); + + if (format == 1) xmlOutputBufferWrite(buf, 1, "\n"); if (ctxt->level >= 0) ctxt->level++; ctxt->format = format; xhtmlNodeListDumpOutput(ctxt, cur->children); if (ctxt->level > 0) ctxt->level--; ctxt->format = indent; - if ((xmlIndentTreeOutput) && (format)) + if ((xmlIndentTreeOutput) && (format == 1)) xmlOutputBufferWrite(buf, ctxt->indent_size * - (ctxt->level > ctxt->indent_nr ? + (ctxt->level > ctxt->indent_nr ? ctxt->indent_nr : ctxt->level), ctxt->indent); } @@ -1726,18 +2035,19 @@ xmlSaveSetAttrEscape(xmlSaveCtxtPtr ctxt, xmlCharEncodingOutputFunc escape) * Public entry points based on buffers * * * ************************************************************************/ + /** - * xmlAttrSerializeTxtContent: - * @buf: the XML buffer output + * xmlBufAttrSerializeTxtContent: + * @buf: and xmlBufPtr output * @doc: the document * @attr: the attribute node * @string: the text content * - * Serialize text attribute values to an xml simple buffer + * Serialize text attribute values to an xmlBufPtr */ void -xmlAttrSerializeTxtContent(xmlBufferPtr buf, xmlDocPtr doc, - xmlAttrPtr attr, const xmlChar * string) +xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc, + xmlAttrPtr attr, const xmlChar * string) { xmlChar *base, *cur; @@ -1747,44 +2057,44 @@ xmlAttrSerializeTxtContent(xmlBufferPtr buf, xmlDocPtr doc, while (*cur != 0) { if (*cur == '\n') { if (base != cur) - xmlBufferAdd(buf, base, cur - base); - xmlBufferAdd(buf, BAD_CAST " ", 5); + xmlBufAdd(buf, base, cur - base); + xmlBufAdd(buf, BAD_CAST " ", 5); cur++; base = cur; } else if (*cur == '\r') { if (base != cur) - xmlBufferAdd(buf, base, cur - base); - xmlBufferAdd(buf, BAD_CAST " ", 5); + xmlBufAdd(buf, base, cur - base); + xmlBufAdd(buf, BAD_CAST " ", 5); cur++; base = cur; } else if (*cur == '\t') { if (base != cur) - xmlBufferAdd(buf, base, cur - base); - xmlBufferAdd(buf, BAD_CAST " ", 4); + xmlBufAdd(buf, base, cur - base); + xmlBufAdd(buf, BAD_CAST " ", 4); cur++; base = cur; } else if (*cur == '"') { if (base != cur) - xmlBufferAdd(buf, base, cur - base); - xmlBufferAdd(buf, BAD_CAST """, 6); + xmlBufAdd(buf, base, cur - base); + xmlBufAdd(buf, BAD_CAST """, 6); cur++; base = cur; } else if (*cur == '<') { if (base != cur) - xmlBufferAdd(buf, base, cur - base); - xmlBufferAdd(buf, BAD_CAST "<", 4); + xmlBufAdd(buf, base, cur - base); + xmlBufAdd(buf, BAD_CAST "<", 4); cur++; base = cur; } else if (*cur == '>') { if (base != cur) - xmlBufferAdd(buf, base, cur - base); - xmlBufferAdd(buf, BAD_CAST ">", 4); + xmlBufAdd(buf, base, cur - base); + xmlBufAdd(buf, BAD_CAST ">", 4); cur++; base = cur; } else if (*cur == '&') { if (base != cur) - xmlBufferAdd(buf, base, cur - base); - xmlBufferAdd(buf, BAD_CAST "&", 5); + xmlBufAdd(buf, base, cur - base); + xmlBufAdd(buf, BAD_CAST "&", 5); cur++; base = cur; } else if ((*cur >= 0x80) && ((doc == NULL) || @@ -1792,17 +2102,17 @@ xmlAttrSerializeTxtContent(xmlBufferPtr buf, xmlDocPtr doc, /* * We assume we have UTF-8 content. */ - unsigned char tmp[10]; + unsigned char tmp[12]; int val = 0, l = 1; if (base != cur) - xmlBufferAdd(buf, base, cur - base); + xmlBufAdd(buf, base, cur - base); if (*cur < 0xC0) { xmlSaveErr(XML_SAVE_NOT_UTF8, (xmlNodePtr) attr, NULL); if (doc != NULL) doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); xmlSerializeHexCharRef(tmp, *cur); - xmlBufferAdd(buf, (xmlChar *) tmp, -1); + xmlBufAdd(buf, (xmlChar *) tmp, -1); cur++; base = cur; continue; @@ -1832,9 +2142,9 @@ xmlAttrSerializeTxtContent(xmlBufferPtr buf, xmlDocPtr doc, xmlSaveErr(XML_SAVE_CHAR_INVALID, (xmlNodePtr) attr, NULL); if (doc != NULL) doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); - + xmlSerializeHexCharRef(tmp, *cur); - xmlBufferAdd(buf, (xmlChar *) tmp, -1); + xmlBufAdd(buf, (xmlChar *) tmp, -1); cur++; base = cur; continue; @@ -1844,7 +2154,7 @@ xmlAttrSerializeTxtContent(xmlBufferPtr buf, xmlDocPtr doc, * as a char ref */ xmlSerializeHexCharRef(tmp, val); - xmlBufferAdd(buf, (xmlChar *) tmp, -1); + xmlBufAdd(buf, (xmlChar *) tmp, -1); cur += l; base = cur; } else { @@ -1852,7 +2162,31 @@ xmlAttrSerializeTxtContent(xmlBufferPtr buf, xmlDocPtr doc, } } if (base != cur) - xmlBufferAdd(buf, base, cur - base); + xmlBufAdd(buf, base, cur - base); +} + +/** + * xmlAttrSerializeTxtContent: + * @buf: the XML buffer output + * @doc: the document + * @attr: the attribute node + * @string: the text content + * + * Serialize text attribute values to an xml simple buffer + */ +void +xmlAttrSerializeTxtContent(xmlBufferPtr buf, xmlDocPtr doc, + xmlAttrPtr attr, const xmlChar * string) +{ + xmlBufPtr buffer; + + if ((buf == NULL) || (string == NULL)) + return; + buffer = xmlBufFromBuffer(buf); + if (buffer == NULL) + return; + xmlBufAttrSerializeTxtContent(buffer, doc, attr, string); + xmlBufBackToBuffer(buffer); } /** @@ -1866,6 +2200,8 @@ xmlAttrSerializeTxtContent(xmlBufferPtr buf, xmlDocPtr doc, * Dump an XML node, recursive behaviour,children are printed too. * Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 * or xmlKeepBlanksDefault(0) was called + * Since this is using xmlBuffer structures it is limited to 2GB and somehow + * deprecated, use xmlBufNodeDump() instead. * * Returns the number of bytes written to the buffer or -1 in case of error */ @@ -1873,9 +2209,45 @@ int xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, int format) { - unsigned int use; + xmlBufPtr buffer; + int ret; + + if ((buf == NULL) || (cur == NULL)) + return(-1); + buffer = xmlBufFromBuffer(buf); + if (buffer == NULL) + return(-1); + ret = xmlBufNodeDump(buffer, doc, cur, level, format); + xmlBufBackToBuffer(buffer); + if (ret > INT_MAX) + return(-1); + return((int) ret); +} + +/** + * xmlBufNodeDump: + * @buf: the XML buffer output + * @doc: the document + * @cur: the current node + * @level: the imbrication level for indenting + * @format: is formatting allowed + * + * Dump an XML node, recursive behaviour,children are printed too. + * Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 + * or xmlKeepBlanksDefault(0) was called + * + * Returns the number of bytes written to the buffer, in case of error 0 + * is returned or @buf stores the error + */ + +size_t +xmlBufNodeDump(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, + int format) +{ + size_t use; int ret; xmlOutputBufferPtr outbuf; + int oldalloc; xmlInitParser(); @@ -1906,10 +2278,13 @@ xmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, int level, outbuf->context = NULL; outbuf->written = 0; - use = buf->use; + use = xmlBufUse(buf); + oldalloc = xmlBufGetAllocationScheme(buf); + xmlBufSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT); xmlNodeDumpOutput(outbuf, doc, cur, level, format, NULL); + xmlBufSetAllocationScheme(buf, oldalloc); xmlFree(outbuf); - ret = buf->use - use; + ret = xmlBufUse(buf) - use; return (ret); } @@ -1996,9 +2371,10 @@ xmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, ctxt.doc = doc; ctxt.buf = buf; ctxt.level = level; - ctxt.format = format; + ctxt.format = format ? 1 : 0; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; #ifdef LIBXML_HTML_ENABLED dtd = xmlGetIntSubset(doc); @@ -2081,17 +2457,18 @@ xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr, ctxt.doc = out_doc; ctxt.buf = out_buff; ctxt.level = 0; - ctxt.format = format; + ctxt.format = format ? 1 : 0; ctxt.encoding = (const xmlChar *) txt_encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, out_doc); xmlOutputBufferFlush(out_buff); if (out_buff->conv != NULL) { - *doc_txt_len = out_buff->conv->use; - *doc_txt_ptr = xmlStrndup(out_buff->conv->content, *doc_txt_len); + *doc_txt_len = xmlBufUse(out_buff->conv); + *doc_txt_ptr = xmlStrndup(xmlBufContent(out_buff->conv), *doc_txt_len); } else { - *doc_txt_len = out_buff->buffer->use; - *doc_txt_ptr = xmlStrndup(out_buff->buffer->content, *doc_txt_len); + *doc_txt_len = xmlBufUse(out_buff->buffer); + *doc_txt_ptr = xmlStrndup(xmlBufContent(out_buff->buffer),*doc_txt_len); } (void)xmlOutputBufferClose(out_buff); @@ -2186,21 +2563,23 @@ xmlDocFormatDump(FILE *f, xmlDocPtr cur, int format) { encoding = (const char *) cur->encoding; if (encoding != NULL) { - handler = xmlFindCharEncodingHandler(encoding); - if (handler == NULL) { - xmlFree((char *) cur->encoding); - cur->encoding = NULL; - } + handler = xmlFindCharEncodingHandler(encoding); + if (handler == NULL) { + xmlFree((char *) cur->encoding); + cur->encoding = NULL; + encoding = NULL; } + } buf = xmlOutputBufferCreateFile(f, handler); if (buf == NULL) return(-1); memset(&ctxt, 0, sizeof(ctxt)); ctxt.doc = cur; ctxt.buf = buf; ctxt.level = 0; - ctxt.format = format; + ctxt.format = format ? 1 : 0; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur); ret = xmlOutputBufferClose(buf); @@ -2250,6 +2629,7 @@ xmlSaveFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding) { ctxt.format = 0; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur); ret = xmlOutputBufferClose(buf); return(ret); @@ -2286,9 +2666,10 @@ xmlSaveFormatFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, ctxt.doc = cur; ctxt.buf = buf; ctxt.level = 0; - ctxt.format = format; + ctxt.format = format ? 1 : 0; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur); ret = xmlOutputBufferClose(buf); return (ret); @@ -2331,7 +2712,7 @@ xmlSaveFormatFileEnc( const char * filename, xmlDocPtr cur, #ifdef HAVE_ZLIB_H if (cur->compression < 0) cur->compression = xmlGetCompressMode(); #endif - /* + /* * save the content to a temp buffer. */ buf = xmlOutputBufferCreateFilename(filename, handler, cur->compression); @@ -2340,9 +2721,10 @@ xmlSaveFormatFileEnc( const char * filename, xmlDocPtr cur, ctxt.doc = cur; ctxt.buf = buf; ctxt.level = 0; - ctxt.format = format; + ctxt.format = format ? 1 : 0; ctxt.encoding = (const xmlChar *) encoding; xmlSaveCtxtInit(&ctxt); + ctxt.options |= XML_SAVE_AS_XML; xmlDocContentDumpOutput(&ctxt, cur); diff --git a/gnulib-local/lib/libxml/xmlsave.in.h b/gnulib-local/lib/libxml/xmlsave.in.h index c71c71a..fb329b2 100644 --- a/gnulib-local/lib/libxml/xmlsave.in.h +++ b/gnulib-local/lib/libxml/xmlsave.in.h @@ -30,7 +30,11 @@ typedef enum { XML_SAVE_FORMAT = 1<<0, /* format save output */ XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ - 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_AS_XML = 1<<5, /* force XML serialization on HTML doc */ + XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */ + XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */ } xmlSaveOption; diff --git a/gnulib-local/lib/libxml/xmlschemas.c b/gnulib-local/lib/libxml/xmlschemas.c index 11e3eac..fe533e6 100644 --- a/gnulib-local/lib/libxml/xmlschemas.c +++ b/gnulib-local/lib/libxml/xmlschemas.c @@ -90,7 +90,7 @@ #ifndef DEBUG_IDC_NODE_TABLE #define DEBUG_IDC_NODE_TABLE #endif -#endif +#endif /* #define ENABLE_PARTICLE_RESTRICTION 1 */ @@ -107,7 +107,7 @@ #endif #define UNBOUNDED (1 << 30) -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); @@ -374,7 +374,7 @@ typedef xmlSchemaBucket *xmlSchemaBucketPtr; #define XML_SCHEMA_SCHEMA_REDEFINE 3 /** - * xmlSchemaSchemaRelation: + * xmlSchemaSchemaRelation: * * Used to create a graph of schema relationships. */ @@ -402,12 +402,12 @@ struct _xmlSchemaBucket { int parsed; int imported; int preserveDoc; - xmlSchemaItemListPtr globals; /* Global components. */ + xmlSchemaItemListPtr globals; /* Global components. */ xmlSchemaItemListPtr locals; /* Local components. */ }; /** - * xmlSchemaImport: + * xmlSchemaImport: * (extends xmlSchemaBucket) * * Reflects a schema. Holds some information @@ -422,9 +422,9 @@ struct _xmlSchemaImport { const xmlChar *schemaLocation; /* The URI of the schema document. */ /* For chameleon includes, @origTargetNamespace will be NULL */ const xmlChar *origTargetNamespace; - /* + /* * For chameleon includes, @targetNamespace will be the - * targetNamespace of the including schema. + * targetNamespace of the including schema. */ const xmlChar *targetNamespace; xmlDocPtr doc; /* The schema node-tree. */ @@ -457,7 +457,7 @@ struct _xmlSchemaInclude { int parsed; int imported; int preserveDoc; - xmlSchemaItemListPtr globals; /* Global components. */ + xmlSchemaItemListPtr globals; /* Global components. */ xmlSchemaItemListPtr locals; /* Local components. */ /* The owning main or import schema bucket. */ @@ -517,7 +517,7 @@ struct _xmlSchemaAttributeUse { xmlSchemaTypeType type; xmlSchemaAnnotPtr annot; xmlSchemaAttributeUsePtr next; /* The next attr. use. */ - /* + /* * The attr. decl. OR a QName-ref. to an attr. decl. OR * a QName-ref. to an attribute group definition. */ @@ -573,7 +573,7 @@ struct _xmlSchemaConstructionCtxt { xmlDictPtr dict; xmlSchemaItemListPtr buckets; /* List of schema buckets. */ /* xmlSchemaItemListPtr relations; */ /* List of schema relations. */ - xmlSchemaBucketPtr bucket; /* The current schema bucket */ + xmlSchemaBucketPtr bucket; /* The current schema bucket */ xmlSchemaItemListPtr pending; /* All Components of all schemas that need to be fixed. */ xmlHashTablePtr substGroups; @@ -629,7 +629,7 @@ struct _xmlSchemaParserCtxt { xmlSchemaBucketPtr redefined; /* The schema to be redefined. */ xmlSchemaRedefPtr redef; /* Used for redefinitions. */ - int redefCounter; /* Used for redefinitions. */ + int redefCounter; /* Used for redefinitions. */ xmlSchemaItemListPtr attrProhibs; }; @@ -783,7 +783,7 @@ struct _xmlSchemaPSVIIDCNode { xmlNodePtr node; xmlSchemaPSVIIDCKeyPtr *keys; int nodeLine; - int nodeQNameID; + int nodeQNameID; }; @@ -879,7 +879,7 @@ struct _xmlSchemaIDCMatcher { struct _xmlSchemaNodeInfo { int nodeType; xmlNodePtr node; - int nodeLine; + int nodeLine; const xmlChar *localName; const xmlChar *nsName; const xmlChar *value; @@ -901,7 +901,7 @@ struct _xmlSchemaNodeInfo { const xmlChar **nsBindings; /* Namespace bindings on this element */ int nbNsBindings; - int sizeNsBindings; + int sizeNsBindings; int hasKeyrefs; int appliedXPath; /* Indicates that an XPath has been applied. */ @@ -938,7 +938,7 @@ typedef xmlSchemaAttrInfo *xmlSchemaAttrInfoPtr; struct _xmlSchemaAttrInfo { int nodeType; xmlNodePtr node; - int nodeLine; + int nodeLine; const xmlChar *localName; const xmlChar *nsName; const xmlChar *value; @@ -975,6 +975,7 @@ struct _xmlSchemaValidCtxt { xmlSAXHandlerPtr sax; xmlParserCtxtPtr parserCtxt; void *user_data; /* TODO: What is this for? */ + char *filename; int err; int nberrors; @@ -1028,6 +1029,10 @@ struct _xmlSchemaValidCtxt { int hasKeyrefs; int createIDCNodeTables; int psviExposeIDCNodeTables; + + /* Locator for error reporting in streaming mode */ + xmlSchemaValidityLocatorFunc locFunc; + void *locCtxt; }; /** @@ -1043,9 +1048,9 @@ struct _xmlSchemaSubstGroup { }; /************************************************************************ - * * - * Some predeclarations * - * * + * * + * Some predeclarations * + * * ************************************************************************/ static int xmlSchemaParseInclude(xmlSchemaParserCtxtPtr ctxt, @@ -1098,7 +1103,7 @@ xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt, /************************************************************************ * * - * Helper functions * + * Helper functions * * * ************************************************************************/ @@ -1172,7 +1177,7 @@ xmlSchemaGetComponentTypeStr(xmlSchemaBasicItemPtr item) if (WXS_IS_COMPLEX(WXS_TYPE_CAST item)) return(BAD_CAST "complex type definition"); else - return(BAD_CAST "simple type definition"); + return(BAD_CAST "simple type definition"); default: return(xmlSchemaItemTypeToStr(item->type)); } @@ -1300,11 +1305,11 @@ xmlSchemaFormatQName(xmlChar **buf, *buf = xmlStrcat(*buf, localName); } else { *buf = xmlStrcat(*buf, BAD_CAST "(NULL)"); - } + } return ((const xmlChar *) *buf); } -static const xmlChar* +static const xmlChar* xmlSchemaFormatQNameNs(xmlChar **buf, xmlNsPtr ns, const xmlChar *localName) { if (ns != NULL) @@ -1466,7 +1471,7 @@ xmlSchemaWildcardPCToString(int pc) * @retValue: the returned value * @ws: the whitespace type of the value * - * Get a the cononical representation of the value. + * Get a the canonical representation of the value. * The caller has to free the returned retValue. * * Returns 0 if the value could be built and -1 in case of @@ -1480,16 +1485,16 @@ xmlSchemaGetCanonValueWhtspExt(xmlSchemaValPtr val, int list; xmlSchemaValType valType; const xmlChar *value, *value2 = NULL; - + if ((retValue == NULL) || (val == NULL)) return (-1); list = xmlSchemaValueGetNext(val) ? 1 : 0; *retValue = NULL; do { - value = NULL; - valType = xmlSchemaGetValType(val); - switch (valType) { + value = NULL; + valType = xmlSchemaGetValType(val); + switch (valType) { case XML_SCHEMAS_STRING: case XML_SCHEMAS_NORMSTRING: case XML_SCHEMAS_ANYSIMPLETYPE: @@ -1502,7 +1507,7 @@ xmlSchemaGetCanonValueWhtspExt(xmlSchemaValPtr val, if (value2 != NULL) value = value2; } - break; + break; default: if (xmlSchemaGetCanonValue(val, &value2) == -1) { if (value2 != NULL) @@ -1540,29 +1545,29 @@ internal_error: * @buf: the string buffer * @itemDes: the designation of the item * @itemName: the name of the item - * @item: the item as an object + * @item: the item as an object * @itemNode: the node of the item * @local: the local name * @parsing: if the function is used during the parse * * Returns a representation of the given item used - * for error reports. + * for error reports. * - * The following order is used to build the resulting + * The following order is used to build the resulting * designation if the arguments are not NULL: * 1a. If itemDes not NULL -> itemDes * 1b. If (itemDes not NULL) and (itemName not NULL) * -> itemDes + itemName * 2. If the preceding was NULL and (item not NULL) -> item * 3. If the preceding was NULL and (itemNode not NULL) -> itemNode - * + * * If the itemNode is an attribute node, the name of the attribute * will be appended to the result. * * Returns the formatted string and sets @buf to the resulting value. - */ -static xmlChar* -xmlSchemaFormatItemForReport(xmlChar **buf, + */ +static xmlChar* +xmlSchemaFormatItemForReport(xmlChar **buf, const xmlChar *itemDes, xmlSchemaBasicItemPtr item, xmlNodePtr itemNode) @@ -1574,9 +1579,9 @@ xmlSchemaFormatItemForReport(xmlChar **buf, xmlFree(*buf); *buf = NULL; } - + if (itemDes != NULL) { - *buf = xmlStrdup(itemDes); + *buf = xmlStrdup(itemDes); } else if (item != NULL) { switch (item->type) { case XML_SCHEMA_TYPE_BASIC: { @@ -1634,7 +1639,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, break; case XML_SCHEMA_TYPE_ATTRIBUTE_USE: { xmlSchemaAttributeUsePtr ause; - + ause = WXS_ATTR_USE_CAST item; *buf = xmlStrdup(BAD_CAST "attribute use "); if (WXS_ATTRUSE_DECL(ause) != NULL) { @@ -1650,7 +1655,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, break; case XML_SCHEMA_TYPE_ATTRIBUTE: { xmlSchemaAttributePtr attr; - + attr = (xmlSchemaAttributePtr) item; *buf = xmlStrdup(BAD_CAST "attribute decl."); *buf = xmlStrcat(*buf, BAD_CAST " '"); @@ -1666,7 +1671,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, case XML_SCHEMA_TYPE_ELEMENT: { xmlSchemaElementPtr elem; - elem = (xmlSchemaElementPtr) item; + elem = (xmlSchemaElementPtr) item; *buf = xmlStrdup(BAD_CAST "element decl."); *buf = xmlStrcat(*buf, BAD_CAST " '"); *buf = xmlStrcat(*buf, xmlSchemaFormatQName(&str, @@ -1676,7 +1681,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, break; case XML_SCHEMA_TYPE_IDC_UNIQUE: case XML_SCHEMA_TYPE_IDC_KEY: - case XML_SCHEMA_TYPE_IDC_KEYREF: + case XML_SCHEMA_TYPE_IDC_KEYREF: if (item->type == XML_SCHEMA_TYPE_IDC_UNIQUE) *buf = xmlStrdup(BAD_CAST "unique '"); else if (item->type == XML_SCHEMA_TYPE_IDC_KEY) @@ -1732,7 +1737,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, default: named = 0; } - } else + } else named = 0; if ((named == 0) && (itemNode != NULL)) { @@ -1740,7 +1745,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, if (itemNode->type == XML_ATTRIBUTE_NODE) elem = itemNode->parent; - else + else elem = itemNode; *buf = xmlStrdup(BAD_CAST "Element '"); if (elem->ns != NULL) { @@ -1750,7 +1755,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, } else *buf = xmlStrcat(*buf, elem->name); *buf = xmlStrcat(*buf, BAD_CAST "'"); - + } if ((itemNode != NULL) && (itemNode->type == XML_ATTRIBUTE_NODE)) { *buf = xmlStrcat(*buf, BAD_CAST ", attribute '"); @@ -1763,7 +1768,7 @@ xmlSchemaFormatItemForReport(xmlChar **buf, *buf = xmlStrcat(*buf, BAD_CAST "'"); } FREE_AND_NULL(str) - + return (*buf); } @@ -1786,13 +1791,13 @@ xmlSchemaFormatFacetEnumSet(xmlSchemaAbstractCtxtPtr actxt, int res, found = 0; if (*buf != NULL) - xmlFree(*buf); + xmlFree(*buf); *buf = NULL; do { /* * Use the whitespace type of the base type. - */ + */ ws = xmlSchemaGetWhiteSpaceFacetValue(type->baseType); for (facet = type->facets; facet != NULL; facet = facet->next) { if (facet->type != XML_SCHEMA_FACET_ENUMERATION) @@ -1836,7 +1841,7 @@ xmlSchemaFormatFacetEnumSet(xmlSchemaAbstractCtxtPtr actxt, /************************************************************************ * * - * Error functions * + * Error functions * * * ************************************************************************/ @@ -1881,7 +1886,7 @@ xmlSchemaPErrMemory(xmlSchemaParserCtxtPtr ctxt, * @msg: the error message * @str1: extra data * @str2: extra data - * + * * Handle a parser error */ static void @@ -1914,7 +1919,7 @@ xmlSchemaPErr(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, * @msg: the error message * @str1: extra data * @str2: extra data - * + * * Handle a parser error */ static void @@ -1933,7 +1938,7 @@ xmlSchemaPErr2(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, * xmlSchemaPErrExt: * @ctxt: the parsing context * @node: the context node - * @error: the error code + * @error: the error code * @strData1: extra data * @strData2: extra data * @strData3: extra data @@ -1943,13 +1948,13 @@ xmlSchemaPErr2(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, * @str3: extra parameter for the message display * @str4: extra parameter for the message display * @str5: extra parameter for the message display - * + * * Handle a parser error */ static void xmlSchemaPErrExt(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, - const xmlChar * strData1, const xmlChar * strData2, - const xmlChar * strData3, const char *msg, const xmlChar * str1, + const xmlChar * strData1, const xmlChar * strData2, + const xmlChar * strData3, const char *msg, const xmlChar * str1, const xmlChar * str2, const xmlChar * str3, const xmlChar * str4, const xmlChar * str5) { @@ -1967,14 +1972,14 @@ xmlSchemaPErrExt(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, } __xmlRaiseError(schannel, channel, data, ctxt, node, XML_FROM_SCHEMASP, error, XML_ERR_ERROR, NULL, 0, - (const char *) strData1, (const char *) strData2, - (const char *) strData3, 0, 0, msg, str1, str2, + (const char *) strData1, (const char *) strData2, + (const char *) strData3, 0, 0, msg, str1, str2, str3, str4, str5); } /************************************************************************ * * - * Allround error functions * + * Allround error functions * * * ************************************************************************/ @@ -2016,7 +2021,7 @@ xmlSchemaPSimpleInternalErr(xmlNodePtr node, * @str1: extra data * @str2: extra data * @str3: extra data - * + * * Handle a validation error */ static void @@ -2028,16 +2033,17 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, { xmlStructuredErrorFunc schannel = NULL; xmlGenericErrorFunc channel = NULL; - void *data = NULL; - + void *data = NULL; + if (ctxt != NULL) { if (ctxt->type == XML_SCHEMA_CTXT_VALIDATOR) { xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctxt; const char *file = NULL; + int col = 0; if (errorLevel != XML_ERR_WARNING) { vctxt->nberrors++; vctxt->err = error; - channel = vctxt->error; + channel = vctxt->error; } else { channel = vctxt->warning; } @@ -2062,6 +2068,7 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, (vctxt->parserCtxt->input != NULL)) { file = vctxt->parserCtxt->input->filename; line = vctxt->parserCtxt->input->line; + col = vctxt->parserCtxt->input->col; } } else { /* @@ -2077,19 +2084,33 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, else if ((vctxt->parserCtxt != NULL) && (vctxt->parserCtxt->input != NULL)) file = vctxt->parserCtxt->input->filename; - } + } + if (vctxt->locFunc != NULL) { + if ((file == NULL) || (line == 0)) { + unsigned long l; + const char *f; + vctxt->locFunc(vctxt->locCtxt, &f, &l); + if (file == NULL) + file = f; + if (line == 0) + line = (int) l; + } + } + if ((file == NULL) && (vctxt->filename != NULL)) + file = vctxt->filename; + __xmlRaiseError(schannel, channel, data, ctxt, node, XML_FROM_SCHEMASV, error, errorLevel, file, line, (const char *) str1, (const char *) str2, - (const char *) str3, 0, 0, msg, str1, str2, str3, str4); + (const char *) str3, 0, col, msg, str1, str2, str3, str4); } else if (ctxt->type == XML_SCHEMA_CTXT_PARSER) { xmlSchemaParserCtxtPtr pctxt = (xmlSchemaParserCtxtPtr) ctxt; if (errorLevel != XML_ERR_WARNING) { pctxt->nberrors++; pctxt->err = error; - channel = pctxt->error; + channel = pctxt->error; } else { channel = pctxt->warning; } @@ -2115,11 +2136,11 @@ xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, * @str1: extra data * @str2: extra data * @str3: extra data - * + * * Handle a validation error */ static void -xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt, +xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt, int error, xmlNodePtr node, const char *msg, const xmlChar *str1, const xmlChar *str2, const xmlChar *str3) { @@ -2128,7 +2149,7 @@ xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt, } static void -xmlSchemaErr4(xmlSchemaAbstractCtxtPtr actxt, +xmlSchemaErr4(xmlSchemaAbstractCtxtPtr actxt, int error, xmlNodePtr node, const char *msg, const xmlChar *str1, const xmlChar *str2, const xmlChar *str3, const xmlChar *str4) @@ -2157,7 +2178,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, (node->type != XML_ELEMENT_NODE) && (node->type != XML_ATTRIBUTE_NODE)) { - /* + /* * Don't try to format other nodes than element and * attribute nodes. * Play save and return an empty string. @@ -2171,7 +2192,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, */ if (node->type == XML_ATTRIBUTE_NODE) { xmlNodePtr elem = node->parent; - + *msg = xmlStrdup(BAD_CAST "Element '"); if (elem->ns != NULL) *msg = xmlStrcat(*msg, xmlSchemaFormatQName(&str, @@ -2181,7 +2202,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, NULL, elem->name)); FREE_AND_NULL(str); *msg = xmlStrcat(*msg, BAD_CAST "', "); - *msg = xmlStrcat(*msg, BAD_CAST "attribute '"); + *msg = xmlStrcat(*msg, BAD_CAST "attribute '"); } else { *msg = xmlStrdup(BAD_CAST "Element '"); } @@ -2197,7 +2218,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) actxt; /* * Work on node infos. - */ + */ if (vctxt->inode->nodeType == XML_ATTRIBUTE_NODE) { xmlSchemaNodeInfoPtr ielem = vctxt->elemInfos[vctxt->depth]; @@ -2207,7 +2228,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, ielem->nsName, ielem->localName)); FREE_AND_NULL(str); *msg = xmlStrcat(*msg, BAD_CAST "', "); - *msg = xmlStrcat(*msg, BAD_CAST "attribute '"); + *msg = xmlStrcat(*msg, BAD_CAST "attribute '"); } else { *msg = xmlStrdup(BAD_CAST "Element '"); } @@ -2216,7 +2237,7 @@ xmlSchemaFormatNodeForError(xmlChar ** msg, FREE_AND_NULL(str); *msg = xmlStrcat(*msg, BAD_CAST "': "); } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) { - /* + /* * Hmm, no node while parsing? * Return an empty string, in case NULL will break something. */ @@ -2254,7 +2275,7 @@ xmlSchemaInternalErr2(xmlSchemaAbstractCtxtPtr actxt, return; msg = xmlStrdup(BAD_CAST "Internal error: "); msg = xmlStrcat(msg, BAD_CAST funcName); - msg = xmlStrcat(msg, BAD_CAST ", "); + msg = xmlStrcat(msg, BAD_CAST ", "); msg = xmlStrcat(msg, BAD_CAST message); msg = xmlStrcat(msg, BAD_CAST ".\n"); @@ -2262,7 +2283,7 @@ xmlSchemaInternalErr2(xmlSchemaAbstractCtxtPtr actxt, xmlSchemaErr(actxt, XML_SCHEMAV_INTERNAL, NULL, (const char *) msg, str1, str2); - else if (actxt->type == XML_SCHEMA_CTXT_PARSER) + else if (actxt->type == XML_SCHEMA_CTXT_PARSER) xmlSchemaErr(actxt, XML_SCHEMAP_INTERNAL, NULL, (const char *) msg, str1, str2); @@ -2309,7 +2330,7 @@ xmlSchemaCustomErr4(xmlSchemaAbstractCtxtPtr actxt, } else xmlSchemaFormatNodeForError(&msg, actxt, node); msg = xmlStrcat(msg, (const xmlChar *) message); - msg = xmlStrcat(msg, BAD_CAST ".\n"); + msg = xmlStrcat(msg, BAD_CAST ".\n"); xmlSchemaErr4(actxt, error, node, (const char *) msg, str1, str2, str3, str4); FREE_AND_NULL(msg) @@ -2325,7 +2346,7 @@ xmlSchemaCustomErr(xmlSchemaAbstractCtxtPtr actxt, const xmlChar *str2) { xmlSchemaCustomErr4(actxt, error, node, item, - message, str1, str2, NULL, NULL); + message, str1, str2, NULL, NULL); } @@ -2344,8 +2365,8 @@ xmlSchemaCustomWarning(xmlSchemaAbstractCtxtPtr actxt, xmlSchemaFormatNodeForError(&msg, actxt, node); msg = xmlStrcat(msg, (const xmlChar *) message); - msg = xmlStrcat(msg, BAD_CAST ".\n"); - + msg = xmlStrcat(msg, BAD_CAST ".\n"); + /* URGENT TODO: Set the error code to something sane. */ xmlSchemaErr4Line(actxt, XML_ERR_WARNING, error, node, 0, (const char *) msg, str1, str2, str3, NULL); @@ -2365,15 +2386,15 @@ xmlSchemaKeyrefErr(xmlSchemaValidCtxtPtr vctxt, const xmlChar *str2) { xmlChar *msg = NULL, *qname = NULL; - - msg = xmlStrdup(BAD_CAST "Element '%s': "); + + msg = xmlStrdup(BAD_CAST "Element '%s': "); msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST ".\n"); xmlSchemaErr4Line(ACTXT_CAST vctxt, XML_ERR_ERROR, error, NULL, idcNode->nodeLine, (const char *) msg, xmlSchemaFormatQName(&qname, vctxt->nodeQNames->items[idcNode->nodeQNameID +1], - vctxt->nodeQNames->items[idcNode->nodeQNameID]), + vctxt->nodeQNames->items[idcNode->nodeQNameID]), str1, str2, NULL); FREE_AND_NULL(qname); FREE_AND_NULL(msg); @@ -2456,7 +2477,7 @@ xmlSchemaSimpleTypeErr(xmlSchemaAbstractCtxtPtr actxt, if (type->builtInType != 0) { msg = xmlStrcat(msg, BAD_CAST "xs:"); msg = xmlStrcat(msg, type->name); - } else + } else msg = xmlStrcat(msg, xmlSchemaFormatQName(&str, type->targetNamespace, type->name)); @@ -2494,12 +2515,12 @@ xmlSchemaIllegalAttrErr(xmlSchemaAbstractCtxtPtr actxt, xmlNodePtr node) { xmlChar *msg = NULL, *str = NULL; - + xmlSchemaFormatNodeForError(&msg, actxt, node); msg = xmlStrcat(msg, BAD_CAST "The attribute '%s' is not allowed.\n"); xmlSchemaErr(actxt, error, node, (const char *) msg, xmlSchemaFormatErrorNodeQName(&str, (xmlSchemaNodeInfoPtr) ni, node), - NULL); + NULL); FREE_AND_NULL(str) FREE_AND_NULL(msg) } @@ -2518,7 +2539,7 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, xmlChar *localName, *nsName; const xmlChar *cur, *end; int i; - + xmlSchemaFormatNodeForError(&msg, actxt, node); msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST "."); @@ -2533,7 +2554,7 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, } else str = xmlStrdup(BAD_CAST " Expected is ( "); nsName = NULL; - + for (i = 0; i < nbval + nbneg; i++) { cur = values[i]; if (cur == NULL) @@ -2547,7 +2568,7 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, * Get the local name. */ localName = NULL; - + end = cur; if (*end == '*') { localName = xmlStrdup(BAD_CAST "*"); @@ -2556,8 +2577,8 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, while ((*end != 0) && (*end != '|')) end++; localName = xmlStrncat(localName, BAD_CAST cur, end - cur); - } - if (*end != 0) { + } + if (*end != 0) { end++; /* * Skip "*|*" if they come with negated expressions, since @@ -2573,12 +2594,12 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, } else { while (*end != 0) end++; - + if (i >= nbval) nsName = xmlStrdup(BAD_CAST "{##other:"); else nsName = xmlStrdup(BAD_CAST "{"); - + nsName = xmlStrncat(nsName, BAD_CAST cur, end - cur); nsName = xmlStrcat(nsName, BAD_CAST "}"); } @@ -2588,13 +2609,13 @@ xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, FREE_AND_NULL(localName); continue; } - } + } str = xmlStrcat(str, BAD_CAST localName); FREE_AND_NULL(localName); - + if (i < nbval + nbneg -1) str = xmlStrcat(str, BAD_CAST ", "); - } + } str = xmlStrcat(str, BAD_CAST " ).\n"); msg = xmlStrcat(msg, BAD_CAST str); FREE_AND_NULL(str) @@ -2626,8 +2647,8 @@ xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, /* * If enumerations are validated, one must not expect the * facet to be given. - */ - } else + */ + } else facetType = facet->type; msg = xmlStrcat(msg, BAD_CAST "["); msg = xmlStrcat(msg, BAD_CAST "facet '"); @@ -2655,31 +2676,31 @@ xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, snprintf(actLen, 24, "%lu", length); if (facetType == XML_SCHEMA_FACET_LENGTH) - msg = xmlStrcat(msg, - BAD_CAST "this differs from the allowed length of '%s'.\n"); + msg = xmlStrcat(msg, + BAD_CAST "this differs from the allowed length of '%s'.\n"); else if (facetType == XML_SCHEMA_FACET_MAXLENGTH) - msg = xmlStrcat(msg, + msg = xmlStrcat(msg, BAD_CAST "this exceeds the allowed maximum length of '%s'.\n"); else if (facetType == XML_SCHEMA_FACET_MINLENGTH) - msg = xmlStrcat(msg, + msg = xmlStrcat(msg, BAD_CAST "this underruns the allowed minimum length of '%s'.\n"); - + if (nodeType == XML_ATTRIBUTE_NODE) xmlSchemaErr3(actxt, error, node, (const char *) msg, value, (const xmlChar *) actLen, (const xmlChar *) len); - else + else xmlSchemaErr(actxt, error, node, (const char *) msg, (const xmlChar *) actLen, (const xmlChar *) len); - + } else if (facetType == XML_SCHEMA_FACET_ENUMERATION) { msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not an element " "of the set {%s}.\n"); - xmlSchemaErr(actxt, error, node, (const char *) msg, value, + xmlSchemaErr(actxt, error, node, (const char *) msg, value, xmlSchemaFormatFacetEnumSet(actxt, &str, type)); } else if (facetType == XML_SCHEMA_FACET_PATTERN) { msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not accepted " "by the pattern '%s'.\n"); - xmlSchemaErr(actxt, error, node, (const char *) msg, value, + xmlSchemaErr(actxt, error, node, (const char *) msg, value, facet->value); } else if (facetType == XML_SCHEMA_FACET_MININCLUSIVE) { msg = xmlStrcat(msg, BAD_CAST "The value '%s' is less than the " @@ -2711,10 +2732,10 @@ xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, "digits than are allowed ('%s').\n"); xmlSchemaErr(actxt, error, node, (const char*) msg, value, facet->value); - } else if (nodeType == XML_ATTRIBUTE_NODE) { + } else if (nodeType == XML_ATTRIBUTE_NODE) { msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not facet-valid.\n"); - xmlSchemaErr(actxt, error, node, (const char *) msg, value, NULL); - } else { + xmlSchemaErr(actxt, error, node, (const char *) msg, value, NULL); + } else { msg = xmlStrcat(msg, BAD_CAST "The value is not facet-valid.\n"); xmlSchemaErr(actxt, error, node, (const char *) msg, NULL, NULL); } @@ -2722,7 +2743,7 @@ xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST ".\n"); xmlSchemaErr(actxt, error, node, (const char *) msg, str1, str2); - } + } FREE_AND_NULL(str) xmlFree(msg); } @@ -2967,9 +2988,9 @@ xmlSchemaPAttrUseErr4(xmlSchemaParserCtxtPtr ctxt, const xmlChar *str3,const xmlChar *str4) { xmlChar *str = NULL, *msg = NULL; - + xmlSchemaFormatItemForReport(&msg, NULL, ownerItem, NULL); - msg = xmlStrcat(msg, BAD_CAST ", "); + msg = xmlStrcat(msg, BAD_CAST ", "); msg = xmlStrcat(msg, BAD_CAST xmlSchemaFormatItemForReport(&str, NULL, WXS_BASIC_CAST attruse, NULL)); @@ -2977,7 +2998,7 @@ xmlSchemaPAttrUseErr4(xmlSchemaParserCtxtPtr ctxt, msg = xmlStrcat(msg, BAD_CAST ": "); msg = xmlStrcat(msg, (const xmlChar *) message); msg = xmlStrcat(msg, BAD_CAST ".\n"); - xmlSchemaErr4(ACTXT_CAST ctxt, error, node, + xmlSchemaErr4(ACTXT_CAST ctxt, error, node, (const char *) msg, str1, str2, str3, str4); xmlFree(msg); } @@ -3071,7 +3092,7 @@ xmlSchemaPMutualExclAttrErr(xmlSchemaParserCtxtPtr ctxt, * @error: the error code * @type: the type specifier * @ownerDes: the designation of the owner - * @ownerItem: the schema object if existent + * @ownerItem: the schema object if existent * @node: the validated node * @value: the validated value * @@ -3079,7 +3100,7 @@ xmlSchemaPMutualExclAttrErr(xmlSchemaParserCtxtPtr ctxt, * TODO: Should this report the value of an element as well? */ static void -xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, +xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, xmlParserErrors error, xmlSchemaBasicItemPtr ownerItem ATTRIBUTE_UNUSED, xmlNodePtr node, @@ -3091,37 +3112,37 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, const xmlChar *str2) { xmlChar *msg = NULL; - + xmlSchemaFormatNodeForError(&msg, ACTXT_CAST ctxt, node); if (message == NULL) { /* * Use default messages. - */ + */ if (type != NULL) { if (node->type == XML_ATTRIBUTE_NODE) msg = xmlStrcat(msg, BAD_CAST "'%s' is not a valid value of "); else msg = xmlStrcat(msg, BAD_CAST "The character content is not a " - "valid value of "); + "valid value of "); if (! xmlSchemaIsGlobalItem(type)) msg = xmlStrcat(msg, BAD_CAST "the local "); else msg = xmlStrcat(msg, BAD_CAST "the "); - + if (WXS_IS_ATOMIC(type)) msg = xmlStrcat(msg, BAD_CAST "atomic type"); else if (WXS_IS_LIST(type)) msg = xmlStrcat(msg, BAD_CAST "list type"); else if (WXS_IS_UNION(type)) msg = xmlStrcat(msg, BAD_CAST "union type"); - + if (xmlSchemaIsGlobalItem(type)) { xmlChar *str = NULL; msg = xmlStrcat(msg, BAD_CAST " '"); if (type->builtInType != 0) { msg = xmlStrcat(msg, BAD_CAST "xs:"); msg = xmlStrcat(msg, type->name); - } else + } else msg = xmlStrcat(msg, xmlSchemaFormatQName(&str, type->targetNamespace, type->name)); @@ -3134,7 +3155,7 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, else msg = xmlStrcat(msg, BAD_CAST "The character content is not " "valid."); - } + } if (expected) { msg = xmlStrcat(msg, BAD_CAST " Expected is '"); msg = xmlStrcat(msg, BAD_CAST expected); @@ -3151,7 +3172,7 @@ xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPErrExt(ctxt, node, error, NULL, NULL, NULL, (const char*) msg, str1, str2, NULL, NULL, NULL); } - /* Cleanup. */ + /* Cleanup. */ FREE_AND_NULL(msg) } @@ -3199,25 +3220,25 @@ xmlSchemaPContentErr(xmlSchemaParserCtxtPtr ctxt, } /************************************************************************ - * * - * Streamable error functions * - * * + * * + * Streamable error functions * + * * ************************************************************************/ /************************************************************************ - * * - * Validation helper functions * - * * + * * + * Validation helper functions * + * * ************************************************************************/ /************************************************************************ - * * - * Allocation functions * - * * + * * + * Allocation functions * + * * ************************************************************************/ /** @@ -3372,7 +3393,7 @@ xmlSchemaItemListAddSize(xmlSchemaItemListPtr list, static int xmlSchemaItemListInsert(xmlSchemaItemListPtr list, void *item, int idx) -{ +{ if (list->items == NULL) { list->items = (void **) xmlMalloc( 20 * sizeof(void *)); @@ -3412,7 +3433,7 @@ xmlSchemaItemListInsertSize(xmlSchemaItemListPtr list, int initialSize, void *item, int idx) -{ +{ if (list->items == NULL) { if (initialSize <= 0) initialSize = 1; @@ -3467,7 +3488,7 @@ xmlSchemaItemListRemove(xmlSchemaItemListPtr list, int idx) list->sizeItems = 0; } else if (list->nbItems -1 == idx) { list->nbItems--; - } else { + } else { for (i = idx; i < list->nbItems -1; i++) list->items[i] = list->items[i+1]; list->nbItems--; @@ -3502,19 +3523,19 @@ xmlSchemaBucketFree(xmlSchemaBucketPtr bucket) } if (bucket->locals != NULL) { xmlSchemaComponentListFree(bucket->locals); - xmlSchemaItemListFree(bucket->locals); + xmlSchemaItemListFree(bucket->locals); } if (bucket->relations != NULL) { xmlSchemaSchemaRelationPtr prev, cur = bucket->relations; do { - prev = cur; + prev = cur; cur = cur->next; xmlFree(prev); } while (cur != NULL); } if ((! bucket->preserveDoc) && (bucket->doc != NULL)) { xmlFreeDoc(bucket->doc); - } + } if (bucket->type == XML_SCHEMA_SCHEMA_IMPORT) { if (WXS_IMPBUCKET(bucket)->schema != NULL) xmlSchemaFree(WXS_IMPBUCKET(bucket)->schema); @@ -3559,7 +3580,7 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, xmlFree(ret); return(NULL); } - /* + /* * The following will assure that only the first bucket is marked as * XML_SCHEMA_SCHEMA_MAIN and it points to the *main* schema. * For each following import buckets an xmlSchema will be created. @@ -3573,7 +3594,7 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, xmlSchemaBucketFree(ret); return(NULL); } - /* Force the type to be XML_SCHEMA_SCHEMA_MAIN. */ + /* Force the type to be XML_SCHEMA_SCHEMA_MAIN. */ ret->type = XML_SCHEMA_SCHEMA_MAIN; /* Point to the *main* schema. */ WXS_CONSTRUCTOR(pctxt)->mainBucket = ret; @@ -3583,12 +3604,12 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, */ mainSchema->targetNamespace = targetNamespace; } else { - if (type == XML_SCHEMA_SCHEMA_MAIN) { + if (type == XML_SCHEMA_SCHEMA_MAIN) { PERROR_INT("xmlSchemaBucketCreate", "main bucket but it's not the first one"); xmlSchemaBucketFree(ret); return(NULL); - } else if (type == XML_SCHEMA_SCHEMA_IMPORT) { + } else if (type == XML_SCHEMA_SCHEMA_IMPORT) { /* * Create a schema for imports and assign the * targetNamespace. @@ -3600,7 +3621,7 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, } WXS_IMPBUCKET(ret)->schema->targetNamespace = targetNamespace; } - } + } if (WXS_IS_BUCKET_IMPMAIN(type)) { int res; /* @@ -3643,11 +3664,11 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt, if (mainSchema->includes == NULL) { xmlSchemaBucketFree(ret); return(NULL); - } + } } xmlSchemaItemListAdd(mainSchema->includes, ret); } - /* + /* * Add to list of all buckets; this is used for lookup * during schema construction time only. */ @@ -4015,7 +4036,7 @@ xmlSchemaComponentListFree(xmlSchemaItemListPtr list) for (i = 0; i < list->nbItems; i++) { item = items[i]; if (item == NULL) - continue; + continue; switch (item->type) { case XML_SCHEMA_TYPE_SIMPLE: case XML_SCHEMA_TYPE_COMPLEX: @@ -4122,7 +4143,7 @@ xmlSchemaFree(xmlSchemaPtr schema) xmlSchemaItemListPtr list = (xmlSchemaItemListPtr) schema->includes; int i; for (i = 0; i < list->nbItems; i++) { - xmlSchemaBucketFree((xmlSchemaBucketPtr) list->items[i]); + xmlSchemaBucketFree((xmlSchemaBucketPtr) list->items[i]); } xmlSchemaItemListFree(list); } @@ -4135,9 +4156,9 @@ xmlSchemaFree(xmlSchemaPtr schema) } /************************************************************************ - * * - * Debug functions * - * * + * * + * Debug functions * + * * ************************************************************************/ #ifdef LIBXML_OUTPUT_ENABLED @@ -4274,7 +4295,7 @@ xmlSchemaContentModelDump(xmlSchemaParticlePtr particle, FILE * output, int dept for (i = 0;((i < depth) && (i < 25));i++) shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = 0; - fprintf(output, shift); + fprintf(output, "%s", shift); if (particle->children == NULL) { fprintf(output, "MISSING particle term\n"); return; @@ -4330,7 +4351,7 @@ xmlSchemaContentModelDump(xmlSchemaParticlePtr particle, FILE * output, int dept /** * xmlSchemaAttrUsesDump: * @uses: attribute uses list - * @output: the file output + * @output: the file output * * Dumps a list of attribute use components. */ @@ -4347,7 +4368,7 @@ xmlSchemaAttrUsesDump(xmlSchemaItemListPtr uses, FILE * output) if ((uses == NULL) || (uses->nbItems == 0)) return; - fprintf(output, " attributes:\n"); + fprintf(output, " attributes:\n"); for (i = 0; i < uses->nbItems; i++) { use = uses->items[i]; if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) { @@ -4533,7 +4554,7 @@ xmlSchemaDebugDumpIDCTable(FILE * output, return; do { fprintf(output, "IDC: BINDING '%s' (%d)\n", - xmlSchemaGetComponentQName(&str, + xmlSchemaGetComponentQName(&str, bind->definition), bind->nbNodes); FREE_AND_NULL(str) for (i = 0; i < bind->nbNodes; i++) { @@ -4587,7 +4608,7 @@ xmlSchemaDebugDumpIDCTable(FILE * output, /************************************************************************ * * - * Utilities * + * Utilities * * * ************************************************************************/ @@ -4634,7 +4655,7 @@ xmlSchemaGetPropNodeNs(xmlNodePtr node, const char *uri, const char *name) xmlAttrPtr prop; if ((node == NULL) || (name == NULL)) - return(NULL); + return(NULL); prop = node->properties; while (prop != NULL) { if ((prop->ns != NULL) && @@ -4692,9 +4713,9 @@ xmlSchemaGetProp(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, } /************************************************************************ - * * - * Parsing functions * - * * + * * + * Parsing functions * + * * ************************************************************************/ #define WXS_FIND_GLOBAL_ITEM(slot) \ @@ -4729,12 +4750,12 @@ xmlSchemaGetElem(xmlSchemaPtr schema, const xmlChar * name, const xmlChar * nsName) { xmlSchemaElementPtr ret = NULL; - + if ((name == NULL) || (schema == NULL)) return(NULL); if (schema != NULL) { WXS_FIND_GLOBAL_ITEM(elemDecl) - } + } exit: #ifdef DEBUG if (ret == NULL) { @@ -4765,9 +4786,9 @@ xmlSchemaGetType(xmlSchemaPtr schema, const xmlChar * name, xmlSchemaTypePtr ret = NULL; if (name == NULL) - return (NULL); + return (NULL); /* First try the built-in types. */ - if ((nsName != NULL) && xmlStrEqual(nsName, xmlSchemaNs)) { + if ((nsName != NULL) && xmlStrEqual(nsName, xmlSchemaNs)) { ret = xmlSchemaGetPredefinedType(name, nsName); if (ret != NULL) goto exit; @@ -4780,7 +4801,7 @@ xmlSchemaGetType(xmlSchemaPtr schema, const xmlChar * name, } if (schema != NULL) { WXS_FIND_GLOBAL_ITEM(typeDecl) - } + } exit: #ifdef DEBUG @@ -4891,7 +4912,7 @@ xmlSchemaGetGroup(xmlSchemaPtr schema, const xmlChar * name, WXS_FIND_GLOBAL_ITEM(groupDecl) } exit: - + #ifdef DEBUG if (ret == NULL) { if (nsName == NULL) @@ -4966,9 +4987,9 @@ xmlSchemaGetNamedComponent(xmlSchemaPtr schema, } /************************************************************************ - * * - * Parsing functions * - * * + * * + * Parsing functions * + * * ************************************************************************/ #define IS_BLANK_NODE(n) \ @@ -5000,7 +5021,7 @@ xmlSchemaIsBlank(xmlChar * str, int len) str++; len--; } - + return (1); } @@ -5061,7 +5082,7 @@ xmlSchemaFindRedefCompInGraph(xmlSchemaBucketPtr bucket, default: /* Should not be hit. */ return(NULL); - } + } } } subschemas: @@ -5209,7 +5230,7 @@ xmlSchemaAddAttributeUse(xmlSchemaParserCtxtPtr pctxt, * resolve references to the redefined components and to check constraints. */ static xmlSchemaRedefPtr -xmlSchemaAddRedef(xmlSchemaParserCtxtPtr pctxt, +xmlSchemaAddRedef(xmlSchemaParserCtxtPtr pctxt, xmlSchemaBucketPtr targetBucket, void *item, const xmlChar *refName, @@ -5272,7 +5293,7 @@ xmlSchemaAddAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt, ret->type = XML_SCHEMA_TYPE_ATTRIBUTEGROUP; ret->name = name; ret->targetNamespace = nsName; - ret->node = node; + ret->node = node; /* TODO: Remove the flag. */ ret->flags |= XML_SCHEMAS_ATTRGROUP_GLOBAL; @@ -5282,7 +5303,7 @@ xmlSchemaAddAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt, if (pctxt->redef == NULL) { xmlFree(ret); return(NULL); - } + } pctxt->redefCounter = 0; } WXS_ADD_GLOBAL(pctxt, ret); @@ -5371,13 +5392,13 @@ xmlSchemaAddType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (ctxt->redef == NULL) { xmlFree(ret); return(NULL); - } + } ctxt->redefCounter = 0; } WXS_ADD_GLOBAL(ctxt, ret); } else WXS_ADD_LOCAL(ctxt, ret); - WXS_ADD_PENDING(ctxt, ret); + WXS_ADD_PENDING(ctxt, ret); return (ret); } @@ -5509,7 +5530,7 @@ xmlSchemaAddParticle(xmlSchemaParserCtxtPtr ctxt, ret->children = NULL; WXS_ADD_LOCAL(ctxt, ret); - /* + /* * Note that addition to pending components will be done locally * to the specific parsing function, since the most particles * need not to be fixed up (i.e. the reference to be resolved). @@ -5558,7 +5579,7 @@ xmlSchemaAddModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt, if (ctxt->redef == NULL) { xmlFree(ret); return(NULL); - } + } ctxt->redefCounter = 0; } WXS_ADD_GLOBAL(ctxt, ret); @@ -5595,7 +5616,7 @@ xmlSchemaAddIDC(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, const xmlChar *name, const xmlChar *nsName, int category, xmlNodePtr node) { - xmlSchemaIDCPtr ret = NULL; + xmlSchemaIDCPtr ret = NULL; if ((ctxt == NULL) || (schema == NULL) || (name == NULL)) return (NULL); @@ -5611,8 +5632,8 @@ xmlSchemaAddIDC(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, ret->targetNamespace = nsName; ret->name = name; ret->type = category; - ret->node = node; - + ret->node = node; + WXS_ADD_GLOBAL(ctxt, ret); /* * Only keyrefs need to be fixup up. @@ -5648,7 +5669,7 @@ xmlSchemaAddWildcard(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } memset(ret, 0, sizeof(xmlSchemaWildcard)); ret->type = type; - ret->node = node; + ret->node = node; WXS_ADD_LOCAL(ctxt, ret); return (ret); } @@ -5704,7 +5725,7 @@ xmlSchemaSubstGroupAdd(xmlSchemaParserCtxtPtr pctxt, static xmlSchemaSubstGroupPtr xmlSchemaSubstGroupGet(xmlSchemaParserCtxtPtr pctxt, xmlSchemaElementPtr head) -{ +{ if (WXS_SUBST_GROUPS(pctxt) == NULL) return(NULL); return(xmlHashLookup2(WXS_SUBST_GROUPS(pctxt), @@ -5743,9 +5764,9 @@ xmlSchemaAddElementSubstitutionMember(xmlSchemaParserCtxtPtr pctxt, } /************************************************************************ - * * + * * * Utilities for parsing * - * * + * * ************************************************************************/ /** @@ -5939,7 +5960,7 @@ xmlSchemaPValAttrNodeID(xmlSchemaParserCtxtPtr ctxt, xmlAttrPtr attr) xmlFree((xmlChar *) value); value = strip; } - res = xmlAddID(NULL, attr->doc, value, attr); + res = xmlAddID(NULL, attr->doc, value, attr); if (res == NULL) { ret = XML_SCHEMAP_S4S_ATTR_INVALID_VALUE; xmlSchemaPSimpleTypeErr(ctxt, @@ -6120,7 +6141,7 @@ xmlSchemaPGetBoolNodeValue(xmlSchemaParserCtxtPtr ctxt, value = xmlNodeGetContent(node); /* * 3.2.2.1 Lexical representation - * An instance of a datatype that is defined as ·boolean· + * An instance of a datatype that is defined as `boolean` * can have the following legal literals {true, false, 1, 0}. */ if (xmlStrEqual(BAD_CAST value, BAD_CAST "true")) @@ -6168,7 +6189,7 @@ xmlGetBooleanProp(xmlSchemaParserCtxtPtr ctxt, return (def); /* * 3.2.2.1 Lexical representation - * An instance of a datatype that is defined as ·boolean· + * An instance of a datatype that is defined as `boolean` * can have the following legal literals {true, false, 1, 0}. */ if (xmlStrEqual(val, BAD_CAST "true")) @@ -6191,9 +6212,9 @@ xmlGetBooleanProp(xmlSchemaParserCtxtPtr ctxt, } /************************************************************************ - * * + * * * Shema extraction from an Infoset * - * * + * * ************************************************************************/ static xmlSchemaTypePtr xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, @@ -6288,7 +6309,7 @@ xmlSchemaPValAttrNodeValue(xmlSchemaParserCtxtPtr pctxt, ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2; else ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; - xmlSchemaPSimpleTypeErr(pctxt, + xmlSchemaPSimpleTypeErr(pctxt, ret, ownerItem, (xmlNodePtr) attr, type, NULL, value, NULL, NULL, NULL); } @@ -6352,7 +6373,7 @@ xmlSchemaPValAttrNode(xmlSchemaParserCtxtPtr ctxt, * number otherwise and -1 in case of an internal or API error. */ static int -xmlSchemaPValAttr(xmlSchemaParserCtxtPtr ctxt, +xmlSchemaPValAttr(xmlSchemaParserCtxtPtr ctxt, xmlSchemaBasicItemPtr ownerItem, xmlNodePtr ownerElem, const char *name, @@ -6442,7 +6463,7 @@ xmlSchemaCheckReference(xmlSchemaParserCtxtPtr pctxt, * @type: the hosting type where the attributes will be anchored * * Parses attribute uses and attribute declarations and - * attribute group references. + * attribute group references. */ static int xmlSchemaParseLocalAttributes(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, @@ -6797,7 +6818,7 @@ xmlSchemaParseWildcardNs(xmlSchemaParserCtxtPtr ctxt, tmp->next = NULL; if (wildc->nsSet == NULL) wildc->nsSet = tmp; - else + else if (lastNs != NULL) lastNs->next = tmp; lastNs = tmp; } @@ -7085,7 +7106,7 @@ xmlSchemaParseLocalAttribute(xmlSchemaParserCtxtPtr pctxt, int parentType) { const xmlChar *attrValue, *name = NULL, *ns = NULL; - xmlSchemaAttributeUsePtr use = NULL; + xmlSchemaAttributeUsePtr use = NULL; xmlNodePtr child = NULL; xmlAttrPtr attr; const xmlChar *tmpNs = NULL, *tmpName = NULL, *defValue = NULL; @@ -7139,7 +7160,7 @@ xmlSchemaParseLocalAttribute(xmlSchemaParserCtxtPtr pctxt, /* * Evaluate the target namespace */ - hasForm = 1; + hasForm = 1; attrValue = xmlSchemaGetNodeContent(pctxt, (xmlNodePtr) attr); if (xmlStrEqual(attrValue, BAD_CAST "qualified")) { @@ -7210,7 +7231,7 @@ xmlSchemaParseLocalAttribute(xmlSchemaParserCtxtPtr pctxt, attr_next: attr = attr->next; - } + } /* * 3.2.3 : 2 * If default and use are both present, use must have @@ -7236,7 +7257,7 @@ attr_next: /* TODO: move XML_SCHEMAS_QUALIF_ATTR to the parser. */ if ((! hasForm) && (schema->flags & XML_SCHEMAS_QUALIF_ATTR)) - ns = pctxt->targetNamespace; + ns = pctxt->targetNamespace; /* * 3.2.6 Schema Component Constraint: xsi: Not Allowed * TODO: Move this to the component layer. @@ -7293,7 +7314,7 @@ attr_next: use->attrDecl = attrDecl; /* * Value constraint. - */ + */ if (defValue != NULL) { attrDecl->defValue = defValue; if (defValueType == WXS_ATTR_DEF_VAL_FIXED) @@ -7333,14 +7354,14 @@ attr_next: if (defValueType == WXS_ATTR_DEF_VAL_FIXED) use->flags |= XML_SCHEMA_ATTR_USE_FIXED; } - + check_children: /* * And now for the children... */ child = node->children; if (occurs == XML_SCHEMAS_ATTR_USE_PROHIBITED) { - xmlSchemaAttributeUseProhibPtr prohib; + xmlSchemaAttributeUseProhibPtr prohib; if (IS_SCHEMA(child, "annotation")) { xmlSchemaParseAnnotation(pctxt, child, 0); @@ -7355,7 +7376,7 @@ check_children: /* * Check for pointlessness of attribute prohibitions. */ - if (parentType == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) { + if (parentType == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) { xmlSchemaCustomWarning(ACTXT_CAST pctxt, XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, node, NULL, @@ -7373,7 +7394,7 @@ check_children: return(NULL); } if (! isRef) { - tmpName = name; + tmpName = name; tmpNs = ns; } /* @@ -7381,7 +7402,7 @@ check_children: */ if (uses) { int i; - + for (i = 0; i < uses->nbItems; i++) { use = uses->items[i]; if ((use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) && @@ -7389,16 +7410,16 @@ check_children: (tmpNs == (WXS_ATTR_PROHIB_CAST use)->targetNamespace)) { xmlChar *str = NULL; - + xmlSchemaCustomWarning(ACTXT_CAST pctxt, XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, node, NULL, "Skipping duplicate attribute use prohibition '%s'", xmlSchemaFormatQName(&str, tmpNs, tmpName), NULL, NULL); - FREE_AND_NULL(str) + FREE_AND_NULL(str) return(NULL); - } + } } } /* @@ -7417,7 +7438,7 @@ check_children: WXS_ADD_PENDING(pctxt, prohib); } return(WXS_BASIC_CAST prohib); - } else { + } else { if (IS_SCHEMA(child, "annotation")) { /* * TODO: Should this go into the attr decl? @@ -7464,7 +7485,7 @@ check_children: NULL, node, child, NULL, "(annotation?, simpleType?)"); } - } + } return (WXS_BASIC_CAST use); } @@ -7486,7 +7507,7 @@ xmlSchemaParseGlobalAttribute(xmlSchemaParserCtxtPtr pctxt, * 3.2.3 Constraints on XML Representations of Attribute Declarations */ if ((pctxt == NULL) || (schema == NULL) || (node == NULL)) - return (NULL); + return (NULL); /* * 3.2.3 : 3.1 * One of ref or name must be present, but not both @@ -7532,7 +7553,7 @@ xmlSchemaParseGlobalAttribute(xmlSchemaParserCtxtPtr pctxt, if (ret == NULL) return (NULL); ret->flags |= XML_SCHEMAS_ATTR_GLOBAL; - + /* * Check for illegal attributes. */ @@ -7546,7 +7567,7 @@ xmlSchemaParseGlobalAttribute(xmlSchemaParserCtxtPtr pctxt, (!xmlStrEqual(attr->name, BAD_CAST "type"))) { xmlSchemaPIllegalAttrErr(pctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(pctxt, @@ -7556,7 +7577,7 @@ xmlSchemaParseGlobalAttribute(xmlSchemaParserCtxtPtr pctxt, } xmlSchemaPValAttrQName(pctxt, schema, NULL, node, "type", &ret->typeNs, &ret->typeName); - + xmlSchemaPValAttrID(pctxt, node, BAD_CAST "id"); /* * Attribute "fixed". @@ -7641,12 +7662,12 @@ xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt, XML_SCHEMAP_S4S_ATTR_MISSING, NULL, node, "ref", NULL); return (NULL); - } + } xmlSchemaPValAttrNodeQName(pctxt, schema, NULL, attr, &refNs, &ref); if (xmlSchemaCheckReference(pctxt, schema, node, attr, refNs) != 0) return(NULL); - + /* * Check for illegal attributes. */ @@ -7698,13 +7719,13 @@ xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt, /* * SPEC src-redefine: * (7.1) "If it has an among its contents - * the ·actual value· of whose ref [attribute] is the same - * as the ·actual value· of its own name attribute plus + * the `actual value` of whose ref [attribute] is the same + * as the `actual value` of its own name attribute plus * target namespace, then it must have exactly one such group." */ if (pctxt->redefCounter != 0) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_SRC_REDEFINE, node, NULL, "The redefining attribute group definition " @@ -7738,7 +7759,7 @@ xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr pctxt, ret->node = node; /* Add to pending items, to be able to resolve the reference. */ WXS_ADD_PENDING(pctxt, ret); - } + } return (ret); } @@ -7785,7 +7806,7 @@ xmlSchemaParseAttributeGroupDefinition(xmlSchemaParserCtxtPtr pctxt, ret = xmlSchemaAddAttributeGroupDefinition(pctxt, schema, name, pctxt->targetNamespace, node); if (ret == NULL) - return (NULL); + return (NULL); /* * Check for illegal attributes. */ @@ -8185,7 +8206,7 @@ xmlSchemaAddAnnotation(xmlSchemaAnnotItemPtr annItem, * Returns the parsed identity-constraint definition. */ static xmlSchemaIDCSelectPtr -xmlSchemaParseIDCSelectorAndField(xmlSchemaParserCtxtPtr ctxt, +xmlSchemaParseIDCSelectorAndField(xmlSchemaParserCtxtPtr ctxt, xmlSchemaIDCPtr idc, xmlNodePtr node, int isField) @@ -8227,7 +8248,7 @@ xmlSchemaParseIDCSelectorAndField(xmlSchemaParserCtxtPtr ctxt, */ attr = xmlSchemaGetPropNode(node, "xpath"); if (attr == NULL) { - xmlSchemaPMissingAttrErr(ctxt, + xmlSchemaPMissingAttrErr(ctxt, XML_SCHEMAP_S4S_ATTR_MISSING, NULL, node, "name", NULL); @@ -8848,7 +8869,7 @@ xmlSchemaParseUnion(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, type->flags |= XML_SCHEMAS_TYPE_VARIETY_UNION; /* * SPEC (Base type) (2) "If the or alternative is chosen, - * then the ·simple ur-type definition·." + * then the `simple ur-type definition`." */ type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE); /* @@ -9016,7 +9037,7 @@ xmlSchemaParseList(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, type->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST; /* * SPEC (Base type) (2) "If the or alternative is chosen, - * then the ·simple ur-type definition·." + * then the `simple ur-type definition`." */ type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYSIMPLETYPE); /* @@ -9161,9 +9182,9 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } /* * TargetNamespace: - * SPEC "The ·actual value· of the targetNamespace [attribute] + * SPEC "The `actual value` of the targetNamespace [attribute] * of the ancestor element information item if present, - * otherwise ·absent·. + * otherwise `absent`. */ if (topLevel == 0) { #ifdef ENABLE_NAMED_LOCALS @@ -9195,7 +9216,7 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, if (attr->ns == NULL) { if (!xmlStrEqual(attr->name, BAD_CAST "id")) { xmlSchemaPIllegalAttrErr(ctxt, - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { xmlSchemaPIllegalAttrErr(ctxt, @@ -9266,9 +9287,9 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * And now for the children... */ oldCtxtType = ctxt->ctxtType; - + ctxt->ctxtType = type; - + child = node->children; if (IS_SCHEMA(child, "annotation")) { type->annot = xmlSchemaParseAnnotation(ctxt, child, 1); @@ -9278,10 +9299,10 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, NULL, node, child, NULL, "(annotation?, (restriction | list | union))"); - } else if (IS_SCHEMA(child, "restriction")) { + } else if (IS_SCHEMA(child, "restriction")) { xmlSchemaParseRestriction(ctxt, schema, child, - XML_SCHEMA_TYPE_SIMPLE); - hasRestriction = 1; + XML_SCHEMA_TYPE_SIMPLE); + hasRestriction = 1; child = child->next; } else if (IS_SCHEMA(child, "list")) { xmlSchemaParseList(ctxt, schema, child); @@ -9298,8 +9319,8 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * REDEFINE: SPEC src-redefine (5) * "Within the [children], each must have a - * among its [children] ... the ·actual value· of whose - * base [attribute] must be the same as the ·actual value· of its own + * among its [children] ... the `actual value` of whose + * base [attribute] must be the same as the `actual value` of its own * name attribute plus target namespace;" */ if (topLevel && ctxt->isRedefine && (! hasRestriction)) { @@ -9307,7 +9328,7 @@ xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, NULL, node, "This is a redefinition, thus the " " must have a child", NULL); } - + ctxt->ctxtType = oldCtxtType; return (type); } @@ -9373,13 +9394,13 @@ xmlSchemaParseModelGroupDefRef(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); item = xmlSchemaAddParticle(ctxt, node, min, max); if (item == NULL) - return (NULL); + return (NULL); /* * Create a qname-reference and set as the term; it will be substituted * for the model group after the reference has been resolved. */ item->children = (xmlSchemaTreeItemPtr) - xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_GROUP, ref, refNs); + xmlSchemaNewQNameRef(ctxt, XML_SCHEMA_TYPE_GROUP, ref, refNs); xmlSchemaPCheckParticleCorrect_2(ctxt, item, node, min, max); /* * And now for the children... @@ -9419,7 +9440,7 @@ xmlSchemaParseModelGroupDefRef(xmlSchemaParserCtxtPtr ctxt, * Note that the contraint src-redefine (6.2) can't be applied until * references have been resolved. So we will do this at the * component fixup level. - * + * * *WARNING* this interface is highly subject to change * * Returns -1 in case of error, 0 if the declaration is improper and @@ -9493,7 +9514,7 @@ xmlSchemaParseModelGroupDefinition(xmlSchemaParserCtxtPtr ctxt, child = child->next; } - + if (child != NULL) { xmlSchemaPContentErr(ctxt, @@ -9631,7 +9652,7 @@ xmlSchemaParseSchemaElement(xmlSchemaParserCtxtPtr ctxt, attr = xmlSchemaGetPropNode(node, "version"); if (attr != NULL) { res = xmlSchemaPValAttrNode(ctxt, NULL, NULL, attr, - xmlSchemaGetBuiltInType(XML_SCHEMAS_TOKEN), &val); + xmlSchemaGetBuiltInType(XML_SCHEMAS_TOKEN), &val); HFAILURE; } */ @@ -9691,7 +9712,7 @@ xmlSchemaParseSchemaElement(xmlSchemaParserCtxtPtr ctxt, } attr = xmlSchemaGetPropNode(node, "blockDefault"); if (attr != NULL) { - val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr); + val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr); res = xmlSchemaPValAttrBlockFinal(val, &(schema->flags), -1, XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION, XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION, @@ -9752,14 +9773,14 @@ xmlSchemaParseSchemaTopLevel(xmlSchemaParserCtxtPtr ctxt, HFAILURE; HSTOP(ctxt); if (tmpOldErrs != ctxt->nberrors) - goto exit; + goto exit; } else if (IS_SCHEMA(child, "include")) { tmpOldErrs = ctxt->nberrors; res = xmlSchemaParseInclude(ctxt, schema, child); HFAILURE; HSTOP(ctxt); if (tmpOldErrs != ctxt->nberrors) - goto exit; + goto exit; } else if (IS_SCHEMA(child, "redefine")) { tmpOldErrs = ctxt->nberrors; res = xmlSchemaParseRedefine(ctxt, schema, child); @@ -9884,7 +9905,7 @@ xmlSchemaConstructionCtxtFree(xmlSchemaConstructionCtxtPtr con) xmlFree(con); } -static xmlSchemaConstructionCtxtPtr +static xmlSchemaConstructionCtxtPtr xmlSchemaConstructionCtxtCreate(xmlDictPtr dict) { xmlSchemaConstructionCtxtPtr ret; @@ -9954,10 +9975,10 @@ xmlSchemaNewParserCtxtUseDict(const char *URL, xmlDictPtr dict) xmlSchemaParserCtxtPtr ret; ret = xmlSchemaParserCtxtCreate(); - if (ret == NULL) + if (ret == NULL) return (NULL); ret->dict = dict; - xmlDictReference(dict); + xmlDictReference(dict); if (URL != NULL) ret->URL = xmlDictLookup(dict, (const xmlChar *) URL, -1); return (ret); @@ -10082,8 +10103,8 @@ xmlSchemaParseNewDocWithContext(xmlSchemaParserCtxtPtr pctxt, xmlNodePtr node; int ret, oldErrs; xmlSchemaBucketPtr oldbucket = pctxt->constructor->bucket; - - /* + + /* * Save old values; reset the *main* schema. * URGENT TODO: This is not good; move the per-document information * to the parser. Get rid of passing the main schema to the @@ -10093,9 +10114,9 @@ xmlSchemaParseNewDocWithContext(xmlSchemaParserCtxtPtr pctxt, oldDoc = schema->doc; if (schema->flags != 0) xmlSchemaClearSchemaDefaults(schema); - schema->doc = bucket->doc; + schema->doc = bucket->doc; pctxt->schema = schema; - /* + /* * Keep the current target namespace on the parser *not* on the * main schema. */ @@ -10108,7 +10129,7 @@ xmlSchemaParseNewDocWithContext(xmlSchemaParserCtxtPtr pctxt, * We are parsing the schema for schemas! */ pctxt->isS4S = 1; - } + } /* Mark it as parsed, even if parsing fails. */ bucket->parsed++; /* Compile the schema doc. */ @@ -10132,7 +10153,7 @@ xmlSchemaParseNewDocWithContext(xmlSchemaParserCtxtPtr pctxt, ret = pctxt->err; goto exit; } - + exit: WXS_CONSTRUCTOR(pctxt)->bucket = oldbucket; /* Restore schema values. */ @@ -10165,7 +10186,7 @@ xmlSchemaParseNewDoc(xmlSchemaParserCtxtPtr pctxt, PERROR_INT("xmlSchemaParseNewDoc", "no constructor"); return(-1); - } + } /* Create and init the temporary parser context. */ newpctxt = xmlSchemaNewParserCtxtUseDict( (const char *) bucket->schemaLocation, pctxt->dict); @@ -10173,7 +10194,7 @@ xmlSchemaParseNewDoc(xmlSchemaParserCtxtPtr pctxt, return(-1); newpctxt->constructor = pctxt->constructor; /* - * TODO: Can we avoid that the parser knows about the main schema? + * TODO: Can we avoid that the parser knows about the main schema? * It would be better if he knows about the current schema bucket * only. */ @@ -10183,16 +10204,16 @@ xmlSchemaParseNewDoc(xmlSchemaParserCtxtPtr pctxt, xmlSchemaSetParserStructuredErrors(newpctxt, pctxt->serror, pctxt->errCtxt); newpctxt->counter = pctxt->counter; - + res = xmlSchemaParseNewDocWithContext(newpctxt, schema, bucket); - + /* Channel back errors and cleanup the temporary parser context. */ if (res != 0) pctxt->err = res; pctxt->nberrors += newpctxt->nberrors; pctxt->counter = newpctxt->counter; - newpctxt->constructor = NULL; + newpctxt->constructor = NULL; /* Free the parser context. */ xmlSchemaFreeParserCtxt(newpctxt); return(res); @@ -10217,11 +10238,11 @@ xmlSchemaSchemaRelationAddChild(xmlSchemaBucketPtr bucket, static const xmlChar * xmlSchemaBuildAbsoluteURI(xmlDictPtr dict, const xmlChar* location, xmlNodePtr ctxtNode) -{ +{ /* * Build an absolue location URI. */ - if (location != NULL) { + if (location != NULL) { if (ctxtNode == NULL) return(location); else { @@ -10244,7 +10265,7 @@ xmlSchemaBuildAbsoluteURI(xmlDictPtr dict, const xmlChar* location, } return(NULL); } - + /** @@ -10267,8 +10288,8 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, const char *schemaBuffer, int schemaBufferLen, xmlNodePtr invokingNode, - const xmlChar *sourceTargetNamespace, - const xmlChar *importNamespace, + const xmlChar *sourceTargetNamespace, + const xmlChar *importNamespace, xmlSchemaBucketPtr *bucket) { const xmlChar *targetNamespace = NULL; @@ -10279,7 +10300,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, if (bucket != NULL) *bucket = NULL; - + switch (type) { case XML_SCHEMA_SCHEMA_IMPORT: case XML_SCHEMA_SCHEMA_MAIN: @@ -10291,23 +10312,23 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, case XML_SCHEMA_SCHEMA_REDEFINE: err = XML_SCHEMAP_SRC_REDEFINE; break; - } - + } + /* Special handling for the main schema: * skip the location and relation logic and just parse the doc. * We need just a bucket to be returned in this case. - */ + */ if ((type == XML_SCHEMA_SCHEMA_MAIN) || (! WXS_HAS_BUCKETS(pctxt))) - goto doc_load; + goto doc_load; - /* Note that we expect the location to be an absulute URI. */ + /* Note that we expect the location to be an absulute URI. */ if (schemaLocation != NULL) { bkt = xmlSchemaGetSchemaBucket(pctxt, schemaLocation); if ((bkt != NULL) && (pctxt->constructor->bucket == bkt)) { /* Report self-imports/inclusions/redefinitions. */ - + xmlSchemaCustomErr(ACTXT_CAST pctxt, err, invokingNode, NULL, "The schema must not import/include/redefine itself", @@ -10320,7 +10341,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, */ relation = xmlSchemaSchemaRelationCreate(); if (relation == NULL) - return(-1); + return(-1); xmlSchemaSchemaRelationAddChild(pctxt->constructor->bucket, relation); relation->type = type; @@ -10329,7 +10350,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, * Save the namespace import information. */ if (WXS_IS_BUCKET_IMPMAIN(type)) { - relation->importNamespace = importNamespace; + relation->importNamespace = importNamespace; if (schemaLocation == NULL) { /* * No location; this is just an import of the namespace. @@ -10342,32 +10363,48 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, } /* Did we already fetch the doc? */ - if (bkt != NULL) { - /* TODO: The following nasty cases will produce an error. */ + if (bkt != NULL) { if ((WXS_IS_BUCKET_IMPMAIN(type)) && (! bkt->imported)) { - /* We included/redefined and then try to import a schema. */ - xmlSchemaCustomErr(ACTXT_CAST pctxt, err, - invokingNode, NULL, - "The schema document '%s' cannot be imported, since " - "it was already included or redefined", - schemaLocation, NULL); - goto exit; + /* + * We included/redefined and then try to import a schema, + * but the new location provided for import was different. + */ + if (schemaLocation == NULL) + schemaLocation = BAD_CAST "in_memory_buffer"; + if (!xmlStrEqual(schemaLocation, + bkt->schemaLocation)) { + xmlSchemaCustomErr(ACTXT_CAST pctxt, err, + invokingNode, NULL, + "The schema document '%s' cannot be imported, since " + "it was already included or redefined", + schemaLocation, NULL); + goto exit; + } } else if ((! WXS_IS_BUCKET_IMPMAIN(type)) && (bkt->imported)) { - /* We imported and then try to include/redefine a schema. */ - xmlSchemaCustomErr(ACTXT_CAST pctxt, err, - invokingNode, NULL, - "The schema document '%s' cannot be included or " - "redefined, since it was already imported", - schemaLocation, NULL); - goto exit; - } + /* + * We imported and then try to include/redefine a schema, + * but the new location provided for the include/redefine + * was different. + */ + if (schemaLocation == NULL) + schemaLocation = BAD_CAST "in_memory_buffer"; + if (!xmlStrEqual(schemaLocation, + bkt->schemaLocation)) { + xmlSchemaCustomErr(ACTXT_CAST pctxt, err, + invokingNode, NULL, + "The schema document '%s' cannot be included or " + "redefined, since it was already imported", + schemaLocation, NULL); + goto exit; + } + } } - + if (WXS_IS_BUCKET_IMPMAIN(type)) { /* * Given that the schemaLocation [attribute] is only a hint, it is open * to applications to ignore all but the first for a given - * namespace, regardless of the ·actual value· of schemaLocation, but + * namespace, regardless of the `actual value` of schemaLocation, but * such a strategy risks missing useful information when new * schemaLocations are offered. * @@ -10383,7 +10420,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, * 5 Attempt to resolve the namespace name to locate such a resource. * * NOTE: (3) and (5) are not supported. - */ + */ if (bkt != NULL) { relation->bucket = bkt; goto exit; @@ -10391,7 +10428,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, bkt = xmlSchemaGetSchemaBucketByTNS(pctxt, importNamespace, 1); - if (bkt != NULL) { + if (bkt != NULL) { relation->bucket = bkt; if (bkt->schemaLocation == NULL) { /* First given location of the schema; load the doc. */ @@ -10404,6 +10441,9 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, * URGENT TODO: We should report a warning here. * res = XML_SCHEMAP_SRC_IMPORT; */ + if (schemaLocation == NULL) + schemaLocation = BAD_CAST "in_memory_buffer"; + xmlSchemaCustomWarning(ACTXT_CAST pctxt, XML_SCHEMAP_WARN_SKIP_SCHEMA, invokingNode, NULL, @@ -10414,19 +10454,19 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, } goto exit; } - } - /* + } + /* * No bucket + first location: load the doc and create a * bucket. */ } else { /* and */ if (bkt != NULL) { - + if ((bkt->origTargetNamespace == NULL) && (bkt->targetNamespace != sourceTargetNamespace)) { xmlSchemaBucketPtr chamel; - + /* * Chameleon include/redefine: skip loading only if it was * aleady build for the targetNamespace of the including @@ -10451,7 +10491,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, relation->bucket = chamel; goto exit; } - /* + /* * We need to parse the chameleon again for a different * targetNamespace. * CHAMELEON TODO: Optimize this by only parsing the @@ -10462,7 +10502,7 @@ xmlSchemaAddSchemaDoc(xmlSchemaParserCtxtPtr pctxt, } else { relation->bucket = bkt; goto exit; - } + } } } if ((bkt != NULL) && (bkt->doc != NULL)) { @@ -10484,7 +10524,8 @@ doc_load: if (schemaDoc->URL != NULL) schemaLocation = xmlDictLookup(pctxt->dict, schemaDoc->URL, -1); - + else + schemaLocation = BAD_CAST "in_memory_buffer"; } else if ((schemaLocation != NULL) || (schemaBuffer != NULL)) { xmlParserCtxtPtr parserCtxt; @@ -10511,9 +10552,9 @@ doc_load: /* Parse from memory buffer. */ doc = xmlCtxtReadMemory(parserCtxt, schemaBuffer, schemaBufferLen, NULL, NULL, SCHEMAS_PARSE_OPTIONS); - schemaLocation = xmlStrdup(BAD_CAST "in_memory_buffer"); + schemaLocation = BAD_CAST "in_memory_buffer"; if (doc != NULL) - doc->URL = schemaLocation; + doc->URL = xmlStrdup(schemaLocation); } /* * For : @@ -10547,7 +10588,7 @@ doc_load: xmlSchemaCustomErr(ACTXT_CAST pctxt, res, invokingNode, NULL, "Failed to parse the XML resource '%s'", - schemaLocation, NULL); + schemaLocation, NULL); } } xmlFreeParserCtxt(parserCtxt); @@ -10567,11 +10608,11 @@ doc_load: if (doc != NULL) { xmlNodePtr docElem = NULL; - located = 1; + located = 1; docElem = xmlDocGetRootElement(doc); if (docElem == NULL) { xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_NOROOT, - invokingNode, NULL, + invokingNode, NULL, "The document '%s' has no document element", schemaLocation, NULL); goto exit_error; @@ -10590,14 +10631,14 @@ doc_load: schemaLocation, NULL); goto exit_error; } - /* + /* * Note that we don't apply a type check for the * targetNamespace value here. */ targetNamespace = xmlSchemaGetProp(pctxt, docElem, "targetNamespace"); } - + /* after_doc_loading: */ if ((bkt == NULL) && located) { /* Only create a bucket if the schema was located. */ @@ -10624,14 +10665,14 @@ doc_load: if (relation != NULL) relation->bucket = bkt; } - + exit: /* * Return the bucket explicitely; this is needed for the * main schema. */ if (bucket != NULL) - *bucket = bkt; + *bucket = bkt; return (0); exit_error: @@ -10647,7 +10688,7 @@ exit_failure: xmlFreeDoc(doc); if (bkt != NULL) bkt->doc = NULL; - } + } return (-1); } @@ -10716,7 +10757,7 @@ xmlSchemaParseImport(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, NULL, node, xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYURI), - NULL, namespaceName, NULL, NULL, NULL); + NULL, schemaLocation, NULL, NULL, NULL); return (pctxt->err); } /* @@ -10747,8 +10788,8 @@ xmlSchemaParseImport(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, thisTargetNamespace = WXS_BUCKET(pctxt)->origTargetNamespace; if (namespaceName != NULL) { /* - * 1.1 If the namespace [attribute] is present, then its ·actual value· - * must not match the ·actual value· of the enclosing 's + * 1.1 If the namespace [attribute] is present, then its `actual value` + * must not match the `actual value` of the enclosing 's * targetNamespace [attribute]. */ if (xmlStrEqual(thisTargetNamespace, namespaceName)) { @@ -10802,11 +10843,11 @@ xmlSchemaParseImport(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, "Failed to locate a schema at location '%s'. " "Skipping the import", schemaLocation, NULL, NULL); } - - if ((bucket != NULL) && CAN_PARSE_SCHEMA(bucket)) { + + if ((bucket != NULL) && CAN_PARSE_SCHEMA(bucket)) { ret = xmlSchemaParseNewDoc(pctxt, schema, bucket); } - + return (ret); } @@ -10888,7 +10929,7 @@ xmlSchemaParseIncludeOrRedefineAttrs(xmlSchemaParserCtxtPtr pctxt, XML_SCHEMAP_SRC_REDEFINE, NULL, node, "The schema document '%s' cannot redefine itself.", - *schemaLocation); + *schemaLocation); } else { xmlSchemaPCustomErr(pctxt, XML_SCHEMAP_SRC_INCLUDE, @@ -10898,7 +10939,7 @@ xmlSchemaParseIncludeOrRedefineAttrs(xmlSchemaParserCtxtPtr pctxt, } goto exit_error; } - + return(0); exit_error: return(pctxt->err); @@ -10928,19 +10969,19 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, res = xmlSchemaParseIncludeOrRedefineAttrs(pctxt, schema, node, (xmlChar **) (&schemaLocation), type); if (res != 0) - return(res); + return(res); /* * Load and add the schema document. */ res = xmlSchemaAddSchemaDoc(pctxt, type, schemaLocation, NULL, NULL, 0, node, pctxt->targetNamespace, NULL, &bucket); if (res != 0) - return(res); + return(res); /* * If we get no schema bucket back, then this means that the schema * document could not be located or was broken XML or was not * a schema document. - */ + */ if ((bucket == NULL) || (bucket->doc == NULL)) { if (type == XML_SCHEMA_SCHEMA_INCLUDE) { /* @@ -10949,7 +10990,7 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, * for inclusions, since the that was the feedback from the * schema people. I.e. the following spec piece will *not* be * satisfied: - * SPEC src-include: "It is not an error for the ·actual value· of the + * SPEC src-include: "It is not an error for the `actual value` of the * schemaLocation [attribute] to fail to resolve it all, in which * case no corresponding inclusion is performed. * So do we need a warning report here?" @@ -10966,7 +11007,7 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, * * SPEC src-redefine (1) * "If there are any element information items among the [children] - * other than then the ·actual value· of the + * other than then the `actual value` of the * schemaLocation [attribute] must successfully resolve." * TODO: Ask the WG if a the location has always to resolve * here as well! @@ -10982,13 +11023,13 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, * Check targetNamespace sanity before parsing the new schema. * TODO: Note that we won't check further content if the * targetNamespace was bad. - */ - if (bucket->origTargetNamespace != NULL) { + */ + if (bucket->origTargetNamespace != NULL) { /* * SPEC src-include (2.1) - * "SII has a targetNamespace [attribute], and its ·actual - * value· is identical to the ·actual value· of the targetNamespace - * [attribute] of SII’ (which must have such an [attribute])." + * "SII has a targetNamespace [attribute], and its `actual + * value` is identical to the `actual value` of the targetNamespace + * [attribute] of SII' (which must have such an [attribute])." */ if (pctxt->targetNamespace == NULL) { xmlSchemaCustomErr(ACTXT_CAST pctxt, @@ -11012,28 +11053,29 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, pctxt->targetNamespace); goto exit_error; } - } else if (pctxt->targetNamespace != NULL) { + } else if (pctxt->targetNamespace != NULL) { /* * Chameleons: the original target namespace will * differ from the resulting namespace. */ isChameleon = 1; if (bucket->parsed && - (bucket->targetNamespace != pctxt->targetNamespace)) { - /* - * This is a sanity check, I dunno yet if this can happen. - */ - PERROR_INT("xmlSchemaParseIncludeOrRedefine", - "trying to use an already parsed schema for a " - "different targetNamespace"); - return(-1); + bucket->origTargetNamespace != NULL) { + xmlSchemaCustomErr(ACTXT_CAST pctxt, + XML_SCHEMAP_SRC_INCLUDE, + node, NULL, + "The target namespace of the included/redefined schema " + "'%s' has to be absent or the same as the " + "including/redefining schema's target namespace", + schemaLocation, NULL); + goto exit_error; } bucket->targetNamespace = pctxt->targetNamespace; } - } + } /* * Parse the schema. - */ + */ if (bucket && (!bucket->parsed) && (bucket->doc != NULL)) { if (isChameleon) { /* TODO: Get rid of this flag on the schema itself. */ @@ -11050,8 +11092,8 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, /* * And now for the children... */ - child = node->children; - if (type == XML_SCHEMA_SCHEMA_REDEFINE) { + child = node->children; + if (type == XML_SCHEMA_SCHEMA_REDEFINE) { /* * Parse (simpleType | complexType | group | attributeGroup))* */ @@ -11074,7 +11116,7 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, } else if (IS_SCHEMA(child, "complexType")) { xmlSchemaParseComplexType(pctxt, schema, child, 1); /* hasRedefinitions = 1; */ - } else if (IS_SCHEMA(child, "group")) { + } else if (IS_SCHEMA(child, "group")) { /* hasRedefinitions = 1; */ xmlSchemaParseModelGroupDefinition(pctxt, schema, child); @@ -11094,7 +11136,7 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, */ child = child->next; } - } + } if (child != NULL) { res = XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED; if (type == XML_SCHEMA_SCHEMA_REDEFINE) { @@ -11105,8 +11147,8 @@ xmlSchemaParseIncludeOrRedefine(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPContentErr(pctxt, res, NULL, node, child, NULL, "(annotation?)"); - } - } + } + } return(res); exit_error: @@ -11156,7 +11198,7 @@ xmlSchemaParseInclude(xmlSchemaParserCtxtPtr pctxt, xmlSchemaPtr schema, * Redefinition Constraints and Semantics (src-redefine) * (6.1), (6.1.1), (6.1.2) * - * Schema Component Constraint: + * Schema Component Constraint: * All Group Limited (cos-all-limited) (2) * TODO: Actually this should go to component-level checks, * but is done here due to performance. Move it to an other layer @@ -11335,8 +11377,8 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * SPEC src-redefine: * (6.1) "If it has a among its contents at - * some level the ·actual value· of whose ref - * [attribute] is the same as the ·actual value· of + * some level the `actual value` of whose ref + * [attribute] is the same as the `actual value` of * its own name attribute plus target namespace, then * all of the following must be true:" * (6.1.1) "It must have exactly one such group." @@ -11361,9 +11403,9 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, xmlChar *str = NULL; /* * SPEC src-redefine: - * (6.1.2) "The ·actual value· of both that + * (6.1.2) "The `actual value` of both that * group's minOccurs and maxOccurs [attribute] - * must be 1 (or ·absent·). + * must be 1 (or `absent`). */ xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_SRC_REDEFINE, child, NULL, @@ -11380,7 +11422,7 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } ctxt->redef->reference = WXS_BASIC_CAST part; ctxt->redefCounter++; - } + } } } else if (IS_SCHEMA(child, "any")) { part = (xmlSchemaTreeItemPtr) @@ -11417,7 +11459,7 @@ xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, WXS_ADD_PENDING(ctxt, item); } if (withParticle) - return ((xmlSchemaTreeItemPtr) particle); + return ((xmlSchemaTreeItemPtr) particle); else return ((xmlSchemaTreeItemPtr) item); } @@ -11469,7 +11511,7 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, */ xmlSchemaPValAttrID(ctxt, node, BAD_CAST "id"); /* - * Attribute + * Attribute */ /* * Extract the base type. The "base" attribute is mandatory if inside @@ -11477,8 +11519,8 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * * SPEC (1.2) "...otherwise ( has no " * among its [children]), the simple type definition which is - * the {content type} of the type definition ·resolved· to by - * the ·actual value· of the base [attribute]" + * the {content type} of the type definition `resolved` to by + * the `actual value` of the base [attribute]" */ if (xmlSchemaPValAttrQName(ctxt, schema, NULL, node, "base", &(type->baseNs), &(type->base)) == 0) @@ -11501,8 +11543,8 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * REDEFINE: SPEC src-redefine (5) * "Within the [children], each must have a - * among its [children] ... the ·actual value· of - * whose base [attribute] must be the same as the ·actual value· + * among its [children] ... the `actual value` of + * whose base [attribute] must be the same as the `actual value` * of its own name attribute plus target namespace;" */ xmlSchemaPCustomErrExt(ctxt, XML_SCHEMAP_SRC_REDEFINE, @@ -11518,7 +11560,7 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, type->base = NULL; type->baseNs = NULL; } - } + } } /* * And now for the children... @@ -11585,7 +11627,7 @@ xmlSchemaParseRestriction(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, /* * Model group reference . */ - } else if (IS_SCHEMA(child, "group")) { + } else if (IS_SCHEMA(child, "group")) { type->subtypes = (xmlSchemaTypePtr) xmlSchemaParseModelGroupDefRef(ctxt, schema, child); /* @@ -11923,13 +11965,13 @@ xmlSchemaParseSimpleContent(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, NULL, node, NULL, NULL, - "(annotation?, (restriction | extension))"); + "(annotation?, (restriction | extension))"); } if (child == NULL) { xmlSchemaPContentErr(ctxt, XML_SCHEMAP_S4S_ELEM_MISSING, NULL, node, NULL, NULL, - "(annotation?, (restriction | extension))"); + "(annotation?, (restriction | extension))"); } if (IS_SCHEMA(child, "restriction")) { xmlSchemaParseRestriction(ctxt, schema, child, @@ -12086,7 +12128,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } else if (xmlSchemaPValAttrNode(ctxt, NULL, attr, xmlSchemaGetBuiltInType(XML_SCHEMAS_NCNAME), &name) != 0) { return (NULL); - } + } } if (topLevel == 0) { @@ -12175,7 +12217,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, NULL, (xmlNodePtr) attr, NULL, "(#all | List of (extension | restriction))", attrValue, NULL, NULL, NULL); - } else + } else final = 1; } else if (xmlStrEqual(attr->name, BAD_CAST "block")) { /* @@ -12193,7 +12235,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, NULL, (xmlNodePtr) attr, NULL, "(#all | List of (extension | restriction)) ", attrValue, NULL, NULL, NULL); - } else + } else block = 1; } else { xmlSchemaPIllegalAttrErr(ctxt, @@ -12204,7 +12246,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } } else if (xmlStrEqual(attr->ns->href, xmlSchemaNs)) { - xmlSchemaPIllegalAttrErr(ctxt, + xmlSchemaPIllegalAttrErr(ctxt, XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, NULL, attr); } attr = attr->next; @@ -12263,7 +12305,7 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, * SPEC * "...the third alternative (neither nor * ) is chosen. This case is understood as shorthand - * for complex content restricting the ·ur-type definition·, and the + * for complex content restricting the `ur-type definition`, and the * details of the mappings should be modified as necessary. */ type->baseType = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE); @@ -12332,15 +12374,15 @@ xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, } /************************************************************************ - * * - * Validating using Schemas * - * * + * * + * Validating using Schemas * + * * ************************************************************************/ /************************************************************************ - * * - * Reading/Writing Schemas * - * * + * * + * Reading/Writing Schemas * + * * ************************************************************************/ #if 0 /* Will be enabled if it is clear what options are needed. */ @@ -12440,7 +12482,7 @@ xmlSchemaNewMemParserCtxt(const char *buffer, int size) return(NULL); ret->buffer = buffer; ret->size = size; - ret->dict = xmlDictCreate(); + ret->dict = xmlDictCreate(); return (ret); } @@ -12483,7 +12525,7 @@ xmlSchemaFreeParserCtxt(xmlSchemaParserCtxtPtr ctxt) if (ctxt == NULL) return; if (ctxt->doc != NULL && !ctxt->preserve) - xmlFreeDoc(ctxt->doc); + xmlFreeDoc(ctxt->doc); if (ctxt->vctxt != NULL) { xmlSchemaFreeValidCtxt(ctxt->vctxt); } @@ -12504,7 +12546,12 @@ xmlSchemaFreeParserCtxt(xmlSchemaParserCtxtPtr ctxt) * * ************************************************************************/ -static void +/** + * xmlSchemaBuildContentModelForSubstGroup: + * + * Returns 1 if nillable, 0 otherwise + */ +static int xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt, xmlSchemaParticlePtr particle, int counter, xmlAutomataStatePtr end) { @@ -12512,6 +12559,7 @@ xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt, xmlSchemaElementPtr elemDecl, member; xmlSchemaSubstGroupPtr substGroup; int i; + int ret = 0; elemDecl = (xmlSchemaElementPtr) particle->children; /* @@ -12527,7 +12575,7 @@ xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt, "Internal error: xmlSchemaBuildContentModelForSubstGroup, " "declaration is marked having a subst. group but none " "available.\n", elemDecl->name, NULL); - return; + return(0); } if (counter >= 0) { /* @@ -12565,7 +12613,7 @@ xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt, * was incorrectly used instead of xmlAutomataNewTransition2() * (seems like a copy&paste bug from the XML_SCHEMA_TYPE_ALL * section in xmlSchemaBuildAContentModel() ). - * TODO: Check if xmlAutomataNewOnceTrans2() was instead + * TODO: Check if xmlAutomataNewOnceTrans2() was instead * intended for the above "counter" section originally. I.e., * check xs:all with subst-groups. * @@ -12574,7 +12622,7 @@ xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt, * 1, 1, member); */ tmp = xmlAutomataNewTransition2(pctxt->am, start, NULL, - member->name, member->targetNamespace, member); + member->name, member->targetNamespace, member); xmlAutomataNewEpsilon(pctxt->am, tmp, end); } } else { @@ -12607,21 +12655,31 @@ xmlSchemaBuildContentModelForSubstGroup(xmlSchemaParserCtxtPtr pctxt, xmlAutomataNewCountedTrans(pctxt->am, hop, start, counter); xmlAutomataNewCounterTrans(pctxt->am, hop, end, counter); } - if (particle->minOccurs == 0) + if (particle->minOccurs == 0) { xmlAutomataNewEpsilon(pctxt->am, start, end); + ret = 1; + } pctxt->state = end; + return(ret); } -static void +/** + * xmlSchemaBuildContentModelForElement: + * + * Returns 1 if nillable, 0 otherwise + */ +static int xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt, xmlSchemaParticlePtr particle) { + int ret = 0; + if (((xmlSchemaElementPtr) particle->children)->flags & XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD) { /* * Substitution groups. */ - xmlSchemaBuildContentModelForSubstGroup(ctxt, particle, -1, NULL); + ret = xmlSchemaBuildContentModelForSubstGroup(ctxt, particle, -1, NULL); } else { xmlSchemaElementPtr elemDecl; xmlAutomataStatePtr start; @@ -12629,7 +12687,7 @@ xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt, elemDecl = (xmlSchemaElementPtr) particle->children; if (elemDecl->flags & XML_SCHEMAS_ELEM_ABSTRACT) - return; + return(0); if (particle->maxOccurs == 1) { start = ctxt->state; ctxt->state = xmlAutomataNewTransition2(ctxt->am, start, NULL, @@ -12637,11 +12695,11 @@ xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt, } else if ((particle->maxOccurs >= UNBOUNDED) && (particle->minOccurs < 2)) { /* Special case. */ - start = ctxt->state; + start = ctxt->state; ctxt->state = xmlAutomataNewTransition2(ctxt->am, start, NULL, - elemDecl->name, elemDecl->targetNamespace, elemDecl); + elemDecl->name, elemDecl->targetNamespace, elemDecl); ctxt->state = xmlAutomataNewTransition2(ctxt->am, ctxt->state, ctxt->state, - elemDecl->name, elemDecl->targetNamespace, elemDecl); + elemDecl->name, elemDecl->targetNamespace, elemDecl); } else { int counter; int maxOccurs = particle->maxOccurs == UNBOUNDED ? @@ -12657,9 +12715,12 @@ xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt, ctxt->state = xmlAutomataNewCounterTrans(ctxt->am, ctxt->state, NULL, counter); } - if (particle->minOccurs == 0) + if (particle->minOccurs == 0) { xmlAutomataNewEpsilon(ctxt->am, start, ctxt->state); + ret = 1; + } } + return(ret); } /** @@ -12670,21 +12731,24 @@ xmlSchemaBuildContentModelForElement(xmlSchemaParserCtxtPtr ctxt, * * Create the automaton for the {content type} of a complex type. * + * Returns 1 if the content is nillable, 0 otherwise */ -static void +static int xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt, xmlSchemaParticlePtr particle) { + int ret = 0, tmp2; + if (particle == NULL) { - PERROR_INT("xmlSchemaBuildAContentModel", "particle is NULL"); - return; + PERROR_INT("xmlSchemaBuildAContentModel", "particle is NULL"); + return(1); } if (particle->children == NULL) { /* * Just return in this case. A missing "term" of the particle * might arise due to an invalid "term" component. */ - return; + return(1); } switch (particle->children->type) { @@ -12736,7 +12800,8 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt, int counter; xmlAutomataStatePtr hop; int maxOccurs = - particle->maxOccurs == UNBOUNDED ? UNBOUNDED : particle->maxOccurs - 1; + particle->maxOccurs == UNBOUNDED ? UNBOUNDED : + particle->maxOccurs - 1; int minOccurs = particle->minOccurs < 1 ? 0 : particle->minOccurs - 1; @@ -12771,243 +12836,282 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt, } if (particle->minOccurs == 0) { xmlAutomataNewEpsilon(pctxt->am, start, end); + ret = 1; } pctxt->state = end; break; } case XML_SCHEMA_TYPE_ELEMENT: - xmlSchemaBuildContentModelForElement(pctxt, particle); + ret = xmlSchemaBuildContentModelForElement(pctxt, particle); break; case XML_SCHEMA_TYPE_SEQUENCE:{ - xmlSchemaTreeItemPtr sub; - - /* - * If max and min occurances are default (1) then - * simply iterate over the particles of the . - */ - if ((particle->minOccurs == 1) && (particle->maxOccurs == 1)) { - sub = particle->children->children; - while (sub != NULL) { - xmlSchemaBuildAContentModel(pctxt, - (xmlSchemaParticlePtr) sub); - sub = sub->next; - } - } else { - xmlAutomataStatePtr oldstate = pctxt->state; - - if (particle->maxOccurs >= UNBOUNDED) { - if (particle->minOccurs > 1) { - xmlAutomataStatePtr tmp; - int counter; + xmlSchemaTreeItemPtr sub; - pctxt->state = xmlAutomataNewEpsilon(pctxt->am, - oldstate, NULL); - oldstate = pctxt->state; + ret = 1; + /* + * If max and min occurances are default (1) then + * simply iterate over the particles of the . + */ + if ((particle->minOccurs == 1) && (particle->maxOccurs == 1)) { + sub = particle->children->children; - counter = xmlAutomataNewCounter(pctxt->am, - particle->minOccurs - 1, UNBOUNDED); + while (sub != NULL) { + tmp2 = xmlSchemaBuildAContentModel(pctxt, + (xmlSchemaParticlePtr) sub); + if (tmp2 != 1) ret = 0; + sub = sub->next; + } + } else { + xmlAutomataStatePtr oldstate = pctxt->state; - sub = particle->children->children; - while (sub != NULL) { - xmlSchemaBuildAContentModel(pctxt, - (xmlSchemaParticlePtr) sub); - sub = sub->next; - } - tmp = pctxt->state; - xmlAutomataNewCountedTrans(pctxt->am, tmp, - oldstate, counter); - pctxt->state = - xmlAutomataNewCounterTrans(pctxt->am, tmp, - NULL, counter); - - } else { - pctxt->state = xmlAutomataNewEpsilon(pctxt->am, - oldstate, NULL); - oldstate = pctxt->state; - - sub = particle->children->children; - while (sub != NULL) { - xmlSchemaBuildAContentModel(pctxt, - (xmlSchemaParticlePtr) sub); - sub = sub->next; - } - xmlAutomataNewEpsilon(pctxt->am, pctxt->state, - oldstate); - /* - * epsilon needed to block previous trans from - * being allowed to enter back from another - * construct - */ - pctxt->state = xmlAutomataNewEpsilon(pctxt->am, - pctxt->state, NULL); - if (particle->minOccurs == 0) { - xmlAutomataNewEpsilon(pctxt->am, - oldstate, pctxt->state); - } - } - } else if ((particle->maxOccurs > 1) - || (particle->minOccurs > 1)) { + if (particle->maxOccurs >= UNBOUNDED) { + if (particle->minOccurs > 1) { xmlAutomataStatePtr tmp; int counter; pctxt->state = xmlAutomataNewEpsilon(pctxt->am, - oldstate, NULL); + oldstate, NULL); oldstate = pctxt->state; counter = xmlAutomataNewCounter(pctxt->am, - particle->minOccurs - 1, - particle->maxOccurs - 1); + particle->minOccurs - 1, UNBOUNDED); sub = particle->children->children; while (sub != NULL) { - xmlSchemaBuildAContentModel(pctxt, - (xmlSchemaParticlePtr) sub); + tmp2 = xmlSchemaBuildAContentModel(pctxt, + (xmlSchemaParticlePtr) sub); + if (tmp2 != 1) ret = 0; sub = sub->next; } tmp = pctxt->state; - xmlAutomataNewCountedTrans(pctxt->am, - tmp, oldstate, counter); + xmlAutomataNewCountedTrans(pctxt->am, tmp, + oldstate, counter); pctxt->state = - xmlAutomataNewCounterTrans(pctxt->am, tmp, NULL, - counter); - if (particle->minOccurs == 0) { + xmlAutomataNewCounterTrans(pctxt->am, tmp, + NULL, counter); + if (ret == 1) xmlAutomataNewEpsilon(pctxt->am, - oldstate, pctxt->state); - } + oldstate, pctxt->state); + } else { + pctxt->state = xmlAutomataNewEpsilon(pctxt->am, + oldstate, NULL); + oldstate = pctxt->state; + sub = particle->children->children; while (sub != NULL) { - xmlSchemaBuildAContentModel(pctxt, - (xmlSchemaParticlePtr) sub); + tmp2 = xmlSchemaBuildAContentModel(pctxt, + (xmlSchemaParticlePtr) sub); + if (tmp2 != 1) ret = 0; sub = sub->next; } + xmlAutomataNewEpsilon(pctxt->am, pctxt->state, + oldstate); + /* + * epsilon needed to block previous trans from + * being allowed to enter back from another + * construct + */ + pctxt->state = xmlAutomataNewEpsilon(pctxt->am, + pctxt->state, NULL); if (particle->minOccurs == 0) { - xmlAutomataNewEpsilon(pctxt->am, oldstate, - pctxt->state); + xmlAutomataNewEpsilon(pctxt->am, + oldstate, pctxt->state); + ret = 1; } } - } - break; - } - case XML_SCHEMA_TYPE_CHOICE:{ - xmlSchemaTreeItemPtr sub; - xmlAutomataStatePtr start, end; + } else if ((particle->maxOccurs > 1) + || (particle->minOccurs > 1)) { + xmlAutomataStatePtr tmp; + int counter; - start = pctxt->state; - end = xmlAutomataNewState(pctxt->am); + pctxt->state = xmlAutomataNewEpsilon(pctxt->am, + oldstate, NULL); + oldstate = pctxt->state; - /* - * iterate over the subtypes and remerge the end with an - * epsilon transition - */ - if (particle->maxOccurs == 1) { - sub = particle->children->children; + counter = xmlAutomataNewCounter(pctxt->am, + particle->minOccurs - 1, + particle->maxOccurs - 1); + + sub = particle->children->children; while (sub != NULL) { - pctxt->state = start; - xmlSchemaBuildAContentModel(pctxt, - (xmlSchemaParticlePtr) sub); - xmlAutomataNewEpsilon(pctxt->am, pctxt->state, end); + tmp2 = xmlSchemaBuildAContentModel(pctxt, + (xmlSchemaParticlePtr) sub); + if (tmp2 != 1) ret = 0; sub = sub->next; } + tmp = pctxt->state; + xmlAutomataNewCountedTrans(pctxt->am, + tmp, oldstate, counter); + pctxt->state = + xmlAutomataNewCounterTrans(pctxt->am, tmp, NULL, + counter); + if ((particle->minOccurs == 0) || (ret == 1)) { + xmlAutomataNewEpsilon(pctxt->am, + oldstate, pctxt->state); + ret = 1; + } } else { - int counter; - xmlAutomataStatePtr hop, base; - int maxOccurs = particle->maxOccurs == UNBOUNDED ? - UNBOUNDED : particle->maxOccurs - 1; - int minOccurs = - particle->minOccurs < 1 ? 0 : particle->minOccurs - 1; - - /* - * use a counter to keep track of the number of transtions - * which went through the choice. - */ - counter = - xmlAutomataNewCounter(pctxt->am, minOccurs, maxOccurs); - hop = xmlAutomataNewState(pctxt->am); - base = xmlAutomataNewState(pctxt->am); - - sub = particle->children->children; + sub = particle->children->children; while (sub != NULL) { - pctxt->state = base; - xmlSchemaBuildAContentModel(pctxt, - (xmlSchemaParticlePtr) sub); - xmlAutomataNewEpsilon(pctxt->am, pctxt->state, hop); + tmp2 = xmlSchemaBuildAContentModel(pctxt, + (xmlSchemaParticlePtr) sub); + if (tmp2 != 1) ret = 0; sub = sub->next; } - xmlAutomataNewEpsilon(pctxt->am, start, base); - xmlAutomataNewCountedTrans(pctxt->am, hop, base, counter); - xmlAutomataNewCounterTrans(pctxt->am, hop, end, counter); - } - if (particle->minOccurs == 0) { - xmlAutomataNewEpsilon(pctxt->am, start, end); + + /* + * epsilon needed to block previous trans from + * being allowed to enter back from another + * construct + */ + pctxt->state = xmlAutomataNewEpsilon(pctxt->am, + pctxt->state, NULL); + + if (particle->minOccurs == 0) { + xmlAutomataNewEpsilon(pctxt->am, oldstate, + pctxt->state); + ret = 1; + } } - pctxt->state = end; - break; } - case XML_SCHEMA_TYPE_ALL:{ - xmlAutomataStatePtr start; - xmlSchemaParticlePtr sub; - xmlSchemaElementPtr elemDecl; - int lax; - - sub = (xmlSchemaParticlePtr) particle->children->children; - if (sub == NULL) - break; - start = pctxt->state; + break; + } + case XML_SCHEMA_TYPE_CHOICE:{ + xmlSchemaTreeItemPtr sub; + xmlAutomataStatePtr start, end; + + ret = 0; + start = pctxt->state; + end = xmlAutomataNewState(pctxt->am); + + /* + * iterate over the subtypes and remerge the end with an + * epsilon transition + */ + if (particle->maxOccurs == 1) { + sub = particle->children->children; while (sub != NULL) { pctxt->state = start; + tmp2 = xmlSchemaBuildAContentModel(pctxt, + (xmlSchemaParticlePtr) sub); + if (tmp2 == 1) ret = 1; + xmlAutomataNewEpsilon(pctxt->am, pctxt->state, end); + sub = sub->next; + } + } else { + int counter; + xmlAutomataStatePtr hop, base; + int maxOccurs = particle->maxOccurs == UNBOUNDED ? + UNBOUNDED : particle->maxOccurs - 1; + int minOccurs = + particle->minOccurs < 1 ? 0 : particle->minOccurs - 1; - elemDecl = (xmlSchemaElementPtr) sub->children; - if (elemDecl == NULL) { - PERROR_INT("xmlSchemaBuildAContentModel", - " particle has no term"); - return; - }; - /* - * NOTE: The {max occurs} of all the particles in the - * {particles} of the group must be 0 or 1; this is - * already ensured during the parse of the content of - * . - */ - if (elemDecl->flags & XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD) { - int counter; - - /* - * This is an abstract group, we need to share - * the same counter for all the element transitions - * derived from the group - */ - counter = xmlAutomataNewCounter(pctxt->am, - sub->minOccurs, sub->maxOccurs); - xmlSchemaBuildContentModelForSubstGroup(pctxt, - sub, counter, pctxt->state); - } else { - if ((sub->minOccurs == 1) && - (sub->maxOccurs == 1)) { - xmlAutomataNewOnceTrans2(pctxt->am, pctxt->state, - pctxt->state, - elemDecl->name, - elemDecl->targetNamespace, - 1, 1, elemDecl); - } else if ((sub->minOccurs == 0) && - (sub->maxOccurs == 1)) { - - xmlAutomataNewCountTrans2(pctxt->am, pctxt->state, - pctxt->state, - elemDecl->name, - elemDecl->targetNamespace, - 0, - 1, - elemDecl); - } - } - sub = (xmlSchemaParticlePtr) sub->next; + /* + * use a counter to keep track of the number of transtions + * which went through the choice. + */ + counter = + xmlAutomataNewCounter(pctxt->am, minOccurs, maxOccurs); + hop = xmlAutomataNewState(pctxt->am); + base = xmlAutomataNewState(pctxt->am); + + sub = particle->children->children; + while (sub != NULL) { + pctxt->state = base; + tmp2 = xmlSchemaBuildAContentModel(pctxt, + (xmlSchemaParticlePtr) sub); + if (tmp2 == 1) ret = 1; + xmlAutomataNewEpsilon(pctxt->am, pctxt->state, hop); + sub = sub->next; } - lax = particle->minOccurs == 0; - pctxt->state = - xmlAutomataNewAllTrans(pctxt->am, pctxt->state, NULL, lax); + xmlAutomataNewEpsilon(pctxt->am, start, base); + xmlAutomataNewCountedTrans(pctxt->am, hop, base, counter); + xmlAutomataNewCounterTrans(pctxt->am, hop, end, counter); + if (ret == 1) + xmlAutomataNewEpsilon(pctxt->am, base, end); + } + if (particle->minOccurs == 0) { + xmlAutomataNewEpsilon(pctxt->am, start, end); + ret = 1; + } + pctxt->state = end; + break; + } + case XML_SCHEMA_TYPE_ALL:{ + xmlAutomataStatePtr start, tmp; + xmlSchemaParticlePtr sub; + xmlSchemaElementPtr elemDecl; + + ret = 1; + + sub = (xmlSchemaParticlePtr) particle->children->children; + if (sub == NULL) break; + + ret = 0; + + start = pctxt->state; + tmp = xmlAutomataNewState(pctxt->am); + xmlAutomataNewEpsilon(pctxt->am, pctxt->state, tmp); + pctxt->state = tmp; + while (sub != NULL) { + pctxt->state = tmp; + + elemDecl = (xmlSchemaElementPtr) sub->children; + if (elemDecl == NULL) { + PERROR_INT("xmlSchemaBuildAContentModel", + " particle has no term"); + return(ret); + }; + /* + * NOTE: The {max occurs} of all the particles in the + * {particles} of the group must be 0 or 1; this is + * already ensured during the parse of the content of + * . + */ + if (elemDecl->flags & XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD) { + int counter; + + /* + * This is an abstract group, we need to share + * the same counter for all the element transitions + * derived from the group + */ + counter = xmlAutomataNewCounter(pctxt->am, + sub->minOccurs, sub->maxOccurs); + xmlSchemaBuildContentModelForSubstGroup(pctxt, + sub, counter, pctxt->state); + } else { + if ((sub->minOccurs == 1) && + (sub->maxOccurs == 1)) { + xmlAutomataNewOnceTrans2(pctxt->am, pctxt->state, + pctxt->state, + elemDecl->name, + elemDecl->targetNamespace, + 1, 1, elemDecl); + } else if ((sub->minOccurs == 0) && + (sub->maxOccurs == 1)) { + + xmlAutomataNewCountTrans2(pctxt->am, pctxt->state, + pctxt->state, + elemDecl->name, + elemDecl->targetNamespace, + 0, + 1, + elemDecl); + } + } + sub = (xmlSchemaParticlePtr) sub->next; } + pctxt->state = + xmlAutomataNewAllTrans(pctxt->am, pctxt->state, NULL, 0); + if (particle->minOccurs == 0) { + xmlAutomataNewEpsilon(pctxt->am, start, pctxt->state); + ret = 1; + } + break; + } case XML_SCHEMA_TYPE_GROUP: /* * If we hit a model group definition, then this means that @@ -13016,14 +13120,16 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pctxt, * TODO: But the group should be substituted and not occur at * all in the content model at this point. Fix this. */ + ret = 1; break; default: xmlSchemaInternalErr2(ACTXT_CAST pctxt, "xmlSchemaBuildAContentModel", "found unexpected term of type '%s' in content model", WXS_ITEM_TYPE_NAME(particle->children), NULL); - return; + return(ret); } + return(ret); } /** @@ -13107,8 +13213,8 @@ xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl, if ((elemDecl->subtypes == NULL) && (elemDecl->namedType != NULL)) { xmlSchemaTypePtr type; - /* (type definition) ... otherwise the type definition ·resolved· - * to by the ·actual value· of the type [attribute] ... + /* (type definition) ... otherwise the type definition `resolved` + * to by the `actual value` of the type [attribute] ... */ type = xmlSchemaGetType(ctxt->schema, elemDecl->namedType, elemDecl->namedTypeNs); @@ -13146,7 +13252,7 @@ xmlSchemaResolveElementReferences(xmlSchemaElementPtr elemDecl, /* * The type definitions is set to: * SPEC "...the {type definition} of the element - * declaration ·resolved· to by the ·actual value· + * declaration `resolved` to by the `actual value` * of the substitutionGroup [attribute], if present" */ if (elemDecl->subtypes == NULL) @@ -13184,8 +13290,8 @@ xmlSchemaResolveUnionMemberTypes(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (1) "If the alternative is chosen, then [Definition:] - * define the explicit members as the type definitions ·resolved· - * to by the items in the ·actual value· of the memberTypes [attribute], + * define the explicit members as the type definitions `resolved` + * to by the items in the `actual value` of the memberTypes [attribute], * if any, followed by the type definitions corresponding to the * s among the [children] of , if any." */ @@ -13298,7 +13404,6 @@ xmlSchemaIsUserDerivedFromBuiltInType(xmlSchemaTypePtr type, int valType) return (0); } -#endif static xmlSchemaTypePtr xmlSchemaQueryBuiltInType(xmlSchemaTypePtr type) @@ -13311,6 +13416,7 @@ xmlSchemaQueryBuiltInType(xmlSchemaTypePtr type) return(type); return(xmlSchemaQueryBuiltInType(type->subtypes)); } +#endif /** * xmlSchemaGetPrimitiveType: @@ -13480,7 +13586,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, return (0); } /* - * 3 If both O1 and O2 are sets of (namespace names or ·absent·), + * 3 If both O1 and O2 are sets of (namespace names or `absent`), * then the union of those sets must be the value. */ if ((completeWild->nsSet != NULL) && (curWild->nsSet != NULL)) { @@ -13514,7 +13620,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, } /* * 4 If the two are negations of different values (namespace names - * or ·absent·), then a pair of not and ·absent· must be the value. + * or `absent`), then a pair of not and `absent` must be the value. */ if ((completeWild->negNsSet != NULL) && (curWild->negNsSet != NULL) && @@ -13556,7 +13662,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, if (nsFound && absentFound) { /* * 5.1 If the set S includes both the negated namespace - * name and ·absent·, then any must be the value. + * name and `absent`, then any must be the value. */ completeWild->any = 1; if (completeWild->nsSet != NULL) { @@ -13570,7 +13676,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, } else if (nsFound && (!absentFound)) { /* * 5.2 If the set S includes the negated namespace name - * but not ·absent·, then a pair of not and ·absent· must + * but not `absent`, then a pair of not and `absent` must * be the value. */ if (completeWild->nsSet != NULL) { @@ -13585,7 +13691,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, completeWild->negNsSet->value = NULL; } else if ((!nsFound) && absentFound) { /* - * 5.3 If the set S includes ·absent· but not the negated + * 5.3 If the set S includes `absent` but not the negated * namespace name, then the union is not expressible. */ xmlSchemaPErr(ctxt, completeWild->node, @@ -13596,7 +13702,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, } else if ((!nsFound) && (!absentFound)) { /* * 5.4 If the set S does not include either the negated namespace - * name or ·absent·, then whichever of O1 or O2 is a pair of not + * name or `absent`, then whichever of O1 or O2 is a pair of not * and a namespace name must be the value. */ if (completeWild->negNsSet == NULL) { @@ -13630,7 +13736,7 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, while (cur != NULL) { if (cur->value == NULL) { /* - * 6.1 If the set S includes ·absent·, then any must be the + * 6.1 If the set S includes `absent`, then any must be the * value. */ completeWild->any = 1; @@ -13648,8 +13754,8 @@ xmlSchemaUnionWildcards(xmlSchemaParserCtxtPtr ctxt, } if (completeWild->negNsSet == NULL) { /* - * 6.2 If the set S does not include ·absent·, then a pair of not - * and ·absent· must be the value. + * 6.2 If the set S does not include `absent`, then a pair of not + * and `absent` must be the value. */ if (completeWild->nsSet != NULL) { xmlSchemaFreeWildcardNsSet(completeWild->nsSet); @@ -13732,9 +13838,9 @@ xmlSchemaIntersectWildcards(xmlSchemaParserCtxtPtr ctxt, } /* * 3 If either O1 or O2 is a pair of not and a value (a namespace - * name or ·absent·) and the other is a set of (namespace names or - * ·absent·), then that set, minus the negated value if it was in - * the set, minus ·absent· if it was in the set, must be the value. + * name or `absent`) and the other is a set of (namespace names or + * `absent`), then that set, minus the negated value if it was in + * the set, minus `absent` if it was in the set, must be the value. */ if (((completeWild->negNsSet != NULL) && (curWild->nsSet != NULL)) || ((curWild->negNsSet != NULL) && (completeWild->nsSet != NULL))) { @@ -13783,7 +13889,7 @@ xmlSchemaIntersectWildcards(xmlSchemaParserCtxtPtr ctxt, return(0); } /* - * 4 If both O1 and O2 are sets of (namespace names or ·absent·), + * 4 If both O1 and O2 are sets of (namespace names or `absent`), * then the intersection of those sets must be the value. */ if ((completeWild->nsSet != NULL) && (curWild->nsSet != NULL)) { @@ -13833,7 +13939,7 @@ xmlSchemaIntersectWildcards(xmlSchemaParserCtxtPtr ctxt, } /* * 6 If the one is a negation of a namespace name and the other - * is a negation of ·absent·, then the one which is the negation + * is a negation of `absent`, then the one which is the negation * of a namespace name must be the value. */ if ((completeWild->negNsSet != NULL) && (curWild->negNsSet != NULL) && @@ -13865,15 +13971,15 @@ xmlSchemaCheckCOSNSSubset(xmlSchemaWildcardPtr sub, if (super->any) return (0); /* - * 2.1 sub must be a pair of not and a namespace name or ·absent·. + * 2.1 sub must be a pair of not and a namespace name or `absent`. * 2.2 super must be a pair of not and the same value. */ if ((sub->negNsSet != NULL) && (super->negNsSet != NULL) && - (sub->negNsSet->value == sub->negNsSet->value)) + (sub->negNsSet->value == super->negNsSet->value)) return (0); /* - * 3.1 sub must be a set whose members are either namespace names or ·absent·. + * 3.1 sub must be a set whose members are either namespace names or `absent`. */ if (sub->nsSet != NULL) { /* @@ -13904,7 +14010,7 @@ xmlSchemaCheckCOSNSSubset(xmlSchemaWildcardPtr sub, xmlSchemaWildcardNsPtr cur; /* * 3.2.2 super must be a pair of not and a namespace name or - * ·absent· and that value must not be in sub's set. + * `absent` and that value must not be in sub's set. */ cur = sub->nsSet; while (cur != NULL) { @@ -13929,7 +14035,7 @@ xmlSchemaGetEffectiveValueConstraint(xmlSchemaAttributeUsePtr attruse, if (val != 0) *val = NULL; - if (attruse->defValue != NULL) { + if (attruse->defValue != NULL) { *value = attruse->defValue; if (val != NULL) *val = attruse->defVal; @@ -14009,12 +14115,12 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, xmlSchemaItemListPtr baseUses, xmlSchemaWildcardPtr wild, xmlSchemaWildcardPtr baseWild) -{ +{ xmlSchemaAttributeUsePtr cur = NULL, bcur; int i, j, found; /* err = 0; */ const xmlChar *bEffValue; int effFixed; - + if (uses != NULL) { for (i = 0; i < uses->nbItems; i++) { cur = uses->items[i]; @@ -14022,7 +14128,7 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, if (baseUses == NULL) goto not_found; for (j = 0; j < baseUses->nbItems; j++) { - bcur = baseUses->items[j]; + bcur = baseUses->items[j]; if ((WXS_ATTRUSE_DECL_NAME(cur) == WXS_ATTRUSE_DECL_NAME(bcur)) && (WXS_ATTRUSE_DECL_TNS(cur) == @@ -14035,7 +14141,7 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, * namespace}, then all of the following must be true:" */ found = 1; - + if ((cur->occurs == XML_SCHEMAS_ATTR_USE_OPTIONAL) && (bcur->occurs == XML_SCHEMAS_ATTR_USE_REQUIRED)) { @@ -14061,12 +14167,12 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, WXS_ATTRUSE_TYPEDEF(bcur), 0) != 0) { xmlChar *strA = NULL, *strB = NULL, *strC = NULL; - + /* * SPEC (2.1.2) "R's {attribute declaration}'s * {type definition} must be validly derived from * B's {type definition} given the empty set as - * defined in Type Derivation OK (Simple) (§3.14.6)." + * defined in Type Derivation OK (Simple) ($3.14.6)." */ xmlSchemaPAttrUseErr4(pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, @@ -14098,17 +14204,17 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, /* * 2.1.3 ... one of the following must be true * - * 2.1.3.1 B's ·effective value constraint· is - * ·absent· or default. + * 2.1.3.1 B's `effective value constraint` is + * `absent` or default. */ if ((bEffValue != NULL) && (effFixed == 1)) { const xmlChar *rEffValue = NULL; - + xmlSchemaGetEffectiveValueConstraint(bcur, &effFixed, &rEffValue, NULL); /* - * 2.1.3.2 R's ·effective value constraint· is + * 2.1.3.2 R's `effective value constraint` is * fixed with the same string as B's. * MAYBE TODO: Compare the computed values. * Hmm, it says "same string" so @@ -14118,7 +14224,7 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, (! WXS_ARE_DEFAULT_STR_EQUAL(rEffValue, bEffValue))) { xmlChar *str = NULL; - + xmlSchemaPAttrUseErr4(pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, WXS_ITEM_NODE(item), item, cur, @@ -14137,21 +14243,21 @@ xmlSchemaCheckDerivationOKRestriction2to4(xmlSchemaParserCtxtPtr pctxt, break; } } -not_found: +not_found: if (!found) { /* * (2.2) "otherwise the {base type definition} must have an * {attribute wildcard} and the {target namespace} of the - * R's {attribute declaration} must be ·valid· with respect + * R's {attribute declaration} must be `valid` with respect * to that wildcard, as defined in Wildcard allows Namespace - * Name (§3.10.4)." + * Name ($3.10.4)." */ if ((baseWild == NULL) || (xmlSchemaCheckCVCWildcardNamespace(baseWild, (WXS_ATTRUSE_DECL(cur))->targetNamespace) != 0)) { xmlChar *str = NULL; - + xmlSchemaPAttrUseErr4(pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, WXS_ITEM_NODE(item), item, cur, @@ -14167,7 +14273,7 @@ not_found: } } /* - * SPEC derivation-ok-restriction (3): + * SPEC derivation-ok-restriction (3): * (3) "For each attribute use in the {attribute uses} of the {base type * definition} whose {required} is true, there must be an attribute * use with an {attribute declaration} with the same {name} and @@ -14182,7 +14288,7 @@ not_found: found = 0; if (uses != NULL) { for (i = 0; i < uses->nbItems; i++) { - cur = uses->items[i]; + cur = uses->items[i]; if ((WXS_ATTRUSE_DECL_NAME(cur) == WXS_ATTRUSE_DECL_NAME(bcur)) && (WXS_ATTRUSE_DECL_TNS(cur) == @@ -14194,7 +14300,7 @@ not_found: } if (!found) { xmlChar *strA = NULL, *strB = NULL; - + xmlSchemaCustomErr4(ACTXT_CAST pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, NULL, item, @@ -14216,19 +14322,19 @@ not_found: /* * (4) "If there is an {attribute wildcard}, all of the * following must be true:" - */ + */ if (baseWild == NULL) { xmlChar *str = NULL; /* * (4.1) "The {base type definition} must also have one." - */ + */ xmlSchemaCustomErr4(ACTXT_CAST pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, NULL, item, "The %s has an attribute wildcard, " "but the %s %s '%s' does not have one", - WXS_ITEM_TYPE_NAME(item), + WXS_ITEM_TYPE_NAME(item), WXS_ACTION_STR(action), WXS_ITEM_TYPE_NAME(baseItem), xmlSchemaGetComponentQName(&str, baseItem)); @@ -14242,7 +14348,7 @@ not_found: * (4.2) "The complex type definition's {attribute wildcard}'s * {namespace constraint} must be a subset of the {base type * definition}'s {attribute wildcard}'s {namespace constraint}, - * as defined by Wildcard Subset (§3.10.6)." + * as defined by Wildcard Subset ($3.10.6)." */ xmlSchemaCustomErr4(ACTXT_CAST pctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, @@ -14256,8 +14362,8 @@ not_found: FREE_AND_NULL(str); return(pctxt->err); } - /* 4.3 Unless the {base type definition} is the ·ur-type - * definition·, the complex type definition's {attribute + /* 4.3 Unless the {base type definition} is the `ur-type + * definition`, the complex type definition's {attribute * wildcard}'s {process contents} must be identical to or * stronger than the {base type definition}'s {attribute * wildcard}'s {process contents}, where strict is stronger @@ -14308,7 +14414,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt, xmlSchemaTypePtr type) { xmlSchemaTypePtr baseType = NULL; - xmlSchemaAttributeUsePtr use; + xmlSchemaAttributeUsePtr use; xmlSchemaItemListPtr uses, baseUses, prohibs = NULL; if (type->baseType == NULL) { @@ -14316,7 +14422,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt, "no base type"); return (-1); } - baseType = type->baseType; + baseType = type->baseType; if (WXS_IS_TYPE_NOT_FIXED(baseType)) if (xmlSchemaTypeFixup(baseType, ACTXT_CAST pctxt) == -1) return(-1); @@ -14328,7 +14434,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt, * wildcard, i.e. intersect multiple wildcards. * Move attribute prohibitions into a separate list. */ - if (uses != NULL) { + if (uses != NULL) { if (WXS_IS_RESTRICTION(type)) { /* * This one will transfer all attr. prohibitions @@ -14362,7 +14468,7 @@ xmlSchemaFixupTypeAttributeUses(xmlSchemaParserCtxtPtr pctxt, if (WXS_IS_RESTRICTION(type)) { int usesCount; - xmlSchemaAttributeUsePtr tmp; + xmlSchemaAttributeUsePtr tmp; if (uses != NULL) usesCount = uses->nbItems; @@ -14412,15 +14518,15 @@ inherit_next: {} } } else { /* Extension. */ - for (i = 0; i < baseUses->nbItems; i++) { - use = baseUses->items[i]; + for (i = 0; i < baseUses->nbItems; i++) { + use = baseUses->items[i]; if (uses == NULL) { type->attrUses = xmlSchemaItemListCreate(); if (type->attrUses == NULL) goto exit_failure; uses = type->attrUses; } - xmlSchemaItemListAddSize(uses, baseUses->nbItems, use); + xmlSchemaItemListAddSize(uses, baseUses->nbItems, use); } } } @@ -14440,10 +14546,10 @@ inherit_next: {} /* * Compute the complete wildcard. */ - if (WXS_IS_EXTENSION(type)) { + if (WXS_IS_EXTENSION(type)) { if (baseType->attributeWildcard != NULL) { /* - * (3.2.2.1) "If the ·base wildcard· is non-·absent·, then + * (3.2.2.1) "If the `base wildcard` is non-`absent`, then * the appropriate case among the following:" */ if (type->attributeWildcard != NULL) { @@ -14451,26 +14557,26 @@ inherit_next: {} * Union the complete wildcard with the base wildcard. * SPEC {attribute wildcard} * (3.2.2.1.2) "otherwise a wildcard whose {process contents} - * and {annotation} are those of the ·complete wildcard·, + * and {annotation} are those of the `complete wildcard`, * and whose {namespace constraint} is the intensional union - * of the {namespace constraint} of the ·complete wildcard· - * and of the ·base wildcard·, as defined in Attribute - * Wildcard Union (§3.10.6)." + * of the {namespace constraint} of the `complete wildcard` + * and of the `base wildcard`, as defined in Attribute + * Wildcard Union ($3.10.6)." */ if (xmlSchemaUnionWildcards(pctxt, type->attributeWildcard, baseType->attributeWildcard) == -1) - goto exit_failure; + goto exit_failure; } else { /* - * (3.2.2.1.1) "If the ·complete wildcard· is ·absent·, - * then the ·base wildcard·." + * (3.2.2.1.1) "If the `complete wildcard` is `absent`, + * then the `base wildcard`." */ type->attributeWildcard = baseType->attributeWildcard; - } + } } else { /* - * (3.2.2.2) "otherwise (the ·base wildcard· is ·absent·) the - * ·complete wildcard" + * (3.2.2.2) "otherwise (the `base wildcard` is `absent`) the + * `complete wildcard`" * NOOP */ } @@ -14478,11 +14584,11 @@ inherit_next: {} /* * SPEC {attribute wildcard} * (3.1) "If the alternative is chosen, then the - * ·complete wildcard·;" + * `complete wildcard`;" * NOOP */ } - + return (0); exit_failure: @@ -14586,6 +14692,7 @@ xmlSchemaGetParticleTotalRangeMin(xmlSchemaParticlePtr particle) } } +#if 0 /** * xmlSchemaGetParticleTotalRangeMax: * @particle: the particle @@ -14645,6 +14752,7 @@ xmlSchemaGetParticleTotalRangeMax(xmlSchemaParticlePtr particle) return (particle->maxOccurs * sum); } } +#endif /** * xmlSchemaIsParticleEmptiable: @@ -14725,12 +14833,12 @@ xmlSchemaCheckCOSSTDerivedOK(xmlSchemaAbstractCtxtPtr actxt, /* 2.2 */ if (type->baseType == baseType) { /* - * 2.2.1 D's ·base type definition· is B. + * 2.2.1 D's `base type definition` is B. */ return (0); } /* - * 2.2.2 D's ·base type definition· is not the ·ur-type definition· + * 2.2.2 D's `base type definition` is not the `ur-type definition` * and is validly derived from B given the subset, as defined by this * constraint. */ @@ -14740,8 +14848,8 @@ xmlSchemaCheckCOSSTDerivedOK(xmlSchemaAbstractCtxtPtr actxt, return (0); } /* - * 2.2.3 D's {variety} is list or union and B is the ·simple ur-type - * definition·. + * 2.2.3 D's {variety} is list or union and B is the `simple ur-type + * definition`. */ if (WXS_IS_ANY_SIMPLE_TYPE(baseType) && (WXS_IS_LIST(type) || WXS_IS_UNION(type))) { @@ -14857,10 +14965,10 @@ static int xmlSchemaCheckUnionTypeDefCircularRecur(xmlSchemaParserCtxtPtr pctxt, xmlSchemaTypePtr ctxType, xmlSchemaTypeLinkPtr members) -{ +{ xmlSchemaTypeLinkPtr member; xmlSchemaTypePtr memberType; - + member = members; while (member != NULL) { memberType = member->type; @@ -14961,7 +15069,7 @@ xmlSchemaResolveTypeReferences(xmlSchemaTypePtr typeDef, } return; } - } + } /* * The ball of letters below means, that if we have a particle * which has a QName-helper component as its {term}, we want @@ -15004,7 +15112,7 @@ xmlSchemaResolveTypeReferences(xmlSchemaTypePtr typeDef, * particle's {term}. */ WXS_TYPE_PARTICLE_TERM(typeDef) = WXS_MODELGROUPDEF_MODEL(groupDef); - + if (WXS_MODELGROUPDEF_MODEL(groupDef)->type == XML_SCHEMA_TYPE_ALL) { /* * SPEC cos-all-limited (1.2) @@ -15053,14 +15161,14 @@ xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ctxt, * NOTE: This is somehow redundant, since we actually built a simple type * to have all the needed information; this acts as an self test. */ - /* Base type: If the datatype has been ·derived· by ·restriction· - * then the Simple Type Definition component from which it is ·derived·, - * otherwise the Simple Type Definition for anySimpleType (§4.1.6). + /* Base type: If the datatype has been `derived` by `restriction` + * then the Simple Type Definition component from which it is `derived`, + * otherwise the Simple Type Definition for anySimpleType ($4.1.6). */ if (baseType == NULL) { /* * TODO: Think about: "modulo the impact of Missing - * Sub-components (§5.3)." + * Sub-components ($5.3)." */ xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_ST_PROPS_CORRECT_1, @@ -15078,13 +15186,14 @@ xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ctxt, FREE_AND_NULL(str) return (XML_SCHEMAP_ST_PROPS_CORRECT_1); } - if ( (WXS_IS_LIST(type) || WXS_IS_UNION(type)) && - (WXS_IS_RESTRICTION(type) == 0) && - (! WXS_IS_ANY_SIMPLE_TYPE(baseType))) { + if ((WXS_IS_LIST(type) || WXS_IS_UNION(type)) && + (WXS_IS_RESTRICTION(type) == 0) && + ((! WXS_IS_ANY_SIMPLE_TYPE(baseType)) && + (baseType->type != XML_SCHEMA_TYPE_SIMPLE))) { xmlSchemaPCustomErr(ctxt, XML_SCHEMAP_ST_PROPS_CORRECT_1, WXS_BASIC_CAST type, NULL, - "A type, derived by list or union, must have" + "A type, derived by list or union, must have " "the simple ur-type definition as base type, not '%s'", xmlSchemaGetComponentQName(&str, baseType)); FREE_AND_NULL(str) @@ -15119,10 +15228,10 @@ xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ctxt, } /* - * 2 All simple type definitions must be derived ultimately from the ·simple - * ur-type definition (so· circular definitions are disallowed). That is, it - * must be possible to reach a built-in primitive datatype or the ·simple - * ur-type definition· by repeatedly following the {base type definition}. + * 2 All simple type definitions must be derived ultimately from the `simple + * ur-type definition` (so circular definitions are disallowed). That is, it + * must be possible to reach a built-in primitive datatype or the `simple + * ur-type definition` by repeatedly following the {base type definition}. * * NOTE: this is done in xmlSchemaCheckTypeDefCircular(). */ @@ -15306,10 +15415,10 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, } /* * MAYBE TODO: (Hmm, not really) Datatypes states: - * A ·list· datatype can be ·derived· from an ·atomic· datatype - * whose ·lexical space· allows space (such as string or anyURI)or - * a ·union· datatype any of whose {member type definitions}'s - * ·lexical space· allows space. + * A `list` datatype can be `derived` from an `atomic` datatype + * whose `lexical space` allows space (such as string or anyURI)or + * a `union` datatype any of whose {member type definitions}'s + * `lexical space` allows space. */ } else { /* @@ -15346,7 +15455,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, /* * 2.3.2.3 The {item type definition} must be validly derived * from the {base type definition}'s {item type definition} given - * the empty set, as defined in Type Derivation OK (Simple) (§3.14.6). + * the empty set, as defined in Type Derivation OK (Simple) ($3.14.6). */ { xmlSchemaTypePtr baseItemType; @@ -15393,7 +15502,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, case XML_SCHEMA_FACET_WHITESPACE: /* * TODO: 2.5.1.2 List datatypes - * The value of ·whiteSpace· is fixed to the value collapse. + * The value of `whiteSpace` is fixed to the value collapse. */ case XML_SCHEMA_FACET_PATTERN: case XML_SCHEMA_FACET_ENUMERATION: @@ -15446,8 +15555,8 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, member = member->next; } /* - * 3.3.1 If the {base type definition} is the ·simple ur-type - * definition· + * 3.3.1 If the {base type definition} is the `simple ur-type + * definition` */ if (type->baseType->builtInType == XML_SCHEMAS_ANYSIMPLETYPE) { /* @@ -15509,7 +15618,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, * 3.3.2.3 The {member type definitions}, in order, must be validly * derived from the corresponding type definitions in the {base * type definition}'s {member type definitions} given the empty set, - * as defined in Type Derivation OK (Simple) (§3.14.6). + * as defined in Type Derivation OK (Simple) ($3.14.6). */ { xmlSchemaTypeLinkPtr baseMember; @@ -15557,7 +15666,8 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, return (XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3); } member = member->next; - baseMember = baseMember->next; + if (baseMember != NULL) + baseMember = baseMember->next; } } } @@ -15601,7 +15711,7 @@ xmlSchemaCheckCOSSTRestricts(xmlSchemaParserCtxtPtr pctxt, * @ctxt: the schema parser context * @type: the simple type definition * - * Checks crc-simple-type constraints. + * Checks crc-simple-type constraints. * * Returns 0 if the constraints are satisfied, * if not a positive error code and -1 on internal @@ -15615,8 +15725,8 @@ xmlSchemaCheckSRCSimpleType(xmlSchemaParserCtxtPtr ctxt, /* * src-simple-type.1 The corresponding simple type definition, if any, * must satisfy the conditions set out in Constraints on Simple Type - * Definition Schema Components (§3.14.6). - */ + * Definition Schema Components ($3.14.6). + */ if (WXS_IS_RESTRICTION(type)) { /* * src-simple-type.2 "If the alternative is chosen, @@ -15625,7 +15735,7 @@ xmlSchemaCheckSRCSimpleType(xmlSchemaParserCtxtPtr ctxt, * NOTE: This is checked in the parse function of . */ /* - * + * */ } else if (WXS_IS_LIST(type)) { /* src-simple-type.3 "If the alternative is chosen, either it must have @@ -15634,8 +15744,8 @@ xmlSchemaCheckSRCSimpleType(xmlSchemaParserCtxtPtr ctxt, * * NOTE: This is checked in the parse function of . */ - } else if (WXS_IS_UNION(type)) { - /* + } else if (WXS_IS_UNION(type)) { + /* * src-simple-type.4 is checked in xmlSchemaCheckUnionTypeDefCircular(). */ } @@ -15713,8 +15823,8 @@ xmlSchemaParseCheckCOSValidDefault(xmlSchemaParserCtxtPtr pctxt, * SPEC (2.1) "its {content type} must be a simple type definition * or mixed." * SPEC (2.2.2) "If the {content type} is mixed, then the {content - * type}'s particle must be ·emptiable· as defined by - * Particle Emptiable (§3.9.6)." + * type}'s particle must be `emptiable` as defined by + * Particle Emptiable ($3.9.6)." */ if ((! WXS_HAS_SIMPLE_CONTENT(type)) && ((! WXS_HAS_MIXED_CONTENT(type)) || (! WXS_EMPTIABLE(type)))) { @@ -15730,14 +15840,14 @@ xmlSchemaParseCheckCOSValidDefault(xmlSchemaParserCtxtPtr pctxt, } /* * 1 If the type definition is a simple type definition, then the string - * must be ·valid· with respect to that definition as defined by String - * Valid (§3.14.4). + * must be `valid` with respect to that definition as defined by String + * Valid ($3.14.4). * * AND * * 2.2.1 If the {content type} is a simple type definition, then the - * string must be ·valid· with respect to that simple type definition - * as defined by String Valid (§3.14.4). + * string must be `valid` with respect to that simple type definition + * as defined by String Valid ($3.14.4). */ if (WXS_IS_SIMPLE(type)) ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, node, @@ -15778,8 +15888,8 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * * SPEC (1) "The values of the properties of a complex type definition must * be as described in the property tableau in The Complex Type Definition - * Schema Component (§3.4.1), modulo the impact of Missing - * Sub-components (§5.3)." + * Schema Component ($3.4.1), modulo the impact of Missing + * Sub-components ($5.3)." */ if ((type->baseType != NULL) && (WXS_IS_SIMPLE(type->baseType)) && @@ -15790,15 +15900,15 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, */ xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_SRC_CT_1, - NULL, WXS_BASIC_CAST type, + NULL, WXS_BASIC_CAST type, "If the base type is a simple type, the derivation method must be " "'extension'", NULL, NULL); return (XML_SCHEMAP_SRC_CT_1); } /* - * SPEC (3) "Circular definitions are disallowed, except for the ·ur-type - * definition·. That is, it must be possible to reach the ·ur-type - * definition by repeatedly following the {base type definition}." + * SPEC (3) "Circular definitions are disallowed, except for the `ur-type + * definition`. That is, it must be possible to reach the `ur-type + * definition` by repeatedly following the {base type definition}." * * NOTE (3) is done in xmlSchemaCheckTypeDefCircular(). */ @@ -15807,7 +15917,7 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * - attribute uses need to be already inherited (apply attr. prohibitions) * - attribute group references need to be expanded already * - simple types need to be typefixed already - */ + */ if (type->attrUses && (((xmlSchemaItemListPtr) type->attrUses)->nbItems > 1)) { @@ -15817,8 +15927,8 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, for (i = uses->nbItems -1; i >= 0; i--) { use = uses->items[i]; - - /* + + /* * SPEC ct-props-correct * (4) "Two distinct attribute declarations in the * {attribute uses} must not have identical {name}s and @@ -15859,10 +15969,10 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, if (WXS_ATTRUSE_TYPEDEF(use) != NULL) { if (xmlSchemaIsDerivedFromBuiltInType( WXS_ATTRUSE_TYPEDEF(use), XML_SCHEMAS_ID)) - { + { if (hasId) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_AG_PROPS_CORRECT, NULL, WXS_BASIC_CAST type, @@ -15876,7 +15986,7 @@ xmlSchemaCheckCTPropsCorrect(xmlSchemaParserCtxtPtr pctxt, if (xmlSchemaItemListRemove(uses, i) == -1) goto exit_failure; } - + hasId = 1; } } @@ -15950,8 +16060,8 @@ xmlSchemaCheckCOSCTDerivedOK(xmlSchemaAbstractCtxtPtr actxt, if (type->baseType == baseType) return (0); /* - * SPEC (2.3.1) "D's {base type definition} must not be the ·ur-type - * definition·." + * SPEC (2.3.1) "D's {base type definition} must not be the `ur-type + * definition`." */ if (WXS_IS_ANYTYPE(type->baseType)) return (1); @@ -15968,7 +16078,7 @@ xmlSchemaCheckCOSCTDerivedOK(xmlSchemaAbstractCtxtPtr actxt, /* * SPEC (2.3.2.2) "If D's {base type definition} is simple, then it * must be validly derived from B given the subset as defined in Type - * Derivation OK (Simple) (§3.14.6). + * Derivation OK (Simple) ($3.14.6). */ return (xmlSchemaCheckCOSSTDerivedOK(actxt, type->baseType, baseType, set)); @@ -16029,7 +16139,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, * SPEC (1) "If the {base type definition} is a complex type definition, * then all of the following must be true:" */ - if (WXS_IS_COMPLEX(base)) { + if (WXS_IS_COMPLEX(base)) { /* * SPEC (1.1) "The {final} of the {base type definition} must not * contain extension." @@ -16042,7 +16152,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, "contains 'extension'", NULL); return (XML_SCHEMAP_COS_CT_EXTENDS_1_1); } - + /* * ATTENTION: The constrains (1.2) and (1.3) are not applied, * since they are automatically satisfied through the @@ -16086,11 +16196,11 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, } if (! found) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_COS_CT_EXTENDS_1_2, NULL, WXS_BASIC_CAST type, - /* + /* * TODO: The report does not indicate that also the * type needs to be the same. */ @@ -16108,9 +16218,9 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, * definition must also have one, and the base type definition's * {attribute wildcard}'s {namespace constraint} must be a subset * of the complex type definition's {attribute wildcard}'s {namespace - * constraint}, as defined by Wildcard Subset (§3.10.6)." + * constraint}, as defined by Wildcard Subset ($3.10.6)." */ - + /* * MAYBE TODO: Enable if ever needed. But this will be needed only * if created the type via a schema construction API. @@ -16118,7 +16228,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, if (base->attributeWildcard != NULL) { if (type->attributeWilcard == NULL) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_COS_CT_EXTENDS_1_3, NULL, type, @@ -16131,7 +16241,7 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, base->attributeWildcard, type->attributeWildcard)) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_COS_CT_EXTENDS_1_3, NULL, type, @@ -16205,9 +16315,9 @@ xmlSchemaCheckCOSCTExtends(xmlSchemaParserCtxtPtr ctxt, } /* * URGENT TODO SPEC (1.4.3.2.2.2) "The particle of the - * complex type definition must be a ·valid extension· + * complex type definition must be a `valid extension` * of the {base type definition}'s particle, as defined - * in Particle Valid (Extension) (§3.9.6)." + * in Particle Valid (Extension) ($3.9.6)." * * NOTE that we won't check "Particle Valid (Extension)", * since it is ensured by the derivation process in @@ -16285,7 +16395,7 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, */ base = type->baseType; if (! WXS_IS_COMPLEX(base)) { - xmlSchemaCustomErr(ACTXT_CAST ctxt, + xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, type->node, WXS_BASIC_CAST type, "The base type must be a complex type", NULL, NULL); @@ -16296,7 +16406,7 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, * SPEC (1) "The {base type definition} must be a complex type * definition whose {final} does not contain restriction." */ - xmlSchemaCustomErr(ACTXT_CAST ctxt, + xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, type->node, WXS_BASIC_CAST type, "The 'final' of the base type definition " @@ -16324,7 +16434,7 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, if (base->builtInType == XML_SCHEMAS_ANYTYPE) { /* * SPEC (5.1) "The {base type definition} must be the - * ·ur-type definition·." + * `ur-type definition`." * PASS */ } else if ((type->contentType == XML_SCHEMA_CONTENT_SIMPLE) || @@ -16343,11 +16453,11 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, * SPEC (5.2.2.1) "The {content type} of the {base type * definition} must be a simple type definition from which * the {content type} is validly derived given the empty - * set as defined in Type Derivation OK (Simple) (§3.14.6)." + * set as defined in Type Derivation OK (Simple) ($3.14.6)." * * ATTENTION TODO: This seems not needed if the type implicitely * derived from the base type. - * + * */ err = xmlSchemaCheckCOSSTDerivedOK(ACTXT_CAST ctxt, type->contentTypeDef, base->contentTypeDef, 0); @@ -16374,8 +16484,8 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, (xmlSchemaParticlePtr) base->subtypes))) { /* * SPEC (5.2.2.2) "The {base type definition} must be mixed - * and have a particle which is ·emptiable· as defined in - * Particle Emptiable (§3.9.6)." + * and have a particle which is `emptiable` as defined in + * Particle Emptiable ($3.9.6)." * PASS */ } else { @@ -16404,7 +16514,7 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (5.3.2.2) "The {content type} of the {base type * definition} must be elementOnly or mixed and have a particle - * which is ·emptiable· as defined in Particle Emptiable (§3.9.6)." + * which is `emptiable` as defined in Particle Emptiable ($3.9.6)." * PASS */ } else { @@ -16421,7 +16531,7 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (5.4.1.1) "The {content type} of the complex type definition * itself must be element-only" - */ + */ if (WXS_HAS_MIXED_CONTENT(type) && (! WXS_HAS_MIXED_CONTENT(base))) { /* * SPEC (5.4.1.2) "The {content type} of the complex type @@ -16437,9 +16547,9 @@ xmlSchemaCheckDerivationOKRestriction(xmlSchemaParserCtxtPtr ctxt, } /* * SPEC (5.4.2) "The particle of the complex type definition itself - * must be a ·valid restriction· of the particle of the {content + * must be a `valid restriction` of the particle of the {content * type} of the {base type definition} as defined in Particle Valid - * (Restriction) (§3.9.6). + * (Restriction) ($3.9.6). * * URGENT TODO: (5.4.2) */ @@ -16508,7 +16618,7 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, if (! WXS_HAS_SIMPLE_CONTENT(type)) { /* * 1 If the alternative is chosen, the type definition - * ·resolved· to by the ·actual value· of the base [attribute] + * `resolved` to by the `actual value` of the base [attribute] * must be a complex type definition; */ if (! WXS_IS_COMPLEX(base)) { @@ -16528,7 +16638,7 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, * SPEC * 2 If the alternative is chosen, all of the * following must be true: - * 2.1 The type definition ·resolved· to by the ·actual value· of the + * 2.1 The type definition `resolved` to by the `actual value` of the * base [attribute] must be one of the following: */ if (WXS_IS_SIMPLE(base)) { @@ -16578,11 +16688,11 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, if (! xmlSchemaIsParticleEmptiable( (xmlSchemaParticlePtr) base->subtypes)) { ret = XML_SCHEMAP_SRC_CT_1; - } else + } else /* * Attention: at this point the child is in * ->contentTypeDef (put there during parsing). - */ + */ if (type->contentTypeDef == NULL) { xmlChar *str = NULL; /* @@ -16634,14 +16744,14 @@ xmlSchemaCheckSRCCT(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (3) "The corresponding complex type definition component must * satisfy the conditions set out in Constraints on Complex Type - * Definition Schema Components (§3.4.6);" + * Definition Schema Components ($3.4.6);" * NOTE (3) will be done in xmlSchemaTypeFixup(). */ /* * SPEC (4) If clause 2.2.1 or clause 2.2.2 in the correspondence specification * above for {attribute wildcard} is satisfied, the intensional * intersection must be expressible, as defined in Attribute Wildcard - * Intersection (§3.10.6). + * Intersection ($3.10.6). * NOTE (4) is done in xmlSchemaFixupTypeAttributeUses(). */ return (ret); @@ -16712,7 +16822,7 @@ xmlSchemaCheckRCaseNameAndTypeOK(xmlSchemaParserCtxtPtr ctxt, return (1); /* * SPEC (2) "R's occurrence range is a valid restriction of B's - * occurrence range as defined by Occurrence Range OK (§3.9.6)." + * occurrence range as defined by Occurrence Range OK ($3.9.6)." */ if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, b->minOccurs, b->maxOccurs) != 0) @@ -16804,19 +16914,19 @@ xmlSchemaCheckRCaseNSCompat(xmlSchemaParserCtxtPtr ctxt, { /* TODO:Error codes (rcase-NSCompat). */ /* - * SPEC "For an element declaration particle to be a ·valid restriction· + * SPEC "For an element declaration particle to be a `valid restriction` * of a wildcard particle all of the following must be true:" * - * SPEC (1) "The element declaration's {target namespace} is ·valid· + * SPEC (1) "The element declaration's {target namespace} is `valid` * with respect to the wildcard's {namespace constraint} as defined by - * Wildcard allows Namespace Name (§3.10.4)." + * Wildcard allows Namespace Name ($3.10.4)." */ if (xmlSchemaCheckCVCWildcardNamespace((xmlSchemaWildcardPtr) b->children, ((xmlSchemaElementPtr) r->children)->targetNamespace) != 0) return (1); /* * SPEC (2) "R's occurrence range is a valid restriction of B's - * occurrence range as defined by Occurrence Range OK (§3.9.6)." + * occurrence range as defined by Occurrence Range OK ($3.9.6)." */ if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, b->minOccurs, b->maxOccurs) != 0) @@ -16876,21 +16986,21 @@ xmlSchemaCheckRCaseNSSubset(xmlSchemaParserCtxtPtr ctxt, /* TODO: Error codes (rcase-NSSubset). */ /* * SPEC (1) "R's occurrence range is a valid restriction of B's - * occurrence range as defined by Occurrence Range OK (§3.9.6)." + * occurrence range as defined by Occurrence Range OK ($3.9.6)." */ if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, b->minOccurs, b->maxOccurs)) return (1); /* * SPEC (2) "R's {namespace constraint} must be an intensional subset - * of B's {namespace constraint} as defined by Wildcard Subset (§3.10.6)." + * of B's {namespace constraint} as defined by Wildcard Subset ($3.10.6)." */ if (xmlSchemaCheckCOSNSSubset((xmlSchemaWildcardPtr) r->children, (xmlSchemaWildcardPtr) b->children)) return (1); /* - * SPEC (3) "Unless B is the content model wildcard of the ·ur-type - * definition·, R's {process contents} must be identical to or stronger + * SPEC (3) "Unless B is the content model wildcard of the `ur-type + * definition`, R's {process contents} must be identical to or stronger * than B's {process contents}, where strict is stronger than lax is * stronger than skip." */ @@ -16940,6 +17050,7 @@ xmlSchemaCheckCOSParticleRestrict(xmlSchemaParserCtxtPtr ctxt, return (0); } +#if 0 /** * xmlSchemaCheckRCaseNSRecurseCheckCardinality: * @ctxt: the schema parser context @@ -16967,12 +17078,12 @@ xmlSchemaCheckRCaseNSRecurseCheckCardinality(xmlSchemaParserCtxtPtr ctxt, if ((r->children == NULL) || (r->children->children == NULL)) return (-1); /* - * SPEC "For a group particle to be a ·valid restriction· of a + * SPEC "For a group particle to be a `valid restriction` of a * wildcard particle..." * - * SPEC (1) "Every member of the {particles} of the group is a ·valid - * restriction· of the wildcard as defined by - * Particle Valid (Restriction) (§3.9.6)." + * SPEC (1) "Every member of the {particles} of the group is a `valid + * restriction` of the wildcard as defined by + * Particle Valid (Restriction) ($3.9.6)." */ part = (xmlSchemaParticlePtr) r->children->children; do { @@ -16983,7 +17094,7 @@ xmlSchemaCheckRCaseNSRecurseCheckCardinality(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (2) "The effective total range of the group [...] is a * valid restriction of B's occurrence range as defined by - * Occurrence Range OK (§3.9.6)." + * Occurrence Range OK ($3.9.6)." */ if (xmlSchemaCheckParticleRangeOK( xmlSchemaGetParticleTotalRangeMin(r), @@ -16992,6 +17103,7 @@ xmlSchemaCheckRCaseNSRecurseCheckCardinality(xmlSchemaParserCtxtPtr ctxt, return (1); return (0); } +#endif /** * xmlSchemaCheckRCaseRecurse: @@ -17022,11 +17134,11 @@ xmlSchemaCheckRCaseRecurse(xmlSchemaParserCtxtPtr ctxt, (r->children->type != b->children->type)) return (-1); /* - * SPEC "For an all or sequence group particle to be a ·valid - * restriction· of another group particle with the same {compositor}..." + * SPEC "For an all or sequence group particle to be a `valid + * restriction` of another group particle with the same {compositor}..." * * SPEC (1) "R's occurrence range is a valid restriction of B's - * occurrence range as defined by Occurrence Range OK (§3.9.6)." + * occurrence range as defined by Occurrence Range OK ($3.9.6)." */ if (xmlSchemaCheckParticleRangeOK(r->minOccurs, r->maxOccurs, b->minOccurs, b->maxOccurs)) @@ -17123,7 +17235,7 @@ xmlSchemaDeriveAndValidateFacets(xmlSchemaParserCtxtPtr pctxt, /* * SPEC st-restrict-facets 1: - * "The {variety} of R is the same as that of B." + * "The {variety} of R is the same as that of B." */ /* * SPEC st-restrict-facets 2: @@ -17277,7 +17389,7 @@ xmlSchemaDeriveAndValidateFacets(xmlSchemaParserCtxtPtr pctxt, flength = bflength; if (flength) { if (! fminlen) - flength = bflength; + fminlen = bfminlen; if (fminlen) { /* (1.1) length >= minLength */ res = xmlSchemaCompareValues(flength->val, fminlen->val); @@ -17595,7 +17707,7 @@ xmlSchemaDeriveAndValidateFacets(xmlSchemaParserCtxtPtr pctxt, * The whitespace must be stronger. */ if (facet->whitespace < bfacet->whitespace) { - FACET_RESTR_ERR(flength, + FACET_RESTR_ERR(facet, "The 'whitespace' value has to be equal to " "or stronger than the 'whitespace' value of " "the base type") @@ -17650,7 +17762,7 @@ xmlSchemaFinishMemberTypeDefinitionsProperty(xmlSchemaParserCtxtPtr pctxt, xmlSchemaTypeLinkPtr link, lastLink, prevLink, subLink, newLink; /* * The actual value is then formed by replacing any union type - * definition in the ·explicit members· with the members of their + * definition in the `explicit members` with the members of their * {member type definitions}, in order. * * TODO: There's a bug entry at @@ -17696,7 +17808,7 @@ xmlSchemaFinishMemberTypeDefinitionsProperty(xmlSchemaParserCtxtPtr pctxt, static void xmlSchemaTypeFixupOptimFacets(xmlSchemaTypePtr type) -{ +{ int has = 0, needVal = 0, normVal = 0; has = (type->baseType->flags & XML_SCHEMAS_TYPE_HAS_FACETS) ? 1 : 0; @@ -17708,7 +17820,7 @@ xmlSchemaTypeFixupOptimFacets(xmlSchemaTypePtr type) } if (type->facets != NULL) { xmlSchemaFacetPtr fac; - + for (fac = type->facets; fac != NULL; fac = fac->next) { switch (fac->type) { case XML_SCHEMA_FACET_WHITESPACE: @@ -17726,7 +17838,7 @@ xmlSchemaTypeFixupOptimFacets(xmlSchemaTypePtr type) has = 1; break; } - } + } } if (normVal) type->flags |= XML_SCHEMAS_TYPE_NORMVALUENEEDED; @@ -17743,24 +17855,24 @@ xmlSchemaTypeFixupOptimFacets(xmlSchemaTypePtr type) if ((prim->builtInType != XML_SCHEMAS_ANYSIMPLETYPE) && (prim->builtInType != XML_SCHEMAS_STRING)) { type->flags |= XML_SCHEMAS_TYPE_FACETSNEEDVALUE; - } - } + } + } } static int xmlSchemaTypeFixupWhitespace(xmlSchemaTypePtr type) { - - + + /* * Evaluate the whitespace-facet value. - */ + */ if (WXS_IS_LIST(type)) { type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE; return (0); } else if (WXS_IS_UNION(type)) return (0); - + if (type->facetSet != NULL) { xmlSchemaFacetLinkPtr lin; @@ -17784,23 +17896,23 @@ xmlSchemaTypeFixupWhitespace(xmlSchemaTypePtr type) } } /* - * For all ·atomic· datatypes other than string (and types ·derived· - * by ·restriction· from it) the value of whiteSpace is fixed to + * For all `atomic` datatypes other than string (and types `derived` + * by `restriction` from it) the value of whiteSpace is fixed to * collapse */ { xmlSchemaTypePtr anc; - for (anc = type->baseType; anc != NULL && + for (anc = type->baseType; anc != NULL && anc->builtInType != XML_SCHEMAS_ANYTYPE; anc = anc->baseType) { if (anc->type == XML_SCHEMA_TYPE_BASIC) { - if (anc->builtInType == XML_SCHEMAS_NORMSTRING) { + if (anc->builtInType == XML_SCHEMAS_NORMSTRING) { type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_REPLACE; } else if ((anc->builtInType == XML_SCHEMAS_STRING) || - (anc->builtInType == XML_SCHEMAS_ANYSIMPLETYPE)) { + (anc->builtInType == XML_SCHEMAS_ANYSIMPLETYPE)) { type->flags |= XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE; } else @@ -17837,7 +17949,7 @@ xmlSchemaFixupSimpleTypeStageOne(xmlSchemaParserCtxtPtr pctxt, } else if (WXS_IS_UNION(type)) { /* * Corresponds to ... - */ + */ if (type->memberTypes == NULL) { /* * This one is really needed, so get out. @@ -17845,8 +17957,8 @@ xmlSchemaFixupSimpleTypeStageOne(xmlSchemaParserCtxtPtr pctxt, PERROR_INT("xmlSchemaFixupSimpleTypeStageOne", "union type has no member-types assigned"); return(-1); - } - } else { + } + } else { /* * Corresponds to ... */ @@ -17961,7 +18073,7 @@ xmlSchemaFixupSimpleTypeStageTwo(xmlSchemaParserCtxtPtr pctxt, } if (WXS_IS_TYPE_NOT_FIXED(type->baseType)) xmlSchemaTypeFixup(type->baseType, ACTXT_CAST pctxt); - /* + /* * If a member type of a union is a union itself, we need to substitute * that member type for its member types. * NOTE that this might change in WXS 1.1; i.e. we will keep the union @@ -17969,12 +18081,12 @@ xmlSchemaFixupSimpleTypeStageTwo(xmlSchemaParserCtxtPtr pctxt, */ if ((type->memberTypes != NULL) && (xmlSchemaFinishMemberTypeDefinitionsProperty(pctxt, type) == -1)) - return(-1); + return(-1); /* - * SPEC src-simple-type 1 + * SPEC src-simple-type 1 * "The corresponding simple type definition, if any, must satisfy * the conditions set out in Constraints on Simple Type Definition - * Schema Components (§3.14.6)." + * Schema Components ($3.14.6)." */ /* * Schema Component Constraint: Simple Type Definition Properties Correct @@ -17982,7 +18094,7 @@ xmlSchemaFixupSimpleTypeStageTwo(xmlSchemaParserCtxtPtr pctxt, */ res = xmlSchemaCheckSTPropsCorrect(pctxt, type); HFAILURE HERROR - /* + /* * Schema Component Constraint: Derivation Valid (Restriction, Simple) * (cos-st-restricts) */ @@ -18015,7 +18127,7 @@ xmlSchemaFixupSimpleTypeStageTwo(xmlSchemaParserCtxtPtr pctxt, */ res = xmlSchemaTypeFixupWhitespace(type); HFAILURE HERROR - xmlSchemaTypeFixupOptimFacets(type); + xmlSchemaTypeFixupOptimFacets(type); exit_error: #ifdef DEBUG_TYPE @@ -18046,7 +18158,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, PERROR_INT("xmlSchemaFixupComplexType", "missing baseType"); goto exit_failure; - } + } /* * Fixup the base type. */ @@ -18058,12 +18170,12 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, * TODO: Generate a warning! */ return(0); - } + } /* * This basically checks if the base type can be derived. */ res = xmlSchemaCheckSRCCT(pctxt, type); - HFAILURE HERROR + HFAILURE HERROR /* * Fixup the content type. */ @@ -18137,7 +18249,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, type->facets = NULL; content->facetSet = type->facetSet; type->facetSet = NULL; - + type->contentTypeDef = content; if (WXS_IS_TYPE_NOT_FIXED(contentBase)) xmlSchemaTypeFixup(contentBase, ACTXT_CAST pctxt); @@ -18146,10 +18258,10 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, * for circularity here. */ res = xmlSchemaFixupSimpleTypeStageOne(pctxt, content); - HFAILURE HERROR + HFAILURE HERROR res = xmlSchemaFixupSimpleTypeStageTwo(pctxt, content); - HFAILURE HERROR - + HFAILURE HERROR + } else if ((WXS_IS_COMPLEX(baseType)) && (baseType->contentType == XML_SCHEMA_CONTENT_MIXED) && (WXS_IS_RESTRICTION(type))) { @@ -18234,7 +18346,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, ( ((xmlSchemaTreeItemPtr) particle->children)->children == NULL))) { if (type->flags & XML_SCHEMAS_TYPE_MIXED) { /* - * SPEC (2.1.4) "If the ·effective mixed· is true, then + * SPEC (2.1.4) "If the `effective mixed` is true, then * a particle whose properties are as follows:..." * * Empty sequence model group with @@ -18259,7 +18371,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, XML_SCHEMA_TYPE_SEQUENCE, type->node); if (particle->children == NULL) goto exit_failure; - + type->subtypes = (xmlSchemaTypePtr) particle; } dummySequence = 1; @@ -18296,7 +18408,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, if (type->contentType == XML_SCHEMA_CONTENT_EMPTY) { /* * SPEC (3.2.1) - * "If the ·effective content· is empty, then the + * "If the `effective content` is empty, then the * {content type} of the [...] base ..." */ type->contentType = baseType->contentType; @@ -18394,8 +18506,8 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, particle->children->children = (xmlSchemaTreeItemPtr) xmlSchemaAddParticle(pctxt, type->node, - ((xmlSchemaParticlePtr) type->subtypes)->minOccurs, - ((xmlSchemaParticlePtr) type->subtypes)->maxOccurs); + ((xmlSchemaParticlePtr) baseType->subtypes)->minOccurs, + ((xmlSchemaParticlePtr) baseType->subtypes)->maxOccurs); if (particle->children->children == NULL) goto exit_failure; particle = (xmlSchemaParticlePtr) @@ -18403,7 +18515,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt, particle->children = ((xmlSchemaParticlePtr) baseType->subtypes)->children; /* - * SPEC "followed by the ·effective content·." + * SPEC "followed by the `effective content`." */ particle->next = effectiveContent; /* @@ -18547,12 +18659,12 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, /* 4.3.5.5 Constraints on enumeration Schema Components * Schema Component Constraint: enumeration valid restriction - * It is an ·error· if any member of {value} is not in the - * ·value space· of {base type definition}. + * It is an `error` if any member of {value} is not in the + * `value space` of {base type definition}. * * minInclusive, maxInclusive, minExclusive, maxExclusive: - * The value ·must· be in the - * ·value space· of the ·base type·. + * The value `must` be in the + * `value space` of the `base type`. */ /* * This function is intended to deliver a compiled value @@ -18572,11 +18684,11 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, } } else base = typeDecl; - + if (! ctxtGiven) { /* * A context is needed if called from RelaxNG. - */ + */ pctxt = xmlSchemaNewParserCtxt("*"); if (pctxt == NULL) return (-1); @@ -18587,17 +18699,17 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, * facet->node is just the node holding the facet * definition, *not* the attribute holding the *value* * of the facet. - */ + */ ret = xmlSchemaVCheckCVCSimpleType( ACTXT_CAST pctxt, facet->node, base, facet->value, &(facet->val), 1, 1, 0); if (ret != 0) { if (ret < 0) { /* No error message for RelaxNG. */ - if (ctxtGiven) { + if (ctxtGiven) { xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_INTERNAL, facet->node, NULL, - "Internal error: xmlSchemaCheckFacet, " + "Internal error: xmlSchemaCheckFacet, " "failed to validate the value '%s' of the " "facet '%s' against the base type", facet->value, xmlSchemaFacetTypeToString(facet->type)); @@ -18672,17 +18784,17 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, /* error code */ xmlSchemaCustomErr4(ACTXT_CAST pctxt, ret, facet->node, WXS_BASIC_CAST typeDecl, - "The value '%s' of the facet '%s' is not a valid '%s'", + "The value '%s' of the facet '%s' is not a valid '%s'", facet->value, xmlSchemaFacetTypeToString(facet->type), - (facet->type != XML_SCHEMA_FACET_TOTALDIGITS) ? + (facet->type != XML_SCHEMA_FACET_TOTALDIGITS) ? BAD_CAST "nonNegativeInteger" : BAD_CAST "positiveInteger", NULL); } } break; - + case XML_SCHEMA_FACET_WHITESPACE:{ if (xmlStrEqual(facet->value, BAD_CAST "preserve")) { facet->whitespace = XML_SCHEMAS_FACET_PRESERVE; @@ -18895,7 +19007,7 @@ xmlSchemaModelGroupToModelGroupDefFixup( { particle = WXS_PTC_CAST particle->next; continue; - } + } if (WXS_MODELGROUPDEF_MODEL(WXS_PARTICLE_TERM(particle)) == NULL) { /* * TODO: Remove the particle. @@ -18945,7 +19057,7 @@ xmlSchemaCheckAttrGroupCircularRecur(xmlSchemaAttributeGroupPtr ctxtGr, if (gr == ctxtGr) return(ref); if (gr->flags & XML_SCHEMAS_ATTRGROUP_MARKED) - continue; + continue; /* * Mark as visited to avoid infinite recursion on * circular references not yet examined. @@ -18955,12 +19067,12 @@ xmlSchemaCheckAttrGroupCircularRecur(xmlSchemaAttributeGroupPtr ctxtGr, { gr->flags |= XML_SCHEMAS_ATTRGROUP_MARKED; circ = xmlSchemaCheckAttrGroupCircularRecur(ctxtGr, - (xmlSchemaItemListPtr) gr->attrUses); + (xmlSchemaItemListPtr) gr->attrUses); gr->flags ^= XML_SCHEMAS_ATTRGROUP_MARKED; if (circ != NULL) return (circ); } - + } } return (NULL); @@ -18987,9 +19099,9 @@ xmlSchemaCheckAttrGroupCircular(xmlSchemaAttributeGroupPtr attrGr, * not be an with ref [attribute] which resolves * to the component corresponding to this . Indirect * circularity is also ruled out. That is, when QName resolution - * (Schema Document) (§3.15.3) is applied to a ·QName· arising from + * (Schema Document) ($3.15.3) is applied to a `QName` arising from * any s with a ref [attribute] among the [children], - * it must not be the case that a ·QName· is encountered at any depth + * it must not be the case that a `QName` is encountered at any depth * which resolves to the component corresponding to this . */ if (attrGr->attrUses == NULL) @@ -18998,9 +19110,9 @@ xmlSchemaCheckAttrGroupCircular(xmlSchemaAttributeGroupPtr attrGr, return(0); else { xmlSchemaQNameRefPtr circ; - + circ = xmlSchemaCheckAttrGroupCircularRecur(attrGr, - (xmlSchemaItemListPtr) attrGr->attrUses); + (xmlSchemaItemListPtr) attrGr->attrUses); if (circ != NULL) { xmlChar *str = NULL; /* @@ -19032,7 +19144,7 @@ xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt, * xmlSchemaExpandAttributeGroupRefs: * @pctxt: the parser context * @node: the node of the component holding the attribute uses - * @completeWild: the intersected wildcard to be returned + * @completeWild: the intersected wildcard to be returned * @list: the attribute uses * * Substitutes contained attribute group references @@ -19061,7 +19173,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, for (i = 0; i < list->nbItems; i++) { use = list->items[i]; - if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) { + if (use->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) { if (prohibs == NULL) { PERROR_INT("xmlSchemaExpandAttributeGroupRefs", "unexpected attr prohibition found"); @@ -19076,7 +19188,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, /* * Note that duplicate prohibitions were already * handled at parsing time. - */ + */ /* * Add to list of prohibitions. */ @@ -19129,7 +19241,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, *completeWild = tmpWild; created = 1; } - + if (xmlSchemaIntersectWildcards(pctxt, *completeWild, gr->attributeWildcard) == -1) return(-1); @@ -19139,7 +19251,8 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, * Just remove the reference if the referenced group does not * contain any attribute uses. */ - if (gr->attrUses == NULL) { + sublist = ((xmlSchemaItemListPtr) gr->attrUses); + if ((sublist == NULL) || sublist->nbItems == 0) { if (xmlSchemaItemListRemove(list, i) == -1) return(-1); i--; @@ -19148,18 +19261,15 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, /* * Add the attribute uses. */ - sublist = ((xmlSchemaItemListPtr) gr->attrUses); - if (sublist->nbItems != 0) { - list->items[i] = sublist->items[0]; - if (sublist->nbItems != 1) { - for (j = 1; j < sublist->nbItems; j++) { - i++; - if (xmlSchemaItemListInsert(list, - sublist->items[j], i) == -1) - return(-1); - } + list->items[i] = sublist->items[0]; + if (sublist->nbItems != 1) { + for (j = 1; j < sublist->nbItems; j++) { + i++; + if (xmlSchemaItemListInsert(list, + sublist->items[j], i) == -1) + return(-1); } - } + } } } @@ -19205,7 +19315,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, /** * xmlSchemaAttributeGroupExpandRefs: * @pctxt: the parser context - * @attrGr: the attribute group definition + * @attrGr: the attribute group definition * * Computation of: * {attribute uses} property @@ -19217,7 +19327,7 @@ xmlSchemaExpandAttributeGroupRefs(xmlSchemaParserCtxtPtr pctxt, static int xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt, xmlSchemaAttributeGroupPtr attrGr) -{ +{ if ((attrGr->attrUses == NULL) || (attrGr->flags & XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED)) return(0); @@ -19225,33 +19335,33 @@ xmlSchemaAttributeGroupExpandRefs(xmlSchemaParserCtxtPtr pctxt, attrGr->flags |= XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED; if (xmlSchemaExpandAttributeGroupRefs(pctxt, WXS_BASIC_CAST attrGr, &(attrGr->attributeWildcard), attrGr->attrUses, NULL) == -1) - return(-1); + return(-1); return(0); } /** * xmlSchemaAttributeGroupExpandRefs: * @pctxt: the parser context - * @attrGr: the attribute group definition + * @attrGr: the attribute group definition * * Substitutes contained attribute group references * for their attribute uses. Wilcards are intersected. - * + * * Schema Component Constraint: - * Attribute Group Definition Properties Correct (ag-props-correct) + * Attribute Group Definition Properties Correct (ag-props-correct) */ static int xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, xmlSchemaAttributeGroupPtr attrGr) -{ +{ /* * SPEC ag-props-correct * (1) "The values of the properties of an attribute group definition * must be as described in the property tableau in The Attribute - * Group Definition Schema Component (§3.6.1), modulo the impact of - * Missing Sub-components (§5.3);" + * Group Definition Schema Component ($3.6.1), modulo the impact of + * Missing Sub-components ($5.3);" */ - + if ((attrGr->attrUses != NULL) && (WXS_LIST_CAST attrGr->attrUses)->nbItems > 1) { @@ -19260,7 +19370,7 @@ xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, int i, j, hasId = 0; for (i = uses->nbItems -1; i >= 0; i--) { - use = uses->items[i]; + use = uses->items[i]; /* * SPEC ag-props-correct * (2) "Two distinct members of the {attribute uses} must not have @@ -19276,7 +19386,7 @@ xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, WXS_ATTRUSE_DECL_TNS(tmp))) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_AG_PROPS_CORRECT, attrGr->node, WXS_BASIC_CAST attrGr, @@ -19300,13 +19410,13 @@ xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * are derived from ID." * TODO: Does 'derived' include member-types of unions? */ - if (WXS_ATTRUSE_TYPEDEF(use) != NULL) { + if (WXS_ATTRUSE_TYPEDEF(use) != NULL) { if (xmlSchemaIsDerivedFromBuiltInType( WXS_ATTRUSE_TYPEDEF(use), XML_SCHEMAS_ID)) - { + { if (hasId) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_AG_PROPS_CORRECT, attrGr->node, WXS_BASIC_CAST attrGr, @@ -19319,7 +19429,7 @@ xmlSchemaCheckAGPropsCorrect(xmlSchemaParserCtxtPtr pctxt, FREE_AND_NULL(str); if (xmlSchemaItemListRemove(uses, i) == -1) return(-1); - } + } hasId = 1; } } @@ -19383,10 +19493,10 @@ xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * SPEC a-props-correct (1) * "The values of the properties of an attribute declaration must * be as described in the property tableau in The Attribute - * Declaration Schema Component (§3.2.1), modulo the impact of - * Missing Sub-components (§5.3)." + * Declaration Schema Component ($3.2.1), modulo the impact of + * Missing Sub-components ($5.3)." */ - + if (WXS_ATTR_TYPEDEF(attr) == NULL) return(0); @@ -19412,9 +19522,9 @@ xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt, /* * SPEC a-props-correct (2) * "if there is a {value constraint}, the canonical lexical - * representation of its value must be ·valid· with respect - * to the {type definition} as defined in String Valid (§3.14.4)." - * TODO: Don't care about the *cononical* stuff here, this requirement + * representation of its value must be `valid` with respect + * to the {type definition} as defined in String Valid ($3.14.4)." + * TODO: Don't care about the *canonical* stuff here, this requirement * will be removed in WXS 1.1 anyway. */ ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST pctxt, @@ -19435,7 +19545,7 @@ xmlSchemaCheckAttrPropsCorrect(xmlSchemaParserCtxtPtr pctxt, return(pctxt->err); } } - + return(0); } @@ -19481,15 +19591,15 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, /* * SPEC (1) "The values of the properties of an element declaration * must be as described in the property tableau in The Element - * Declaration Schema Component (§3.3.1), modulo the impact of Missing - * Sub-components (§5.3)." + * Declaration Schema Component ($3.3.1), modulo the impact of Missing + * Sub-components ($5.3)." */ if (WXS_SUBST_HEAD(elemDecl) != NULL) { xmlSchemaElementPtr head = WXS_SUBST_HEAD(elemDecl), circ; xmlSchemaCheckElementDeclComponent(head, pctxt); /* - * SPEC (3) "If there is a non-·absent· {substitution group + * SPEC (3) "If there is a non-`absent` {substitution group * affiliation}, then {scope} must be global." */ if ((elemDecl->flags & XML_SCHEMAS_ELEM_GLOBAL) == 0) { @@ -19533,9 +19643,9 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, * of the element declaration must be validly derived from the {type * definition} of the {substitution group affiliation}, given the value * of the {substitution group exclusions} of the {substitution group - * affiliation}, as defined in Type Derivation OK (Complex) (§3.4.6) + * affiliation}, as defined in Type Derivation OK (Complex) ($3.4.6) * (if the {type definition} is complex) or as defined in - * Type Derivation OK (Simple) (§3.14.6) (if the {type definition} is + * Type Derivation OK (Simple) ($3.14.6) (if the {type definition} is * simple)." * * NOTE: {substitution group exclusions} means the values of the @@ -19599,9 +19709,9 @@ xmlSchemaCheckElemPropsCorrect(xmlSchemaParserCtxtPtr pctxt, /* * SPEC (2) "If there is a {value constraint}, the canonical lexical - * representation of its value must be ·valid· with respect to the + * representation of its value must be `valid` with respect to the * {type definition} as defined in Element Default Valid (Immediate) - * (§3.3.6)." + * ($3.3.6)." */ if (typeDef == NULL) { xmlSchemaPErr(pctxt, elemDecl->node, @@ -19669,7 +19779,7 @@ xmlSchemaCheckElemSubstGroup(xmlSchemaParserCtxtPtr ctxt, /* * SPEC (2) "It is validly substitutable for HEAD subject to HEAD's * {disallowed substitutions} as the blocking constraint, as defined in - * Substitution Group OK (Transitive) (§3.3.6)." + * Substitution Group OK (Transitive) ($3.3.6)." */ for (head = WXS_SUBST_HEAD(elemDecl); head != NULL; head = WXS_SUBST_HEAD(head)) { @@ -19761,12 +19871,12 @@ add_member: * @ctxtParticle: the first particle of the context component * @searchParticle: the element declaration particle to be analysed * - * Schema Component Constraint: Element Declarations Consistent + * Schema Component Constraint: Element Declarations Consistent */ static int xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, xmlSchemaBasicItemPtr ctxtComponent, - xmlSchemaParticlePtr ctxtParticle, + xmlSchemaParticlePtr ctxtParticle, xmlSchemaParticlePtr searchParticle, xmlSchemaParticlePtr curParticle, int search) @@ -19775,7 +19885,7 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, int ret = 0; xmlSchemaParticlePtr cur = curParticle; - if (curParticle == NULL) { + if (curParticle == NULL) { return(0); } if (WXS_PARTICLE_TERM(curParticle) == NULL) { @@ -19784,7 +19894,7 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, * might arise due to an invalid "term" component. */ return(0); - } + } while (cur != NULL) { switch (WXS_PARTICLE_TERM(cur)->type) { case XML_SCHEMA_TYPE_ANY: @@ -19794,7 +19904,7 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, ret = xmlSchemaCheckElementDeclConsistent(pctxt, ctxtComponent, ctxtParticle, cur, ctxtParticle, 1); if (ret != 0) - return(ret); + return(ret); } else { xmlSchemaElementPtr elem = WXS_ELEM_CAST(WXS_PARTICLE_TERM(cur)); @@ -19802,7 +19912,7 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, * SPEC Element Declarations Consistent: * "If the {particles} contains, either directly, * indirectly (that is, within the {particles} of a - * contained model group, recursively) or ·implicitly· + * contained model group, recursively) or `implicitly` * two or more element declaration particles with * the same {name} and {target namespace}, then * all their type definitions must be the same @@ -19814,7 +19924,7 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, WXS_PARTICLE_TERM_AS_ELEM(searchParticle)->targetNamespace)) { xmlChar *strA = NULL, *strB = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, /* TODO: error code */ XML_SCHEMAP_COS_NONAMBIG, @@ -19831,16 +19941,16 @@ xmlSchemaCheckElementDeclConsistent(xmlSchemaParserCtxtPtr pctxt, FREE_AND_NULL(strB); return(XML_SCHEMAP_COS_NONAMBIG); } - } + } break; - case XML_SCHEMA_TYPE_SEQUENCE: { + case XML_SCHEMA_TYPE_SEQUENCE: { break; } case XML_SCHEMA_TYPE_CHOICE:{ /* xmlSchemaTreeItemPtr sub; - - sub = WXS_PARTICLE_TERM(particle)->children; (xmlSchemaParticlePtr) + + sub = WXS_PARTICLE_TERM(particle)->children; (xmlSchemaParticlePtr) while (sub != NULL) { ret = xmlSchemaCheckElementDeclConsistent(pctxt, ctxtComponent, ctxtParticle, ctxtElem); @@ -19877,7 +19987,7 @@ exit: * @name: the name of the attribute * * Validates the value constraints of an element declaration. - * Adds substitution group members. + * Adds substitution group members. */ static void xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl, @@ -19892,7 +20002,7 @@ xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl, /* * Adds substitution group members. */ - xmlSchemaCheckElemSubstGroup(ctxt, elemDecl); + xmlSchemaCheckElemSubstGroup(ctxt, elemDecl); } } @@ -19922,7 +20032,7 @@ xmlSchemaResolveModelGroupParticleReferences( XML_SCHEMA_EXTRA_QNAMEREF)) { goto next_particle; - } + } ref = WXS_QNAME_CAST WXS_PARTICLE_TERM(particle); /* * Resolve the reference. @@ -19938,7 +20048,7 @@ xmlSchemaResolveModelGroupParticleReferences( ref->targetNamespace, ref->itemType, NULL); /* TODO: remove the particle. */ goto next_particle; - } + } if (refItem->type == XML_SCHEMA_TYPE_GROUP) { if (WXS_MODELGROUPDEF_MODEL(refItem) == NULL) /* TODO: remove the particle. */ @@ -19988,9 +20098,9 @@ next_particle: static int xmlSchemaAreValuesEqual(xmlSchemaValPtr x, - xmlSchemaValPtr y) -{ - xmlSchemaTypePtr tx, ty, ptx, pty; + xmlSchemaValPtr y) +{ + xmlSchemaTypePtr tx, ty, ptx, pty; int ret; while (x != NULL) { @@ -20000,12 +20110,12 @@ xmlSchemaAreValuesEqual(xmlSchemaValPtr x, ptx = xmlSchemaGetPrimitiveType(tx); pty = xmlSchemaGetPrimitiveType(ty); /* - * (1) if a datatype T' is ·derived· by ·restriction· from an - * atomic datatype T then the ·value space· of T' is a subset of - * the ·value space· of T. */ + * (1) if a datatype T' is `derived` by `restriction` from an + * atomic datatype T then the `value space` of T' is a subset of + * the `value space` of T. */ /* - * (2) if datatypes T' and T'' are ·derived· by ·restriction· - * from a common atomic ancestor T then the ·value space·s of T' + * (2) if datatypes T' and T'' are `derived` by `restriction` + * from a common atomic ancestor T then the `value space`s of T' * and T'' may overlap. */ if (ptx != pty) @@ -20036,7 +20146,7 @@ xmlSchemaAreValuesEqual(xmlSchemaValPtr x, if (x != NULL) { y = xmlSchemaValueGetNext(y); if (y == NULL) - return (0); + return (0); } else if (xmlSchemaValueGetNext(y) != NULL) return (0); else @@ -20073,7 +20183,7 @@ xmlSchemaResolveAttrUseReferences(xmlSchemaAttributeUsePtr ause, ref->name, ref->targetNamespace); if (ause->attrDecl == NULL) { xmlSchemaPResCompAttrErr(ctxt, - XML_SCHEMAP_SRC_RESOLVE, + XML_SCHEMAP_SRC_RESOLVE, WXS_BASIC_CAST ause, ause->node, "ref", ref->name, ref->targetNamespace, XML_SCHEMA_TYPE_ATTRIBUTE, NULL); @@ -20086,11 +20196,11 @@ xmlSchemaResolveAttrUseReferences(xmlSchemaAttributeUsePtr ause, /** * xmlSchemaCheckAttrUsePropsCorrect: * @ctxt: a parser context - * @use: an attribute use + * @use: an attribute use * * Schema Component Constraint: * Attribute Use Correct (au-props-correct) - * + * */ static int xmlSchemaCheckAttrUsePropsCorrect(xmlSchemaParserCtxtPtr ctxt, @@ -20100,16 +20210,16 @@ xmlSchemaCheckAttrUsePropsCorrect(xmlSchemaParserCtxtPtr ctxt, return(-1); if ((use->defValue == NULL) || (WXS_ATTRUSE_DECL(use) == NULL) || ((WXS_ATTRUSE_DECL(use))->type != XML_SCHEMA_TYPE_ATTRIBUTE)) - return(0); + return(0); /* * SPEC au-props-correct (1) * "The values of the properties of an attribute use must be as * described in the property tableau in The Attribute Use Schema - * Component (§3.5.1), modulo the impact of Missing - * Sub-components (§5.3)." + * Component ($3.5.1), modulo the impact of Missing + * Sub-components ($5.3)." */ - + if (((WXS_ATTRUSE_DECL(use))->defValue != NULL) && ((WXS_ATTRUSE_DECL(use))->flags & XML_SCHEMAS_ATTR_FIXED) && ((use->flags & XML_SCHEMA_ATTR_USE_FIXED) == 0)) @@ -20129,7 +20239,7 @@ xmlSchemaCheckAttrUsePropsCorrect(xmlSchemaParserCtxtPtr ctxt, if ((use->defVal != NULL) && (WXS_ATTRUSE_TYPEDEF(use) != NULL)) { int ret; /* - * TODO: The spec seems to be missing a check of the + * TODO: The spec seems to be missing a check of the * value constraint of the attribute use. We will do it here. */ /* @@ -20146,7 +20256,7 @@ xmlSchemaCheckAttrUsePropsCorrect(xmlSchemaParserCtxtPtr ctxt, NULL, NULL); return(ctxt->err); } - + ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST ctxt, use->node, WXS_ATTRUSE_TYPEDEF(use), use->defValue, &(use->defVal), @@ -20197,7 +20307,7 @@ xmlSchemaCheckAttrUsePropsCorrect(xmlSchemaParserCtxtPtr ctxt, /** * xmlSchemaResolveAttrTypeReferences: * @item: an attribute declaration - * @ctxt: a parser context + * @ctxt: a parser context * * Resolves the referenced type definition component. */ @@ -20208,8 +20318,8 @@ xmlSchemaResolveAttrTypeReferences(xmlSchemaAttributePtr item, /* * The simple type definition corresponding to the element * information item in the [children], if present, otherwise the simple - * type definition ·resolved· to by the ·actual value· of the type - * [attribute], if present, otherwise the ·simple ur-type definition·. + * type definition `resolved` to by the `actual value` of the type + * [attribute], if present, otherwise the `simple ur-type definition`. */ if (item->flags & XML_SCHEMAS_ATTR_INTERNAL_RESOLVED) return(0); @@ -20288,7 +20398,7 @@ xmlSchemaResolveIDCKeyReferences(xmlSchemaIDCPtr idc, ((xmlSchemaIDCPtr) idc->ref->item)->nbFields) { xmlChar *str = NULL; xmlSchemaIDCPtr refer; - + refer = (xmlSchemaIDCPtr) idc->ref->item; /* * SPEC c-props-correct(2) @@ -20347,7 +20457,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) int wasRedefined; if (redef == NULL) - return(0); + return(0); do { item = redef->item; @@ -20362,7 +20472,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) * d schema. Currenlty we latter approach is used. * SUPPLEMENT: It seems that the WG moves towards the latter * approach, so we are doing it right. - * + * */ prev = xmlSchemaFindRedefCompInGraph( redef->targetBucket, item->type, @@ -20373,11 +20483,11 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) /* * SPEC src-redefine: - * (6.2.1) "The ·actual value· of its own name attribute plus - * target namespace must successfully ·resolve· to a model + * (6.2.1) "The `actual value` of its own name attribute plus + * target namespace must successfully `resolve` to a model * group definition in I." - * (7.2.1) "The ·actual value· of its own name attribute plus - * target namespace must successfully ·resolve· to an attribute + * (7.2.1) "The `actual value` of its own name attribute plus + * target namespace must successfully `resolve` to an attribute * group definition in I." * @@ -20394,7 +20504,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) /* * TODO: error code. * Probably XML_SCHEMAP_SRC_RESOLVE, if this is using the - * reference kind. + * reference kind. */ XML_SCHEMAP_SRC_REDEFINE, node, NULL, "The %s '%s' to be redefined could not be found in " @@ -20402,7 +20512,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) WXS_ITEM_TYPE_NAME(item), xmlSchemaFormatQName(&str, redef->refTargetNs, redef->refName)); - FREE_AND_NULL(str); + FREE_AND_NULL(str); err = pctxt->err; redef = redef->next; continue; @@ -20428,7 +20538,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) * base type of the redefining type. * TODO: How */ - ((xmlSchemaTypePtr) item)->baseType = + ((xmlSchemaTypePtr) item)->baseType = (xmlSchemaTypePtr) prev; break; case XML_SCHEMA_TYPE_GROUP: @@ -20483,7 +20593,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) default: PERROR_INT("xmlSchemaResolveRedefReferences", "Unexpected redefined component type"); - return(-1); + return(-1); } if (wasRedefined) { xmlChar *str = NULL; @@ -20493,7 +20603,7 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) node = WXS_ITEM_NODE(redef->reference); else node = WXS_ITEM_NODE(redef->item); - + xmlSchemaCustomErr(ACTXT_CAST pctxt, /* TODO: error code. */ XML_SCHEMAP_SRC_REDEFINE, @@ -20502,12 +20612,12 @@ xmlSchemaCheckSRCRedefineFirst(xmlSchemaParserCtxtPtr pctxt) "redefinition of the same component is not supported", xmlSchemaGetComponentDesignation(&str, prev), NULL); - FREE_AND_NULL(str) + FREE_AND_NULL(str) err = pctxt->err; redef = redef->next; continue; } - redef = redef->next; + redef = redef->next; } while (redef != NULL); return(err); @@ -20521,7 +20631,7 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) xmlSchemaBasicItemPtr item; if (redef == NULL) - return(0); + return(0); do { if (redef->target == NULL) { @@ -20529,7 +20639,7 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) continue; } item = redef->item; - + switch (item->type) { case XML_SCHEMA_TYPE_SIMPLE: case XML_SCHEMA_TYPE_COMPLEX: @@ -20538,7 +20648,7 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) * type to be 'absent', we'll NULL it. */ (WXS_TYPE_CAST redef->target)->name = NULL; - + /* * TODO: Seems like there's nothing more to do. The normal * inheritance mechanism is used. But not 100% sure. @@ -20550,10 +20660,10 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) * SPEC src-redefine: * (6.2.2) "The {model group} of the model group definition * which corresponds to it per XML Representation of Model - * Group Definition Schema Components (§3.7.2) must be a - * ·valid restriction· of the {model group} of that model + * Group Definition Schema Components ($3.7.2) must be a + * `valid restriction` of the {model group} of that model * group definition in I, as defined in Particle Valid - * (Restriction) (§3.9.6)." + * (Restriction) ($3.9.6)." */ break; case XML_SCHEMA_TYPE_ATTRIBUTEGROUP: @@ -20562,11 +20672,11 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) * (7.2.2) "The {attribute uses} and {attribute wildcard} of * the attribute group definition which corresponds to it * per XML Representation of Attribute Group Definition Schema - * Components (§3.6.2) must be ·valid restrictions· of the + * Components ($3.6.2) must be `valid restrictions` of the * {attribute uses} and {attribute wildcard} of that attribute * group definition in I, as defined in clause 2, clause 3 and * clause 4 of Derivation Valid (Restriction, Complex) - * (§3.4.6) (where references to the base type definition are + * ($3.4.6) (where references to the base type definition are * understood as references to the attribute group definition * in I)." */ @@ -20587,7 +20697,7 @@ xmlSchemaCheckSRCRedefineSecond(xmlSchemaParserCtxtPtr pctxt) } while (redef != NULL); return(0); } - + static int xmlSchemaAddComponents(xmlSchemaParserCtxtPtr pctxt, @@ -20621,8 +20731,8 @@ xmlSchemaAddComponents(xmlSchemaParserCtxtPtr pctxt, return(-1); if (bucket->flags & XML_SCHEMA_BUCKET_COMPS_ADDED) return(0); - bucket->flags |= XML_SCHEMA_BUCKET_COMPS_ADDED; - + bucket->flags |= XML_SCHEMA_BUCKET_COMPS_ADDED; + for (i = 0; i < bucket->globals->nbItems; i++) { item = bucket->globals->items[i]; table = NULL; @@ -20663,12 +20773,12 @@ xmlSchemaAddComponents(xmlSchemaParserCtxtPtr pctxt, case XML_SCHEMA_TYPE_NOTATION: name = ((xmlSchemaNotationPtr) item)->name; WXS_GET_GLOBAL_HASH(bucket, notaDecl) - break; + break; default: PERROR_INT("xmlSchemaAddComponents", "Unexpected global component type"); - continue; - } + continue; + } if (*table == NULL) { *table = xmlHashCreateDict(10, pctxt->dict); if (*table == NULL) { @@ -20676,11 +20786,11 @@ xmlSchemaAddComponents(xmlSchemaParserCtxtPtr pctxt, "failed to create a component hash table"); return(-1); } - } + } err = xmlHashAddEntry(*table, name, item); - if (err != 0) { + if (err != 0) { xmlChar *str = NULL; - + xmlSchemaCustomErr(ACTXT_CAST pctxt, XML_SCHEMAP_REDEFINED_TYPE, WXS_ITEM_NODE(item), @@ -20688,7 +20798,7 @@ xmlSchemaAddComponents(xmlSchemaParserCtxtPtr pctxt, "A global %s '%s' does already exist", WXS_ITEM_TYPE_NAME(item), xmlSchemaGetComponentQName(&str, item)); - FREE_AND_NULL(str); + FREE_AND_NULL(str); } } /* @@ -20722,34 +20832,34 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, if ((con->pending == NULL) || (con->pending->nbItems == 0)) - return(0); + return(0); /* * Since xmlSchemaFixupComplexType() will create new particles * (local components), and those particle components need a bucket * on the constructor, we'll assure here that the constructor has * a bucket. - * TODO: Think about storing locals _only_ on the main bucket. - */ + * TODO: Think about storing locals _only_ on the main bucket. + */ if (con->bucket == NULL) - con->bucket = rootBucket; + con->bucket = rootBucket; /* TODO: * SPEC (src-redefine): * (6.2) "If it has no such self-reference, then all of the * following must be true:" - + * (6.2.2) The {model group} of the model group definition which * corresponds to it per XML Representation of Model Group - * Definition Schema Components (§3.7.2) must be a ·valid - * restriction· of the {model group} of that model group definition - * in I, as defined in Particle Valid (Restriction) (§3.9.6)." + * Definition Schema Components ($3.7.2) must be a `valid + * restriction` of the {model group} of that model group definition + * in I, as defined in Particle Valid (Restriction) ($3.9.6)." */ xmlSchemaCheckSRCRedefineFirst(pctxt); /* * Add global components to the schemata's hash tables. - */ + */ xmlSchemaAddComponents(pctxt, rootBucket); pctxt->ctxtType = NULL; @@ -20759,7 +20869,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, * Now that we have parsed *all* the schema document(s) and converted * them to schema components, we can resolve references, apply component * constraints, create the FSA from the content model, etc. - */ + */ /* * Resolve references of.. * @@ -20780,7 +20890,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, * 6. IDC key-references: * - the referenced IDC 'key' or 'unique' definition * 7. Attribute prohibitions which had a "ref" attribute. - */ + */ for (i = 0; i < nbItems; i++) { item = items[i]; switch (item->type) { @@ -20806,7 +20916,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, FIXHFAILURE; break; case XML_SCHEMA_EXTRA_QNAMEREF: - if ((WXS_QNAME_CAST item)->itemType == + if ((WXS_QNAME_CAST item)->itemType == XML_SCHEMA_TYPE_ATTRIBUTEGROUP) { xmlSchemaResolveAttrGroupReferences( @@ -20843,11 +20953,11 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, } if (pctxt->nberrors != 0) goto exit_error; - + /* * Now that all references are resolved we * can check for circularity of... - * 1. the base axis of type definitions + * 1. the base axis of type definitions * 2. nested model group definitions * 3. nested attribute group definitions * TODO: check for circual substitution groups. @@ -20882,7 +20992,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, break; default: break; - } + } } if (pctxt->nberrors != 0) goto exit_error; @@ -20898,7 +21008,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, item = items[i]; switch (item->type) { case XML_SCHEMA_TYPE_SEQUENCE: - case XML_SCHEMA_TYPE_CHOICE: + case XML_SCHEMA_TYPE_CHOICE: xmlSchemaModelGroupToModelGroupDefFixup(pctxt, WXS_MODEL_GROUP_CAST item); break; @@ -20929,7 +21039,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, } if (pctxt->nberrors != 0) goto exit_error; - /* + /* * First compute the variety of simple types. This is needed as * a seperate step, since otherwise we won't be able to detect * circular union types in all cases. @@ -20959,7 +21069,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, switch (item->type) { case XML_SCHEMA_TYPE_SIMPLE: if (((xmlSchemaTypePtr) item)->memberTypes != NULL) { - xmlSchemaCheckUnionTypeDefCircular(pctxt, + xmlSchemaCheckUnionTypeDefCircular(pctxt, (xmlSchemaTypePtr) item); FIXHFAILURE; } @@ -20970,7 +21080,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, } if (pctxt->nberrors != 0) goto exit_error; - + /* * Do the complete type fixup for simple types. */ @@ -20998,10 +21108,10 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, for (i = 0; i < nbItems; i++) { item = items[i]; switch (item->type) { - case XML_SCHEMA_TYPE_ATTRIBUTE: + case XML_SCHEMA_TYPE_ATTRIBUTE: xmlSchemaCheckAttrPropsCorrect(pctxt, WXS_ATTR_CAST item); FIXHFAILURE; - break; + break; default: break; } @@ -21010,7 +21120,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, goto exit_error; /* * Apply constraints for attribute uses. - */ + */ for (i = 0; i < nbItems; i++) { item = items[i]; switch (item->type) { @@ -21057,7 +21167,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, if (pctxt->nberrors != 0) goto exit_error; - /* + /* * Complex types are builded and checked. */ for (i = 0; i < nbItems; i++) { @@ -21081,8 +21191,8 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, * will create particles and model groups in some cases. */ items = (xmlSchemaTreeItemPtr *) con->pending->items; - nbItems = con->pending->nbItems; - + nbItems = con->pending->nbItems; + /* * Apply some constraints for element declarations. */ @@ -21091,7 +21201,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, switch (item->type) { case XML_SCHEMA_TYPE_ELEMENT: elemDecl = (xmlSchemaElementPtr) item; - + if ((elemDecl->flags & XML_SCHEMAS_ELEM_INTERNAL_CHECKED) == 0) { xmlSchemaCheckElementDeclComponent( @@ -21121,7 +21231,7 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, } if (pctxt->nberrors != 0) goto exit_error; - + /* * Finally we can build the automaton from the content model of * complex types. @@ -21142,10 +21252,10 @@ xmlSchemaFixupComponents(xmlSchemaParserCtxtPtr pctxt, goto exit_error; /* * URGENT TODO: cos-element-consistent - */ - goto exit; + */ + goto exit; -exit_error: +exit_error: ret = pctxt->err; goto exit; @@ -21159,12 +21269,12 @@ exit: * if not cleared here. */ con->bucket = oldbucket; - con->pending->nbItems = 0; + con->pending->nbItems = 0; if (con->substGroups != NULL) { xmlHashFree(con->substGroups, (xmlHashDeallocator) xmlSchemaSubstGroupFree); con->substGroups = NULL; - } + } if (con->redefs != NULL) { xmlSchemaRedefListFree(con->redefs); con->redefs = NULL; @@ -21227,11 +21337,11 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt) if (res == -1) goto exit_failure; if (res != 0) - goto exit; + goto exit; if (bucket == NULL) { /* TODO: Error code, actually we failed to *locate* the schema. */ - if (ctxt->URL) + if (ctxt->URL) xmlSchemaCustomErr(ACTXT_CAST ctxt, XML_SCHEMAP_FAILED_LOAD, NULL, NULL, "Failed to locate the main schema resource at '%s'", @@ -21242,16 +21352,16 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt) "Failed to locate the main schema resource", NULL, NULL); goto exit; - } + } /* Then do the parsing for good. */ if (xmlSchemaParseNewDocWithContext(ctxt, mainSchema, bucket) == -1) goto exit_failure; if (ctxt->nberrors != 0) goto exit; - + mainSchema->doc = bucket->doc; mainSchema->preserve = ctxt->preserve; - + ctxt->schema = mainSchema; if (xmlSchemaFixupComponents(ctxt, WXS_CONSTRUCTOR(ctxt)->mainBucket) == -1) @@ -21261,8 +21371,8 @@ xmlSchemaParse(xmlSchemaParserCtxtPtr ctxt) * TODO: This is not nice, since we cannot distinguish from the * result if there was an internal error or not. */ -exit: - if (ctxt->nberrors != 0) { +exit: + if (ctxt->nberrors != 0) { if (mainSchema) { xmlSchemaFree(mainSchema); mainSchema = NULL; @@ -21276,7 +21386,7 @@ exit: ctxt->schema = NULL; return(mainSchema); exit_failure: - /* + /* * Quite verbose, but should catch internal errors, which were * not communitated. */ @@ -21290,7 +21400,7 @@ exit_failure: ctxt->ownsConstructor = 0; } PERROR_INT2("xmlSchemaParse", - "An internal error occured"); + "An internal error occured"); ctxt->schema = NULL; return(NULL); } @@ -21427,8 +21537,8 @@ xmlSchemaGetWhiteSpaceFacetValue(xmlSchemaTypePtr type) return(XML_SCHEMA_WHITESPACE_REPLACE); else { /* - * For all ·atomic· datatypes other than string (and types ·derived· - * by ·restriction· from it) the value of whiteSpace is fixed to + * For all `atomic` datatypes other than string (and types `derived` + * by `restriction` from it) the value of whiteSpace is fixed to * collapse * Note that this includes built-in list datatypes. */ @@ -21453,16 +21563,16 @@ xmlSchemaGetWhiteSpaceFacetValue(xmlSchemaTypePtr type) } /************************************************************************ - * * - * Simple type validation * - * * + * * + * Simple type validation * + * * ************************************************************************/ /************************************************************************ - * * - * DOM Validation code * - * * + * * + * DOM Validation code * + * * ************************************************************************/ /** @@ -21515,11 +21625,11 @@ xmlSchemaAssembleByLocation(xmlSchemaValidCtxtPtr vctxt, * XML_SCHEMA_SCHEMA_MAIN if it is the first schema document. */ ret = xmlSchemaAddSchemaDoc(pctxt, XML_SCHEMA_SCHEMA_IMPORT, - location, NULL, NULL, 0, node, NULL, nsName, + location, NULL, NULL, 0, node, NULL, nsName, &bucket); if (ret != 0) - return(ret); - if (bucket == NULL) { + return(ret); + if (bucket == NULL) { /* * Generate a warning that the document could not be located. */ @@ -21549,17 +21659,17 @@ xmlSchemaAssembleByLocation(xmlSchemaValidCtxtPtr vctxt, pctxt->nberrors = 0; pctxt->err = 0; pctxt->doc = bucket->doc; - - ret = xmlSchemaParseNewDocWithContext(pctxt, schema, bucket); + + ret = xmlSchemaParseNewDocWithContext(pctxt, schema, bucket); if (ret == -1) { pctxt->doc = NULL; goto exit_failure; } /* Paranoid error channelling. */ if ((ret == 0) && (pctxt->nberrors != 0)) - ret = pctxt->err; - if (pctxt->nberrors == 0) { - /* + ret = pctxt->err; + if (pctxt->nberrors == 0) { + /* * Only bother to fixup pending components, if there was * no error yet. * For every XSI acquired schema (and its sub-schemata) we will @@ -21575,7 +21685,7 @@ xmlSchemaAssembleByLocation(xmlSchemaValidCtxtPtr vctxt, vctxt->err = ret; vctxt->nberrors += pctxt->nberrors; } else { - /* Add to validation error sum. */ + /* Add to validation error sum. */ vctxt->nberrors += pctxt->nberrors; } pctxt->doc = NULL; @@ -21586,7 +21696,7 @@ exit_failure: } static xmlSchemaAttrInfoPtr -xmlSchemaGetMetaAttrInfo(xmlSchemaValidCtxtPtr vctxt, +xmlSchemaGetMetaAttrInfo(xmlSchemaValidCtxtPtr vctxt, int metaType) { if (vctxt->nbAttrInfos == 0) @@ -21676,7 +21786,7 @@ xmlSchemaAssembleByXSI(xmlSchemaValidCtxtPtr vctxt) /* * If using @schemaLocation then tuples are expected. * I.e. the namespace name *and* the document's URI. - */ + */ xmlSchemaCustomWarning(ACTXT_CAST vctxt, XML_SCHEMAV_MISC, iattr->node, NULL, "The value must consist of tuples: the target namespace " @@ -21705,7 +21815,7 @@ xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt, if (vctxt->sax != NULL) { int i, j; xmlSchemaNodeInfoPtr inode; - + for (i = vctxt->depth; i >= 0; i--) { if (vctxt->elemInfos[i]->nbNsBindings != 0) { inode = vctxt->elemInfos[i]; @@ -21719,16 +21829,16 @@ xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt, * Note that the namespace bindings are already * in a string dict. */ - return (inode->nsBindings[j+1]); + return (inode->nsBindings[j+1]); } } } } return (NULL); -#ifdef LIBXML_WRITER_ENABLED +#ifdef LIBXML_READER_ENABLED } else if (vctxt->reader != NULL) { xmlChar *nsName; - + nsName = xmlTextReaderLookupNamespace(vctxt->reader, prefix); if (nsName != NULL) { const xmlChar *ret; @@ -21760,7 +21870,7 @@ xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt, * This one works on the schema of the validation context. */ static int -xmlSchemaValidateNotation(xmlSchemaValidCtxtPtr vctxt, +xmlSchemaValidateNotation(xmlSchemaValidCtxtPtr vctxt, xmlSchemaPtr schema, xmlNodePtr node, const xmlChar *value, @@ -21785,7 +21895,7 @@ xmlSchemaValidateNotation(xmlSchemaValidCtxtPtr vctxt, if (prefix != NULL) { const xmlChar *nsName = NULL; - if (vctxt != NULL) + if (vctxt != NULL) nsName = xmlSchemaLookupNamespace(vctxt, BAD_CAST prefix); else if (node != NULL) { xmlNsPtr ns = xmlSearchNs(node->doc, node, prefix); @@ -21802,9 +21912,9 @@ xmlSchemaValidateNotation(xmlSchemaValidCtxtPtr vctxt, return (1); } if (xmlSchemaGetNotation(schema, localName, nsName) != NULL) { - if (valNeeded && (val != NULL)) { - (*val) = xmlSchemaNewNOTATIONValue(BAD_CAST localName, - BAD_CAST xmlStrdup(nsName)); + if ((valNeeded) && (val != NULL)) { + (*val) = xmlSchemaNewNOTATIONValue(xmlStrdup(localName), + xmlStrdup(nsName)); if (*val == NULL) ret = -1; } @@ -21856,9 +21966,9 @@ xmlSchemaVAddNodeQName(xmlSchemaValidCtxtPtr vctxt, } /************************************************************************ - * * + * * * Validation of identity-constraints (IDC) * - * * + * * ************************************************************************/ /** @@ -21899,6 +22009,20 @@ xmlSchemaAugmentIDC(xmlSchemaIDCPtr idcDef, vctxt->hasKeyrefs = 1; } +/** + * xmlSchemaAugmentImportedIDC: + * @imported: the imported schema + * + * Creates an augmented IDC definition for the imported schema. + */ +static void +xmlSchemaAugmentImportedIDC(xmlSchemaImportPtr imported, xmlSchemaValidCtxtPtr vctxt) { + if (imported->schema->idcDef != NULL) { + xmlHashScan(imported->schema->idcDef , + (xmlHashScanner) xmlSchemaAugmentIDC, vctxt); + } +} + /** * xmlSchemaIDCNewBinding: * @idcDef: the IDC definition of this binding @@ -22123,7 +22247,7 @@ xmlSchemaIDCFreeBinding(xmlSchemaPSVIIDCBindingPtr bind) if (bind->nodeTable != NULL) xmlFree(bind->nodeTable); if (bind->dupls != NULL) - xmlSchemaItemListFree(bind->dupls); + xmlSchemaItemListFree(bind->dupls); xmlFree(bind); } @@ -22158,12 +22282,12 @@ xmlSchemaIDCFreeMatcherList(xmlSchemaIDCMatcherPtr matcher) while (matcher != NULL) { next = matcher->next; - if (matcher->keySeqs != NULL) { + if (matcher->keySeqs != NULL) { int i; for (i = 0; i < matcher->sizeKeySeqs; i++) if (matcher->keySeqs[i] != NULL) xmlFree(matcher->keySeqs[i]); - xmlFree(matcher->keySeqs); + xmlFree(matcher->keySeqs); } if (matcher->targets != NULL) { if (matcher->idcType == XML_SCHEMA_TYPE_IDC_KEYREF) { @@ -22203,7 +22327,7 @@ xmlSchemaIDCReleaseMatcherList(xmlSchemaValidCtxtPtr vctxt, while (matcher != NULL) { next = matcher->next; - if (matcher->keySeqs != NULL) { + if (matcher->keySeqs != NULL) { int i; /* * Don't free the array, but only the content. @@ -22232,7 +22356,7 @@ xmlSchemaIDCReleaseMatcherList(xmlSchemaValidCtxtPtr vctxt, } xmlSchemaItemListFree(matcher->targets); matcher->targets = NULL; - } + } matcher->next = NULL; /* * Cache the matcher. @@ -22274,7 +22398,7 @@ xmlSchemaIDCAddStateObject(xmlSchemaValidCtxtPtr vctxt, sto = vctxt->xpathStatePool; vctxt->xpathStatePool = sto->next; sto->next = NULL; - } else { + } else { /* * Create a new state object. */ @@ -22285,10 +22409,10 @@ xmlSchemaIDCAddStateObject(xmlSchemaValidCtxtPtr vctxt, return (-1); } memset(sto, 0, sizeof(xmlSchemaIDCStateObj)); - } + } /* - * Add to global list. - */ + * Add to global list. + */ if (vctxt->xpathStates != NULL) sto->next = vctxt->xpathStates; vctxt->xpathStates = sto; @@ -22308,13 +22432,13 @@ xmlSchemaIDCAddStateObject(xmlSchemaValidCtxtPtr vctxt, VERROR_INT("xmlSchemaIDCAddStateObject", "failed to create an XPath validation context"); return (-1); - } + } sto->type = type; sto->depth = vctxt->depth; sto->matcher = matcher; sto->sel = sel; sto->nbHistory = 0; - + #ifdef DEBUG_IDC xmlGenericError(xmlGenericErrorContext, "IDC: STO push '%s'\n", sto->sel->xpath); @@ -22338,7 +22462,7 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, { xmlSchemaIDCStateObjPtr sto, head = NULL, first; int res, resolved = 0, depth = vctxt->depth; - + if (vctxt->xpathStates == NULL) return (0); @@ -22347,8 +22471,8 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, #ifdef DEBUG_IDC { xmlChar *str = NULL; - xmlGenericError(xmlGenericErrorContext, - "IDC: EVAL on %s, depth %d, type %d\n", + xmlGenericError(xmlGenericErrorContext, + "IDC: EVAL on %s, depth %d, type %d\n", xmlSchemaFormatQName(&str, vctxt->inode->nsName, vctxt->inode->localName), depth, nodeType); FREE_AND_NULL(str) @@ -22362,10 +22486,10 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, while (sto != head) { #ifdef DEBUG_IDC if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) - xmlGenericError(xmlGenericErrorContext, "IDC: ['%s'] selector '%s'\n", + xmlGenericError(xmlGenericErrorContext, "IDC: ['%s'] selector '%s'\n", sto->matcher->aidc->def->name, sto->sel->xpath); else - xmlGenericError(xmlGenericErrorContext, "IDC: ['%s'] field '%s'\n", + xmlGenericError(xmlGenericErrorContext, "IDC: ['%s'] field '%s'\n", sto->matcher->aidc->def->name, sto->sel->xpath); #endif if (nodeType == XML_ELEMENT_NODE) @@ -22395,7 +22519,7 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, if (sto->history == NULL) { sto->history = (int *) xmlMalloc(5 * sizeof(int)); if (sto->history == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "allocating the state object history", NULL); return(-1); } @@ -22405,11 +22529,11 @@ xmlSchemaXPathEvaluate(xmlSchemaValidCtxtPtr vctxt, sto->history = (int *) xmlRealloc(sto->history, sto->sizeHistory * sizeof(int)); if (sto->history == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "re-allocating the state object history", NULL); return(-1); } - } + } sto->history[sto->nbHistory++] = depth; #ifdef DEBUG_IDC @@ -22478,7 +22602,7 @@ xmlSchemaFormatIDCKeySequence(xmlSchemaValidCtxtPtr vctxt, *buf = xmlStrdup(BAD_CAST "["); for (i = 0; i < count; i++) { *buf = xmlStrcat(*buf, BAD_CAST "'"); - res = xmlSchemaGetCanonValueWhtspExt(seq[i]->val, + res = xmlSchemaGetCanonValueWhtspExt(seq[i]->val, xmlSchemaGetWhiteSpaceFacetValue(seq[i]->type), &value); if (res == 0) @@ -22536,7 +22660,7 @@ xmlSchemaXPathPop(xmlSchemaValidCtxtPtr vctxt) * * Processes and pops the history items of the IDC state objects. * IDC key-sequences are validated/created on IDC bindings. - * + * * Returns 0 on success and -1 on internal errors. */ static int @@ -22555,13 +22679,13 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, #ifdef DEBUG_IDC { xmlChar *str = NULL; - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "IDC: BACK on %s, depth %d\n", xmlSchemaFormatQName(&str, vctxt->inode->nsName, vctxt->inode->localName), vctxt->depth); FREE_AND_NULL(str) } -#endif +#endif /* * Evaluate the state objects. */ @@ -22587,14 +22711,14 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, if (matchDepth != depth) { sto = sto->next; continue; - } + } if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_FIELD) { /* * NOTE: According to * http://www.w3.org/Bugs/Public/show_bug.cgi?id=2198 * ... the simple-content of complex types is also allowed. */ - + if (WXS_IS_COMPLEX(type)) { if (WXS_HAS_SIMPLE_CONTENT(type)) { /* @@ -22609,17 +22733,17 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, } } else simpleType = NULL; - } else + } else simpleType = type; if (simpleType == NULL) { xmlChar *str = NULL; - + /* * Not qualified if the field resolves to a node of non * simple type. - */ + */ xmlSchemaCustomErr(ACTXT_CAST vctxt, - XML_SCHEMAV_CVC_IDC, NULL, + XML_SCHEMAV_CVC_IDC, NULL, WXS_BASIC_CAST sto->matcher->aidc->def, "The XPath '%s' of a field of %s does evaluate to a node of " "non-simple type", @@ -22629,7 +22753,7 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, sto->nbHistory--; goto deregister_check; } - + if ((key == NULL) && (vctxt->inode->val == NULL)) { /* * Failed to provide the normalized value; maybe @@ -22645,13 +22769,13 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, xmlSchemaIDCMatcherPtr matcher = sto->matcher; xmlSchemaPSVIIDCKeyPtr *keySeq; int pos, idx; - + /* * The key will be anchored on the matcher's list of * key-sequences. The position in this list is determined * by the target node's depth relative to the matcher's * depth of creation (i.e. the depth of the scope element). - * + * * Element Depth Pos List-entries * 0 NULL * 1 NULL @@ -22662,23 +22786,23 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, * The size of the list is only dependant on the depth of * the tree. * An entry will be NULLed in selector_leave, i.e. when - * we hit the target's - */ + * we hit the target's + */ pos = sto->depth - matcher->depth; idx = sto->sel->index; - + /* * Create/grow the array of key-sequences. */ if (matcher->keySeqs == NULL) { - if (pos > 9) + if (pos > 9) matcher->sizeKeySeqs = pos * 2; else matcher->sizeKeySeqs = 10; - matcher->keySeqs = (xmlSchemaPSVIIDCKeyPtr **) + matcher->keySeqs = (xmlSchemaPSVIIDCKeyPtr **) xmlMalloc(matcher->sizeKeySeqs * - sizeof(xmlSchemaPSVIIDCKeyPtr *)); - if (matcher->keySeqs == NULL) { + sizeof(xmlSchemaPSVIIDCKeyPtr *)); + if (matcher->keySeqs == NULL) { xmlSchemaVErrMemory(NULL, "allocating an array of key-sequences", NULL); @@ -22687,9 +22811,9 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, memset(matcher->keySeqs, 0, matcher->sizeKeySeqs * sizeof(xmlSchemaPSVIIDCKeyPtr *)); - } else if (pos >= matcher->sizeKeySeqs) { + } else if (pos >= matcher->sizeKeySeqs) { int i = matcher->sizeKeySeqs; - + matcher->sizeKeySeqs *= 2; matcher->keySeqs = (xmlSchemaPSVIIDCKeyPtr **) xmlRealloc(matcher->keySeqs, @@ -22705,29 +22829,29 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, * The array needs to be NULLed. * TODO: Use memset? */ - for (; i < matcher->sizeKeySeqs; i++) - matcher->keySeqs[i] = NULL; + for (; i < matcher->sizeKeySeqs; i++) + matcher->keySeqs[i] = NULL; } - + /* * Get/create the key-sequence. */ - keySeq = matcher->keySeqs[pos]; - if (keySeq == NULL) { + keySeq = matcher->keySeqs[pos]; + if (keySeq == NULL) { goto create_sequence; } else if (keySeq[idx] != NULL) { xmlChar *str = NULL; /* * cvc-identity-constraint: - * 3 For each node in the ·target node set· all + * 3 For each node in the `target node set` all * of the {fields}, with that node as the context * node, evaluate to either an empty node-set or * a node-set with exactly one member, which must * have a simple type. - * + * * The key was already set; report an error. */ - xmlSchemaCustomErr(ACTXT_CAST vctxt, + xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_IDC, NULL, WXS_BASIC_CAST matcher->aidc->def, "The XPath '%s' of a field of %s evaluates to a " @@ -22738,27 +22862,27 @@ xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt, sto->nbHistory--; goto deregister_check; } else - goto create_key; - + goto create_key; + create_sequence: /* * Create a key-sequence. */ keySeq = (xmlSchemaPSVIIDCKeyPtr *) xmlMalloc( - matcher->aidc->def->nbFields * + matcher->aidc->def->nbFields * sizeof(xmlSchemaPSVIIDCKeyPtr)); if (keySeq == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "allocating an IDC key-sequence", NULL); - return(-1); - } - memset(keySeq, 0, matcher->aidc->def->nbFields * + return(-1); + } + memset(keySeq, 0, matcher->aidc->def->nbFields * sizeof(xmlSchemaPSVIIDCKeyPtr)); matcher->keySeqs[pos] = keySeq; create_key: /* * Create a key once per node only. - */ + */ if (key == NULL) { key = (xmlSchemaPSVIIDCKeyPtr) xmlMalloc( sizeof(xmlSchemaPSVIIDCKey)); @@ -22767,7 +22891,7 @@ create_key: "allocating a IDC key", NULL); xmlFree(keySeq); matcher->keySeqs[pos] = NULL; - return(-1); + return(-1); } /* * Consume the compiled value. @@ -22783,10 +22907,10 @@ create_key: return (-1); } } - keySeq[idx] = key; + keySeq[idx] = key; } } else if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) { - + xmlSchemaPSVIIDCKeyPtr **keySeq = NULL; /* xmlSchemaPSVIIDCBindingPtr bind; */ xmlSchemaPSVIIDCNodePtr ntItem; @@ -22797,22 +22921,22 @@ create_key: /* * Here we have the following scenario: * An IDC 'selector' state object resolved to a target node, - * during the time this target node was in the - * ancestor-or-self axis, the 'field' state object(s) looked - * out for matching nodes to create a key-sequence for this + * during the time this target node was in the + * ancestor-or-self axis, the 'field' state object(s) looked + * out for matching nodes to create a key-sequence for this * target node. Now we are back to this target node and need - * to put the key-sequence, together with the target node - * itself, into the node-table of the corresponding IDC + * to put the key-sequence, together with the target node + * itself, into the node-table of the corresponding IDC * binding. */ matcher = sto->matcher; idc = matcher->aidc->def; nbKeys = idc->nbFields; - pos = depth - matcher->depth; + pos = depth - matcher->depth; /* * Check if the matcher has any key-sequences at all, plus * if it has a key-sequence for the current target node. - */ + */ if ((matcher->keySeqs == NULL) || (matcher->sizeKeySeqs <= pos)) { if (idc->type == XML_SCHEMA_TYPE_IDC_KEY) @@ -22820,15 +22944,15 @@ create_key: else goto selector_leave; } - - keySeq = &(matcher->keySeqs[pos]); + + keySeq = &(matcher->keySeqs[pos]); if (*keySeq == NULL) { if (idc->type == XML_SCHEMA_TYPE_IDC_KEY) goto selector_key_error; else goto selector_leave; } - + for (i = 0; i < nbKeys; i++) { if ((*keySeq)[i] == NULL) { /* @@ -22839,18 +22963,18 @@ create_key: * All fields of a "key" IDC must resolve. */ goto selector_key_error; - } + } goto selector_leave; } } /* * All fields did resolve. */ - + /* * 4.1 If the {identity-constraint category} is unique(/key), - * then no two members of the ·qualified node set· have - * ·key-sequences· whose members are pairwise equal, as + * then no two members of the `qualified node set` have + * `key-sequences` whose members are pairwise equal, as * defined by Equal in [XML Schemas: Datatypes]. * * Get the IDC binding from the matcher and check for @@ -22860,10 +22984,10 @@ create_key: bind = xmlSchemaIDCAcquireBinding(vctxt, matcher); #endif targets = xmlSchemaIDCAcquireTargetList(vctxt, matcher); - if ((idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) && + if ((idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) && (targets->nbItems != 0)) { xmlSchemaPSVIIDCKeyPtr ckey, bkey, *bkeySeq; - + i = 0; res = 0; /* @@ -22874,7 +22998,7 @@ create_key: ((xmlSchemaPSVIIDCNodePtr) targets->items[i])->keys; for (j = 0; j < nbKeys; j++) { ckey = (*keySeq)[j]; - bkey = bkeySeq[j]; + bkey = bkeySeq[j]; res = xmlSchemaAreValuesEqual(ckey->val, bkey->val); if (res == -1) { return (-1); @@ -22896,10 +23020,10 @@ create_key: } while (i < targets->nbItems); if (i != targets->nbItems) { xmlChar *str = NULL, *strB = NULL; - /* + /* * TODO: Try to report the key-sequence. */ - xmlSchemaCustomErr(ACTXT_CAST vctxt, + xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_IDC, NULL, WXS_BASIC_CAST idc, "Duplicate key-sequence %s in %s", @@ -22917,15 +23041,15 @@ create_key: ntItem = (xmlSchemaPSVIIDCNodePtr) xmlMalloc( sizeof(xmlSchemaPSVIIDCNode)); if (ntItem == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "allocating an IDC node-table item", NULL); xmlFree(*keySeq); *keySeq = NULL; return(-1); - } + } memset(ntItem, 0, sizeof(xmlSchemaPSVIIDCNode)); - - /* + + /* * Store the node-table item in a global list. */ if (idc->type != XML_SCHEMA_TYPE_IDC_KEYREF) { @@ -22947,7 +23071,7 @@ create_key: xmlFree(ntItem); xmlFree(*keySeq); *keySeq = NULL; - return (-1); + return (-1); } } /* @@ -22959,11 +23083,11 @@ create_key: ntItem->keys = *keySeq; *keySeq = NULL; #if 0 - if (xmlSchemaIDCAppendNodeTableItem(bind, ntItem) == -1) { + if (xmlSchemaIDCAppendNodeTableItem(bind, ntItem) == -1) #endif if (xmlSchemaItemListAdd(targets, ntItem) == -1) { if (idc->type == XML_SCHEMA_TYPE_IDC_KEYREF) { - /* + /* * Free the item, since keyref items won't be * put on a global list. */ @@ -22972,18 +23096,18 @@ create_key: } return (-1); } - + goto selector_leave; selector_key_error: { xmlChar *str = NULL; /* - * 4.2.1 (KEY) The ·target node set· and the - * ·qualified node set· are equal, that is, every - * member of the ·target node set· is also a member - * of the ·qualified node set· and vice versa. + * 4.2.1 (KEY) The `target node set` and the + * `qualified node set` are equal, that is, every + * member of the `target node set` is also a member + * of the `qualified node set` and vice versa. */ - xmlSchemaCustomErr(ACTXT_CAST vctxt, + xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_IDC, NULL, WXS_BASIC_CAST idc, "Not all fields of %s evaluate to a node", @@ -22999,7 +23123,7 @@ selector_leave: *keySeq = NULL; } } /* if selector */ - + sto->nbHistory--; deregister_check: @@ -23050,15 +23174,15 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, xmlSchemaIDCMatcherPtr matcher, last = NULL; xmlSchemaIDCPtr idc, refIdc; xmlSchemaIDCAugPtr aidc; - + idc = (xmlSchemaIDCPtr) elemDecl->idcs; if (idc == NULL) return (0); - + #ifdef DEBUG_IDC { xmlChar *str = NULL; - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "IDC: REGISTER on %s, depth %d\n", (char *) xmlSchemaFormatQName(&str, vctxt->inode->nsName, vctxt->inode->localName), vctxt->depth); @@ -23099,7 +23223,7 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, "Could not find an augmented IDC item for an IDC " "definition"); return (-1); - } + } if ((aidc->keyrefDepth == -1) || (vctxt->depth < aidc->keyrefDepth)) aidc->keyrefDepth = vctxt->depth; @@ -23130,10 +23254,10 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, vctxt->idcMatcherCache = matcher->nextCached; matcher->nextCached = NULL; } else { - matcher = (xmlSchemaIDCMatcherPtr) + matcher = (xmlSchemaIDCMatcherPtr) xmlMalloc(sizeof(xmlSchemaIDCMatcher)); if (matcher == NULL) { - xmlSchemaVErrMemory(vctxt, + xmlSchemaVErrMemory(vctxt, "allocating an IDC matcher", NULL); return (-1); } @@ -23146,16 +23270,16 @@ xmlSchemaIDCRegisterMatchers(xmlSchemaValidCtxtPtr vctxt, last = matcher; matcher->type = IDC_MATCHER; - matcher->depth = vctxt->depth; + matcher->depth = vctxt->depth; matcher->aidc = aidc; matcher->idcType = aidc->def->type; -#ifdef DEBUG_IDC +#ifdef DEBUG_IDC xmlGenericError(xmlGenericErrorContext, "IDC: register matcher\n"); -#endif +#endif /* - * Init the automaton state object. + * Init the automaton state object. */ - if (xmlSchemaIDCAddStateObject(vctxt, matcher, + if (xmlSchemaIDCAddStateObject(vctxt, matcher, idc->selector, XPATH_STATE_OBJ_TYPE_IDC_SELECTOR) == -1) return (-1); @@ -23172,7 +23296,7 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, int res, i, j, k, nbTargets, nbFields, nbDupls, nbNodeTable; xmlSchemaPSVIIDCKeyPtr *keys, *ntkeys; xmlSchemaPSVIIDCNodePtr *targets, *dupls; - + xmlSchemaIDCMatcherPtr matcher = ielem->idcMatchers; /* vctxt->createIDCNodeTables */ while (matcher != NULL) { @@ -23206,7 +23330,7 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, nbDupls = bind->dupls->nbItems; } else { dupls = NULL; - nbDupls = 0; + nbDupls = 0; } if (bind->nodeTable != NULL) { nbNodeTable = bind->nbNodes; @@ -23219,29 +23343,29 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, * Transfer all IDC target-nodes to the IDC node-table. */ bind->nodeTable = - (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; + (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; bind->sizeNodes = matcher->targets->sizeItems; bind->nbNodes = matcher->targets->nbItems; matcher->targets->items = NULL; matcher->targets->sizeItems = 0; - matcher->targets->nbItems = 0; + matcher->targets->nbItems = 0; } else { /* * Compare the key-sequences and add to the IDC node-table. */ nbTargets = matcher->targets->nbItems; - targets = (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; + targets = (xmlSchemaPSVIIDCNodePtr *) matcher->targets->items; nbFields = matcher->aidc->def->nbFields; i = 0; do { keys = targets[i]->keys; - if (nbDupls) { + if (nbDupls) { /* * Search in already found duplicates first. */ j = 0; - do { + do { if (nbFields == 1) { res = xmlSchemaAreValuesEqual(keys[0]->val, dupls[j]->keys[0]->val); @@ -23276,11 +23400,11 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, } } j++; - } while (j < nbDupls); + } while (j < nbDupls); } if (nbNodeTable) { j = 0; - do { + do { if (nbFields == 1) { res = xmlSchemaAreValuesEqual(keys[0]->val, bind->nodeTable[j]->keys[0]->val); @@ -23307,7 +23431,7 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, goto next_node_table_entry; } } - } + } /* * Add the duplicate to the list of duplicates. */ @@ -23315,7 +23439,7 @@ xmlSchemaIDCFillNodeTables(xmlSchemaValidCtxtPtr vctxt, bind->dupls = xmlSchemaItemListCreate(); if (bind->dupls == NULL) goto internal_error; - } + } if (xmlSchemaItemListAdd(bind->dupls, bind->nodeTable[j]) == -1) goto internal_error; /* @@ -23350,12 +23474,12 @@ internal_error: } /** - * xmlSchemaBubbleIDCNodeTables: + * xmlSchemaBubbleIDCNodeTables: * @depth: the current tree depth * - * Merges IDC bindings of an element at @depth into the corresponding IDC - * bindings of its parent element. If a duplicate note-table entry is found, - * both, the parent node-table entry and child entry are discarded from the + * Merges IDC bindings of an element at @depth into the corresponding IDC + * bindings of its parent element. If a duplicate note-table entry is found, + * both, the parent node-table entry and child entry are discarded from the * node-table of the parent. * * Returns 0 if OK and -1 on internal errors. @@ -23369,19 +23493,19 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) xmlSchemaIDCAugPtr aidc; int i, j, k, ret = 0, nbFields, oldNum, oldDupls; - bind = vctxt->inode->idcTable; + bind = vctxt->inode->idcTable; if (bind == NULL) { /* Fine, no table, no bubbles. */ return (0); } - + parTable = &(vctxt->elemInfos[vctxt->depth -1]->idcTable); /* * Walk all bindings; create new or add to existing bindings. * Remove duplicate key-sequences. */ while (bind != NULL) { - + if ((bind->nbNodes == 0) && WXS_ILIST_IS_EMPTY(bind->dupls)) goto next_binding; /* @@ -23391,7 +23515,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) aidc = vctxt->aidcs; do { if (aidc->def == bind->definition) { - if ((aidc->keyrefDepth == -1) || + if ((aidc->keyrefDepth == -1) || (aidc->keyrefDepth >= vctxt->depth)) { goto next_binding; } @@ -23407,7 +23531,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) * Search a matching parent binding for the * IDC definition. */ - while (parBind != NULL) { + while (parBind != NULL) { if (parBind->definition == bind->definition) break; parBind = parBind->next; @@ -23415,7 +23539,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) if (parBind != NULL) { /* - * Compare every node-table entry of the child node, + * Compare every node-table entry of the child node, * i.e. the key-sequence within, ... */ oldNum = parBind->nbNodes; /* Skip newly added items. */ @@ -23425,12 +23549,12 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) dupls = (xmlSchemaPSVIIDCNodePtr *) parBind->dupls->items; } else { dupls = NULL; - oldDupls = 0; + oldDupls = 0; } - + parNodes = parBind->nodeTable; nbFields = bind->definition->nbFields; - + for (i = 0; i < bind->nbNodes; i++) { node = bind->nodeTable[i]; if (node == NULL) @@ -23440,7 +23564,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) * evaluated to be a duplicate key-sequence. */ if (oldDupls) { - j = 0; + j = 0; while (j < oldDupls) { if (nbFields == 1) { ret = xmlSchemaAreValuesEqual( @@ -23473,12 +23597,12 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) /* Duplicate found. Skip this entry. */ continue; } - } + } /* * ... and with every key-sequence of the parent node. */ if (oldNum) { - j = 0; + j = 0; while (j < oldNum) { parNode = parNodes[j]; if (nbFields == 1) { @@ -23491,7 +23615,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) j++; continue; } - } else { + } else { for (k = 0; k < nbFields; k++) { ret = xmlSchemaAreValuesEqual( node->keys[k]->val, @@ -23512,20 +23636,20 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) * Handle duplicates. Move the duplicate in * the parent's node-table to the list of * duplicates. - */ + */ oldNum--; parBind->nbNodes--; /* * Move last old item to pos of duplicate. */ parNodes[j] = parNodes[oldNum]; - + if (parBind->nbNodes != oldNum) { /* - * If new items exist, move last new item to + * If new items exist, move last new item to * last of old items. */ - parNodes[oldNum] = + parNodes[oldNum] = parNodes[parBind->nbNodes]; } if (parBind->dupls == NULL) { @@ -23533,31 +23657,31 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) if (parBind->dupls == NULL) goto internal_error; } - xmlSchemaItemListAdd(parBind->dupls, parNode); + xmlSchemaItemListAdd(parBind->dupls, parNode); } else { /* - * Add the node-table entry (node and key-sequence) of + * Add the node-table entry (node and key-sequence) of * the child node to the node table of the parent node. */ - if (parBind->nodeTable == NULL) { - parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) + if (parBind->nodeTable == NULL) { + parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) xmlMalloc(10 * sizeof(xmlSchemaPSVIIDCNodePtr)); if (parBind->nodeTable == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "allocating IDC list of node-table items", NULL); goto internal_error; } parBind->sizeNodes = 1; } else if (parBind->nbNodes >= parBind->sizeNodes) { parBind->sizeNodes *= 2; - parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) - xmlRealloc(parBind->nodeTable, parBind->sizeNodes * + parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) + xmlRealloc(parBind->nodeTable, parBind->sizeNodes * sizeof(xmlSchemaPSVIIDCNodePtr)); if (parBind->nodeTable == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "re-allocating IDC list of node-table items", NULL); goto internal_error; - } + } } parNodes = parBind->nodeTable; /* @@ -23567,9 +23691,9 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) parNodes[parBind->nbNodes++] = node; } - } - - } + } + + } } else { /* * No binding for the IDC was found: create a new one and @@ -23578,7 +23702,7 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) parBind = xmlSchemaIDCNewBinding(bind->definition); if (parBind == NULL) goto internal_error; - + /* * TODO: Hmm, how to optimize the initial number of * allocated entries? @@ -23604,11 +23728,11 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) /* * Copy the entries. */ - parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) + parBind->nodeTable = (xmlSchemaPSVIIDCNodePtr *) xmlMalloc(bind->nbNodes * sizeof(xmlSchemaPSVIIDCNodePtr)); if (parBind->nodeTable == NULL) { - xmlSchemaVErrMemory(NULL, + xmlSchemaVErrMemory(NULL, "allocating an array of IDC node-table " "items", NULL); xmlSchemaIDCFreeBinding(parBind); @@ -23627,15 +23751,17 @@ xmlSchemaBubbleIDCNodeTables(xmlSchemaValidCtxtPtr vctxt) if (parBind->dupls != NULL) xmlSchemaItemListFree(parBind->dupls); parBind->dupls = bind->dupls; - bind->dupls = NULL; - } - if (*parTable == NULL) - *parTable = parBind; - else { - parBind->next = *parTable; - *parTable = parBind; - } - } + bind->dupls = NULL; + } + if (parTable != NULL) { + if (*parTable == NULL) + *parTable = parBind; + else { + parBind->next = *parTable; + *parTable = parBind; + } + } + } next_binding: bind = bind->next; @@ -23658,7 +23784,7 @@ xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt) { xmlSchemaIDCMatcherPtr matcher; xmlSchemaPSVIIDCBindingPtr bind; - + matcher = vctxt->inode->idcMatchers; /* * Find a keyref. @@ -23679,7 +23805,7 @@ xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt) */ bind = vctxt->inode->idcTable; while (bind != NULL) { - if ((xmlSchemaIDCPtr) matcher->aidc->def->ref->item == + if ((xmlSchemaIDCPtr) matcher->aidc->def->ref->item == bind->definition) break; bind = bind->next; @@ -23748,7 +23874,7 @@ xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt) } } } - + if (res == 0) { xmlChar *str = NULL, *strB = NULL; xmlSchemaKeyrefErr(vctxt, @@ -23770,9 +23896,9 @@ xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt) } /************************************************************************ - * * - * XML Reader validation code * - * * + * * + * XML Reader validation code * + * * ************************************************************************/ static xmlSchemaAttrInfoPtr @@ -23832,7 +23958,7 @@ xmlSchemaValidatorPushAttribute(xmlSchemaValidCtxtPtr vctxt, xmlNodePtr attrNode, int nodeLine, const xmlChar *localName, - const xmlChar *nsName, + const xmlChar *nsName, int ownedNames, xmlChar *value, int ownedValue) @@ -23858,7 +23984,7 @@ xmlSchemaValidatorPushAttribute(xmlSchemaValidCtxtPtr vctxt, if (nsName != NULL) { if (xmlStrEqual(localName, BAD_CAST "nil")) { if (xmlStrEqual(attr->nsName, xmlSchemaInstanceNs)) { - attr->metaType = XML_SCHEMA_ATTR_INFO_META_XSI_NIL; + attr->metaType = XML_SCHEMA_ATTR_INFO_META_XSI_NIL; } } else if (xmlStrEqual(localName, BAD_CAST "type")) { if (xmlStrEqual(attr->nsName, xmlSchemaInstanceNs)) { @@ -24060,6 +24186,7 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt, else goto pattern_and_enum; } + /* * Whitespace handling is only of importance for string-based * types. @@ -24070,16 +24197,15 @@ xmlSchemaValidateFacets(xmlSchemaAbstractCtxtPtr actxt, ws = xmlSchemaGetWhiteSpaceFacetValue(type); } else ws = XML_SCHEMA_WHITESPACE_COLLAPSE; + /* * If the value was not computed (for string or * anySimpleType based types), then use the provided * type. */ - if (val == NULL) - valType = valType; - else + if (val != NULL) valType = xmlSchemaGetValType(val); - + ret = 0; for (facetLink = type->facetSet; facetLink != NULL; facetLink = facetLink->next) { @@ -24128,11 +24254,11 @@ WXS_IS_LIST: ret = 0; for (facetLink = type->facetSet; facetLink != NULL; facetLink = facetLink->next) { - + switch (facetLink->facet->type) { case XML_SCHEMA_FACET_LENGTH: case XML_SCHEMA_FACET_MINLENGTH: - case XML_SCHEMA_FACET_MAXLENGTH: + case XML_SCHEMA_FACET_MAXLENGTH: ret = xmlSchemaValidateListSimpleTypeFacet(facetLink->facet, value, length, NULL); break; @@ -24144,7 +24270,7 @@ WXS_IS_LIST: "validating against a list type facet"); return (-1); } else if (ret > 0) { - if (fireErrors) + if (fireErrors) xmlSchemaFacetErr(actxt, ret, node, value, length, type, facetLink->facet, NULL, NULL, NULL); else @@ -24221,7 +24347,7 @@ pattern_and_enum: if (facetLink->facet->type != XML_SCHEMA_FACET_PATTERN) continue; found = 1; - /* + /* * NOTE that for patterns, @value needs to be the * normalized vaule. */ @@ -24233,7 +24359,7 @@ pattern_and_enum: "validating against a pattern facet"); return (-1); } else { - /* + /* * Save the last non-validating facet. */ facet = facetLink->facet; @@ -24256,12 +24382,12 @@ pattern_and_enum: return (error); } - + static xmlChar * xmlSchemaNormalizeValue(xmlSchemaTypePtr type, const xmlChar *value) { - switch (xmlSchemaGetWhiteSpaceFacetValue(type)) { + switch (xmlSchemaGetWhiteSpaceFacetValue(type)) { case XML_SCHEMA_WHITESPACE_COLLAPSE: return (xmlSchemaCollapseString(value)); case XML_SCHEMA_WHITESPACE_REPLACE: @@ -24280,7 +24406,7 @@ xmlSchemaValidateQName(xmlSchemaValidCtxtPtr vctxt, int ret; const xmlChar *nsName; xmlChar *local, *prefix = NULL; - + ret = xmlValidateQName(value, 1); if (ret != 0) { if (ret == -1) { @@ -24303,7 +24429,7 @@ xmlSchemaValidateQName(xmlSchemaValidCtxtPtr vctxt, * - is there a default namespace? */ nsName = xmlSchemaLookupNamespace(vctxt, prefix); - + if (prefix != NULL) { xmlFree(prefix); /* @@ -24360,7 +24486,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, value = normValue; \ isNormalized = 1; \ } - + if ((retVal != NULL) && (*retVal != NULL)) { xmlSchemaFreeValue(*retVal); *retVal = NULL; @@ -24375,14 +24501,14 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, */ /* * 2.1 If The definition is ENTITY or is validly derived from ENTITY given - * the empty set, as defined in Type Derivation OK (Simple) (§3.14.6), then - * the string must be a ·declared entity name·. + * the empty set, as defined in Type Derivation OK (Simple) ($3.14.6), then + * the string must be a `declared entity name`. */ /* * 2.2 If The definition is ENTITIES or is validly derived from ENTITIES - * given the empty set, as defined in Type Derivation OK (Simple) (§3.14.6), - * then every whitespace-delimited substring of the string must be a ·declared - * entity name·. + * given the empty set, as defined in Type Derivation OK (Simple) ($3.14.6), + * then every whitespace-delimited substring of the string must be a `declared + * entity name`. */ /* * 2.3 otherwise no further condition applies. @@ -24394,8 +24520,8 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, if (WXS_IS_ANY_SIMPLE_TYPE(type) || WXS_IS_ATOMIC(type)) { xmlSchemaTypePtr biType; /* The built-in type. */ /* - * SPEC (1.2.1) "if {variety} is ·atomic· then the string must ·match· - * a literal in the ·lexical space· of {base type definition}" + * SPEC (1.2.1) "if {variety} is `atomic` then the string must `match` + * a literal in the `lexical space` of {base type definition}" */ /* * Whitespace-normalize. @@ -24421,9 +24547,9 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, * NOTATIONs need to be processed here, since they need * to lookup in the hashtable of NOTATION declarations of the schema. */ - if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) { - switch (biType->builtInType) { - case XML_SCHEMAS_NOTATION: + if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) { + switch (biType->builtInType) { + case XML_SCHEMAS_NOTATION: ret = xmlSchemaValidateNotation( (xmlSchemaValidCtxtPtr) actxt, ((xmlSchemaValidCtxtPtr) actxt)->schema, @@ -24437,14 +24563,14 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, /* ws = xmlSchemaGetWhiteSpaceFacetValue(type); */ if (valNeeded) ret = xmlSchemaValPredefTypeNodeNoNorm(biType, - value, &val, NULL); + value, &val, node); else ret = xmlSchemaValPredefTypeNodeNoNorm(biType, - value, NULL, NULL); + value, NULL, node); break; } - } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) { - switch (biType->builtInType) { + } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) { + switch (biType->builtInType) { case XML_SCHEMAS_NOTATION: ret = xmlSchemaValidateNotation(NULL, ((xmlSchemaParserCtxtPtr) actxt)->schema, node, @@ -24459,7 +24585,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, ret = xmlSchemaValPredefTypeNodeNoNorm(biType, value, NULL, node); break; - } + } } else { /* * Validation via a public API is not implemented yet. @@ -24476,7 +24602,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, if (WXS_IS_LIST(type)) ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2; else - ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; + ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; } if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) { /* @@ -24491,10 +24617,10 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, "validating facets of atomic simple type"); goto internal_error; } - if (WXS_IS_LIST(type)) + if (WXS_IS_LIST(type)) ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2; else - ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; + ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1; } } if (fireErrors && (ret > 0)) @@ -24506,9 +24632,9 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, xmlChar *tmpValue = NULL; unsigned long len = 0; xmlSchemaValPtr prevVal = NULL, curVal = NULL; - /* 1.2.2 if {variety} is ·list· then the string must be a sequence - * of white space separated tokens, each of which ·match·es a literal - * in the ·lexical space· of {item type definition} + /* 1.2.2 if {variety} is `list` then the string must be a sequence + * of white space separated tokens, each of which `match`es a literal + * in the `lexical space` of {item type definition} */ /* * Note that XML_SCHEMAS_TYPE_NORMVALUENEEDED will be set if @@ -24519,7 +24645,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, * VAL TODO: Optimize validation of empty values. * VAL TODO: We do not have computed values for lists. */ - itemType = WXS_LIST_ITEMTYPE(type); + itemType = WXS_LIST_ITEMTYPE(type); cur = value; do { while (IS_BLANK_CH(*cur)) @@ -24558,7 +24684,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, } ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2; break; - } + } cur = end; } while (*cur != 0); FREE_AND_NULL(tmpValue); @@ -24579,7 +24705,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, } } if (fireErrors && (ret > 0)) { - /* + /* * Report the normalized value. */ normalize = 1; @@ -24589,10 +24715,10 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, } else if (WXS_IS_UNION(type)) { xmlSchemaTypeLinkPtr memberLink; /* - * TODO: For all datatypes ·derived· by ·union· whiteSpace does - * not apply directly; however, the normalization behavior of ·union· + * TODO: For all datatypes `derived` by `union` whiteSpace does + * not apply directly; however, the normalization behavior of `union` * types is controlled by the value of whiteSpace on that one of the - * ·memberTypes· against which the ·union· is successfully validated. + * `memberTypes` against which the `union` is successfully validated. * * This means that the value is normalized by the first validating * member type, then the facets of the union type are applied. This @@ -24600,8 +24726,8 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, */ /* - * 1.2.3 if {variety} is ·union· then the string must ·match· a - * literal in the ·lexical space· of at least one member of + * 1.2.3 if {variety} is `union` then the string must `match` a + * literal in the `lexical space` of at least one member of * {member type definitions} */ memberLink = xmlSchemaGetUnionSimpleTypeMemberTypes(type); @@ -24609,7 +24735,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, AERROR_INT("xmlSchemaVCheckCVCSimpleType", "union simple type has no member types"); goto internal_error; - } + } /* * Always normalize union type values, since we currently * cannot store the whitespace information with the value @@ -24617,7 +24743,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, * not possible. */ while (memberLink != NULL) { - if (valNeeded) + if (valNeeded) ret = xmlSchemaVCheckCVCSimpleType(actxt, node, memberLink->type, value, &val, 0, 1, 0); else @@ -24640,9 +24766,9 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, */ if ((ret == 0) && (type->flags & XML_SCHEMAS_TYPE_HAS_FACETS)) { /* - * The normalization behavior of ·union· types is controlled by - * the value of whiteSpace on that one of the ·memberTypes· - * against which the ·union· is successfully validated. + * The normalization behavior of `union` types is controlled by + * the value of whiteSpace on that one of the `memberTypes` + * against which the `union` is successfully validated. */ NORMALIZE(memberLink->type); ret = xmlSchemaValidateFacets(actxt, node, type, @@ -24654,7 +24780,7 @@ xmlSchemaVCheckCVCSimpleType(xmlSchemaAbstractCtxtPtr actxt, "validating facets of union simple type"); goto internal_error; } - ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3; + ret = XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3; } } if (fireErrors && (ret > 0)) @@ -24802,14 +24928,14 @@ xmlSchemaProcessXSIType(xmlSchemaValidCtxtPtr vctxt, /* * SPEC cvc-elt (3.3.4) : (4.3) (Type Derivation OK) - * "The ·local type definition· must be validly + * "The `local type definition` must be validly * derived from the {type definition} given the union of * the {disallowed substitutions} and the {type definition}'s * {prohibited substitutions}, as defined in - * Type Derivation OK (Complex) (§3.4.6) + * Type Derivation OK (Complex) ($3.4.6) * (if it is a complex type definition), * or given {disallowed substitutions} as defined in Type - * Derivation OK (Simple) (§3.14.6) (if it is a simple type + * Derivation OK (Simple) ($3.14.6) (if it is a simple type * definition)." * * {disallowed substitutions}: the "block" on the element decl. @@ -24892,9 +25018,9 @@ xmlSchemaValidateElemDecl(xmlSchemaValidCtxtPtr vctxt) return (vctxt->err); } if (actualType == NULL) { - VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL, - "The type definition is absent"); - return (XML_SCHEMAV_CVC_TYPE_1); + VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL, + "The type definition is absent"); + return (XML_SCHEMAV_CVC_TYPE_1); } if (vctxt->nbAttrInfos != 0) { int ret; @@ -24984,9 +25110,9 @@ xmlSchemaValidateElemDecl(xmlSchemaValidCtxtPtr vctxt) * No actual type definition. */ if (actualType == NULL) { - VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL, - "The type definition is absent"); - return (XML_SCHEMAV_CVC_TYPE_1); + VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL, + "The type definition is absent"); + return (XML_SCHEMAV_CVC_TYPE_1); } /* * Remember the actual type definition. @@ -25069,19 +25195,19 @@ xmlSchemaClearAttrInfos(xmlSchemaValidCtxtPtr vctxt) static int xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) { - xmlSchemaTypePtr type = vctxt->inode->typeDef; + xmlSchemaTypePtr type = vctxt->inode->typeDef; xmlSchemaItemListPtr attrUseList; xmlSchemaAttributeUsePtr attrUse = NULL; xmlSchemaAttributePtr attrDecl = NULL; - xmlSchemaAttrInfoPtr iattr, tmpiattr; + xmlSchemaAttrInfoPtr iattr, tmpiattr; int i, j, found, nbAttrs, nbUses; int xpathRes = 0, res, wildIDs = 0, fixed; xmlNodePtr defAttrOwnerElem = NULL; /* * SPEC (cvc-attribute) - * (1) "The declaration must not be ·absent· (see Missing - * Sub-components (§5.3) for how this can fail to be + * (1) "The declaration must not be `absent` (see Missing + * Sub-components ($5.3) for how this can fail to be * the case)." * (2) "Its {type definition} must not be absent." * @@ -25131,15 +25257,15 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * use with an {attribute declaration} whose {name} matches * the attribute information item's [local name] and whose * {target namespace} is identical to the attribute information - * item's [namespace name] (where an ·absent· {target namespace} + * item's [namespace name] (where an `absent` {target namespace} * is taken to be identical to a [namespace name] with no value), - * then the attribute information must be ·valid· with respect + * then the attribute information must be `valid` with respect * to that attribute use as per Attribute Locally Valid (Use) - * (§3.5.4). In this case the {attribute declaration} of that - * attribute use is the ·context-determined declaration· for the + * ($3.5.4). In this case the {attribute declaration} of that + * attribute use is the `context-determined declaration` for the * attribute information item with respect to Schema-Validity - * Assessment (Attribute) (§3.2.4) and - * Assessment Outcome (Attribute) (§3.2.5). + * Assessment (Attribute) ($3.2.4) and + * Assessment Outcome (Attribute) ($3.2.5). */ iattr->state = XML_SCHEMAS_ATTR_ASSESSED; iattr->use = attrUse; @@ -25173,7 +25299,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) } tmpiattr->state = XML_SCHEMAS_ATTR_ERR_MISSING; tmpiattr->use = attrUse; - tmpiattr->decl = attrDecl; + tmpiattr->decl = attrDecl; } else if ((attrUse->occurs == XML_SCHEMAS_ATTR_USE_OPTIONAL) && ((attrUse->defValue != NULL) || (attrDecl->defValue != NULL))) { @@ -25198,7 +25324,6 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) if (vctxt->nbAttrInfos == 0) return (0); - nbUses = vctxt->nbAttrInfos; /* * Validate against the wildcard. */ @@ -25217,13 +25342,13 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) continue; /* * SPEC (cvc-complex-type) - * (3.2.2) "The attribute information item must be ·valid· with - * respect to it as defined in Item Valid (Wildcard) (§3.10.4)." + * (3.2.2) "The attribute information item must be `valid` with + * respect to it as defined in Item Valid (Wildcard) ($3.10.4)." * * SPEC Item Valid (Wildcard) (cvc-wildcard) - * "... its [namespace name] must be ·valid· with respect to + * "... its [namespace name] must be `valid` with respect to * the wildcard constraint, as defined in Wildcard allows - * Namespace Name (§3.10.4)." + * Namespace Name ($3.10.4)." */ if (xmlSchemaCheckCVCWildcardNamespace(type->attributeWildcard, iattr->nsName) == 0) { @@ -25259,11 +25384,11 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * SPEC (cvc-complex-type) * (5) "Let [Definition:] the wild IDs be the set of * all attribute information item to which clause 3.2 - * applied and whose ·validation· resulted in a - * ·context-determined declaration· of mustFind or no - * ·context-determined declaration· at all, and whose + * applied and whose `validation` resulted in a + * `context-determined declaration` of mustFind or no + * `context-determined declaration` at all, and whose * [local name] and [namespace name] resolve (as - * defined by QName resolution (Instance) (§3.15.4)) to + * defined by QName resolution (Instance) ($3.15.4)) to * an attribute declaration whose {type definition} is * or is derived from ID. Then all of the following * must be true:" @@ -25273,7 +25398,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) iattr->typeDef, XML_SCHEMAS_ID)) { /* * SPEC (5.1) "There must be no more than one - * item in ·wild IDs·." + * item in `wild IDs`." */ if (wildIDs != 0) { /* VAL TODO */ @@ -25284,21 +25409,23 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) wildIDs++; /* * SPEC (cvc-complex-type) - * (5.2) "If ·wild IDs· is non-empty, there must not + * (5.2) "If `wild IDs` is non-empty, there must not * be any attribute uses among the {attribute uses} * whose {attribute declaration}'s {type definition} * is or is derived from ID." */ - for (j = 0; j < attrUseList->nbItems; j++) { - if (xmlSchemaIsDerivedFromBuiltInType( - WXS_ATTRUSE_TYPEDEF(attrUseList->items[j]), - XML_SCHEMAS_ID)) { - /* URGENT VAL TODO: implement */ - iattr->state = XML_SCHEMAS_ATTR_ERR_WILD_AND_USE_ID; - TODO - break; - } - } + if (attrUseList != NULL) { + for (j = 0; j < attrUseList->nbItems; j++) { + if (xmlSchemaIsDerivedFromBuiltInType( + WXS_ATTRUSE_TYPEDEF(attrUseList->items[j]), + XML_SCHEMAS_ID)) { + /* URGENT VAL TODO: implement */ + iattr->state = XML_SCHEMAS_ATTR_ERR_WILD_AND_USE_ID; + TODO + break; + } + } + } } } else if (type->attributeWildcard->processContents == XML_SCHEMAS_ANY_LAX) { @@ -25401,7 +25528,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) * VAL TODO: Should we use the *normalized* value? This currently * uses the *initial* value. */ - + if (defAttrOwnerElem) { xmlChar *normValue; const xmlChar *value; @@ -25419,7 +25546,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) if (xmlNewProp(defAttrOwnerElem, iattr->localName, value) == NULL) { VERROR_INT("xmlSchemaVAttributesComplex", - "callling xmlNewProp()"); + "calling xmlNewProp()"); if (normValue != NULL) xmlFree(normValue); goto internal_error; @@ -25492,9 +25619,9 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) fixed = 0; /* * SPEC (cvc-attribute) - * (3) "The item's ·normalized value· must be locally ·valid· - * with respect to that {type definition} as per - * String Valid (§3.14.4)." + * (3) "The item's `normalized value` must be locally `valid` + * with respect to that {type definition} as per + * String Valid ($3.14.4)." * * VAL TODO: Do we already have the * "normalized attribute value" here? @@ -25514,7 +25641,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) iattr->node, iattr->typeDef, iattr->value, NULL, 1, 0, 0); } - + if (res != 0) { if (res == -1) { VERROR_INT("xmlSchemaVAttributesComplex", @@ -25529,12 +25656,12 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) goto eval_idcs; } - if (fixed) { + if (fixed) { /* * SPEC Attribute Locally Valid (Use) (cvc-au) - * "For an attribute information item to be·valid· + * "For an attribute information item to be `valid` * with respect to an attribute use its *normalized* - * value· must match the *canonical* lexical + * value must match the *canonical* lexical * representation of the attribute use's {value * constraint}value, if it is present and fixed." * @@ -25543,7 +25670,7 @@ xmlSchemaVAttributesComplex(xmlSchemaValidCtxtPtr vctxt) */ /* * SPEC Attribute Locally Valid (cvc-attribute) - * (4) "The item's *actual* value· must match the *value* of + * (4) "The item's *actual* value must match the *value* of * the {value constraint}, if it is present and fixed." */ if (iattr->val == NULL) { @@ -25635,8 +25762,8 @@ eval_idcs: xmlSchemaCustomErr(ACTXT_CAST vctxt, XML_SCHEMAV_CVC_AU, NULL, NULL, "The value '%s' does not match the fixed " - "value constraint '%s'", - iattr->value, iattr->vcValue); + "value constraint '%s'", + iattr->value, iattr->vcValue); break; case XML_SCHEMAS_ATTR_ERR_WILD_STRICT_NO_DECL: VERROR(XML_SCHEMAV_CVC_WILDCARD, NULL, @@ -25698,7 +25825,7 @@ xmlSchemaValidateElemWildcard(xmlSchemaValidCtxtPtr vctxt, xmlSchemaElementPtr decl = NULL; decl = xmlSchemaGetElem(vctxt->schema, - vctxt->inode->localName, vctxt->inode->nsName); + vctxt->inode->localName, vctxt->inode->nsName); if (decl != NULL) { vctxt->inode->decl = decl; return (0); @@ -25756,16 +25883,16 @@ static int xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, const xmlChar *value, xmlSchemaValPtr *val) -{ +{ int ret = 0; xmlSchemaNodeInfoPtr inode = vctxt->inode; /* * cos-valid-default: * Schema Component Constraint: Element Default Valid (Immediate) - * For a string to be a valid default with respect to a type + * For a string to be a valid default with respect to a type * definition the appropriate case among the following must be true: - */ + */ if WXS_IS_COMPLEX(inode->typeDef) { /* * Complex type. @@ -25773,8 +25900,8 @@ xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, * SPEC (2.1) "its {content type} must be a simple type definition * or mixed." * SPEC (2.2.2) "If the {content type} is mixed, then the {content - * type}'s particle must be ·emptiable· as defined by - * Particle Emptiable (§3.9.6)." + * type}'s particle must be `emptiable` as defined by + * Particle Emptiable ($3.9.6)." */ if ((! WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) && ((! WXS_HAS_MIXED_CONTENT(inode->typeDef)) || @@ -25787,18 +25914,18 @@ xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, "or mixed content and a particle emptiable"); return(ret); } - } + } /* - * 1 If the type definition is a simple type definition, then the string - * must be ·valid· with respect to that definition as defined by String - * Valid (§3.14.4). + * 1 If the type definition is a simple type definition, then the string + * must be `valid` with respect to that definition as defined by String + * Valid ($3.14.4). * * AND * - * 2.2.1 If the {content type} is a simple type definition, then the - * string must be ·valid· with respect to that simple type definition - * as defined by String Valid (§3.14.4). - */ + * 2.2.1 If the {content type} is a simple type definition, then the + * string must be `valid` with respect to that simple type definition + * as defined by String Valid ($3.14.4). + */ if (WXS_IS_SIMPLE(inode->typeDef)) { ret = xmlSchemaVCheckCVCSimpleType(ACTXT_CAST vctxt, @@ -25812,7 +25939,7 @@ xmlSchemaCheckCOSValidDefault(xmlSchemaValidCtxtPtr vctxt, if (ret < 0) { VERROR_INT("xmlSchemaCheckCOSValidDefault", "calling xmlSchemaVCheckCVCSimpleType()"); - } + } return (ret); } @@ -25846,13 +25973,13 @@ xmlSchemaVContentModelCallback(xmlSchemaValidCtxtPtr vctxt ATTRIBUTE_UNUSED, static int xmlSchemaValidatorPushElem(xmlSchemaValidCtxtPtr vctxt) -{ +{ vctxt->inode = xmlSchemaGetFreshElemInfo(vctxt); if (vctxt->inode == NULL) { VERROR_INT("xmlSchemaValidatorPushElem", "calling xmlSchemaGetFreshElemInfo()"); return (-1); - } + } vctxt->nbAttrInfos = 0; return (0); } @@ -25875,7 +26002,7 @@ xmlSchemaVCheckINodeDataType(xmlSchemaValidCtxtPtr vctxt, -/* +/* * Process END of element. */ static int @@ -25894,7 +26021,7 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt) */ vctxt->skipDepth = vctxt->depth -1; goto end_elem; - } + } if ((inode->typeDef == NULL) || (inode->flags & XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE)) { /* @@ -25914,8 +26041,8 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt) * Workaround for "anyType". */ if (inode->typeDef->builtInType == XML_SCHEMAS_ANYTYPE) - goto character_content; - + goto character_content; + if ((inode->flags & XML_SCHEMA_ELEM_INFO_ERR_BAD_CONTENT) == 0) { xmlChar *values[10]; int terminal, nbval = 10, nbneg; @@ -25936,16 +26063,30 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt) #ifdef DEBUG_AUTOMATA xmlGenericError(xmlGenericErrorContext, "AUTOMATON create on '%s'\n", inode->localName); -#endif +#endif } + + /* + * Do not check further content if the node has been nilled + */ + if (INODE_NILLED(inode)) { + ret = 0; +#ifdef DEBUG_AUTOMATA + xmlGenericError(xmlGenericErrorContext, + "AUTOMATON succeeded on nilled '%s'\n", + inode->localName); +#endif + goto skip_nilled; + } + /* * Get hold of the still expected content, since a further * call to xmlRegExecPushString() will loose this information. - */ + */ xmlRegExecNextValues(inode->regexCtxt, &nbval, &nbneg, &values[0], &terminal); ret = xmlRegExecPushString(inode->regexCtxt, NULL, NULL); - if (ret <= 0) { + if ((ret<0) || ((ret==0) && (!INODE_NILLED(inode)))) { /* * Still missing something. */ @@ -25975,6 +26116,9 @@ xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt) } } + +skip_nilled: + if (inode->typeDef->contentType == XML_SCHEMA_CONTENT_ELEMENTS) goto end_elem; @@ -25991,14 +26135,14 @@ character_content: /* * Speedup if no declaration exists. */ - if (WXS_IS_SIMPLE(inode->typeDef)) { + if (WXS_IS_SIMPLE(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef, inode->value); } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef->contentTypeDef, inode->value); - } + } if (ret < 0) { VERROR_INT("xmlSchemaValidatorPopElem", "calling xmlSchemaVCheckCVCSimpleType()"); @@ -26007,26 +26151,26 @@ character_content: goto end_elem; } /* - * cvc-elt (3.3.4) : 5 + * cvc-elt (3.3.4) : 5 * The appropriate case among the following must be true: */ /* - * cvc-elt (3.3.4) : 5.1 - * If the declaration has a {value constraint}, - * the item has neither element nor character [children] and + * cvc-elt (3.3.4) : 5.1 + * If the declaration has a {value constraint}, + * the item has neither element nor character [children] and * clause 3.2 has not applied, then all of the following must be true: */ if ((inode->decl->value != NULL) && - (inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY) && + (inode->flags & XML_SCHEMA_ELEM_INFO_EMPTY) && (! INODE_NILLED(inode))) { /* - * cvc-elt (3.3.4) : 5.1.1 - * If the ·actual type definition· is a ·local type definition· + * cvc-elt (3.3.4) : 5.1.1 + * If the `actual type definition` is a `local type definition` * then the canonical lexical representation of the {value constraint} - * value must be a valid default for the ·actual type definition· as - * defined in Element Default Valid (Immediate) (§3.3.6). + * value must be a valid default for the `actual type definition` as + * defined in Element Default Valid (Immediate) ($3.3.6). */ - /* + /* * NOTE: 'local' above means types acquired by xsi:type. * NOTE: Although the *canonical* value is stated, it is not * relevant if canonical or not. Additionally XML Schema 1.1 @@ -26049,22 +26193,22 @@ character_content: * (see following). */ goto default_psvi; - } - /* - * cvc-elt (3.3.4) : 5.1.2 - * The element information item with the canonical lexical - * representation of the {value constraint} value used as its - * ·normalized value· must be ·valid· with respect to the - * ·actual type definition· as defined by Element Locally Valid (Type) - * (§3.3.4). - */ + } + /* + * cvc-elt (3.3.4) : 5.1.2 + * The element information item with the canonical lexical + * representation of the {value constraint} value used as its + * `normalized value` must be `valid` with respect to the + * `actual type definition` as defined by Element Locally Valid (Type) + * ($3.3.4). + */ if (WXS_IS_SIMPLE(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef, inode->decl->value); } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef->contentTypeDef, - inode->decl->value); + inode->decl->value); } if (ret != 0) { if (ret < 0) { @@ -26085,7 +26229,7 @@ default_psvi: xmlChar *normValue; /* * VAL TODO: Normalize the value. - */ + */ normValue = xmlSchemaNormalizeValue(inode->typeDef, inode->decl->value); if (normValue != NULL) { @@ -26098,42 +26242,42 @@ default_psvi: "calling xmlNewText()"); goto internal_error; } else - xmlAddChild(inode->node, textChild); + xmlAddChild(inode->node, textChild); } - - } else if (! INODE_NILLED(inode)) { + + } else if (! INODE_NILLED(inode)) { /* - * 5.2.1 The element information item must be ·valid· with respect - * to the ·actual type definition· as defined by Element Locally - * Valid (Type) (§3.3.4). - */ + * 5.2.1 The element information item must be `valid` with respect + * to the `actual type definition` as defined by Element Locally + * Valid (Type) ($3.3.4). + */ if (WXS_IS_SIMPLE(inode->typeDef)) { /* * SPEC (cvc-type) (3.1) * "If the type definition is a simple type definition, ..." * (3.1.3) "If clause 3.2 of Element Locally Valid - * (Element) (§3.3.4) did not apply, then the ·normalized value· - * must be ·valid· with respect to the type definition as defined - * by String Valid (§3.14.4). - */ + * (Element) ($3.3.4) did not apply, then the `normalized value` + * must be `valid` with respect to the type definition as defined + * by String Valid ($3.14.4). + */ ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef, inode->value); } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { /* * SPEC (cvc-type) (3.2) "If the type definition is a complex type * definition, then the element information item must be - * ·valid· with respect to the type definition as per - * Element Locally Valid (Complex Type) (§3.4.4);" + * `valid` with respect to the type definition as per + * Element Locally Valid (Complex Type) ($3.4.4);" * * SPEC (cvc-complex-type) (2.2) - * "If the {content type} is a simple type definition, ... - * the ·normalized value· of the element information item is - * ·valid· with respect to that simple type definition as - * defined by String Valid (§3.14.4)." + * "If the {content type} is a simple type definition, ... + * the `normalized value` of the element information item is + * `valid` with respect to that simple type definition as + * defined by String Valid ($3.14.4)." */ ret = xmlSchemaVCheckINodeDataType(vctxt, inode, inode->typeDef->contentTypeDef, inode->value); - } + } if (ret != 0) { if (ret < 0) { VERROR_INT("xmlSchemaValidatorPopElem", @@ -26143,7 +26287,7 @@ default_psvi: goto end_elem; } /* - * 5.2.2 If there is a fixed {value constraint} and clause 3.2 has + * 5.2.2 If there is a fixed {value constraint} and clause 3.2 has * not applied, all of the following must be true: */ if ((inode->decl->value != NULL) && @@ -26154,7 +26298,7 @@ default_psvi: * done on computed values. */ /* - * 5.2.2.1 The element information item must have no element + * 5.2.2.1 The element information item must have no element * information item [children]. */ if (inode->flags & @@ -26166,28 +26310,28 @@ default_psvi: goto end_elem; } else { /* - * 5.2.2.2 The appropriate case among the following must + * 5.2.2.2 The appropriate case among the following must * be true: - */ + */ if (WXS_HAS_MIXED_CONTENT(inode->typeDef)) { /* - * 5.2.2.2.1 If the {content type} of the ·actual type - * definition· is mixed, then the *initial value* of the - * item must match the canonical lexical representation + * 5.2.2.2.1 If the {content type} of the `actual type + * definition` is mixed, then the *initial value* of the + * item must match the canonical lexical representation * of the {value constraint} value. * - * ... the *initial value* of an element information - * item is the string composed of, in order, the - * [character code] of each character information item in + * ... the *initial value* of an element information + * item is the string composed of, in order, the + * [character code] of each character information item in * the [children] of that element information item. - */ + */ if (! xmlStrEqual(inode->value, inode->decl->value)){ - /* + /* * VAL TODO: Report invalid & expected values as well. * VAL TODO: Implement the canonical stuff. */ ret = XML_SCHEMAV_CVC_ELT_5_2_2_2_1; - xmlSchemaCustomErr(ACTXT_CAST vctxt, + xmlSchemaCustomErr(ACTXT_CAST vctxt, ret, NULL, NULL, "The initial value '%s' does not match the fixed " "value constraint '%s'", @@ -26196,9 +26340,9 @@ default_psvi: } } else if (WXS_HAS_SIMPLE_CONTENT(inode->typeDef)) { /* - * 5.2.2.2.2 If the {content type} of the ·actual type - * definition· is a simple type definition, then the - * *actual value* of the item must match the canonical + * 5.2.2.2.2 If the {content type} of the `actual type + * definition` is a simple type definition, then the + * *actual value* of the item must match the canonical * lexical representation of the {value constraint} value. */ /* @@ -26213,16 +26357,16 @@ default_psvi: xmlSchemaCustomErr(ACTXT_CAST vctxt, ret, NULL, NULL, "The actual value '%s' does not match the fixed " - "value constraint '%s'", + "value constraint '%s'", inode->value, inode->decl->value); goto end_elem; - } + } } - } + } } } - + end_elem: if (vctxt->depth < 0) { /* TODO: raise error? */ @@ -26232,15 +26376,15 @@ end_elem: vctxt->skipDepth = -1; /* * Evaluate the history of XPath state objects. - */ + */ if (inode->appliedXPath && (xmlSchemaXPathProcessHistory(vctxt, vctxt->depth) == -1)) goto internal_error; /* * MAYBE TODO: - * SPEC (6) "The element information item must be ·valid· with + * SPEC (6) "The element information item must be `valid` with * respect to each of the {identity-constraint definitions} as per - * Identity-constraint Satisfied (§3.11.4)." + * Identity-constraint Satisfied ($3.11.4)." */ /* * PSVI TODO: If we expose IDC node-tables via PSVI then the tables @@ -26248,7 +26392,7 @@ end_elem: * We will currently build IDC node-tables and bubble them only if * keyrefs do exist. */ - + /* * Add the current IDC target-nodes to the IDC node-tables. */ @@ -26282,7 +26426,7 @@ end_elem: */ if (xmlSchemaBubbleIDCNodeTables(vctxt) == -1) goto internal_error; - } + } } /* * Clear the current ielem. @@ -26315,11 +26459,11 @@ end_elem: aidc = aidc->next; } while (aidc != NULL); } - vctxt->depth--; + vctxt->depth--; vctxt->inode = vctxt->elemInfos[vctxt->depth]; /* - * VAL TODO: 7 If the element information item is the ·validation root·, it must be - * ·valid· per Validation Root Valid (ID/IDREF) (§3.3.4). + * VAL TODO: 7 If the element information item is the `validation root`, it must be + * `valid` per Validation Root Valid (ID/IDREF) ($3.3.4). */ return (ret); @@ -26400,11 +26544,11 @@ xmlSchemaValidateChildElem(xmlSchemaValidCtxtPtr vctxt) * Fallback to "anyType". * * SPEC (cvc-assess-elt) - * "If the item cannot be ·strictly assessed·, [...] + * "If the item cannot be `strictly assessed`, [...] * an element information item's schema validity may be laxly - * assessed if its ·context-determined declaration· is not - * skip by ·validating· with respect to the ·ur-type - * definition· as per Element Locally Valid (Type) (§3.3.4)." + * assessed if its `context-determined declaration` is not + * skip by `validating` with respect to the `ur-type + * definition` as per Element Locally Valid (Type) ($3.3.4)." */ vctxt->inode->typeDef = xmlSchemaGetBuiltInType(XML_SCHEMAS_ANYTYPE); @@ -26476,9 +26620,9 @@ xmlSchemaValidateChildElem(xmlSchemaValidCtxtPtr vctxt) * SPEC (2.4) "If the {content type} is element-only or mixed, * then the sequence of the element information item's * element information item [children], if any, taken in - * order, is ·valid· with respect to the {content type}'s + * order, is `valid` with respect to the {content type}'s * particle, as defined in Element Sequence Locally Valid - * (Particle) (§3.9.4)." + * (Particle) ($3.9.4)." */ ret = xmlRegExecPushString2(regexCtxt, vctxt->inode->localName, @@ -26575,7 +26719,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, if (consumed != NULL) *consumed = 0; if (INODE_NILLED(vctxt->inode)) { - /* + /* * SPEC cvc-elt (3.3.4 - 3.2.1) * "The element information item must have no character or * element information item [children]." @@ -26591,7 +26735,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, * information item [children]." */ if (vctxt->inode->typeDef->contentType == - XML_SCHEMA_CONTENT_EMPTY) { + XML_SCHEMA_CONTENT_EMPTY) { VERROR(XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, NULL, "Character content is not allowed, " "because the content type is empty"); @@ -26602,12 +26746,12 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, XML_SCHEMA_CONTENT_ELEMENTS) { if ((nodeType != XML_TEXT_NODE) || (! xmlSchemaIsBlank((xmlChar *) value, len))) { - /* - * SPEC cvc-complex-type (2.3) - * "If the {content type} is element-only, then the - * element information item has no character information - * item [children] other than those whose [character - * code] is defined as a white space in [XML 1.0 (Second + /* + * SPEC cvc-complex-type (2.3) + * "If the {content type} is element-only, then the + * element information item has no character information + * item [children] other than those whose [character + * code] is defined as a white space in [XML 1.0 (Second * Edition)]." */ VERROR(XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, NULL, @@ -26617,7 +26761,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, } return (0); } - + if ((value == NULL) || (value[0] == 0)) return (0); /* @@ -26629,7 +26773,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, ((vctxt->inode->decl == NULL) || (vctxt->inode->decl->value == NULL))) return (0); - + if (vctxt->inode->value == NULL) { /* * Set the value. @@ -26672,7 +26816,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, len = xmlStrlen(value); /* * Concat the value. - */ + */ if (vctxt->inode->flags & XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES) { vctxt->inode->value = BAD_CAST xmlStrncat( (xmlChar *) vctxt->inode->value, value, len); @@ -26681,7 +26825,7 @@ xmlSchemaVPushText(xmlSchemaValidCtxtPtr vctxt, BAD_CAST xmlStrncatNew(vctxt->inode->value, value, len); vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_FLAG_OWNED_VALUES; } - } + } return (0); } @@ -26698,7 +26842,7 @@ xmlSchemaValidateElem(xmlSchemaValidCtxtPtr vctxt) goto internal_error; } if (vctxt->xsiAssemble) { - /* + /* * We will stop validation if there was an error during * dynamic schema construction. * Note that we simply set @skipDepth to 0, this could @@ -26715,6 +26859,11 @@ xmlSchemaValidateElem(xmlSchemaValidCtxtPtr vctxt) vctxt->skipDepth = 0; 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) { /* @@ -26808,15 +26957,15 @@ type_validation: if (vctxt->inode->typeDef == NULL) { vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE; ret = XML_SCHEMAV_CVC_TYPE_1; - VERROR(ret, NULL, - "The type definition is absent"); + VERROR(ret, NULL, + "The type definition is absent"); goto exit; - } + } if (vctxt->inode->typeDef->flags & XML_SCHEMAS_TYPE_ABSTRACT) { vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE; ret = XML_SCHEMAV_CVC_TYPE_2; - VERROR(ret, NULL, - "The type definition is abstract"); + VERROR(ret, NULL, + "The type definition is abstract"); goto exit; } /* @@ -26897,7 +27046,7 @@ root_found: nodeType = xmlTextReaderNodeType(vctxt->reader); if (nodeType == XML_ELEMENT_NODE) { - + vctxt->depth++; if (xmlSchemaValidatorPushElem(vctxt) == -1) { VERROR_INT("xmlSchemaVReaderWalk", @@ -27063,17 +27212,17 @@ internal_error: #endif /************************************************************************ - * * - * SAX validation handlers * - * * + * * + * SAX validation handlers * + * * ************************************************************************/ /* * Process text content. */ static void -xmlSchemaSAXHandleText(void *ctx, - const xmlChar * ch, +xmlSchemaSAXHandleText(void *ctx, + const xmlChar * ch, int len) { xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx; @@ -27097,10 +27246,10 @@ xmlSchemaSAXHandleText(void *ctx, * Process CDATA content. */ static void -xmlSchemaSAXHandleCDataSection(void *ctx, - const xmlChar * ch, +xmlSchemaSAXHandleCDataSection(void *ctx, + const xmlChar * ch, int len) -{ +{ xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx; if (vctxt->depth < 0) @@ -27134,20 +27283,20 @@ xmlSchemaSAXHandleReference(void *ctx ATTRIBUTE_UNUSED, static void xmlSchemaSAXHandleStartElementNs(void *ctx, - const xmlChar * localname, - const xmlChar * prefix ATTRIBUTE_UNUSED, - const xmlChar * URI, - int nb_namespaces, - const xmlChar ** namespaces, - int nb_attributes, - int nb_defaulted ATTRIBUTE_UNUSED, + const xmlChar * localname, + const xmlChar * prefix ATTRIBUTE_UNUSED, + const xmlChar * URI, + int nb_namespaces, + const xmlChar ** namespaces, + int nb_attributes, + int nb_defaulted ATTRIBUTE_UNUSED, const xmlChar ** attributes) -{ +{ xmlSchemaValidCtxtPtr vctxt = (xmlSchemaValidCtxtPtr) ctx; int ret; xmlSchemaNodeInfoPtr ielem; int i, j; - + /* * SAX VAL TODO: What to do with nb_defaulted? */ @@ -27175,16 +27324,16 @@ xmlSchemaSAXHandleStartElementNs(void *ctx, ielem->flags |= XML_SCHEMA_ELEM_INFO_EMPTY; /* * Register namespaces on the elem info. - */ + */ if (nb_namespaces != 0) { /* * Although the parser builds its own namespace list, * we have no access to it, so we'll use an own one. */ - for (i = 0, j = 0; i < nb_namespaces; i++, j += 2) { + for (i = 0, j = 0; i < nb_namespaces; i++, j += 2) { /* * Store prefix and namespace name. - */ + */ if (ielem->nsBindings == NULL) { ielem->nsBindings = (const xmlChar **) xmlMalloc(10 * @@ -27220,7 +27369,7 @@ xmlSchemaSAXHandleStartElementNs(void *ctx, } else ielem->nsBindings[ielem->nbNsBindings * 2 + 1] = namespaces[j+1]; - ielem->nbNsBindings++; + ielem->nbNsBindings++; } } /* @@ -27234,7 +27383,7 @@ xmlSchemaSAXHandleStartElementNs(void *ctx, for (j = 0, i = 0; i < nb_attributes; i++, j += 5) { /* * Duplicate the value. - */ + */ value = xmlStrndup(attributes[j+3], attributes[j+4] - attributes[j+3]); /* @@ -27261,7 +27410,7 @@ xmlSchemaSAXHandleStartElementNs(void *ctx, goto internal_error; } goto exit; - } + } exit: return; @@ -27316,9 +27465,9 @@ internal_error: } /************************************************************************ - * * - * Validation interfaces * - * * + * * + * Validation interfaces * + * * ************************************************************************/ /** @@ -27347,9 +27496,29 @@ xmlSchemaNewValidCtxt(xmlSchemaPtr schema) return (ret); } +/** + * xmlSchemaValidateSetFilename: + * @vctxt: the schema validation context + * @filename: the file name + * + * Workaround to provide file error reporting information when this is + * not provided by current APIs + */ +void +xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, const char *filename) { + if (vctxt == NULL) + return; + if (vctxt->filename != NULL) + xmlFree(vctxt->filename); + if (filename != NULL) + vctxt->filename = (char *) xmlStrdup((const xmlChar *) filename); + else + vctxt->filename = NULL; +} + /** * xmlSchemaClearValidCtxt: - * @ctxt: the schema validation context + * @vctxt: the schema validation context * * Free the resources associated to the schema validation context; * leaves some fields alive intended for reuse of the context. @@ -27371,7 +27540,7 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt) #ifdef LIBXML_READER_ENABLED vctxt->reader = NULL; #endif - vctxt->hasKeyrefs = 0; + vctxt->hasKeyrefs = 0; if (vctxt->value != NULL) { xmlSchemaFreeValue(vctxt->value); @@ -27441,7 +27610,7 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt) break; xmlSchemaClearElemInfo(vctxt, ei); } - } + } xmlSchemaItemListClear(vctxt->nodeQNames); /* Recreate the dict. */ xmlDictFree(vctxt->dict); @@ -27450,6 +27619,11 @@ xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt) * where the user provides the dict? */ vctxt->dict = xmlDictCreate(); + + if (vctxt->filename != NULL) { + xmlFree(vctxt->filename); + vctxt->filename = NULL; + } } /** @@ -27535,6 +27709,8 @@ xmlSchemaFreeValidCtxt(xmlSchemaValidCtxtPtr ctxt) xmlSchemaItemListFree(ctxt->nodeQNames); if (ctxt->dict != NULL) xmlDictFree(ctxt->dict); + if (ctxt->filename != NULL) + xmlFree(ctxt->filename); xmlFree(ctxt); } @@ -27543,7 +27719,7 @@ xmlSchemaFreeValidCtxt(xmlSchemaValidCtxtPtr ctxt) * @ctxt: the schema validation context * * Check if any error was detected during validation. - * + * * Returns 1 if valid so far, 0 if errors were detected, and -1 in case * of internal error. */ @@ -27602,7 +27778,7 @@ xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, /** * xmlSchemaGetValidErrors: - * @ctxt: a XML-Schema validation context + * @ctxt: a XML-Schema validation context * @err: the error function result * @warn: the warning function result * @ctx: the functions context result @@ -27663,7 +27839,7 @@ xmlSchemaSetValidOptions(xmlSchemaValidCtxtPtr ctxt, /** * xmlSchemaValidCtxtGetOptions: - * @ctxt: a schema validation context + * @ctxt: a schema validation context * * Get the validation context options. * @@ -27689,7 +27865,10 @@ xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt) const xmlChar *nsName; /* DOC VAL TODO: Move this to the start function. */ - valRoot = xmlDocGetRootElement(vctxt->doc); + if (vctxt->validationRoot != NULL) + valRoot = vctxt->validationRoot; + else + valRoot = xmlDocGetRootElement(vctxt->doc); if (valRoot == NULL) { /* VAL TODO: Error code? */ VERROR(1, NULL, "The document has no document element"); @@ -27731,7 +27910,7 @@ xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt) nsName = NULL; ret = xmlSchemaValidatorPushAttribute(vctxt, (xmlNodePtr) attr, - /* + /* * Note that we give it the line number of the * parent element. */ @@ -27787,7 +27966,7 @@ xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt) (node->type == XML_ENTITY_REF_NODE)) { /* * DOC VAL TODO: What to do with entities? - */ + */ VERROR_INT("xmlSchemaVDocWalk", "there is at least one entity reference in the node-tree " "currently being validated. Processing of entities with " @@ -27847,7 +28026,7 @@ static int xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { /* * Some initialization. - */ + */ vctxt->err = 0; vctxt->nberrors = 0; vctxt->depth = -1; @@ -27864,9 +28043,9 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { */ if (vctxt->schema == NULL) { xmlSchemaParserCtxtPtr pctxt; - + vctxt->xsiAssemble = 1; - /* + /* * If not schema was given then we will create a schema * dynamically using XSI schema locations. * @@ -27882,8 +28061,8 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { */ vctxt->schema = xmlSchemaNewSchema(pctxt); if (vctxt->schema == NULL) - return (-1); - /* + return (-1); + /* * Create the schema construction context. */ pctxt->constructor = xmlSchemaConstructionCtxtCreate(pctxt->dict); @@ -27894,14 +28073,13 @@ xmlSchemaPreRun(xmlSchemaValidCtxtPtr vctxt) { * Take ownership of the constructor to be able to free it. */ pctxt->ownsConstructor = 1; - } + } /* - * Augment the IDC definitions. + * Augment the IDC definitions for the main schema and all imported ones + * NOTE: main schema if the first in the imported list */ - if (vctxt->schema->idcDef != NULL) { - xmlHashScan(vctxt->schema->idcDef, - (xmlHashScanner) xmlSchemaAugmentIDC, vctxt); - } + xmlHashScan(vctxt->schema->schemasImports,(xmlHashScanner)xmlSchemaAugmentImportedIDC, vctxt); + return(0); } @@ -28011,9 +28189,9 @@ xmlSchemaValidateDoc(xmlSchemaValidCtxtPtr ctxt, xmlDocPtr doc) /************************************************************************ - * * - * Function and data for SAX streaming API * - * * + * * + * Function and data for SAX streaming API * + * * ************************************************************************/ typedef struct _xmlSchemaSplitSAXData xmlSchemaSplitSAXData; typedef xmlSchemaSplitSAXData *xmlSchemaSplitSAXDataPtr; @@ -28089,8 +28267,8 @@ externalSubsetSplit(void *ctx, const xmlChar *name, { xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx; if ((ctxt != NULL) && (ctxt->user_sax != NULL) && - (ctxt->user_sax->internalSubset != NULL)) - ctxt->user_sax->internalSubset(ctxt->user_data, name, ExternalID, + (ctxt->user_sax->externalSubset != NULL)) + ctxt->user_sax->externalSubset(ctxt->user_data, name, ExternalID, SystemID); } @@ -28296,8 +28474,8 @@ cdataBlockSplit(void *ctx, const xmlChar *value, int len) if (ctxt == NULL) return; if ((ctxt->user_sax != NULL) && - (ctxt->user_sax->ignorableWhitespace != NULL)) - ctxt->user_sax->ignorableWhitespace(ctxt->user_data, value, len); + (ctxt->user_sax->cdataBlock != NULL)) + ctxt->user_sax->cdataBlock(ctxt->user_data, value, len); if (ctxt->ctxt != NULL) xmlSchemaSAXHandleCDataSection(ctxt->ctxt, value, len); } @@ -28316,10 +28494,10 @@ referenceSplit(void *ctx, const xmlChar *name) } static void -startElementNsSplit(void *ctx, const xmlChar * localname, - const xmlChar * prefix, const xmlChar * URI, - int nb_namespaces, const xmlChar ** namespaces, - int nb_attributes, int nb_defaulted, +startElementNsSplit(void *ctx, const xmlChar * localname, + const xmlChar * prefix, const xmlChar * URI, + int nb_namespaces, const xmlChar ** namespaces, + int nb_attributes, int nb_defaulted, const xmlChar ** attributes) { xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx; if (ctxt == NULL) @@ -28338,7 +28516,7 @@ startElementNsSplit(void *ctx, const xmlChar * localname, } static void -endElementNsSplit(void *ctx, const xmlChar * localname, +endElementNsSplit(void *ctx, const xmlChar * localname, const xmlChar * prefix, const xmlChar * URI) { xmlSchemaSAXPlugPtr ctxt = (xmlSchemaSAXPlugPtr) ctx; if (ctxt == NULL) @@ -28379,7 +28557,7 @@ xmlSchemaSAXPlug(xmlSchemaValidCtxtPtr ctxt, old_sax = *sax; if ((old_sax != NULL) && (old_sax->initialized != XML_SAX2_MAGIC)) return(NULL); - if ((old_sax != NULL) && + if ((old_sax != NULL) && (old_sax->startElementNs == NULL) && (old_sax->endElementNs == NULL) && ((old_sax->startElement != NULL) || (old_sax->endElement != NULL))) return(NULL); @@ -28397,7 +28575,7 @@ xmlSchemaSAXPlug(xmlSchemaValidCtxtPtr ctxt, ret->ctxt = ctxt; ret->user_sax_ptr = sax; ret->user_sax = old_sax; - if (old_sax == NULL) { + if (old_sax == NULL) { /* * go direct, no need for the split block and functions. */ @@ -28418,7 +28596,7 @@ xmlSchemaSAXPlug(xmlSchemaValidCtxtPtr ctxt, } else { /* * for each callback unused by Schemas initialize it to the Split - * routine only if non NULL in the user block, this can speed up + * routine only if non NULL in the user block, this can speed up * things at the SAX level. */ if (old_sax->internalSubset != NULL) @@ -28529,6 +28707,63 @@ xmlSchemaSAXUnplug(xmlSchemaSAXPlugPtr plug) return(0); } +/** + * xmlSchemaValidateSetLocator: + * @vctxt: a schema validation context + * @f: the locator function pointer + * @ctxt: the locator context + * + * Allows to set a locator function to the validation context, + * which will be used to provide file and line information since + * those are not provided as part of the SAX validation flow + * Setting @f to NULL disable the locator. + */ + +void +xmlSchemaValidateSetLocator(xmlSchemaValidCtxtPtr vctxt, + xmlSchemaValidityLocatorFunc f, + void *ctxt) +{ + if (vctxt == NULL) return; + vctxt->locFunc = f; + vctxt->locCtxt = ctxt; +} + +/** + * xmlSchemaValidateStreamLocator: + * @ctx: the xmlTextReaderPtr used + * @file: returned file information + * @line: returned line information + * + * Internal locator function for the readers + * + * Returns 0 in case the Schema validation could be (des)activated and + * -1 in case of error. + */ +static int +xmlSchemaValidateStreamLocator(void *ctx, const char **file, + unsigned long *line) { + xmlParserCtxtPtr ctxt; + + if ((ctx == NULL) || ((file == NULL) && (line == NULL))) + return(-1); + + if (file != NULL) + *file = NULL; + if (line != NULL) + *line = 0; + + ctxt = (xmlParserCtxtPtr) ctx; + if (ctxt->input != NULL) { + if (file != NULL) + *file = ctxt->input->filename; + if (line != NULL) + *line = ctxt->input->line; + return(0); + } + return(-1); +} + /** * xmlSchemaValidateStream: * @ctxt: a schema validation context @@ -28571,7 +28806,8 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt, if (options) xmlCtxtUseOptions(pctxt, options); #endif - pctxt->linenumbers = 1; + pctxt->linenumbers = 1; + xmlSchemaValidateSetLocator(ctxt, xmlSchemaValidateStreamLocator, pctxt); inputStream = xmlNewIOInputStream(pctxt, input, enc);; if (inputStream == NULL) { @@ -28600,7 +28836,7 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt, ret = ctxt->parserCtxt->errNo; if (ret == 0) ret = 1; - } + } done: ctxt->parserCtxt = NULL; @@ -28639,16 +28875,33 @@ xmlSchemaValidateFile(xmlSchemaValidCtxtPtr ctxt, if ((ctxt == NULL) || (filename == NULL)) return (-1); - + input = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE); if (input == NULL) return (-1); ret = xmlSchemaValidateStream(ctxt, input, XML_CHAR_ENCODING_NONE, - NULL, NULL); + NULL, NULL); return (ret); } +/** + * xmlSchemaValidCtxtGetParserCtxt: + * @ctxt: a schema validation context + * + * allow access to the parser context of the schema validation context + * + * Returns the parser context of the schema validation context or NULL + * in case of error. + */ +xmlParserCtxtPtr +xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt) +{ + if (ctxt == NULL) + return(NULL); + return (ctxt->parserCtxt); +} + #define bottom_xmlschemas #include "elfgcchack.h" #endif /* LIBXML_SCHEMAS_ENABLED */ diff --git a/gnulib-local/lib/libxml/xmlschemas.in.h b/gnulib-local/lib/libxml/xmlschemas.in.h index 15faef5..97930c7 100644 --- a/gnulib-local/lib/libxml/xmlschemas.in.h +++ b/gnulib-local/lib/libxml/xmlschemas.in.h @@ -56,7 +56,7 @@ typedef enum { /* * ATTENTION: Change xmlSchemaSetValidOptions's check -* for invalid values, if adding to the validation +* for invalid values, if adding to the validation * options below. */ /** @@ -85,30 +85,65 @@ typedef struct _xmlSchema xmlSchema; typedef xmlSchema *xmlSchemaPtr; /** - * A schemas validation context + * xmlSchemaValidityErrorFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of an error callback from an XSD validation + */ +typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) + (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); + +/** + * xmlSchemaValidityWarningFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of a warning callback from an XSD validation */ -typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...); -typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...); +typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) + (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); +/** + * A schemas validation context + */ typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; +/** + * xmlSchemaValidityLocatorFunc: + * @ctx: user provided context + * @file: returned file information + * @line: returned line information + * + * A schemas validation locator, a callback called by the validator. + * This is used when file or node informations are not available + * to find out what file and line number are affected + * + * Returns: 0 in case of success and -1 in case of error + */ + +typedef int (XMLCDECL *xmlSchemaValidityLocatorFunc) (void *ctx, + const char **file, unsigned long *line); + /* * Interfaces for parsing. */ -XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL +XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL xmlSchemaNewParserCtxt (const char *URL); -XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL +XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL xmlSchemaNewMemParserCtxt (const char *buffer, int size); XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL xmlSchemaNewDocParserCtxt (xmlDocPtr doc); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, xmlSchemaValidityErrorFunc err, xmlSchemaValidityWarningFunc warn, @@ -125,19 +160,19 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt); -XMLPUBFUN xmlSchemaPtr XMLCALL +XMLPUBFUN xmlSchemaPtr XMLCALL xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaFree (xmlSchemaPtr schema); #ifdef LIBXML_OUTPUT_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaDump (FILE *output, xmlSchemaPtr schema); #endif /* LIBXML_OUTPUT_ENABLED */ /* * Interfaces for validating */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, xmlSchemaValidityErrorFunc err, xmlSchemaValidityWarningFunc warn, @@ -154,14 +189,17 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt, int options); +XMLPUBFUN void XMLCALL + xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, + const char *filename); XMLPUBFUN int XMLCALL xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt); -XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL +XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL xmlSchemaNewValidCtxt (xmlSchemaPtr schema); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, xmlDocPtr instance); XMLPUBFUN int XMLCALL @@ -178,8 +216,11 @@ XMLPUBFUN int XMLCALL const char * filename, int options); +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt); + /* - * Interface to insert Schemas SAX velidation in a SAX stream + * Interface to insert Schemas SAX validation in a SAX stream */ typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct; typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr; @@ -190,6 +231,13 @@ XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL void **user_data); XMLPUBFUN int XMLCALL xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug); + + +XMLPUBFUN void XMLCALL + xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt, + xmlSchemaValidityLocatorFunc f, + void *ctxt); + #ifdef __cplusplus } #endif diff --git a/gnulib-local/lib/libxml/xmlschemastypes.c b/gnulib-local/lib/libxml/xmlschemastypes.c index a35c539..ff64f50 100644 --- a/gnulib-local/lib/libxml/xmlschemastypes.c +++ b/gnulib-local/lib/libxml/xmlschemastypes.c @@ -40,7 +40,7 @@ extern double xmlXPathPINF; extern double xmlXPathNINF; #endif -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); @@ -75,7 +75,7 @@ typedef struct _xmlSchemaValDuration xmlSchemaValDuration; typedef xmlSchemaValDuration *xmlSchemaValDurationPtr; struct _xmlSchemaValDuration { long mon; /* mon stores years also */ - long day; + long day; double sec; /* sec stores min and hour also */ }; @@ -189,7 +189,7 @@ static xmlSchemaTypePtr xmlSchemaTypeNmtokensDef = NULL; /************************************************************************ * * - * Datatype error handlers * + * Datatype error handlers * * * ************************************************************************/ /** @@ -206,7 +206,7 @@ xmlSchemaTypeErrMemory(xmlNodePtr node, const char *extra) /************************************************************************ * * - * Base types support * + * Base types support * * * ************************************************************************/ @@ -242,6 +242,10 @@ xmlSchemaNewMinLengthFacet(int value) } ret->type = XML_SCHEMA_FACET_MINLENGTH; ret->val = xmlSchemaNewValue(XML_SCHEMAS_NNINTEGER); + if (ret->val == NULL) { + xmlFree(ret); + return(NULL); + } ret->val->value.decimal.lo = value; return (ret); } @@ -254,7 +258,7 @@ xmlSchemaNewMinLengthFacet(int value) * Initialize one primitive built-in type */ static xmlSchemaTypePtr -xmlSchemaInitBasicType(const char *name, xmlSchemaValType type, +xmlSchemaInitBasicType(const char *name, xmlSchemaValType type, xmlSchemaTypePtr baseType) { xmlSchemaTypePtr ret; @@ -267,31 +271,31 @@ xmlSchemaInitBasicType(const char *name, xmlSchemaValType type, ret->name = (const xmlChar *)name; ret->targetNamespace = XML_SCHEMAS_NAMESPACE_NAME; ret->type = XML_SCHEMA_TYPE_BASIC; - ret->baseType = baseType; + ret->baseType = baseType; ret->contentType = XML_SCHEMA_CONTENT_BASIC; /* * Primitive types. */ - switch (type) { - case XML_SCHEMAS_STRING: - case XML_SCHEMAS_DECIMAL: - case XML_SCHEMAS_DATE: - case XML_SCHEMAS_DATETIME: - case XML_SCHEMAS_TIME: - case XML_SCHEMAS_GYEAR: - case XML_SCHEMAS_GYEARMONTH: - case XML_SCHEMAS_GMONTH: - case XML_SCHEMAS_GMONTHDAY: - case XML_SCHEMAS_GDAY: - case XML_SCHEMAS_DURATION: - case XML_SCHEMAS_FLOAT: - case XML_SCHEMAS_DOUBLE: - case XML_SCHEMAS_BOOLEAN: - case XML_SCHEMAS_ANYURI: - case XML_SCHEMAS_HEXBINARY: - case XML_SCHEMAS_BASE64BINARY: - case XML_SCHEMAS_QNAME: - case XML_SCHEMAS_NOTATION: + switch (type) { + case XML_SCHEMAS_STRING: + case XML_SCHEMAS_DECIMAL: + case XML_SCHEMAS_DATE: + case XML_SCHEMAS_DATETIME: + case XML_SCHEMAS_TIME: + case XML_SCHEMAS_GYEAR: + case XML_SCHEMAS_GYEARMONTH: + case XML_SCHEMAS_GMONTH: + case XML_SCHEMAS_GMONTHDAY: + case XML_SCHEMAS_GDAY: + case XML_SCHEMAS_DURATION: + case XML_SCHEMAS_FLOAT: + case XML_SCHEMAS_DOUBLE: + case XML_SCHEMAS_BOOLEAN: + case XML_SCHEMAS_ANYURI: + case XML_SCHEMAS_HEXBINARY: + case XML_SCHEMAS_BASE64BINARY: + case XML_SCHEMAS_QNAME: + case XML_SCHEMAS_NOTATION: ret->flags |= XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE; break; default: @@ -309,7 +313,7 @@ xmlSchemaInitBasicType(const char *name, xmlSchemaValType type, case XML_SCHEMAS_ENTITIES: ret->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST; ret->facets = xmlSchemaNewMinLengthFacet(1); - ret->flags |= XML_SCHEMAS_TYPE_HAS_FACETS; + ret->flags |= XML_SCHEMAS_TYPE_HAS_FACETS; break; default: ret->flags |= XML_SCHEMAS_TYPE_VARIETY_ATOMIC; @@ -390,19 +394,19 @@ xmlSchemaInitTypes(void) return; xmlSchemaTypesBank = xmlHashCreate(40); - + /* * 3.4.7 Built-in Complex Type Definition */ xmlSchemaTypeAnyTypeDef = xmlSchemaInitBasicType("anyType", - XML_SCHEMAS_ANYTYPE, + XML_SCHEMAS_ANYTYPE, NULL); xmlSchemaTypeAnyTypeDef->baseType = xmlSchemaTypeAnyTypeDef; xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED; /* * Init the content type. */ - xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED; + xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED; { xmlSchemaParticlePtr particle; xmlSchemaModelGroupPtr sequence; @@ -420,7 +424,7 @@ xmlSchemaInitTypes(void) return; } memset(sequence, 0, sizeof(xmlSchemaModelGroup)); - sequence->type = XML_SCHEMA_TYPE_SEQUENCE; + sequence->type = XML_SCHEMA_TYPE_SEQUENCE; particle->children = (xmlSchemaTreeItemPtr) sequence; /* Second particle. */ particle = xmlSchemaAddParticle(); @@ -437,9 +441,9 @@ xmlSchemaInitTypes(void) } memset(wild, 0, sizeof(xmlSchemaWildcard)); wild->type = XML_SCHEMA_TYPE_ANY; - wild->any = 1; - wild->processContents = XML_SCHEMAS_ANY_LAX; - particle->children = (xmlSchemaTreeItemPtr) wild; + wild->any = 1; + wild->processContents = XML_SCHEMAS_ANY_LAX; + particle->children = (xmlSchemaTreeItemPtr) wild; /* * Create the attribute wildcard. */ @@ -451,10 +455,10 @@ xmlSchemaInitTypes(void) } memset(wild, 0, sizeof(xmlSchemaWildcard)); wild->any = 1; - wild->processContents = XML_SCHEMAS_ANY_LAX; + wild->processContents = XML_SCHEMAS_ANY_LAX; xmlSchemaTypeAnyTypeDef->attributeWildcard = wild; } - xmlSchemaTypeAnySimpleTypeDef = xmlSchemaInitBasicType("anySimpleType", + xmlSchemaTypeAnySimpleTypeDef = xmlSchemaInitBasicType("anySimpleType", XML_SCHEMAS_ANYSIMPLETYPE, xmlSchemaTypeAnyTypeDef); /* @@ -513,7 +517,7 @@ xmlSchemaInitTypes(void) xmlSchemaTypeAnySimpleTypeDef); xmlSchemaTypeNotationDef = xmlSchemaInitBasicType("NOTATION", XML_SCHEMAS_NOTATION, - xmlSchemaTypeAnySimpleTypeDef); + xmlSchemaTypeAnySimpleTypeDef); xmlSchemaTypeQNameDef = xmlSchemaInitBasicType("QName", XML_SCHEMAS_QNAME, xmlSchemaTypeAnySimpleTypeDef); @@ -583,7 +587,7 @@ xmlSchemaInitTypes(void) xmlSchemaTypeNCNameDef); xmlSchemaTypeIdrefDef = xmlSchemaInitBasicType("IDREF", XML_SCHEMAS_IDREF, - xmlSchemaTypeNCNameDef); + xmlSchemaTypeNCNameDef); xmlSchemaTypeEntityDef = xmlSchemaInitBasicType("ENTITY", XML_SCHEMAS_ENTITY, xmlSchemaTypeNCNameDef); @@ -615,7 +619,7 @@ xmlSchemaInitTypes(void) * * Cleanup the default XML Schemas type library */ -void +void xmlSchemaCleanupTypes(void) { if (xmlSchemaTypesInitialized == 0) return; @@ -629,13 +633,13 @@ xmlSchemaCleanupTypes(void) { /* Content type. */ particle = (xmlSchemaParticlePtr) xmlSchemaTypeAnyTypeDef->subtypes; /* Wildcard. */ - xmlSchemaFreeWildcard((xmlSchemaWildcardPtr) + xmlSchemaFreeWildcard((xmlSchemaWildcardPtr) particle->children->children->children); xmlFree((xmlSchemaParticlePtr) particle->children->children); /* Sequence model group. */ xmlFree((xmlSchemaModelGroupPtr) particle->children); xmlFree((xmlSchemaParticlePtr) particle); - xmlSchemaTypeAnyTypeDef->subtypes = NULL; + xmlSchemaTypeAnyTypeDef->subtypes = NULL; } xmlHashFree(xmlSchemaTypesBank, (xmlHashDeallocator) xmlSchemaFreeType); xmlSchemaTypesInitialized = 0; @@ -665,12 +669,12 @@ xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int facetType) (facetType == XML_SCHEMA_FACET_WHITESPACE)) return (1); else - return (0); + return (0); case XML_SCHEMAS_STRING: case XML_SCHEMAS_NOTATION: case XML_SCHEMAS_QNAME: - case XML_SCHEMAS_ANYURI: - case XML_SCHEMAS_BASE64BINARY: + case XML_SCHEMAS_ANYURI: + case XML_SCHEMAS_BASE64BINARY: case XML_SCHEMAS_HEXBINARY: if ((facetType == XML_SCHEMA_FACET_LENGTH) || (facetType == XML_SCHEMA_FACET_MINLENGTH) || @@ -693,12 +697,12 @@ xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int facetType) (facetType == XML_SCHEMA_FACET_MINEXCLUSIVE)) return (1); else - return (0); + return (0); case XML_SCHEMAS_TIME: - case XML_SCHEMAS_GDAY: + case XML_SCHEMAS_GDAY: case XML_SCHEMAS_GMONTH: - case XML_SCHEMAS_GMONTHDAY: - case XML_SCHEMAS_GYEAR: + case XML_SCHEMAS_GMONTHDAY: + case XML_SCHEMAS_GYEAR: case XML_SCHEMAS_GYEARMONTH: case XML_SCHEMAS_DATE: case XML_SCHEMAS_DATETIME: @@ -714,7 +718,7 @@ xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int facetType) (facetType == XML_SCHEMA_FACET_MINEXCLUSIVE)) return (1); else - return (0); + return (0); default: break; } @@ -736,7 +740,7 @@ xmlSchemaGetBuiltInType(xmlSchemaValType type) if (xmlSchemaTypesInitialized == 0) xmlSchemaInitTypes(); switch (type) { - + case XML_SCHEMAS_ANYSIMPLETYPE: return (xmlSchemaTypeAnySimpleTypeDef); case XML_SCHEMAS_STRING: @@ -752,7 +756,7 @@ xmlSchemaGetBuiltInType(xmlSchemaValType type) case XML_SCHEMAS_GMONTH: return (xmlSchemaTypeGMonthDef); case XML_SCHEMAS_GMONTHDAY: - return (xmlSchemaTypeGMonthDayDef); + return (xmlSchemaTypeGMonthDayDef); case XML_SCHEMAS_GYEAR: return (xmlSchemaTypeGYearDef); case XML_SCHEMAS_GYEARMONTH: @@ -828,7 +832,7 @@ xmlSchemaGetBuiltInType(xmlSchemaValType type) case XML_SCHEMAS_BASE64BINARY: return (xmlSchemaTypeBase64BinaryDef); case XML_SCHEMAS_ANYTYPE: - return (xmlSchemaTypeAnyTypeDef); + return (xmlSchemaTypeAnyTypeDef); default: return (NULL); } @@ -880,7 +884,7 @@ xmlSchemaValueGetNext(xmlSchemaValPtr cur) { */ const xmlChar * xmlSchemaValueGetAsString(xmlSchemaValPtr val) -{ +{ if (val == NULL) return (NULL); switch (val->type) { @@ -913,7 +917,7 @@ xmlSchemaValueGetAsString(xmlSchemaValPtr val) */ int xmlSchemaValueGetAsBoolean(xmlSchemaValPtr val) -{ +{ if ((val == NULL) || (val->type != XML_SCHEMAS_BOOLEAN)) return (0); return (val->value.b); @@ -924,8 +928,8 @@ xmlSchemaValueGetAsBoolean(xmlSchemaValPtr val) * @type: the value type * @value: the value * - * Allocate a new simple type value. The type can be - * of XML_SCHEMAS_STRING. + * Allocate a new simple type value. The type can be + * of XML_SCHEMAS_STRING. * WARNING: This one is intended to be expanded for other * string based types. We need this for anySimpleType as well. * The given value is consumed and freed with the struct. @@ -1007,11 +1011,11 @@ xmlSchemaNewQNameValue(const xmlChar *namespaceName, * * Cleanup the default XML Schemas type library */ -void +void xmlSchemaFreeValue(xmlSchemaValPtr value) { xmlSchemaValPtr prev; - while (value != NULL) { + while (value != NULL) { switch (value->type) { case XML_SCHEMAS_STRING: case XML_SCHEMAS_NORMSTRING: @@ -1025,7 +1029,7 @@ xmlSchemaFreeValue(xmlSchemaValPtr value) { case XML_SCHEMAS_IDREF: case XML_SCHEMAS_IDREFS: case XML_SCHEMAS_ENTITY: - case XML_SCHEMAS_ENTITIES: + case XML_SCHEMAS_ENTITIES: case XML_SCHEMAS_ANYURI: case XML_SCHEMAS_ANYSIMPLETYPE: if (value->value.str != NULL) @@ -1052,7 +1056,7 @@ xmlSchemaFreeValue(xmlSchemaValPtr value) { prev = value; value = value->next; xmlFree(prev); - } + } } /** @@ -1088,9 +1092,9 @@ xmlSchemaGetBuiltInListSimpleTypeItemType(xmlSchemaTypePtr type) if ((type == NULL) || (type->type != XML_SCHEMA_TYPE_BASIC)) return (NULL); switch (type->builtInType) { - case XML_SCHEMAS_NMTOKENS: + case XML_SCHEMAS_NMTOKENS: return (xmlSchemaTypeNmtokenDef ); - case XML_SCHEMAS_IDREFS: + case XML_SCHEMAS_IDREFS: return (xmlSchemaTypeIdrefDef); case XML_SCHEMAS_ENTITIES: return (xmlSchemaTypeEntityDef); @@ -1342,13 +1346,13 @@ _xmlSchemaParseGDay (xmlSchemaValDatePtr dt, const xmlChar **str) { */ static int _xmlSchemaParseTime (xmlSchemaValDatePtr dt, const xmlChar **str) { - const xmlChar *cur = *str; + const xmlChar *cur = *str; int ret = 0; int value = 0; PARSE_2_DIGITS(value, cur, ret); if (ret != 0) - return ret; + return ret; if (*cur != ':') return 1; if (!VALID_HOUR(value)) @@ -1614,7 +1618,7 @@ xmlSchemaValidateDates (xmlSchemaValType type, const xmlChar *rewnd = cur; cur++; - ret = _xmlSchemaParseGDay(&(dt->value.date), &cur); + ret = _xmlSchemaParseGDay(&(dt->value.date), &cur); if ((ret == 0) && ((*cur == 0) || (*cur != ':'))) { /* @@ -1852,7 +1856,7 @@ xmlSchemaValidateDuration (xmlSchemaTypePtr type ATTRIBUTE_UNUSED, } cur++; if (collapse) - while IS_WSP_BLANK_CH(*cur) cur++; + while IS_WSP_BLANK_CH(*cur) cur++; } if (isneg) { @@ -1908,13 +1912,13 @@ xmlSchemaStrip(const xmlChar *value) { */ xmlChar * xmlSchemaWhiteSpaceReplace(const xmlChar *value) { - const xmlChar *cur = value; - xmlChar *ret = NULL, *mcur; + const xmlChar *cur = value; + xmlChar *ret = NULL, *mcur; - if (value == NULL) + if (value == NULL) return(NULL); - - while ((*cur != 0) && + + while ((*cur != 0) && (((*cur) != 0xd) && ((*cur) != 0x9) && ((*cur) != 0xa))) { cur++; } @@ -1927,7 +1931,7 @@ xmlSchemaWhiteSpaceReplace(const xmlChar *value) { if ( ((*mcur) == 0xd) || ((*mcur) == 0x9) || ((*mcur) == 0xa) ) *mcur = ' '; mcur++; - } while (*mcur != 0); + } while (*mcur != 0); return(ret); } @@ -2063,7 +2067,7 @@ xmlSchemaValAtomicListNode(xmlSchemaTypePtr type, const xmlChar *value, * Parse an unsigned long into 3 fields. * * Returns the number of significant digits in the number or - * -1 if overflow of the capacity + * -1 if overflow of the capacity and -2 if it's not a number. */ static int xmlSchemaParseUInt(const xmlChar **str, unsigned long *llo, @@ -2072,6 +2076,9 @@ xmlSchemaParseUInt(const xmlChar **str, unsigned long *llo, const xmlChar *tmp, *cur = *str; int ret = 0, i = 0; + if (!((*cur >= '0') && (*cur <= '9'))) + return(-2); + while (*cur == '0') { /* ignore leading zeroes */ cur++; } @@ -2145,7 +2152,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, if ((flags == 0) && (value != NULL)) { if ((type->builtInType != XML_SCHEMAS_STRING) && - (type->builtInType != XML_SCHEMAS_ANYTYPE) && + (type->builtInType != XML_SCHEMAS_ANYTYPE) && (type->builtInType != XML_SCHEMAS_ANYSIMPLETYPE)) { if (type->builtInType == XML_SCHEMAS_NORMSTRING) norm = xmlSchemaWhiteSpaceReplace(value); @@ -2157,7 +2164,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, } switch (type->builtInType) { - case XML_SCHEMAS_UNKNOWN: + case XML_SCHEMAS_UNKNOWN: goto error; case XML_SCHEMAS_ANYTYPE: case XML_SCHEMAS_ANYSIMPLETYPE: @@ -2168,10 +2175,10 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, *val = v; } else { goto error; - } + } } goto return0; - case XML_SCHEMAS_STRING: + case XML_SCHEMAS_STRING: if (! normOnTheFly) { const xmlChar *cur = value; @@ -2250,7 +2257,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, const xmlChar *cur = value; unsigned int len, neg, integ, hasLeadingZeroes; xmlChar cval[25]; - xmlChar *cptr = cval; + xmlChar *cptr = cval; if ((cur == NULL) || (*cur == 0)) goto return1; @@ -2324,10 +2331,10 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, v = xmlSchemaNewValue(XML_SCHEMAS_DECIMAL); if (v != NULL) { /* - * Now evaluate the significant digits of the number - */ + * Now evaluate the significant digits of the number + */ if (len != 0) { - + if (integ != ~0u) { /* * Get rid of trailing zeroes in the @@ -2342,9 +2349,9 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, * Terminate the (preparsed) string. */ if (len != 0) { - *cptr = 0; + *cptr = 0; cptr = cval; - + xmlSchemaParseUInt((const xmlChar **)&cptr, &v->value.decimal.lo, &v->value.decimal.mi, @@ -2386,9 +2393,11 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, normOnTheFly); break; case XML_SCHEMAS_FLOAT: - case XML_SCHEMAS_DOUBLE:{ + case XML_SCHEMAS_DOUBLE: { const xmlChar *cur = value; int neg = 0; + int digits_before = 0; + int digits_after = 0; if (normOnTheFly) while IS_WSP_BLANK_CH(*cur) cur++; @@ -2461,12 +2470,17 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, goto return1; while ((*cur >= '0') && (*cur <= '9')) { cur++; + digits_before++; } if (*cur == '.') { cur++; - while ((*cur >= '0') && (*cur <= '9')) + while ((*cur >= '0') && (*cur <= '9')) { cur++; + digits_after++; + } } + if ((digits_before == 0) && (digits_after == 0)) + goto return1; if ((*cur == 'e') || (*cur == 'E')) { cur++; if ((*cur == '-') || (*cur == '+')) @@ -2594,8 +2608,8 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, } else { cur++; } - } - } + } + } if (val != NULL) { v = xmlSchemaNewValue(XML_SCHEMAS_TOKEN); if (v != NULL) { @@ -2608,7 +2622,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, goto return0; } case XML_SCHEMAS_LANGUAGE: - if (normOnTheFly) { + if (normOnTheFly) { norm = xmlSchemaCollapseString(value); if (norm != NULL) value = norm; @@ -2893,15 +2907,26 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, } goto done; } - case XML_SCHEMAS_ANYURI:{ + case XML_SCHEMAS_ANYURI:{ if (*value != 0) { xmlURIPtr uri; - if (normOnTheFly) { + xmlChar *tmpval, *cur; + if (normOnTheFly) { norm = xmlSchemaCollapseString(value); if (norm != NULL) value = norm; } - uri = xmlParseURI((const char *) value); + tmpval = xmlStrdup(value); + for (cur = tmpval; *cur; ++cur) { + if (*cur < 32 || *cur >= 127 || *cur == ' ' || + *cur == '<' || *cur == '>' || *cur == '"' || + *cur == '{' || *cur == '}' || *cur == '|' || + *cur == '\\' || *cur == '^' || *cur == '`' || + *cur == '\'') + *cur = '_'; + } + uri = xmlParseURI((const char *) tmpval); + xmlFree(tmpval); if (uri == NULL) goto return1; xmlFreeURI(uri); @@ -2975,12 +3000,12 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, } case XML_SCHEMAS_BASE64BINARY:{ /* ISSUE: - * + * * Ignore all stray characters? (yes, currently) * Worry about long lines? (no, currently) - * + * * rfc2045.txt: - * + * * "The encoded output stream must be represented in lines of * no more than 76 characters each. All line breaks or other * characters not found in Table 1 must be ignored by decoding @@ -3116,7 +3141,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, } else if (*cur == '+') cur++; ret = xmlSchemaParseUInt(&cur, &lo, &mi, &hi); - if (ret == -1) + if (ret < 0) goto return1; if (normOnTheFly) while IS_WSP_BLANK_CH(*cur) cur++; @@ -3161,7 +3186,7 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value, case XML_SCHEMAS_BYTE: case XML_SCHEMAS_SHORT: case XML_SCHEMAS_INT:{ - const xmlChar *cur = value; + const xmlChar *cur = value; unsigned long lo, mi, hi; int sign = 0; @@ -3391,7 +3416,7 @@ xmlSchemaCompareDecimals(xmlSchemaValPtr x, xmlSchemaValPtr y) /* * First test: If x is -ve and not zero */ - if ((x->value.decimal.sign) && + if ((x->value.decimal.sign) && ((x->value.decimal.lo != 0) || (x->value.decimal.mi != 0) || (x->value.decimal.hi != 0))) { @@ -3548,8 +3573,8 @@ xmlSchemaCompareDurations(xmlSchemaValPtr x, xmlSchemaValPtr y) /* seconds */ sec = x->value.dur.sec - y->value.dur.sec; - carry = (long)sec / SECS_PER_DAY; - sec -= (double)(carry * SECS_PER_DAY); + carry = (long)(sec / SECS_PER_DAY); + sec -= ((double)carry) * SECS_PER_DAY; /* days */ day = x->value.dur.day - y->value.dur.day + carry; @@ -3632,7 +3657,7 @@ xmlSchemaDupVal (xmlSchemaValPtr v) xmlSchemaValPtr ret = xmlSchemaNewValue(v->type); if (ret == NULL) return NULL; - + memcpy(ret, v, sizeof(xmlSchemaVal)); ret->next = NULL; return ret; @@ -3678,7 +3703,7 @@ xmlSchemaCopyValue(xmlSchemaValPtr val) if (val->value.str != NULL) cur->value.str = xmlStrdup(BAD_CAST val->value.str); break; - case XML_SCHEMAS_QNAME: + case XML_SCHEMAS_QNAME: case XML_SCHEMAS_NOTATION: cur = xmlSchemaDupVal(val); if (val->value.qname.name != NULL) @@ -3820,16 +3845,17 @@ _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr dur) if (tyr == 0) tyr--; /* - * Coverity detected an overrun in daysInMonth + * Coverity detected an overrun in daysInMonth * of size 12 at position 12 with index variable "((r)->mon - 1)" */ - if (tmon < 0) - tmon = 0; + if (tmon < 1) + tmon = 1; if (tmon > 12) tmon = 12; tempdays += MAX_DAYINMONTH(tyr, tmon); carry = -1; - } else if (tempdays > (long) MAX_DAYINMONTH(r->year, r->mon)) { + } else if (VALID_YEAR(r->year) && VALID_MONTH(r->mon) && + tempdays > (long) MAX_DAYINMONTH(r->year, r->mon)) { tempdays = tempdays - MAX_DAYINMONTH(r->year, r->mon); carry = 1; } else @@ -3845,7 +3871,7 @@ _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr dur) r->year++; } } - + r->day = tempdays; /* @@ -3910,7 +3936,7 @@ xmlSchemaDateNormalize (xmlSchemaValPtr dt, double offset) * _xmlSchemaDateCastYMToDays: * @dt: an #xmlSchemaValPtr * - * Convert mon and year of @dt to total number of days. Take the + * Convert mon and year of @dt to total number of days. Take the * number of years since (or before) 1 AD and add the number of leap * years. This is a function because negative * years must be handled a little differently and there is no zero year. @@ -4090,7 +4116,7 @@ xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaValPtr y) ret = -1; else if (sec > 0.0) ret = 1; - + } xmlSchemaFreeValue(p1); xmlSchemaFreeValue(q1); @@ -4231,7 +4257,7 @@ xmlSchemaComparePreserveReplaceStrings(const xmlChar *x, int invert) { int tmp; - + while ((*x != 0) && (*y != 0)) { if (IS_WSP_REPLACE_CH(*y)) { if (! IS_WSP_SPACE_CH(*x)) { @@ -4246,7 +4272,7 @@ xmlSchemaComparePreserveReplaceStrings(const xmlChar *x, else return(1); } - } + } } else { tmp = *x - *y; if (tmp < 0) { @@ -4300,7 +4326,7 @@ xmlSchemaComparePreserveCollapseStrings(const xmlChar *x, { int tmp; - /* + /* * Skip leading blank chars of the collapsed string. */ while IS_WSP_BLANK_CH(*y) @@ -4389,12 +4415,12 @@ xmlSchemaCompareReplaceCollapseStrings(const xmlChar *x, { int tmp; - /* + /* * Skip leading blank chars of the collapsed string. */ while IS_WSP_BLANK_CH(*y) y++; - + while ((*x != 0) && (*y != 0)) { if IS_WSP_BLANK_CH(*y) { if (! IS_WSP_BLANK_CH(*x)) { @@ -4414,8 +4440,8 @@ xmlSchemaCompareReplaceCollapseStrings(const xmlChar *x, } } x++; - y++; - /* + y++; + /* * Skip contiguous blank chars of the collapsed string. */ while IS_WSP_BLANK_CH(*y) @@ -4449,7 +4475,7 @@ xmlSchemaCompareReplaceCollapseStrings(const xmlChar *x, return(-1); else return(1); - } + } if (*y != 0) { /* * Skip trailing blank chars of the collapsed string. @@ -4482,27 +4508,27 @@ xmlSchemaCompareReplacedStrings(const xmlChar *x, const xmlChar *y) { int tmp; - + while ((*x != 0) && (*y != 0)) { if IS_WSP_BLANK_CH(*y) { if (! IS_WSP_BLANK_CH(*x)) { if ((*x - 0x20) < 0) - return(-1); + return(-1); else return(1); - } + } } else { if IS_WSP_BLANK_CH(*x) { if ((0x20 - *y) < 0) - return(-1); + return(-1); else return(1); } tmp = *x - *y; if (tmp < 0) - return(-1); + return(-1); if (tmp > 0) - return(1); + return(1); } x++; y++; @@ -4528,7 +4554,7 @@ static int xmlSchemaCompareNormStrings(const xmlChar *x, const xmlChar *y) { int tmp; - + while (IS_BLANK_CH(*x)) x++; while (IS_BLANK_CH(*y)) y++; while ((*x != 0) && (*y != 0)) { @@ -4721,13 +4747,13 @@ xmlSchemaCompareValuesInternal(xmlSchemaValType xtype, (ytype == XML_SCHEMAS_GYEARMONTH)) return (xmlSchemaCompareDates(x, y)); return (-2); - /* + /* * Note that we will support comparison of string types against * anySimpleType as well. */ case XML_SCHEMAS_ANYSIMPLETYPE: case XML_SCHEMAS_STRING: - case XML_SCHEMAS_NORMSTRING: + case XML_SCHEMAS_NORMSTRING: case XML_SCHEMAS_TOKEN: case XML_SCHEMAS_LANGUAGE: case XML_SCHEMAS_NMTOKEN: @@ -4751,10 +4777,10 @@ xmlSchemaCompareValuesInternal(xmlSchemaValType xtype, /* * TODO: Compare those against QName. */ - if (ytype == XML_SCHEMAS_QNAME) { + if (ytype == XML_SCHEMAS_QNAME) { TODO if (y == NULL) - return(-2); + return(-2); return (-2); } if ((ytype == XML_SCHEMAS_ANYSIMPLETYPE) || @@ -4776,7 +4802,7 @@ xmlSchemaCompareValuesInternal(xmlSchemaValType xtype, /* TODO: What about x < y or x > y. */ if (xmlStrEqual(xv, yv)) return (0); - else + else return (2); } else if (yws == XML_SCHEMA_WHITESPACE_REPLACE) return (xmlSchemaComparePreserveReplaceStrings(xv, yv, 0)); @@ -4802,7 +4828,7 @@ xmlSchemaCompareValuesInternal(xmlSchemaValType xtype, return (xmlSchemaCompareNormStrings(xv, yv)); } else return (-2); - + } return (-2); } @@ -4873,7 +4899,7 @@ xmlSchemaCompareValuesInternal(xmlSchemaValType xtype, else return(-1); } - return (-2); + return (-2); case XML_SCHEMAS_IDREFS: case XML_SCHEMAS_ENTITIES: case XML_SCHEMAS_NMTOKENS: @@ -4908,7 +4934,7 @@ xmlSchemaCompareValues(xmlSchemaValPtr x, xmlSchemaValPtr y) { if (y->type == XML_SCHEMAS_STRING) yws = XML_SCHEMA_WHITESPACE_PRESERVE; - else if (x->type == XML_SCHEMAS_NORMSTRING) + else if (y->type == XML_SCHEMAS_NORMSTRING) yws = XML_SCHEMA_WHITESPACE_REPLACE; else yws = XML_SCHEMA_WHITESPACE_COLLAPSE; @@ -5061,7 +5087,7 @@ xmlSchemaValidateListSimpleTypeFacet(xmlSchemaFacetPtr facet, if (expectedLen != NULL) *expectedLen = facet->val->value.decimal.lo; return (XML_SCHEMAV_CVC_LENGTH_VALID); - } + } } else if (facet->type == XML_SCHEMA_FACET_MINLENGTH) { if (actualLen < facet->val->value.decimal.lo) { if (expectedLen != NULL) @@ -5075,12 +5101,12 @@ xmlSchemaValidateListSimpleTypeFacet(xmlSchemaFacetPtr facet, return (XML_SCHEMAV_CVC_MAXLENGTH_VALID); } } else - /* - * NOTE: That we can pass NULL as xmlSchemaValPtr to + /* + * NOTE: That we can pass NULL as xmlSchemaValPtr to * xmlSchemaValidateFacet, since the remaining facet types - * are: XML_SCHEMA_FACET_PATTERN, XML_SCHEMA_FACET_ENUMERATION. + * are: XML_SCHEMA_FACET_PATTERN, XML_SCHEMA_FACET_ENUMERATION. */ - return(xmlSchemaValidateFacet(NULL, facet, value, NULL)); + return(xmlSchemaValidateFacet(NULL, facet, value, NULL)); return (0); } @@ -5093,7 +5119,7 @@ xmlSchemaValidateListSimpleTypeFacet(xmlSchemaFacetPtr facet, * @ws: the whitespace type of the value * @length: the actual length of the value * - * Checka a value against a "length", "minLength" and "maxLength" + * Checka a value against a "length", "minLength" and "maxLength" * facet; sets @length to the computed length of @value. * * Returns 0 if the value is valid, a positive error code @@ -5101,11 +5127,11 @@ xmlSchemaValidateListSimpleTypeFacet(xmlSchemaFacetPtr facet, */ static int xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr facet, - xmlSchemaTypeType valType, + xmlSchemaValType valType, const xmlChar *value, - xmlSchemaValPtr val, + xmlSchemaValPtr val, unsigned long *length, - xmlSchemaWhitespaceValueType ws) + xmlSchemaWhitespaceValueType ws) { unsigned int len = 0; @@ -5116,7 +5142,7 @@ xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr facet, (facet->type != XML_SCHEMA_FACET_MAXLENGTH) && (facet->type != XML_SCHEMA_FACET_MINLENGTH)) return (-1); - + /* * TODO: length, maxLength and minLength must be of type * nonNegativeInteger only. Check if decimal is used somehow. @@ -5150,7 +5176,7 @@ xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr facet, if (ws == XML_SCHEMA_WHITESPACE_COLLAPSE) len = xmlSchemaNormLen(value); else - /* + /* * Should be OK for "preserve" as well. */ len = xmlUTF8Strlen(value); @@ -5162,7 +5188,7 @@ xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr facet, case XML_SCHEMAS_NMTOKEN: case XML_SCHEMAS_NAME: case XML_SCHEMAS_NCNAME: - case XML_SCHEMAS_ID: + case XML_SCHEMAS_ID: /* * FIXME: What exactly to do with anyURI? */ @@ -5171,11 +5197,11 @@ xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr facet, len = xmlSchemaNormLen(value); break; case XML_SCHEMAS_QNAME: - case XML_SCHEMAS_NOTATION: - /* + case XML_SCHEMAS_NOTATION: + /* * For QName and NOTATION, those facets are * deprecated and should be ignored. - */ + */ return (0); default: TODO @@ -5195,7 +5221,7 @@ xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr facet, if (len > facet->val->value.decimal.lo) return(XML_SCHEMAV_CVC_MAXLENGTH_VALID); } - + return (0); } @@ -5207,18 +5233,18 @@ xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr facet, * @val: the precomputed value * @length: the actual length of the value * - * Checka a value against a "length", "minLength" and "maxLength" + * Checka a value against a "length", "minLength" and "maxLength" * facet; sets @length to the computed length of @value. * * Returns 0 if the value is valid, a positive error code * otherwise and -1 in case of an internal or API error. */ int -xmlSchemaValidateLengthFacet(xmlSchemaTypePtr type, +xmlSchemaValidateLengthFacet(xmlSchemaTypePtr type, xmlSchemaFacetPtr facet, const xmlChar *value, xmlSchemaValPtr val, - unsigned long *length) + unsigned long *length) { if (type == NULL) return(-1); @@ -5228,7 +5254,7 @@ xmlSchemaValidateLengthFacet(xmlSchemaTypePtr type, } /** - * xmlSchemaValidateLengthFacetWhtsp: + * xmlSchemaValidateLengthFacetWhtsp: * @facet: the facet to check * @valType: the built-in type * @value: the lexical repr. of the value to be validated @@ -5236,7 +5262,7 @@ xmlSchemaValidateLengthFacet(xmlSchemaTypePtr type, * @ws: the whitespace type of the value * @length: the actual length of the value * - * Checka a value against a "length", "minLength" and "maxLength" + * Checka a value against a "length", "minLength" and "maxLength" * facet; sets @length to the computed length of @value. * * Returns 0 if the value is valid, a positive error code @@ -5271,7 +5297,7 @@ xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, static int xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet, xmlSchemaWhitespaceValueType fws, - xmlSchemaValType valType, + xmlSchemaValType valType, const xmlChar *value, xmlSchemaValPtr val, xmlSchemaWhitespaceValueType ws) @@ -5283,7 +5309,7 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet, switch (facet->type) { case XML_SCHEMA_FACET_PATTERN: - /* + /* * NOTE that for patterns, the @value needs to be the normalized * value, *not* the lexical initial value or the canonical value. */ @@ -5384,7 +5410,7 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet, else { switch (valType) { case XML_SCHEMAS_STRING: - case XML_SCHEMAS_NORMSTRING: + case XML_SCHEMAS_NORMSTRING: if (ws == XML_SCHEMA_WHITESPACE_UNKNOWN) { /* * This is to ensure API compatibility with the old @@ -5400,13 +5426,13 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet, if (ws == XML_SCHEMA_WHITESPACE_COLLAPSE) len = xmlSchemaNormLen(value); else - /* + /* * Should be OK for "preserve" as well. */ len = xmlUTF8Strlen(value); } break; - case XML_SCHEMAS_IDREF: + case XML_SCHEMAS_IDREF: case XML_SCHEMAS_TOKEN: case XML_SCHEMAS_LANGUAGE: case XML_SCHEMAS_NMTOKEN: @@ -5415,11 +5441,11 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet, case XML_SCHEMAS_ID: case XML_SCHEMAS_ANYURI: if (value != NULL) - len = xmlSchemaNormLen(value); - break; + len = xmlSchemaNormLen(value); + break; default: TODO - } + } } if (facet->type == XML_SCHEMA_FACET_LENGTH) { if (len != facet->val->value.decimal.lo) @@ -5529,7 +5555,7 @@ xmlSchemaValidateFacet(xmlSchemaTypePtr base, int xmlSchemaValidateFacetWhtsp(xmlSchemaFacetPtr facet, xmlSchemaWhitespaceValueType fws, - xmlSchemaValType valType, + xmlSchemaValType valType, const xmlChar *value, xmlSchemaValPtr val, xmlSchemaWhitespaceValueType ws) @@ -5590,13 +5616,13 @@ xmlSchemaFormatFloat(double number, char buffer[], int buffersize) /* * Result is in work, and after_fraction points * just past the fractional part. - * Use scientific notation + * Use scientific notation */ integer_place = DBL_DIG + EXPONENT_DIGITS + 1; fraction_place = DBL_DIG - 1; snprintf(work, sizeof(work),"%*.*e", integer_place, fraction_place, number); - after_fraction = strchr(work + DBL_DIG, 'e'); + after_fraction = strchr(work + DBL_DIG, 'e'); /* Remove fractional trailing zeroes */ ptr = after_fraction; while (*(--ptr) == '0') @@ -5623,12 +5649,12 @@ xmlSchemaFormatFloat(double number, char buffer[], int buffersize) * @val: the precomputed value * @retValue: the returned value * - * Get a the cononical lexical representation of the value. + * Get the canonical lexical representation of the value. * The caller has to FREE the returned retValue. * * WARNING: Some value types are not supported yet, resulting * in a @retValue of "???". - * + * * TODO: XML Schema 1.0 does not define canonical representations * for: duration, gYearMonth, gYear, gMonthDay, gMonth, gDay, * anyURI, QName, NOTATION. This will be fixed in XML Schema 1.1. @@ -5648,7 +5674,7 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) if (val->value.str == NULL) *retValue = BAD_CAST xmlStrdup(BAD_CAST ""); else - *retValue = + *retValue = BAD_CAST xmlStrdup((const xmlChar *) val->value.str); break; case XML_SCHEMAS_NORMSTRING: @@ -5665,7 +5691,7 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) case XML_SCHEMAS_TOKEN: case XML_SCHEMAS_LANGUAGE: case XML_SCHEMAS_NMTOKEN: - case XML_SCHEMAS_NAME: + case XML_SCHEMAS_NAME: case XML_SCHEMAS_NCNAME: case XML_SCHEMAS_ID: case XML_SCHEMAS_IDREF: @@ -5674,10 +5700,10 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) case XML_SCHEMAS_ANYURI: /* Unclear */ if (val->value.str == NULL) return (-1); - *retValue = + *retValue = BAD_CAST xmlSchemaCollapseString(BAD_CAST val->value.str); if (*retValue == NULL) - *retValue = + *retValue = BAD_CAST xmlStrdup((const xmlChar *) val->value.str); break; case XML_SCHEMAS_QNAME: @@ -5699,7 +5725,7 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) /* * TODO: Lookout for a more simple implementation. */ - if ((val->value.decimal.total == 1) && + if ((val->value.decimal.total == 1) && (val->value.decimal.lo == 0)) { *retValue = xmlStrdup(BAD_CAST "0.0"); } else { @@ -5733,7 +5759,7 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) else snprintf(offs, bufsize - (offs - buf), "%lu", dec.lo); - + if (dec.frac != 0) { if (dec.frac != dec.total) { int diff = dec.total - dec.frac; @@ -5746,7 +5772,7 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) unsigned int i = 0; /* * Insert missing zeroes behind the decimal point. - */ + */ while (*(offs + i) != 0) i++; if (i < dec.total) { @@ -5883,7 +5909,7 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) snprintf((char *) *retValue, 6, "---%02u", val->value.date.day); } - break; + break; case XML_SCHEMAS_GMONTHDAY: { /* TODO: Unclear in XML Schema 1.0 */ /* TODO: What to do with the timezone? */ @@ -5900,14 +5926,14 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) /* TODO: What to do with the timezone? */ if (val->value.date.year < 0) snprintf(buf, 35, "-%04ld-%02u", - labs(val->value.date.year), + labs(val->value.date.year), val->value.date.mon); else snprintf(buf, 35, "%04ld-%02u", val->value.date.year, val->value.date.mon); *retValue = BAD_CAST xmlStrdup(BAD_CAST buf); } - break; + break; case XML_SCHEMAS_TIME: { char buf[30]; @@ -5918,8 +5944,8 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) norm = xmlSchemaDateNormalize(val, 0); if (norm == NULL) return (-1); - /* - * TODO: Check if "%.14g" is portable. + /* + * TODO: Check if "%.14g" is portable. */ snprintf(buf, 30, "%02u:%02u:%02.14gZ", @@ -5935,7 +5961,7 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) val->value.date.sec); } *retValue = BAD_CAST xmlStrdup(BAD_CAST buf); - } + } break; case XML_SCHEMAS_DATE: { @@ -5963,7 +5989,7 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) val->value.date.day); } *retValue = BAD_CAST xmlStrdup(BAD_CAST buf); - } + } break; case XML_SCHEMAS_DATETIME: { @@ -6007,8 +6033,8 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) *retValue = BAD_CAST xmlStrdup(BAD_CAST val->value.base64.str); break; case XML_SCHEMAS_FLOAT: { - char buf[30]; - /* + char buf[30]; + /* * |m| < 16777216, -149 <= e <= 104. * TODO: Handle, NaN, INF, -INF. The format is not * yet conformant. The c type float does not cover @@ -6029,7 +6055,7 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) snprintf(buf, 40, "%01.14e", val->value.d); *retValue = BAD_CAST xmlStrdup(BAD_CAST buf); } - break; + break; default: *retValue = BAD_CAST xmlStrdup(BAD_CAST "???"); return (1); @@ -6045,7 +6071,7 @@ xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlChar **retValue) * @retValue: the returned value * @ws: the whitespace type of the value * - * Get a the cononical representation of the value. + * Get the canonical representation of the value. * The caller has to free the returned @retValue. * * Returns 0 if the value could be built, 1 if the value type is @@ -6088,7 +6114,7 @@ xmlSchemaGetCanonValueWhtsp(xmlSchemaValPtr val, break; default: return (xmlSchemaGetCanonValue(val, retValue)); - } + } return (0); } diff --git a/gnulib-local/lib/libxml/xmlschemastypes.in.h b/gnulib-local/lib/libxml/xmlschemastypes.in.h index 9a3a7a1..35d48d4 100644 --- a/gnulib-local/lib/libxml/xmlschemastypes.in.h +++ b/gnulib-local/lib/libxml/xmlschemastypes.in.h @@ -30,23 +30,23 @@ typedef enum { XML_SCHEMA_WHITESPACE_COLLAPSE = 3 } xmlSchemaWhitespaceValueType; -XMLPUBFUN void XMLCALL - xmlSchemaInitTypes (void); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL + xmlSchemaInitTypes (void); +XMLPUBFUN void XMLCALL xmlSchemaCleanupTypes (void); -XMLPUBFUN xmlSchemaTypePtr XMLCALL +XMLPUBFUN xmlSchemaTypePtr XMLCALL xmlSchemaGetPredefinedType (const xmlChar *name, const xmlChar *ns); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, const xmlChar *value, xmlSchemaValPtr *val); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, const xmlChar *value, xmlSchemaValPtr *val, xmlNodePtr node); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaValidateFacet (xmlSchemaTypePtr base, xmlSchemaFacetPtr facet, const xmlChar *value, @@ -54,25 +54,25 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet, xmlSchemaWhitespaceValueType fws, - xmlSchemaValType valType, + xmlSchemaValType valType, const xmlChar *value, xmlSchemaValPtr val, xmlSchemaWhitespaceValueType ws); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaFreeValue (xmlSchemaValPtr val); -XMLPUBFUN xmlSchemaFacetPtr XMLCALL +XMLPUBFUN xmlSchemaFacetPtr XMLCALL xmlSchemaNewFacet (void); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, xmlSchemaTypePtr typeDecl, xmlSchemaParserCtxtPtr ctxt, const xmlChar *name); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlSchemaCompareValues (xmlSchemaValPtr x, xmlSchemaValPtr y); -XMLPUBFUN xmlSchemaTypePtr XMLCALL +XMLPUBFUN xmlSchemaTypePtr XMLCALL xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); XMLPUBFUN int XMLCALL xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet, @@ -82,7 +82,7 @@ XMLPUBFUN int XMLCALL XMLPUBFUN xmlSchemaTypePtr XMLCALL xmlSchemaGetBuiltInType (xmlSchemaValType type); XMLPUBFUN int XMLCALL - xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, + xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, int facetType); XMLPUBFUN xmlChar * XMLCALL xmlSchemaCollapseString (const xmlChar *value); @@ -91,7 +91,7 @@ XMLPUBFUN xmlChar * XMLCALL XMLPUBFUN unsigned long XMLCALL xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); XMLPUBFUN int XMLCALL - xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, + xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, xmlSchemaFacetPtr facet, const xmlChar *value, xmlSchemaValPtr val, @@ -100,19 +100,19 @@ XMLPUBFUN int XMLCALL xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, xmlSchemaValType valType, const xmlChar *value, - xmlSchemaValPtr val, + xmlSchemaValPtr val, unsigned long *length, xmlSchemaWhitespaceValueType ws); XMLPUBFUN int XMLCALL - xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, + xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, const xmlChar *value, - xmlSchemaValPtr *val, + xmlSchemaValPtr *val, xmlNodePtr node); XMLPUBFUN int XMLCALL xmlSchemaGetCanonValue (xmlSchemaValPtr val, const xmlChar **retValue); XMLPUBFUN int XMLCALL - xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, + xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, const xmlChar **retValue, xmlSchemaWhitespaceValueType ws); XMLPUBFUN int XMLCALL diff --git a/gnulib-local/lib/libxml/xmlstring.c b/gnulib-local/lib/libxml/xmlstring.c index 4f3b373..a37220d 100644 --- a/gnulib-local/lib/libxml/xmlstring.c +++ b/gnulib-local/lib/libxml/xmlstring.c @@ -3,7 +3,7 @@ * * This module provides various utility functions for manipulating * the xmlChar* type. All functions named xmlStr* have been moved here - * from the parser.c file (their original home). + * from the parser.c file (their original home). * * See Copyright for the status of this software. * @@ -40,7 +40,7 @@ xmlChar * xmlStrndup(const xmlChar *cur, int len) { xmlChar *ret; - + if ((cur == NULL) || (len < 0)) return(NULL); ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar)); if (ret == NULL) { @@ -85,7 +85,7 @@ xmlChar * xmlCharStrndup(const char *cur, int len) { int i; xmlChar *ret; - + if ((cur == NULL) || (len < 0)) return(NULL); ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar)); if (ret == NULL) { @@ -170,7 +170,7 @@ xmlStrEqual(const xmlChar *str1, const xmlChar *str2) { * @name: the localname of the QName * @str: the second xmlChar * * - * Check if a QName is Equal to a given string + * Check if a QName is Equal to a given string * * Returns 1 if they are equal, 0 if they are different */ @@ -340,7 +340,7 @@ xmlStrchr(const xmlChar *str, xmlChar val) { const xmlChar * xmlStrstr(const xmlChar *str, const xmlChar *val) { int n; - + if (str == NULL) return(NULL); if (val == NULL) return(NULL); n = xmlStrlen(val); @@ -366,9 +366,9 @@ xmlStrstr(const xmlChar *str, const xmlChar *val) { */ const xmlChar * -xmlStrcasestr(const xmlChar *str, xmlChar *val) { +xmlStrcasestr(const xmlChar *str, const xmlChar *val) { int n; - + if (str == NULL) return(NULL); if (val == NULL) return(NULL); n = xmlStrlen(val); @@ -396,7 +396,7 @@ xmlStrcasestr(const xmlChar *str, xmlChar *val) { xmlChar * xmlStrsub(const xmlChar *str, int start, int len) { int i; - + if (str == NULL) return(NULL); if (start < 0) return(NULL); if (len < 0) return(NULL); @@ -519,7 +519,7 @@ xmlStrcat(xmlChar *cur, const xmlChar *add) { const xmlChar *p = add; if (add == NULL) return(cur); - if (cur == NULL) + if (cur == NULL) return(xmlStrdup(add)); while (*p != 0) p++; /* non input consuming */ @@ -537,20 +537,20 @@ xmlStrcat(xmlChar *cur, const xmlChar *add) { * * Returns the number of characters written to @buf or -1 if an error occurs. */ -int XMLCDECL +int XMLCDECL xmlStrPrintf(xmlChar *buf, int len, const xmlChar *msg, ...) { va_list args; int ret; - + if((buf == NULL) || (msg == NULL)) { return(-1); } - + va_start(args, msg); ret = vsnprintf((char *) buf, len, (const char *) msg, args); va_end(args); buf[len - 1] = 0; /* be safe ! */ - + return(ret); } @@ -565,17 +565,17 @@ xmlStrPrintf(xmlChar *buf, int len, const xmlChar *msg, ...) { * * Returns the number of characters written to @buf or -1 if an error occurs. */ -int +int xmlStrVPrintf(xmlChar *buf, int len, const xmlChar *msg, va_list ap) { int ret; - + if((buf == NULL) || (msg == NULL)) { return(-1); } - + ret = vsnprintf((char *) buf, len, (const char *) msg, ap); buf[len - 1] = 0; /* be safe ! */ - + return(ret); } @@ -858,7 +858,7 @@ xmlChar * xmlUTF8Strndup(const xmlChar *utf, int len) { xmlChar *ret; int i; - + if ((utf == NULL) || (len < 0)) return(NULL); i = xmlUTF8Strsize(utf, len); ret = (xmlChar *) xmlMallocAtomic((i + 1) * sizeof(xmlChar)); diff --git a/gnulib-local/lib/libxml/xmlstring.in.h b/gnulib-local/lib/libxml/xmlstring.in.h index 1dfc5ea..2036236 100644 --- a/gnulib-local/lib/libxml/xmlstring.in.h +++ b/gnulib-local/lib/libxml/xmlstring.in.h @@ -59,7 +59,7 @@ XMLPUBFUN const xmlChar * XMLCALL const xmlChar *val); XMLPUBFUN const xmlChar * XMLCALL xmlStrcasestr (const xmlChar *str, - xmlChar *val); + const xmlChar *val); XMLPUBFUN int XMLCALL xmlStrcmp (const xmlChar *str1, const xmlChar *str2); @@ -113,16 +113,16 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlUTF8Strsize (const xmlChar *utf, int len); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlUTF8Strndup (const xmlChar *utf, int len); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlUTF8Strpos (const xmlChar *utf, int pos); XMLPUBFUN int XMLCALL xmlUTF8Strloc (const xmlChar *utf, const xmlChar *utfchar); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlUTF8Strsub (const xmlChar *utf, int start, int len); diff --git a/gnulib-local/lib/libxml/xmlunicode.c b/gnulib-local/lib/libxml/xmlunicode.c index 450d0f0..ce6e9a4 100644 --- a/gnulib-local/lib/libxml/xmlunicode.c +++ b/gnulib-local/lib/libxml/xmlunicode.c @@ -204,729 +204,729 @@ static xmlUnicodeRange xmlUnicodeCats[] = { {"Zp", xmlUCSIsCatZp}, {"Zs", xmlUCSIsCatZs}}; -static const xmlChSRange xmlCS[] = {{0x0, 0x1f}, {0x7f, 0x9f}, - {0xad, 0xad}, {0x600, 0x603}, {0x6dd, 0x6dd}, {0x70f, 0x70f}, - {0x17b4, 0x17b5}, {0x200b, 0x200f}, {0x202a, 0x202e}, {0x2060, 0x2063}, - {0x206a, 0x206f}, {0xd800, 0xd800}, {0xdb7f, 0xdb80}, {0xdbff, 0xdc00}, +static const xmlChSRange xmlCS[] = {{0x0, 0x1f}, {0x7f, 0x9f}, + {0xad, 0xad}, {0x600, 0x603}, {0x6dd, 0x6dd}, {0x70f, 0x70f}, + {0x17b4, 0x17b5}, {0x200b, 0x200f}, {0x202a, 0x202e}, {0x2060, 0x2063}, + {0x206a, 0x206f}, {0xd800, 0xd800}, {0xdb7f, 0xdb80}, {0xdbff, 0xdc00}, {0xdfff, 0xe000}, {0xf8ff, 0xf8ff}, {0xfeff, 0xfeff}, {0xfff9, 0xfffb} }; -static const xmlChLRange xmlCL[] = {{0x1d173, 0x1d17a}, {0xe0001, 0xe0001}, - {0xe0020, 0xe007f}, {0xf0000, 0xf0000}, {0xffffd, 0xffffd}, +static const xmlChLRange xmlCL[] = {{0x1d173, 0x1d17a}, {0xe0001, 0xe0001}, + {0xe0020, 0xe007f}, {0xf0000, 0xf0000}, {0xffffd, 0xffffd}, {0x100000, 0x100000}, {0x10fffd, 0x10fffd} }; static xmlChRangeGroup xmlCG = {18,7,xmlCS,xmlCL}; -static const xmlChSRange xmlCfS[] = {{0xad, 0xad}, {0x600, 0x603}, - {0x6dd, 0x6dd}, {0x70f, 0x70f}, {0x17b4, 0x17b5}, {0x200b, 0x200f}, - {0x202a, 0x202e}, {0x2060, 0x2063}, {0x206a, 0x206f}, {0xfeff, 0xfeff}, +static const xmlChSRange xmlCfS[] = {{0xad, 0xad}, {0x600, 0x603}, + {0x6dd, 0x6dd}, {0x70f, 0x70f}, {0x17b4, 0x17b5}, {0x200b, 0x200f}, + {0x202a, 0x202e}, {0x2060, 0x2063}, {0x206a, 0x206f}, {0xfeff, 0xfeff}, {0xfff9, 0xfffb} }; -static const xmlChLRange xmlCfL[] = {{0x1d173, 0x1d17a}, {0xe0001, 0xe0001}, +static const xmlChLRange xmlCfL[] = {{0x1d173, 0x1d17a}, {0xe0001, 0xe0001}, {0xe0020, 0xe007f} }; static xmlChRangeGroup xmlCfG = {11,3,xmlCfS,xmlCfL}; -static const xmlChSRange xmlLS[] = {{0x41, 0x5a}, {0x61, 0x7a}, - {0xaa, 0xaa}, {0xb5, 0xb5}, {0xba, 0xba}, {0xc0, 0xd6}, {0xd8, 0xf6}, - {0xf8, 0x236}, {0x250, 0x2c1}, {0x2c6, 0x2d1}, {0x2e0, 0x2e4}, - {0x2ee, 0x2ee}, {0x37a, 0x37a}, {0x386, 0x386}, {0x388, 0x38a}, - {0x38c, 0x38c}, {0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3f5}, - {0x3f7, 0x3fb}, {0x400, 0x481}, {0x48a, 0x4ce}, {0x4d0, 0x4f5}, - {0x4f8, 0x4f9}, {0x500, 0x50f}, {0x531, 0x556}, {0x559, 0x559}, - {0x561, 0x587}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, - {0x640, 0x64a}, {0x66e, 0x66f}, {0x671, 0x6d3}, {0x6d5, 0x6d5}, - {0x6e5, 0x6e6}, {0x6ee, 0x6ef}, {0x6fa, 0x6fc}, {0x6ff, 0x6ff}, - {0x710, 0x710}, {0x712, 0x72f}, {0x74d, 0x74f}, {0x780, 0x7a5}, - {0x7b1, 0x7b1}, {0x904, 0x939}, {0x93d, 0x93d}, {0x950, 0x950}, - {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990}, {0x993, 0x9a8}, - {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9}, {0x9bd, 0x9bd}, - {0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a}, - {0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33}, - {0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e}, - {0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, - {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9}, {0xabd, 0xabd}, - {0xad0, 0xad0}, {0xae0, 0xae1}, {0xb05, 0xb0c}, {0xb0f, 0xb10}, - {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb35, 0xb39}, - {0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb71, 0xb71}, - {0xb83, 0xb83}, {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95}, - {0xb99, 0xb9a}, {0xb9c, 0xb9c}, {0xb9e, 0xb9f}, {0xba3, 0xba4}, - {0xba8, 0xbaa}, {0xbae, 0xbb5}, {0xbb7, 0xbb9}, {0xc05, 0xc0c}, - {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc33}, {0xc35, 0xc39}, - {0xc60, 0xc61}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, - {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcbd, 0xcbd}, {0xcde, 0xcde}, - {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd28}, - {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xd85, 0xd96}, {0xd9a, 0xdb1}, - {0xdb3, 0xdbb}, {0xdbd, 0xdbd}, {0xdc0, 0xdc6}, {0xe01, 0xe30}, - {0xe32, 0xe33}, {0xe40, 0xe46}, {0xe81, 0xe82}, {0xe84, 0xe84}, - {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d}, {0xe94, 0xe97}, - {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5}, {0xea7, 0xea7}, - {0xeaa, 0xeab}, {0xead, 0xeb0}, {0xeb2, 0xeb3}, {0xebd, 0xebd}, - {0xec0, 0xec4}, {0xec6, 0xec6}, {0xedc, 0xedd}, {0xf00, 0xf00}, - {0xf40, 0xf47}, {0xf49, 0xf6a}, {0xf88, 0xf8b}, {0x1000, 0x1021}, - {0x1023, 0x1027}, {0x1029, 0x102a}, {0x1050, 0x1055}, {0x10a0, 0x10c5}, - {0x10d0, 0x10f8}, {0x1100, 0x1159}, {0x115f, 0x11a2}, {0x11a8, 0x11f9}, - {0x1200, 0x1206}, {0x1208, 0x1246}, {0x1248, 0x1248}, {0x124a, 0x124d}, - {0x1250, 0x1256}, {0x1258, 0x1258}, {0x125a, 0x125d}, {0x1260, 0x1286}, - {0x1288, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12ae}, {0x12b0, 0x12b0}, - {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c0, 0x12c0}, {0x12c2, 0x12c5}, - {0x12c8, 0x12ce}, {0x12d0, 0x12d6}, {0x12d8, 0x12ee}, {0x12f0, 0x130e}, - {0x1310, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x131e}, {0x1320, 0x1346}, - {0x1348, 0x135a}, {0x13a0, 0x13f4}, {0x1401, 0x166c}, {0x166f, 0x1676}, - {0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x1700, 0x170c}, {0x170e, 0x1711}, - {0x1720, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770}, - {0x1780, 0x17b3}, {0x17d7, 0x17d7}, {0x17dc, 0x17dc}, {0x1820, 0x1877}, - {0x1880, 0x18a8}, {0x1900, 0x191c}, {0x1950, 0x196d}, {0x1970, 0x1974}, - {0x1d00, 0x1d6b}, {0x1e00, 0x1e9b}, {0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, - {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, - {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b}, {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, - {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, - {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, - {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, {0x2071, 0x2071}, {0x207f, 0x207f}, - {0x2102, 0x2102}, {0x2107, 0x2107}, {0x210a, 0x2113}, {0x2115, 0x2115}, - {0x2119, 0x211d}, {0x2124, 0x2124}, {0x2126, 0x2126}, {0x2128, 0x2128}, - {0x212a, 0x212d}, {0x212f, 0x2131}, {0x2133, 0x2139}, {0x213d, 0x213f}, - {0x2145, 0x2149}, {0x3005, 0x3006}, {0x3031, 0x3035}, {0x303b, 0x303c}, - {0x3041, 0x3096}, {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, - {0x3105, 0x312c}, {0x3131, 0x318e}, {0x31a0, 0x31b7}, {0x31f0, 0x31ff}, - {0x3400, 0x3400}, {0x4db5, 0x4db5}, {0x4e00, 0x4e00}, {0x9fa5, 0x9fa5}, - {0xa000, 0xa48c}, {0xac00, 0xac00}, {0xd7a3, 0xd7a3}, {0xf900, 0xfa2d}, - {0xfa30, 0xfa6a}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1d, 0xfb1d}, - {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb3e, 0xfb3e}, - {0xfb40, 0xfb41}, {0xfb43, 0xfb44}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, - {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, - {0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, +static const xmlChSRange xmlLS[] = {{0x41, 0x5a}, {0x61, 0x7a}, + {0xaa, 0xaa}, {0xb5, 0xb5}, {0xba, 0xba}, {0xc0, 0xd6}, {0xd8, 0xf6}, + {0xf8, 0x236}, {0x250, 0x2c1}, {0x2c6, 0x2d1}, {0x2e0, 0x2e4}, + {0x2ee, 0x2ee}, {0x37a, 0x37a}, {0x386, 0x386}, {0x388, 0x38a}, + {0x38c, 0x38c}, {0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3f5}, + {0x3f7, 0x3fb}, {0x400, 0x481}, {0x48a, 0x4ce}, {0x4d0, 0x4f5}, + {0x4f8, 0x4f9}, {0x500, 0x50f}, {0x531, 0x556}, {0x559, 0x559}, + {0x561, 0x587}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, + {0x640, 0x64a}, {0x66e, 0x66f}, {0x671, 0x6d3}, {0x6d5, 0x6d5}, + {0x6e5, 0x6e6}, {0x6ee, 0x6ef}, {0x6fa, 0x6fc}, {0x6ff, 0x6ff}, + {0x710, 0x710}, {0x712, 0x72f}, {0x74d, 0x74f}, {0x780, 0x7a5}, + {0x7b1, 0x7b1}, {0x904, 0x939}, {0x93d, 0x93d}, {0x950, 0x950}, + {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990}, {0x993, 0x9a8}, + {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9}, {0x9bd, 0x9bd}, + {0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a}, + {0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33}, + {0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e}, + {0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, + {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9}, {0xabd, 0xabd}, + {0xad0, 0xad0}, {0xae0, 0xae1}, {0xb05, 0xb0c}, {0xb0f, 0xb10}, + {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb35, 0xb39}, + {0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb71, 0xb71}, + {0xb83, 0xb83}, {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95}, + {0xb99, 0xb9a}, {0xb9c, 0xb9c}, {0xb9e, 0xb9f}, {0xba3, 0xba4}, + {0xba8, 0xbaa}, {0xbae, 0xbb5}, {0xbb7, 0xbb9}, {0xc05, 0xc0c}, + {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc33}, {0xc35, 0xc39}, + {0xc60, 0xc61}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, + {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcbd, 0xcbd}, {0xcde, 0xcde}, + {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd28}, + {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xd85, 0xd96}, {0xd9a, 0xdb1}, + {0xdb3, 0xdbb}, {0xdbd, 0xdbd}, {0xdc0, 0xdc6}, {0xe01, 0xe30}, + {0xe32, 0xe33}, {0xe40, 0xe46}, {0xe81, 0xe82}, {0xe84, 0xe84}, + {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d}, {0xe94, 0xe97}, + {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5}, {0xea7, 0xea7}, + {0xeaa, 0xeab}, {0xead, 0xeb0}, {0xeb2, 0xeb3}, {0xebd, 0xebd}, + {0xec0, 0xec4}, {0xec6, 0xec6}, {0xedc, 0xedd}, {0xf00, 0xf00}, + {0xf40, 0xf47}, {0xf49, 0xf6a}, {0xf88, 0xf8b}, {0x1000, 0x1021}, + {0x1023, 0x1027}, {0x1029, 0x102a}, {0x1050, 0x1055}, {0x10a0, 0x10c5}, + {0x10d0, 0x10f8}, {0x1100, 0x1159}, {0x115f, 0x11a2}, {0x11a8, 0x11f9}, + {0x1200, 0x1206}, {0x1208, 0x1246}, {0x1248, 0x1248}, {0x124a, 0x124d}, + {0x1250, 0x1256}, {0x1258, 0x1258}, {0x125a, 0x125d}, {0x1260, 0x1286}, + {0x1288, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12ae}, {0x12b0, 0x12b0}, + {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c0, 0x12c0}, {0x12c2, 0x12c5}, + {0x12c8, 0x12ce}, {0x12d0, 0x12d6}, {0x12d8, 0x12ee}, {0x12f0, 0x130e}, + {0x1310, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x131e}, {0x1320, 0x1346}, + {0x1348, 0x135a}, {0x13a0, 0x13f4}, {0x1401, 0x166c}, {0x166f, 0x1676}, + {0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x1700, 0x170c}, {0x170e, 0x1711}, + {0x1720, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770}, + {0x1780, 0x17b3}, {0x17d7, 0x17d7}, {0x17dc, 0x17dc}, {0x1820, 0x1877}, + {0x1880, 0x18a8}, {0x1900, 0x191c}, {0x1950, 0x196d}, {0x1970, 0x1974}, + {0x1d00, 0x1d6b}, {0x1e00, 0x1e9b}, {0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, + {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, + {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b}, {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, + {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, + {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, + {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, {0x2071, 0x2071}, {0x207f, 0x207f}, + {0x2102, 0x2102}, {0x2107, 0x2107}, {0x210a, 0x2113}, {0x2115, 0x2115}, + {0x2119, 0x211d}, {0x2124, 0x2124}, {0x2126, 0x2126}, {0x2128, 0x2128}, + {0x212a, 0x212d}, {0x212f, 0x2131}, {0x2133, 0x2139}, {0x213d, 0x213f}, + {0x2145, 0x2149}, {0x3005, 0x3006}, {0x3031, 0x3035}, {0x303b, 0x303c}, + {0x3041, 0x3096}, {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, + {0x3105, 0x312c}, {0x3131, 0x318e}, {0x31a0, 0x31b7}, {0x31f0, 0x31ff}, + {0x3400, 0x3400}, {0x4db5, 0x4db5}, {0x4e00, 0x4e00}, {0x9fa5, 0x9fa5}, + {0xa000, 0xa48c}, {0xac00, 0xac00}, {0xd7a3, 0xd7a3}, {0xf900, 0xfa2d}, + {0xfa30, 0xfa6a}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1d, 0xfb1d}, + {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb3e, 0xfb3e}, + {0xfb40, 0xfb41}, {0xfb43, 0xfb44}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, + {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, + {0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc} }; -static const xmlChLRange xmlLL[] = {{0x10000, 0x1000b}, {0x1000d, 0x10026}, - {0x10028, 0x1003a}, {0x1003c, 0x1003d}, {0x1003f, 0x1004d}, - {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10300, 0x1031e}, - {0x10330, 0x10349}, {0x10380, 0x1039d}, {0x10400, 0x1049d}, - {0x10800, 0x10805}, {0x10808, 0x10808}, {0x1080a, 0x10835}, - {0x10837, 0x10838}, {0x1083c, 0x1083c}, {0x1083f, 0x1083f}, - {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d49e, 0x1d49f}, - {0x1d4a2, 0x1d4a2}, {0x1d4a5, 0x1d4a6}, {0x1d4a9, 0x1d4ac}, - {0x1d4ae, 0x1d4b9}, {0x1d4bb, 0x1d4bb}, {0x1d4bd, 0x1d4c3}, - {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, - {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, - {0x1d540, 0x1d544}, {0x1d546, 0x1d546}, {0x1d54a, 0x1d550}, - {0x1d552, 0x1d6a3}, {0x1d6a8, 0x1d6c0}, {0x1d6c2, 0x1d6da}, - {0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, - {0x1d736, 0x1d74e}, {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, - {0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}, +static const xmlChLRange xmlLL[] = {{0x10000, 0x1000b}, {0x1000d, 0x10026}, + {0x10028, 0x1003a}, {0x1003c, 0x1003d}, {0x1003f, 0x1004d}, + {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10300, 0x1031e}, + {0x10330, 0x10349}, {0x10380, 0x1039d}, {0x10400, 0x1049d}, + {0x10800, 0x10805}, {0x10808, 0x10808}, {0x1080a, 0x10835}, + {0x10837, 0x10838}, {0x1083c, 0x1083c}, {0x1083f, 0x1083f}, + {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d49e, 0x1d49f}, + {0x1d4a2, 0x1d4a2}, {0x1d4a5, 0x1d4a6}, {0x1d4a9, 0x1d4ac}, + {0x1d4ae, 0x1d4b9}, {0x1d4bb, 0x1d4bb}, {0x1d4bd, 0x1d4c3}, + {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, + {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, + {0x1d540, 0x1d544}, {0x1d546, 0x1d546}, {0x1d54a, 0x1d550}, + {0x1d552, 0x1d6a3}, {0x1d6a8, 0x1d6c0}, {0x1d6c2, 0x1d6da}, + {0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, + {0x1d736, 0x1d74e}, {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, + {0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}, {0x20000, 0x20000}, {0x2a6d6, 0x2a6d6}, {0x2f800, 0x2fa1d} }; static xmlChRangeGroup xmlLG = {279,50,xmlLS,xmlLL}; -static const xmlChSRange xmlLlS[] = {{0x61, 0x7a}, {0xaa, 0xaa}, - {0xb5, 0xb5}, {0xba, 0xba}, {0xdf, 0xf6}, {0xf8, 0xff}, {0x101, 0x101}, - {0x103, 0x103}, {0x105, 0x105}, {0x107, 0x107}, {0x109, 0x109}, - {0x10b, 0x10b}, {0x10d, 0x10d}, {0x10f, 0x10f}, {0x111, 0x111}, - {0x113, 0x113}, {0x115, 0x115}, {0x117, 0x117}, {0x119, 0x119}, - {0x11b, 0x11b}, {0x11d, 0x11d}, {0x11f, 0x11f}, {0x121, 0x121}, - {0x123, 0x123}, {0x125, 0x125}, {0x127, 0x127}, {0x129, 0x129}, - {0x12b, 0x12b}, {0x12d, 0x12d}, {0x12f, 0x12f}, {0x131, 0x131}, - {0x133, 0x133}, {0x135, 0x135}, {0x137, 0x138}, {0x13a, 0x13a}, - {0x13c, 0x13c}, {0x13e, 0x13e}, {0x140, 0x140}, {0x142, 0x142}, - {0x144, 0x144}, {0x146, 0x146}, {0x148, 0x149}, {0x14b, 0x14b}, - {0x14d, 0x14d}, {0x14f, 0x14f}, {0x151, 0x151}, {0x153, 0x153}, - {0x155, 0x155}, {0x157, 0x157}, {0x159, 0x159}, {0x15b, 0x15b}, - {0x15d, 0x15d}, {0x15f, 0x15f}, {0x161, 0x161}, {0x163, 0x163}, - {0x165, 0x165}, {0x167, 0x167}, {0x169, 0x169}, {0x16b, 0x16b}, - {0x16d, 0x16d}, {0x16f, 0x16f}, {0x171, 0x171}, {0x173, 0x173}, - {0x175, 0x175}, {0x177, 0x177}, {0x17a, 0x17a}, {0x17c, 0x17c}, - {0x17e, 0x180}, {0x183, 0x183}, {0x185, 0x185}, {0x188, 0x188}, - {0x18c, 0x18d}, {0x192, 0x192}, {0x195, 0x195}, {0x199, 0x19b}, - {0x19e, 0x19e}, {0x1a1, 0x1a1}, {0x1a3, 0x1a3}, {0x1a5, 0x1a5}, - {0x1a8, 0x1a8}, {0x1aa, 0x1ab}, {0x1ad, 0x1ad}, {0x1b0, 0x1b0}, - {0x1b4, 0x1b4}, {0x1b6, 0x1b6}, {0x1b9, 0x1ba}, {0x1bd, 0x1bf}, - {0x1c6, 0x1c6}, {0x1c9, 0x1c9}, {0x1cc, 0x1cc}, {0x1ce, 0x1ce}, - {0x1d0, 0x1d0}, {0x1d2, 0x1d2}, {0x1d4, 0x1d4}, {0x1d6, 0x1d6}, - {0x1d8, 0x1d8}, {0x1da, 0x1da}, {0x1dc, 0x1dd}, {0x1df, 0x1df}, - {0x1e1, 0x1e1}, {0x1e3, 0x1e3}, {0x1e5, 0x1e5}, {0x1e7, 0x1e7}, - {0x1e9, 0x1e9}, {0x1eb, 0x1eb}, {0x1ed, 0x1ed}, {0x1ef, 0x1f0}, - {0x1f3, 0x1f3}, {0x1f5, 0x1f5}, {0x1f9, 0x1f9}, {0x1fb, 0x1fb}, - {0x1fd, 0x1fd}, {0x1ff, 0x1ff}, {0x201, 0x201}, {0x203, 0x203}, - {0x205, 0x205}, {0x207, 0x207}, {0x209, 0x209}, {0x20b, 0x20b}, - {0x20d, 0x20d}, {0x20f, 0x20f}, {0x211, 0x211}, {0x213, 0x213}, - {0x215, 0x215}, {0x217, 0x217}, {0x219, 0x219}, {0x21b, 0x21b}, - {0x21d, 0x21d}, {0x21f, 0x21f}, {0x221, 0x221}, {0x223, 0x223}, - {0x225, 0x225}, {0x227, 0x227}, {0x229, 0x229}, {0x22b, 0x22b}, - {0x22d, 0x22d}, {0x22f, 0x22f}, {0x231, 0x231}, {0x233, 0x236}, - {0x250, 0x2af}, {0x390, 0x390}, {0x3ac, 0x3ce}, {0x3d0, 0x3d1}, - {0x3d5, 0x3d7}, {0x3d9, 0x3d9}, {0x3db, 0x3db}, {0x3dd, 0x3dd}, - {0x3df, 0x3df}, {0x3e1, 0x3e1}, {0x3e3, 0x3e3}, {0x3e5, 0x3e5}, - {0x3e7, 0x3e7}, {0x3e9, 0x3e9}, {0x3eb, 0x3eb}, {0x3ed, 0x3ed}, - {0x3ef, 0x3f3}, {0x3f5, 0x3f5}, {0x3f8, 0x3f8}, {0x3fb, 0x3fb}, - {0x430, 0x45f}, {0x461, 0x461}, {0x463, 0x463}, {0x465, 0x465}, - {0x467, 0x467}, {0x469, 0x469}, {0x46b, 0x46b}, {0x46d, 0x46d}, - {0x46f, 0x46f}, {0x471, 0x471}, {0x473, 0x473}, {0x475, 0x475}, - {0x477, 0x477}, {0x479, 0x479}, {0x47b, 0x47b}, {0x47d, 0x47d}, - {0x47f, 0x47f}, {0x481, 0x481}, {0x48b, 0x48b}, {0x48d, 0x48d}, - {0x48f, 0x48f}, {0x491, 0x491}, {0x493, 0x493}, {0x495, 0x495}, - {0x497, 0x497}, {0x499, 0x499}, {0x49b, 0x49b}, {0x49d, 0x49d}, - {0x49f, 0x49f}, {0x4a1, 0x4a1}, {0x4a3, 0x4a3}, {0x4a5, 0x4a5}, - {0x4a7, 0x4a7}, {0x4a9, 0x4a9}, {0x4ab, 0x4ab}, {0x4ad, 0x4ad}, - {0x4af, 0x4af}, {0x4b1, 0x4b1}, {0x4b3, 0x4b3}, {0x4b5, 0x4b5}, - {0x4b7, 0x4b7}, {0x4b9, 0x4b9}, {0x4bb, 0x4bb}, {0x4bd, 0x4bd}, - {0x4bf, 0x4bf}, {0x4c2, 0x4c2}, {0x4c4, 0x4c4}, {0x4c6, 0x4c6}, - {0x4c8, 0x4c8}, {0x4ca, 0x4ca}, {0x4cc, 0x4cc}, {0x4ce, 0x4ce}, - {0x4d1, 0x4d1}, {0x4d3, 0x4d3}, {0x4d5, 0x4d5}, {0x4d7, 0x4d7}, - {0x4d9, 0x4d9}, {0x4db, 0x4db}, {0x4dd, 0x4dd}, {0x4df, 0x4df}, - {0x4e1, 0x4e1}, {0x4e3, 0x4e3}, {0x4e5, 0x4e5}, {0x4e7, 0x4e7}, - {0x4e9, 0x4e9}, {0x4eb, 0x4eb}, {0x4ed, 0x4ed}, {0x4ef, 0x4ef}, - {0x4f1, 0x4f1}, {0x4f3, 0x4f3}, {0x4f5, 0x4f5}, {0x4f9, 0x4f9}, - {0x501, 0x501}, {0x503, 0x503}, {0x505, 0x505}, {0x507, 0x507}, - {0x509, 0x509}, {0x50b, 0x50b}, {0x50d, 0x50d}, {0x50f, 0x50f}, - {0x561, 0x587}, {0x1d00, 0x1d2b}, {0x1d62, 0x1d6b}, {0x1e01, 0x1e01}, - {0x1e03, 0x1e03}, {0x1e05, 0x1e05}, {0x1e07, 0x1e07}, {0x1e09, 0x1e09}, - {0x1e0b, 0x1e0b}, {0x1e0d, 0x1e0d}, {0x1e0f, 0x1e0f}, {0x1e11, 0x1e11}, - {0x1e13, 0x1e13}, {0x1e15, 0x1e15}, {0x1e17, 0x1e17}, {0x1e19, 0x1e19}, - {0x1e1b, 0x1e1b}, {0x1e1d, 0x1e1d}, {0x1e1f, 0x1e1f}, {0x1e21, 0x1e21}, - {0x1e23, 0x1e23}, {0x1e25, 0x1e25}, {0x1e27, 0x1e27}, {0x1e29, 0x1e29}, - {0x1e2b, 0x1e2b}, {0x1e2d, 0x1e2d}, {0x1e2f, 0x1e2f}, {0x1e31, 0x1e31}, - {0x1e33, 0x1e33}, {0x1e35, 0x1e35}, {0x1e37, 0x1e37}, {0x1e39, 0x1e39}, - {0x1e3b, 0x1e3b}, {0x1e3d, 0x1e3d}, {0x1e3f, 0x1e3f}, {0x1e41, 0x1e41}, - {0x1e43, 0x1e43}, {0x1e45, 0x1e45}, {0x1e47, 0x1e47}, {0x1e49, 0x1e49}, - {0x1e4b, 0x1e4b}, {0x1e4d, 0x1e4d}, {0x1e4f, 0x1e4f}, {0x1e51, 0x1e51}, - {0x1e53, 0x1e53}, {0x1e55, 0x1e55}, {0x1e57, 0x1e57}, {0x1e59, 0x1e59}, - {0x1e5b, 0x1e5b}, {0x1e5d, 0x1e5d}, {0x1e5f, 0x1e5f}, {0x1e61, 0x1e61}, - {0x1e63, 0x1e63}, {0x1e65, 0x1e65}, {0x1e67, 0x1e67}, {0x1e69, 0x1e69}, - {0x1e6b, 0x1e6b}, {0x1e6d, 0x1e6d}, {0x1e6f, 0x1e6f}, {0x1e71, 0x1e71}, - {0x1e73, 0x1e73}, {0x1e75, 0x1e75}, {0x1e77, 0x1e77}, {0x1e79, 0x1e79}, - {0x1e7b, 0x1e7b}, {0x1e7d, 0x1e7d}, {0x1e7f, 0x1e7f}, {0x1e81, 0x1e81}, - {0x1e83, 0x1e83}, {0x1e85, 0x1e85}, {0x1e87, 0x1e87}, {0x1e89, 0x1e89}, - {0x1e8b, 0x1e8b}, {0x1e8d, 0x1e8d}, {0x1e8f, 0x1e8f}, {0x1e91, 0x1e91}, - {0x1e93, 0x1e93}, {0x1e95, 0x1e9b}, {0x1ea1, 0x1ea1}, {0x1ea3, 0x1ea3}, - {0x1ea5, 0x1ea5}, {0x1ea7, 0x1ea7}, {0x1ea9, 0x1ea9}, {0x1eab, 0x1eab}, - {0x1ead, 0x1ead}, {0x1eaf, 0x1eaf}, {0x1eb1, 0x1eb1}, {0x1eb3, 0x1eb3}, - {0x1eb5, 0x1eb5}, {0x1eb7, 0x1eb7}, {0x1eb9, 0x1eb9}, {0x1ebb, 0x1ebb}, - {0x1ebd, 0x1ebd}, {0x1ebf, 0x1ebf}, {0x1ec1, 0x1ec1}, {0x1ec3, 0x1ec3}, - {0x1ec5, 0x1ec5}, {0x1ec7, 0x1ec7}, {0x1ec9, 0x1ec9}, {0x1ecb, 0x1ecb}, - {0x1ecd, 0x1ecd}, {0x1ecf, 0x1ecf}, {0x1ed1, 0x1ed1}, {0x1ed3, 0x1ed3}, - {0x1ed5, 0x1ed5}, {0x1ed7, 0x1ed7}, {0x1ed9, 0x1ed9}, {0x1edb, 0x1edb}, - {0x1edd, 0x1edd}, {0x1edf, 0x1edf}, {0x1ee1, 0x1ee1}, {0x1ee3, 0x1ee3}, - {0x1ee5, 0x1ee5}, {0x1ee7, 0x1ee7}, {0x1ee9, 0x1ee9}, {0x1eeb, 0x1eeb}, - {0x1eed, 0x1eed}, {0x1eef, 0x1eef}, {0x1ef1, 0x1ef1}, {0x1ef3, 0x1ef3}, - {0x1ef5, 0x1ef5}, {0x1ef7, 0x1ef7}, {0x1ef9, 0x1ef9}, {0x1f00, 0x1f07}, - {0x1f10, 0x1f15}, {0x1f20, 0x1f27}, {0x1f30, 0x1f37}, {0x1f40, 0x1f45}, - {0x1f50, 0x1f57}, {0x1f60, 0x1f67}, {0x1f70, 0x1f7d}, {0x1f80, 0x1f87}, - {0x1f90, 0x1f97}, {0x1fa0, 0x1fa7}, {0x1fb0, 0x1fb4}, {0x1fb6, 0x1fb7}, - {0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fc7}, {0x1fd0, 0x1fd3}, - {0x1fd6, 0x1fd7}, {0x1fe0, 0x1fe7}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ff7}, - {0x2071, 0x2071}, {0x207f, 0x207f}, {0x210a, 0x210a}, {0x210e, 0x210f}, - {0x2113, 0x2113}, {0x212f, 0x212f}, {0x2134, 0x2134}, {0x2139, 0x2139}, - {0x213d, 0x213d}, {0x2146, 0x2149}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, +static const xmlChSRange xmlLlS[] = {{0x61, 0x7a}, {0xaa, 0xaa}, + {0xb5, 0xb5}, {0xba, 0xba}, {0xdf, 0xf6}, {0xf8, 0xff}, {0x101, 0x101}, + {0x103, 0x103}, {0x105, 0x105}, {0x107, 0x107}, {0x109, 0x109}, + {0x10b, 0x10b}, {0x10d, 0x10d}, {0x10f, 0x10f}, {0x111, 0x111}, + {0x113, 0x113}, {0x115, 0x115}, {0x117, 0x117}, {0x119, 0x119}, + {0x11b, 0x11b}, {0x11d, 0x11d}, {0x11f, 0x11f}, {0x121, 0x121}, + {0x123, 0x123}, {0x125, 0x125}, {0x127, 0x127}, {0x129, 0x129}, + {0x12b, 0x12b}, {0x12d, 0x12d}, {0x12f, 0x12f}, {0x131, 0x131}, + {0x133, 0x133}, {0x135, 0x135}, {0x137, 0x138}, {0x13a, 0x13a}, + {0x13c, 0x13c}, {0x13e, 0x13e}, {0x140, 0x140}, {0x142, 0x142}, + {0x144, 0x144}, {0x146, 0x146}, {0x148, 0x149}, {0x14b, 0x14b}, + {0x14d, 0x14d}, {0x14f, 0x14f}, {0x151, 0x151}, {0x153, 0x153}, + {0x155, 0x155}, {0x157, 0x157}, {0x159, 0x159}, {0x15b, 0x15b}, + {0x15d, 0x15d}, {0x15f, 0x15f}, {0x161, 0x161}, {0x163, 0x163}, + {0x165, 0x165}, {0x167, 0x167}, {0x169, 0x169}, {0x16b, 0x16b}, + {0x16d, 0x16d}, {0x16f, 0x16f}, {0x171, 0x171}, {0x173, 0x173}, + {0x175, 0x175}, {0x177, 0x177}, {0x17a, 0x17a}, {0x17c, 0x17c}, + {0x17e, 0x180}, {0x183, 0x183}, {0x185, 0x185}, {0x188, 0x188}, + {0x18c, 0x18d}, {0x192, 0x192}, {0x195, 0x195}, {0x199, 0x19b}, + {0x19e, 0x19e}, {0x1a1, 0x1a1}, {0x1a3, 0x1a3}, {0x1a5, 0x1a5}, + {0x1a8, 0x1a8}, {0x1aa, 0x1ab}, {0x1ad, 0x1ad}, {0x1b0, 0x1b0}, + {0x1b4, 0x1b4}, {0x1b6, 0x1b6}, {0x1b9, 0x1ba}, {0x1bd, 0x1bf}, + {0x1c6, 0x1c6}, {0x1c9, 0x1c9}, {0x1cc, 0x1cc}, {0x1ce, 0x1ce}, + {0x1d0, 0x1d0}, {0x1d2, 0x1d2}, {0x1d4, 0x1d4}, {0x1d6, 0x1d6}, + {0x1d8, 0x1d8}, {0x1da, 0x1da}, {0x1dc, 0x1dd}, {0x1df, 0x1df}, + {0x1e1, 0x1e1}, {0x1e3, 0x1e3}, {0x1e5, 0x1e5}, {0x1e7, 0x1e7}, + {0x1e9, 0x1e9}, {0x1eb, 0x1eb}, {0x1ed, 0x1ed}, {0x1ef, 0x1f0}, + {0x1f3, 0x1f3}, {0x1f5, 0x1f5}, {0x1f9, 0x1f9}, {0x1fb, 0x1fb}, + {0x1fd, 0x1fd}, {0x1ff, 0x1ff}, {0x201, 0x201}, {0x203, 0x203}, + {0x205, 0x205}, {0x207, 0x207}, {0x209, 0x209}, {0x20b, 0x20b}, + {0x20d, 0x20d}, {0x20f, 0x20f}, {0x211, 0x211}, {0x213, 0x213}, + {0x215, 0x215}, {0x217, 0x217}, {0x219, 0x219}, {0x21b, 0x21b}, + {0x21d, 0x21d}, {0x21f, 0x21f}, {0x221, 0x221}, {0x223, 0x223}, + {0x225, 0x225}, {0x227, 0x227}, {0x229, 0x229}, {0x22b, 0x22b}, + {0x22d, 0x22d}, {0x22f, 0x22f}, {0x231, 0x231}, {0x233, 0x236}, + {0x250, 0x2af}, {0x390, 0x390}, {0x3ac, 0x3ce}, {0x3d0, 0x3d1}, + {0x3d5, 0x3d7}, {0x3d9, 0x3d9}, {0x3db, 0x3db}, {0x3dd, 0x3dd}, + {0x3df, 0x3df}, {0x3e1, 0x3e1}, {0x3e3, 0x3e3}, {0x3e5, 0x3e5}, + {0x3e7, 0x3e7}, {0x3e9, 0x3e9}, {0x3eb, 0x3eb}, {0x3ed, 0x3ed}, + {0x3ef, 0x3f3}, {0x3f5, 0x3f5}, {0x3f8, 0x3f8}, {0x3fb, 0x3fb}, + {0x430, 0x45f}, {0x461, 0x461}, {0x463, 0x463}, {0x465, 0x465}, + {0x467, 0x467}, {0x469, 0x469}, {0x46b, 0x46b}, {0x46d, 0x46d}, + {0x46f, 0x46f}, {0x471, 0x471}, {0x473, 0x473}, {0x475, 0x475}, + {0x477, 0x477}, {0x479, 0x479}, {0x47b, 0x47b}, {0x47d, 0x47d}, + {0x47f, 0x47f}, {0x481, 0x481}, {0x48b, 0x48b}, {0x48d, 0x48d}, + {0x48f, 0x48f}, {0x491, 0x491}, {0x493, 0x493}, {0x495, 0x495}, + {0x497, 0x497}, {0x499, 0x499}, {0x49b, 0x49b}, {0x49d, 0x49d}, + {0x49f, 0x49f}, {0x4a1, 0x4a1}, {0x4a3, 0x4a3}, {0x4a5, 0x4a5}, + {0x4a7, 0x4a7}, {0x4a9, 0x4a9}, {0x4ab, 0x4ab}, {0x4ad, 0x4ad}, + {0x4af, 0x4af}, {0x4b1, 0x4b1}, {0x4b3, 0x4b3}, {0x4b5, 0x4b5}, + {0x4b7, 0x4b7}, {0x4b9, 0x4b9}, {0x4bb, 0x4bb}, {0x4bd, 0x4bd}, + {0x4bf, 0x4bf}, {0x4c2, 0x4c2}, {0x4c4, 0x4c4}, {0x4c6, 0x4c6}, + {0x4c8, 0x4c8}, {0x4ca, 0x4ca}, {0x4cc, 0x4cc}, {0x4ce, 0x4ce}, + {0x4d1, 0x4d1}, {0x4d3, 0x4d3}, {0x4d5, 0x4d5}, {0x4d7, 0x4d7}, + {0x4d9, 0x4d9}, {0x4db, 0x4db}, {0x4dd, 0x4dd}, {0x4df, 0x4df}, + {0x4e1, 0x4e1}, {0x4e3, 0x4e3}, {0x4e5, 0x4e5}, {0x4e7, 0x4e7}, + {0x4e9, 0x4e9}, {0x4eb, 0x4eb}, {0x4ed, 0x4ed}, {0x4ef, 0x4ef}, + {0x4f1, 0x4f1}, {0x4f3, 0x4f3}, {0x4f5, 0x4f5}, {0x4f9, 0x4f9}, + {0x501, 0x501}, {0x503, 0x503}, {0x505, 0x505}, {0x507, 0x507}, + {0x509, 0x509}, {0x50b, 0x50b}, {0x50d, 0x50d}, {0x50f, 0x50f}, + {0x561, 0x587}, {0x1d00, 0x1d2b}, {0x1d62, 0x1d6b}, {0x1e01, 0x1e01}, + {0x1e03, 0x1e03}, {0x1e05, 0x1e05}, {0x1e07, 0x1e07}, {0x1e09, 0x1e09}, + {0x1e0b, 0x1e0b}, {0x1e0d, 0x1e0d}, {0x1e0f, 0x1e0f}, {0x1e11, 0x1e11}, + {0x1e13, 0x1e13}, {0x1e15, 0x1e15}, {0x1e17, 0x1e17}, {0x1e19, 0x1e19}, + {0x1e1b, 0x1e1b}, {0x1e1d, 0x1e1d}, {0x1e1f, 0x1e1f}, {0x1e21, 0x1e21}, + {0x1e23, 0x1e23}, {0x1e25, 0x1e25}, {0x1e27, 0x1e27}, {0x1e29, 0x1e29}, + {0x1e2b, 0x1e2b}, {0x1e2d, 0x1e2d}, {0x1e2f, 0x1e2f}, {0x1e31, 0x1e31}, + {0x1e33, 0x1e33}, {0x1e35, 0x1e35}, {0x1e37, 0x1e37}, {0x1e39, 0x1e39}, + {0x1e3b, 0x1e3b}, {0x1e3d, 0x1e3d}, {0x1e3f, 0x1e3f}, {0x1e41, 0x1e41}, + {0x1e43, 0x1e43}, {0x1e45, 0x1e45}, {0x1e47, 0x1e47}, {0x1e49, 0x1e49}, + {0x1e4b, 0x1e4b}, {0x1e4d, 0x1e4d}, {0x1e4f, 0x1e4f}, {0x1e51, 0x1e51}, + {0x1e53, 0x1e53}, {0x1e55, 0x1e55}, {0x1e57, 0x1e57}, {0x1e59, 0x1e59}, + {0x1e5b, 0x1e5b}, {0x1e5d, 0x1e5d}, {0x1e5f, 0x1e5f}, {0x1e61, 0x1e61}, + {0x1e63, 0x1e63}, {0x1e65, 0x1e65}, {0x1e67, 0x1e67}, {0x1e69, 0x1e69}, + {0x1e6b, 0x1e6b}, {0x1e6d, 0x1e6d}, {0x1e6f, 0x1e6f}, {0x1e71, 0x1e71}, + {0x1e73, 0x1e73}, {0x1e75, 0x1e75}, {0x1e77, 0x1e77}, {0x1e79, 0x1e79}, + {0x1e7b, 0x1e7b}, {0x1e7d, 0x1e7d}, {0x1e7f, 0x1e7f}, {0x1e81, 0x1e81}, + {0x1e83, 0x1e83}, {0x1e85, 0x1e85}, {0x1e87, 0x1e87}, {0x1e89, 0x1e89}, + {0x1e8b, 0x1e8b}, {0x1e8d, 0x1e8d}, {0x1e8f, 0x1e8f}, {0x1e91, 0x1e91}, + {0x1e93, 0x1e93}, {0x1e95, 0x1e9b}, {0x1ea1, 0x1ea1}, {0x1ea3, 0x1ea3}, + {0x1ea5, 0x1ea5}, {0x1ea7, 0x1ea7}, {0x1ea9, 0x1ea9}, {0x1eab, 0x1eab}, + {0x1ead, 0x1ead}, {0x1eaf, 0x1eaf}, {0x1eb1, 0x1eb1}, {0x1eb3, 0x1eb3}, + {0x1eb5, 0x1eb5}, {0x1eb7, 0x1eb7}, {0x1eb9, 0x1eb9}, {0x1ebb, 0x1ebb}, + {0x1ebd, 0x1ebd}, {0x1ebf, 0x1ebf}, {0x1ec1, 0x1ec1}, {0x1ec3, 0x1ec3}, + {0x1ec5, 0x1ec5}, {0x1ec7, 0x1ec7}, {0x1ec9, 0x1ec9}, {0x1ecb, 0x1ecb}, + {0x1ecd, 0x1ecd}, {0x1ecf, 0x1ecf}, {0x1ed1, 0x1ed1}, {0x1ed3, 0x1ed3}, + {0x1ed5, 0x1ed5}, {0x1ed7, 0x1ed7}, {0x1ed9, 0x1ed9}, {0x1edb, 0x1edb}, + {0x1edd, 0x1edd}, {0x1edf, 0x1edf}, {0x1ee1, 0x1ee1}, {0x1ee3, 0x1ee3}, + {0x1ee5, 0x1ee5}, {0x1ee7, 0x1ee7}, {0x1ee9, 0x1ee9}, {0x1eeb, 0x1eeb}, + {0x1eed, 0x1eed}, {0x1eef, 0x1eef}, {0x1ef1, 0x1ef1}, {0x1ef3, 0x1ef3}, + {0x1ef5, 0x1ef5}, {0x1ef7, 0x1ef7}, {0x1ef9, 0x1ef9}, {0x1f00, 0x1f07}, + {0x1f10, 0x1f15}, {0x1f20, 0x1f27}, {0x1f30, 0x1f37}, {0x1f40, 0x1f45}, + {0x1f50, 0x1f57}, {0x1f60, 0x1f67}, {0x1f70, 0x1f7d}, {0x1f80, 0x1f87}, + {0x1f90, 0x1f97}, {0x1fa0, 0x1fa7}, {0x1fb0, 0x1fb4}, {0x1fb6, 0x1fb7}, + {0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fc7}, {0x1fd0, 0x1fd3}, + {0x1fd6, 0x1fd7}, {0x1fe0, 0x1fe7}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ff7}, + {0x2071, 0x2071}, {0x207f, 0x207f}, {0x210a, 0x210a}, {0x210e, 0x210f}, + {0x2113, 0x2113}, {0x212f, 0x212f}, {0x2134, 0x2134}, {0x2139, 0x2139}, + {0x213d, 0x213d}, {0x2146, 0x2149}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xff41, 0xff5a} }; -static const xmlChLRange xmlLlL[] = {{0x10428, 0x1044f}, {0x1d41a, 0x1d433}, - {0x1d44e, 0x1d454}, {0x1d456, 0x1d467}, {0x1d482, 0x1d49b}, - {0x1d4b6, 0x1d4b9}, {0x1d4bb, 0x1d4bb}, {0x1d4bd, 0x1d4c3}, - {0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503}, {0x1d51e, 0x1d537}, - {0x1d552, 0x1d56b}, {0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3}, - {0x1d5ee, 0x1d607}, {0x1d622, 0x1d63b}, {0x1d656, 0x1d66f}, - {0x1d68a, 0x1d6a3}, {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6e1}, - {0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, {0x1d736, 0x1d74e}, - {0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f}, +static const xmlChLRange xmlLlL[] = {{0x10428, 0x1044f}, {0x1d41a, 0x1d433}, + {0x1d44e, 0x1d454}, {0x1d456, 0x1d467}, {0x1d482, 0x1d49b}, + {0x1d4b6, 0x1d4b9}, {0x1d4bb, 0x1d4bb}, {0x1d4bd, 0x1d4c3}, + {0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503}, {0x1d51e, 0x1d537}, + {0x1d552, 0x1d56b}, {0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3}, + {0x1d5ee, 0x1d607}, {0x1d622, 0x1d63b}, {0x1d656, 0x1d66f}, + {0x1d68a, 0x1d6a3}, {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6e1}, + {0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, {0x1d736, 0x1d74e}, + {0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f}, {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9} }; static xmlChRangeGroup xmlLlG = {396,28,xmlLlS,xmlLlL}; -static const xmlChSRange xmlLmS[] = {{0x2b0, 0x2c1}, {0x2c6, 0x2d1}, - {0x2e0, 0x2e4}, {0x2ee, 0x2ee}, {0x37a, 0x37a}, {0x559, 0x559}, - {0x640, 0x640}, {0x6e5, 0x6e6}, {0xe46, 0xe46}, {0xec6, 0xec6}, - {0x17d7, 0x17d7}, {0x1843, 0x1843}, {0x1d2c, 0x1d61}, {0x3005, 0x3005}, - {0x3031, 0x3035}, {0x303b, 0x303b}, {0x309d, 0x309e}, {0x30fc, 0x30fe}, +static const xmlChSRange xmlLmS[] = {{0x2b0, 0x2c1}, {0x2c6, 0x2d1}, + {0x2e0, 0x2e4}, {0x2ee, 0x2ee}, {0x37a, 0x37a}, {0x559, 0x559}, + {0x640, 0x640}, {0x6e5, 0x6e6}, {0xe46, 0xe46}, {0xec6, 0xec6}, + {0x17d7, 0x17d7}, {0x1843, 0x1843}, {0x1d2c, 0x1d61}, {0x3005, 0x3005}, + {0x3031, 0x3035}, {0x303b, 0x303b}, {0x309d, 0x309e}, {0x30fc, 0x30fe}, {0xff70, 0xff70}, {0xff9e, 0xff9f} }; static xmlChRangeGroup xmlLmG = {20,0,xmlLmS,NULL}; -static const xmlChSRange xmlLoS[] = {{0x1bb, 0x1bb}, {0x1c0, 0x1c3}, - {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, {0x641, 0x64a}, - {0x66e, 0x66f}, {0x671, 0x6d3}, {0x6d5, 0x6d5}, {0x6ee, 0x6ef}, - {0x6fa, 0x6fc}, {0x6ff, 0x6ff}, {0x710, 0x710}, {0x712, 0x72f}, - {0x74d, 0x74f}, {0x780, 0x7a5}, {0x7b1, 0x7b1}, {0x904, 0x939}, - {0x93d, 0x93d}, {0x950, 0x950}, {0x958, 0x961}, {0x985, 0x98c}, - {0x98f, 0x990}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, - {0x9b6, 0x9b9}, {0x9bd, 0x9bd}, {0x9dc, 0x9dd}, {0x9df, 0x9e1}, - {0x9f0, 0x9f1}, {0xa05, 0xa0a}, {0xa0f, 0xa10}, {0xa13, 0xa28}, - {0xa2a, 0xa30}, {0xa32, 0xa33}, {0xa35, 0xa36}, {0xa38, 0xa39}, - {0xa59, 0xa5c}, {0xa5e, 0xa5e}, {0xa72, 0xa74}, {0xa85, 0xa8d}, - {0xa8f, 0xa91}, {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, - {0xab5, 0xab9}, {0xabd, 0xabd}, {0xad0, 0xad0}, {0xae0, 0xae1}, - {0xb05, 0xb0c}, {0xb0f, 0xb10}, {0xb13, 0xb28}, {0xb2a, 0xb30}, - {0xb32, 0xb33}, {0xb35, 0xb39}, {0xb3d, 0xb3d}, {0xb5c, 0xb5d}, - {0xb5f, 0xb61}, {0xb71, 0xb71}, {0xb83, 0xb83}, {0xb85, 0xb8a}, - {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c}, - {0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5}, - {0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, - {0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c}, - {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, - {0xcbd, 0xcbd}, {0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, - {0xd0e, 0xd10}, {0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, - {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdbd, 0xdbd}, - {0xdc0, 0xdc6}, {0xe01, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, - {0xe81, 0xe82}, {0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, - {0xe8d, 0xe8d}, {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, - {0xea5, 0xea5}, {0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeb0}, - {0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xedc, 0xedd}, - {0xf00, 0xf00}, {0xf40, 0xf47}, {0xf49, 0xf6a}, {0xf88, 0xf8b}, - {0x1000, 0x1021}, {0x1023, 0x1027}, {0x1029, 0x102a}, {0x1050, 0x1055}, - {0x10d0, 0x10f8}, {0x1100, 0x1159}, {0x115f, 0x11a2}, {0x11a8, 0x11f9}, - {0x1200, 0x1206}, {0x1208, 0x1246}, {0x1248, 0x1248}, {0x124a, 0x124d}, - {0x1250, 0x1256}, {0x1258, 0x1258}, {0x125a, 0x125d}, {0x1260, 0x1286}, - {0x1288, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12ae}, {0x12b0, 0x12b0}, - {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c0, 0x12c0}, {0x12c2, 0x12c5}, - {0x12c8, 0x12ce}, {0x12d0, 0x12d6}, {0x12d8, 0x12ee}, {0x12f0, 0x130e}, - {0x1310, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x131e}, {0x1320, 0x1346}, - {0x1348, 0x135a}, {0x13a0, 0x13f4}, {0x1401, 0x166c}, {0x166f, 0x1676}, - {0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x1700, 0x170c}, {0x170e, 0x1711}, - {0x1720, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770}, - {0x1780, 0x17b3}, {0x17dc, 0x17dc}, {0x1820, 0x1842}, {0x1844, 0x1877}, - {0x1880, 0x18a8}, {0x1900, 0x191c}, {0x1950, 0x196d}, {0x1970, 0x1974}, - {0x2135, 0x2138}, {0x3006, 0x3006}, {0x303c, 0x303c}, {0x3041, 0x3096}, - {0x309f, 0x309f}, {0x30a1, 0x30fa}, {0x30ff, 0x30ff}, {0x3105, 0x312c}, - {0x3131, 0x318e}, {0x31a0, 0x31b7}, {0x31f0, 0x31ff}, {0x3400, 0x3400}, - {0x4db5, 0x4db5}, {0x4e00, 0x4e00}, {0x9fa5, 0x9fa5}, {0xa000, 0xa48c}, - {0xac00, 0xac00}, {0xd7a3, 0xd7a3}, {0xf900, 0xfa2d}, {0xfa30, 0xfa6a}, - {0xfb1d, 0xfb1d}, {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, - {0xfb3e, 0xfb3e}, {0xfb40, 0xfb41}, {0xfb43, 0xfb44}, {0xfb46, 0xfbb1}, - {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, - {0xfe70, 0xfe74}, {0xfe76, 0xfefc}, {0xff66, 0xff6f}, {0xff71, 0xff9d}, - {0xffa0, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, +static const xmlChSRange xmlLoS[] = {{0x1bb, 0x1bb}, {0x1c0, 0x1c3}, + {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, {0x641, 0x64a}, + {0x66e, 0x66f}, {0x671, 0x6d3}, {0x6d5, 0x6d5}, {0x6ee, 0x6ef}, + {0x6fa, 0x6fc}, {0x6ff, 0x6ff}, {0x710, 0x710}, {0x712, 0x72f}, + {0x74d, 0x74f}, {0x780, 0x7a5}, {0x7b1, 0x7b1}, {0x904, 0x939}, + {0x93d, 0x93d}, {0x950, 0x950}, {0x958, 0x961}, {0x985, 0x98c}, + {0x98f, 0x990}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, + {0x9b6, 0x9b9}, {0x9bd, 0x9bd}, {0x9dc, 0x9dd}, {0x9df, 0x9e1}, + {0x9f0, 0x9f1}, {0xa05, 0xa0a}, {0xa0f, 0xa10}, {0xa13, 0xa28}, + {0xa2a, 0xa30}, {0xa32, 0xa33}, {0xa35, 0xa36}, {0xa38, 0xa39}, + {0xa59, 0xa5c}, {0xa5e, 0xa5e}, {0xa72, 0xa74}, {0xa85, 0xa8d}, + {0xa8f, 0xa91}, {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, + {0xab5, 0xab9}, {0xabd, 0xabd}, {0xad0, 0xad0}, {0xae0, 0xae1}, + {0xb05, 0xb0c}, {0xb0f, 0xb10}, {0xb13, 0xb28}, {0xb2a, 0xb30}, + {0xb32, 0xb33}, {0xb35, 0xb39}, {0xb3d, 0xb3d}, {0xb5c, 0xb5d}, + {0xb5f, 0xb61}, {0xb71, 0xb71}, {0xb83, 0xb83}, {0xb85, 0xb8a}, + {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c}, + {0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5}, + {0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, + {0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c}, + {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, + {0xcbd, 0xcbd}, {0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, + {0xd0e, 0xd10}, {0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, + {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdbd, 0xdbd}, + {0xdc0, 0xdc6}, {0xe01, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, + {0xe81, 0xe82}, {0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, + {0xe8d, 0xe8d}, {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, + {0xea5, 0xea5}, {0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeb0}, + {0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xedc, 0xedd}, + {0xf00, 0xf00}, {0xf40, 0xf47}, {0xf49, 0xf6a}, {0xf88, 0xf8b}, + {0x1000, 0x1021}, {0x1023, 0x1027}, {0x1029, 0x102a}, {0x1050, 0x1055}, + {0x10d0, 0x10f8}, {0x1100, 0x1159}, {0x115f, 0x11a2}, {0x11a8, 0x11f9}, + {0x1200, 0x1206}, {0x1208, 0x1246}, {0x1248, 0x1248}, {0x124a, 0x124d}, + {0x1250, 0x1256}, {0x1258, 0x1258}, {0x125a, 0x125d}, {0x1260, 0x1286}, + {0x1288, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12ae}, {0x12b0, 0x12b0}, + {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c0, 0x12c0}, {0x12c2, 0x12c5}, + {0x12c8, 0x12ce}, {0x12d0, 0x12d6}, {0x12d8, 0x12ee}, {0x12f0, 0x130e}, + {0x1310, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x131e}, {0x1320, 0x1346}, + {0x1348, 0x135a}, {0x13a0, 0x13f4}, {0x1401, 0x166c}, {0x166f, 0x1676}, + {0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x1700, 0x170c}, {0x170e, 0x1711}, + {0x1720, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770}, + {0x1780, 0x17b3}, {0x17dc, 0x17dc}, {0x1820, 0x1842}, {0x1844, 0x1877}, + {0x1880, 0x18a8}, {0x1900, 0x191c}, {0x1950, 0x196d}, {0x1970, 0x1974}, + {0x2135, 0x2138}, {0x3006, 0x3006}, {0x303c, 0x303c}, {0x3041, 0x3096}, + {0x309f, 0x309f}, {0x30a1, 0x30fa}, {0x30ff, 0x30ff}, {0x3105, 0x312c}, + {0x3131, 0x318e}, {0x31a0, 0x31b7}, {0x31f0, 0x31ff}, {0x3400, 0x3400}, + {0x4db5, 0x4db5}, {0x4e00, 0x4e00}, {0x9fa5, 0x9fa5}, {0xa000, 0xa48c}, + {0xac00, 0xac00}, {0xd7a3, 0xd7a3}, {0xf900, 0xfa2d}, {0xfa30, 0xfa6a}, + {0xfb1d, 0xfb1d}, {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, + {0xfb3e, 0xfb3e}, {0xfb40, 0xfb41}, {0xfb43, 0xfb44}, {0xfb46, 0xfbb1}, + {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, + {0xfe70, 0xfe74}, {0xfe76, 0xfefc}, {0xff66, 0xff6f}, {0xff71, 0xff9d}, + {0xffa0, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc} }; -static const xmlChLRange xmlLoL[] = {{0x10000, 0x1000b}, {0x1000d, 0x10026}, - {0x10028, 0x1003a}, {0x1003c, 0x1003d}, {0x1003f, 0x1004d}, - {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10300, 0x1031e}, - {0x10330, 0x10349}, {0x10380, 0x1039d}, {0x10450, 0x1049d}, - {0x10800, 0x10805}, {0x10808, 0x10808}, {0x1080a, 0x10835}, - {0x10837, 0x10838}, {0x1083c, 0x1083c}, {0x1083f, 0x1083f}, +static const xmlChLRange xmlLoL[] = {{0x10000, 0x1000b}, {0x1000d, 0x10026}, + {0x10028, 0x1003a}, {0x1003c, 0x1003d}, {0x1003f, 0x1004d}, + {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10300, 0x1031e}, + {0x10330, 0x10349}, {0x10380, 0x1039d}, {0x10450, 0x1049d}, + {0x10800, 0x10805}, {0x10808, 0x10808}, {0x1080a, 0x10835}, + {0x10837, 0x10838}, {0x1083c, 0x1083c}, {0x1083f, 0x1083f}, {0x20000, 0x20000}, {0x2a6d6, 0x2a6d6}, {0x2f800, 0x2fa1d} }; static xmlChRangeGroup xmlLoG = {211,20,xmlLoS,xmlLoL}; -static const xmlChSRange xmlLtS[] = {{0x1c5, 0x1c5}, {0x1c8, 0x1c8}, - {0x1cb, 0x1cb}, {0x1f2, 0x1f2}, {0x1f88, 0x1f8f}, {0x1f98, 0x1f9f}, +static const xmlChSRange xmlLtS[] = {{0x1c5, 0x1c5}, {0x1c8, 0x1c8}, + {0x1cb, 0x1cb}, {0x1f2, 0x1f2}, {0x1f88, 0x1f8f}, {0x1f98, 0x1f9f}, {0x1fa8, 0x1faf}, {0x1fbc, 0x1fbc}, {0x1fcc, 0x1fcc}, {0x1ffc, 0x1ffc} }; static xmlChRangeGroup xmlLtG = {10,0,xmlLtS,NULL}; -static const xmlChSRange xmlLuS[] = {{0x41, 0x5a}, {0xc0, 0xd6}, - {0xd8, 0xde}, {0x100, 0x100}, {0x102, 0x102}, {0x104, 0x104}, - {0x106, 0x106}, {0x108, 0x108}, {0x10a, 0x10a}, {0x10c, 0x10c}, - {0x10e, 0x10e}, {0x110, 0x110}, {0x112, 0x112}, {0x114, 0x114}, - {0x116, 0x116}, {0x118, 0x118}, {0x11a, 0x11a}, {0x11c, 0x11c}, - {0x11e, 0x11e}, {0x120, 0x120}, {0x122, 0x122}, {0x124, 0x124}, - {0x126, 0x126}, {0x128, 0x128}, {0x12a, 0x12a}, {0x12c, 0x12c}, - {0x12e, 0x12e}, {0x130, 0x130}, {0x132, 0x132}, {0x134, 0x134}, - {0x136, 0x136}, {0x139, 0x139}, {0x13b, 0x13b}, {0x13d, 0x13d}, - {0x13f, 0x13f}, {0x141, 0x141}, {0x143, 0x143}, {0x145, 0x145}, - {0x147, 0x147}, {0x14a, 0x14a}, {0x14c, 0x14c}, {0x14e, 0x14e}, - {0x150, 0x150}, {0x152, 0x152}, {0x154, 0x154}, {0x156, 0x156}, - {0x158, 0x158}, {0x15a, 0x15a}, {0x15c, 0x15c}, {0x15e, 0x15e}, - {0x160, 0x160}, {0x162, 0x162}, {0x164, 0x164}, {0x166, 0x166}, - {0x168, 0x168}, {0x16a, 0x16a}, {0x16c, 0x16c}, {0x16e, 0x16e}, - {0x170, 0x170}, {0x172, 0x172}, {0x174, 0x174}, {0x176, 0x176}, - {0x178, 0x179}, {0x17b, 0x17b}, {0x17d, 0x17d}, {0x181, 0x182}, - {0x184, 0x184}, {0x186, 0x187}, {0x189, 0x18b}, {0x18e, 0x191}, - {0x193, 0x194}, {0x196, 0x198}, {0x19c, 0x19d}, {0x19f, 0x1a0}, - {0x1a2, 0x1a2}, {0x1a4, 0x1a4}, {0x1a6, 0x1a7}, {0x1a9, 0x1a9}, - {0x1ac, 0x1ac}, {0x1ae, 0x1af}, {0x1b1, 0x1b3}, {0x1b5, 0x1b5}, - {0x1b7, 0x1b8}, {0x1bc, 0x1bc}, {0x1c4, 0x1c4}, {0x1c7, 0x1c7}, - {0x1ca, 0x1ca}, {0x1cd, 0x1cd}, {0x1cf, 0x1cf}, {0x1d1, 0x1d1}, - {0x1d3, 0x1d3}, {0x1d5, 0x1d5}, {0x1d7, 0x1d7}, {0x1d9, 0x1d9}, - {0x1db, 0x1db}, {0x1de, 0x1de}, {0x1e0, 0x1e0}, {0x1e2, 0x1e2}, - {0x1e4, 0x1e4}, {0x1e6, 0x1e6}, {0x1e8, 0x1e8}, {0x1ea, 0x1ea}, - {0x1ec, 0x1ec}, {0x1ee, 0x1ee}, {0x1f1, 0x1f1}, {0x1f4, 0x1f4}, - {0x1f6, 0x1f8}, {0x1fa, 0x1fa}, {0x1fc, 0x1fc}, {0x1fe, 0x1fe}, - {0x200, 0x200}, {0x202, 0x202}, {0x204, 0x204}, {0x206, 0x206}, - {0x208, 0x208}, {0x20a, 0x20a}, {0x20c, 0x20c}, {0x20e, 0x20e}, - {0x210, 0x210}, {0x212, 0x212}, {0x214, 0x214}, {0x216, 0x216}, - {0x218, 0x218}, {0x21a, 0x21a}, {0x21c, 0x21c}, {0x21e, 0x21e}, - {0x220, 0x220}, {0x222, 0x222}, {0x224, 0x224}, {0x226, 0x226}, - {0x228, 0x228}, {0x22a, 0x22a}, {0x22c, 0x22c}, {0x22e, 0x22e}, - {0x230, 0x230}, {0x232, 0x232}, {0x386, 0x386}, {0x388, 0x38a}, - {0x38c, 0x38c}, {0x38e, 0x38f}, {0x391, 0x3a1}, {0x3a3, 0x3ab}, - {0x3d2, 0x3d4}, {0x3d8, 0x3d8}, {0x3da, 0x3da}, {0x3dc, 0x3dc}, - {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3e2}, {0x3e4, 0x3e4}, - {0x3e6, 0x3e6}, {0x3e8, 0x3e8}, {0x3ea, 0x3ea}, {0x3ec, 0x3ec}, - {0x3ee, 0x3ee}, {0x3f4, 0x3f4}, {0x3f7, 0x3f7}, {0x3f9, 0x3fa}, - {0x400, 0x42f}, {0x460, 0x460}, {0x462, 0x462}, {0x464, 0x464}, - {0x466, 0x466}, {0x468, 0x468}, {0x46a, 0x46a}, {0x46c, 0x46c}, - {0x46e, 0x46e}, {0x470, 0x470}, {0x472, 0x472}, {0x474, 0x474}, - {0x476, 0x476}, {0x478, 0x478}, {0x47a, 0x47a}, {0x47c, 0x47c}, - {0x47e, 0x47e}, {0x480, 0x480}, {0x48a, 0x48a}, {0x48c, 0x48c}, - {0x48e, 0x48e}, {0x490, 0x490}, {0x492, 0x492}, {0x494, 0x494}, - {0x496, 0x496}, {0x498, 0x498}, {0x49a, 0x49a}, {0x49c, 0x49c}, - {0x49e, 0x49e}, {0x4a0, 0x4a0}, {0x4a2, 0x4a2}, {0x4a4, 0x4a4}, - {0x4a6, 0x4a6}, {0x4a8, 0x4a8}, {0x4aa, 0x4aa}, {0x4ac, 0x4ac}, - {0x4ae, 0x4ae}, {0x4b0, 0x4b0}, {0x4b2, 0x4b2}, {0x4b4, 0x4b4}, - {0x4b6, 0x4b6}, {0x4b8, 0x4b8}, {0x4ba, 0x4ba}, {0x4bc, 0x4bc}, - {0x4be, 0x4be}, {0x4c0, 0x4c1}, {0x4c3, 0x4c3}, {0x4c5, 0x4c5}, - {0x4c7, 0x4c7}, {0x4c9, 0x4c9}, {0x4cb, 0x4cb}, {0x4cd, 0x4cd}, - {0x4d0, 0x4d0}, {0x4d2, 0x4d2}, {0x4d4, 0x4d4}, {0x4d6, 0x4d6}, - {0x4d8, 0x4d8}, {0x4da, 0x4da}, {0x4dc, 0x4dc}, {0x4de, 0x4de}, - {0x4e0, 0x4e0}, {0x4e2, 0x4e2}, {0x4e4, 0x4e4}, {0x4e6, 0x4e6}, - {0x4e8, 0x4e8}, {0x4ea, 0x4ea}, {0x4ec, 0x4ec}, {0x4ee, 0x4ee}, - {0x4f0, 0x4f0}, {0x4f2, 0x4f2}, {0x4f4, 0x4f4}, {0x4f8, 0x4f8}, - {0x500, 0x500}, {0x502, 0x502}, {0x504, 0x504}, {0x506, 0x506}, - {0x508, 0x508}, {0x50a, 0x50a}, {0x50c, 0x50c}, {0x50e, 0x50e}, - {0x531, 0x556}, {0x10a0, 0x10c5}, {0x1e00, 0x1e00}, {0x1e02, 0x1e02}, - {0x1e04, 0x1e04}, {0x1e06, 0x1e06}, {0x1e08, 0x1e08}, {0x1e0a, 0x1e0a}, - {0x1e0c, 0x1e0c}, {0x1e0e, 0x1e0e}, {0x1e10, 0x1e10}, {0x1e12, 0x1e12}, - {0x1e14, 0x1e14}, {0x1e16, 0x1e16}, {0x1e18, 0x1e18}, {0x1e1a, 0x1e1a}, - {0x1e1c, 0x1e1c}, {0x1e1e, 0x1e1e}, {0x1e20, 0x1e20}, {0x1e22, 0x1e22}, - {0x1e24, 0x1e24}, {0x1e26, 0x1e26}, {0x1e28, 0x1e28}, {0x1e2a, 0x1e2a}, - {0x1e2c, 0x1e2c}, {0x1e2e, 0x1e2e}, {0x1e30, 0x1e30}, {0x1e32, 0x1e32}, - {0x1e34, 0x1e34}, {0x1e36, 0x1e36}, {0x1e38, 0x1e38}, {0x1e3a, 0x1e3a}, - {0x1e3c, 0x1e3c}, {0x1e3e, 0x1e3e}, {0x1e40, 0x1e40}, {0x1e42, 0x1e42}, - {0x1e44, 0x1e44}, {0x1e46, 0x1e46}, {0x1e48, 0x1e48}, {0x1e4a, 0x1e4a}, - {0x1e4c, 0x1e4c}, {0x1e4e, 0x1e4e}, {0x1e50, 0x1e50}, {0x1e52, 0x1e52}, - {0x1e54, 0x1e54}, {0x1e56, 0x1e56}, {0x1e58, 0x1e58}, {0x1e5a, 0x1e5a}, - {0x1e5c, 0x1e5c}, {0x1e5e, 0x1e5e}, {0x1e60, 0x1e60}, {0x1e62, 0x1e62}, - {0x1e64, 0x1e64}, {0x1e66, 0x1e66}, {0x1e68, 0x1e68}, {0x1e6a, 0x1e6a}, - {0x1e6c, 0x1e6c}, {0x1e6e, 0x1e6e}, {0x1e70, 0x1e70}, {0x1e72, 0x1e72}, - {0x1e74, 0x1e74}, {0x1e76, 0x1e76}, {0x1e78, 0x1e78}, {0x1e7a, 0x1e7a}, - {0x1e7c, 0x1e7c}, {0x1e7e, 0x1e7e}, {0x1e80, 0x1e80}, {0x1e82, 0x1e82}, - {0x1e84, 0x1e84}, {0x1e86, 0x1e86}, {0x1e88, 0x1e88}, {0x1e8a, 0x1e8a}, - {0x1e8c, 0x1e8c}, {0x1e8e, 0x1e8e}, {0x1e90, 0x1e90}, {0x1e92, 0x1e92}, - {0x1e94, 0x1e94}, {0x1ea0, 0x1ea0}, {0x1ea2, 0x1ea2}, {0x1ea4, 0x1ea4}, - {0x1ea6, 0x1ea6}, {0x1ea8, 0x1ea8}, {0x1eaa, 0x1eaa}, {0x1eac, 0x1eac}, - {0x1eae, 0x1eae}, {0x1eb0, 0x1eb0}, {0x1eb2, 0x1eb2}, {0x1eb4, 0x1eb4}, - {0x1eb6, 0x1eb6}, {0x1eb8, 0x1eb8}, {0x1eba, 0x1eba}, {0x1ebc, 0x1ebc}, - {0x1ebe, 0x1ebe}, {0x1ec0, 0x1ec0}, {0x1ec2, 0x1ec2}, {0x1ec4, 0x1ec4}, - {0x1ec6, 0x1ec6}, {0x1ec8, 0x1ec8}, {0x1eca, 0x1eca}, {0x1ecc, 0x1ecc}, - {0x1ece, 0x1ece}, {0x1ed0, 0x1ed0}, {0x1ed2, 0x1ed2}, {0x1ed4, 0x1ed4}, - {0x1ed6, 0x1ed6}, {0x1ed8, 0x1ed8}, {0x1eda, 0x1eda}, {0x1edc, 0x1edc}, - {0x1ede, 0x1ede}, {0x1ee0, 0x1ee0}, {0x1ee2, 0x1ee2}, {0x1ee4, 0x1ee4}, - {0x1ee6, 0x1ee6}, {0x1ee8, 0x1ee8}, {0x1eea, 0x1eea}, {0x1eec, 0x1eec}, - {0x1eee, 0x1eee}, {0x1ef0, 0x1ef0}, {0x1ef2, 0x1ef2}, {0x1ef4, 0x1ef4}, - {0x1ef6, 0x1ef6}, {0x1ef8, 0x1ef8}, {0x1f08, 0x1f0f}, {0x1f18, 0x1f1d}, - {0x1f28, 0x1f2f}, {0x1f38, 0x1f3f}, {0x1f48, 0x1f4d}, {0x1f59, 0x1f59}, - {0x1f5b, 0x1f5b}, {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f5f}, {0x1f68, 0x1f6f}, - {0x1fb8, 0x1fbb}, {0x1fc8, 0x1fcb}, {0x1fd8, 0x1fdb}, {0x1fe8, 0x1fec}, - {0x1ff8, 0x1ffb}, {0x2102, 0x2102}, {0x2107, 0x2107}, {0x210b, 0x210d}, - {0x2110, 0x2112}, {0x2115, 0x2115}, {0x2119, 0x211d}, {0x2124, 0x2124}, - {0x2126, 0x2126}, {0x2128, 0x2128}, {0x212a, 0x212d}, {0x2130, 0x2131}, +static const xmlChSRange xmlLuS[] = {{0x41, 0x5a}, {0xc0, 0xd6}, + {0xd8, 0xde}, {0x100, 0x100}, {0x102, 0x102}, {0x104, 0x104}, + {0x106, 0x106}, {0x108, 0x108}, {0x10a, 0x10a}, {0x10c, 0x10c}, + {0x10e, 0x10e}, {0x110, 0x110}, {0x112, 0x112}, {0x114, 0x114}, + {0x116, 0x116}, {0x118, 0x118}, {0x11a, 0x11a}, {0x11c, 0x11c}, + {0x11e, 0x11e}, {0x120, 0x120}, {0x122, 0x122}, {0x124, 0x124}, + {0x126, 0x126}, {0x128, 0x128}, {0x12a, 0x12a}, {0x12c, 0x12c}, + {0x12e, 0x12e}, {0x130, 0x130}, {0x132, 0x132}, {0x134, 0x134}, + {0x136, 0x136}, {0x139, 0x139}, {0x13b, 0x13b}, {0x13d, 0x13d}, + {0x13f, 0x13f}, {0x141, 0x141}, {0x143, 0x143}, {0x145, 0x145}, + {0x147, 0x147}, {0x14a, 0x14a}, {0x14c, 0x14c}, {0x14e, 0x14e}, + {0x150, 0x150}, {0x152, 0x152}, {0x154, 0x154}, {0x156, 0x156}, + {0x158, 0x158}, {0x15a, 0x15a}, {0x15c, 0x15c}, {0x15e, 0x15e}, + {0x160, 0x160}, {0x162, 0x162}, {0x164, 0x164}, {0x166, 0x166}, + {0x168, 0x168}, {0x16a, 0x16a}, {0x16c, 0x16c}, {0x16e, 0x16e}, + {0x170, 0x170}, {0x172, 0x172}, {0x174, 0x174}, {0x176, 0x176}, + {0x178, 0x179}, {0x17b, 0x17b}, {0x17d, 0x17d}, {0x181, 0x182}, + {0x184, 0x184}, {0x186, 0x187}, {0x189, 0x18b}, {0x18e, 0x191}, + {0x193, 0x194}, {0x196, 0x198}, {0x19c, 0x19d}, {0x19f, 0x1a0}, + {0x1a2, 0x1a2}, {0x1a4, 0x1a4}, {0x1a6, 0x1a7}, {0x1a9, 0x1a9}, + {0x1ac, 0x1ac}, {0x1ae, 0x1af}, {0x1b1, 0x1b3}, {0x1b5, 0x1b5}, + {0x1b7, 0x1b8}, {0x1bc, 0x1bc}, {0x1c4, 0x1c4}, {0x1c7, 0x1c7}, + {0x1ca, 0x1ca}, {0x1cd, 0x1cd}, {0x1cf, 0x1cf}, {0x1d1, 0x1d1}, + {0x1d3, 0x1d3}, {0x1d5, 0x1d5}, {0x1d7, 0x1d7}, {0x1d9, 0x1d9}, + {0x1db, 0x1db}, {0x1de, 0x1de}, {0x1e0, 0x1e0}, {0x1e2, 0x1e2}, + {0x1e4, 0x1e4}, {0x1e6, 0x1e6}, {0x1e8, 0x1e8}, {0x1ea, 0x1ea}, + {0x1ec, 0x1ec}, {0x1ee, 0x1ee}, {0x1f1, 0x1f1}, {0x1f4, 0x1f4}, + {0x1f6, 0x1f8}, {0x1fa, 0x1fa}, {0x1fc, 0x1fc}, {0x1fe, 0x1fe}, + {0x200, 0x200}, {0x202, 0x202}, {0x204, 0x204}, {0x206, 0x206}, + {0x208, 0x208}, {0x20a, 0x20a}, {0x20c, 0x20c}, {0x20e, 0x20e}, + {0x210, 0x210}, {0x212, 0x212}, {0x214, 0x214}, {0x216, 0x216}, + {0x218, 0x218}, {0x21a, 0x21a}, {0x21c, 0x21c}, {0x21e, 0x21e}, + {0x220, 0x220}, {0x222, 0x222}, {0x224, 0x224}, {0x226, 0x226}, + {0x228, 0x228}, {0x22a, 0x22a}, {0x22c, 0x22c}, {0x22e, 0x22e}, + {0x230, 0x230}, {0x232, 0x232}, {0x386, 0x386}, {0x388, 0x38a}, + {0x38c, 0x38c}, {0x38e, 0x38f}, {0x391, 0x3a1}, {0x3a3, 0x3ab}, + {0x3d2, 0x3d4}, {0x3d8, 0x3d8}, {0x3da, 0x3da}, {0x3dc, 0x3dc}, + {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3e2}, {0x3e4, 0x3e4}, + {0x3e6, 0x3e6}, {0x3e8, 0x3e8}, {0x3ea, 0x3ea}, {0x3ec, 0x3ec}, + {0x3ee, 0x3ee}, {0x3f4, 0x3f4}, {0x3f7, 0x3f7}, {0x3f9, 0x3fa}, + {0x400, 0x42f}, {0x460, 0x460}, {0x462, 0x462}, {0x464, 0x464}, + {0x466, 0x466}, {0x468, 0x468}, {0x46a, 0x46a}, {0x46c, 0x46c}, + {0x46e, 0x46e}, {0x470, 0x470}, {0x472, 0x472}, {0x474, 0x474}, + {0x476, 0x476}, {0x478, 0x478}, {0x47a, 0x47a}, {0x47c, 0x47c}, + {0x47e, 0x47e}, {0x480, 0x480}, {0x48a, 0x48a}, {0x48c, 0x48c}, + {0x48e, 0x48e}, {0x490, 0x490}, {0x492, 0x492}, {0x494, 0x494}, + {0x496, 0x496}, {0x498, 0x498}, {0x49a, 0x49a}, {0x49c, 0x49c}, + {0x49e, 0x49e}, {0x4a0, 0x4a0}, {0x4a2, 0x4a2}, {0x4a4, 0x4a4}, + {0x4a6, 0x4a6}, {0x4a8, 0x4a8}, {0x4aa, 0x4aa}, {0x4ac, 0x4ac}, + {0x4ae, 0x4ae}, {0x4b0, 0x4b0}, {0x4b2, 0x4b2}, {0x4b4, 0x4b4}, + {0x4b6, 0x4b6}, {0x4b8, 0x4b8}, {0x4ba, 0x4ba}, {0x4bc, 0x4bc}, + {0x4be, 0x4be}, {0x4c0, 0x4c1}, {0x4c3, 0x4c3}, {0x4c5, 0x4c5}, + {0x4c7, 0x4c7}, {0x4c9, 0x4c9}, {0x4cb, 0x4cb}, {0x4cd, 0x4cd}, + {0x4d0, 0x4d0}, {0x4d2, 0x4d2}, {0x4d4, 0x4d4}, {0x4d6, 0x4d6}, + {0x4d8, 0x4d8}, {0x4da, 0x4da}, {0x4dc, 0x4dc}, {0x4de, 0x4de}, + {0x4e0, 0x4e0}, {0x4e2, 0x4e2}, {0x4e4, 0x4e4}, {0x4e6, 0x4e6}, + {0x4e8, 0x4e8}, {0x4ea, 0x4ea}, {0x4ec, 0x4ec}, {0x4ee, 0x4ee}, + {0x4f0, 0x4f0}, {0x4f2, 0x4f2}, {0x4f4, 0x4f4}, {0x4f8, 0x4f8}, + {0x500, 0x500}, {0x502, 0x502}, {0x504, 0x504}, {0x506, 0x506}, + {0x508, 0x508}, {0x50a, 0x50a}, {0x50c, 0x50c}, {0x50e, 0x50e}, + {0x531, 0x556}, {0x10a0, 0x10c5}, {0x1e00, 0x1e00}, {0x1e02, 0x1e02}, + {0x1e04, 0x1e04}, {0x1e06, 0x1e06}, {0x1e08, 0x1e08}, {0x1e0a, 0x1e0a}, + {0x1e0c, 0x1e0c}, {0x1e0e, 0x1e0e}, {0x1e10, 0x1e10}, {0x1e12, 0x1e12}, + {0x1e14, 0x1e14}, {0x1e16, 0x1e16}, {0x1e18, 0x1e18}, {0x1e1a, 0x1e1a}, + {0x1e1c, 0x1e1c}, {0x1e1e, 0x1e1e}, {0x1e20, 0x1e20}, {0x1e22, 0x1e22}, + {0x1e24, 0x1e24}, {0x1e26, 0x1e26}, {0x1e28, 0x1e28}, {0x1e2a, 0x1e2a}, + {0x1e2c, 0x1e2c}, {0x1e2e, 0x1e2e}, {0x1e30, 0x1e30}, {0x1e32, 0x1e32}, + {0x1e34, 0x1e34}, {0x1e36, 0x1e36}, {0x1e38, 0x1e38}, {0x1e3a, 0x1e3a}, + {0x1e3c, 0x1e3c}, {0x1e3e, 0x1e3e}, {0x1e40, 0x1e40}, {0x1e42, 0x1e42}, + {0x1e44, 0x1e44}, {0x1e46, 0x1e46}, {0x1e48, 0x1e48}, {0x1e4a, 0x1e4a}, + {0x1e4c, 0x1e4c}, {0x1e4e, 0x1e4e}, {0x1e50, 0x1e50}, {0x1e52, 0x1e52}, + {0x1e54, 0x1e54}, {0x1e56, 0x1e56}, {0x1e58, 0x1e58}, {0x1e5a, 0x1e5a}, + {0x1e5c, 0x1e5c}, {0x1e5e, 0x1e5e}, {0x1e60, 0x1e60}, {0x1e62, 0x1e62}, + {0x1e64, 0x1e64}, {0x1e66, 0x1e66}, {0x1e68, 0x1e68}, {0x1e6a, 0x1e6a}, + {0x1e6c, 0x1e6c}, {0x1e6e, 0x1e6e}, {0x1e70, 0x1e70}, {0x1e72, 0x1e72}, + {0x1e74, 0x1e74}, {0x1e76, 0x1e76}, {0x1e78, 0x1e78}, {0x1e7a, 0x1e7a}, + {0x1e7c, 0x1e7c}, {0x1e7e, 0x1e7e}, {0x1e80, 0x1e80}, {0x1e82, 0x1e82}, + {0x1e84, 0x1e84}, {0x1e86, 0x1e86}, {0x1e88, 0x1e88}, {0x1e8a, 0x1e8a}, + {0x1e8c, 0x1e8c}, {0x1e8e, 0x1e8e}, {0x1e90, 0x1e90}, {0x1e92, 0x1e92}, + {0x1e94, 0x1e94}, {0x1ea0, 0x1ea0}, {0x1ea2, 0x1ea2}, {0x1ea4, 0x1ea4}, + {0x1ea6, 0x1ea6}, {0x1ea8, 0x1ea8}, {0x1eaa, 0x1eaa}, {0x1eac, 0x1eac}, + {0x1eae, 0x1eae}, {0x1eb0, 0x1eb0}, {0x1eb2, 0x1eb2}, {0x1eb4, 0x1eb4}, + {0x1eb6, 0x1eb6}, {0x1eb8, 0x1eb8}, {0x1eba, 0x1eba}, {0x1ebc, 0x1ebc}, + {0x1ebe, 0x1ebe}, {0x1ec0, 0x1ec0}, {0x1ec2, 0x1ec2}, {0x1ec4, 0x1ec4}, + {0x1ec6, 0x1ec6}, {0x1ec8, 0x1ec8}, {0x1eca, 0x1eca}, {0x1ecc, 0x1ecc}, + {0x1ece, 0x1ece}, {0x1ed0, 0x1ed0}, {0x1ed2, 0x1ed2}, {0x1ed4, 0x1ed4}, + {0x1ed6, 0x1ed6}, {0x1ed8, 0x1ed8}, {0x1eda, 0x1eda}, {0x1edc, 0x1edc}, + {0x1ede, 0x1ede}, {0x1ee0, 0x1ee0}, {0x1ee2, 0x1ee2}, {0x1ee4, 0x1ee4}, + {0x1ee6, 0x1ee6}, {0x1ee8, 0x1ee8}, {0x1eea, 0x1eea}, {0x1eec, 0x1eec}, + {0x1eee, 0x1eee}, {0x1ef0, 0x1ef0}, {0x1ef2, 0x1ef2}, {0x1ef4, 0x1ef4}, + {0x1ef6, 0x1ef6}, {0x1ef8, 0x1ef8}, {0x1f08, 0x1f0f}, {0x1f18, 0x1f1d}, + {0x1f28, 0x1f2f}, {0x1f38, 0x1f3f}, {0x1f48, 0x1f4d}, {0x1f59, 0x1f59}, + {0x1f5b, 0x1f5b}, {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f5f}, {0x1f68, 0x1f6f}, + {0x1fb8, 0x1fbb}, {0x1fc8, 0x1fcb}, {0x1fd8, 0x1fdb}, {0x1fe8, 0x1fec}, + {0x1ff8, 0x1ffb}, {0x2102, 0x2102}, {0x2107, 0x2107}, {0x210b, 0x210d}, + {0x2110, 0x2112}, {0x2115, 0x2115}, {0x2119, 0x211d}, {0x2124, 0x2124}, + {0x2126, 0x2126}, {0x2128, 0x2128}, {0x212a, 0x212d}, {0x2130, 0x2131}, {0x2133, 0x2133}, {0x213e, 0x213f}, {0x2145, 0x2145}, {0xff21, 0xff3a} }; -static const xmlChLRange xmlLuL[] = {{0x10400, 0x10427}, {0x1d400, 0x1d419}, - {0x1d434, 0x1d44d}, {0x1d468, 0x1d481}, {0x1d49c, 0x1d49c}, - {0x1d49e, 0x1d49f}, {0x1d4a2, 0x1d4a2}, {0x1d4a5, 0x1d4a6}, - {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b5}, {0x1d4d0, 0x1d4e9}, - {0x1d504, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, - {0x1d516, 0x1d51c}, {0x1d538, 0x1d539}, {0x1d53b, 0x1d53e}, - {0x1d540, 0x1d544}, {0x1d546, 0x1d546}, {0x1d54a, 0x1d550}, - {0x1d56c, 0x1d585}, {0x1d5a0, 0x1d5b9}, {0x1d5d4, 0x1d5ed}, - {0x1d608, 0x1d621}, {0x1d63c, 0x1d655}, {0x1d670, 0x1d689}, - {0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, {0x1d71c, 0x1d734}, +static const xmlChLRange xmlLuL[] = {{0x10400, 0x10427}, {0x1d400, 0x1d419}, + {0x1d434, 0x1d44d}, {0x1d468, 0x1d481}, {0x1d49c, 0x1d49c}, + {0x1d49e, 0x1d49f}, {0x1d4a2, 0x1d4a2}, {0x1d4a5, 0x1d4a6}, + {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b5}, {0x1d4d0, 0x1d4e9}, + {0x1d504, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, + {0x1d516, 0x1d51c}, {0x1d538, 0x1d539}, {0x1d53b, 0x1d53e}, + {0x1d540, 0x1d544}, {0x1d546, 0x1d546}, {0x1d54a, 0x1d550}, + {0x1d56c, 0x1d585}, {0x1d5a0, 0x1d5b9}, {0x1d5d4, 0x1d5ed}, + {0x1d608, 0x1d621}, {0x1d63c, 0x1d655}, {0x1d670, 0x1d689}, + {0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, {0x1d71c, 0x1d734}, {0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8} }; static xmlChRangeGroup xmlLuG = {390,31,xmlLuS,xmlLuL}; -static const xmlChSRange xmlMS[] = {{0x300, 0x357}, {0x35d, 0x36f}, - {0x483, 0x486}, {0x488, 0x489}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, - {0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4}, - {0x610, 0x615}, {0x64b, 0x658}, {0x670, 0x670}, {0x6d6, 0x6dc}, - {0x6de, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x711, 0x711}, - {0x730, 0x74a}, {0x7a6, 0x7b0}, {0x901, 0x903}, {0x93c, 0x93c}, - {0x93e, 0x94d}, {0x951, 0x954}, {0x962, 0x963}, {0x981, 0x983}, - {0x9bc, 0x9bc}, {0x9be, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd}, - {0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa01, 0xa03}, {0xa3c, 0xa3c}, - {0xa3e, 0xa42}, {0xa47, 0xa48}, {0xa4b, 0xa4d}, {0xa70, 0xa71}, - {0xa81, 0xa83}, {0xabc, 0xabc}, {0xabe, 0xac5}, {0xac7, 0xac9}, - {0xacb, 0xacd}, {0xae2, 0xae3}, {0xb01, 0xb03}, {0xb3c, 0xb3c}, - {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d}, {0xb56, 0xb57}, - {0xb82, 0xb82}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, {0xbca, 0xbcd}, - {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44}, {0xc46, 0xc48}, - {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83}, {0xcbc, 0xcbc}, - {0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6}, - {0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d}, - {0xd57, 0xd57}, {0xd82, 0xd83}, {0xdca, 0xdca}, {0xdcf, 0xdd4}, - {0xdd6, 0xdd6}, {0xdd8, 0xddf}, {0xdf2, 0xdf3}, {0xe31, 0xe31}, - {0xe34, 0xe3a}, {0xe47, 0xe4e}, {0xeb1, 0xeb1}, {0xeb4, 0xeb9}, - {0xebb, 0xebc}, {0xec8, 0xecd}, {0xf18, 0xf19}, {0xf35, 0xf35}, - {0xf37, 0xf37}, {0xf39, 0xf39}, {0xf3e, 0xf3f}, {0xf71, 0xf84}, - {0xf86, 0xf87}, {0xf90, 0xf97}, {0xf99, 0xfbc}, {0xfc6, 0xfc6}, - {0x102c, 0x1032}, {0x1036, 0x1039}, {0x1056, 0x1059}, {0x1712, 0x1714}, - {0x1732, 0x1734}, {0x1752, 0x1753}, {0x1772, 0x1773}, {0x17b6, 0x17d3}, - {0x17dd, 0x17dd}, {0x180b, 0x180d}, {0x18a9, 0x18a9}, {0x1920, 0x192b}, - {0x1930, 0x193b}, {0x20d0, 0x20ea}, {0x302a, 0x302f}, {0x3099, 0x309a}, +static const xmlChSRange xmlMS[] = {{0x300, 0x357}, {0x35d, 0x36f}, + {0x483, 0x486}, {0x488, 0x489}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, + {0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4}, + {0x610, 0x615}, {0x64b, 0x658}, {0x670, 0x670}, {0x6d6, 0x6dc}, + {0x6de, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x711, 0x711}, + {0x730, 0x74a}, {0x7a6, 0x7b0}, {0x901, 0x903}, {0x93c, 0x93c}, + {0x93e, 0x94d}, {0x951, 0x954}, {0x962, 0x963}, {0x981, 0x983}, + {0x9bc, 0x9bc}, {0x9be, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd}, + {0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa01, 0xa03}, {0xa3c, 0xa3c}, + {0xa3e, 0xa42}, {0xa47, 0xa48}, {0xa4b, 0xa4d}, {0xa70, 0xa71}, + {0xa81, 0xa83}, {0xabc, 0xabc}, {0xabe, 0xac5}, {0xac7, 0xac9}, + {0xacb, 0xacd}, {0xae2, 0xae3}, {0xb01, 0xb03}, {0xb3c, 0xb3c}, + {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d}, {0xb56, 0xb57}, + {0xb82, 0xb82}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, {0xbca, 0xbcd}, + {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44}, {0xc46, 0xc48}, + {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83}, {0xcbc, 0xcbc}, + {0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6}, + {0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d}, + {0xd57, 0xd57}, {0xd82, 0xd83}, {0xdca, 0xdca}, {0xdcf, 0xdd4}, + {0xdd6, 0xdd6}, {0xdd8, 0xddf}, {0xdf2, 0xdf3}, {0xe31, 0xe31}, + {0xe34, 0xe3a}, {0xe47, 0xe4e}, {0xeb1, 0xeb1}, {0xeb4, 0xeb9}, + {0xebb, 0xebc}, {0xec8, 0xecd}, {0xf18, 0xf19}, {0xf35, 0xf35}, + {0xf37, 0xf37}, {0xf39, 0xf39}, {0xf3e, 0xf3f}, {0xf71, 0xf84}, + {0xf86, 0xf87}, {0xf90, 0xf97}, {0xf99, 0xfbc}, {0xfc6, 0xfc6}, + {0x102c, 0x1032}, {0x1036, 0x1039}, {0x1056, 0x1059}, {0x1712, 0x1714}, + {0x1732, 0x1734}, {0x1752, 0x1753}, {0x1772, 0x1773}, {0x17b6, 0x17d3}, + {0x17dd, 0x17dd}, {0x180b, 0x180d}, {0x18a9, 0x18a9}, {0x1920, 0x192b}, + {0x1930, 0x193b}, {0x20d0, 0x20ea}, {0x302a, 0x302f}, {0x3099, 0x309a}, {0xfb1e, 0xfb1e}, {0xfe00, 0xfe0f}, {0xfe20, 0xfe23} }; -static const xmlChLRange xmlML[] = {{0x1d165, 0x1d169}, {0x1d16d, 0x1d172}, - {0x1d17b, 0x1d182}, {0x1d185, 0x1d18b}, {0x1d1aa, 0x1d1ad}, +static const xmlChLRange xmlML[] = {{0x1d165, 0x1d169}, {0x1d16d, 0x1d172}, + {0x1d17b, 0x1d182}, {0x1d185, 0x1d18b}, {0x1d1aa, 0x1d1ad}, {0xe0100, 0xe01ef} }; static xmlChRangeGroup xmlMG = {113,6,xmlMS,xmlML}; -static const xmlChSRange xmlMcS[] = {{0x903, 0x903}, {0x93e, 0x940}, - {0x949, 0x94c}, {0x982, 0x983}, {0x9be, 0x9c0}, {0x9c7, 0x9c8}, - {0x9cb, 0x9cc}, {0x9d7, 0x9d7}, {0xa03, 0xa03}, {0xa3e, 0xa40}, - {0xa83, 0xa83}, {0xabe, 0xac0}, {0xac9, 0xac9}, {0xacb, 0xacc}, - {0xb02, 0xb03}, {0xb3e, 0xb3e}, {0xb40, 0xb40}, {0xb47, 0xb48}, - {0xb4b, 0xb4c}, {0xb57, 0xb57}, {0xbbe, 0xbbf}, {0xbc1, 0xbc2}, - {0xbc6, 0xbc8}, {0xbca, 0xbcc}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, - {0xc41, 0xc44}, {0xc82, 0xc83}, {0xcbe, 0xcbe}, {0xcc0, 0xcc4}, - {0xcc7, 0xcc8}, {0xcca, 0xccb}, {0xcd5, 0xcd6}, {0xd02, 0xd03}, - {0xd3e, 0xd40}, {0xd46, 0xd48}, {0xd4a, 0xd4c}, {0xd57, 0xd57}, - {0xd82, 0xd83}, {0xdcf, 0xdd1}, {0xdd8, 0xddf}, {0xdf2, 0xdf3}, - {0xf3e, 0xf3f}, {0xf7f, 0xf7f}, {0x102c, 0x102c}, {0x1031, 0x1031}, - {0x1038, 0x1038}, {0x1056, 0x1057}, {0x17b6, 0x17b6}, {0x17be, 0x17c5}, - {0x17c7, 0x17c8}, {0x1923, 0x1926}, {0x1929, 0x192b}, {0x1930, 0x1931}, +static const xmlChSRange xmlMcS[] = {{0x903, 0x903}, {0x93e, 0x940}, + {0x949, 0x94c}, {0x982, 0x983}, {0x9be, 0x9c0}, {0x9c7, 0x9c8}, + {0x9cb, 0x9cc}, {0x9d7, 0x9d7}, {0xa03, 0xa03}, {0xa3e, 0xa40}, + {0xa83, 0xa83}, {0xabe, 0xac0}, {0xac9, 0xac9}, {0xacb, 0xacc}, + {0xb02, 0xb03}, {0xb3e, 0xb3e}, {0xb40, 0xb40}, {0xb47, 0xb48}, + {0xb4b, 0xb4c}, {0xb57, 0xb57}, {0xbbe, 0xbbf}, {0xbc1, 0xbc2}, + {0xbc6, 0xbc8}, {0xbca, 0xbcc}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, + {0xc41, 0xc44}, {0xc82, 0xc83}, {0xcbe, 0xcbe}, {0xcc0, 0xcc4}, + {0xcc7, 0xcc8}, {0xcca, 0xccb}, {0xcd5, 0xcd6}, {0xd02, 0xd03}, + {0xd3e, 0xd40}, {0xd46, 0xd48}, {0xd4a, 0xd4c}, {0xd57, 0xd57}, + {0xd82, 0xd83}, {0xdcf, 0xdd1}, {0xdd8, 0xddf}, {0xdf2, 0xdf3}, + {0xf3e, 0xf3f}, {0xf7f, 0xf7f}, {0x102c, 0x102c}, {0x1031, 0x1031}, + {0x1038, 0x1038}, {0x1056, 0x1057}, {0x17b6, 0x17b6}, {0x17be, 0x17c5}, + {0x17c7, 0x17c8}, {0x1923, 0x1926}, {0x1929, 0x192b}, {0x1930, 0x1931}, {0x1933, 0x1938} }; static const xmlChLRange xmlMcL[] = {{0x1d165, 0x1d166}, {0x1d16d, 0x1d172} }; static xmlChRangeGroup xmlMcG = {55,2,xmlMcS,xmlMcL}; -static const xmlChSRange xmlMnS[] = {{0x300, 0x357}, {0x35d, 0x36f}, - {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, {0x5bb, 0x5bd}, - {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4}, {0x610, 0x615}, - {0x64b, 0x658}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6df, 0x6e4}, - {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x711, 0x711}, {0x730, 0x74a}, - {0x7a6, 0x7b0}, {0x901, 0x902}, {0x93c, 0x93c}, {0x941, 0x948}, - {0x94d, 0x94d}, {0x951, 0x954}, {0x962, 0x963}, {0x981, 0x981}, - {0x9bc, 0x9bc}, {0x9c1, 0x9c4}, {0x9cd, 0x9cd}, {0x9e2, 0x9e3}, - {0xa01, 0xa02}, {0xa3c, 0xa3c}, {0xa41, 0xa42}, {0xa47, 0xa48}, - {0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa82}, {0xabc, 0xabc}, - {0xac1, 0xac5}, {0xac7, 0xac8}, {0xacd, 0xacd}, {0xae2, 0xae3}, - {0xb01, 0xb01}, {0xb3c, 0xb3c}, {0xb3f, 0xb3f}, {0xb41, 0xb43}, - {0xb4d, 0xb4d}, {0xb56, 0xb56}, {0xb82, 0xb82}, {0xbc0, 0xbc0}, - {0xbcd, 0xbcd}, {0xc3e, 0xc40}, {0xc46, 0xc48}, {0xc4a, 0xc4d}, - {0xc55, 0xc56}, {0xcbc, 0xcbc}, {0xcbf, 0xcbf}, {0xcc6, 0xcc6}, - {0xccc, 0xccd}, {0xd41, 0xd43}, {0xd4d, 0xd4d}, {0xdca, 0xdca}, - {0xdd2, 0xdd4}, {0xdd6, 0xdd6}, {0xe31, 0xe31}, {0xe34, 0xe3a}, - {0xe47, 0xe4e}, {0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, - {0xec8, 0xecd}, {0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, - {0xf39, 0xf39}, {0xf71, 0xf7e}, {0xf80, 0xf84}, {0xf86, 0xf87}, - {0xf90, 0xf97}, {0xf99, 0xfbc}, {0xfc6, 0xfc6}, {0x102d, 0x1030}, - {0x1032, 0x1032}, {0x1036, 0x1037}, {0x1039, 0x1039}, {0x1058, 0x1059}, - {0x1712, 0x1714}, {0x1732, 0x1734}, {0x1752, 0x1753}, {0x1772, 0x1773}, - {0x17b7, 0x17bd}, {0x17c6, 0x17c6}, {0x17c9, 0x17d3}, {0x17dd, 0x17dd}, - {0x180b, 0x180d}, {0x18a9, 0x18a9}, {0x1920, 0x1922}, {0x1927, 0x1928}, - {0x1932, 0x1932}, {0x1939, 0x193b}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, - {0x20e5, 0x20ea}, {0x302a, 0x302f}, {0x3099, 0x309a}, {0xfb1e, 0xfb1e}, +static const xmlChSRange xmlMnS[] = {{0x300, 0x357}, {0x35d, 0x36f}, + {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, {0x5bb, 0x5bd}, + {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4}, {0x610, 0x615}, + {0x64b, 0x658}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6df, 0x6e4}, + {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x711, 0x711}, {0x730, 0x74a}, + {0x7a6, 0x7b0}, {0x901, 0x902}, {0x93c, 0x93c}, {0x941, 0x948}, + {0x94d, 0x94d}, {0x951, 0x954}, {0x962, 0x963}, {0x981, 0x981}, + {0x9bc, 0x9bc}, {0x9c1, 0x9c4}, {0x9cd, 0x9cd}, {0x9e2, 0x9e3}, + {0xa01, 0xa02}, {0xa3c, 0xa3c}, {0xa41, 0xa42}, {0xa47, 0xa48}, + {0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa82}, {0xabc, 0xabc}, + {0xac1, 0xac5}, {0xac7, 0xac8}, {0xacd, 0xacd}, {0xae2, 0xae3}, + {0xb01, 0xb01}, {0xb3c, 0xb3c}, {0xb3f, 0xb3f}, {0xb41, 0xb43}, + {0xb4d, 0xb4d}, {0xb56, 0xb56}, {0xb82, 0xb82}, {0xbc0, 0xbc0}, + {0xbcd, 0xbcd}, {0xc3e, 0xc40}, {0xc46, 0xc48}, {0xc4a, 0xc4d}, + {0xc55, 0xc56}, {0xcbc, 0xcbc}, {0xcbf, 0xcbf}, {0xcc6, 0xcc6}, + {0xccc, 0xccd}, {0xd41, 0xd43}, {0xd4d, 0xd4d}, {0xdca, 0xdca}, + {0xdd2, 0xdd4}, {0xdd6, 0xdd6}, {0xe31, 0xe31}, {0xe34, 0xe3a}, + {0xe47, 0xe4e}, {0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, + {0xec8, 0xecd}, {0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, + {0xf39, 0xf39}, {0xf71, 0xf7e}, {0xf80, 0xf84}, {0xf86, 0xf87}, + {0xf90, 0xf97}, {0xf99, 0xfbc}, {0xfc6, 0xfc6}, {0x102d, 0x1030}, + {0x1032, 0x1032}, {0x1036, 0x1037}, {0x1039, 0x1039}, {0x1058, 0x1059}, + {0x1712, 0x1714}, {0x1732, 0x1734}, {0x1752, 0x1753}, {0x1772, 0x1773}, + {0x17b7, 0x17bd}, {0x17c6, 0x17c6}, {0x17c9, 0x17d3}, {0x17dd, 0x17dd}, + {0x180b, 0x180d}, {0x18a9, 0x18a9}, {0x1920, 0x1922}, {0x1927, 0x1928}, + {0x1932, 0x1932}, {0x1939, 0x193b}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, + {0x20e5, 0x20ea}, {0x302a, 0x302f}, {0x3099, 0x309a}, {0xfb1e, 0xfb1e}, {0xfe00, 0xfe0f}, {0xfe20, 0xfe23} }; -static const xmlChLRange xmlMnL[] = {{0x1d167, 0x1d169}, {0x1d17b, 0x1d182}, +static const xmlChLRange xmlMnL[] = {{0x1d167, 0x1d169}, {0x1d17b, 0x1d182}, {0x1d185, 0x1d18b}, {0x1d1aa, 0x1d1ad}, {0xe0100, 0xe01ef} }; static xmlChRangeGroup xmlMnG = {108,5,xmlMnS,xmlMnL}; -static const xmlChSRange xmlNS[] = {{0x30, 0x39}, {0xb2, 0xb3}, - {0xb9, 0xb9}, {0xbc, 0xbe}, {0x660, 0x669}, {0x6f0, 0x6f9}, - {0x966, 0x96f}, {0x9e6, 0x9ef}, {0x9f4, 0x9f9}, {0xa66, 0xa6f}, - {0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbf2}, {0xc66, 0xc6f}, - {0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9}, - {0xf20, 0xf33}, {0x1040, 0x1049}, {0x1369, 0x137c}, {0x16ee, 0x16f0}, - {0x17e0, 0x17e9}, {0x17f0, 0x17f9}, {0x1810, 0x1819}, {0x1946, 0x194f}, - {0x2070, 0x2070}, {0x2074, 0x2079}, {0x2080, 0x2089}, {0x2153, 0x2183}, - {0x2460, 0x249b}, {0x24ea, 0x24ff}, {0x2776, 0x2793}, {0x3007, 0x3007}, - {0x3021, 0x3029}, {0x3038, 0x303a}, {0x3192, 0x3195}, {0x3220, 0x3229}, +static const xmlChSRange xmlNS[] = {{0x30, 0x39}, {0xb2, 0xb3}, + {0xb9, 0xb9}, {0xbc, 0xbe}, {0x660, 0x669}, {0x6f0, 0x6f9}, + {0x966, 0x96f}, {0x9e6, 0x9ef}, {0x9f4, 0x9f9}, {0xa66, 0xa6f}, + {0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbf2}, {0xc66, 0xc6f}, + {0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9}, + {0xf20, 0xf33}, {0x1040, 0x1049}, {0x1369, 0x137c}, {0x16ee, 0x16f0}, + {0x17e0, 0x17e9}, {0x17f0, 0x17f9}, {0x1810, 0x1819}, {0x1946, 0x194f}, + {0x2070, 0x2070}, {0x2074, 0x2079}, {0x2080, 0x2089}, {0x2153, 0x2183}, + {0x2460, 0x249b}, {0x24ea, 0x24ff}, {0x2776, 0x2793}, {0x3007, 0x3007}, + {0x3021, 0x3029}, {0x3038, 0x303a}, {0x3192, 0x3195}, {0x3220, 0x3229}, {0x3251, 0x325f}, {0x3280, 0x3289}, {0x32b1, 0x32bf}, {0xff10, 0xff19} }; -static const xmlChLRange xmlNL[] = {{0x10107, 0x10133}, {0x10320, 0x10323}, +static const xmlChLRange xmlNL[] = {{0x10107, 0x10133}, {0x10320, 0x10323}, {0x1034a, 0x1034a}, {0x104a0, 0x104a9}, {0x1d7ce, 0x1d7ff} }; static xmlChRangeGroup xmlNG = {42,5,xmlNS,xmlNL}; -static const xmlChSRange xmlNdS[] = {{0x30, 0x39}, {0x660, 0x669}, - {0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f}, - {0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f}, - {0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9}, - {0xf20, 0xf29}, {0x1040, 0x1049}, {0x1369, 0x1371}, {0x17e0, 0x17e9}, +static const xmlChSRange xmlNdS[] = {{0x30, 0x39}, {0x660, 0x669}, + {0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f}, + {0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f}, + {0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9}, + {0xf20, 0xf29}, {0x1040, 0x1049}, {0x1369, 0x1371}, {0x17e0, 0x17e9}, {0x1810, 0x1819}, {0x1946, 0x194f}, {0xff10, 0xff19} }; static const xmlChLRange xmlNdL[] = {{0x104a0, 0x104a9}, {0x1d7ce, 0x1d7ff} }; static xmlChRangeGroup xmlNdG = {21,2,xmlNdS,xmlNdL}; -static const xmlChSRange xmlNoS[] = {{0xb2, 0xb3}, {0xb9, 0xb9}, - {0xbc, 0xbe}, {0x9f4, 0x9f9}, {0xbf0, 0xbf2}, {0xf2a, 0xf33}, - {0x1372, 0x137c}, {0x17f0, 0x17f9}, {0x2070, 0x2070}, {0x2074, 0x2079}, - {0x2080, 0x2089}, {0x2153, 0x215f}, {0x2460, 0x249b}, {0x24ea, 0x24ff}, - {0x2776, 0x2793}, {0x3192, 0x3195}, {0x3220, 0x3229}, {0x3251, 0x325f}, +static const xmlChSRange xmlNoS[] = {{0xb2, 0xb3}, {0xb9, 0xb9}, + {0xbc, 0xbe}, {0x9f4, 0x9f9}, {0xbf0, 0xbf2}, {0xf2a, 0xf33}, + {0x1372, 0x137c}, {0x17f0, 0x17f9}, {0x2070, 0x2070}, {0x2074, 0x2079}, + {0x2080, 0x2089}, {0x2153, 0x215f}, {0x2460, 0x249b}, {0x24ea, 0x24ff}, + {0x2776, 0x2793}, {0x3192, 0x3195}, {0x3220, 0x3229}, {0x3251, 0x325f}, {0x3280, 0x3289}, {0x32b1, 0x32bf} }; static const xmlChLRange xmlNoL[] = {{0x10107, 0x10133}, {0x10320, 0x10323} }; static xmlChRangeGroup xmlNoG = {20,2,xmlNoS,xmlNoL}; -static const xmlChSRange xmlPS[] = {{0x21, 0x23}, {0x25, 0x2a}, - {0x2c, 0x2f}, {0x3a, 0x3b}, {0x3f, 0x40}, {0x5b, 0x5d}, {0x5f, 0x5f}, - {0x7b, 0x7b}, {0x7d, 0x7d}, {0xa1, 0xa1}, {0xab, 0xab}, {0xb7, 0xb7}, - {0xbb, 0xbb}, {0xbf, 0xbf}, {0x37e, 0x37e}, {0x387, 0x387}, - {0x55a, 0x55f}, {0x589, 0x58a}, {0x5be, 0x5be}, {0x5c0, 0x5c0}, - {0x5c3, 0x5c3}, {0x5f3, 0x5f4}, {0x60c, 0x60d}, {0x61b, 0x61b}, - {0x61f, 0x61f}, {0x66a, 0x66d}, {0x6d4, 0x6d4}, {0x700, 0x70d}, - {0x964, 0x965}, {0x970, 0x970}, {0xdf4, 0xdf4}, {0xe4f, 0xe4f}, - {0xe5a, 0xe5b}, {0xf04, 0xf12}, {0xf3a, 0xf3d}, {0xf85, 0xf85}, - {0x104a, 0x104f}, {0x10fb, 0x10fb}, {0x1361, 0x1368}, {0x166d, 0x166e}, - {0x169b, 0x169c}, {0x16eb, 0x16ed}, {0x1735, 0x1736}, {0x17d4, 0x17d6}, - {0x17d8, 0x17da}, {0x1800, 0x180a}, {0x1944, 0x1945}, {0x2010, 0x2027}, - {0x2030, 0x2043}, {0x2045, 0x2051}, {0x2053, 0x2054}, {0x2057, 0x2057}, - {0x207d, 0x207e}, {0x208d, 0x208e}, {0x2329, 0x232a}, {0x23b4, 0x23b6}, - {0x2768, 0x2775}, {0x27e6, 0x27eb}, {0x2983, 0x2998}, {0x29d8, 0x29db}, - {0x29fc, 0x29fd}, {0x3001, 0x3003}, {0x3008, 0x3011}, {0x3014, 0x301f}, - {0x3030, 0x3030}, {0x303d, 0x303d}, {0x30a0, 0x30a0}, {0x30fb, 0x30fb}, - {0xfd3e, 0xfd3f}, {0xfe30, 0xfe52}, {0xfe54, 0xfe61}, {0xfe63, 0xfe63}, - {0xfe68, 0xfe68}, {0xfe6a, 0xfe6b}, {0xff01, 0xff03}, {0xff05, 0xff0a}, - {0xff0c, 0xff0f}, {0xff1a, 0xff1b}, {0xff1f, 0xff20}, {0xff3b, 0xff3d}, +static const xmlChSRange xmlPS[] = {{0x21, 0x23}, {0x25, 0x2a}, + {0x2c, 0x2f}, {0x3a, 0x3b}, {0x3f, 0x40}, {0x5b, 0x5d}, {0x5f, 0x5f}, + {0x7b, 0x7b}, {0x7d, 0x7d}, {0xa1, 0xa1}, {0xab, 0xab}, {0xb7, 0xb7}, + {0xbb, 0xbb}, {0xbf, 0xbf}, {0x37e, 0x37e}, {0x387, 0x387}, + {0x55a, 0x55f}, {0x589, 0x58a}, {0x5be, 0x5be}, {0x5c0, 0x5c0}, + {0x5c3, 0x5c3}, {0x5f3, 0x5f4}, {0x60c, 0x60d}, {0x61b, 0x61b}, + {0x61f, 0x61f}, {0x66a, 0x66d}, {0x6d4, 0x6d4}, {0x700, 0x70d}, + {0x964, 0x965}, {0x970, 0x970}, {0xdf4, 0xdf4}, {0xe4f, 0xe4f}, + {0xe5a, 0xe5b}, {0xf04, 0xf12}, {0xf3a, 0xf3d}, {0xf85, 0xf85}, + {0x104a, 0x104f}, {0x10fb, 0x10fb}, {0x1361, 0x1368}, {0x166d, 0x166e}, + {0x169b, 0x169c}, {0x16eb, 0x16ed}, {0x1735, 0x1736}, {0x17d4, 0x17d6}, + {0x17d8, 0x17da}, {0x1800, 0x180a}, {0x1944, 0x1945}, {0x2010, 0x2027}, + {0x2030, 0x2043}, {0x2045, 0x2051}, {0x2053, 0x2054}, {0x2057, 0x2057}, + {0x207d, 0x207e}, {0x208d, 0x208e}, {0x2329, 0x232a}, {0x23b4, 0x23b6}, + {0x2768, 0x2775}, {0x27e6, 0x27eb}, {0x2983, 0x2998}, {0x29d8, 0x29db}, + {0x29fc, 0x29fd}, {0x3001, 0x3003}, {0x3008, 0x3011}, {0x3014, 0x301f}, + {0x3030, 0x3030}, {0x303d, 0x303d}, {0x30a0, 0x30a0}, {0x30fb, 0x30fb}, + {0xfd3e, 0xfd3f}, {0xfe30, 0xfe52}, {0xfe54, 0xfe61}, {0xfe63, 0xfe63}, + {0xfe68, 0xfe68}, {0xfe6a, 0xfe6b}, {0xff01, 0xff03}, {0xff05, 0xff0a}, + {0xff0c, 0xff0f}, {0xff1a, 0xff1b}, {0xff1f, 0xff20}, {0xff3b, 0xff3d}, {0xff3f, 0xff3f}, {0xff5b, 0xff5b}, {0xff5d, 0xff5d}, {0xff5f, 0xff65} }; static const xmlChLRange xmlPL[] = {{0x10100, 0x10101}, {0x1039f, 0x1039f} }; static xmlChRangeGroup xmlPG = {84,2,xmlPS,xmlPL}; -static const xmlChSRange xmlPdS[] = {{0x2d, 0x2d}, {0x58a, 0x58a}, - {0x1806, 0x1806}, {0x2010, 0x2015}, {0x301c, 0x301c}, {0x3030, 0x3030}, - {0x30a0, 0x30a0}, {0xfe31, 0xfe32}, {0xfe58, 0xfe58}, {0xfe63, 0xfe63}, +static const xmlChSRange xmlPdS[] = {{0x2d, 0x2d}, {0x58a, 0x58a}, + {0x1806, 0x1806}, {0x2010, 0x2015}, {0x301c, 0x301c}, {0x3030, 0x3030}, + {0x30a0, 0x30a0}, {0xfe31, 0xfe32}, {0xfe58, 0xfe58}, {0xfe63, 0xfe63}, {0xff0d, 0xff0d} }; static xmlChRangeGroup xmlPdG = {11,0,xmlPdS,NULL}; -static const xmlChSRange xmlPeS[] = {{0x29, 0x29}, {0x5d, 0x5d}, - {0x7d, 0x7d}, {0xf3b, 0xf3b}, {0xf3d, 0xf3d}, {0x169c, 0x169c}, - {0x2046, 0x2046}, {0x207e, 0x207e}, {0x208e, 0x208e}, {0x232a, 0x232a}, - {0x23b5, 0x23b5}, {0x2769, 0x2769}, {0x276b, 0x276b}, {0x276d, 0x276d}, - {0x276f, 0x276f}, {0x2771, 0x2771}, {0x2773, 0x2773}, {0x2775, 0x2775}, - {0x27e7, 0x27e7}, {0x27e9, 0x27e9}, {0x27eb, 0x27eb}, {0x2984, 0x2984}, - {0x2986, 0x2986}, {0x2988, 0x2988}, {0x298a, 0x298a}, {0x298c, 0x298c}, - {0x298e, 0x298e}, {0x2990, 0x2990}, {0x2992, 0x2992}, {0x2994, 0x2994}, - {0x2996, 0x2996}, {0x2998, 0x2998}, {0x29d9, 0x29d9}, {0x29db, 0x29db}, - {0x29fd, 0x29fd}, {0x3009, 0x3009}, {0x300b, 0x300b}, {0x300d, 0x300d}, - {0x300f, 0x300f}, {0x3011, 0x3011}, {0x3015, 0x3015}, {0x3017, 0x3017}, - {0x3019, 0x3019}, {0x301b, 0x301b}, {0x301e, 0x301f}, {0xfd3f, 0xfd3f}, - {0xfe36, 0xfe36}, {0xfe38, 0xfe38}, {0xfe3a, 0xfe3a}, {0xfe3c, 0xfe3c}, - {0xfe3e, 0xfe3e}, {0xfe40, 0xfe40}, {0xfe42, 0xfe42}, {0xfe44, 0xfe44}, - {0xfe48, 0xfe48}, {0xfe5a, 0xfe5a}, {0xfe5c, 0xfe5c}, {0xfe5e, 0xfe5e}, - {0xff09, 0xff09}, {0xff3d, 0xff3d}, {0xff5d, 0xff5d}, {0xff60, 0xff60}, +static const xmlChSRange xmlPeS[] = {{0x29, 0x29}, {0x5d, 0x5d}, + {0x7d, 0x7d}, {0xf3b, 0xf3b}, {0xf3d, 0xf3d}, {0x169c, 0x169c}, + {0x2046, 0x2046}, {0x207e, 0x207e}, {0x208e, 0x208e}, {0x232a, 0x232a}, + {0x23b5, 0x23b5}, {0x2769, 0x2769}, {0x276b, 0x276b}, {0x276d, 0x276d}, + {0x276f, 0x276f}, {0x2771, 0x2771}, {0x2773, 0x2773}, {0x2775, 0x2775}, + {0x27e7, 0x27e7}, {0x27e9, 0x27e9}, {0x27eb, 0x27eb}, {0x2984, 0x2984}, + {0x2986, 0x2986}, {0x2988, 0x2988}, {0x298a, 0x298a}, {0x298c, 0x298c}, + {0x298e, 0x298e}, {0x2990, 0x2990}, {0x2992, 0x2992}, {0x2994, 0x2994}, + {0x2996, 0x2996}, {0x2998, 0x2998}, {0x29d9, 0x29d9}, {0x29db, 0x29db}, + {0x29fd, 0x29fd}, {0x3009, 0x3009}, {0x300b, 0x300b}, {0x300d, 0x300d}, + {0x300f, 0x300f}, {0x3011, 0x3011}, {0x3015, 0x3015}, {0x3017, 0x3017}, + {0x3019, 0x3019}, {0x301b, 0x301b}, {0x301e, 0x301f}, {0xfd3f, 0xfd3f}, + {0xfe36, 0xfe36}, {0xfe38, 0xfe38}, {0xfe3a, 0xfe3a}, {0xfe3c, 0xfe3c}, + {0xfe3e, 0xfe3e}, {0xfe40, 0xfe40}, {0xfe42, 0xfe42}, {0xfe44, 0xfe44}, + {0xfe48, 0xfe48}, {0xfe5a, 0xfe5a}, {0xfe5c, 0xfe5c}, {0xfe5e, 0xfe5e}, + {0xff09, 0xff09}, {0xff3d, 0xff3d}, {0xff5d, 0xff5d}, {0xff60, 0xff60}, {0xff63, 0xff63} }; static xmlChRangeGroup xmlPeG = {63,0,xmlPeS,NULL}; -static const xmlChSRange xmlPoS[] = {{0x21, 0x23}, {0x25, 0x27}, - {0x2a, 0x2a}, {0x2c, 0x2c}, {0x2e, 0x2f}, {0x3a, 0x3b}, {0x3f, 0x40}, - {0x5c, 0x5c}, {0xa1, 0xa1}, {0xb7, 0xb7}, {0xbf, 0xbf}, {0x37e, 0x37e}, - {0x387, 0x387}, {0x55a, 0x55f}, {0x589, 0x589}, {0x5be, 0x5be}, - {0x5c0, 0x5c0}, {0x5c3, 0x5c3}, {0x5f3, 0x5f4}, {0x60c, 0x60d}, - {0x61b, 0x61b}, {0x61f, 0x61f}, {0x66a, 0x66d}, {0x6d4, 0x6d4}, - {0x700, 0x70d}, {0x964, 0x965}, {0x970, 0x970}, {0xdf4, 0xdf4}, - {0xe4f, 0xe4f}, {0xe5a, 0xe5b}, {0xf04, 0xf12}, {0xf85, 0xf85}, - {0x104a, 0x104f}, {0x10fb, 0x10fb}, {0x1361, 0x1368}, {0x166d, 0x166e}, - {0x16eb, 0x16ed}, {0x1735, 0x1736}, {0x17d4, 0x17d6}, {0x17d8, 0x17da}, - {0x1800, 0x1805}, {0x1807, 0x180a}, {0x1944, 0x1945}, {0x2016, 0x2017}, - {0x2020, 0x2027}, {0x2030, 0x2038}, {0x203b, 0x203e}, {0x2041, 0x2043}, - {0x2047, 0x2051}, {0x2053, 0x2053}, {0x2057, 0x2057}, {0x23b6, 0x23b6}, - {0x3001, 0x3003}, {0x303d, 0x303d}, {0xfe30, 0xfe30}, {0xfe45, 0xfe46}, - {0xfe49, 0xfe4c}, {0xfe50, 0xfe52}, {0xfe54, 0xfe57}, {0xfe5f, 0xfe61}, - {0xfe68, 0xfe68}, {0xfe6a, 0xfe6b}, {0xff01, 0xff03}, {0xff05, 0xff07}, - {0xff0a, 0xff0a}, {0xff0c, 0xff0c}, {0xff0e, 0xff0f}, {0xff1a, 0xff1b}, +static const xmlChSRange xmlPoS[] = {{0x21, 0x23}, {0x25, 0x27}, + {0x2a, 0x2a}, {0x2c, 0x2c}, {0x2e, 0x2f}, {0x3a, 0x3b}, {0x3f, 0x40}, + {0x5c, 0x5c}, {0xa1, 0xa1}, {0xb7, 0xb7}, {0xbf, 0xbf}, {0x37e, 0x37e}, + {0x387, 0x387}, {0x55a, 0x55f}, {0x589, 0x589}, {0x5be, 0x5be}, + {0x5c0, 0x5c0}, {0x5c3, 0x5c3}, {0x5f3, 0x5f4}, {0x60c, 0x60d}, + {0x61b, 0x61b}, {0x61f, 0x61f}, {0x66a, 0x66d}, {0x6d4, 0x6d4}, + {0x700, 0x70d}, {0x964, 0x965}, {0x970, 0x970}, {0xdf4, 0xdf4}, + {0xe4f, 0xe4f}, {0xe5a, 0xe5b}, {0xf04, 0xf12}, {0xf85, 0xf85}, + {0x104a, 0x104f}, {0x10fb, 0x10fb}, {0x1361, 0x1368}, {0x166d, 0x166e}, + {0x16eb, 0x16ed}, {0x1735, 0x1736}, {0x17d4, 0x17d6}, {0x17d8, 0x17da}, + {0x1800, 0x1805}, {0x1807, 0x180a}, {0x1944, 0x1945}, {0x2016, 0x2017}, + {0x2020, 0x2027}, {0x2030, 0x2038}, {0x203b, 0x203e}, {0x2041, 0x2043}, + {0x2047, 0x2051}, {0x2053, 0x2053}, {0x2057, 0x2057}, {0x23b6, 0x23b6}, + {0x3001, 0x3003}, {0x303d, 0x303d}, {0xfe30, 0xfe30}, {0xfe45, 0xfe46}, + {0xfe49, 0xfe4c}, {0xfe50, 0xfe52}, {0xfe54, 0xfe57}, {0xfe5f, 0xfe61}, + {0xfe68, 0xfe68}, {0xfe6a, 0xfe6b}, {0xff01, 0xff03}, {0xff05, 0xff07}, + {0xff0a, 0xff0a}, {0xff0c, 0xff0c}, {0xff0e, 0xff0f}, {0xff1a, 0xff1b}, {0xff1f, 0xff20}, {0xff3c, 0xff3c}, {0xff61, 0xff61}, {0xff64, 0xff64} }; static const xmlChLRange xmlPoL[] = {{0x10100, 0x10101}, {0x1039f, 0x1039f} }; static xmlChRangeGroup xmlPoG = {72,2,xmlPoS,xmlPoL}; -static const xmlChSRange xmlPsS[] = {{0x28, 0x28}, {0x5b, 0x5b}, - {0x7b, 0x7b}, {0xf3a, 0xf3a}, {0xf3c, 0xf3c}, {0x169b, 0x169b}, - {0x201a, 0x201a}, {0x201e, 0x201e}, {0x2045, 0x2045}, {0x207d, 0x207d}, - {0x208d, 0x208d}, {0x2329, 0x2329}, {0x23b4, 0x23b4}, {0x2768, 0x2768}, - {0x276a, 0x276a}, {0x276c, 0x276c}, {0x276e, 0x276e}, {0x2770, 0x2770}, - {0x2772, 0x2772}, {0x2774, 0x2774}, {0x27e6, 0x27e6}, {0x27e8, 0x27e8}, - {0x27ea, 0x27ea}, {0x2983, 0x2983}, {0x2985, 0x2985}, {0x2987, 0x2987}, - {0x2989, 0x2989}, {0x298b, 0x298b}, {0x298d, 0x298d}, {0x298f, 0x298f}, - {0x2991, 0x2991}, {0x2993, 0x2993}, {0x2995, 0x2995}, {0x2997, 0x2997}, - {0x29d8, 0x29d8}, {0x29da, 0x29da}, {0x29fc, 0x29fc}, {0x3008, 0x3008}, - {0x300a, 0x300a}, {0x300c, 0x300c}, {0x300e, 0x300e}, {0x3010, 0x3010}, - {0x3014, 0x3014}, {0x3016, 0x3016}, {0x3018, 0x3018}, {0x301a, 0x301a}, - {0x301d, 0x301d}, {0xfd3e, 0xfd3e}, {0xfe35, 0xfe35}, {0xfe37, 0xfe37}, - {0xfe39, 0xfe39}, {0xfe3b, 0xfe3b}, {0xfe3d, 0xfe3d}, {0xfe3f, 0xfe3f}, - {0xfe41, 0xfe41}, {0xfe43, 0xfe43}, {0xfe47, 0xfe47}, {0xfe59, 0xfe59}, - {0xfe5b, 0xfe5b}, {0xfe5d, 0xfe5d}, {0xff08, 0xff08}, {0xff3b, 0xff3b}, +static const xmlChSRange xmlPsS[] = {{0x28, 0x28}, {0x5b, 0x5b}, + {0x7b, 0x7b}, {0xf3a, 0xf3a}, {0xf3c, 0xf3c}, {0x169b, 0x169b}, + {0x201a, 0x201a}, {0x201e, 0x201e}, {0x2045, 0x2045}, {0x207d, 0x207d}, + {0x208d, 0x208d}, {0x2329, 0x2329}, {0x23b4, 0x23b4}, {0x2768, 0x2768}, + {0x276a, 0x276a}, {0x276c, 0x276c}, {0x276e, 0x276e}, {0x2770, 0x2770}, + {0x2772, 0x2772}, {0x2774, 0x2774}, {0x27e6, 0x27e6}, {0x27e8, 0x27e8}, + {0x27ea, 0x27ea}, {0x2983, 0x2983}, {0x2985, 0x2985}, {0x2987, 0x2987}, + {0x2989, 0x2989}, {0x298b, 0x298b}, {0x298d, 0x298d}, {0x298f, 0x298f}, + {0x2991, 0x2991}, {0x2993, 0x2993}, {0x2995, 0x2995}, {0x2997, 0x2997}, + {0x29d8, 0x29d8}, {0x29da, 0x29da}, {0x29fc, 0x29fc}, {0x3008, 0x3008}, + {0x300a, 0x300a}, {0x300c, 0x300c}, {0x300e, 0x300e}, {0x3010, 0x3010}, + {0x3014, 0x3014}, {0x3016, 0x3016}, {0x3018, 0x3018}, {0x301a, 0x301a}, + {0x301d, 0x301d}, {0xfd3e, 0xfd3e}, {0xfe35, 0xfe35}, {0xfe37, 0xfe37}, + {0xfe39, 0xfe39}, {0xfe3b, 0xfe3b}, {0xfe3d, 0xfe3d}, {0xfe3f, 0xfe3f}, + {0xfe41, 0xfe41}, {0xfe43, 0xfe43}, {0xfe47, 0xfe47}, {0xfe59, 0xfe59}, + {0xfe5b, 0xfe5b}, {0xfe5d, 0xfe5d}, {0xff08, 0xff08}, {0xff3b, 0xff3b}, {0xff5b, 0xff5b}, {0xff5f, 0xff5f}, {0xff62, 0xff62} }; static xmlChRangeGroup xmlPsG = {65,0,xmlPsS,NULL}; -static const xmlChSRange xmlSS[] = {{0x24, 0x24}, {0x2b, 0x2b}, - {0x3c, 0x3e}, {0x5e, 0x5e}, {0x60, 0x60}, {0x7c, 0x7c}, {0x7e, 0x7e}, - {0xa2, 0xa9}, {0xac, 0xac}, {0xae, 0xb1}, {0xb4, 0xb4}, {0xb6, 0xb6}, - {0xb8, 0xb8}, {0xd7, 0xd7}, {0xf7, 0xf7}, {0x2c2, 0x2c5}, - {0x2d2, 0x2df}, {0x2e5, 0x2ed}, {0x2ef, 0x2ff}, {0x374, 0x375}, - {0x384, 0x385}, {0x3f6, 0x3f6}, {0x482, 0x482}, {0x60e, 0x60f}, - {0x6e9, 0x6e9}, {0x6fd, 0x6fe}, {0x9f2, 0x9f3}, {0x9fa, 0x9fa}, - {0xaf1, 0xaf1}, {0xb70, 0xb70}, {0xbf3, 0xbfa}, {0xe3f, 0xe3f}, - {0xf01, 0xf03}, {0xf13, 0xf17}, {0xf1a, 0xf1f}, {0xf34, 0xf34}, - {0xf36, 0xf36}, {0xf38, 0xf38}, {0xfbe, 0xfc5}, {0xfc7, 0xfcc}, - {0xfcf, 0xfcf}, {0x17db, 0x17db}, {0x1940, 0x1940}, {0x19e0, 0x19ff}, - {0x1fbd, 0x1fbd}, {0x1fbf, 0x1fc1}, {0x1fcd, 0x1fcf}, {0x1fdd, 0x1fdf}, - {0x1fed, 0x1fef}, {0x1ffd, 0x1ffe}, {0x2044, 0x2044}, {0x2052, 0x2052}, - {0x207a, 0x207c}, {0x208a, 0x208c}, {0x20a0, 0x20b1}, {0x2100, 0x2101}, - {0x2103, 0x2106}, {0x2108, 0x2109}, {0x2114, 0x2114}, {0x2116, 0x2118}, - {0x211e, 0x2123}, {0x2125, 0x2125}, {0x2127, 0x2127}, {0x2129, 0x2129}, - {0x212e, 0x212e}, {0x2132, 0x2132}, {0x213a, 0x213b}, {0x2140, 0x2144}, - {0x214a, 0x214b}, {0x2190, 0x2328}, {0x232b, 0x23b3}, {0x23b7, 0x23d0}, - {0x2400, 0x2426}, {0x2440, 0x244a}, {0x249c, 0x24e9}, {0x2500, 0x2617}, - {0x2619, 0x267d}, {0x2680, 0x2691}, {0x26a0, 0x26a1}, {0x2701, 0x2704}, - {0x2706, 0x2709}, {0x270c, 0x2727}, {0x2729, 0x274b}, {0x274d, 0x274d}, - {0x274f, 0x2752}, {0x2756, 0x2756}, {0x2758, 0x275e}, {0x2761, 0x2767}, - {0x2794, 0x2794}, {0x2798, 0x27af}, {0x27b1, 0x27be}, {0x27d0, 0x27e5}, - {0x27f0, 0x2982}, {0x2999, 0x29d7}, {0x29dc, 0x29fb}, {0x29fe, 0x2b0d}, - {0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb}, - {0x3004, 0x3004}, {0x3012, 0x3013}, {0x3020, 0x3020}, {0x3036, 0x3037}, - {0x303e, 0x303f}, {0x309b, 0x309c}, {0x3190, 0x3191}, {0x3196, 0x319f}, - {0x3200, 0x321e}, {0x322a, 0x3243}, {0x3250, 0x3250}, {0x3260, 0x327d}, - {0x327f, 0x327f}, {0x328a, 0x32b0}, {0x32c0, 0x32fe}, {0x3300, 0x33ff}, - {0x4dc0, 0x4dff}, {0xa490, 0xa4c6}, {0xfb29, 0xfb29}, {0xfdfc, 0xfdfd}, - {0xfe62, 0xfe62}, {0xfe64, 0xfe66}, {0xfe69, 0xfe69}, {0xff04, 0xff04}, - {0xff0b, 0xff0b}, {0xff1c, 0xff1e}, {0xff3e, 0xff3e}, {0xff40, 0xff40}, - {0xff5c, 0xff5c}, {0xff5e, 0xff5e}, {0xffe0, 0xffe6}, {0xffe8, 0xffee}, +static const xmlChSRange xmlSS[] = {{0x24, 0x24}, {0x2b, 0x2b}, + {0x3c, 0x3e}, {0x5e, 0x5e}, {0x60, 0x60}, {0x7c, 0x7c}, {0x7e, 0x7e}, + {0xa2, 0xa9}, {0xac, 0xac}, {0xae, 0xb1}, {0xb4, 0xb4}, {0xb6, 0xb6}, + {0xb8, 0xb8}, {0xd7, 0xd7}, {0xf7, 0xf7}, {0x2c2, 0x2c5}, + {0x2d2, 0x2df}, {0x2e5, 0x2ed}, {0x2ef, 0x2ff}, {0x374, 0x375}, + {0x384, 0x385}, {0x3f6, 0x3f6}, {0x482, 0x482}, {0x60e, 0x60f}, + {0x6e9, 0x6e9}, {0x6fd, 0x6fe}, {0x9f2, 0x9f3}, {0x9fa, 0x9fa}, + {0xaf1, 0xaf1}, {0xb70, 0xb70}, {0xbf3, 0xbfa}, {0xe3f, 0xe3f}, + {0xf01, 0xf03}, {0xf13, 0xf17}, {0xf1a, 0xf1f}, {0xf34, 0xf34}, + {0xf36, 0xf36}, {0xf38, 0xf38}, {0xfbe, 0xfc5}, {0xfc7, 0xfcc}, + {0xfcf, 0xfcf}, {0x17db, 0x17db}, {0x1940, 0x1940}, {0x19e0, 0x19ff}, + {0x1fbd, 0x1fbd}, {0x1fbf, 0x1fc1}, {0x1fcd, 0x1fcf}, {0x1fdd, 0x1fdf}, + {0x1fed, 0x1fef}, {0x1ffd, 0x1ffe}, {0x2044, 0x2044}, {0x2052, 0x2052}, + {0x207a, 0x207c}, {0x208a, 0x208c}, {0x20a0, 0x20b1}, {0x2100, 0x2101}, + {0x2103, 0x2106}, {0x2108, 0x2109}, {0x2114, 0x2114}, {0x2116, 0x2118}, + {0x211e, 0x2123}, {0x2125, 0x2125}, {0x2127, 0x2127}, {0x2129, 0x2129}, + {0x212e, 0x212e}, {0x2132, 0x2132}, {0x213a, 0x213b}, {0x2140, 0x2144}, + {0x214a, 0x214b}, {0x2190, 0x2328}, {0x232b, 0x23b3}, {0x23b7, 0x23d0}, + {0x2400, 0x2426}, {0x2440, 0x244a}, {0x249c, 0x24e9}, {0x2500, 0x2617}, + {0x2619, 0x267d}, {0x2680, 0x2691}, {0x26a0, 0x26a1}, {0x2701, 0x2704}, + {0x2706, 0x2709}, {0x270c, 0x2727}, {0x2729, 0x274b}, {0x274d, 0x274d}, + {0x274f, 0x2752}, {0x2756, 0x2756}, {0x2758, 0x275e}, {0x2761, 0x2767}, + {0x2794, 0x2794}, {0x2798, 0x27af}, {0x27b1, 0x27be}, {0x27d0, 0x27e5}, + {0x27f0, 0x2982}, {0x2999, 0x29d7}, {0x29dc, 0x29fb}, {0x29fe, 0x2b0d}, + {0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb}, + {0x3004, 0x3004}, {0x3012, 0x3013}, {0x3020, 0x3020}, {0x3036, 0x3037}, + {0x303e, 0x303f}, {0x309b, 0x309c}, {0x3190, 0x3191}, {0x3196, 0x319f}, + {0x3200, 0x321e}, {0x322a, 0x3243}, {0x3250, 0x3250}, {0x3260, 0x327d}, + {0x327f, 0x327f}, {0x328a, 0x32b0}, {0x32c0, 0x32fe}, {0x3300, 0x33ff}, + {0x4dc0, 0x4dff}, {0xa490, 0xa4c6}, {0xfb29, 0xfb29}, {0xfdfc, 0xfdfd}, + {0xfe62, 0xfe62}, {0xfe64, 0xfe66}, {0xfe69, 0xfe69}, {0xff04, 0xff04}, + {0xff0b, 0xff0b}, {0xff1c, 0xff1e}, {0xff3e, 0xff3e}, {0xff40, 0xff40}, + {0xff5c, 0xff5c}, {0xff5e, 0xff5e}, {0xffe0, 0xffe6}, {0xffe8, 0xffee}, {0xfffc, 0xfffd} }; -static const xmlChLRange xmlSL[] = {{0x10102, 0x10102}, {0x10137, 0x1013f}, - {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d12a, 0x1d164}, - {0x1d16a, 0x1d16c}, {0x1d183, 0x1d184}, {0x1d18c, 0x1d1a9}, - {0x1d1ae, 0x1d1dd}, {0x1d300, 0x1d356}, {0x1d6c1, 0x1d6c1}, - {0x1d6db, 0x1d6db}, {0x1d6fb, 0x1d6fb}, {0x1d715, 0x1d715}, - {0x1d735, 0x1d735}, {0x1d74f, 0x1d74f}, {0x1d76f, 0x1d76f}, +static const xmlChLRange xmlSL[] = {{0x10102, 0x10102}, {0x10137, 0x1013f}, + {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d12a, 0x1d164}, + {0x1d16a, 0x1d16c}, {0x1d183, 0x1d184}, {0x1d18c, 0x1d1a9}, + {0x1d1ae, 0x1d1dd}, {0x1d300, 0x1d356}, {0x1d6c1, 0x1d6c1}, + {0x1d6db, 0x1d6db}, {0x1d6fb, 0x1d6fb}, {0x1d715, 0x1d715}, + {0x1d735, 0x1d735}, {0x1d74f, 0x1d74f}, {0x1d76f, 0x1d76f}, {0x1d789, 0x1d789}, {0x1d7a9, 0x1d7a9}, {0x1d7c3, 0x1d7c3} }; static xmlChRangeGroup xmlSG = {133,20,xmlSS,xmlSL}; -static const xmlChSRange xmlScS[] = {{0x24, 0x24}, {0xa2, 0xa5}, - {0x9f2, 0x9f3}, {0xaf1, 0xaf1}, {0xbf9, 0xbf9}, {0xe3f, 0xe3f}, - {0x17db, 0x17db}, {0x20a0, 0x20b1}, {0xfdfc, 0xfdfc}, {0xfe69, 0xfe69}, +static const xmlChSRange xmlScS[] = {{0x24, 0x24}, {0xa2, 0xa5}, + {0x9f2, 0x9f3}, {0xaf1, 0xaf1}, {0xbf9, 0xbf9}, {0xe3f, 0xe3f}, + {0x17db, 0x17db}, {0x20a0, 0x20b1}, {0xfdfc, 0xfdfc}, {0xfe69, 0xfe69}, {0xff04, 0xff04}, {0xffe0, 0xffe1}, {0xffe5, 0xffe6} }; static xmlChRangeGroup xmlScG = {13,0,xmlScS,NULL}; -static const xmlChSRange xmlSkS[] = {{0x5e, 0x5e}, {0x60, 0x60}, - {0xa8, 0xa8}, {0xaf, 0xaf}, {0xb4, 0xb4}, {0xb8, 0xb8}, {0x2c2, 0x2c5}, - {0x2d2, 0x2df}, {0x2e5, 0x2ed}, {0x2ef, 0x2ff}, {0x374, 0x375}, - {0x384, 0x385}, {0x1fbd, 0x1fbd}, {0x1fbf, 0x1fc1}, {0x1fcd, 0x1fcf}, - {0x1fdd, 0x1fdf}, {0x1fed, 0x1fef}, {0x1ffd, 0x1ffe}, {0x309b, 0x309c}, +static const xmlChSRange xmlSkS[] = {{0x5e, 0x5e}, {0x60, 0x60}, + {0xa8, 0xa8}, {0xaf, 0xaf}, {0xb4, 0xb4}, {0xb8, 0xb8}, {0x2c2, 0x2c5}, + {0x2d2, 0x2df}, {0x2e5, 0x2ed}, {0x2ef, 0x2ff}, {0x374, 0x375}, + {0x384, 0x385}, {0x1fbd, 0x1fbd}, {0x1fbf, 0x1fc1}, {0x1fcd, 0x1fcf}, + {0x1fdd, 0x1fdf}, {0x1fed, 0x1fef}, {0x1ffd, 0x1ffe}, {0x309b, 0x309c}, {0xff3e, 0xff3e}, {0xff40, 0xff40}, {0xffe3, 0xffe3} }; static xmlChRangeGroup xmlSkG = {22,0,xmlSkS,NULL}; -static const xmlChSRange xmlSmS[] = {{0x2b, 0x2b}, {0x3c, 0x3e}, - {0x7c, 0x7c}, {0x7e, 0x7e}, {0xac, 0xac}, {0xb1, 0xb1}, {0xd7, 0xd7}, - {0xf7, 0xf7}, {0x3f6, 0x3f6}, {0x2044, 0x2044}, {0x2052, 0x2052}, - {0x207a, 0x207c}, {0x208a, 0x208c}, {0x2140, 0x2144}, {0x214b, 0x214b}, - {0x2190, 0x2194}, {0x219a, 0x219b}, {0x21a0, 0x21a0}, {0x21a3, 0x21a3}, - {0x21a6, 0x21a6}, {0x21ae, 0x21ae}, {0x21ce, 0x21cf}, {0x21d2, 0x21d2}, - {0x21d4, 0x21d4}, {0x21f4, 0x22ff}, {0x2308, 0x230b}, {0x2320, 0x2321}, - {0x237c, 0x237c}, {0x239b, 0x23b3}, {0x25b7, 0x25b7}, {0x25c1, 0x25c1}, - {0x25f8, 0x25ff}, {0x266f, 0x266f}, {0x27d0, 0x27e5}, {0x27f0, 0x27ff}, - {0x2900, 0x2982}, {0x2999, 0x29d7}, {0x29dc, 0x29fb}, {0x29fe, 0x2aff}, - {0xfb29, 0xfb29}, {0xfe62, 0xfe62}, {0xfe64, 0xfe66}, {0xff0b, 0xff0b}, - {0xff1c, 0xff1e}, {0xff5c, 0xff5c}, {0xff5e, 0xff5e}, {0xffe2, 0xffe2}, +static const xmlChSRange xmlSmS[] = {{0x2b, 0x2b}, {0x3c, 0x3e}, + {0x7c, 0x7c}, {0x7e, 0x7e}, {0xac, 0xac}, {0xb1, 0xb1}, {0xd7, 0xd7}, + {0xf7, 0xf7}, {0x3f6, 0x3f6}, {0x2044, 0x2044}, {0x2052, 0x2052}, + {0x207a, 0x207c}, {0x208a, 0x208c}, {0x2140, 0x2144}, {0x214b, 0x214b}, + {0x2190, 0x2194}, {0x219a, 0x219b}, {0x21a0, 0x21a0}, {0x21a3, 0x21a3}, + {0x21a6, 0x21a6}, {0x21ae, 0x21ae}, {0x21ce, 0x21cf}, {0x21d2, 0x21d2}, + {0x21d4, 0x21d4}, {0x21f4, 0x22ff}, {0x2308, 0x230b}, {0x2320, 0x2321}, + {0x237c, 0x237c}, {0x239b, 0x23b3}, {0x25b7, 0x25b7}, {0x25c1, 0x25c1}, + {0x25f8, 0x25ff}, {0x266f, 0x266f}, {0x27d0, 0x27e5}, {0x27f0, 0x27ff}, + {0x2900, 0x2982}, {0x2999, 0x29d7}, {0x29dc, 0x29fb}, {0x29fe, 0x2aff}, + {0xfb29, 0xfb29}, {0xfe62, 0xfe62}, {0xfe64, 0xfe66}, {0xff0b, 0xff0b}, + {0xff1c, 0xff1e}, {0xff5c, 0xff5c}, {0xff5e, 0xff5e}, {0xffe2, 0xffe2}, {0xffe9, 0xffec} }; -static const xmlChLRange xmlSmL[] = {{0x1d6c1, 0x1d6c1}, {0x1d6db, 0x1d6db}, - {0x1d6fb, 0x1d6fb}, {0x1d715, 0x1d715}, {0x1d735, 0x1d735}, - {0x1d74f, 0x1d74f}, {0x1d76f, 0x1d76f}, {0x1d789, 0x1d789}, +static const xmlChLRange xmlSmL[] = {{0x1d6c1, 0x1d6c1}, {0x1d6db, 0x1d6db}, + {0x1d6fb, 0x1d6fb}, {0x1d715, 0x1d715}, {0x1d735, 0x1d735}, + {0x1d74f, 0x1d74f}, {0x1d76f, 0x1d76f}, {0x1d789, 0x1d789}, {0x1d7a9, 0x1d7a9}, {0x1d7c3, 0x1d7c3} }; static xmlChRangeGroup xmlSmG = {48,10,xmlSmS,xmlSmL}; -static const xmlChSRange xmlSoS[] = {{0xa6, 0xa7}, {0xa9, 0xa9}, - {0xae, 0xae}, {0xb0, 0xb0}, {0xb6, 0xb6}, {0x482, 0x482}, - {0x60e, 0x60f}, {0x6e9, 0x6e9}, {0x6fd, 0x6fe}, {0x9fa, 0x9fa}, - {0xb70, 0xb70}, {0xbf3, 0xbf8}, {0xbfa, 0xbfa}, {0xf01, 0xf03}, - {0xf13, 0xf17}, {0xf1a, 0xf1f}, {0xf34, 0xf34}, {0xf36, 0xf36}, - {0xf38, 0xf38}, {0xfbe, 0xfc5}, {0xfc7, 0xfcc}, {0xfcf, 0xfcf}, - {0x1940, 0x1940}, {0x19e0, 0x19ff}, {0x2100, 0x2101}, {0x2103, 0x2106}, - {0x2108, 0x2109}, {0x2114, 0x2114}, {0x2116, 0x2118}, {0x211e, 0x2123}, - {0x2125, 0x2125}, {0x2127, 0x2127}, {0x2129, 0x2129}, {0x212e, 0x212e}, - {0x2132, 0x2132}, {0x213a, 0x213b}, {0x214a, 0x214a}, {0x2195, 0x2199}, - {0x219c, 0x219f}, {0x21a1, 0x21a2}, {0x21a4, 0x21a5}, {0x21a7, 0x21ad}, - {0x21af, 0x21cd}, {0x21d0, 0x21d1}, {0x21d3, 0x21d3}, {0x21d5, 0x21f3}, - {0x2300, 0x2307}, {0x230c, 0x231f}, {0x2322, 0x2328}, {0x232b, 0x237b}, - {0x237d, 0x239a}, {0x23b7, 0x23d0}, {0x2400, 0x2426}, {0x2440, 0x244a}, - {0x249c, 0x24e9}, {0x2500, 0x25b6}, {0x25b8, 0x25c0}, {0x25c2, 0x25f7}, - {0x2600, 0x2617}, {0x2619, 0x266e}, {0x2670, 0x267d}, {0x2680, 0x2691}, - {0x26a0, 0x26a1}, {0x2701, 0x2704}, {0x2706, 0x2709}, {0x270c, 0x2727}, - {0x2729, 0x274b}, {0x274d, 0x274d}, {0x274f, 0x2752}, {0x2756, 0x2756}, - {0x2758, 0x275e}, {0x2761, 0x2767}, {0x2794, 0x2794}, {0x2798, 0x27af}, - {0x27b1, 0x27be}, {0x2800, 0x28ff}, {0x2b00, 0x2b0d}, {0x2e80, 0x2e99}, - {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb}, {0x3004, 0x3004}, - {0x3012, 0x3013}, {0x3020, 0x3020}, {0x3036, 0x3037}, {0x303e, 0x303f}, - {0x3190, 0x3191}, {0x3196, 0x319f}, {0x3200, 0x321e}, {0x322a, 0x3243}, - {0x3250, 0x3250}, {0x3260, 0x327d}, {0x327f, 0x327f}, {0x328a, 0x32b0}, - {0x32c0, 0x32fe}, {0x3300, 0x33ff}, {0x4dc0, 0x4dff}, {0xa490, 0xa4c6}, - {0xfdfd, 0xfdfd}, {0xffe4, 0xffe4}, {0xffe8, 0xffe8}, {0xffed, 0xffee}, +static const xmlChSRange xmlSoS[] = {{0xa6, 0xa7}, {0xa9, 0xa9}, + {0xae, 0xae}, {0xb0, 0xb0}, {0xb6, 0xb6}, {0x482, 0x482}, + {0x60e, 0x60f}, {0x6e9, 0x6e9}, {0x6fd, 0x6fe}, {0x9fa, 0x9fa}, + {0xb70, 0xb70}, {0xbf3, 0xbf8}, {0xbfa, 0xbfa}, {0xf01, 0xf03}, + {0xf13, 0xf17}, {0xf1a, 0xf1f}, {0xf34, 0xf34}, {0xf36, 0xf36}, + {0xf38, 0xf38}, {0xfbe, 0xfc5}, {0xfc7, 0xfcc}, {0xfcf, 0xfcf}, + {0x1940, 0x1940}, {0x19e0, 0x19ff}, {0x2100, 0x2101}, {0x2103, 0x2106}, + {0x2108, 0x2109}, {0x2114, 0x2114}, {0x2116, 0x2118}, {0x211e, 0x2123}, + {0x2125, 0x2125}, {0x2127, 0x2127}, {0x2129, 0x2129}, {0x212e, 0x212e}, + {0x2132, 0x2132}, {0x213a, 0x213b}, {0x214a, 0x214a}, {0x2195, 0x2199}, + {0x219c, 0x219f}, {0x21a1, 0x21a2}, {0x21a4, 0x21a5}, {0x21a7, 0x21ad}, + {0x21af, 0x21cd}, {0x21d0, 0x21d1}, {0x21d3, 0x21d3}, {0x21d5, 0x21f3}, + {0x2300, 0x2307}, {0x230c, 0x231f}, {0x2322, 0x2328}, {0x232b, 0x237b}, + {0x237d, 0x239a}, {0x23b7, 0x23d0}, {0x2400, 0x2426}, {0x2440, 0x244a}, + {0x249c, 0x24e9}, {0x2500, 0x25b6}, {0x25b8, 0x25c0}, {0x25c2, 0x25f7}, + {0x2600, 0x2617}, {0x2619, 0x266e}, {0x2670, 0x267d}, {0x2680, 0x2691}, + {0x26a0, 0x26a1}, {0x2701, 0x2704}, {0x2706, 0x2709}, {0x270c, 0x2727}, + {0x2729, 0x274b}, {0x274d, 0x274d}, {0x274f, 0x2752}, {0x2756, 0x2756}, + {0x2758, 0x275e}, {0x2761, 0x2767}, {0x2794, 0x2794}, {0x2798, 0x27af}, + {0x27b1, 0x27be}, {0x2800, 0x28ff}, {0x2b00, 0x2b0d}, {0x2e80, 0x2e99}, + {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb}, {0x3004, 0x3004}, + {0x3012, 0x3013}, {0x3020, 0x3020}, {0x3036, 0x3037}, {0x303e, 0x303f}, + {0x3190, 0x3191}, {0x3196, 0x319f}, {0x3200, 0x321e}, {0x322a, 0x3243}, + {0x3250, 0x3250}, {0x3260, 0x327d}, {0x327f, 0x327f}, {0x328a, 0x32b0}, + {0x32c0, 0x32fe}, {0x3300, 0x33ff}, {0x4dc0, 0x4dff}, {0xa490, 0xa4c6}, + {0xfdfd, 0xfdfd}, {0xffe4, 0xffe4}, {0xffe8, 0xffe8}, {0xffed, 0xffee}, {0xfffc, 0xfffd} }; -static const xmlChLRange xmlSoL[] = {{0x10102, 0x10102}, {0x10137, 0x1013f}, - {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d12a, 0x1d164}, - {0x1d16a, 0x1d16c}, {0x1d183, 0x1d184}, {0x1d18c, 0x1d1a9}, +static const xmlChLRange xmlSoL[] = {{0x10102, 0x10102}, {0x10137, 0x1013f}, + {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d12a, 0x1d164}, + {0x1d16a, 0x1d16c}, {0x1d183, 0x1d184}, {0x1d18c, 0x1d1a9}, {0x1d1ae, 0x1d1dd}, {0x1d300, 0x1d356} }; static xmlChRangeGroup xmlSoG = {103,10,xmlSoS,xmlSoL}; -static const xmlChSRange xmlZS[] = {{0x20, 0x20}, {0xa0, 0xa0}, - {0x1680, 0x1680}, {0x180e, 0x180e}, {0x2000, 0x200a}, {0x2028, 0x2029}, +static const xmlChSRange xmlZS[] = {{0x20, 0x20}, {0xa0, 0xa0}, + {0x1680, 0x1680}, {0x180e, 0x180e}, {0x2000, 0x200a}, {0x2028, 0x2029}, {0x202f, 0x202f}, {0x205f, 0x205f}, {0x3000, 0x3000} }; static xmlChRangeGroup xmlZG = {9,0,xmlZS,NULL}; @@ -961,7 +961,7 @@ static xmlIntFunc else low = mid + 1; } - return (NULL); + return (NULL); } /** diff --git a/gnulib-local/lib/libxml/xmlversion.in.h b/gnulib-local/lib/libxml/xmlversion.in.h index 4c6d2bd..f7b483a 100644 --- a/gnulib-local/lib/libxml/xmlversion.in.h +++ b/gnulib-local/lib/libxml/xmlversion.in.h @@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.6.27" +#define LIBXML_DOTTED_VERSION "2.9.3" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 10203 */ -#define LIBXML_VERSION 20627 +#define LIBXML_VERSION 20903 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "10203" */ -#define LIBXML_VERSION_STRING "20627" +#define LIBXML_VERSION_STRING "20903" /** * LIBXML_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ -#define LIBXML_VERSION_EXTRA "-CVS2872" +#define LIBXML_VERSION_EXTRA "-GITCVE-2015-8242" /** * 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 * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20627); +#define LIBXML_TEST_VERSION xmlCheckVersion(20903); #ifndef VMS #if 0 @@ -91,11 +91,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Whether the thread support is configured in */ #if 0 -#if defined(_REENTRANT) || defined(__MT__) || (_POSIX_C_SOURCE - 0 >= 199506L) +#if defined(_REENTRANT) || defined(__MT__) || \ + (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) #define LIBXML_THREAD_ENABLED #endif #endif +/** + * LIBXML_THREAD_ALLOC_ENABLED: + * + * Whether the allocation hooks are per-thread + */ +#if 0 +#define LIBXML_THREAD_ALLOC_ENABLED +#endif + /** * LIBXML_TREE_ENABLED: * @@ -236,7 +246,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * Whether XPath is configured in */ -#if 0 +#if 1 #define LIBXML_XPATH_ENABLED #endif @@ -245,7 +255,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * Whether XPointer is configured in */ -#if 0 +#if 1 #define LIBXML_XPTR_ENABLED #endif @@ -267,6 +277,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #define LIBXML_ICONV_ENABLED #endif +/** + * LIBXML_ICU_ENABLED: + * + * Whether icu support is available + */ +#if 0 +#define LIBXML_ICU_ENABLED +#endif + /** * LIBXML_ISO8859X_ENABLED: * @@ -382,21 +401,86 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); #endif /** - * ATTRIBUTE_UNUSED: + * LIBXML_LZMA_ENABLED: * - * Macro used to signal to GCC unused function parameters + * Whether the Lzma support is compiled in */ +#if 0 +#define LIBXML_LZMA_ENABLED +#endif + #ifdef __GNUC__ #ifdef HAVE_ANSIDECL_H #include #endif + +/** + * ATTRIBUTE_UNUSED: + * + * Macro used to signal to GCC unused function parameters + */ + #ifndef ATTRIBUTE_UNUSED -#define ATTRIBUTE_UNUSED __attribute__((unused)) +# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) +# define ATTRIBUTE_UNUSED __attribute__((unused)) +# else +# define ATTRIBUTE_UNUSED +# endif #endif + +/** + * LIBXML_ATTR_ALLOC_SIZE: + * + * Macro used to indicate to GCC this is an allocator function + */ + +#ifndef LIBXML_ATTR_ALLOC_SIZE +# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))) +# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) +# else +# define LIBXML_ATTR_ALLOC_SIZE(x) +# endif #else -#define ATTRIBUTE_UNUSED +# define LIBXML_ATTR_ALLOC_SIZE(x) +#endif + +/** + * LIBXML_ATTR_FORMAT: + * + * Macro used to indicate to GCC the parameter are printf like + */ + +#ifndef LIBXML_ATTR_FORMAT +# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) +# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) +# else +# define LIBXML_ATTR_FORMAT(fmt,args) +# endif +#else +# define LIBXML_ATTR_FORMAT(fmt,args) #endif +#else /* ! __GNUC__ */ +/** + * ATTRIBUTE_UNUSED: + * + * Macro used to signal to GCC unused function parameters + */ +#define ATTRIBUTE_UNUSED +/** + * LIBXML_ATTR_ALLOC_SIZE: + * + * Macro used to indicate to GCC this is an allocator function + */ +#define LIBXML_ATTR_ALLOC_SIZE(x) +/** + * LIBXML_ATTR_FORMAT: + * + * Macro used to indicate to GCC the parameter are printf like + */ +#define LIBXML_ATTR_FORMAT(fmt,args) +#endif /* __GNUC__ */ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/gnulib-local/lib/libxml/xmlwriter.c b/gnulib-local/lib/libxml/xmlwriter.c index 5821056..fac20ac 100644 --- a/gnulib-local/lib/libxml/xmlwriter.c +++ b/gnulib-local/lib/libxml/xmlwriter.c @@ -10,7 +10,6 @@ #define IN_LIBXML #include "libxml.h" - #include #include @@ -22,15 +21,18 @@ #include +#include "buf.h" +#include "enc.h" +#include "save.h" + #define B64LINELEN 72 #define B64CRLF "\r\n" /* * The following VA_COPY was coded following an example in * the Samba project. It may not be sufficient for some - * esoteric implementations of va_list (i.e. it may need - * something involving a memcpy) but (hopefully) will be - * sufficient for libxml2. + * esoteric implementations of va_list but (hopefully) will + * be sufficient for libxml2. */ #ifndef VA_COPY #ifdef HAVE_VA_COPY @@ -39,7 +41,12 @@ #ifdef HAVE___VA_COPY #define VA_COPY(dest,src) __va_copy(dest, src) #else - #define VA_COPY(dest,src) (dest) = (src) + #ifndef VA_LIST_IS_ARRAY + #define VA_COPY(dest,src) (dest) = (src) + #else + #include + #define VA_COPY(dest,src) memcpy((char *)(dest),(char *)(src),sizeof(va_list)) + #endif #endif #endif #endif @@ -98,6 +105,7 @@ struct _xmlTextWriter { static void xmlFreeTextWriterStackEntry(xmlLinkPtr lk); static int xmlCmpTextWriterStackEntry(const void *data0, const void *data1); +static int xmlTextWriterOutputNSDecl(xmlTextWriterPtr writer); static void xmlFreeTextWriterNsStackEntry(xmlLinkPtr lk); static int xmlCmpTextWriterNsStackEntry(const void *data0, const void *data1); @@ -129,10 +137,10 @@ xmlWriterErrMsg(xmlTextWriterPtr ctxt, xmlParserErrors error, if (ctxt != NULL) { __xmlRaiseError(NULL, NULL, NULL, ctxt->ctxt, NULL, XML_FROM_WRITER, error, XML_ERR_FATAL, - NULL, 0, NULL, NULL, NULL, 0, 0, msg); + NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg); } else { __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_WRITER, error, - XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, msg); + XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg); } } @@ -242,8 +250,8 @@ xmlNewTextWriterFilename(const char *uri, int compression) out = xmlOutputBufferCreateFilename(uri, NULL, compression); if (out == NULL) { - xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, - "xmlNewTextWriterFilename : out of memory!\n"); + xmlWriterErrMsg(NULL, XML_IO_EIO, + "xmlNewTextWriterFilename : cannot open uri\n"); return NULL; } @@ -370,7 +378,7 @@ xmlNewTextWriterDoc(xmlDocPtr * doc, int compression) ctxt = xmlCreatePushParserCtxt(&saxHandler, NULL, NULL, 0, NULL); if (ctxt == NULL) { xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, - "xmlNewTextWriterDoc : error at xmlCreatePushParserCtxt!\n"); + "xmlNewTextWriterDoc : error at xmlCreatePushParserCtxt!\n"); return NULL; } /* @@ -389,8 +397,10 @@ xmlNewTextWriterDoc(xmlDocPtr * doc, int compression) ret = xmlNewTextWriterPushParser(ctxt, compression); if (ret == NULL) { + xmlFreeDoc(ctxt->myDoc); + xmlFreeParserCtxt(ctxt); xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, - "xmlNewTextWriterDoc : error at xmlNewTextWriterPushParser!\n"); + "xmlNewTextWriterDoc : error at xmlNewTextWriterPushParser!\n"); return NULL; } @@ -545,8 +555,10 @@ xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version, writer->out->encoder = encoder; if (encoder != NULL) { - writer->out->conv = xmlBufferCreateSize(4000); - xmlCharEncOutFunc(encoder, writer->out->conv, NULL); + if (writer->out->conv == NULL) { + writer->out->conv = xmlBufCreateSize(4000); + } + xmlCharEncOutput(writer->out, 1); if ((writer->doc != NULL) && (writer->doc->encoding == NULL)) writer->doc->encoding = xmlStrdup((xmlChar *)writer->out->encoder->name); } else @@ -624,9 +636,10 @@ xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version, * xmlTextWriterEndDocument: * @writer: the xmlTextWriterPtr * - * End an xml document. All open elements are closed + * End an xml document. All open elements are closed, and + * the content is flushed to the output. * - * Returns the bytes written (may be 0 because of buffering) or -1 in case of error + * Returns the bytes written or -1 in case of error */ int xmlTextWriterEndDocument(xmlTextWriterPtr writer) @@ -700,6 +713,9 @@ xmlTextWriterEndDocument(xmlTextWriterPtr writer) return -1; sum += count; } + + sum += xmlTextWriterFlush(writer); + return sum; } @@ -735,6 +751,11 @@ xmlTextWriterStartComment(xmlTextWriterPtr writer) case XML_TEXTWRITER_NONE: break; case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; count = xmlOutputBufferWriteString(writer->out, ">"); if (count < 0) return -1; @@ -887,8 +908,8 @@ xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, } buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteComment(writer, buf); @@ -966,6 +987,11 @@ xmlTextWriterStartElement(xmlTextWriterPtr writer, const xmlChar * name) sum += count; /* fallthrough */ case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; count = xmlOutputBufferWriteString(writer->out, ">"); if (count < 0) return -1; @@ -1056,17 +1082,31 @@ xmlTextWriterStartElementNS(xmlTextWriterPtr writer, sum += count; if (namespaceURI != 0) { + xmlTextWriterNsStackEntry *p = (xmlTextWriterNsStackEntry *) + xmlMalloc(sizeof(xmlTextWriterNsStackEntry)); + if (p == 0) { + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, + "xmlTextWriterStartElementNS : out of memory!\n"); + return -1; + } + buf = xmlStrdup(BAD_CAST "xmlns"); if (prefix != 0) { buf = xmlStrcat(buf, BAD_CAST ":"); buf = xmlStrcat(buf, prefix); } - count = xmlTextWriterWriteAttribute(writer, buf, namespaceURI); - xmlFree(buf); - if (count < 0) + p->prefix = buf; + p->uri = xmlStrdup(namespaceURI); + if (p->uri == 0) { + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, + "xmlTextWriterStartElementNS : out of memory!\n"); + xmlFree(p); return -1; - sum += count; + } + p->elem = xmlListFront(writer->nodes); + + xmlListPushFront(writer->nsstack, p); } return sum; @@ -1092,22 +1132,37 @@ xmlTextWriterEndElement(xmlTextWriterPtr writer) return -1; lk = xmlListFront(writer->nodes); - if (lk == 0) + if (lk == 0) { + xmlListDelete(writer->nsstack); + writer->nsstack = NULL; return -1; + } p = (xmlTextWriterStackEntry *) xmlLinkGetData(lk); - if (p == 0) + if (p == 0) { + xmlListDelete(writer->nsstack); + writer->nsstack = NULL; return -1; + } sum = 0; switch (p->state) { case XML_TEXTWRITER_ATTRIBUTE: count = xmlTextWriterEndAttribute(writer); - if (count < 0) + if (count < 0) { + xmlListDelete(writer->nsstack); + writer->nsstack = NULL; return -1; + } sum += count; /* fallthrough */ case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; + if (writer->indent) /* next element needs indent */ writer->doindent = 1; count = xmlOutputBufferWriteString(writer->out, "/>"); @@ -1185,12 +1240,26 @@ xmlTextWriterFullEndElement(xmlTextWriterPtr writer) sum += count; /* fallthrough */ case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; + count = xmlOutputBufferWriteString(writer->out, ">"); if (count < 0) return -1; sum += count; + if (writer->indent) + writer->doindent = 0; /* fallthrough */ case XML_TEXTWRITER_TEXT: + if ((writer->indent) && (writer->doindent)) { + count = xmlTextWriterWriteIndent(writer); + sum += count; + writer->doindent = 1; + } else + writer->doindent = 1; count = xmlOutputBufferWriteString(writer->out, "indent) { + count = xmlOutputBufferWriteString(writer->out, "\n"); + sum += count; + } + xmlListPopFront(writer->nodes); return sum; } @@ -1259,8 +1333,8 @@ xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, const char *format, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteRaw(writer, buf); @@ -1388,8 +1462,8 @@ xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteString(writer, buf); @@ -1435,8 +1509,8 @@ xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content) break; case XML_TEXTWRITER_ATTRIBUTE: buf = NULL; - xmlAttrSerializeTxtContent(writer->out->buffer, writer->doc, - NULL, content); + xmlBufAttrSerializeTxtContent(writer->out->buffer, + writer->doc, NULL, content); break; default: break; @@ -1446,12 +1520,13 @@ xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content) if (buf != NULL) { count = xmlTextWriterWriteRaw(writer, buf); - if (count < 0) - return -1; - sum += count; if (buf != content) /* buf was allocated by us, so free it */ xmlFree(buf); + + if (count < 0) + return -1; + sum += count; } return sum; @@ -1596,7 +1671,7 @@ xmlTextWriterWriteBase64(xmlTextWriterPtr writer, const char *data, * Write hqx encoded data to an xmlOutputBuffer. * ::todo * - * Returns the bytes written (may be 0 because of buffering) + * Returns the bytes written (may be 0 because of buffering) * or -1 in case of error */ static int @@ -1605,8 +1680,8 @@ xmlOutputBufferWriteBinHex(xmlOutputBufferPtr out, { int count; int sum; - static char hex[16] = - {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; + static char hex[16] = + {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; int i; if ((out == NULL) || (data == NULL) || (len < 0)) { @@ -1768,6 +1843,57 @@ xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer, if ((writer == NULL) || (name == NULL) || (*name == '\0')) return -1; + /* Handle namespace first in case of error */ + if (namespaceURI != 0) { + xmlTextWriterNsStackEntry nsentry, *curns; + + buf = xmlStrdup(BAD_CAST "xmlns"); + if (prefix != 0) { + buf = xmlStrcat(buf, BAD_CAST ":"); + buf = xmlStrcat(buf, prefix); + } + + nsentry.prefix = buf; + nsentry.uri = (xmlChar *)namespaceURI; + nsentry.elem = xmlListFront(writer->nodes); + + curns = (xmlTextWriterNsStackEntry *)xmlListSearch(writer->nsstack, + (void *)&nsentry); + if ((curns != NULL)) { + xmlFree(buf); + if (xmlStrcmp(curns->uri, namespaceURI) == 0) { + /* Namespace already defined on element skip */ + buf = NULL; + } else { + /* Prefix mismatch so error out */ + return -1; + } + } + + /* Do not add namespace decl to list - it is already there */ + if (buf != NULL) { + p = (xmlTextWriterNsStackEntry *) + xmlMalloc(sizeof(xmlTextWriterNsStackEntry)); + if (p == 0) { + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, + "xmlTextWriterStartAttributeNS : out of memory!\n"); + return -1; + } + + p->prefix = buf; + p->uri = xmlStrdup(namespaceURI); + if (p->uri == 0) { + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, + "xmlTextWriterStartAttributeNS : out of memory!\n"); + xmlFree(p); + return -1; + } + p->elem = xmlListFront(writer->nodes); + + xmlListPushFront(writer->nsstack, p); + } + } + buf = NULL; if (prefix != 0) { buf = xmlStrdup(prefix); @@ -1782,34 +1908,6 @@ xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer, return -1; sum += count; - if (namespaceURI != 0) { - buf = xmlStrdup(BAD_CAST "xmlns"); - if (prefix != 0) { - buf = xmlStrcat(buf, BAD_CAST ":"); - buf = xmlStrcat(buf, prefix); - } - - p = (xmlTextWriterNsStackEntry *) - xmlMalloc(sizeof(xmlTextWriterNsStackEntry)); - if (p == 0) { - xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, - "xmlTextWriterStartAttributeNS : out of memory!\n"); - return -1; - } - - p->prefix = buf; - p->uri = xmlStrdup(namespaceURI); - if (p->uri == 0) { - xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, - "xmlTextWriterStartAttributeNS : out of memory!\n"); - xmlFree(p); - return -1; - } - p->elem = xmlListFront(writer->nodes); - - xmlListPushFront(writer->nsstack, p); - } - return sum; } @@ -1828,22 +1926,17 @@ xmlTextWriterEndAttribute(xmlTextWriterPtr writer) int sum; xmlLinkPtr lk; xmlTextWriterStackEntry *p; - xmlTextWriterNsStackEntry *np; if (writer == NULL) return -1; lk = xmlListFront(writer->nodes); if (lk == 0) { - xmlListDelete(writer->nsstack); - writer->nsstack = NULL; return -1; } p = (xmlTextWriterStackEntry *) xmlLinkGetData(lk); if (p == 0) { - xmlListDelete(writer->nsstack); - writer->nsstack = NULL; return -1; } @@ -1854,45 +1947,11 @@ xmlTextWriterEndAttribute(xmlTextWriterPtr writer) count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar); if (count < 0) { - xmlListDelete(writer->nsstack); - writer->nsstack = NULL; return -1; } sum += count; - - while (!xmlListEmpty(writer->nsstack)) { - xmlChar *namespaceURI = NULL; - xmlChar *prefix = NULL; - - lk = xmlListFront(writer->nsstack); - np = (xmlTextWriterNsStackEntry *) xmlLinkGetData(lk); - - if (np != 0) { - namespaceURI = xmlStrdup(np->uri); - prefix = xmlStrdup(np->prefix); - } - - xmlListPopFront(writer->nsstack); - - if (np != 0) { - count = - xmlTextWriterWriteAttribute(writer, prefix, - namespaceURI); - xmlFree(namespaceURI); - xmlFree(prefix); - - if (count < 0) { - xmlListDelete(writer->nsstack); - writer->nsstack = NULL; - return -1; - } - sum += count; - } - } break; - default: - xmlListClear(writer->nsstack); return -1; } @@ -1949,8 +2008,8 @@ xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteAttribute(writer, name, buf); @@ -2051,8 +2110,8 @@ xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI, buf); @@ -2081,38 +2140,24 @@ xmlTextWriterWriteAttributeNS(xmlTextWriterPtr writer, { int count; int sum; - xmlChar *buf; if ((writer == NULL) || (name == NULL) || (*name == '\0')) return -1; - buf = NULL; - if (prefix != NULL) { - buf = xmlStrdup(prefix); - buf = xmlStrcat(buf, BAD_CAST ":"); - } - buf = xmlStrcat(buf, name); - sum = 0; - count = xmlTextWriterWriteAttribute(writer, buf, content); - xmlFree(buf); + count = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI); + if (count < 0) + return -1; + sum += count; + count = xmlTextWriterWriteString(writer, content); + if (count < 0) + return -1; + sum += count; + count = xmlTextWriterEndAttribute(writer); if (count < 0) return -1; sum += count; - if (namespaceURI != NULL) { - buf = NULL; - buf = xmlStrdup(BAD_CAST "xmlns"); - if (prefix != NULL) { - buf = xmlStrcat(buf, BAD_CAST ":"); - buf = xmlStrcat(buf, prefix); - } - count = xmlTextWriterWriteAttribute(writer, buf, namespaceURI); - xmlFree(buf); - if (count < 0) - return -1; - sum += count; - } return sum; } @@ -2166,8 +2211,8 @@ xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteElement(writer, name, buf); @@ -2197,10 +2242,12 @@ xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name, if (count == -1) return -1; sum += count; - count = xmlTextWriterWriteString(writer, content); - if (count == -1) - return -1; - sum += count; + if (content != NULL) { + count = xmlTextWriterWriteString(writer, content); + if (count == -1) + return -1; + sum += count; + } count = xmlTextWriterEndElement(writer); if (count == -1) return -1; @@ -2268,8 +2315,8 @@ xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI, buf); @@ -2359,6 +2406,11 @@ xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target) sum += count; /* fallthrough */ case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; count = xmlOutputBufferWriteString(writer->out, ">"); if (count < 0) return -1; @@ -2454,8 +2506,8 @@ xmlTextWriterEndPI(xmlTextWriterPtr writer) if (writer->indent) { count = xmlOutputBufferWriteString(writer->out, "\n"); - if (count < 0) - return -1; + if (count < 0) + return -1; sum += count; } @@ -2512,8 +2564,8 @@ xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWritePI(writer, target, buf); @@ -2583,6 +2635,7 @@ xmlTextWriterStartCDATA(xmlTextWriterPtr writer) if (p != 0) { switch (p->state) { case XML_TEXTWRITER_NONE: + case XML_TEXTWRITER_TEXT: case XML_TEXTWRITER_PI: case XML_TEXTWRITER_PI_TEXT: break; @@ -2593,6 +2646,11 @@ xmlTextWriterStartCDATA(xmlTextWriterPtr writer) sum += count; /* fallthrough */ case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; count = xmlOutputBufferWriteString(writer->out, ">"); if (count < 0) return -1; @@ -2719,8 +2777,8 @@ xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, const char *format, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteCDATA(writer, buf); @@ -3037,8 +3095,8 @@ xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteDTD(writer, name, pubid, sysid, buf); @@ -3275,8 +3333,8 @@ xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteDTDElement(writer, name, buf); @@ -3512,8 +3570,8 @@ xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteDTDAttlist(writer, name, buf); @@ -3774,8 +3832,8 @@ xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, return -1; buf = xmlTextWriterVSprintf(format, argptr); - if (buf == 0) - return 0; + if (buf == NULL) + return -1; rc = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, buf); @@ -4248,6 +4306,51 @@ xmlCmpTextWriterStackEntry(const void *data0, const void *data1) * misc */ +/** + * xmlTextWriterOutputNSDecl: + * @writer: the xmlTextWriterPtr + * + * Output the current namespace declarations. + */ +static int +xmlTextWriterOutputNSDecl(xmlTextWriterPtr writer) +{ + xmlLinkPtr lk; + xmlTextWriterNsStackEntry *np; + int count; + int sum; + + sum = 0; + while (!xmlListEmpty(writer->nsstack)) { + xmlChar *namespaceURI = NULL; + xmlChar *prefix = NULL; + + lk = xmlListFront(writer->nsstack); + np = (xmlTextWriterNsStackEntry *) xmlLinkGetData(lk); + + if (np != 0) { + namespaceURI = xmlStrdup(np->uri); + prefix = xmlStrdup(np->prefix); + } + + xmlListPopFront(writer->nsstack); + + if (np != 0) { + count = xmlTextWriterWriteAttribute(writer, prefix, namespaceURI); + xmlFree(namespaceURI); + xmlFree(prefix); + + if (count < 0) { + xmlListDelete(writer->nsstack); + writer->nsstack = NULL; + return -1; + } + sum += count; + } + } + return sum; +} + /** * xmlFreeTextWriterNsStackEntry: * @lk: the xmlLinkPtr @@ -4301,8 +4404,8 @@ xmlCmpTextWriterNsStackEntry(const void *data0, const void *data1) rc = xmlStrcmp(p0->prefix, p1->prefix); - if (rc == 0) - rc = p0->elem == p1->elem; + if ((rc != 0) || (p0->elem != p1->elem)) + rc = -1; return rc; } @@ -4512,6 +4615,26 @@ xmlTextWriterSetIndentString(xmlTextWriterPtr writer, const xmlChar * str) return 0; } +/** + * xmlTextWriterSetQuoteChar: + * @writer: the xmlTextWriterPtr + * @quotechar: the quote character + * + * Set the character used for quoting attributes. + * + * Returns -1 on error or 0 otherwise. + */ +int +xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar) +{ + if ((writer == NULL) || ((quotechar != '\'') && (quotechar != '"'))) + return -1; + + writer->qchar = quotechar; + + return 0; +} + /** * xmlTextWriterWriteIndent: * @writer: the xmlTextWriterPtr @@ -4569,6 +4692,11 @@ xmlTextWriterHandleStateDependencies(xmlTextWriterPtr writer, sum = 0; switch (p->state) { case XML_TEXTWRITER_NAME: + /* Output namespace declarations */ + count = xmlTextWriterOutputNSDecl(writer); + if (count < 0) + return -1; + sum += count; extra[0] = '>'; p->state = XML_TEXTWRITER_TEXT; break; diff --git a/gnulib-local/lib/libxml/xmlwriter.in.h b/gnulib-local/lib/libxml/xmlwriter.in.h index 31ceb5f..dd5add3 100644 --- a/gnulib-local/lib/libxml/xmlwriter.in.h +++ b/gnulib-local/lib/libxml/xmlwriter.in.h @@ -1,4 +1,3 @@ - /* * Summary: text writing API for XML * Description: text writing API for XML @@ -69,11 +68,13 @@ extern "C" { XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer); XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, const char *format, - va_list argptr); + va_list argptr) + LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr writer, const xmlChar * @@ -102,12 +103,14 @@ extern "C" { XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, const xmlChar * name, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, const xmlChar * name, const char *format, - va_list argptr); + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr writer, const xmlChar * name, @@ -118,14 +121,16 @@ extern "C" { const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(5,6); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const char *format, - va_list argptr); + va_list argptr) + LIBXML_ATTR_FORMAT(5,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr writer, const xmlChar * @@ -141,10 +146,12 @@ extern "C" { */ XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, - const char *format, va_list argptr); + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, const xmlChar * content, int len); @@ -154,12 +161,14 @@ extern "C" { XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr writer, const char - *format, ...); + *format, ...) + LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer, const char *format, - va_list argptr); + va_list argptr) + LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content); @@ -193,12 +202,14 @@ extern "C" { XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, const xmlChar * name, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, const xmlChar * name, const char *format, - va_list argptr); + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr writer, const xmlChar * name, @@ -209,14 +220,16 @@ extern "C" { const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(5,6); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, const xmlChar * prefix, const xmlChar * name, const xmlChar * namespaceURI, const char *format, - va_list argptr); + va_list argptr) + LIBXML_ATTR_FORMAT(5,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr writer, const xmlChar * @@ -242,11 +255,13 @@ extern "C" { XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, const xmlChar * target, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, const xmlChar * target, - const char *format, va_list argptr); + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int XMLCALL xmlTextWriterWritePI(xmlTextWriterPtr writer, const xmlChar * target, @@ -270,10 +285,12 @@ extern "C" { */ XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(2,3); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, - const char *format, va_list argptr); + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(2,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, const xmlChar * content); @@ -296,13 +313,15 @@ extern "C" { const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(5,6); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, const xmlChar * name, const xmlChar * pubid, const xmlChar * sysid, - const char *format, va_list argptr); + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(5,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteDTD(xmlTextWriterPtr writer, const xmlChar * name, @@ -332,12 +351,14 @@ extern "C" { XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, const xmlChar * name, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, const xmlChar * name, const char *format, - va_list argptr); + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr writer, const xmlChar * @@ -360,12 +381,14 @@ extern "C" { XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name, const char *format, - va_list argptr); + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr writer, const xmlChar * @@ -389,13 +412,15 @@ extern "C" { xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, - const char *format, ...); + const char *format, ...) + LIBXML_ATTR_FORMAT(4,5); XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, int pe, const xmlChar * name, const char *format, - va_list argptr); + va_list argptr) + LIBXML_ATTR_FORMAT(4,0); XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, int pe, @@ -445,6 +470,10 @@ extern "C" { xmlTextWriterSetIndentString(xmlTextWriterPtr writer, const xmlChar * str); + XMLPUBFUN int XMLCALL + xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar); + + /* * misc */ diff --git a/gnulib-local/lib/libxml/xpath.c b/gnulib-local/lib/libxml/xpath.c index 8964628..935fcff 100644 --- a/gnulib-local/lib/libxml/xpath.c +++ b/gnulib-local/lib/libxml/xpath.c @@ -55,15 +55,26 @@ #include #endif +#include "buf.h" + #ifdef LIBXML_PATTERN_ENABLED #define XPATH_STREAMING #endif -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); +/** + * WITH_TIM_SORT: + * + * Use the Timsort algorithm provided in timsort.h to sort + * nodeset as this is a great improvement over the old Shell sort + * used in xmlXPathNodeSetSort() + */ +#define WITH_TIM_SORT + /* * XP_OPTIMIZED_NON_ELEM_COMPARISON: * If defined, this will use xmlXPathCmpNodesExt() instead of @@ -79,7 +90,7 @@ * XP_OPTIMIZED_FILTER_FIRST: * If defined, this will optimize expressions like "key('foo', 'val')[b][1]" * in a way, that it stop evaluation at the first node. -*/ +*/ #define XP_OPTIMIZED_FILTER_FIRST /* @@ -90,266 +101,624 @@ /* #define XP_DEBUG_OBJ_USAGE */ /* - * TODO: - * There are a few spots where some tests are done which depend upon ascii - * data. These should be enhanced for full UTF8 support (see particularly - * any use of the macros IS_ASCII_CHARACTER and IS_ASCII_DIGIT) + * XPATH_MAX_STEPS: + * when compiling an XPath expression we arbitrary limit the maximum + * number of step operation in the compiled expression. 1000000 is + * an insanely large value which should never be reached under normal + * circumstances */ - -#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) - -/************************************************************************ - * * - * Floating point stuff * - * * - ************************************************************************/ - -#ifndef TRIO_REPLACE_STDIO -#define TRIO_PUBLIC static -#endif -#include "trionan.c" +#define XPATH_MAX_STEPS 1000000 /* - * The lack of portability of this section of the libc is annoying ! - */ -double xmlXPathNAN = 0; -double xmlXPathPINF = 1; -double xmlXPathNINF = -1; -static double xmlXPathNZERO = 0; /* not exported from headers */ -static int xmlXPathInitialized = 0; - -/** - * xmlXPathInit: - * - * Initialize the XPath environment - */ -void -xmlXPathInit(void) { - if (xmlXPathInitialized) return; - - xmlXPathPINF = trio_pinf(); - xmlXPathNINF = trio_ninf(); - xmlXPathNAN = trio_nan(); - xmlXPathNZERO = trio_nzero(); - - xmlXPathInitialized = 1; -} - -/** - * xmlXPathIsNaN: - * @val: a double value - * - * Provides a portable isnan() function to detect whether a double - * is a NotaNumber. Based on trio code - * http://sourceforge.net/projects/ctrio/ - * - * Returns 1 if the value is a NaN, 0 otherwise - */ -int -xmlXPathIsNaN(double val) { - return(trio_isnan(val)); -} - -/** - * xmlXPathIsInf: - * @val: a double value - * - * Provides a portable isinf() function to detect whether a double - * is a +Infinite or -Infinite. Based on trio code - * http://sourceforge.net/projects/ctrio/ - * - * Returns 1 vi the value is +Infinite, -1 if -Infinite, 0 otherwise - */ -int -xmlXPathIsInf(double val) { - return(trio_isinf(val)); -} - -#endif /* SCHEMAS or XPATH */ -#ifdef LIBXML_XPATH_ENABLED -/** - * xmlXPathGetSign: - * @val: a double value - * - * Provides a portable function to detect the sign of a double - * Modified from trio code - * http://sourceforge.net/projects/ctrio/ - * - * Returns 1 if the value is Negative, 0 if positive + * XPATH_MAX_STACK_DEPTH: + * when evaluating an XPath expression we arbitrary limit the maximum + * number of object allowed to be pushed on the stack. 1000000 is + * an insanely large value which should never be reached under normal + * circumstances */ -static int -xmlXPathGetSign(double val) { - return(trio_signbit(val)); -} - +#define XPATH_MAX_STACK_DEPTH 1000000 /* - * TODO: when compatibility allows remove all "fake node libxslt" strings - * the test should just be name[0] = ' ' - */ -/* #define DEBUG */ -/* #define DEBUG_STEP */ -/* #define DEBUG_STEP_NTH */ -/* #define DEBUG_EXPR */ -/* #define DEBUG_EVAL_COUNTS */ - -static xmlNs xmlXPathXMLNamespaceStruct = { - NULL, - XML_NAMESPACE_DECL, - XML_XML_NAMESPACE, - BAD_CAST "xml", - NULL -}; -static xmlNsPtr xmlXPathXMLNamespace = &xmlXPathXMLNamespaceStruct; -#ifndef LIBXML_THREAD_ENABLED -/* - * Optimizer is disabled only when threaded apps are detected while - * the library ain't compiled for thread safety. - */ -static int xmlXPathDisableOptimizer = 0; -#endif - -/************************************************************************ - * * - * Error handling routines * - * * - ************************************************************************/ - -/** - * XP_ERRORNULL: - * @X: the error code - * - * Macro to raise an XPath error and return NULL. + * XPATH_MAX_NODESET_LENGTH: + * when evaluating an XPath expression nodesets are created and we + * arbitrary limit the maximum length of those node set. 10000000 is + * an insanely large value which should never be reached under normal + * circumstances, one would first need to construct an in memory tree + * with more than 10 millions nodes. */ -#define XP_ERRORNULL(X) \ - { xmlXPathErr(ctxt, X); return(NULL); } +#define XPATH_MAX_NODESET_LENGTH 10000000 /* - * The array xmlXPathErrorMessages corresponds to the enum xmlXPathError - */ -static const char *xmlXPathErrorMessages[] = { - "Ok\n", - "Number encoding\n", - "Unfinished literal\n", - "Start of literal\n", - "Expected $ for variable reference\n", - "Undefined variable\n", - "Invalid predicate\n", - "Invalid expression\n", - "Missing closing curly brace\n", - "Unregistered function\n", - "Invalid operand\n", - "Invalid type\n", - "Invalid number of arguments\n", - "Invalid context size\n", - "Invalid context position\n", - "Memory allocation error\n", - "Syntax error\n", - "Resource error\n", - "Sub resource error\n", - "Undefined namespace prefix\n", - "Encoding error\n", - "Char out of XML range\n", - "Invalid or incomplete context\n", - "?? Unknown error ??\n" /* Must be last in the list! */ -}; -#define MAXERRNO ((int)(sizeof(xmlXPathErrorMessages) / \ - sizeof(xmlXPathErrorMessages[0])) - 1) -/** - * xmlXPathErrMemory: - * @ctxt: an XPath context - * @extra: extra informations - * - * Handle a redefinition of attribute error + * TODO: + * There are a few spots where some tests are done which depend upon ascii + * data. These should be enhanced for full UTF8 support (see particularly + * any use of the macros IS_ASCII_CHARACTER and IS_ASCII_DIGIT) */ -static void -xmlXPathErrMemory(xmlXPathContextPtr ctxt, const char *extra) -{ - if (ctxt != NULL) { - if (extra) { - xmlChar buf[200]; - - xmlStrPrintf(buf, 200, - BAD_CAST "Memory allocation failed : %s\n", - extra); - ctxt->lastError.message = (char *) xmlStrdup(buf); - } else { - ctxt->lastError.message = (char *) - xmlStrdup(BAD_CAST "Memory allocation failed\n"); - } - ctxt->lastError.domain = XML_FROM_XPATH; - ctxt->lastError.code = XML_ERR_NO_MEMORY; - if (ctxt->error != NULL) - ctxt->error(ctxt->userData, &ctxt->lastError); - } else { - if (extra) - __xmlRaiseError(NULL, NULL, NULL, - NULL, NULL, XML_FROM_XPATH, - XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, - extra, NULL, NULL, 0, 0, - "Memory allocation failed : %s\n", extra); - else - __xmlRaiseError(NULL, NULL, NULL, - NULL, NULL, XML_FROM_XPATH, - XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, - NULL, NULL, NULL, 0, 0, - "Memory allocation failed\n"); - } -} +#ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON /** - * xmlXPathPErrMemory: - * @ctxt: an XPath parser context - * @extra: extra informations + * xmlXPathCmpNodesExt: + * @node1: the first node + * @node2: the second node * - * Handle a redefinition of attribute error - */ -static void -xmlXPathPErrMemory(xmlXPathParserContextPtr ctxt, const char *extra) -{ - if (ctxt == NULL) - xmlXPathErrMemory(NULL, extra); - else { - ctxt->error = XPATH_MEMORY_ERROR; - xmlXPathErrMemory(ctxt->context, extra); - } -} - -/** - * xmlXPathErr: - * @ctxt: a XPath parser context - * @error: the error code + * Compare two nodes w.r.t document order. + * This one is optimized for handling of non-element nodes. * - * Handle an XPath error + * Returns -2 in case of error 1 if first point < second point, 0 if + * it's the same node, -1 otherwise */ -void -xmlXPathErr(xmlXPathParserContextPtr ctxt, int error) -{ - if ((error < 0) || (error > MAXERRNO)) - error = MAXERRNO; - if (ctxt == NULL) { - __xmlRaiseError(NULL, NULL, NULL, - NULL, NULL, XML_FROM_XPATH, - error + XML_XPATH_EXPRESSION_OK - XPATH_EXPRESSION_OK, - XML_ERR_ERROR, NULL, 0, - NULL, NULL, NULL, 0, 0, - xmlXPathErrorMessages[error]); - return; - } - ctxt->error = error; - if (ctxt->context == NULL) { - __xmlRaiseError(NULL, NULL, NULL, - NULL, NULL, XML_FROM_XPATH, - error + XML_XPATH_EXPRESSION_OK - XPATH_EXPRESSION_OK, - XML_ERR_ERROR, NULL, 0, - (const char *) ctxt->base, NULL, NULL, - ctxt->cur - ctxt->base, 0, - xmlXPathErrorMessages[error]); - return; - } +static int +xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { + int depth1, depth2; + int misc = 0, precedence1 = 0, precedence2 = 0; + xmlNodePtr miscNode1 = NULL, miscNode2 = NULL; + xmlNodePtr cur, root; + long l1, l2; - /* cleanup current last error */ - xmlResetError(&ctxt->context->lastError); + if ((node1 == NULL) || (node2 == NULL)) + return(-2); + + if (node1 == node2) + return(0); + + /* + * a couple of optimizations which will avoid computations in most cases + */ + switch (node1->type) { + case XML_ELEMENT_NODE: + if (node2->type == XML_ELEMENT_NODE) { + if ((0 > (long) node1->content) && /* TODO: Would a != 0 suffice here? */ + (0 > (long) node2->content) && + (node1->doc == node2->doc)) + { + l1 = -((long) node1->content); + l2 = -((long) node2->content); + if (l1 < l2) + return(1); + if (l1 > l2) + return(-1); + } else + goto turtle_comparison; + } + break; + case XML_ATTRIBUTE_NODE: + precedence1 = 1; /* element is owner */ + miscNode1 = node1; + node1 = node1->parent; + misc = 1; + break; + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_COMMENT_NODE: + case XML_PI_NODE: { + miscNode1 = node1; + /* + * Find nearest element node. + */ + if (node1->prev != NULL) { + do { + node1 = node1->prev; + if (node1->type == XML_ELEMENT_NODE) { + precedence1 = 3; /* element in prev-sibl axis */ + break; + } + if (node1->prev == NULL) { + precedence1 = 2; /* element is parent */ + /* + * URGENT TODO: Are there any cases, where the + * parent of such a node is not an element node? + */ + node1 = node1->parent; + break; + } + } while (1); + } else { + precedence1 = 2; /* element is parent */ + node1 = node1->parent; + } + if ((node1 == NULL) || (node1->type != XML_ELEMENT_NODE) || + (0 <= (long) node1->content)) { + /* + * Fallback for whatever case. + */ + node1 = miscNode1; + precedence1 = 0; + } else + misc = 1; + } + break; + case XML_NAMESPACE_DECL: + /* + * TODO: why do we return 1 for namespace nodes? + */ + return(1); + default: + break; + } + switch (node2->type) { + case XML_ELEMENT_NODE: + break; + case XML_ATTRIBUTE_NODE: + precedence2 = 1; /* element is owner */ + miscNode2 = node2; + node2 = node2->parent; + misc = 1; + break; + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_COMMENT_NODE: + case XML_PI_NODE: { + miscNode2 = node2; + if (node2->prev != NULL) { + do { + node2 = node2->prev; + if (node2->type == XML_ELEMENT_NODE) { + precedence2 = 3; /* element in prev-sibl axis */ + break; + } + if (node2->prev == NULL) { + precedence2 = 2; /* element is parent */ + node2 = node2->parent; + break; + } + } while (1); + } else { + precedence2 = 2; /* element is parent */ + node2 = node2->parent; + } + if ((node2 == NULL) || (node2->type != XML_ELEMENT_NODE) || + (0 <= (long) node2->content)) + { + node2 = miscNode2; + precedence2 = 0; + } else + misc = 1; + } + break; + case XML_NAMESPACE_DECL: + return(1); + default: + break; + } + if (misc) { + if (node1 == node2) { + if (precedence1 == precedence2) { + /* + * The ugly case; but normally there aren't many + * adjacent non-element nodes around. + */ + cur = miscNode2->prev; + while (cur != NULL) { + if (cur == miscNode1) + return(1); + if (cur->type == XML_ELEMENT_NODE) + return(-1); + cur = cur->prev; + } + return (-1); + } else { + /* + * Evaluate based on higher precedence wrt to the element. + * TODO: This assumes attributes are sorted before content. + * Is this 100% correct? + */ + if (precedence1 < precedence2) + return(1); + else + return(-1); + } + } + /* + * Special case: One of the helper-elements is contained by the other. + * + * + * Text-1(precedence1 == 2) + * + * Text-6(precedence2 == 3) + * + */ + if ((precedence2 == 3) && (precedence1 > 1)) { + cur = node1->parent; + while (cur) { + if (cur == node2) + return(1); + cur = cur->parent; + } + } + if ((precedence1 == 3) && (precedence2 > 1)) { + cur = node2->parent; + while (cur) { + if (cur == node1) + return(-1); + cur = cur->parent; + } + } + } + + /* + * Speedup using document order if availble. + */ + if ((node1->type == XML_ELEMENT_NODE) && + (node2->type == XML_ELEMENT_NODE) && + (0 > (long) node1->content) && + (0 > (long) node2->content) && + (node1->doc == node2->doc)) { + + l1 = -((long) node1->content); + l2 = -((long) node2->content); + if (l1 < l2) + return(1); + if (l1 > l2) + return(-1); + } + +turtle_comparison: + + if (node1 == node2->prev) + return(1); + if (node1 == node2->next) + return(-1); + /* + * compute depth to root + */ + for (depth2 = 0, cur = node2; cur->parent != NULL; cur = cur->parent) { + if (cur->parent == node1) + return(1); + depth2++; + } + root = cur; + for (depth1 = 0, cur = node1; cur->parent != NULL; cur = cur->parent) { + if (cur->parent == node2) + return(-1); + depth1++; + } + /* + * Distinct document (or distinct entities :-( ) case. + */ + if (root != cur) { + return(-2); + } + /* + * get the nearest common ancestor. + */ + while (depth1 > depth2) { + depth1--; + node1 = node1->parent; + } + while (depth2 > depth1) { + depth2--; + node2 = node2->parent; + } + while (node1->parent != node2->parent) { + node1 = node1->parent; + node2 = node2->parent; + /* should not happen but just in case ... */ + if ((node1 == NULL) || (node2 == NULL)) + return(-2); + } + /* + * Find who's first. + */ + if (node1 == node2->prev) + return(1); + if (node1 == node2->next) + return(-1); + /* + * Speedup using document order if availble. + */ + if ((node1->type == XML_ELEMENT_NODE) && + (node2->type == XML_ELEMENT_NODE) && + (0 > (long) node1->content) && + (0 > (long) node2->content) && + (node1->doc == node2->doc)) { + + l1 = -((long) node1->content); + l2 = -((long) node2->content); + if (l1 < l2) + return(1); + if (l1 > l2) + return(-1); + } + + for (cur = node1->next;cur != NULL;cur = cur->next) + if (cur == node2) + return(1); + return(-1); /* assume there is no sibling list corruption */ +} +#endif /* XP_OPTIMIZED_NON_ELEM_COMPARISON */ + +/* + * Wrapper for the Timsort argorithm from timsort.h + */ +#ifdef WITH_TIM_SORT +#define SORT_NAME libxml_domnode +#define SORT_TYPE xmlNodePtr +/** + * wrap_cmp: + * @x: a node + * @y: another node + * + * Comparison function for the Timsort implementation + * + * Returns -2 in case of error -1 if first point < second point, 0 if + * it's the same node, +1 otherwise + */ +static +int wrap_cmp( xmlNodePtr x, xmlNodePtr y ); +#ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON + static int wrap_cmp( xmlNodePtr x, xmlNodePtr y ) + { + int res = xmlXPathCmpNodesExt(x, y); + return res == -2 ? res : -res; + } +#else + static int wrap_cmp( xmlNodePtr x, xmlNodePtr y ) + { + int res = xmlXPathCmpNodes(x, y); + return res == -2 ? res : -res; + } +#endif +#define SORT_CMP(x, y) (wrap_cmp(x, y)) +#include "timsort.h" +#endif /* WITH_TIM_SORT */ + +#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) + +/************************************************************************ + * * + * Floating point stuff * + * * + ************************************************************************/ + +#ifndef TRIO_REPLACE_STDIO +#define TRIO_PUBLIC static +#endif +#include "trionan.c" + +/* + * The lack of portability of this section of the libc is annoying ! + */ +double xmlXPathNAN = 0; +double xmlXPathPINF = 1; +double xmlXPathNINF = -1; +static double xmlXPathNZERO = 0; /* not exported from headers */ +static int xmlXPathInitialized = 0; + +/** + * xmlXPathInit: + * + * Initialize the XPath environment + */ +void +xmlXPathInit(void) { + if (xmlXPathInitialized) return; + + xmlXPathPINF = trio_pinf(); + xmlXPathNINF = trio_ninf(); + xmlXPathNAN = trio_nan(); + xmlXPathNZERO = trio_nzero(); + + xmlXPathInitialized = 1; +} + +/** + * xmlXPathIsNaN: + * @val: a double value + * + * Provides a portable isnan() function to detect whether a double + * is a NotaNumber. Based on trio code + * http://sourceforge.net/projects/ctrio/ + * + * Returns 1 if the value is a NaN, 0 otherwise + */ +int +xmlXPathIsNaN(double val) { + return(trio_isnan(val)); +} + +/** + * xmlXPathIsInf: + * @val: a double value + * + * Provides a portable isinf() function to detect whether a double + * is a +Infinite or -Infinite. Based on trio code + * http://sourceforge.net/projects/ctrio/ + * + * Returns 1 vi the value is +Infinite, -1 if -Infinite, 0 otherwise + */ +int +xmlXPathIsInf(double val) { + return(trio_isinf(val)); +} + +#endif /* SCHEMAS or XPATH */ +#ifdef LIBXML_XPATH_ENABLED +/** + * xmlXPathGetSign: + * @val: a double value + * + * Provides a portable function to detect the sign of a double + * Modified from trio code + * http://sourceforge.net/projects/ctrio/ + * + * Returns 1 if the value is Negative, 0 if positive + */ +static int +xmlXPathGetSign(double val) { + return(trio_signbit(val)); +} + + +/* + * TODO: when compatibility allows remove all "fake node libxslt" strings + * the test should just be name[0] = ' ' + */ +#ifdef DEBUG_XPATH_EXPRESSION +#define DEBUG_STEP +#define DEBUG_EXPR +#define DEBUG_EVAL_COUNTS +#endif + +static xmlNs xmlXPathXMLNamespaceStruct = { + NULL, + XML_NAMESPACE_DECL, + XML_XML_NAMESPACE, + BAD_CAST "xml", + NULL, + NULL +}; +static xmlNsPtr xmlXPathXMLNamespace = &xmlXPathXMLNamespaceStruct; +#ifndef LIBXML_THREAD_ENABLED +/* + * Optimizer is disabled only when threaded apps are detected while + * the library ain't compiled for thread safety. + */ +static int xmlXPathDisableOptimizer = 0; +#endif + +/************************************************************************ + * * + * Error handling routines * + * * + ************************************************************************/ + +/** + * XP_ERRORNULL: + * @X: the error code + * + * Macro to raise an XPath error and return NULL. + */ +#define XP_ERRORNULL(X) \ + { xmlXPathErr(ctxt, X); return(NULL); } + +/* + * The array xmlXPathErrorMessages corresponds to the enum xmlXPathError + */ +static const char *xmlXPathErrorMessages[] = { + "Ok\n", + "Number encoding\n", + "Unfinished literal\n", + "Start of literal\n", + "Expected $ for variable reference\n", + "Undefined variable\n", + "Invalid predicate\n", + "Invalid expression\n", + "Missing closing curly brace\n", + "Unregistered function\n", + "Invalid operand\n", + "Invalid type\n", + "Invalid number of arguments\n", + "Invalid context size\n", + "Invalid context position\n", + "Memory allocation error\n", + "Syntax error\n", + "Resource error\n", + "Sub resource error\n", + "Undefined namespace prefix\n", + "Encoding error\n", + "Char out of XML range\n", + "Invalid or incomplete context\n", + "Stack usage error\n", + "Forbidden variable\n", + "?? Unknown error ??\n" /* Must be last in the list! */ +}; +#define MAXERRNO ((int)(sizeof(xmlXPathErrorMessages) / \ + sizeof(xmlXPathErrorMessages[0])) - 1) +/** + * xmlXPathErrMemory: + * @ctxt: an XPath context + * @extra: extra informations + * + * Handle a redefinition of attribute error + */ +static void +xmlXPathErrMemory(xmlXPathContextPtr ctxt, const char *extra) +{ + if (ctxt != NULL) { + if (extra) { + xmlChar buf[200]; + + xmlStrPrintf(buf, 200, + BAD_CAST "Memory allocation failed : %s\n", + extra); + ctxt->lastError.message = (char *) xmlStrdup(buf); + } else { + ctxt->lastError.message = (char *) + xmlStrdup(BAD_CAST "Memory allocation failed\n"); + } + ctxt->lastError.domain = XML_FROM_XPATH; + ctxt->lastError.code = XML_ERR_NO_MEMORY; + if (ctxt->error != NULL) + ctxt->error(ctxt->userData, &ctxt->lastError); + } else { + if (extra) + __xmlRaiseError(NULL, NULL, NULL, + NULL, NULL, XML_FROM_XPATH, + XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, + extra, NULL, NULL, 0, 0, + "Memory allocation failed : %s\n", extra); + else + __xmlRaiseError(NULL, NULL, NULL, + NULL, NULL, XML_FROM_XPATH, + XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, + NULL, NULL, NULL, 0, 0, + "Memory allocation failed\n"); + } +} + +/** + * xmlXPathPErrMemory: + * @ctxt: an XPath parser context + * @extra: extra informations + * + * Handle a redefinition of attribute error + */ +static void +xmlXPathPErrMemory(xmlXPathParserContextPtr ctxt, const char *extra) +{ + if (ctxt == NULL) + xmlXPathErrMemory(NULL, extra); + else { + ctxt->error = XPATH_MEMORY_ERROR; + xmlXPathErrMemory(ctxt->context, extra); + } +} + +/** + * xmlXPathErr: + * @ctxt: a XPath parser context + * @error: the error code + * + * Handle an XPath error + */ +void +xmlXPathErr(xmlXPathParserContextPtr ctxt, int error) +{ + if ((error < 0) || (error > MAXERRNO)) + error = MAXERRNO; + if (ctxt == NULL) { + __xmlRaiseError(NULL, NULL, NULL, + NULL, NULL, XML_FROM_XPATH, + error + XML_XPATH_EXPRESSION_OK - XPATH_EXPRESSION_OK, + XML_ERR_ERROR, NULL, 0, + NULL, NULL, NULL, 0, 0, + "%s", xmlXPathErrorMessages[error]); + return; + } + ctxt->error = error; + if (ctxt->context == NULL) { + __xmlRaiseError(NULL, NULL, NULL, + NULL, NULL, XML_FROM_XPATH, + error + XML_XPATH_EXPRESSION_OK - XPATH_EXPRESSION_OK, + XML_ERR_ERROR, NULL, 0, + (const char *) ctxt->base, NULL, NULL, + ctxt->cur - ctxt->base, 0, + "%s", xmlXPathErrorMessages[error]); + return; + } + + /* cleanup current last error */ + xmlResetError(&ctxt->context->lastError); ctxt->context->lastError.domain = XML_FROM_XPATH; ctxt->context->lastError.code = error + XML_XPATH_EXPRESSION_OK - @@ -368,7 +737,7 @@ xmlXPathErr(xmlXPathParserContextPtr ctxt, int error) XML_ERR_ERROR, NULL, 0, (const char *) ctxt->base, NULL, NULL, ctxt->cur - ctxt->base, 0, - xmlXPathErrorMessages[error]); + "%s", xmlXPathErrorMessages[error]); } } @@ -389,9 +758,9 @@ xmlXPatherror(xmlXPathParserContextPtr ctxt, const char *file ATTRIBUTE_UNUSED, } /************************************************************************ - * * - * Utilities * - * * + * * + * Utilities * + * * ************************************************************************/ /** @@ -411,15 +780,14 @@ struct _xmlPointerList { * and here, we should make the functions public. */ static int -xmlPointerListAddSize(xmlPointerListPtr list, +xmlPointerListAddSize(xmlPointerListPtr list, void *item, int initialSize) { if (list->items == NULL) { if (initialSize <= 0) initialSize = 1; - list->items = (void **) xmlMalloc( - initialSize * sizeof(void *)); + list->items = (void **) xmlMalloc(initialSize * sizeof(void *)); if (list->items == NULL) { xmlXPathErrMemory(NULL, "xmlPointerListCreate: allocating item\n"); @@ -428,12 +796,17 @@ xmlPointerListAddSize(xmlPointerListPtr list, list->number = 0; list->size = initialSize; } else if (list->size <= list->number) { + if (list->size > 50000000) { + xmlXPathErrMemory(NULL, + "xmlPointerListAddSize: re-allocating item\n"); + return(-1); + } list->size *= 2; list->items = (void **) xmlRealloc(list->items, list->size * sizeof(void *)); if (list->items == NULL) { xmlXPathErrMemory(NULL, - "xmlPointerListCreate: re-allocating item\n"); + "xmlPointerListAddSize: re-allocating item\n"); list->size = 0; return(-1); } @@ -485,9 +858,9 @@ xmlPointerListFree(xmlPointerListPtr list) } /************************************************************************ - * * - * Parser Types * - * * + * * + * Parser Types * + * * ************************************************************************/ /* @@ -532,7 +905,7 @@ typedef enum { AXIS_PARENT, AXIS_PRECEDING, AXIS_PRECEDING_SIBLING, - AXIS_SELF + AXIS_SELF } xmlXPathAxisVal; typedef enum { @@ -548,11 +921,9 @@ typedef enum { NODE_TYPE_NODE = 0, NODE_TYPE_COMMENT = XML_COMMENT_NODE, NODE_TYPE_TEXT = XML_TEXT_NODE, - NODE_TYPE_PI = XML_PI_NODE + NODE_TYPE_PI = XML_PI_NODE } xmlXPathTypeVal; -#define XP_REWRITE_DOS_CHILD_ELEM 1 - typedef struct _xmlXPathStepOp xmlXPathStepOp; typedef xmlXPathStepOp *xmlXPathStepOpPtr; struct _xmlXPathStepOp { @@ -566,7 +937,6 @@ struct _xmlXPathStepOp { void *value5; void *cache; void *cacheURI; - int rewriteType; }; struct _xmlXPathCompExpr { @@ -586,9 +956,9 @@ struct _xmlXPathCompExpr { }; /************************************************************************ - * * - * Forward declarations * - * * + * * + * Forward declarations * + * * ************************************************************************/ static void xmlXPathFreeValueTree(xmlNodeSetPtr obj); @@ -603,9 +973,9 @@ xmlXPathCompOpEvalToBoolean(xmlXPathParserContextPtr ctxt, int isPredicate); /************************************************************************ - * * - * Parser Type functions * - * * + * * + * Parser Type functions * + * * ************************************************************************/ /** @@ -721,6 +1091,10 @@ xmlXPathCompExprAdd(xmlXPathCompExprPtr comp, int ch1, int ch2, if (comp->nbStep >= comp->maxStep) { xmlXPathStepOp *real; + if (comp->maxStep >= XPATH_MAX_STEPS) { + xmlXPathErrMemory(NULL, "adding step\n"); + return(-1); + } comp->maxStep *= 2; real = (xmlXPathStepOp *) xmlRealloc(comp->steps, comp->maxStep * sizeof(xmlXPathStepOp)); @@ -732,7 +1106,6 @@ xmlXPathCompExprAdd(xmlXPathCompExprPtr comp, int ch1, int ch2, comp->steps = real; } comp->last = comp->nbStep; - comp->steps[comp->nbStep].rewriteType = 0; comp->steps[comp->nbStep].ch1 = ch1; comp->steps[comp->nbStep].ch2 = ch2; comp->steps[comp->nbStep].op = op; @@ -795,19 +1168,19 @@ xmlXPathCompSwap(xmlXPathStepOpPtr op) { xmlXPathCompExprAdd(ctxt->comp, ctxt->comp->last, -1, \ (op), (val), (val2), (val3), (val4), (val5)) -#define PUSH_LEAVE_EXPR(op, val, val2) \ +#define PUSH_LEAVE_EXPR(op, val, val2) \ xmlXPathCompExprAdd(ctxt->comp, -1, -1, (op), (val), (val2), 0 ,NULL ,NULL) -#define PUSH_UNARY_EXPR(op, ch, val, val2) \ +#define PUSH_UNARY_EXPR(op, ch, val, val2) \ xmlXPathCompExprAdd(ctxt->comp, (ch), -1, (op), (val), (val2), 0 ,NULL ,NULL) -#define PUSH_BINARY_EXPR(op, ch1, ch2, val, val2) \ +#define PUSH_BINARY_EXPR(op, ch1, ch2, val, val2) \ xmlXPathCompExprAdd(ctxt->comp, (ch1), (ch2), (op), \ (val), (val2), 0 ,NULL ,NULL) /************************************************************************ * * - * XPath object cache structures * + * XPath object cache structures * * * ************************************************************************/ @@ -839,8 +1212,8 @@ struct _xmlXPathContextCache { int dbgCachedLocset; int dbgCachedUsers; int dbgCachedXSLTTree; - int dbgCachedUndefined; - + int dbgCachedUndefined; + int dbgReusedAll; int dbgReusedNodeset; @@ -859,11 +1232,11 @@ struct _xmlXPathContextCache { /************************************************************************ * * - * Debugging related functions * + * Debugging related functions * * * ************************************************************************/ -#define STRANGE \ +#define STRANGE \ xmlGenericError(xmlGenericErrorContext, \ "Internal error at %s:%d\n", \ __FILE__, __LINE__); @@ -878,15 +1251,15 @@ xmlXPathDebugDumpNode(FILE *output, xmlNodePtr cur, int depth) { shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = 0; if (cur == NULL) { - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, "Node is NULL !\n"); return; - + } if ((cur->type == XML_DOCUMENT_NODE) || (cur->type == XML_HTML_DOCUMENT_NODE)) { - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, " /\n"); } else if (cur->type == XML_ATTRIBUTE_NODE) xmlDebugDumpAttr(output, (xmlAttrPtr)cur, depth); @@ -903,10 +1276,10 @@ xmlXPathDebugDumpNodeList(FILE *output, xmlNodePtr cur, int depth) { shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = 0; if (cur == NULL) { - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, "Node is NULL !\n"); return; - + } while (cur != NULL) { @@ -926,16 +1299,16 @@ xmlXPathDebugDumpNodeSet(FILE *output, xmlNodeSetPtr cur, int depth) { shift[2 * i] = shift[2 * i + 1] = 0; if (cur == NULL) { - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, "NodeSet is NULL !\n"); return; - + } if (cur != NULL) { fprintf(output, "Set contains %d nodes:\n", cur->nodeNr); for (i = 0;i < cur->nodeNr;i++) { - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, "%d", i + 1); xmlXPathDebugDumpNode(output, cur->nodeTab[i], depth + 1); } @@ -952,13 +1325,13 @@ xmlXPathDebugDumpValueTree(FILE *output, xmlNodeSetPtr cur, int depth) { shift[2 * i] = shift[2 * i + 1] = 0; if ((cur == NULL) || (cur->nodeNr == 0) || (cur->nodeTab[0] == NULL)) { - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, "Value Tree is NULL !\n"); return; - + } - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, "%d", i + 1); xmlXPathDebugDumpNodeList(output, cur->nodeTab[0]->children, depth + 1); } @@ -973,14 +1346,14 @@ xmlXPathDebugDumpLocationSet(FILE *output, xmlLocationSetPtr cur, int depth) { shift[2 * i] = shift[2 * i + 1] = 0; if (cur == NULL) { - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, "LocationSet is NULL !\n"); return; - + } for (i = 0;i < cur->locNr;i++) { - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, "%d : ", i + 1); xmlXPathDebugDumpObject(output, cur->locTab[i], depth + 1); } @@ -1007,7 +1380,7 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { shift[2 * i] = shift[2 * i + 1] = 0; - fprintf(output, shift); + fprintf(output, "%s", shift); if (cur == NULL) { fprintf(output, "Object is empty (NULL)\n"); @@ -1062,7 +1435,7 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { if ((cur->user2 == NULL) || ((cur->user2 == cur->user) && (cur->index == cur->index2))) { fprintf(output, "Object is a collapsed range :\n"); - fprintf(output, shift); + fprintf(output, "%s", shift); if (cur->index >= 0) fprintf(output, "index %d in ", cur->index); fprintf(output, "node\n"); @@ -1070,14 +1443,14 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { depth + 1); } else { fprintf(output, "Object is a range :\n"); - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, "From "); if (cur->index >= 0) fprintf(output, "index %d in ", cur->index); fprintf(output, "node\n"); xmlXPathDebugDumpNode(output, (xmlNodePtr) cur->user, depth + 1); - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, "To "); if (cur->index2 >= 0) fprintf(output, "index %d in ", cur->index2); @@ -1110,7 +1483,7 @@ xmlXPathDebugDumpStepOp(FILE *output, xmlXPathCompExprPtr comp, shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = 0; - fprintf(output, shift); + fprintf(output, "%s", shift); if (op == NULL) { fprintf(output, "Step is NULL\n"); return; @@ -1297,7 +1670,7 @@ xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp, shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = 0; - fprintf(output, shift); + fprintf(output, "%s", shift); fprintf(output, "Compiled Expression : %d elements\n", comp->nbStep); @@ -1332,7 +1705,7 @@ static int xmlXPathDebugObjTotalRange = 0; static int xmlXPathDebugObjTotalLocset = 0; static int xmlXPathDebugObjTotalUsers = 0; static int xmlXPathDebugObjTotalXSLTTree = 0; -static int xmlXPathDebugObjTotalAll = 0; +static int xmlXPathDebugObjTotalAll = 0; static int xmlXPathDebugObjMaxUndefined = 0; static int xmlXPathDebugObjMaxNodeset = 0; @@ -1365,7 +1738,7 @@ xmlXPathDebugObjUsageReset(xmlXPathContextPtr ctxt) cache->dbgCachedLocset = 0; cache->dbgCachedUsers = 0; cache->dbgCachedXSLTTree = 0; - cache->dbgCachedUndefined = 0; + cache->dbgCachedUndefined = 0; cache->dbgReusedAll = 0; cache->dbgReusedNodeset = 0; @@ -1379,7 +1752,7 @@ xmlXPathDebugObjUsageReset(xmlXPathContextPtr ctxt) cache->dbgReusedXSLTTree = 0; cache->dbgReusedUndefined = 0; } - } + } xmlXPathDebugObjCounterUndefined = 0; xmlXPathDebugObjCounterNodeset = 0; @@ -1392,7 +1765,7 @@ xmlXPathDebugObjUsageReset(xmlXPathContextPtr ctxt) xmlXPathDebugObjCounterUsers = 0; xmlXPathDebugObjCounterXSLTTree = 0; xmlXPathDebugObjCounterAll = 0; - + xmlXPathDebugObjTotalUndefined = 0; xmlXPathDebugObjTotalNodeset = 0; xmlXPathDebugObjTotalBool = 0; @@ -1403,7 +1776,7 @@ xmlXPathDebugObjUsageReset(xmlXPathContextPtr ctxt) xmlXPathDebugObjTotalLocset = 0; xmlXPathDebugObjTotalUsers = 0; xmlXPathDebugObjTotalXSLTTree = 0; - xmlXPathDebugObjTotalAll = 0; + xmlXPathDebugObjTotalAll = 0; xmlXPathDebugObjMaxUndefined = 0; xmlXPathDebugObjMaxNodeset = 0; @@ -1429,10 +1802,10 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, if (ctxt->cache != NULL) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; - + isCached = 1; - - cache->dbgReusedAll++; + + cache->dbgReusedAll++; switch (objType) { case XPATH_UNDEFINED: cache->dbgReusedUndefined++; @@ -1466,7 +1839,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, break; default: break; - } + } } } @@ -1474,7 +1847,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_UNDEFINED: if (! isCached) xmlXPathDebugObjTotalUndefined++; - xmlXPathDebugObjCounterUndefined++; + xmlXPathDebugObjCounterUndefined++; if (xmlXPathDebugObjCounterUndefined > xmlXPathDebugObjMaxUndefined) xmlXPathDebugObjMaxUndefined = @@ -1483,7 +1856,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_NODESET: if (! isCached) xmlXPathDebugObjTotalNodeset++; - xmlXPathDebugObjCounterNodeset++; + xmlXPathDebugObjCounterNodeset++; if (xmlXPathDebugObjCounterNodeset > xmlXPathDebugObjMaxNodeset) xmlXPathDebugObjMaxNodeset = @@ -1492,7 +1865,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_BOOLEAN: if (! isCached) xmlXPathDebugObjTotalBool++; - xmlXPathDebugObjCounterBool++; + xmlXPathDebugObjCounterBool++; if (xmlXPathDebugObjCounterBool > xmlXPathDebugObjMaxBool) xmlXPathDebugObjMaxBool = @@ -1501,7 +1874,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_NUMBER: if (! isCached) xmlXPathDebugObjTotalNumber++; - xmlXPathDebugObjCounterNumber++; + xmlXPathDebugObjCounterNumber++; if (xmlXPathDebugObjCounterNumber > xmlXPathDebugObjMaxNumber) xmlXPathDebugObjMaxNumber = @@ -1510,7 +1883,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_STRING: if (! isCached) xmlXPathDebugObjTotalString++; - xmlXPathDebugObjCounterString++; + xmlXPathDebugObjCounterString++; if (xmlXPathDebugObjCounterString > xmlXPathDebugObjMaxString) xmlXPathDebugObjMaxString = @@ -1519,7 +1892,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_POINT: if (! isCached) xmlXPathDebugObjTotalPoint++; - xmlXPathDebugObjCounterPoint++; + xmlXPathDebugObjCounterPoint++; if (xmlXPathDebugObjCounterPoint > xmlXPathDebugObjMaxPoint) xmlXPathDebugObjMaxPoint = @@ -1546,7 +1919,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_USERS: if (! isCached) xmlXPathDebugObjTotalUsers++; - xmlXPathDebugObjCounterUsers++; + xmlXPathDebugObjCounterUsers++; if (xmlXPathDebugObjCounterUsers > xmlXPathDebugObjMaxUsers) xmlXPathDebugObjMaxUsers = @@ -1555,7 +1928,7 @@ xmlXPathDebugObjUsageRequested(xmlXPathContextPtr ctxt, case XPATH_XSLT_TREE: if (! isCached) xmlXPathDebugObjTotalXSLTTree++; - xmlXPathDebugObjCounterXSLTTree++; + xmlXPathDebugObjCounterXSLTTree++; if (xmlXPathDebugObjCounterXSLTTree > xmlXPathDebugObjMaxXSLTTree) xmlXPathDebugObjMaxXSLTTree = @@ -1584,8 +1957,8 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt, xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; - isCached = 1; - + isCached = 1; + cache->dbgCachedAll++; switch (objType) { case XPATH_UNDEFINED: @@ -1621,7 +1994,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt, default: break; } - + } } switch (objType) { @@ -1657,7 +2030,7 @@ xmlXPathDebugObjUsageReleased(xmlXPathContextPtr ctxt, break; default: break; - } + } xmlXPathDebugObjCounterAll--; } @@ -1680,7 +2053,7 @@ xmlXPathDebugObjUsageDisplay(xmlXPathContextPtr ctxt) reqNumber = xmlXPathDebugObjTotalNumber; reqXSLTTree = xmlXPathDebugObjTotalXSLTTree; reqUndefined = xmlXPathDebugObjTotalUndefined; - + printf("# XPath object usage:\n"); if (ctxt != NULL) { @@ -1702,7 +2075,7 @@ xmlXPathDebugObjUsageDisplay(xmlXPathContextPtr ctxt) reqXSLTTree += reXSLTTree; reUndefined = cache->dbgReusedUndefined; reqUndefined += reUndefined; - + caAll = cache->dbgCachedAll; caBool = cache->dbgCachedBool; caNodeset = cache->dbgCachedNodeset; @@ -1710,7 +2083,7 @@ xmlXPathDebugObjUsageDisplay(xmlXPathContextPtr ctxt) caNumber = cache->dbgCachedNumber; caXSLTTree = cache->dbgCachedXSLTTree; caUndefined = cache->dbgCachedUndefined; - + if (cache->nodesetObjs) leftObjs -= cache->nodesetObjs->number; if (cache->stringObjs) @@ -1723,8 +2096,8 @@ xmlXPathDebugObjUsageDisplay(xmlXPathContextPtr ctxt) leftObjs -= cache->miscObjs->number; } } - - printf("# all\n"); + + printf("# all\n"); printf("# total : %d\n", reqAll); printf("# left : %d\n", leftObjs); printf("# created: %d\n", xmlXPathDebugObjTotalAll); @@ -1847,7 +2220,7 @@ xmlXPathFreeCache(xmlXPathContextCachePtr cache) if (cache->numberObjs) xmlXPathCacheFreeObjectList(cache->numberObjs); if (cache->miscObjs) - xmlXPathCacheFreeObjectList(cache->miscObjs); + xmlXPathCacheFreeObjectList(cache->miscObjs); xmlFree(cache); } @@ -1856,7 +2229,7 @@ xmlXPathFreeCache(xmlXPathContextCachePtr cache) * * @ctxt: the XPath context * @active: enables/disables (creates/frees) the cache - * @value: a value with semantics dependant on @options + * @value: a value with semantics dependant on @options * @options: options (currently only the value 0 is used) * * Creates/frees an object cache on the XPath context. @@ -1883,7 +2256,7 @@ xmlXPathContextSetCache(xmlXPathContextPtr ctxt, return(-1); if (active) { xmlXPathContextCachePtr cache; - + if (ctxt->cache == NULL) { ctxt->cache = xmlXPathNewCache(); if (ctxt->cache == NULL) @@ -1918,7 +2291,7 @@ xmlXPathContextSetCache(xmlXPathContextPtr ctxt, */ static xmlXPathObjectPtr xmlXPathCacheWrapNodeSet(xmlXPathContextPtr ctxt, xmlNodeSetPtr val) -{ +{ if ((ctxt != NULL) && (ctxt->cache != NULL)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; @@ -1927,7 +2300,7 @@ xmlXPathCacheWrapNodeSet(xmlXPathContextPtr ctxt, xmlNodeSetPtr val) (cache->miscObjs->number != 0)) { xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->miscObjs->items[--cache->miscObjs->number]; ret->type = XPATH_NODESET; @@ -1935,12 +2308,12 @@ xmlXPathCacheWrapNodeSet(xmlXPathContextPtr ctxt, xmlNodeSetPtr val) #ifdef XP_DEBUG_OBJ_USAGE xmlXPathDebugObjUsageRequested(ctxt, XPATH_NODESET); #endif - return(ret); + return(ret); } } - + return(xmlXPathWrapNodeSet(val)); - + } /** @@ -1955,16 +2328,16 @@ xmlXPathCacheWrapNodeSet(xmlXPathContextPtr ctxt, xmlNodeSetPtr val) */ static xmlXPathObjectPtr xmlXPathCacheWrapString(xmlXPathContextPtr ctxt, xmlChar *val) -{ +{ if ((ctxt != NULL) && (ctxt->cache != NULL)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; if ((cache->stringObjs != NULL) && (cache->stringObjs->number != 0)) { - + xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->stringObjs->items[--cache->stringObjs->number]; ret->type = XPATH_STRING; @@ -2013,20 +2386,20 @@ xmlXPathCacheNewNodeSet(xmlXPathContextPtr ctxt, xmlNodePtr val) if ((cache->nodesetObjs != NULL) && (cache->nodesetObjs->number != 0)) - { + { xmlXPathObjectPtr ret; /* * Use the nodset-cache. - */ + */ ret = (xmlXPathObjectPtr) cache->nodesetObjs->items[--cache->nodesetObjs->number]; ret->type = XPATH_NODESET; ret->boolval = 0; - if (val) { + if (val) { if ((ret->nodesetval->nodeMax == 0) || (val->type == XML_NAMESPACE_DECL)) { - xmlXPathNodeSetAddUnique(ret->nodesetval, val); + xmlXPathNodeSetAddUnique(ret->nodesetval, val); } else { ret->nodesetval->nodeTab[0] = val; ret->nodesetval->nodeNr = 1; @@ -2050,6 +2423,11 @@ xmlXPathCacheNewNodeSet(xmlXPathContextPtr ctxt, xmlNodePtr val) ret->type = XPATH_NODESET; ret->boolval = 0; ret->nodesetval = xmlXPathNodeSetCreate(val); + if (ret->nodesetval == NULL) { + ctxt->lastError.domain = XML_FROM_XPATH; + ctxt->lastError.code = XML_ERR_NO_MEMORY; + return(NULL); + } #ifdef XP_DEBUG_OBJ_USAGE xmlXPathDebugObjUsageRequested(ctxt, XPATH_NODESET); #endif @@ -2071,15 +2449,15 @@ xmlXPathCacheNewNodeSet(xmlXPathContextPtr ctxt, xmlNodePtr val) */ static xmlXPathObjectPtr xmlXPathCacheNewCString(xmlXPathContextPtr ctxt, const char *val) -{ +{ if ((ctxt != NULL) && (ctxt->cache)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; if ((cache->stringObjs != NULL) && (cache->stringObjs->number != 0)) - { + { xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->stringObjs->items[--cache->stringObjs->number]; @@ -2120,15 +2498,15 @@ xmlXPathCacheNewCString(xmlXPathContextPtr ctxt, const char *val) */ static xmlXPathObjectPtr xmlXPathCacheNewString(xmlXPathContextPtr ctxt, const xmlChar *val) -{ +{ if ((ctxt != NULL) && (ctxt->cache)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; if ((cache->stringObjs != NULL) && (cache->stringObjs->number != 0)) - { + { xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->stringObjs->items[--cache->stringObjs->number]; ret->type = XPATH_STRING; @@ -2174,15 +2552,15 @@ xmlXPathCacheNewString(xmlXPathContextPtr ctxt, const xmlChar *val) */ static xmlXPathObjectPtr xmlXPathCacheNewBoolean(xmlXPathContextPtr ctxt, int val) -{ +{ if ((ctxt != NULL) && (ctxt->cache)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; if ((cache->booleanObjs != NULL) && (cache->booleanObjs->number != 0)) - { + { xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->booleanObjs->items[--cache->booleanObjs->number]; ret->type = XPATH_BOOLEAN; @@ -2228,9 +2606,9 @@ xmlXPathCacheNewFloat(xmlXPathContextPtr ctxt, double val) if ((cache->numberObjs != NULL) && (cache->numberObjs->number != 0)) - { + { xmlXPathObjectPtr ret; - + ret = (xmlXPathObjectPtr) cache->numberObjs->items[--cache->numberObjs->number]; ret->type = XPATH_NUMBER; @@ -2272,7 +2650,7 @@ xmlXPathCacheNewFloat(xmlXPathContextPtr ctxt, double val) static xmlXPathObjectPtr xmlXPathCacheConvertString(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { - xmlChar *res = NULL; + xmlChar *res = NULL; if (val == NULL) return(xmlXPathCacheNewCString(ctxt, "")); @@ -2356,7 +2734,7 @@ xmlXPathCacheObjectCopy(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) static xmlXPathObjectPtr xmlXPathCacheConvertBoolean(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { xmlXPathObjectPtr ret; - + if (val == NULL) return(xmlXPathCacheNewBoolean(ctxt, 0)); if (val->type == XPATH_BOOLEAN) @@ -2380,7 +2758,7 @@ xmlXPathCacheConvertBoolean(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { static xmlXPathObjectPtr xmlXPathCacheConvertNumber(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { xmlXPathObjectPtr ret; - + if (val == NULL) return(xmlXPathCacheNewFloat(ctxt, 0.0)); if (val->type == XPATH_NUMBER) @@ -2392,10 +2770,46 @@ xmlXPathCacheConvertNumber(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { /************************************************************************ * * - * Parser stacks related functions and macros * + * Parser stacks related functions and macros * * * ************************************************************************/ +/** + * xmlXPathSetFrame: + * @ctxt: an XPath parser context + * + * Set the callee evaluation frame + * + * Returns the previous frame value to be restored once done + */ +static int +xmlXPathSetFrame(xmlXPathParserContextPtr ctxt) { + int ret; + + if (ctxt == NULL) + return(0); + ret = ctxt->valueFrame; + ctxt->valueFrame = ctxt->valueNr; + return(ret); +} + +/** + * xmlXPathPopFrame: + * @ctxt: an XPath parser context + * @frame: the previous frame value + * + * Remove the callee evaluation frame + */ +static void +xmlXPathPopFrame(xmlXPathParserContextPtr ctxt, int frame) { + if (ctxt == NULL) + return; + if (ctxt->valueNr < ctxt->valueFrame) { + xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR); + } + ctxt->valueFrame = frame; +} + /** * valuePop: * @ctxt: an XPath evaluation context @@ -2411,6 +2825,12 @@ valuePop(xmlXPathParserContextPtr ctxt) if ((ctxt == NULL) || (ctxt->valueNr <= 0)) return (NULL); + + if (ctxt->valueNr <= ctxt->valueFrame) { + xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR); + return (NULL); + } + ctxt->valueNr--; if (ctxt->valueNr > 0) ctxt->value = ctxt->valueTab[ctxt->valueNr - 1]; @@ -2436,11 +2856,17 @@ valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value) if (ctxt->valueNr >= ctxt->valueMax) { xmlXPathObjectPtr *tmp; + if (ctxt->valueMax >= XPATH_MAX_STACK_DEPTH) { + xmlXPathErrMemory(NULL, "XPath stack depth limit reached\n"); + ctxt->error = XPATH_MEMORY_ERROR; + return (0); + } tmp = (xmlXPathObjectPtr *) xmlRealloc(ctxt->valueTab, 2 * ctxt->valueMax * sizeof(ctxt->valueTab[0])); if (tmp == NULL) { - xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); + xmlXPathErrMemory(NULL, "pushing value\n"); + ctxt->error = XPATH_MEMORY_ERROR; return (0); } ctxt->valueMax *= 2; @@ -2631,7 +3057,7 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) { #define NEXTL(l) ctxt->cur += l -#define SKIP_BLANKS \ +#define SKIP_BLANKS \ while (IS_BLANK_CH(*(ctxt->cur))) NEXT #define CURRENT (*ctxt->cur) @@ -2647,9 +3073,10 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) { #define UPPER_DOUBLE 1E9 #define LOWER_DOUBLE 1E-5 +#define LOWER_DOUBLE_EXP 5 #define INTEGER_DIGITS DBL_DIG -#define FRACTION_DIGITS (DBL_DIG + 1) +#define FRACTION_DIGITS (DBL_DIG + 1 + (LOWER_DOUBLE_EXP)) #define EXPONENT_DIGITS (3 + 2) /** @@ -2700,8 +3127,16 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize) *ptr = 0; } } else { - /* 3 is sign, decimal point, and terminating zero */ - char work[DBL_DIG + EXPONENT_DIGITS + 3]; + /* + For the dimension of work, + DBL_DIG is number of significant digits + EXPONENT is only needed for "scientific notation" + 3 is sign, decimal point, and terminating zero + LOWER_DOUBLE_EXP is max number of leading zeroes in fraction + Note that this dimension is slightly (a few characters) + larger than actually necessary. + */ + char work[DBL_DIG + EXPONENT_DIGITS + 3 + LOWER_DOUBLE_EXP]; int integer_place, fraction_place; char *ptr; char *after_fraction; @@ -2724,24 +3159,31 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize) size = snprintf(work, sizeof(work),"%*.*e", integer_place, fraction_place, number); while ((size > 0) && (work[size] != 'e')) size--; - after_fraction = work + size; } else { /* Use regular notation */ - if (absolute_value > 0.0) - integer_place = 1 + (int)log10(absolute_value); - else - integer_place = 0; - fraction_place = (integer_place > 0) - ? DBL_DIG - integer_place - : DBL_DIG; + if (absolute_value > 0.0) { + integer_place = (int)log10(absolute_value); + if (integer_place > 0) + fraction_place = DBL_DIG - integer_place - 1; + else + fraction_place = DBL_DIG - integer_place; + } else { + fraction_place = 1; + } size = snprintf(work, sizeof(work), "%0.*f", fraction_place, number); - after_fraction = work + size; + } + + /* Remove leading spaces sometimes inserted by snprintf */ + while (work[0] == ' ') { + for (ptr = &work[0];(ptr[0] = ptr[1]);ptr++); + size--; } /* Remove fractional trailing zeroes */ + after_fraction = work + size; ptr = after_fraction; while (*(--ptr) == '0') ; @@ -2766,410 +3208,127 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize) * * * Routines to handle NodeSets * * * - ************************************************************************/ - -/** - * xmlXPathOrderDocElems: - * @doc: an input document - * - * Call this routine to speed up XPath computation on static documents. - * This stamps all the element nodes with the document order - * Like for line information, the order is kept in the element->content - * field, the value stored is actually - the node number (starting at -1) - * to be able to differentiate from line numbers. - * - * Returns the number of elements found in the document or -1 in case - * of error. - */ -long -xmlXPathOrderDocElems(xmlDocPtr doc) { - long count = 0; - xmlNodePtr cur; - - if (doc == NULL) - return(-1); - cur = doc->children; - while (cur != NULL) { - if (cur->type == XML_ELEMENT_NODE) { - cur->content = (void *) (-(++count)); - if (cur->children != NULL) { - cur = cur->children; - continue; - } - } - if (cur->next != NULL) { - cur = cur->next; - continue; - } - do { - cur = cur->parent; - if (cur == NULL) - break; - if (cur == (xmlNodePtr) doc) { - cur = NULL; - break; - } - if (cur->next != NULL) { - cur = cur->next; - break; - } - } while (cur != NULL); - } - return(count); -} - -/** - * xmlXPathCmpNodes: - * @node1: the first node - * @node2: the second node - * - * Compare two nodes w.r.t document order - * - * Returns -2 in case of error 1 if first point < second point, 0 if - * it's the same node, -1 otherwise - */ -int -xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) { - int depth1, depth2; - int attr1 = 0, attr2 = 0; - xmlNodePtr attrNode1 = NULL, attrNode2 = NULL; - xmlNodePtr cur, root; - - if ((node1 == NULL) || (node2 == NULL)) - return(-2); - /* - * a couple of optimizations which will avoid computations in most cases - */ - if (node1->type == XML_ATTRIBUTE_NODE) { - attr1 = 1; - attrNode1 = node1; - node1 = node1->parent; - } - if (node2->type == XML_ATTRIBUTE_NODE) { - attr2 = 1; - attrNode2 = node2; - node2 = node2->parent; - } - if (node1 == node2) { - if (attr1 == attr2) { - /* not required, but we keep attributes in order */ - if (attr1 != 0) { - cur = attrNode2->prev; - while (cur != NULL) { - if (cur == attrNode1) - return (1); - cur = cur->prev; - } - return (-1); - } - return(0); - } - if (attr2 == 1) - return(1); - return(-1); - } - if ((node1->type == XML_NAMESPACE_DECL) || - (node2->type == XML_NAMESPACE_DECL)) - return(1); - if (node1 == node2->prev) - return(1); - if (node1 == node2->next) - return(-1); - - /* - * Speedup using document order if availble. - */ - if ((node1->type == XML_ELEMENT_NODE) && - (node2->type == XML_ELEMENT_NODE) && - (0 > (long) node1->content) && - (0 > (long) node2->content) && - (node1->doc == node2->doc)) { - long l1, l2; + ************************************************************************/ - l1 = -((long) node1->content); - l2 = -((long) node2->content); - if (l1 < l2) - return(1); - if (l1 > l2) - return(-1); - } +/** + * xmlXPathOrderDocElems: + * @doc: an input document + * + * Call this routine to speed up XPath computation on static documents. + * This stamps all the element nodes with the document order + * Like for line information, the order is kept in the element->content + * field, the value stored is actually - the node number (starting at -1) + * to be able to differentiate from line numbers. + * + * Returns the number of elements found in the document or -1 in case + * of error. + */ +long +xmlXPathOrderDocElems(xmlDocPtr doc) { + long count = 0; + xmlNodePtr cur; - /* - * compute depth to root - */ - for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) { - if (cur == node1) - return(1); - depth2++; - } - root = cur; - for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) { - if (cur == node2) - return(-1); - depth1++; - } - /* - * Distinct document (or distinct entities :-( ) case. - */ - if (root != cur) { - return(-2); - } - /* - * get the nearest common ancestor. - */ - while (depth1 > depth2) { - depth1--; - node1 = node1->parent; - } - while (depth2 > depth1) { - depth2--; - node2 = node2->parent; - } - while (node1->parent != node2->parent) { - node1 = node1->parent; - node2 = node2->parent; - /* should not happen but just in case ... */ - if ((node1 == NULL) || (node2 == NULL)) - return(-2); - } - /* - * Find who's first. - */ - if (node1 == node2->prev) - return(1); - if (node1 == node2->next) + if (doc == NULL) return(-1); - /* - * Speedup using document order if availble. - */ - if ((node1->type == XML_ELEMENT_NODE) && - (node2->type == XML_ELEMENT_NODE) && - (0 > (long) node1->content) && - (0 > (long) node2->content) && - (node1->doc == node2->doc)) { - long l1, l2; - - l1 = -((long) node1->content); - l2 = -((long) node2->content); - if (l1 < l2) - return(1); - if (l1 > l2) - return(-1); + cur = doc->children; + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) { + cur->content = (void *) (-(++count)); + if (cur->children != NULL) { + cur = cur->children; + continue; + } + } + if (cur->next != NULL) { + cur = cur->next; + continue; + } + do { + cur = cur->parent; + if (cur == NULL) + break; + if (cur == (xmlNodePtr) doc) { + cur = NULL; + break; + } + if (cur->next != NULL) { + cur = cur->next; + break; + } + } while (cur != NULL); } - - for (cur = node1->next;cur != NULL;cur = cur->next) - if (cur == node2) - return(1); - return(-1); /* assume there is no sibling list corruption */ + return(count); } -#ifdef XP_OPTIMIZED_NON_ELEM_COMPARISON /** - * xmlXPathCmpNodesExt: + * xmlXPathCmpNodes: * @node1: the first node * @node2: the second node * - * Compare two nodes w.r.t document order. - * This one is optimized for handling of non-element nodes. + * Compare two nodes w.r.t document order * * Returns -2 in case of error 1 if first point < second point, 0 if * it's the same node, -1 otherwise */ -static int -xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { +int +xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) { int depth1, depth2; - int misc = 0, precedence1 = 0, precedence2 = 0; - xmlNodePtr miscNode1 = NULL, miscNode2 = NULL; + int attr1 = 0, attr2 = 0; + xmlNodePtr attrNode1 = NULL, attrNode2 = NULL; xmlNodePtr cur, root; - long l1, l2; if ((node1 == NULL) || (node2 == NULL)) return(-2); - - if (node1 == node2) - return(0); - /* * a couple of optimizations which will avoid computations in most cases - */ - switch (node1->type) { - case XML_ELEMENT_NODE: - if (node2->type == XML_ELEMENT_NODE) { - if ((0 > (long) node1->content) && /* TODO: Would a != 0 suffice here? */ - (0 > (long) node2->content) && - (node1->doc == node2->doc)) - { - l1 = -((long) node1->content); - l2 = -((long) node2->content); - if (l1 < l2) - return(1); - if (l1 > l2) - return(-1); - } else - goto turtle_comparison; - } - break; - case XML_ATTRIBUTE_NODE: - precedence1 = 1; /* element is owner */ - miscNode1 = node1; - node1 = node1->parent; - misc = 1; - break; - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: - case XML_COMMENT_NODE: - case XML_PI_NODE: { - miscNode1 = node1; - /* - * Find nearest element node. - */ - if (node1->prev != NULL) { - do { - node1 = node1->prev; - if (node1->type == XML_ELEMENT_NODE) { - precedence1 = 3; /* element in prev-sibl axis */ - break; - } - if (node1->prev == NULL) { - precedence1 = 2; /* element is parent */ - /* - * URGENT TODO: Are there any cases, where the - * parent of such a node is not an element node? - */ - node1 = node1->parent; - break; - } - } while (1); - } else { - precedence1 = 2; /* element is parent */ - node1 = node1->parent; - } - if ((node1 == NULL) || (node1->type != XML_ELEMENT_NODE)) { - /* - * Fallback for whatever case. - */ - node1 = miscNode1; - precedence1 = 0; - } else - misc = 1; - } - break; - case XML_NAMESPACE_DECL: - /* - * TODO: why do we return 1 for namespace nodes? - */ - return(1); - default: - break; - } - switch (node2->type) { - case XML_ELEMENT_NODE: - break; - case XML_ATTRIBUTE_NODE: - precedence2 = 1; /* element is owner */ - miscNode2 = node2; - node2 = node2->parent; - misc = 1; - break; - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: - case XML_COMMENT_NODE: - case XML_PI_NODE: { - miscNode2 = node2; - if (node2->prev != NULL) { - do { - node2 = node2->prev; - if (node2->type == XML_ELEMENT_NODE) { - precedence2 = 3; /* element in prev-sibl axis */ - break; - } - if (node2->prev == NULL) { - precedence2 = 2; /* element is parent */ - node2 = node2->parent; - break; - } - } while (1); - } else { - precedence2 = 2; /* element is parent */ - node2 = node2->parent; - } - if ((node2 == NULL) || (node2->type != XML_ELEMENT_NODE) || - (0 <= (long) node1->content)) - { - node2 = miscNode2; - precedence2 = 0; - } else - misc = 1; - } - break; - case XML_NAMESPACE_DECL: - return(1); - default: - break; + */ + if (node1 == node2) /* trivial case */ + return(0); + if (node1->type == XML_ATTRIBUTE_NODE) { + attr1 = 1; + attrNode1 = node1; + node1 = node1->parent; } - if (misc) { - if (node1 == node2) { - if (precedence1 == precedence2) { - /* - * The ugly case; but normally there aren't many - * adjacent non-element nodes around. - */ - cur = miscNode2->prev; + if (node2->type == XML_ATTRIBUTE_NODE) { + attr2 = 1; + attrNode2 = node2; + node2 = node2->parent; + } + if (node1 == node2) { + if (attr1 == attr2) { + /* not required, but we keep attributes in order */ + if (attr1 != 0) { + cur = attrNode2->prev; while (cur != NULL) { - if (cur == miscNode1) - return(1); - if (cur->type == XML_ELEMENT_NODE) - return(-1); + if (cur == attrNode1) + return (1); cur = cur->prev; } return (-1); - } else { - /* - * Evaluate based on higher precedence wrt to the element. - * TODO: This assumes attributes are sorted before content. - * Is this 100% correct? - */ - if (precedence1 < precedence2) - return(1); - else - return(-1); - } - } - /* - * Special case: One of the helper-elements is contained by the other. - * - * - * Text-1(precedence1 == 2) - * - * Text-6(precedence2 == 3) - * - */ - if ((precedence2 == 3) && (precedence1 > 1)) { - cur = node1->parent; - while (cur) { - if (cur == node2) - return(1); - cur = cur->parent; - } - } - if ((precedence1 == 3) && (precedence2 > 1)) { - cur = node2->parent; - while (cur) { - if (cur == node1) - return(-1); - cur = cur->parent; } + return(0); } - } + if (attr2 == 1) + return(1); + return(-1); + } + if ((node1->type == XML_NAMESPACE_DECL) || + (node2->type == XML_NAMESPACE_DECL)) + return(1); + if (node1 == node2->prev) + return(1); + if (node1 == node2->next) + return(-1); /* * Speedup using document order if availble. */ - if ((node1->type == XML_ELEMENT_NODE) && + if ((node1->type == XML_ELEMENT_NODE) && (node2->type == XML_ELEMENT_NODE) && (0 > (long) node1->content) && (0 > (long) node2->content) && - (node1->doc == node2->doc)) { + (node1->doc == node2->doc)) { + long l1, l2; l1 = -((long) node1->content); l2 = -((long) node2->content); @@ -3179,12 +3338,6 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) { return(-1); } -turtle_comparison: - - if (node1 == node2->prev) - return(1); - if (node1 == node2->next) - return(-1); /* * compute depth to root */ @@ -3237,7 +3390,8 @@ turtle_comparison: (node2->type == XML_ELEMENT_NODE) && (0 > (long) node1->content) && (0 > (long) node2->content) && - (node1->doc == node2->doc)) { + (node1->doc == node2->doc)) { + long l1, l2; l1 = -((long) node1->content); l2 = -((long) node2->content); @@ -3252,7 +3406,6 @@ turtle_comparison: return(1); return(-1); /* assume there is no sibling list corruption */ } -#endif /* XP_OPTIMIZED_NON_ELEM_COMPARISON */ /** * xmlXPathNodeSetSort: @@ -3262,13 +3415,19 @@ turtle_comparison: */ void xmlXPathNodeSetSort(xmlNodeSetPtr set) { +#ifndef WITH_TIM_SORT int i, j, incr, len; xmlNodePtr tmp; +#endif if (set == NULL) return; - /* Use Shell's sort to sort the node-set */ +#ifndef WITH_TIM_SORT + /* + * Use the old Shell's sort implementation to sort the node-set + * Timsort ought to be quite faster + */ len = set->nodeNr; for (incr = len / 2; incr > 0; incr /= 2) { for (i = incr; i < len; i++) { @@ -3291,6 +3450,9 @@ xmlXPathNodeSetSort(xmlNodeSetPtr set) { } } } +#else /* WITH_TIM_SORT */ + libxml_domnode_tim_sort(set->nodeTab, set->nodeNr); +#endif /* WITH_TIM_SORT */ } #define XML_NODESET_DEFAULT 10 @@ -3325,9 +3487,9 @@ xmlXPathNodeSetDupNs(xmlNodePtr node, xmlNsPtr ns) { memset(cur, 0, sizeof(xmlNs)); cur->type = XML_NAMESPACE_DECL; if (ns->href != NULL) - cur->href = xmlStrdup(ns->href); + cur->href = xmlStrdup(ns->href); if (ns->prefix != NULL) - cur->prefix = xmlStrdup(ns->prefix); + cur->prefix = xmlStrdup(ns->prefix); cur->next = (xmlNsPtr) node; return((xmlNodePtr) cur); } @@ -3421,7 +3583,7 @@ xmlXPathNodeSetCreateSize(int size) { return(NULL); } memset(ret->nodeTab, 0 , size * (size_t) sizeof(xmlNodePtr)); - ret->nodeMax = size; + ret->nodeMax = size; return(ret); } @@ -3469,16 +3631,18 @@ xmlXPathNodeSetContains (xmlNodeSetPtr cur, xmlNodePtr val) { * @ns: a the namespace node * * add a new namespace node to an existing NodeSet + * + * Returns 0 in case of success and -1 in case of error */ -void +int xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) { int i; - + if ((cur == NULL) || (ns == NULL) || (node == NULL) || (ns->type != XML_NAMESPACE_DECL) || (node->type != XML_ELEMENT_NODE)) - return; + return(-1); /* @@ with_ns to check whether namespace nodes should be looked at @@ */ /* @@ -3489,7 +3653,7 @@ xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) { (cur->nodeTab[i]->type == XML_NAMESPACE_DECL) && (((xmlNsPtr)cur->nodeTab[i])->next == (xmlNsPtr) node) && (xmlStrEqual(ns->prefix, ((xmlNsPtr)cur->nodeTab[i])->prefix))) - return; + return(0); } /* @@ -3500,7 +3664,7 @@ xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) { sizeof(xmlNodePtr)); if (cur->nodeTab == NULL) { xmlXPathErrMemory(NULL, "growing nodeset\n"); - return; + return(-1); } memset(cur->nodeTab, 0 , XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr)); @@ -3508,16 +3672,21 @@ xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) { } else if (cur->nodeNr == cur->nodeMax) { xmlNodePtr *temp; - cur->nodeMax *= 2; - temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * + if (cur->nodeMax >= XPATH_MAX_NODESET_LENGTH) { + xmlXPathErrMemory(NULL, "growing nodeset hit limit\n"); + return(-1); + } + temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 * sizeof(xmlNodePtr)); if (temp == NULL) { xmlXPathErrMemory(NULL, "growing nodeset\n"); - return; + return(-1); } + cur->nodeMax *= 2; cur->nodeTab = temp; } cur->nodeTab[cur->nodeNr++] = xmlXPathNodeSetDupNs(node, ns); + return(0); } /** @@ -3526,24 +3695,21 @@ xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) { * @val: a new xmlNodePtr * * add a new xmlNodePtr to an existing NodeSet + * + * Returns 0 in case of success, and -1 in case of error */ -void +int xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) { int i; - if ((cur == NULL) || (val == NULL)) return; - -#if 0 - if ((val->type == XML_ELEMENT_NODE) && (val->name[0] == ' ')) - return; /* an XSLT fake node */ -#endif + if ((cur == NULL) || (val == NULL)) return(-1); /* @@ with_ns to check whether namespace nodes should be looked at @@ */ /* * prevent duplcates */ for (i = 0;i < cur->nodeNr;i++) - if (cur->nodeTab[i] == val) return; + if (cur->nodeTab[i] == val) return(0); /* * grow the nodeTab if needed @@ -3553,7 +3719,7 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) { sizeof(xmlNodePtr)); if (cur->nodeTab == NULL) { xmlXPathErrMemory(NULL, "growing nodeset\n"); - return; + return(-1); } memset(cur->nodeTab, 0 , XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr)); @@ -3561,22 +3727,27 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) { } else if (cur->nodeNr == cur->nodeMax) { xmlNodePtr *temp; - cur->nodeMax *= 2; - temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * + if (cur->nodeMax >= XPATH_MAX_NODESET_LENGTH) { + xmlXPathErrMemory(NULL, "growing nodeset hit limit\n"); + return(-1); + } + temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 * sizeof(xmlNodePtr)); if (temp == NULL) { xmlXPathErrMemory(NULL, "growing nodeset\n"); - return; + return(-1); } + cur->nodeMax *= 2; cur->nodeTab = temp; } if (val->type == XML_NAMESPACE_DECL) { xmlNsPtr ns = (xmlNsPtr) val; - cur->nodeTab[cur->nodeNr++] = + cur->nodeTab[cur->nodeNr++] = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); } else cur->nodeTab[cur->nodeNr++] = val; + return(0); } /** @@ -3586,15 +3757,12 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) { * * add a new xmlNodePtr to an existing NodeSet, optimized version * when we are sure the node is not already in the set. + * + * Returns 0 in case of success and -1 in case of failure */ -void +int xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) { - if ((cur == NULL) || (val == NULL)) return; - -#if 0 - if ((val->type == XML_ELEMENT_NODE) && (val->name[0] == ' ')) - return; /* an XSLT fake node */ -#endif + if ((cur == NULL) || (val == NULL)) return(-1); /* @@ with_ns to check whether namespace nodes should be looked at @@ */ /* @@ -3605,7 +3773,7 @@ xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) { sizeof(xmlNodePtr)); if (cur->nodeTab == NULL) { xmlXPathErrMemory(NULL, "growing nodeset\n"); - return; + return(-1); } memset(cur->nodeTab, 0 , XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr)); @@ -3613,22 +3781,27 @@ xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) { } else if (cur->nodeNr == cur->nodeMax) { xmlNodePtr *temp; - cur->nodeMax *= 2; - temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * + if (cur->nodeMax >= XPATH_MAX_NODESET_LENGTH) { + xmlXPathErrMemory(NULL, "growing nodeset hit limit\n"); + return(-1); + } + temp = (xmlNodePtr *) xmlRealloc(cur->nodeTab, cur->nodeMax * 2 * sizeof(xmlNodePtr)); if (temp == NULL) { xmlXPathErrMemory(NULL, "growing nodeset\n"); - return; + return(-1); } cur->nodeTab = temp; + cur->nodeMax *= 2; } if (val->type == XML_NAMESPACE_DECL) { xmlNsPtr ns = (xmlNsPtr) val; - cur->nodeTab[cur->nodeNr++] = + cur->nodeTab[cur->nodeNr++] = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); } else cur->nodeTab[cur->nodeNr++] = val; + return(0); } /** @@ -3649,6 +3822,8 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { if (val2 == NULL) return(val1); if (val1 == NULL) { val1 = xmlXPathNodeSetCreate(NULL); + if (val1 == NULL) + return (NULL); #if 0 /* * TODO: The optimization won't work in every case, since @@ -3658,7 +3833,7 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { * If there was a flag on the nodesetval, indicating that * some temporary nodes are in, that would be helpfull. */ - /* + /* * Optimization: Create an equally sized node-set * and memcpy the content. */ @@ -3682,7 +3857,7 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { initNr = val1->nodeNr; for (i = 0;i < val2->nodeNr;i++) { - n2 = val2->nodeTab[i]; + n2 = val2->nodeTab[i]; /* * check against duplicates */ @@ -3693,7 +3868,7 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { skip = 1; break; } else if ((n1->type == XML_NAMESPACE_DECL) && - (n2->type == XML_NAMESPACE_DECL)) { + (n2->type == XML_NAMESPACE_DECL)) { if ((((xmlNsPtr) n1)->next == ((xmlNsPtr) n2)->next) && (xmlStrEqual(((xmlNsPtr) n1)->prefix, ((xmlNsPtr) n2)->prefix))) @@ -3722,14 +3897,18 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { } else if (val1->nodeNr == val1->nodeMax) { xmlNodePtr *temp; - val1->nodeMax *= 2; - temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax * + if (val1->nodeMax >= XPATH_MAX_NODESET_LENGTH) { + xmlXPathErrMemory(NULL, "merging nodeset hit limit\n"); + return(NULL); + } + temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax * 2 * sizeof(xmlNodePtr)); if (temp == NULL) { xmlXPathErrMemory(NULL, "merging nodeset\n"); return(NULL); } val1->nodeTab = temp; + val1->nodeMax *= 2; } if (n2->type == XML_NAMESPACE_DECL) { xmlNsPtr ns = (xmlNsPtr) n2; @@ -3743,66 +3922,6 @@ xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { return(val1); } -#if 0 /* xmlXPathNodeSetMergeUnique() is currently not used anymore */ -/** - * xmlXPathNodeSetMergeUnique: - * @val1: the first NodeSet or NULL - * @val2: the second NodeSet - * - * Merges two nodesets, all nodes from @val2 are added to @val1 - * if @val1 is NULL, a new set is created and copied from @val2 - * - * Returns @val1 once extended or NULL in case of error. - */ -static xmlNodeSetPtr -xmlXPathNodeSetMergeUnique(xmlNodeSetPtr val1, xmlNodeSetPtr val2) { - int i; - - if (val2 == NULL) return(val1); - if (val1 == NULL) { - val1 = xmlXPathNodeSetCreate(NULL); - } - - /* @@ with_ns to check whether namespace nodes should be looked at @@ */ - - for (i = 0;i < val2->nodeNr;i++) { - /* - * grow the nodeTab if needed - */ - if (val1->nodeMax == 0) { - val1->nodeTab = (xmlNodePtr *) xmlMalloc(XML_NODESET_DEFAULT * - sizeof(xmlNodePtr)); - if (val1->nodeTab == NULL) { - xmlXPathErrMemory(NULL, "merging nodeset\n"); - return(NULL); - } - memset(val1->nodeTab, 0 , - XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr)); - val1->nodeMax = XML_NODESET_DEFAULT; - } else if (val1->nodeNr == val1->nodeMax) { - xmlNodePtr *temp; - - val1->nodeMax *= 2; - temp = (xmlNodePtr *) xmlRealloc(val1->nodeTab, val1->nodeMax * - sizeof(xmlNodePtr)); - if (temp == NULL) { - xmlXPathErrMemory(NULL, "merging nodeset\n"); - return(NULL); - } - val1->nodeTab = temp; - } - if (val2->nodeTab[i]->type == XML_NAMESPACE_DECL) { - xmlNsPtr ns = (xmlNsPtr) val2->nodeTab[i]; - - val1->nodeTab[val1->nodeNr++] = - xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); - } else - val1->nodeTab[val1->nodeNr++] = val2->nodeTab[i]; - } - - return(val1); -} -#endif /* xmlXPathNodeSetMergeUnique() is currently not used anymore */ /** * xmlXPathNodeSetMergeAndClear: @@ -3838,9 +3957,11 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, xmlNodePtr n1, n2; if (set1 == NULL) - set1 = xmlXPathNodeSetCreate(NULL); + set1 = xmlXPathNodeSetCreate(NULL); + if (set1 == NULL) + return (NULL); - initNbSet1 = set1->nodeNr; + initNbSet1 = set1->nodeNr; for (i = 0;i < set2->nodeNr;i++) { n2 = set2->nodeTab[i]; /* @@ -3853,11 +3974,11 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, */ for (j = 0; j < initNbSet1; j++) { n1 = set1->nodeTab[j]; - if (n1 == n2) { + if (n1 == n2) { goto skip_node; } else if ((n1->type == XML_NAMESPACE_DECL) && (n2->type == XML_NAMESPACE_DECL)) - { + { if ((((xmlNsPtr) n1)->next == ((xmlNsPtr) n2)->next) && (xmlStrEqual(((xmlNsPtr) n1)->prefix, ((xmlNsPtr) n2)->prefix))) @@ -3886,19 +4007,23 @@ xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, set1->nodeMax = XML_NODESET_DEFAULT; } else if (set1->nodeNr >= set1->nodeMax) { xmlNodePtr *temp; - - set1->nodeMax *= 2; + + if (set1->nodeMax >= XPATH_MAX_NODESET_LENGTH) { + xmlXPathErrMemory(NULL, "merging nodeset hit limit\n"); + return(NULL); + } temp = (xmlNodePtr *) xmlRealloc( - set1->nodeTab, set1->nodeMax * sizeof(xmlNodePtr)); + set1->nodeTab, set1->nodeMax * 2 * sizeof(xmlNodePtr)); if (temp == NULL) { xmlXPathErrMemory(NULL, "merging nodeset\n"); return(NULL); } set1->nodeTab = temp; + set1->nodeMax *= 2; } if (n2->type == XML_NAMESPACE_DECL) { xmlNsPtr ns = (xmlNsPtr) n2; - + set1->nodeTab[set1->nodeNr++] = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); } else @@ -3926,7 +4051,7 @@ skip_node: static xmlNodeSetPtr xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2, int hasNullEntries) -{ +{ if (set2 == NULL) return(set1); if ((set1 == NULL) && (hasNullEntries == 0)) { @@ -3948,14 +4073,16 @@ xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2, if (set1 == NULL) set1 = xmlXPathNodeSetCreate(NULL); - + if (set1 == NULL) + return (NULL); + for (i = 0;i < set2->nodeNr;i++) { n2 = set2->nodeTab[i]; /* * Skip NULLed entries. */ if (n2 == NULL) - continue; + continue; if (set1->nodeMax == 0) { set1->nodeTab = (xmlNodePtr *) xmlMalloc( XML_NODESET_DEFAULT * sizeof(xmlNodePtr)); @@ -3968,15 +4095,19 @@ xmlXPathNodeSetMergeAndClearNoDupls(xmlNodeSetPtr set1, xmlNodeSetPtr set2, set1->nodeMax = XML_NODESET_DEFAULT; } else if (set1->nodeNr >= set1->nodeMax) { xmlNodePtr *temp; - - set1->nodeMax *= 2; + + if (set1->nodeMax >= XPATH_MAX_NODESET_LENGTH) { + xmlXPathErrMemory(NULL, "merging nodeset hit limit\n"); + return(NULL); + } temp = (xmlNodePtr *) xmlRealloc( - set1->nodeTab, set1->nodeMax * sizeof(xmlNodePtr)); + set1->nodeTab, set1->nodeMax * 2 * sizeof(xmlNodePtr)); if (temp == NULL) { xmlXPathErrMemory(NULL, "merging nodeset\n"); return(NULL); } set1->nodeTab = temp; + set1->nodeMax *= 2; } set1->nodeTab[set1->nodeNr++] = n2; } @@ -4007,7 +4138,7 @@ xmlXPathNodeSetDel(xmlNodeSetPtr cur, xmlNodePtr val) { if (i >= cur->nodeNr) { /* not found */ #ifdef DEBUG - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "xmlXPathNodeSetDel: Node %s wasn't found in NodeList\n", val->name); #endif @@ -4067,7 +4198,7 @@ xmlXPathFreeNodeSet(xmlNodeSetPtr obj) { /** * xmlXPathNodeSetClear: * @set: the node set to clear - * + * * Clears the list from all temporary XPath objects (e.g. namespace nodes * are feed), but does *not* free the list itself. Sets the length of the * list to 0. @@ -4080,13 +4211,13 @@ xmlXPathNodeSetClear(xmlNodeSetPtr set, int hasNsNodes) else if (hasNsNodes) { int i; xmlNodePtr node; - + for (i = 0; i < set->nodeNr; i++) { node = set->nodeTab[i]; if ((node != NULL) && (node->type == XML_NAMESPACE_DECL)) xmlXPathNodeSetFreeNs((xmlNsPtr) node); - } + } } set->nodeNr = 0; } @@ -4095,7 +4226,7 @@ xmlXPathNodeSetClear(xmlNodeSetPtr set, int hasNsNodes) * xmlXPathNodeSetClearFromPos: * @set: the node set to be cleared * @pos: the start position to clear from - * + * * Clears the list from temporary XPath objects (e.g. namespace nodes * are feed) starting with the entry at @pos, but does *not* free the list * itself. Sets the length of the list to @pos. @@ -4108,13 +4239,13 @@ xmlXPathNodeSetClearFromPos(xmlNodeSetPtr set, int pos, int hasNsNodes) else if ((hasNsNodes)) { int i; xmlNodePtr node; - + for (i = pos; i < set->nodeNr; i++) { node = set->nodeTab[i]; if ((node != NULL) && (node->type == XML_NAMESPACE_DECL)) xmlXPathNodeSetFreeNs((xmlNsPtr) node); - } + } } set->nodeNr = pos; } @@ -4267,8 +4398,12 @@ xmlXPathNewNodeSetList(xmlNodeSetPtr val) ret = xmlXPathNewNodeSet(NULL); else { ret = xmlXPathNewNodeSet(val->nodeTab[0]); - for (i = 1; i < val->nodeNr; ++i) - xmlXPathNodeSetAddUnique(ret->nodesetval, val->nodeTab[i]); + if (ret) { + for (i = 1; i < val->nodeNr; ++i) { + if (xmlXPathNodeSetAddUnique(ret->nodesetval, val->nodeTab[i]) + < 0) break; + } + } } return (ret); @@ -4344,8 +4479,10 @@ xmlXPathDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { for (i = 0; i < l1; i++) { cur = xmlXPathNodeSetItem(nodes1, i); - if (!xmlXPathNodeSetContains(nodes2, cur)) - xmlXPathNodeSetAddUnique(ret, cur); + if (!xmlXPathNodeSetContains(nodes2, cur)) { + if (xmlXPathNodeSetAddUnique(ret, cur) < 0) + break; + } } return(ret); } @@ -4367,6 +4504,8 @@ xmlXPathIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { int i, l1; xmlNodePtr cur; + if (ret == NULL) + return(ret); if (xmlXPathNodeSetIsEmpty(nodes1)) return(ret); if (xmlXPathNodeSetIsEmpty(nodes2)) @@ -4376,8 +4515,10 @@ xmlXPathIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { for (i = 0; i < l1; i++) { cur = xmlXPathNodeSetItem(nodes1, i); - if (xmlXPathNodeSetContains(nodes2, cur)) - xmlXPathNodeSetAddUnique(ret, cur); + if (xmlXPathNodeSetContains(nodes2, cur)) { + if (xmlXPathNodeSetAddUnique(ret, cur) < 0) + break; + } } return(ret); } @@ -4388,7 +4529,7 @@ xmlXPathIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { * * Implements the EXSLT - Sets distinct() function: * node-set set:distinct (node-set) - * + * * Returns a subset of the nodes contained in @nodes, or @nodes if * it is empty */ @@ -4404,6 +4545,8 @@ xmlXPathDistinctSorted (xmlNodeSetPtr nodes) { return(nodes); ret = xmlXPathNodeSetCreate(NULL); + if (ret == NULL) + return(ret); l = xmlXPathNodeSetGetLength(nodes); hash = xmlHashCreate (l); for (i = 0; i < l; i++) { @@ -4411,7 +4554,8 @@ xmlXPathDistinctSorted (xmlNodeSetPtr nodes) { strval = xmlXPathCastNodeToString(cur); if (xmlHashLookup(hash, strval) == NULL) { xmlHashAddEntry(hash, strval, strval); - xmlXPathNodeSetAddUnique(ret, cur); + if (xmlXPathNodeSetAddUnique(ret, cur) < 0) + break; } else { xmlFree(strval); } @@ -4492,6 +4636,8 @@ xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) { return(nodes); ret = xmlXPathNodeSetCreate(NULL); + if (ret == NULL) + return(ret); if (xmlXPathNodeSetIsEmpty(nodes) || (!xmlXPathNodeSetContains(nodes, node))) return(ret); @@ -4501,7 +4647,8 @@ xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) { cur = xmlXPathNodeSetItem(nodes, i); if (cur == node) break; - xmlXPathNodeSetAddUnique(ret, cur); + if (xmlXPathNodeSetAddUnique(ret, cur) < 0) + break; } return(ret); } @@ -4594,17 +4741,21 @@ xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node) { return(nodes); ret = xmlXPathNodeSetCreate(NULL); + if (ret == NULL) + return(ret); if (xmlXPathNodeSetIsEmpty(nodes) || (!xmlXPathNodeSetContains(nodes, node))) return(ret); l = xmlXPathNodeSetGetLength(nodes); - for (i = l; i > 0; i--) { + for (i = l - 1; i >= 0; i--) { cur = xmlXPathNodeSetItem(nodes, i); if (cur == node) break; - xmlXPathNodeSetAddUnique(ret, cur); + if (xmlXPathNodeSetAddUnique(ret, cur) < 0) + break; } + xmlXPathNodeSetSort(ret); /* bug 413451 */ return(ret); } @@ -4690,7 +4841,7 @@ xmlXPathTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { * * Returns 0 in case of success, -1 in case of error */ -int +int xmlXPathRegisterFunc(xmlXPathContextPtr ctxt, const xmlChar *name, xmlXPathFunction f) { return(xmlXPathRegisterFuncNS(ctxt, name, NULL, f)); @@ -4784,7 +4935,7 @@ xmlXPathFunction xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri) { xmlXPathFunction ret; - + if (ctxt == NULL) return(NULL); if (name == NULL) @@ -4838,7 +4989,7 @@ xmlXPathRegisteredFuncsCleanup(xmlXPathContextPtr ctxt) { * * Returns 0 in case of success, -1 in case of error */ -int +int xmlXPathRegisterVariable(xmlXPathContextPtr ctxt, const xmlChar *name, xmlXPathObjectPtr value) { return(xmlXPathRegisterVariableNS(ctxt, name, NULL, value)); @@ -4870,7 +5021,7 @@ xmlXPathRegisterVariableNS(xmlXPathContextPtr ctxt, const xmlChar *name, if (ctxt->varHash == NULL) return(-1); if (value == NULL) - return(xmlHashRemoveEntry2(ctxt->varHash, name, ns_uri, + return(xmlHashRemoveEntry2(ctxt->varHash, name, ns_uri, (xmlHashDeallocator)xmlXPathFreeObject)); return(xmlHashUpdateEntry2(ctxt->varHash, name, ns_uri, (void *) value, @@ -4926,7 +5077,7 @@ xmlXPathVariableLookup(xmlXPathContextPtr ctxt, const xmlChar *name) { * @ns_uri: the variable namespace URI * * Search in the Variable array of the context for the given - * variable value. + * variable value. * * Returns the a copy of the value or NULL if not found */ @@ -4971,7 +5122,7 @@ xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt) { /** * xmlXPathRegisterNs: * @ctxt: the XPath context - * @prefix: the namespace prefix + * @prefix: the namespace prefix cannot be NULL or empty string * @ns_uri: the namespace name * * Register a new namespace. If @ns_uri is NULL it unregisters @@ -4986,6 +5137,8 @@ xmlXPathRegisterNs(xmlXPathContextPtr ctxt, const xmlChar *prefix, return(-1); if (prefix == NULL) return(-1); + if (prefix[0] == 0) + return(-1); if (ctxt->nsHash == NULL) ctxt->nsHash = xmlHashCreate(10); @@ -5309,7 +5462,7 @@ xmlXPathObjectCopy(xmlXPathObjectPtr val) { #endif case XPATH_USERS: ret->user = val->user; - break; + break; case XPATH_UNDEFINED: xmlGenericError(xmlGenericErrorContext, "xmlXPathObjectCopy: unsupported type %d\n", @@ -5338,7 +5491,7 @@ xmlXPathFreeObject(xmlXPathObjectPtr obj) { #endif obj->type = XPATH_XSLT_TREE; /* TODO: Just for debugging. */ if (obj->nodesetval != NULL) - xmlXPathFreeValueTree(obj->nodesetval); + xmlXPathFreeValueTree(obj->nodesetval); } else { if (obj->nodesetval != NULL) xmlXPathFreeNodeSet(obj->nodesetval); @@ -5355,7 +5508,7 @@ xmlXPathFreeObject(xmlXPathObjectPtr obj) { #ifdef XP_DEBUG_OBJ_USAGE xmlXPathDebugObjUsageReleased(NULL, obj->type); #endif - xmlFree(obj); + xmlFree(obj); } /** @@ -5378,7 +5531,7 @@ xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj) return; if ((ctxt == NULL) || (ctxt->cache == NULL)) { xmlXPathFreeObject(obj); - } else { + } else { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; @@ -5387,7 +5540,7 @@ xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj) case XPATH_XSLT_TREE: if (obj->nodesetval != NULL) { if (obj->boolval) { - /* + /* * It looks like the @boolval is used for * evaluation if this an XSLT Result Tree Fragment. * TODO: Check if this assumption is correct. @@ -5434,7 +5587,7 @@ xmlXPathReleaseObject(xmlXPathContextPtr ctxt, xmlXPathObjectPtr obj) xmlXPtrFreeLocationSet(obj->user); } goto free_obj; -#endif +#endif default: goto free_obj; } @@ -5455,7 +5608,7 @@ obj_cached: if (obj->nodesetval != NULL) { xmlNodeSetPtr tmpset = obj->nodesetval; - + /* * TODO: Due to those nasty ns-nodes, we need to traverse * the list and free the ns-nodes. @@ -5478,7 +5631,7 @@ obj_cached: if ((tmpset->nodeTab[0] != NULL) && (tmpset->nodeTab[0]->type == XML_NAMESPACE_DECL)) xmlXPathNodeSetFreeNs((xmlNsPtr) tmpset->nodeTab[0]); - } + } tmpset->nodeNr = 0; memset(obj, 0, sizeof(xmlXPathObject)); obj->nodesetval = tmpset; @@ -5490,7 +5643,7 @@ obj_cached: free_obj: /* * Cache is full; free the object. - */ + */ if (obj->nodesetval != NULL) xmlXPathFreeNodeSet(obj->nodesetval); #ifdef XP_DEBUG_OBJ_USAGE @@ -5570,7 +5723,10 @@ xmlXPathCastNumberToString (double val) { */ xmlChar * xmlXPathCastNodeToString (xmlNodePtr node) { - return(xmlNodeGetContent(node)); +xmlChar *ret; + if ((ret = xmlNodeGetContent(node)) == NULL) + ret = xmlStrdup((const xmlChar *) ""); + return(ret); } /** @@ -5598,7 +5754,7 @@ xmlXPathCastNodeSetToString (xmlNodeSetPtr ns) { * Converts an existing object to its string() equivalent * * Returns the allocated string value of the object, NULL in case of error. - * It's up to the caller to free the string memory with xmlFree(). + * It's up to the caller to free the string memory with xmlFree(). */ xmlChar * xmlXPathCastToString(xmlXPathObjectPtr val) { @@ -5989,7 +6145,7 @@ xmlXPathNewContext(xmlDocPtr doc) { } #endif - xmlXPathRegisterAllFunctions(ret); + xmlXPathRegisterAllFunctions(ret); return(ret); } @@ -6020,7 +6176,7 @@ xmlXPathFreeContext(xmlXPathContextPtr ctxt) { ************************************************************************/ #define CHECK_CTXT(ctxt) \ - if (ctxt == NULL) { \ + if (ctxt == NULL) { \ __xmlRaiseError(NULL, NULL, NULL, \ NULL, NULL, XML_FROM_XPATH, \ XML_ERR_INTERNAL_ERROR, XML_ERR_FATAL, \ @@ -6031,7 +6187,7 @@ xmlXPathFreeContext(xmlXPathContextPtr ctxt) { } \ #define CHECK_CTXT_NEG(ctxt) \ - if (ctxt == NULL) { \ + if (ctxt == NULL) { \ __xmlRaiseError(NULL, NULL, NULL, \ NULL, NULL, XML_FROM_XPATH, \ XML_ERR_INTERNAL_ERROR, XML_ERR_FATAL, \ @@ -6044,7 +6200,7 @@ xmlXPathFreeContext(xmlXPathContextPtr ctxt) { #define CHECK_CONTEXT(ctxt) \ if ((ctxt == NULL) || (ctxt->doc == NULL) || \ - (ctxt->doc->children == NULL)) { \ + (ctxt->doc->children == NULL)) { \ xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_INVALID_CTXT); \ return(NULL); \ } @@ -6107,7 +6263,7 @@ xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) { memset(ret, 0 , (size_t) sizeof(xmlXPathParserContext)); /* Allocate the value stack */ - ret->valueTab = (xmlXPathObjectPtr *) + ret->valueTab = (xmlXPathObjectPtr *) xmlMalloc(10 * sizeof(xmlXPathObjectPtr)); if (ret->valueTab == NULL) { xmlFree(ret); @@ -6117,6 +6273,7 @@ xmlXPathCompParserContext(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt) { ret->valueNr = 0; ret->valueMax = 10; ret->value = NULL; + ret->valueFrame = 0; ret->context = ctxt; ret->comp = comp; @@ -6254,7 +6411,7 @@ xmlXPathNodeValHash(xmlNodePtr node) { tmp = tmp->next; continue; } - + do { tmp = tmp->parent; if (tmp == NULL) @@ -6413,7 +6570,7 @@ xmlXPathCompareNodeSetString(xmlXPathParserContextPtr ctxt, int inf, int strict, * If both objects to be compared are node-sets, then the comparison * will be true if and only if there is a node in the first node-set * and a node in the second node-set such that the result of performing - * the comparison on the string-values of the two nodes is true. + * the comparison on the string-values of the two nodes is true. * .... * When neither object to be compared is a node-set and the operator * is <=, <, >= or >, then the objects are compared by converting both @@ -6427,7 +6584,7 @@ xmlXPathCompareNodeSetString(xmlXPathParserContextPtr ctxt, int inf, int strict, * represented by the string; any other string is converted to NaN * * Conclusion all nodes need to be converted first to their string value - * and then the comparison must be done when possible + * and then the comparison must be done when possible */ static int xmlXPathCompareNodeSets(int inf, int strict, @@ -6482,7 +6639,7 @@ xmlXPathCompareNodeSets(int inf, int strict, } if (xmlXPathIsNaN(values2[j])) continue; - if (inf && strict) + if (inf && strict) ret = (val1 < values2[j]); else if (inf && !strict) ret = (val1 <= values2[j]); @@ -6822,7 +6979,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, case XPATH_STRING: if ((arg2->stringval == NULL) || (arg2->stringval[0] == 0)) ret = 0; - else + else ret = 1; ret = (arg1->boolval == ret); break; @@ -6857,7 +7014,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, case XPATH_NUMBER: /* Hand check NaN and Infinity equalities */ if (xmlXPathIsNaN(arg1->floatval) || - xmlXPathIsNaN(arg2->floatval)) { + xmlXPathIsNaN(arg2->floatval)) { ret = 0; } else if (xmlXPathIsInf(arg1->floatval) == 1) { if (xmlXPathIsInf(arg2->floatval) == 1) @@ -6905,7 +7062,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, case XPATH_BOOLEAN: if ((arg1->stringval == NULL) || (arg1->stringval[0] == 0)) ret = 0; - else + else ret = 1; ret = (arg2->boolval == ret); break; @@ -6918,7 +7075,7 @@ xmlXPathEqualValuesCommon(xmlXPathParserContextPtr ctxt, arg1 = valuePop(ctxt); /* Hand check NaN and Infinity equalities */ if (xmlXPathIsNaN(arg1->floatval) || - xmlXPathIsNaN(arg2->floatval)) { + xmlXPathIsNaN(arg2->floatval)) { ret = 0; } else if (xmlXPathIsInf(arg1->floatval) == 1) { if (xmlXPathIsInf(arg2->floatval) == 1) @@ -6984,7 +7141,7 @@ xmlXPathEqualValues(xmlXPathParserContextPtr ctxt) { int ret = 0; if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); - arg2 = valuePop(ctxt); + arg2 = valuePop(ctxt); arg1 = valuePop(ctxt); if ((arg1 == NULL) || (arg2 == NULL)) { if (arg1 != NULL) @@ -7030,7 +7187,7 @@ xmlXPathEqualValues(xmlXPathParserContextPtr ctxt) { case XPATH_BOOLEAN: if ((arg1->nodesetval == NULL) || (arg1->nodesetval->nodeNr == 0)) ret = 0; - else + else ret = 1; ret = (ret == arg2->boolval); break; @@ -7069,7 +7226,7 @@ xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) { int ret = 0; if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); - arg2 = valuePop(ctxt); + arg2 = valuePop(ctxt); arg1 = valuePop(ctxt); if ((arg1 == NULL) || (arg2 == NULL)) { if (arg1 != NULL) @@ -7115,7 +7272,7 @@ xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) { case XPATH_BOOLEAN: if ((arg1->nodesetval == NULL) || (arg1->nodesetval->nodeNr == 0)) ret = 0; - else + else ret = 1; ret = (ret != arg2->boolval); break; @@ -7146,7 +7303,7 @@ xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) { * @inf: less than (1) or greater than (0) * @strict: is the comparison strict * - * Implement the compare operation on XPath objects: + * Implement the compare operation on XPath objects: * @arg1 < @arg2 (1, 1, ... * @arg1 <= @arg2 (1, 0, ... * @arg1 > @arg2 (0, 1, ... @@ -7170,7 +7327,7 @@ xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict) { xmlXPathObjectPtr arg1, arg2; if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); - arg2 = valuePop(ctxt); + arg2 = valuePop(ctxt); arg1 = valuePop(ctxt); if ((arg1 == NULL) || (arg2 == NULL)) { if (arg1 != NULL) @@ -7411,7 +7568,7 @@ xmlXPathDivValues(xmlXPathParserContextPtr ctxt) { ctxt->value->floatval = xmlXPathPINF; else if (ctxt->value->floatval < 0) ctxt->value->floatval = xmlXPathNINF; - } else + } else ctxt->value->floatval /= val; } @@ -7619,6 +7776,7 @@ xmlXPathNextChildElement(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { return(NULL); } +#if 0 /** * xmlXPathNextDescendantOrSelfElemParent: * @ctxt: the XPath Parser context @@ -7646,10 +7804,10 @@ xmlXPathNextDescendantOrSelfElemParent(xmlNodePtr cur, #ifdef LIBXML_DOCB_ENABLED case XML_DOCB_DOCUMENT_NODE: #endif - case XML_HTML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: return(contextNode); default: - return(NULL); + return(NULL); } return(NULL); } else { @@ -7660,7 +7818,7 @@ xmlXPathNextDescendantOrSelfElemParent(xmlNodePtr cur, case XML_ELEMENT_NODE: /* TODO: OK to have XInclude here? */ case XML_XINCLUDE_START: - case XML_DOCUMENT_FRAG_NODE: + case XML_DOCUMENT_FRAG_NODE: if (cur != start) return(cur); if (cur->children != NULL) { @@ -7668,9 +7826,9 @@ xmlXPathNextDescendantOrSelfElemParent(xmlNodePtr cur, continue; } break; -#ifdef LIBXML_DOCB_ENABLED /* Not sure if we need those here. */ case XML_DOCUMENT_NODE: +#ifdef LIBXML_DOCB_ENABLED case XML_DOCB_DOCUMENT_NODE: #endif case XML_HTML_DOCUMENT_NODE: @@ -7679,13 +7837,13 @@ xmlXPathNextDescendantOrSelfElemParent(xmlNodePtr cur, return(xmlDocGetRootElement((xmlDocPtr) cur)); default: break; - } - + } + next_sibling: if ((cur == NULL) || (cur == contextNode)) - return(NULL); + return(NULL); if (cur->next != NULL) { - cur = cur->next; + cur = cur->next; } else { cur = cur->parent; goto next_sibling; @@ -7693,7 +7851,8 @@ next_sibling: } } return(NULL); -} +} +#endif /** * xmlXPathNextDescendant: @@ -7721,11 +7880,13 @@ xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { return(ctxt->context->node->children); } + if (cur->type == XML_NAMESPACE_DECL) + return(NULL); if (cur->children != NULL) { /* * Do not descend on entities declarations */ - if (cur->children->type != XML_ENTITY_DECL) { + if (cur->children->type != XML_ENTITY_DECL) { cur = cur->children; /* * Skip DTDs @@ -7743,7 +7904,7 @@ xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { (cur->type != XML_DTD_NODE)) return(cur); } - + do { cur = cur->parent; if (cur == NULL) break; @@ -7772,14 +7933,14 @@ xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); - if (cur == NULL) { - if (ctxt->context->node == NULL) - return(NULL); - if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) || - (ctxt->context->node->type == XML_NAMESPACE_DECL)) - return(NULL); + if (cur == NULL) return(ctxt->context->node); - } + + if (ctxt->context->node == NULL) + return(NULL); + if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) || + (ctxt->context->node->type == XML_NAMESPACE_DECL)) + return(NULL); return(xmlXPathNextDescendant(ctxt, cur)); } @@ -7842,7 +8003,7 @@ xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { return(NULL); case XML_NAMESPACE_DECL: { xmlNsPtr ns = (xmlNsPtr) ctxt->context->node; - + if ((ns->next != NULL) && (ns->next->type != XML_NAMESPACE_DECL)) return((xmlNodePtr) ns->next); @@ -7915,7 +8076,7 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { return(NULL); case XML_NAMESPACE_DECL: { xmlNsPtr ns = (xmlNsPtr) ctxt->context->node; - + if ((ns->next != NULL) && (ns->next->type != XML_NAMESPACE_DECL)) return((xmlNodePtr) ns->next); @@ -7959,7 +8120,7 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { } case XML_NAMESPACE_DECL: { xmlNsPtr ns = (xmlNsPtr) ctxt->context->node; - + if ((ns->next != NULL) && (ns->next->type != XML_NAMESPACE_DECL)) return((xmlNodePtr) ns->next); @@ -8069,9 +8230,17 @@ xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); - if (cur != NULL && cur->children != NULL) - return cur->children ; - if (cur == NULL) cur = ctxt->context->node; + if ((cur != NULL) && (cur->type != XML_ATTRIBUTE_NODE) && + (cur->type != XML_NAMESPACE_DECL) && (cur->children != NULL)) + 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->next != NULL) return(cur->next) ; do { @@ -8095,6 +8264,10 @@ xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { static int xmlXPathIsAncestor(xmlNodePtr ancestor, xmlNodePtr node) { if ((ancestor == NULL) || (node == NULL)) return(0); + if (node->type == XML_NAMESPACE_DECL) + return(0); + if (ancestor->type == XML_NAMESPACE_DECL) + return(0); /* nodes need to be in the same document */ if (ancestor->doc != node->doc) return(0); /* avoid searching if ancestor or node is the root node */ @@ -8125,9 +8298,14 @@ xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); - if (cur == NULL) + if (cur == NULL) { cur = ctxt->context->node; - if (cur == NULL) + if (cur->type == XML_NAMESPACE_DECL) + return(NULL); + if (cur->type == XML_ATTRIBUTE_NODE) + return(cur->parent); + } + if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL)) return (NULL); if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE)) cur = cur->prev; @@ -8156,7 +8334,7 @@ xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) * node that are before the context node in document order, excluding any * ancestors and excluding attribute nodes and namespace nodes; the nodes are * ordered in reverse document order - * This is a faster implementation but internal only since it requires a + * This is a faster implementation but internal only since it requires a * state kept in the parser context: ctxt->ancestor. * * Returns the next element following that axis @@ -8170,10 +8348,12 @@ xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt, cur = ctxt->context->node; if (cur == NULL) return (NULL); - if (cur->type == XML_NAMESPACE_DECL) - cur = (xmlNodePtr)((xmlNsPtr)cur)->next; + if (cur->type == XML_NAMESPACE_DECL) + return (NULL); ctxt->ancestor = cur->parent; } + if (cur->type == XML_NAMESPACE_DECL) + return(NULL); if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE)) cur = cur->prev; while (cur->prev == NULL) { @@ -8213,7 +8393,7 @@ xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { if (ctxt->context->tmpNsList == NULL && cur != (xmlNodePtr) xmlXPathXMLNamespace) { if (ctxt->context->tmpNsList != NULL) xmlFree(ctxt->context->tmpNsList); - ctxt->context->tmpNsList = + ctxt->context->tmpNsList = xmlGetNsList(ctxt->context->doc, ctxt->context->node); ctxt->context->tmpNsNr = 0; if (ctxt->context->tmpNsList != NULL) { @@ -8361,7 +8541,7 @@ xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur; CHECK_ARITY(1); - if ((ctxt->value == NULL) || + if ((ctxt->value == NULL) || ((ctxt->value->type != XPATH_NODESET) && (ctxt->value->type != XPATH_XSLT_TREE))) XP_ERROR(XPATH_INVALID_TYPE); @@ -8381,7 +8561,7 @@ xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) { int i = 0; tmp = cur->nodesetval->nodeTab[0]; - if (tmp != NULL) { + if ((tmp != NULL) && (tmp->type != XML_NAMESPACE_DECL)) { tmp = tmp->children; while (tmp != NULL) { tmp = tmp->next; @@ -8414,6 +8594,8 @@ xmlXPathGetElementsByIds (xmlDocPtr doc, const xmlChar *ids) { if (ids == NULL) return(NULL); ret = xmlXPathNodeSetCreate(NULL); + if (ret == NULL) + return(ret); while (IS_BLANK_CH(*cur)) cur++; while (*cur != 0) { @@ -8481,6 +8663,11 @@ xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs) { int i; ret = xmlXPathNodeSetCreate(NULL); + /* + * FIXME -- in an out-of-memory condition this will behave badly. + * The solution is not clear -- we already popped an item from + * ctxt, so the object is in a corrupt state. + */ if (obj->nodesetval != NULL) { for (i = 0; i < obj->nodesetval->nodeNr; i++) { @@ -8499,7 +8686,7 @@ xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs) { } obj = xmlXPathCacheConvertString(ctxt->context, obj); ret = xmlXPathGetElementsByIds(ctxt->context->doc, obj->stringval); - valuePush(ctxt, xmlXPathCacheWrapNodeSet(ctxt->context, ret)); + valuePush(ctxt, xmlXPathCacheWrapNodeSet(ctxt->context, ret)); xmlXPathReleaseObject(ctxt->context, obj); return; } @@ -8530,7 +8717,7 @@ xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs) { } CHECK_ARITY(1); - if ((ctxt->value == NULL) || + if ((ctxt->value == NULL) || ((ctxt->value->type != XPATH_NODESET) && (ctxt->value->type != XPATH_XSLT_TREE))) XP_ERROR(XPATH_INVALID_TYPE); @@ -8588,7 +8775,7 @@ xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs) { nargs = 1; } CHECK_ARITY(1); - if ((ctxt->value == NULL) || + if ((ctxt->value == NULL) || ((ctxt->value->type != XPATH_NODESET) && (ctxt->value->type != XPATH_XSLT_TREE))) XP_ERROR(XPATH_INVALID_TYPE); @@ -8672,7 +8859,7 @@ xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs) cur->nodesetval->nodeTab[i]->name)); } else { xmlChar *fullname; - + fullname = xmlBuildQName(cur->nodesetval->nodeTab[i]->name, cur->nodesetval->nodeTab[i]->ns->prefix, NULL, 0); @@ -8707,11 +8894,11 @@ xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs) * the node in the node-set that is first in document order. * If the node-set is empty, an empty string is returned. * - A number is converted to a string as follows - * + NaN is converted to the string NaN - * + positive zero is converted to the string 0 - * + negative zero is converted to the string 0 - * + positive infinity is converted to the string Infinity - * + negative infinity is converted to the string -Infinity + * + NaN is converted to the string NaN + * + positive zero is converted to the string 0 + * + negative zero is converted to the string 0 + * + positive infinity is converted to the string Infinity + * + negative infinity is converted to the string -Infinity * + if the number is an integer, the number is represented in * decimal form as a Number with no decimal point and no leading * zeros, preceded by a minus sign (-) if the number is negative @@ -8785,7 +8972,7 @@ xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs) { CHECK_TYPE(XPATH_STRING); cur = valuePop(ctxt); valuePush(ctxt, xmlXPathCacheNewFloat(ctxt->context, - xmlUTF8Strlen(cur->stringval))); + xmlUTF8Strlen(cur->stringval))); xmlXPathReleaseObject(ctxt->context, cur); } @@ -8924,12 +9111,12 @@ xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs) { * or equal to the second argument and, if the third argument is specified, * less than the sum of the second and third arguments; the comparisons * and addition used for the above follow the standard IEEE 754 rules. Thus: - * - substring("12345", 1.5, 2.6) returns "234" - * - substring("12345", 0, 3) returns "12" - * - substring("12345", 0 div 0, 3) returns "" - * - substring("12345", 1, 0 div 0) returns "" - * - substring("12345", -42, 1 div 0) returns "12345" - * - substring("12345", -1 div 0, 1 div 0) returns "" + * - substring("12345", 1.5, 2.6) returns "234" + * - substring("12345", 0, 3) returns "12" + * - substring("12345", 0 div 0, 3) returns "" + * - substring("12345", 1, 0 div 0) returns "" + * - substring("12345", -42, 1 div 0) returns "12345" + * - substring("12345", -1 div 0, 1 div 0) returns "" */ void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs) { @@ -8970,18 +9157,18 @@ xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs) { */ if (nargs != 3) { le = (double)m; - if (in < 1.0) + if (in < 1.0) in = 1.0; } - /* Need to check for the special cases where either + /* Need to check for the special cases where either * the index is NaN, the length is NaN, or both * arguments are infinity (relying on Inf + -Inf = NaN) */ - if (!xmlXPathIsNaN(in + le) && !xmlXPathIsInf(in)) { + if (!xmlXPathIsInf(in) && !xmlXPathIsNaN(in + le)) { /* * To meet the requirements of the spec, the arguments - * must be converted to integer format before + * must be converted to integer format before * initial index calculations are done * * First we go to integer form, rounding up @@ -9044,26 +9231,26 @@ void xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr str; xmlXPathObjectPtr find; - xmlBufferPtr target; + xmlBufPtr target; const xmlChar *point; int offset; - + CHECK_ARITY(2); CAST_TO_STRING; find = valuePop(ctxt); CAST_TO_STRING; str = valuePop(ctxt); - - target = xmlBufferCreate(); + + target = xmlBufCreate(); if (target) { point = xmlStrstr(str->stringval, find->stringval); if (point) { offset = (int)(point - str->stringval); - xmlBufferAdd(target, str->stringval, offset); + xmlBufAdd(target, str->stringval, offset); } valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, - xmlBufferContent(target))); - xmlBufferFree(target); + xmlBufContent(target))); + xmlBufFree(target); } xmlXPathReleaseObject(ctxt->context, str); xmlXPathReleaseObject(ctxt->context, find); @@ -9087,27 +9274,27 @@ void xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr str; xmlXPathObjectPtr find; - xmlBufferPtr target; + xmlBufPtr target; const xmlChar *point; int offset; - + CHECK_ARITY(2); CAST_TO_STRING; find = valuePop(ctxt); CAST_TO_STRING; str = valuePop(ctxt); - - target = xmlBufferCreate(); + + target = xmlBufCreate(); if (target) { point = xmlStrstr(str->stringval, find->stringval); if (point) { offset = (int)(point - str->stringval) + xmlStrlen(find->stringval); - xmlBufferAdd(target, &str->stringval[offset], + xmlBufAdd(target, &str->stringval[offset], xmlStrlen(str->stringval) - offset); } valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, - xmlBufferContent(target))); - xmlBufferFree(target); + xmlBufContent(target))); + xmlBufFree(target); } xmlXPathReleaseObject(ctxt->context, str); xmlXPathReleaseObject(ctxt->context, find); @@ -9131,9 +9318,9 @@ void xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr obj = NULL; xmlChar *source = NULL; - xmlBufferPtr target; + xmlBufPtr target; xmlChar blank; - + if (ctxt == NULL) return; if (nargs == 0) { /* Use current context node */ @@ -9149,13 +9336,13 @@ xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs) { obj = valuePop(ctxt); source = obj->stringval; - target = xmlBufferCreate(); + target = xmlBufCreate(); if (target && source) { - + /* Skip leading whitespaces */ while (IS_BLANK_CH(*source)) source++; - + /* Collapse intermediate whitespaces, and skip trailing whitespaces */ blank = 0; while (*source) { @@ -9163,16 +9350,16 @@ xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs) { blank = 0x20; } else { if (blank) { - xmlBufferAdd(target, &blank, 1); + xmlBufAdd(target, &blank, 1); blank = 0; } - xmlBufferAdd(target, source, 1); + xmlBufAdd(target, source, 1); } source++; } valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, - xmlBufferContent(target))); - xmlBufferFree(target); + xmlBufContent(target))); + xmlBufFree(target); } xmlXPathReleaseObject(ctxt->context, obj); } @@ -9203,7 +9390,7 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr str; xmlXPathObjectPtr from; xmlXPathObjectPtr to; - xmlBufferPtr target; + xmlBufPtr target; int offset, max; xmlChar ch; const xmlChar *point; @@ -9218,7 +9405,7 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) { CAST_TO_STRING; str = valuePop(ctxt); - target = xmlBufferCreate(); + target = xmlBufCreate(); if (target) { max = xmlUTF8Strlen(to->stringval); for (cptr = str->stringval; (ch=*cptr); ) { @@ -9227,10 +9414,10 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) { if (offset < max) { point = xmlUTF8Strpos(to->stringval, offset); if (point) - xmlBufferAdd(target, point, xmlUTF8Strsize(point, 1)); + xmlBufAdd(target, point, xmlUTF8Strsize(point, 1)); } } else - xmlBufferAdd(target, cptr, xmlUTF8Strsize(cptr, 1)); + xmlBufAdd(target, cptr, xmlUTF8Strsize(cptr, 1)); /* Step to next character in input */ cptr++; @@ -9239,6 +9426,7 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) { if ( (ch & 0xc0) != 0xc0 ) { xmlGenericError(xmlGenericErrorContext, "xmlXPathTranslateFunction: Invalid UTF8 string\n"); + /* not asserting an XPath error is probably better */ break; } /* then skip over remaining bytes for this char */ @@ -9246,6 +9434,7 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) { if ( (*cptr++ & 0xc0) != 0x80 ) { xmlGenericError(xmlGenericErrorContext, "xmlXPathTranslateFunction: Invalid UTF8 string\n"); + /* not asserting an XPath error is probably better */ break; } if (ch & 0x80) /* must have had error encountered */ @@ -9254,8 +9443,8 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) { } } valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, - xmlBufferContent(target))); - xmlBufferFree(target); + xmlBufContent(target))); + xmlBufFree(target); xmlXPathReleaseObject(ctxt->context, str); xmlXPathReleaseObject(ctxt->context, from); xmlXPathReleaseObject(ctxt->context, to); @@ -9430,7 +9619,7 @@ xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs) { double res = 0.0; CHECK_ARITY(1); - if ((ctxt->value == NULL) || + if ((ctxt->value == NULL) || ((ctxt->value->type != XPATH_NODESET) && (ctxt->value->type != XPATH_XSLT_TREE))) XP_ERROR(XPATH_INVALID_TYPE); @@ -9549,14 +9738,14 @@ xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs) { if (ctxt->value->floatval < 0) { if (ctxt->value->floatval < f - 0.5) ctxt->value->floatval = f - 1; - else + else ctxt->value->floatval = f; if (ctxt->value->floatval == 0) ctxt->value->floatval = xmlXPathNZERO; } else { if (ctxt->value->floatval < f + 0.5) ctxt->value->floatval = f; - else + else ctxt->value->floatval = f + 1; } } @@ -9607,7 +9796,7 @@ xmlXPathCurrentChar(xmlXPathParserContextPtr ctxt, int *len) { * UCS-4 range (hex.) UTF-8 octet sequence (binary) * 0000 0000-0000 007F 0xxxxxxx * 0000 0080-0000 07FF 110xxxxx 10xxxxxx - * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx + * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx * * Check for the 0x110000 limit too */ @@ -9644,7 +9833,7 @@ xmlXPathCurrentChar(xmlXPathParserContextPtr ctxt, int *len) { } if (!IS_CHAR(val)) { XP_ERROR0(XPATH_INVALID_CHAR_ERROR); - } + } return(val); } else { /* 1-byte code */ @@ -9716,7 +9905,7 @@ xmlXPathParseNCName(xmlXPathParserContextPtr ctxt) { /** * xmlXPathParseQName: * @ctxt: the XPath Parser context - * @prefix: a xmlChar ** + * @prefix: a xmlChar ** * * parse an XML qualified name * @@ -9736,7 +9925,7 @@ xmlXPathParseQName(xmlXPathParserContextPtr ctxt, xmlChar **prefix) { *prefix = NULL; ret = xmlXPathParseNCName(ctxt); - if (CUR == ':') { + if (ret && CUR == ':') { *prefix = ret; NEXT; ret = xmlXPathParseNCName(ctxt); @@ -9762,7 +9951,7 @@ xmlChar * xmlXPathParseName(xmlXPathParserContextPtr ctxt) { const xmlChar *in; xmlChar *ret; - int count = 0; + size_t count = 0; if ((ctxt == NULL) || (ctxt->cur == NULL)) return(NULL); /* @@ -9781,6 +9970,10 @@ xmlXPathParseName(xmlXPathParserContextPtr ctxt) { in++; if ((*in > 0) && (*in < 0x80)) { count = in - ctxt->cur; + if (count > XML_MAX_NAME_LENGTH) { + ctxt->cur = in; + XP_ERRORNULL(XPATH_EXPR_ERROR); + } ret = xmlStrndup(ctxt->cur, count); ctxt->cur = in; return(ret); @@ -9810,7 +10003,7 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) { while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ ((IS_LETTER(c)) || (IS_DIGIT(c)) || (c == '.') || (c == '-') || - (c == '_') || ((qualified) && (c == ':')) || + (c == '_') || ((qualified) && (c == ':')) || (IS_COMBINING(c)) || (IS_EXTENDER(c)))) { COPY_BUF(l,buf,len,c); @@ -9823,7 +10016,10 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) { */ xmlChar *buffer; int max = len * 2; - + + if (len > XML_MAX_NAME_LENGTH) { + XP_ERRORNULL(XPATH_EXPR_ERROR); + } buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); if (buffer == NULL) { XP_ERRORNULL(XPATH_MEMORY_ERROR); @@ -9831,10 +10027,13 @@ xmlXPathParseNameComplex(xmlXPathParserContextPtr ctxt, int qualified) { memcpy(buffer, buf, len); while ((IS_LETTER(c)) || (IS_DIGIT(c)) || /* test bigname.xml */ (c == '.') || (c == '-') || - (c == '_') || ((qualified) && (c == ':')) || + (c == '_') || ((qualified) && (c == ':')) || (IS_COMBINING(c)) || (IS_EXTENDER(c))) { if (len + 10 > max) { + if (max > XML_MAX_NAME_LENGTH) { + XP_ERRORNULL(XPATH_EXPR_ERROR); + } max *= 2; buffer = (xmlChar *) xmlRealloc(buffer, max * sizeof(xmlChar)); @@ -9878,7 +10077,7 @@ static double my_pow10[MAX_FRAC+1] = { * [30a] Float ::= Number ('e' Digits?)? * * [30] Number ::= Digits ('.' Digits?)? - * | '.' Digits + * | '.' Digits * [31] Digits ::= [0-9]+ * * Compile a Number in the string @@ -9977,7 +10176,7 @@ xmlXPathStringEvalNumber(const xmlChar *str) { * @ctxt: the XPath Parser context * * [30] Number ::= Digits ('.' Digits?)? - * | '.' Digits + * | '.' Digits * [31] Digits ::= [0-9]+ * * Compile a Number, then push it on the stack @@ -9987,7 +10186,6 @@ static void xmlXPathCompNumber(xmlXPathParserContextPtr ctxt) { double ret = 0.0; - double mult = 1; int ok = 0; int exponent = 0; int is_exponent_negative = 0; @@ -10023,15 +10221,23 @@ xmlXPathCompNumber(xmlXPathParserContextPtr ctxt) } #endif if (CUR == '.') { + int v, frac = 0; + double fraction = 0; + NEXT; if (((CUR < '0') || (CUR > '9')) && (!ok)) { XP_ERROR(XPATH_NUMBER_ERROR); } - while ((CUR >= '0') && (CUR <= '9')) { - mult /= 10; - ret = ret + (CUR - '0') * mult; + while ((CUR >= '0') && (CUR <= '9') && (frac < MAX_FRAC)) { + v = (CUR - '0'); + fraction = fraction * 10 + v; + frac = frac + 1; NEXT; } + fraction /= my_pow10[frac]; + ret = ret + fraction; + while ((CUR >= '0') && (CUR <= '9')) + NEXT; } if ((CUR == 'e') || (CUR == 'E')) { NEXT; @@ -10157,9 +10363,9 @@ xmlXPathCompLiteral(xmlXPathParserContextPtr ctxt) { * * Early evaluation is possible since: * The variable bindings [...] used to evaluate a subexpression are - * always the same as those used to evaluate the containing expression. + * always the same as those used to evaluate the containing expression. * - * [36] VariableReference ::= '$' QName + * [36] VariableReference ::= '$' QName */ static void xmlXPathCompVariableReference(xmlXPathParserContextPtr ctxt) { @@ -10180,7 +10386,7 @@ xmlXPathCompVariableReference(xmlXPathParserContextPtr ctxt) { name, prefix); SKIP_BLANKS; if ((ctxt->context != NULL) && (ctxt->context->flags & XML_XPATH_NOVAR)) { - XP_ERROR(XPATH_UNDEF_VARIABLE_ERROR); + XP_ERROR(XPATH_FORBID_VARIABLE_ERROR); } } @@ -10218,7 +10424,7 @@ xmlXPathIsNodeType(const xmlChar *name) { * @ctxt: the XPath Parser context * * [16] FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument)*)? ')' - * [17] Argument ::= Expr + * [17] Argument ::= Expr * * Compile a function call, the evaluation of all arguments are * pushed on the stack @@ -10232,6 +10438,7 @@ xmlXPathCompFunctionCall(xmlXPathParserContextPtr ctxt) { name = xmlXPathParseQName(ctxt, &prefix); if (name == NULL) { + xmlFree(prefix); XP_ERROR(XPATH_EXPR_ERROR); } SKIP_BLANKS; @@ -10264,7 +10471,11 @@ xmlXPathCompFunctionCall(xmlXPathParserContextPtr ctxt) { int op1 = ctxt->comp->last; ctxt->comp->last = -1; xmlXPathCompileExpr(ctxt, sort); - CHECK_ERROR; + if (ctxt->error != XPATH_EXPRESSION_OK) { + xmlFree(name); + xmlFree(prefix); + return; + } PUSH_BINARY_EXPR(XPATH_OP_ARG, op1, ctxt->comp->last, 0, 0); nbargs++; if (CUR == ')') break; @@ -10285,11 +10496,11 @@ xmlXPathCompFunctionCall(xmlXPathParserContextPtr ctxt) { * xmlXPathCompPrimaryExpr: * @ctxt: the XPath Parser context * - * [15] PrimaryExpr ::= VariableReference + * [15] PrimaryExpr ::= VariableReference * | '(' Expr ')' - * | Literal - * | Number - * | FunctionCall + * | Literal + * | Number + * | FunctionCall * * Compile a primary expression. */ @@ -10321,8 +10532,8 @@ xmlXPathCompPrimaryExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompFilterExpr: * @ctxt: the XPath Parser context * - * [20] FilterExpr ::= PrimaryExpr - * | FilterExpr Predicate + * [20] FilterExpr ::= PrimaryExpr + * | FilterExpr Predicate * * Compile a filter expression. * Square brackets are used to filter expressions in the same way that @@ -10337,13 +10548,13 @@ xmlXPathCompFilterExpr(xmlXPathParserContextPtr ctxt) { xmlXPathCompPrimaryExpr(ctxt); CHECK_ERROR; SKIP_BLANKS; - + while (CUR == '[') { xmlXPathCompPredicate(ctxt, 1); SKIP_BLANKS; } - + } /** @@ -10382,7 +10593,7 @@ xmlXPathScanName(xmlXPathParserContextPtr ctxt) { while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ ((IS_LETTER(c)) || (IS_DIGIT(c)) || (c == '.') || (c == '-') || - (c == '_') || (c == ':') || + (c == '_') || (c == ':') || (IS_COMBINING(c)) || (IS_EXTENDER(c)))) { len += l; @@ -10398,10 +10609,10 @@ xmlXPathScanName(xmlXPathParserContextPtr ctxt) { * xmlXPathCompPathExpr: * @ctxt: the XPath Parser context * - * [19] PathExpr ::= LocationPath - * | FilterExpr - * | FilterExpr '/' RelativeLocationPath - * | FilterExpr '//' RelativeLocationPath + * [19] PathExpr ::= LocationPath + * | FilterExpr + * | FilterExpr '/' RelativeLocationPath + * | FilterExpr '//' RelativeLocationPath * * Compile a path expression. * The / operator and // operators combine an arbitrary expression @@ -10418,8 +10629,8 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { xmlChar *name = NULL; /* we may have to preparse a name to find out */ SKIP_BLANKS; - if ((CUR == '$') || (CUR == '(') || - (IS_ASCII_DIGIT(CUR)) || + if ((CUR == '$') || (CUR == '(') || + (IS_ASCII_DIGIT(CUR)) || (CUR == '\'') || (CUR == '"') || (CUR == '.' && IS_ASCII_DIGIT(NXT(1)))) { lc = 0; @@ -10459,7 +10670,7 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { } else if (name != NULL) { int len =xmlStrlen(name); - + while (NXT(len) != 0) { if (NXT(len) == '/') { /* element name */ @@ -10526,7 +10737,7 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { /* make sure all cases are covered explicitly */ XP_ERROR(XPATH_EXPR_ERROR); } - } + } if (lc) { if (CUR == '/') { @@ -10558,8 +10769,8 @@ xmlXPathCompPathExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompUnionExpr: * @ctxt: the XPath Parser context * - * [18] UnionExpr ::= PathExpr - * | UnionExpr '|' PathExpr + * [18] UnionExpr ::= PathExpr + * | UnionExpr '|' PathExpr * * Compile an union expression. */ @@ -10587,8 +10798,8 @@ xmlXPathCompUnionExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompUnaryExpr: * @ctxt: the XPath Parser context * - * [27] UnaryExpr ::= UnionExpr - * | '-' UnaryExpr + * [27] UnaryExpr ::= UnionExpr + * | '-' UnaryExpr * * Compile an unary expression. */ @@ -10620,10 +10831,10 @@ xmlXPathCompUnaryExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompMultiplicativeExpr: * @ctxt: the XPath Parser context * - * [26] MultiplicativeExpr ::= UnaryExpr - * | MultiplicativeExpr MultiplyOperator UnaryExpr - * | MultiplicativeExpr 'div' UnaryExpr - * | MultiplicativeExpr 'mod' UnaryExpr + * [26] MultiplicativeExpr ::= UnaryExpr + * | MultiplicativeExpr MultiplyOperator UnaryExpr + * | MultiplicativeExpr 'div' UnaryExpr + * | MultiplicativeExpr 'mod' UnaryExpr * [34] MultiplyOperator ::= '*' * * Compile an Additive expression. @@ -10634,7 +10845,7 @@ xmlXPathCompMultiplicativeExpr(xmlXPathParserContextPtr ctxt) { xmlXPathCompUnaryExpr(ctxt); CHECK_ERROR; SKIP_BLANKS; - while ((CUR == '*') || + while ((CUR == '*') || ((CUR == 'd') && (NXT(1) == 'i') && (NXT(2) == 'v')) || ((CUR == 'm') && (NXT(1) == 'o') && (NXT(2) == 'd'))) { int op = -1; @@ -10662,9 +10873,9 @@ xmlXPathCompMultiplicativeExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompAdditiveExpr: * @ctxt: the XPath Parser context * - * [25] AdditiveExpr ::= MultiplicativeExpr - * | AdditiveExpr '+' MultiplicativeExpr - * | AdditiveExpr '-' MultiplicativeExpr + * [25] AdditiveExpr ::= MultiplicativeExpr + * | AdditiveExpr '+' MultiplicativeExpr + * | AdditiveExpr '-' MultiplicativeExpr * * Compile an Additive expression. */ @@ -10694,11 +10905,11 @@ xmlXPathCompAdditiveExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompRelationalExpr: * @ctxt: the XPath Parser context * - * [24] RelationalExpr ::= AdditiveExpr - * | RelationalExpr '<' AdditiveExpr - * | RelationalExpr '>' AdditiveExpr - * | RelationalExpr '<=' AdditiveExpr - * | RelationalExpr '>=' AdditiveExpr + * [24] RelationalExpr ::= AdditiveExpr + * | RelationalExpr '<' AdditiveExpr + * | RelationalExpr '>' AdditiveExpr + * | RelationalExpr '<=' AdditiveExpr + * | RelationalExpr '>=' AdditiveExpr * * A <= B > C is allowed ? Answer from James, yes with * (AdditiveExpr <= AdditiveExpr) > AdditiveExpr @@ -10738,9 +10949,9 @@ xmlXPathCompRelationalExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompEqualityExpr: * @ctxt: the XPath Parser context * - * [23] EqualityExpr ::= RelationalExpr - * | EqualityExpr '=' RelationalExpr - * | EqualityExpr '!=' RelationalExpr + * [23] EqualityExpr ::= RelationalExpr + * | EqualityExpr '=' RelationalExpr + * | EqualityExpr '!=' RelationalExpr * * A != B != C is allowed ? Answer from James, yes with * (RelationalExpr = RelationalExpr) = RelationalExpr @@ -10775,8 +10986,8 @@ xmlXPathCompEqualityExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompAndExpr: * @ctxt: the XPath Parser context * - * [22] AndExpr ::= EqualityExpr - * | AndExpr 'and' EqualityExpr + * [22] AndExpr ::= EqualityExpr + * | AndExpr 'and' EqualityExpr * * Compile an AND expression. * @@ -10801,9 +11012,9 @@ xmlXPathCompAndExpr(xmlXPathParserContextPtr ctxt) { * xmlXPathCompileExpr: * @ctxt: the XPath Parser context * - * [14] Expr ::= OrExpr - * [21] OrExpr ::= AndExpr - * | OrExpr 'or' AndExpr + * [14] Expr ::= OrExpr + * [21] OrExpr ::= AndExpr + * | OrExpr 'or' AndExpr * * Parse and compile an expression */ @@ -10819,7 +11030,6 @@ xmlXPathCompileExpr(xmlXPathParserContextPtr ctxt, int sort) { xmlXPathCompAndExpr(ctxt); CHECK_ERROR; PUSH_BINARY_EXPR(XPATH_OP_OR, op1, ctxt->comp->last, 0, 0); - op1 = ctxt->comp->nbStep; SKIP_BLANKS; } if ((sort) && (ctxt->comp->steps[ctxt->comp->last].op != XPATH_OP_VALUE)) { @@ -10839,7 +11049,7 @@ xmlXPathCompileExpr(xmlXPathParserContextPtr ctxt, int sort) { * @filter: act as a filter * * [8] Predicate ::= '[' PredicateExpr ']' - * [9] PredicateExpr ::= Expr + * [9] PredicateExpr ::= Expr * * Compile a predicate expression */ @@ -10956,7 +11166,7 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test, } *test = NODE_TEST_TYPE; - + SKIP_BLANKS; if (*type == NODE_TYPE_PI) { /* @@ -11092,7 +11302,7 @@ xmlXPathIsAxisName(const xmlChar *name) { * @ctxt: the XPath Parser context * * [4] Step ::= AxisSpecifier NodeTest Predicate* - * | AbbreviatedStep + * | AbbreviatedStep * * [12] AbbreviatedStep ::= '.' | '..' * @@ -11201,7 +11411,10 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) { } } - CHECK_ERROR; + if (ctxt->error != XPATH_EXPRESSION_OK) { + xmlFree(name); + return; + } name = xmlXPathCompNodeTest(ctxt, &test, &type, &prefix, name); if (test == 0) @@ -11264,10 +11477,10 @@ eval_predicates: * xmlXPathCompRelativeLocationPath: * @ctxt: the XPath Parser context * - * [3] RelativeLocationPath ::= Step - * | RelativeLocationPath '/' Step - * | AbbreviatedRelativeLocationPath - * [11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step + * [3] RelativeLocationPath ::= Step + * | RelativeLocationPath '/' Step + * | AbbreviatedRelativeLocationPath + * [11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step * * Compile a relative location path. */ @@ -11285,6 +11498,7 @@ xmlXPathCompRelativeLocationPath SKIP_BLANKS; } xmlXPathCompStep(ctxt); + CHECK_ERROR; SKIP_BLANKS; while (CUR == '/') { if ((CUR == '/') && (NXT(1) == '/')) { @@ -11306,12 +11520,12 @@ xmlXPathCompRelativeLocationPath * xmlXPathCompLocationPath: * @ctxt: the XPath Parser context * - * [1] LocationPath ::= RelativeLocationPath - * | AbsoluteLocationPath + * [1] LocationPath ::= RelativeLocationPath + * | AbsoluteLocationPath * [2] AbsoluteLocationPath ::= '/' RelativeLocationPath? - * | AbbreviatedAbsoluteLocationPath - * [10] AbbreviatedAbsoluteLocationPath ::= - * '//' RelativeLocationPath + * | AbbreviatedAbsoluteLocationPath + * [10] AbbreviatedAbsoluteLocationPath ::= + * '//' RelativeLocationPath * * Compile a location path * @@ -11344,13 +11558,14 @@ xmlXPathCompLocationPath(xmlXPathParserContextPtr ctxt) { (CUR == '@') || (CUR == '*'))) xmlXPathCompRelativeLocationPath(ctxt); } + CHECK_ERROR; } } } /************************************************************************ * * - * XPath precompiled expression evaluation * + * XPath precompiled expression evaluation * * * ************************************************************************/ @@ -11359,12 +11574,11 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op); #ifdef DEBUG_STEP static void -xmlXPathDebugDumpStepAxis(xmlXPathAxisVal axis, - xmlXPathTestVal test, +xmlXPathDebugDumpStepAxis(xmlXPathStepOpPtr op, int nbNodes) { xmlGenericError(xmlGenericErrorContext, "new step : "); - switch (axis) { + switch (op->value) { case AXIS_ANCESTOR: xmlGenericError(xmlGenericErrorContext, "axis 'ancestors' "); break; @@ -11411,14 +11625,14 @@ xmlXPathDebugDumpStepAxis(xmlXPathAxisVal axis, } xmlGenericError(xmlGenericErrorContext, " context contains %d nodes\n", nbNodes); - switch (test) { + switch (op->value2) { case NODE_TEST_NONE: xmlGenericError(xmlGenericErrorContext, " searching for none !!!\n"); break; case NODE_TEST_TYPE: xmlGenericError(xmlGenericErrorContext, - " searching for type %d\n", type); + " searching for type %d\n", op->value3); break; case NODE_TEST_PI: xmlGenericError(xmlGenericErrorContext, @@ -11431,14 +11645,14 @@ xmlXPathDebugDumpStepAxis(xmlXPathAxisVal axis, case NODE_TEST_NS: xmlGenericError(xmlGenericErrorContext, " searching for namespace %s\n", - prefix); + op->value5); break; case NODE_TEST_NAME: xmlGenericError(xmlGenericErrorContext, - " searching for name %s\n", name); - if (prefix != NULL) + " searching for name %s\n", op->value5); + if (op->value4) xmlGenericError(xmlGenericErrorContext, - " with namespace %s\n", prefix); + " with namespace %s\n", op->value4); break; } xmlGenericError(xmlGenericErrorContext, "Testing : "); @@ -11467,7 +11681,7 @@ xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, CHECK_ERROR0; if (contextSize <= 0) return(0); - } + } if (op->ch2 != -1) { xmlXPathContextPtr xpctxt = ctxt->context; xmlNodePtr contextNode, oldContextNode; @@ -11511,7 +11725,7 @@ xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, /* * Get the expression of this predicate. */ - exprOp = &ctxt->comp->steps[op->ch2]; + exprOp = &ctxt->comp->steps[op->ch2]; newContextSize = 0; for (i = 0; i < set->nodeNr; i++) { if (set->nodeTab[i] == NULL) @@ -11521,8 +11735,8 @@ xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, xpctxt->node = contextNode; xpctxt->contextSize = contextSize; xpctxt->proximityPosition = ++contextPos; - - /* + + /* * Also set the xpath document in case things like * key() are evaluated in the predicate. */ @@ -11536,16 +11750,23 @@ xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, */ if (contextObj == NULL) contextObj = xmlXPathCacheNewNodeSet(xpctxt, contextNode); - else - xmlXPathNodeSetAddUnique(contextObj->nodesetval, - contextNode); + else { + if (xmlXPathNodeSetAddUnique(contextObj->nodesetval, + contextNode) < 0) { + ctxt->error = XPATH_MEMORY_ERROR; + goto evaluation_exit; + } + } valuePush(ctxt, contextObj); res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); - if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) - goto evaluation_error; + if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { + xmlXPathNodeSetClear(set, hasNsNodes); + newContextSize = 0; + goto evaluation_exit; + } if (res != 0) { newContextSize++; @@ -11573,18 +11794,13 @@ xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, contextObj = NULL; } } - goto evaluation_exit; - -evaluation_error: - xmlXPathNodeSetClear(set, hasNsNodes); - newContextSize = 0; -evaluation_exit: if (contextObj != NULL) { if (ctxt->value == contextObj) valuePop(ctxt); xmlXPathReleaseObject(xpctxt, contextObj); - } + } +evaluation_exit: if (exprRes != NULL) xmlXPathReleaseObject(ctxt->context, exprRes); /* @@ -11641,6 +11857,7 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr contextObj = NULL, exprRes = NULL; xmlNodePtr oldContextNode, contextNode = NULL; xmlXPathContextPtr xpctxt = ctxt->context; + int frame; #ifdef LIBXML_XPTR_ENABLED /* @@ -11660,6 +11877,8 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, */ exprOp = &ctxt->comp->steps[op->ch2]; for (i = 0; i < set->nodeNr; i++) { + xmlXPathObjectPtr tmp; + if (set->nodeTab[i] == NULL) continue; @@ -11667,7 +11886,7 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, xpctxt->node = contextNode; xpctxt->contextSize = contextSize; xpctxt->proximityPosition = ++contextPos; - + /* * Initialize the new set. * Also set the xpath document in case things like @@ -11683,15 +11902,33 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, */ if (contextObj == NULL) contextObj = xmlXPathCacheNewNodeSet(xpctxt, contextNode); - else - xmlXPathNodeSetAddUnique(contextObj->nodesetval, - contextNode); + else { + if (xmlXPathNodeSetAddUnique(contextObj->nodesetval, + contextNode) < 0) { + ctxt->error = XPATH_MEMORY_ERROR; + goto evaluation_exit; + } + } + frame = xmlXPathSetFrame(ctxt); valuePush(ctxt, contextObj); res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); - - if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) + tmp = valuePop(ctxt); + xmlXPathPopFrame(ctxt, frame); + + if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { + while (tmp != contextObj) { + /* + * Free up the result + * then pop off contextObj, which will be freed later + */ + xmlXPathReleaseObject(xpctxt, tmp); + tmp = valuePop(ctxt); + } goto evaluation_error; + } + /* push the result back onto the stack */ + valuePush(ctxt, tmp); if (res) pos++; @@ -11714,9 +11951,9 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt, } xmlXPathNodeSetClear(set, hasNsNodes); set->nodeNr = 1; - set->nodeTab[0] = contextNode; + set->nodeTab[0] = contextNode; goto evaluation_exit; - } + } if (pos == maxPos) { /* * We are done. @@ -11780,7 +12017,7 @@ evaluation_exit: static int xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt, - xmlXPathStepOpPtr op, + xmlXPathStepOpPtr op, int *maxPos) { @@ -11789,7 +12026,7 @@ xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt, /* * BIG NOTE: This is not intended for XPATH_OP_FILTER yet! */ - + /* * If not -1, then ch1 will point to: * 1) For predicates (XPATH_OP_PREDICATE): @@ -11798,13 +12035,13 @@ xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt, * - an inner filter operater OR * - an expression selecting the node set. * E.g. "key('a', 'b')" or "(//foo | //bar)". - */ + */ if ((op->op != XPATH_OP_PREDICATE) && (op->op != XPATH_OP_FILTER)) return(0); if (op->ch2 != -1) { exprOp = &ctxt->comp->steps[op->ch2]; - } else + } else return(0); if ((exprOp != NULL) && @@ -11823,10 +12060,10 @@ xmlXPathIsPositionalPredicate(xmlXPathParserContextPtr ctxt, * Maybe we could rewrite the AST to ease the optimization. */ *maxPos = (int) ((xmlXPathObjectPtr) exprOp->value4)->floatval; - + if (((xmlXPathObjectPtr) exprOp->value4)->floatval == (float) *maxPos) - { + { return(1); } } @@ -11843,22 +12080,25 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, #define XP_TEST_HIT \ if (hasAxisRange != 0) { \ if (++pos == maxPos) { \ - addNode(seq, cur); \ - goto axis_range_end; } \ + if (addNode(seq, cur) < 0) \ + ctxt->error = XPATH_MEMORY_ERROR; \ + goto axis_range_end; } \ } else { \ - addNode(seq, cur); \ + if (addNode(seq, cur) < 0) \ + ctxt->error = XPATH_MEMORY_ERROR; \ if (breakOnFirstHit) goto first_hit; } #define XP_TEST_HIT_NS \ if (hasAxisRange != 0) { \ if (++pos == maxPos) { \ hasNsNodes = 1; \ - xmlXPathNodeSetAddNs(seq, xpctxt->node, (xmlNsPtr) cur); \ + if (xmlXPathNodeSetAddNs(seq, xpctxt->node, (xmlNsPtr) cur) < 0) \ + ctxt->error = XPATH_MEMORY_ERROR; \ goto axis_range_end; } \ } else { \ hasNsNodes = 1; \ - xmlXPathNodeSetAddNs(seq, \ - xpctxt->node, (xmlNsPtr) cur); \ + if (xmlXPathNodeSetAddNs(seq, xpctxt->node, (xmlNsPtr) cur) < 0) \ + ctxt->error = XPATH_MEMORY_ERROR; \ if (breakOnFirstHit) goto first_hit; } xmlXPathAxisVal axis = (xmlXPathAxisVal) op->value; @@ -11878,8 +12118,6 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, xmlNodeSetPtr contextSeq; int contextIdx; xmlNodePtr contextNode; - /* The context node for a compound traversal */ - xmlNodePtr outerContextNode; /* The final resulting node set wrt to all context nodes */ xmlNodeSetPtr outSeq; /* @@ -11887,7 +12125,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, * Used to feed predicate evaluation. */ xmlNodeSetPtr seq; - xmlNodePtr cur; + xmlNodePtr cur; /* First predicate operator */ xmlXPathStepOpPtr predOp; int maxPos; /* The requested position() (when a "[n]" predicate) */ @@ -11895,11 +12133,9 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, int breakOnFirstHit; xmlXPathTraversalFunction next = NULL; - /* compound axis traversal */ - xmlXPathTraversalFunctionExt outerNext = NULL; - void (*addNode) (xmlNodeSetPtr, xmlNodePtr); + int (*addNode) (xmlNodeSetPtr, xmlNodePtr); xmlXPathNodeSetMergeFunction mergeAndClear; - xmlNodePtr oldContextNode; + xmlNodePtr oldContextNode; xmlXPathContextPtr xpctxt = ctxt->context; @@ -11914,7 +12150,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, xmlXPathReleaseObject(xpctxt, obj); XP_ERROR0(XPATH_UNDEF_PREFIX_ERROR); } - } + } /* * Setup axis. * @@ -11928,7 +12164,6 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, * avoid a duplicate-aware merge, if the axis to be traversed is e.g. * the descendant-or-self axis. */ - addNode = xmlXPathNodeSetAdd; mergeAndClear = xmlXPathNodeSetMergeAndClear; switch (axis) { case AXIS_ANCESTOR: @@ -11947,13 +12182,6 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, break; case AXIS_CHILD: last = NULL; - if (op->rewriteType == XP_REWRITE_DOS_CHILD_ELEM) { - /* - * This iterator will give us only nodes which can - * hold element nodes. - */ - outerNext = xmlXPathNextDescendantOrSelfElemParent; - } if (((test == NODE_TEST_NAME) || (test == NODE_TEST_ALL)) && (type == NODE_TYPE_NODE)) { @@ -12008,20 +12236,20 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, } #ifdef DEBUG_STEP - xmlXPathDebugDumpStepAxis(axis, test, - (obj->nodesetval != NULL) ? obj->nodsetval->nodeNr : 0); + xmlXPathDebugDumpStepAxis(op, + (obj->nodesetval != NULL) ? obj->nodesetval->nodeNr : 0); #endif if (next == NULL) { - xmlXPathReleaseObject(xpctxt, obj); + xmlXPathReleaseObject(xpctxt, obj); return(0); - } + } contextSeq = obj->nodesetval; if ((contextSeq == NULL) || (contextSeq->nodeNr <= 0)) { xmlXPathReleaseObject(xpctxt, obj); valuePush(ctxt, xmlXPathCacheWrapNodeSet(xpctxt, NULL)); return(0); - } + } /* * Predicate optimization --------------------------------------------- * If this step has a last predicate, which contains a position(), @@ -12029,7 +12257,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, * the short-hand form, i.e., "[n]". * * Example - expression "/foo[parent::bar][1]": - * + * * COLLECT 'child' 'name' 'node' foo -- op (we are here) * ROOT -- op->ch1 * PREDICATE -- op->ch2 (predOp) @@ -12062,7 +12290,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, */ predOp = NULL; hasAxisRange = 1; - } + } } } breakOnFirstHit = ((toBool) && (predOp == NULL)) ? 1 : 0; @@ -12071,7 +12299,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, */ /* * 2.3 Node Tests - * - For the attribute axis, the principal node type is attribute. + * - For the attribute axis, the principal node type is attribute. * - For the namespace axis, the principal node type is namespace. * - For other axes, the principal node type is element. * @@ -12083,33 +12311,14 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, addNode = xmlXPathNodeSetAddUnique; outSeq = NULL; seq = NULL; - outerContextNode = NULL; contextNode = NULL; contextIdx = 0; - while ((contextIdx < contextSeq->nodeNr) || (contextNode != NULL)) { - if (outerNext != NULL) { - /* - * This is a compound traversal. - */ - if (contextNode == NULL) { - /* - * Set the context for the outer traversal. - */ - outerContextNode = contextSeq->nodeTab[contextIdx++]; - contextNode = outerNext(NULL, outerContextNode); - } else - contextNode = outerNext(contextNode, outerContextNode); - if (contextNode == NULL) - continue; - /* - * Set the context for the main traversal. - */ - xpctxt->node = contextNode; - } else - xpctxt->node = contextSeq->nodeTab[contextIdx++]; - + while (((contextIdx < contextSeq->nodeNr) || (contextNode != NULL)) && + (ctxt->error == XPATH_EXPRESSION_OK)) { + xpctxt->node = contextSeq->nodeTab[contextIdx++]; + if (seq == NULL) { seq = xmlXPathNodeSetCreate(NULL); if (seq == NULL) { @@ -12163,6 +12372,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, #ifdef DEBUG_STEP xmlGenericError(xmlGenericErrorContext, " %s", cur->name); #endif + switch (test) { case NODE_TEST_NONE: total = 0; @@ -12181,7 +12391,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, #ifdef LIBXML_DOCB_ENABLED case XML_DOCB_DOCUMENT_NODE: #endif - case XML_ELEMENT_NODE: + case XML_ELEMENT_NODE: case XML_ATTRIBUTE_NODE: case XML_PI_NODE: case XML_COMMENT_NODE: @@ -12194,7 +12404,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, break; } } else if (cur->type == type) { - if (type == XML_NAMESPACE_DECL) + if (cur->type == XML_NAMESPACE_DECL) XP_TEST_HIT_NS else XP_TEST_HIT @@ -12215,7 +12425,14 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, if (axis == AXIS_ATTRIBUTE) { if (cur->type == XML_ATTRIBUTE_NODE) { - XP_TEST_HIT + if (prefix == NULL) + { + XP_TEST_HIT + } else if ((cur->ns != NULL) && + (xmlStrEqual(URI, cur->ns->href))) + { + XP_TEST_HIT + } } } else if (axis == AXIS_NAMESPACE) { if (cur->type == XML_NAMESPACE_DECL) @@ -12241,6 +12458,16 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, break; } case NODE_TEST_NAME: + if (axis == AXIS_ATTRIBUTE) { + if (cur->type != XML_ATTRIBUTE_NODE) + break; + } else if (axis == AXIS_NAMESPACE) { + if (cur->type != XML_NAMESPACE_DECL) + break; + } else { + if (cur->type != XML_ELEMENT_NODE) + break; + } switch (cur->type) { case XML_ELEMENT_NODE: if (xmlStrEqual(name, cur->name)) { @@ -12295,11 +12522,11 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, } break; } /* switch(test) */ - } while (cur != NULL); + } while ((cur != NULL) && (ctxt->error == XPATH_EXPRESSION_OK)); goto apply_predicates; -axis_range_end: /* ----------------------------------------------------- */ +axis_range_end: /* ----------------------------------------------------- */ /* * We have a "/foo[n]", and position() = n was reached. * Note that we can have as well "/foo/::parent::foo[1]", so @@ -12336,13 +12563,16 @@ first_hit: /* ---------------------------------------------------------- */ #endif apply_predicates: /* --------------------------------------------------- */ + if (ctxt->error != XPATH_EXPRESSION_OK) + goto error; + /* * Apply predicates. - */ + */ if ((predOp != NULL) && (seq->nodeNr > 0)) { /* * E.g. when we have a "/foo[some expression][n]". - */ + */ /* * QUESTION TODO: The old predicate evaluation took into * account location-sets. @@ -12351,7 +12581,7 @@ apply_predicates: /* --------------------------------------------------- */ * All what I learned now from the evaluation semantics * does not indicate that a location-set will be processed * here, so this looks OK. - */ + */ /* * Iterate over all predicates, starting with the outermost * predicate. @@ -12367,7 +12597,7 @@ apply_predicates: /* --------------------------------------------------- */ * * For the moment, I'll try to solve this with a recursive * function: xmlXPathCompOpEvalPredicate(). - */ + */ size = seq->nodeNr; if (hasPredicateRange != 0) newSize = xmlXPathCompOpEvalPositionalPredicate(ctxt, @@ -12422,7 +12652,7 @@ apply_predicates: /* --------------------------------------------------- */ } else { outSeq = mergeAndClear(outSeq, seq, 0); } - } + } } error: @@ -12447,10 +12677,11 @@ error: outSeq = seq; else outSeq = xmlXPathNodeSetCreate(NULL); + /* XXX what if xmlXPathNodeSetCreate returned NULL here? */ } if ((seq != NULL) && (seq != outSeq)) { xmlXPathFreeNodeSet(seq); - } + } /* * Hand over the result. Better to push the set also in * case of errors. @@ -12590,7 +12821,7 @@ xmlXPathCompOpEvalFirst(xmlXPathParserContextPtr ctxt, return (total); #ifdef XP_OPTIMIZED_FILTER_FIRST case XPATH_OP_FILTER: - total =+ xmlXPathCompOpEvalFilterFirst(ctxt, op, first); + total += xmlXPathCompOpEvalFilterFirst(ctxt, op, first); return (total); #endif default: @@ -12734,9 +12965,9 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op, xmlNodePtr * first) { int total = 0; - xmlXPathCompExprPtr comp; + xmlXPathCompExprPtr comp; xmlXPathObjectPtr res; - xmlXPathObjectPtr obj; + xmlXPathObjectPtr obj; xmlNodeSetPtr oldset; xmlNodePtr oldnode; xmlDocPtr oldDoc; @@ -12751,7 +12982,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, (comp->steps[op->ch1].op == XPATH_OP_SORT) && (comp->steps[op->ch2].op == XPATH_OP_SORT)) { int f = comp->steps[op->ch2].ch1; - + if ((f != -1) && (comp->steps[f].op == XPATH_OP_FUNCTION) && (comp->steps[f].value5 == NULL) && @@ -12760,7 +12991,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, (xmlStrEqual (comp->steps[f].value4, BAD_CAST "last"))) { xmlNodePtr last = NULL; - + total += xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch1], @@ -12787,7 +13018,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, return (total); } } - + if (op->ch1 != -1) total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); CHECK_ERROR0; @@ -12795,7 +13026,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, return (total); if (ctxt->value == NULL) return (total); - + #ifdef LIBXML_XPTR_ENABLED oldnode = ctxt->context->node; /* @@ -12805,7 +13036,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr tmp = NULL; xmlLocationSetPtr newlocset = NULL; xmlLocationSetPtr oldlocset; - + /* * Extract the old locset, and then evaluate the result of the * expression for all the element in the locset. use it to grow @@ -12815,7 +13046,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, obj = valuePop(ctxt); oldlocset = obj->user; ctxt->context->node = NULL; - + if ((oldlocset == NULL) || (oldlocset->locNr == 0)) { ctxt->context->contextSize = 0; ctxt->context->proximityPosition = 0; @@ -12830,7 +13061,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, return (total); } newlocset = xmlXPtrLocationSetCreate(NULL); - + for (i = 0; i < oldlocset->locNr; i++) { /* * Run the evaluation with a node list made of a @@ -12843,9 +13074,11 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, tmp = xmlXPathCacheNewNodeSet(ctxt->context, ctxt->context->node); } else { - xmlXPathNodeSetAddUnique(tmp->nodesetval, - ctxt->context->node); - } + if (xmlXPathNodeSetAddUnique(tmp->nodesetval, + ctxt->context->node) < 0) { + ctxt->error = XPATH_MEMORY_ERROR; + } + } valuePush(ctxt, tmp); if (op->ch2 != -1) total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); @@ -12871,14 +13104,14 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, } if (ctxt->value == tmp) { valuePop(ctxt); - xmlXPathNodeSetClear(tmp->nodesetval, 1); + xmlXPathNodeSetClear(tmp->nodesetval, 1); /* * REVISIT TODO: Don't create a temporary nodeset * for everly iteration. */ /* OLD: xmlXPathFreeObject(res); */ } else - tmp = NULL; + tmp = NULL; ctxt->context->node = NULL; /* * Only put the first node in the result, then leave. @@ -12903,7 +13136,7 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, return (total); } #endif /* LIBXML_XPTR_ENABLED */ - + /* * Extract the old set, and then evaluate the result of the * expression for all the element in the set. use it to grow @@ -12912,11 +13145,11 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, CHECK_TYPE0(XPATH_NODESET); obj = valuePop(ctxt); oldset = obj->nodesetval; - + oldnode = ctxt->context->node; oldDoc = ctxt->context->doc; ctxt->context->node = NULL; - + if ((oldset == NULL) || (oldset->nodeNr == 0)) { ctxt->context->contextSize = 0; ctxt->context->proximityPosition = 0; @@ -12940,9 +13173,10 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, * Initialize the new set. * Also set the xpath document in case things like * key() evaluation are attempted on the predicate - */ + */ newset = xmlXPathNodeSetCreate(NULL); - + /* XXX what if xmlXPathNodeSetCreate returned NULL? */ + for (i = 0; i < oldset->nodeNr; i++) { /* * Run the evaluation with a node list made of @@ -12956,8 +13190,10 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, tmp = xmlXPathCacheNewNodeSet(ctxt->context, ctxt->context->node); } else { - xmlXPathNodeSetAddUnique(tmp->nodesetval, - ctxt->context->node); + if (xmlXPathNodeSetAddUnique(tmp->nodesetval, + ctxt->context->node) < 0) { + ctxt->error = XPATH_MEMORY_ERROR; + } } valuePush(ctxt, tmp); ctxt->context->contextSize = oldset->nodeNr; @@ -12968,15 +13204,16 @@ xmlXPathCompOpEvalFilterFirst(xmlXPathParserContextPtr ctxt, xmlXPathFreeNodeSet(newset); xmlXPathFreeObject(obj); return(0); - } + } /* * The result of the evaluation needs to be tested to * decide whether the filter succeeded or not */ res = valuePop(ctxt); if (xmlXPathEvaluatePredicateResult(ctxt, res)) { - xmlXPathNodeSetAdd(newset, oldset->nodeTab[i]); - } + if (xmlXPathNodeSetAdd(newset, oldset->nodeTab[i]) < 0) + ctxt->error = XPATH_MEMORY_ERROR; + } /* * Cleanup */ @@ -13112,7 +13349,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); CHECK_ERROR0; if (op->value) - equal = xmlXPathEqualValues(ctxt); + equal = xmlXPathEqualValues(ctxt); else equal = xmlXPathNotEqualValues(ctxt); valuePush(ctxt, xmlXPathCacheNewBoolean(ctxt->context, equal)); @@ -13265,8 +13502,9 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) URI = xmlXPathNsLookup(ctxt->context, op->value5); if (URI == NULL) { xmlGenericError(xmlGenericErrorContext, - "xmlXPathCompOpEval: variable %s bound to undefined prefix %s\n", - op->value4, op->value5); + "xmlXPathCompOpEval: variable %s bound to undefined prefix %s\n", + (char *) op->value4, (char *)op->value5); + ctxt->error = XPATH_UNDEF_PREFIX_ERROR; return (total); } val = xmlXPathVariableLookupNS(ctxt->context, @@ -13283,23 +13521,33 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) xmlXPathFunction func; const xmlChar *oldFunc, *oldFuncURI; int i; + int frame; - if (op->ch1 != -1) + frame = xmlXPathSetFrame(ctxt); + if (op->ch1 != -1) { total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); - if (ctxt->valueNr < op->value) { + if (ctxt->error != XPATH_EXPRESSION_OK) { + xmlXPathPopFrame(ctxt, frame); + return (total); + } + } + if (ctxt->valueNr < ctxt->valueFrame + op->value) { xmlGenericError(xmlGenericErrorContext, "xmlXPathCompOpEval: parameter error\n"); ctxt->error = XPATH_INVALID_OPERAND; + xmlXPathPopFrame(ctxt, frame); return (total); } - for (i = 0; i < op->value; i++) + for (i = 0; i < op->value; i++) { if (ctxt->valueTab[(ctxt->valueNr - 1) - i] == NULL) { xmlGenericError(xmlGenericErrorContext, "xmlXPathCompOpEval: parameter error\n"); ctxt->error = XPATH_INVALID_OPERAND; + xmlXPathPopFrame(ctxt, frame); return (total); } + } if (op->cache != NULL) XML_CAST_FPTR(func) = op->cache; else { @@ -13313,8 +13561,10 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) URI = xmlXPathNsLookup(ctxt->context, op->value5); if (URI == NULL) { xmlGenericError(xmlGenericErrorContext, - "xmlXPathCompOpEval: function %s bound to undefined prefix %s\n", - op->value4, op->value5); + "xmlXPathCompOpEval: function %s bound to undefined prefix %s\n", + (char *)op->value4, (char *)op->value5); + xmlXPathPopFrame(ctxt, frame); + ctxt->error = XPATH_UNDEF_PREFIX_ERROR; return (total); } func = xmlXPathFunctionLookupNS(ctxt->context, @@ -13322,8 +13572,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) } if (func == NULL) { xmlGenericError(xmlGenericErrorContext, - "xmlXPathCompOpEval: function %s not found\n", - op->value4); + "xmlXPathCompOpEval: function %s not found\n", + (char *)op->value4); XP_ERROR0(XPATH_UNKNOWN_FUNC_ERROR); } op->cache = XML_CAST_FPTR(func); @@ -13336,6 +13586,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) func(ctxt, op->value); ctxt->context->function = oldFunc; ctxt->context->functionURI = oldFuncURI; + xmlXPathPopFrame(ctxt, frame); return (total); } case XPATH_OP_ARG: @@ -13343,17 +13594,20 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) bak = ctxt->context->node; pp = ctxt->context->proximityPosition; cs = ctxt->context->contextSize; - if (op->ch1 != -1) + if (op->ch1 != -1) { total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); - ctxt->context->contextSize = cs; - ctxt->context->proximityPosition = pp; - ctxt->context->node = bak; - ctxt->context->doc = bakd; - CHECK_ERROR0; + ctxt->context->contextSize = cs; + ctxt->context->proximityPosition = pp; + ctxt->context->node = bak; + ctxt->context->doc = bakd; + CHECK_ERROR0; + } if (op->ch2 != -1) { total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); - ctxt->context->doc = bakd; - ctxt->context->node = bak; + ctxt->context->contextSize = cs; + ctxt->context->proximityPosition = pp; + ctxt->context->node = bak; + ctxt->context->doc = bakd; CHECK_ERROR0; } return (total); @@ -13521,7 +13775,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) tmp = xmlXPathCacheNewNodeSet(ctxt->context, ctxt->context->node); valuePush(ctxt, tmp); - + if (op->ch2 != -1) total += xmlXPathCompOpEval(ctxt, @@ -13630,7 +13884,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) * nC 2 * * removed the first node in the node-set, then - * the context position of the + * the context position of the */ for (i = 0; i < oldset->nodeNr; i++) { /* @@ -13645,8 +13899,10 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) tmp = xmlXPathCacheNewNodeSet(ctxt->context, ctxt->context->node); } else { - xmlXPathNodeSetAddUnique(tmp->nodesetval, - ctxt->context->node); + if (xmlXPathNodeSetAddUnique(tmp->nodesetval, + ctxt->context->node) < 0) { + ctxt->error = XPATH_MEMORY_ERROR; + } } valuePush(ctxt, tmp); ctxt->context->contextSize = oldset->nodeNr; @@ -13676,7 +13932,9 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) */ res = valuePop(ctxt); if (xmlXPathEvaluatePredicateResult(ctxt, res)) { - xmlXPathNodeSetAdd(newset, oldset->nodeTab[i]); + if (xmlXPathNodeSetAdd(newset, oldset->nodeTab[i]) + < 0) + ctxt->error = XPATH_MEMORY_ERROR; } /* @@ -13687,7 +13945,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) } if (ctxt->value == tmp) { valuePop(ctxt); - xmlXPathNodeSetClear(tmp->nodesetval, 1); + xmlXPathNodeSetClear(tmp->nodesetval, 1); /* * Don't free the temporary nodeset * in order to avoid massive recreation inside this @@ -13790,7 +14048,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) res = valuePop(ctxt); if (res->type == XPATH_LOCATIONSET) { - xmlLocationSetPtr rloc = + xmlLocationSetPtr rloc = (xmlLocationSetPtr)res->user; for (j=0; jlocNr; j++) { range = xmlXPtrNewRange( @@ -13892,6 +14150,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) } xmlGenericError(xmlGenericErrorContext, "XPath: unknown precompiled operation %d\n", op->op); + ctxt->error = XPATH_INVALID_OPERAND; return (total); } @@ -13952,7 +14211,7 @@ start: xmlXPathCompOpEval(ctxt, op); if (ctxt->error != XPATH_EXPRESSION_OK) return(-1); - + resObj = valuePop(ctxt); if (resObj == NULL) return(-1); @@ -13973,7 +14232,7 @@ start: * to true if the number is equal to the context position * and will be converted to false otherwise;" */ - res = xmlXPathEvaluatePredicateResult(ctxt, resObj); + res = xmlXPathEvaluatePredicateResult(ctxt, resObj); } else { res = xmlXPathCastToBoolean(resObj); } @@ -13996,13 +14255,13 @@ xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp, xmlXPathObjectPtr *resultSeq, int toBool) { int max_depth, min_depth; - int from_root; + int from_root; int ret, depth; int eval_all_nodes; xmlNodePtr cur = NULL, limit = NULL; xmlStreamCtxtPtr patstream = NULL; - - int nb_nodes = 0; + + int nb_nodes = 0; if ((ctxt == NULL) || (comp == NULL)) return(-1); @@ -14028,7 +14287,7 @@ xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp, if (*resultSeq == NULL) return(-1); } - + /* * handle the special cases of "/" amd "." being matched */ @@ -14038,7 +14297,7 @@ xmlXPathRunStreamEval(xmlXPathContextPtr ctxt, xmlPatternPtr comp, if (toBool) return(1); xmlXPathNodeSetAddUnique((*resultSeq)->nodesetval, - (xmlNodePtr) ctxt->doc); + (xmlNodePtr) ctxt->doc); } else { /* Select "self::node()" */ if (toBool) @@ -14125,13 +14384,17 @@ next_node: ret = xmlStreamPushNode(patstream, NULL, NULL, cur->type); else break; - + if (ret < 0) { /* NOP. */ } else if (ret == 1) { if (toBool) goto return_1; - xmlXPathNodeSetAddUnique((*resultSeq)->nodesetval, cur); + if (xmlXPathNodeSetAddUnique((*resultSeq)->nodesetval, cur) + < 0) { + ctxt->lastError.domain = XML_FROM_XPATH; + ctxt->lastError.code = XML_ERR_NO_MEMORY; + } } if ((cur->children == NULL) || (depth >= max_depth)) { ret = xmlStreamPop(patstream); @@ -14147,9 +14410,10 @@ next_node: } scan_children: + if (cur->type == XML_NAMESPACE_DECL) break; if ((cur->children != NULL) && (depth < max_depth)) { /* - * Do not descend on entities declarations + * Do not descend on entities declarations */ if (cur->children->type != XML_ENTITY_DECL) { cur = cur->children; @@ -14171,7 +14435,7 @@ scan_children: (cur->type != XML_DTD_NODE)) goto next_node; } - + do { cur = cur->parent; depth--; @@ -14230,7 +14494,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) if (ctxt->valueTab == NULL) { /* Allocate the value stack */ - ctxt->valueTab = (xmlXPathObjectPtr *) + ctxt->valueTab = (xmlXPathObjectPtr *) xmlMalloc(10 * sizeof(xmlXPathObjectPtr)); if (ctxt->valueTab == NULL) { xmlXPathPErrMemory(ctxt, "creating evaluation context\n"); @@ -14239,6 +14503,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) ctxt->valueNr = 0; ctxt->valueMax = 10; ctxt->value = NULL; + ctxt->valueFrame = 0; } #ifdef XPATH_STREAMING if (ctxt->comp->stream) { @@ -14253,7 +14518,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) if (res != -1) return(res); } else { - xmlXPathObjectPtr resObj = NULL; + xmlXPathObjectPtr resObj = NULL; /* * Evaluation to a sequence. @@ -14266,7 +14531,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) return(0); } if (resObj != NULL) - xmlXPathReleaseObject(ctxt->context, resObj); + xmlXPathReleaseObject(ctxt->context, resObj); } /* * QUESTION TODO: This falls back to normal XPath evaluation @@ -14291,7 +14556,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) /************************************************************************ * * - * Public interfaces * + * Public interfaces * * * ************************************************************************/ @@ -14307,7 +14572,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt, int toBool) * context node in the context node list (as returned by the position * function) and will be converted to false otherwise; if the result * is not a number, then the result will be converted as if by a call - * to the boolean function. + * to the boolean function. * * Returns 1 if predicate is true, 0 otherwise */ @@ -14345,12 +14610,12 @@ xmlXPathEvalPredicate(xmlXPathContextPtr ctxt, xmlXPathObjectPtr res) { * context node in the context node list (as returned by the position * function) and will be converted to false otherwise; if the result * is not a number, then the result will be converted as if by a call - * to the boolean function. + * to the boolean function. * * Returns 1 if predicate is true, 0 otherwise */ int -xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt, +xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr res) { if ((ctxt == NULL) || (res == NULL)) return(0); switch (res->type) { @@ -14423,7 +14688,7 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { tmp = xmlStrchr(str, ':'); if ((tmp != NULL) && ((ctxt == NULL) || (ctxt->nsNr == 0) || (tmp[1] == ':'))) - return(NULL); + return(NULL); if (ctxt != NULL) { dict = ctxt->dict; @@ -14439,7 +14704,7 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { namespaces[i++] = ns->prefix; } namespaces[i++] = NULL; - namespaces[i++] = NULL; + namespaces[i] = NULL; } } @@ -14447,7 +14712,7 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { &namespaces[0]); if (namespaces != NULL) { xmlFree((xmlChar **)namespaces); - } + } if ((stream != NULL) && (xmlPatternStreamable(stream) == 1)) { comp = xmlXPathNewCompExpr(); if (comp == NULL) { @@ -14466,57 +14731,64 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { } #endif /* XPATH_STREAMING */ -static int -xmlXPathCanRewriteDosExpression(xmlChar *expr) -{ - if (expr == NULL) - return(0); - do { - if ((*expr == '/') && (*(++expr) == '/')) - return(1); - } while (*expr++); - return(0); -} static void -xmlXPathRewriteDOSExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op) +xmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op) { /* * Try to rewrite "descendant-or-self::node()/foo" to an optimized * internal representation. */ - if (op->ch1 != -1) { - if ((op->op == XPATH_OP_COLLECT /* 11 */) && - ((xmlXPathAxisVal) op->value == AXIS_CHILD /* 4 */) && - ((xmlXPathTestVal) op->value2 == NODE_TEST_NAME /* 5 */) && - ((xmlXPathTypeVal) op->value3 == NODE_TYPE_NODE /* 0 */)) - { - /* - * This is a "child::foo" - */ - xmlXPathStepOpPtr prevop = &comp->steps[op->ch1]; - - if ((prevop->op == XPATH_OP_COLLECT /* 11 */) && - (prevop->ch1 != -1) && - ((xmlXPathAxisVal) prevop->value == - AXIS_DESCENDANT_OR_SELF) && - (prevop->ch2 == -1) && - ((xmlXPathTestVal) prevop->value2 == NODE_TEST_TYPE) && - ((xmlXPathTypeVal) prevop->value3 == NODE_TYPE_NODE) && - (comp->steps[prevop->ch1].op == XPATH_OP_ROOT)) - { - /* - * This is a "/descendant-or-self::node()" without predicates. - * Eliminate it. - */ - op->ch1 = prevop->ch1; - op->rewriteType = XP_REWRITE_DOS_CHILD_ELEM; - } + + if ((op->op == XPATH_OP_COLLECT /* 11 */) && + (op->ch1 != -1) && + (op->ch2 == -1 /* no predicate */)) + { + xmlXPathStepOpPtr prevop = &comp->steps[op->ch1]; + + if ((prevop->op == XPATH_OP_COLLECT /* 11 */) && + ((xmlXPathAxisVal) prevop->value == + AXIS_DESCENDANT_OR_SELF) && + (prevop->ch2 == -1) && + ((xmlXPathTestVal) prevop->value2 == NODE_TEST_TYPE) && + ((xmlXPathTypeVal) prevop->value3 == NODE_TYPE_NODE)) + { + /* + * This is a "descendant-or-self::node()" without predicates. + * Try to eliminate it. + */ + + switch ((xmlXPathAxisVal) op->value) { + case AXIS_CHILD: + case AXIS_DESCENDANT: + /* + * Convert "descendant-or-self::node()/child::" or + * "descendant-or-self::node()/descendant::" to + * "descendant::" + */ + op->ch1 = prevop->ch1; + op->value = AXIS_DESCENDANT; + break; + case AXIS_SELF: + case AXIS_DESCENDANT_OR_SELF: + /* + * Convert "descendant-or-self::node()/self::" or + * "descendant-or-self::node()/descendant-or-self::" to + * to "descendant-or-self::" + */ + op->ch1 = prevop->ch1; + op->value = AXIS_DESCENDANT_OR_SELF; + break; + default: + break; + } } - if (op->ch1 != -1) - xmlXPathRewriteDOSExpression(comp, &comp->steps[op->ch1]); } + + /* Recurse */ + if (op->ch1 != -1) + xmlXPathOptimizeExpression(comp, &comp->steps[op->ch1]); if (op->ch2 != -1) - xmlXPathRewriteDOSExpression(comp, &comp->steps[op->ch2]); + xmlXPathOptimizeExpression(comp, &comp->steps[op->ch2]); } /** @@ -14543,6 +14815,8 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { xmlXPathInit(); pctxt = xmlXPathNewParserContext(str, ctxt); + if (pctxt == NULL) + return NULL; xmlXPathCompileExpr(pctxt, 1); if( pctxt->error != XPATH_EXPRESSION_OK ) @@ -14552,7 +14826,7 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { } if (*pctxt->cur != 0) { - /* + /* * aleksey: in some cases this line prints *second* error message * (see bug #78858) and probably this should be fixed. * However, we are not sure that all error messages are printed @@ -14571,13 +14845,9 @@ xmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) { #ifdef DEBUG_EVAL_COUNTS comp->string = xmlStrdup(str); comp->nb = 0; -#endif - if ((comp->expr != NULL) && - (comp->nbStep > 2) && - (comp->last >= 0) && - (xmlXPathCanRewriteDosExpression(comp->expr) == 1)) - { - xmlXPathRewriteDOSExpression(comp, &comp->steps[comp->last]); +#endif + if ((comp->nbStep > 1) && (comp->last >= 0)) { + xmlXPathOptimizeExpression(comp, &comp->steps[comp->last]); } } return(comp); @@ -14616,7 +14886,7 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp, xmlXPathObjectPtr *resObj, int toBool) { - xmlXPathParserContextPtr pctxt; + xmlXPathParserContextPtr pctxt; #ifndef LIBXML_THREAD_ENABLED static int reentance = 0; #endif @@ -14645,15 +14915,15 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp, res = xmlXPathRunEval(pctxt, toBool); if (resObj) { - if (pctxt->value == NULL) { + if (pctxt->value == NULL) { xmlGenericError(xmlGenericErrorContext, "xmlXPathCompiledEval: evaluation failed\n"); - *resObj = NULL; + *resObj = NULL; } else { *resObj = valuePop(pctxt); } } - + /* * Pop all remaining objects from the stack. */ @@ -14664,8 +14934,7 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp, do { tmp = valuePop(pctxt); if (tmp != NULL) { - if (tmp != NULL) - stack++; + stack++; xmlXPathReleaseObject(ctxt, tmp); } } while (tmp != NULL); @@ -14677,11 +14946,11 @@ xmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp, stack); } } - + if ((pctxt->error != XPATH_EXPRESSION_OK) && (resObj) && (*resObj)) { xmlXPathFreeObject(*resObj); *resObj = NULL; - } + } pctxt->comp = NULL; xmlXPathFreeParserContext(pctxt); #ifndef LIBXML_THREAD_ENABLED @@ -14742,7 +15011,7 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { #endif if (ctxt == NULL) return; - + #ifdef XPATH_STREAMING comp = xmlXPathTryStreamCompile(ctxt->context, ctxt->base); if (comp != NULL) { @@ -14755,22 +15024,17 @@ xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { #endif { xmlXPathCompileExpr(ctxt, 1); - /* - * In this scenario the expression string will sit in ctxt->base. - */ if ((ctxt->error == XPATH_EXPRESSION_OK) && (ctxt->comp != NULL) && - (ctxt->base != NULL) && - (ctxt->comp->nbStep > 2) && - (ctxt->comp->last >= 0) && - (xmlXPathCanRewriteDosExpression((xmlChar *) ctxt->base) == 1)) + (ctxt->comp->nbStep > 1) && + (ctxt->comp->last >= 0)) { - xmlXPathRewriteDOSExpression(ctxt->comp, + xmlXPathOptimizeExpression(ctxt->comp, &ctxt->comp->steps[ctxt->comp->last]); } } CHECK_ERROR; - xmlXPathRunEval(ctxt, 0); + xmlXPathRunEval(ctxt, 0); } /** @@ -14794,13 +15058,15 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) { xmlXPathInit(); ctxt = xmlXPathNewParserContext(str, ctx); + if (ctxt == NULL) + return NULL; xmlXPathEvalExpr(ctxt); if (ctxt->value == NULL) { xmlGenericError(xmlGenericErrorContext, "xmlXPathEval: evaluation failed\n"); res = NULL; - } else if ((*ctxt->cur != 0) && (ctxt->comp != NULL) + } else if ((*ctxt->cur != 0) && (ctxt->comp != NULL) #ifdef XPATH_STREAMING && (ctxt->comp->stream == NULL) #endif @@ -14833,6 +15099,49 @@ xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) { return(res); } +/** + * xmlXPathSetContextNode: + * @node: the node to to use as the context node + * @ctx: the XPath context + * + * Sets 'node' as the context node. The node must be in the same + * document as that associated with the context. + * + * Returns -1 in case of error or 0 if successful + */ +int +xmlXPathSetContextNode(xmlNodePtr node, xmlXPathContextPtr ctx) { + if ((node == NULL) || (ctx == NULL)) + return(-1); + + if (node->doc == ctx->doc) { + ctx->node = node; + return(0); + } + return(-1); +} + +/** + * xmlXPathNodeEval: + * @node: the node to to use as the context node + * @str: the XPath expression + * @ctx: the XPath context + * + * Evaluate the XPath Location Path in the given context. The node 'node' + * is set as the context node. The context node is not restored. + * + * Returns the xmlXPathObjectPtr resulting from the evaluation or NULL. + * the caller has to free the object. + */ +xmlXPathObjectPtr +xmlXPathNodeEval(xmlNodePtr node, const xmlChar *str, xmlXPathContextPtr ctx) { + if (str == NULL) + return(NULL); + if (xmlXPathSetContextNode(node, ctx) < 0) + return(NULL); + return(xmlXPathEval(str, ctx)); +} + /** * xmlXPathEvalExpression: * @str: the XPath expression @@ -14854,6 +15163,8 @@ xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) { xmlXPathInit(); pctxt = xmlXPathNewParserContext(str, ctxt); + if (pctxt == NULL) + return NULL; xmlXPathEvalExpr(pctxt); if ((*pctxt->cur != 0) || (pctxt->error != XPATH_EXPRESSION_OK)) { @@ -14911,21 +15222,21 @@ xmlXPathEvalExpression(const xmlChar *str, xmlXPathContextPtr ctxt) { * If $escape-reserved is false, the behavior differs in that characters * referred to in [RFC 2396] as reserved characters are not escaped. These * characters are ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ",". - * + * * [RFC 2396] does not define whether escaped URIs should use lower case or * upper case for hexadecimal digits. To ensure that escaped URIs can be * compared using string comparison functions, this function must always use * the upper-case letters A-F. - * + * * Generally, $escape-reserved should be set to true when escaping a string * that is to form a single part of a URI, and to false when escaping an * entire URI or URI reference. - * - * In the case of non-ascii characters, the string is encoded according to + * + * In the case of non-ascii characters, the string is encoded according to * utf-8 and then converted according to RFC 2396. * * Examples - * xf:escape-uri ("gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles#ocean"), true()) + * xf:escape-uri ("gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles#ocean"), true()) * returns "gopher%3A%2F%2Fspinaltap.micro.umn.edu%2F00%2FWeather%2FCalifornia%2FLos%20Angeles%23ocean" * xf:escape-uri ("gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles#ocean"), false()) * returns "gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles%23ocean" @@ -14935,31 +15246,31 @@ static void xmlXPathEscapeUriFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr str; int escape_reserved; - xmlBufferPtr target; + xmlBufPtr target; xmlChar *cptr; xmlChar escape[4]; - + CHECK_ARITY(2); - + escape_reserved = xmlXPathPopBoolean(ctxt); - + CAST_TO_STRING; str = valuePop(ctxt); - - target = xmlBufferCreate(); - + + target = xmlBufCreate(); + escape[0] = '%'; escape[3] = 0; - + if (target) { for (cptr = str->stringval; *cptr; cptr++) { if ((*cptr >= 'A' && *cptr <= 'Z') || (*cptr >= 'a' && *cptr <= 'z') || (*cptr >= '0' && *cptr <= '9') || - *cptr == '-' || *cptr == '_' || *cptr == '.' || + *cptr == '-' || *cptr == '_' || *cptr == '.' || *cptr == '!' || *cptr == '~' || *cptr == '*' || *cptr == '\''|| *cptr == '(' || *cptr == ')' || - (*cptr == '%' && + (*cptr == '%' && ((cptr[1] >= 'A' && cptr[1] <= 'F') || (cptr[1] >= 'a' && cptr[1] <= 'f') || (cptr[1] >= '0' && cptr[1] <= '9')) && @@ -14971,7 +15282,7 @@ xmlXPathEscapeUriFunction(xmlXPathParserContextPtr ctxt, int nargs) { *cptr == ':' || *cptr == '@' || *cptr == '&' || *cptr == '=' || *cptr == '+' || *cptr == '$' || *cptr == ','))) { - xmlBufferAdd(target, cptr, 1); + xmlBufAdd(target, cptr, 1); } else { if ((*cptr >> 4) < 10) escape[1] = '0' + (*cptr >> 4); @@ -14981,14 +15292,14 @@ xmlXPathEscapeUriFunction(xmlXPathParserContextPtr ctxt, int nargs) { escape[2] = '0' + (*cptr & 0xF); else escape[2] = 'A' - 10 + (*cptr & 0xF); - - xmlBufferAdd(target, &escape[0], 3); + + xmlBufAdd(target, &escape[0], 3); } } } valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, - xmlBufferContent(target))); - xmlBufferFree(target); + xmlBufContent(target))); + xmlBufFree(target); xmlXPathReleaseObject(ctxt->context, str); } diff --git a/gnulib-local/lib/libxml/xpath.in.h b/gnulib-local/lib/libxml/xpath.in.h index 89008fc..d96776c 100644 --- a/gnulib-local/lib/libxml/xpath.in.h +++ b/gnulib-local/lib/libxml/xpath.in.h @@ -33,7 +33,7 @@ extern "C" { #endif #endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */ - + #ifdef LIBXML_XPATH_ENABLED typedef struct _xmlXPathContext xmlXPathContext; @@ -68,7 +68,9 @@ typedef enum { XPATH_UNDEF_PREFIX_ERROR, XPATH_ENCODING_ERROR, XPATH_INVALID_CHAR_ERROR, - XPATH_INVALID_CTXT + XPATH_INVALID_CTXT, + XPATH_STACK_ERROR, + XPATH_FORBID_VARIABLE_ERROR } xmlXPathError; /* @@ -271,13 +273,16 @@ typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, * * Expression evaluation occurs with respect to a context. * he context consists of: - * - a node (the context node) - * - a node list (the context node list) - * - a set of variable bindings - * - a function library - * - the set of namespace declarations in scope for the expression + * - a node (the context node) + * - a node list (the context node list) + * - a set of variable bindings + * - a function library + * - the set of namespace declarations in scope for the expression * Following the switch to hash tables, this need to be trimmed up at * the next binary incompatible release. + * The node may be modified when the context is passed to libxml2 + * for an XPath evaluation so you may need to initialize it again + * before the next call. */ struct _xmlXPathContext { @@ -310,7 +315,7 @@ struct _xmlXPathContext { int proximityPosition; /* the proximity position */ /* extra stuff for XPointer */ - int xptr; /* it this an XPointer context */ + int xptr; /* is this an XPointer context? */ xmlNodePtr here; /* for here() */ xmlNodePtr origin; /* for origin() */ @@ -332,7 +337,7 @@ struct _xmlXPathContext { /* temporary namespace lists kept for walking the namespace axis */ xmlNsPtr *tmpNsList; /* Array of namespaces */ - int tmpNsNr; /* number of namespace in scope */ + int tmpNsNr; /* number of namespaces in scope */ /* error reporting mechanism */ void *userData; /* user specific data block */ @@ -340,8 +345,8 @@ struct _xmlXPathContext { xmlError lastError; /* the last error */ xmlNodePtr debugNode; /* the source node XSLT */ - /* dictionnary */ - xmlDictPtr dict; /* dictionnary if any */ + /* dictionary */ + xmlDictPtr dict; /* dictionary if any */ int flags; /* flags to control compilation */ @@ -377,6 +382,8 @@ struct _xmlXPathParserContext { xmlXPathCompExprPtr comp; /* the precompiled expression */ int xptr; /* it this an XPointer expression */ xmlNodePtr ancestor; /* used for walking preceding axis */ + + int valueFrame; /* used to limit Pop on the stack */ }; /************************************************************************ @@ -414,7 +421,7 @@ XMLPUBVAR double xmlXPathNINF; * @index is out of range (0 to length-1) */ #define xmlXPathNodeSetItem(ns, index) \ - ((((ns) != NULL) && \ + ((((ns) != NULL) && \ ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ (ns)->nodeTab[(index)] \ : NULL) @@ -430,64 +437,64 @@ XMLPUBVAR double xmlXPathNINF; (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathFreeObject (xmlXPathObjectPtr obj); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeSetCreate (xmlNodePtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathFreeNodeSet (xmlNodeSetPtr obj); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathObjectCopy (xmlXPathObjectPtr val); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCmpNodes (xmlNodePtr node1, xmlNodePtr node2); /** * Conversion functions to basic types. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCastNumberToBoolean (double val); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCastStringToBoolean (const xmlChar * val); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCastToBoolean (xmlXPathObjectPtr val); -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathCastBooleanToNumber (int val); -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathCastStringToNumber (const xmlChar * val); -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathCastNodeToNumber (xmlNodePtr node); -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathCastToNumber (xmlXPathObjectPtr val); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathCastBooleanToString (int val); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathCastNumberToString (double val); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathCastNodeToString (xmlNodePtr node); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathCastToString (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathConvertBoolean (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathConvertNumber (xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathConvertString (xmlXPathObjectPtr val); /** * Context handling. */ -XMLPUBFUN xmlXPathContextPtr XMLCALL +XMLPUBFUN xmlXPathContextPtr XMLCALL xmlXPathNewContext (xmlDocPtr doc); XMLPUBFUN void XMLCALL xmlXPathFreeContext (xmlXPathContextPtr ctxt); @@ -499,36 +506,43 @@ XMLPUBFUN int XMLCALL /** * Evaluation functions. */ -XMLPUBFUN long XMLCALL +XMLPUBFUN long XMLCALL xmlXPathOrderDocElems (xmlDocPtr doc); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN int XMLCALL + xmlXPathSetContextNode (xmlNodePtr node, + xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNodeEval (xmlNodePtr node, + const xmlChar *str, + xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathEval (const xmlChar *str, xmlXPathContextPtr ctx); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathEvalExpression (const xmlChar *str, xmlXPathContextPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, xmlXPathObjectPtr res); /** * Separate compilation/evaluation entry points. */ -XMLPUBFUN xmlXPathCompExprPtr XMLCALL +XMLPUBFUN xmlXPathCompExprPtr XMLCALL xmlXPathCompile (const xmlChar *str); -XMLPUBFUN xmlXPathCompExprPtr XMLCALL +XMLPUBFUN xmlXPathCompExprPtr XMLCALL xmlXPathCtxtCompile (xmlXPathContextPtr ctxt, - const xmlChar *str); -XMLPUBFUN xmlXPathObjectPtr XMLCALL + const xmlChar *str); +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathCompiledEval (xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); #endif /* LIBXML_XPATH_ENABLED */ #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathInit (void); XMLPUBFUN int XMLCALL xmlXPathIsNaN (double val); diff --git a/gnulib-local/lib/libxml/xpathInternals.in.h b/gnulib-local/lib/libxml/xpathInternals.in.h index dcd5243..70c9db9 100644 --- a/gnulib-local/lib/libxml/xpathInternals.in.h +++ b/gnulib-local/lib/libxml/xpathInternals.in.h @@ -100,16 +100,16 @@ extern "C" { */ #define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); -XMLPUBFUN double XMLCALL - xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlXPathPopString (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); -XMLPUBFUN void * XMLCALL - xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); +XMLPUBFUN double XMLCALL + xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathPopString (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); +XMLPUBFUN void * XMLCALL + xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); /** * xmlXPathReturnBoolean: @@ -296,7 +296,9 @@ XMLPUBFUN void * XMLCALL #define CHECK_ARITY(x) \ if (ctxt == NULL) return; \ if (nargs != (x)) \ - XP_ERROR(XPATH_INVALID_ARITY); + XP_ERROR(XPATH_INVALID_ARITY); \ + if (ctxt->valueNr < ctxt->valueFrame + (x)) \ + XP_ERROR(XPATH_STACK_ERROR); /** * CAST_TO_STRING: @@ -329,7 +331,7 @@ XMLPUBFUN void * XMLCALL * Variable Lookup forwarding. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, xmlXPathVariableLookupFunc f, void *data); @@ -338,7 +340,7 @@ XMLPUBFUN void XMLCALL * Function Lookup forwarding. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, xmlXPathFuncLookupFunc f, void *funcCtxt); @@ -346,7 +348,7 @@ XMLPUBFUN void XMLCALL /* * Error reporting. */ -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPatherror (xmlXPathParserContextPtr ctxt, const char *file, int line, @@ -357,11 +359,11 @@ XMLPUBFUN void XMLCALL int error); #ifdef LIBXML_DEBUG_ENABLED -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathDebugDumpObject (FILE *output, xmlXPathObjectPtr cur, int depth); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp, int depth); @@ -369,48 +371,48 @@ XMLPUBFUN void XMLCALL /** * NodeSet handling. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathNodeSetContains (xmlNodeSetPtr cur, xmlNodePtr val); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathDifference (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathIntersection (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathDistinctSorted (xmlNodeSetPtr nodes); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathDistinct (xmlNodeSetPtr nodes); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeLeading (xmlNodeSetPtr nodes, xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathLeading (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathNodeTrailing (xmlNodeSetPtr nodes, xmlNodePtr node); -XMLPUBFUN xmlNodeSetPtr XMLCALL +XMLPUBFUN xmlNodeSetPtr XMLCALL xmlXPathTrailing (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2); @@ -419,51 +421,51 @@ XMLPUBFUN xmlNodeSetPtr XMLCALL * Extending a context. */ -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathRegisterNs (xmlXPathContextPtr ctxt, const xmlChar *prefix, const xmlChar *ns_uri); -XMLPUBFUN const xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlXPathNsLookup (xmlXPathContextPtr ctxt, const xmlChar *prefix); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, const xmlChar *name, xmlXPathFunction f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri, xmlXPathFunction f); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, const xmlChar *name, xmlXPathObjectPtr value); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri, xmlXPathObjectPtr value); -XMLPUBFUN xmlXPathFunction XMLCALL +XMLPUBFUN xmlXPathFunction XMLCALL xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, const xmlChar *name); -XMLPUBFUN xmlXPathFunction XMLCALL +XMLPUBFUN xmlXPathFunction XMLCALL xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathVariableLookup (xmlXPathContextPtr ctxt, const xmlChar *name); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, const xmlChar *name, const xmlChar *ns_uri); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); /** @@ -471,79 +473,79 @@ XMLPUBFUN void XMLCALL */ XMLPUBFUN xmlXPathParserContextPtr XMLCALL xmlXPathNewParserContext (const xmlChar *str, - xmlXPathContextPtr ctxt); -XMLPUBFUN void XMLCALL + xmlXPathContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); /* TODO: remap to xmlXPathValuePop and Push. */ -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL valuePop (xmlXPathParserContextPtr ctxt); -XMLPUBFUN int XMLCALL +XMLPUBFUN int XMLCALL valuePush (xmlXPathParserContextPtr ctxt, - xmlXPathObjectPtr value); + xmlXPathObjectPtr value); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewString (const xmlChar *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewCString (const char *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapString (xmlChar *val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapCString (char * val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewFloat (double val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewBoolean (int val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewNodeSet (xmlNodePtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewValueTree (xmlNodePtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN int XMLCALL xmlXPathNodeSetAdd (xmlNodeSetPtr cur, xmlNodePtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN int XMLCALL xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, - xmlNodePtr node, +XMLPUBFUN int XMLCALL + xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, + xmlNodePtr node, xmlNsPtr ns); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathNodeSetSort (xmlNodeSetPtr set); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRoot (xmlXPathParserContextPtr ctxt); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathParseName (xmlXPathParserContextPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN xmlChar * XMLCALL xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); /* * Existing functions. */ -XMLPUBFUN double XMLCALL +XMLPUBFUN double XMLCALL xmlXPathStringEvalNumber (const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, +XMLPUBFUN int XMLCALL + xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr res); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); -XMLPUBFUN xmlNodeSetPtr XMLCALL - xmlXPathNodeSetMerge (xmlNodeSetPtr val1, +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeSetMerge (xmlNodeSetPtr val1, xmlNodeSetPtr val2); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetDel (xmlNodeSetPtr cur, +XMLPUBFUN void XMLCALL + xmlXPathNodeSetDel (xmlNodeSetPtr cur, xmlNodePtr val); -XMLPUBFUN void XMLCALL - xmlXPathNodeSetRemove (xmlNodeSetPtr cur, +XMLPUBFUN void XMLCALL + xmlXPathNodeSetRemove (xmlNodeSetPtr cur, int val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathNewNodeSetList (xmlNodeSetPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapNodeSet (xmlNodeSetPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPathWrapExternal (void *val); XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); @@ -621,7 +623,7 @@ XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, in * Really internal functions */ XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns); - + #ifdef __cplusplus } #endif diff --git a/gnulib-local/lib/libxml/xpointer.c b/gnulib-local/lib/libxml/xpointer.c index 5298fa5..4b4ac2e 100644 --- a/gnulib-local/lib/libxml/xpointer.c +++ b/gnulib-local/lib/libxml/xpointer.c @@ -7,7 +7,7 @@ * * Added support for the element() scheme described in: * W3C Proposed Recommendation 13 November 2002 - * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ + * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ * * See Copyright for the status of this software. * @@ -47,19 +47,19 @@ #endif #endif -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); -#define STRANGE \ +#define STRANGE \ xmlGenericError(xmlGenericErrorContext, \ "Internal error at %s:%d\n", \ __FILE__, __LINE__); /************************************************************************ * * - * Some factorized error routines * + * Some factorized error routines * * * ************************************************************************/ @@ -134,7 +134,7 @@ xmlNodePtr xmlXPtrAdvanceNode(xmlNodePtr cur, int *level); static int xmlXPtrGetArity(xmlNodePtr cur) { int i; - if (cur == NULL) + if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL)) return(-1); cur = cur->children; for (i = 0;cur != NULL;cur = cur->next) { @@ -157,7 +157,7 @@ xmlXPtrGetArity(xmlNodePtr cur) { static int xmlXPtrGetIndex(xmlNodePtr cur) { int i; - if (cur == NULL) + if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL)) return(-1); for (i = 1;cur != NULL;cur = cur->prev) { if ((cur->type == XML_ELEMENT_NODE) || @@ -179,11 +179,11 @@ xmlXPtrGetIndex(xmlNodePtr cur) { static xmlNodePtr xmlXPtrGetNthChild(xmlNodePtr cur, int no) { int i; - if (cur == NULL) + if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL)) return(cur); cur = cur->children; for (i = 0;i <= no;cur = cur->next) { - if (cur == NULL) + if (cur == NULL) return(cur); if ((cur->type == XML_ELEMENT_NODE) || (cur->type == XML_DOCUMENT_NODE) || @@ -553,7 +553,7 @@ xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) { break; case XPATH_NODESET: /* - * Empty set ... + * Empty set ... */ if (end->nodesetval->nodeNr <= 0) return(NULL); @@ -731,7 +731,7 @@ xmlXPtrLocationSetDel(xmlLocationSetPtr cur, xmlXPathObjectPtr val) { if (i >= cur->locNr) { #ifdef DEBUG - xmlGenericError(xmlGenericErrorContext, + xmlGenericError(xmlGenericErrorContext, "xmlXPtrLocationSetDel: Range wasn't found in RangeList\n"); #endif return; @@ -903,7 +903,7 @@ static void xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name); #define NXT(val) ctxt->cur[(val)] #define CUR_PTR ctxt->cur -#define SKIP_BLANKS \ +#define SKIP_BLANKS \ while (IS_BLANK_CH(*(ctxt->cur))) NEXT #define CURRENT (*ctxt->cur) @@ -945,7 +945,7 @@ xmlXPtrGetChildNo(xmlXPathParserContextPtr ctxt, int indx) { * xmlXPtrEvalXPtrPart: * @ctxt: the XPointer Parser context * @name: the preparsed Scheme for the XPtrPart - * + * * XPtrPart ::= 'xpointer' '(' XPtrExpr ')' * | Scheme '(' SchemeSpecificExpr ')' * @@ -953,7 +953,7 @@ xmlXPtrGetChildNo(xmlXPathParserContextPtr ctxt, int indx) { * * SchemeSpecificExpr ::= StringWithBalancedParens * - * StringWithBalancedParens ::= + * StringWithBalancedParens ::= * [^()]* ('(' StringWithBalancedParens ')' [^()]*)* * [VC: Parenthesis escaping] * @@ -971,7 +971,7 @@ xmlXPtrGetChildNo(xmlXPathParserContextPtr ctxt, int indx) { * * Parse and evaluate an XPtrPart. Basically it generates the unescaped * string and if the scheme is 'xpointer' it will call the XPath interpreter. - * + * * TODO: there is no new scheme registration mechanism */ @@ -1007,21 +1007,14 @@ xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) { NEXT; break; } - *cur++ = CUR; } else if (CUR == '(') { level++; - *cur++ = CUR; } else if (CUR == '^') { - NEXT; - if ((CUR == ')') || (CUR == '(') || (CUR == '^')) { - *cur++ = CUR; - } else { - *cur++ = '^'; - *cur++ = CUR; - } - } else { - *cur++ = CUR; + if ((NXT(1) == ')') || (NXT(1) == '(') || (NXT(1) == '^')) { + NEXT; + } } + *cur++ = CUR; NEXT; } *cur = 0; @@ -1104,7 +1097,7 @@ xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) { xmlFree(name); XP_ERROR(XPATH_MEMORY_ERROR); } - + xmlXPathRegisterNs(ctxt->context, prefix, URI); CUR_PTR = left; xmlFree(URI); @@ -1152,10 +1145,12 @@ xmlXPtrEvalFullXPtr(xmlXPathParserContextPtr ctxt, xmlChar *name) { if (name == NULL) XP_ERROR(XPATH_EXPR_ERROR); while (name != NULL) { + ctxt->error = XPATH_EXPRESSION_OK; xmlXPtrEvalXPtrPart(ctxt, name); /* in case of syntax error, break here */ - if (ctxt->error != XPATH_EXPRESSION_OK) + if ((ctxt->error != XPATH_EXPRESSION_OK) && + (ctxt->error != XML_XPTR_UNKNOWN_SCHEME)) return; /* @@ -1234,7 +1229,7 @@ xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name) { while (CUR == '/') { int child = 0; NEXT; - + while ((CUR >= '0') && (CUR <= '9')) { child = child * 10 + (CUR - '0'); NEXT; @@ -1258,7 +1253,7 @@ static void xmlXPtrEvalXPointer(xmlXPathParserContextPtr ctxt) { if (ctxt->valueTab == NULL) { /* Allocate the value stack */ - ctxt->valueTab = (xmlXPathObjectPtr *) + ctxt->valueTab = (xmlXPathObjectPtr *) xmlMalloc(10 * sizeof(xmlXPathObjectPtr)); if (ctxt->valueTab == NULL) { xmlXPtrErrMemory("allocating evaluation context"); @@ -1267,6 +1262,7 @@ xmlXPtrEvalXPointer(xmlXPathParserContextPtr ctxt) { ctxt->valueNr = 0; ctxt->valueMax = 10; ctxt->value = NULL; + ctxt->valueFrame = 0; } SKIP_BLANKS; if (CUR == '/') { @@ -1299,12 +1295,19 @@ xmlXPtrEvalXPointer(xmlXPathParserContextPtr ctxt) { * * ************************************************************************/ +static void xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs); +static void xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs); +static void xmlXPtrEndPointFunction(xmlXPathParserContextPtr ctxt, int nargs); +static void xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs); +static void xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs); +static void xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs); +static void xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs); /** @@ -1372,6 +1375,8 @@ xmlXPtrEval(const xmlChar *str, xmlXPathContextPtr ctx) { return(NULL); ctxt = xmlXPathNewParserContext(str, ctx); + if (ctxt == NULL) + return(NULL); ctxt->xptr = 1; xmlXPtrEvalXPointer(ctxt); @@ -1393,13 +1398,13 @@ xmlXPtrEval(const xmlChar *str, xmlXPathContextPtr ctx) { /* * Evaluation may push a root nodeset which is unused */ - xmlNodeSetPtr set; + xmlNodeSetPtr set; set = tmp->nodesetval; if ((set->nodeNr != 1) || (set->nodeTab[0] != (xmlNodePtr) ctx->doc)) stack++; } else - stack++; + stack++; } xmlXPathFreeObject(tmp); } @@ -1413,7 +1418,7 @@ xmlXPtrEval(const xmlChar *str, xmlXPathContextPtr ctx) { xmlXPathFreeObject(res); res = NULL; } - + xmlXPathFreeParserContext(ctxt); return(res); } @@ -1441,11 +1446,13 @@ xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) { return(NULL); start = (xmlNodePtr) range->user; - if (start == NULL) + if ((start == NULL) || (start->type == XML_NAMESPACE_DECL)) return(NULL); end = range->user2; if (end == NULL) return(xmlCopyNode(start, 1)); + if (end->type == XML_NAMESPACE_DECL) + return(NULL); cur = start; index1 = range->index; @@ -1475,7 +1482,7 @@ xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) { /* prune and return full set */ if (last != NULL) xmlAddNextSibling(last, tmp); - else + else xmlAddChild(parent, tmp); return(list); } else { @@ -1729,16 +1736,16 @@ xmlXPtrNbLocChildren(xmlNodePtr node) { * @ctxt: the XPointer Parser context * @nargs: the number of args * - * Function implementing here() operation + * Function implementing here() operation * as described in 5.4.3 */ -void +static void xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs) { CHECK_ARITY(0); if (ctxt->context->here == NULL) XP_ERROR(XPTR_SYNTAX_ERROR); - + valuePush(ctxt, xmlXPtrNewLocationSetNodes(ctxt->context->here, NULL)); } @@ -1747,16 +1754,16 @@ xmlXPtrHereFunction(xmlXPathParserContextPtr ctxt, int nargs) { * @ctxt: the XPointer Parser context * @nargs: the number of args * - * Function implementing origin() operation + * Function implementing origin() operation * as described in 5.4.3 */ -void +static void xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs) { CHECK_ARITY(0); if (ctxt->context->origin == NULL) XP_ERROR(XPTR_SYNTAX_ERROR); - + valuePush(ctxt, xmlXPtrNewLocationSetNodes(ctxt->context->origin, NULL)); } @@ -1765,7 +1772,7 @@ xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs) { * @ctxt: the XPointer Parser context * @nargs: the number of args * - * Function implementing start-point() operation + * Function implementing start-point() operation * as described in 5.4.3 * ---------------- * location-set start-point(location-set) @@ -1783,7 +1790,7 @@ xmlXPtrOriginFunction(xmlXPathParserContextPtr ctxt, int nargs) { * ---------------- * */ -void +static void xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr tmp, obj, point; xmlLocationSetPtr newset = NULL; @@ -1802,6 +1809,8 @@ xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs) { */ tmp = xmlXPtrNewLocationSetNodeSet(obj->nodesetval); xmlXPathFreeObject(obj); + if (tmp == NULL) + XP_ERROR(XPATH_MEMORY_ERROR) obj = tmp; } @@ -1857,7 +1866,7 @@ xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs) { * @ctxt: the XPointer Parser context * @nargs: the number of args * - * Function implementing end-point() operation + * Function implementing end-point() operation * as described in 5.4.3 * ---------------------------- * location-set end-point(location-set) @@ -1877,7 +1886,7 @@ xmlXPtrStartPointFunction(xmlXPathParserContextPtr ctxt, int nargs) { * syntax error. * ---------------------------- */ -void +static void xmlXPtrEndPointFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr tmp, obj, point; xmlLocationSetPtr newset = NULL; @@ -1896,10 +1905,16 @@ xmlXPtrEndPointFunction(xmlXPathParserContextPtr ctxt, int nargs) { */ tmp = xmlXPtrNewLocationSetNodeSet(obj->nodesetval); xmlXPathFreeObject(obj); + if (tmp == NULL) + XP_ERROR(XPATH_MEMORY_ERROR) obj = tmp; } newset = xmlXPtrLocationSetCreate(NULL); + if (newset == NULL) { + xmlXPathFreeObject(obj); + XP_ERROR(XPATH_MEMORY_ERROR); + } oldset = (xmlLocationSetPtr) obj->user; if (oldset != NULL) { int i; @@ -1993,7 +2008,7 @@ xmlXPtrCoveringRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) { case XML_NOTATION_NODE: case XML_HTML_DOCUMENT_NODE: { int indx = xmlXPtrGetIndex(node); - + node = node->parent; return(xmlXPtrNewRange(node, indx - 1, node, indx + 1)); @@ -2022,7 +2037,7 @@ xmlXPtrCoveringRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) { * location-set, a range location representing the covering range of * x is added to the result location-set. */ -void +static void xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) { int i; xmlXPathObjectPtr set; @@ -2044,6 +2059,8 @@ xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) { */ tmp = xmlXPtrNewLocationSetNodeSet(set->nodesetval); xmlXPathFreeObject(set); + if (tmp == NULL) + XP_ERROR(XPATH_MEMORY_ERROR) set = tmp; } oldset = (xmlLocationSetPtr) set->user; @@ -2052,6 +2069,10 @@ xmlXPtrRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) { * The loop is to compute the covering range for each item and add it */ newset = xmlXPtrLocationSetCreate(NULL); + if (newset == NULL) { + xmlXPathFreeObject(set); + XP_ERROR(XPATH_MEMORY_ERROR); + } for (i = 0;i < oldset->locNr;i++) { xmlXPtrLocationSetAdd(newset, xmlXPtrCoveringRange(ctxt, oldset->locTab[i])); @@ -2168,7 +2189,7 @@ xmlXPtrInsideRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) { * location children of x. * */ -void +static void xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs) { int i; xmlXPathObjectPtr set; @@ -2190,6 +2211,8 @@ xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs) { */ tmp = xmlXPtrNewLocationSetNodeSet(set->nodesetval); xmlXPathFreeObject(set); + if (tmp == NULL) + XP_ERROR(XPATH_MEMORY_ERROR) set = tmp; } oldset = (xmlLocationSetPtr) set->user; @@ -2198,6 +2221,10 @@ xmlXPtrRangeInsideFunction(xmlXPathParserContextPtr ctxt, int nargs) { * The loop is to compute the covering range for each item and add it */ newset = xmlXPtrLocationSetCreate(NULL); + if (newset == NULL) { + xmlXPathFreeObject(set); + XP_ERROR(XPATH_MEMORY_ERROR); + } for (i = 0;i < oldset->locNr;i++) { xmlXPtrLocationSetAdd(newset, xmlXPtrInsideRange(ctxt, oldset->locTab[i])); @@ -2240,7 +2267,7 @@ xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt, int nargs) { cur = ctxt->cur; newset = xmlXPtrLocationSetCreate(NULL); - + for (i = 0; i < oldset->nodeNr; i++) { ctxt->cur = cur; @@ -2274,7 +2301,7 @@ xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt, int nargs) { res = valuePop(ctxt); xmlXPathFreeObject(res); } - + ctxt->context->node = NULL; } @@ -2294,14 +2321,14 @@ xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt, int nargs) { * @level: incremented/decremented to show level in tree * * Advance to the next element or text node in document order - * TODO: add a stack for entering/exiting entities + * TODO: add a stack for entering/exiting entities * * Returns -1 in case of failure, 0 otherwise */ xmlNodePtr xmlXPtrAdvanceNode(xmlNodePtr cur, int *level) { next: - if (cur == NULL) + if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL)) return(NULL); if (cur->children != NULL) { cur = cur->children ; @@ -2359,7 +2386,7 @@ xmlXPtrAdvanceChar(xmlNodePtr *node, int *indx, int bytes) { if ((node == NULL) || (indx == NULL)) return(-1); cur = *node; - if (cur == NULL) + if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL)) return(-1); pos = *indx; @@ -2397,7 +2424,7 @@ xmlXPtrAdvanceChar(xmlNodePtr *node, int *indx, int bytes) { return(0); } /* - * We should have a text (or cdata) node ... + * We should have a text (or cdata) node ... */ len = 0; if ((cur->type != XML_ELEMENT_NODE) && @@ -2450,13 +2477,12 @@ xmlXPtrMatchString(const xmlChar *string, xmlNodePtr start, int startindex, if (string == NULL) return(-1); - if (start == NULL) + if ((start == NULL) || (start->type == XML_NAMESPACE_DECL)) return(-1); - if ((end == NULL) || (endindex == NULL)) + if ((end == NULL) || (*end == NULL) || + ((*end)->type == XML_NAMESPACE_DECL) || (endindex == NULL)) return(-1); cur = start; - if (cur == NULL) - return(-1); pos = startindex - 1; stringlen = xmlStrlen(string); @@ -2535,13 +2561,12 @@ xmlXPtrSearchString(const xmlChar *string, xmlNodePtr *start, int *startindex, if (string == NULL) return(-1); - if ((start == NULL) || (startindex == NULL)) + if ((start == NULL) || (*start == NULL) || + ((*start)->type == XML_NAMESPACE_DECL) || (startindex == NULL)) return(-1); if ((end == NULL) || (endindex == NULL)) return(-1); cur = *start; - if (cur == NULL) - return(-1); pos = *startindex - 1; first = string[0]; @@ -2574,7 +2599,7 @@ xmlXPtrSearchString(const xmlChar *string, xmlNodePtr *start, int *startindex, /* * An empty string is considered to match before each * character of the string-value and after the final - * character. + * character. */ #ifdef DEBUG_RANGES xmlGenericError(xmlGenericErrorContext, @@ -2615,20 +2640,17 @@ xmlXPtrGetLastChar(xmlNodePtr *node, int *indx) { xmlNodePtr cur; int pos, len = 0; - if ((node == NULL) || (indx == NULL)) + if ((node == NULL) || (*node == NULL) || + ((*node)->type == XML_NAMESPACE_DECL) || (indx == NULL)) return(-1); cur = *node; pos = *indx; - if (cur == NULL) - return(-1); - if ((cur->type == XML_ELEMENT_NODE) || (cur->type == XML_DOCUMENT_NODE) || (cur->type == XML_HTML_DOCUMENT_NODE)) { if (pos > 0) { cur = xmlXPtrGetNthChild(cur, pos); - pos = 0; } } while (cur != NULL) { @@ -2727,7 +2749,7 @@ xmlXPtrGetEndPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) { * @nargs: the number of args * * Function implementing the string-range() function - * range as described in 5.4.2 + * range as described in 5.4.2 * * ------------------------------ * [Definition: For each location in the location-set argument, @@ -2757,7 +2779,7 @@ xmlXPtrGetEndPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) { * all be character points. * ------------------------------ */ -void +static void xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) { int i, startindex, endindex = 0, fendindex; xmlNodePtr start, end = 0, fend; @@ -2796,6 +2818,10 @@ xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) { set = valuePop(ctxt); newset = xmlXPtrLocationSetCreate(NULL); + if (newset == NULL) { + xmlXPathFreeObject(set); + XP_ERROR(XPATH_MEMORY_ERROR); + } if (set->nodesetval == NULL) { goto error; } @@ -2807,6 +2833,8 @@ xmlXPtrStringRangeFunction(xmlXPathParserContextPtr ctxt, int nargs) { */ tmp = xmlXPtrNewLocationSetNodeSet(set->nodesetval); xmlXPathFreeObject(set); + if (tmp == NULL) + XP_ERROR(XPATH_MEMORY_ERROR) set = tmp; } oldset = (xmlLocationSetPtr) set->user; @@ -2891,7 +2919,7 @@ error: * @ctxt: the XPointer Parser context * * [8] Predicate ::= '[' PredicateExpr ']' - * [9] PredicateExpr ::= Expr + * [9] PredicateExpr ::= Expr * * Evaluate a predicate as in xmlXPathEvalPredicate() but for * a Location Set instead of a node set @@ -2940,7 +2968,7 @@ xmlXPtrEvalRangePredicate(xmlXPathParserContextPtr ctxt) { */ cur = ctxt->cur; newset = xmlXPtrLocationSetCreate(NULL); - + for (i = 0; i < oldset->locNr; i++) { ctxt->cur = cur; @@ -2976,7 +3004,7 @@ xmlXPtrEvalRangePredicate(xmlXPathParserContextPtr ctxt) { res = valuePop(ctxt); xmlXPathFreeObject(res); } - + ctxt->context->node = NULL; } diff --git a/gnulib-local/lib/libxml/xpointer.in.h b/gnulib-local/lib/libxml/xpointer.in.h index dde1dfb..b99112b 100644 --- a/gnulib-local/lib/libxml/xpointer.in.h +++ b/gnulib-local/lib/libxml/xpointer.in.h @@ -7,7 +7,7 @@ * * Added support for the element() scheme described in: * W3C Proposed Recommendation 13 November 2002 - * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ + * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ * * Copy: See Copyright for the status of this software. * @@ -43,68 +43,68 @@ struct _xmlLocationSet { * Handling of location sets. */ -XMLPUBFUN xmlLocationSetPtr XMLCALL +XMLPUBFUN xmlLocationSetPtr XMLCALL xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); -XMLPUBFUN xmlLocationSetPtr XMLCALL +XMLPUBFUN xmlLocationSetPtr XMLCALL xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, xmlLocationSetPtr val2); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRange (xmlNodePtr start, int startindex, xmlNodePtr end, int endindex); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangePoints (xmlXPathObjectPtr start, xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodePoint (xmlNodePtr start, xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodes (xmlNodePtr start, xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewLocationSetNodes (xmlNodePtr start, xmlNodePtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewRangeNodeObject (xmlNodePtr start, xmlXPathObjectPtr end); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrNewCollapsedRange (xmlNodePtr start); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, xmlXPathObjectPtr val); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrWrapLocationSet (xmlLocationSetPtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrLocationSetDel (xmlLocationSetPtr cur, xmlXPathObjectPtr val); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, int val); /* * Functions. */ -XMLPUBFUN xmlXPathContextPtr XMLCALL +XMLPUBFUN xmlXPathContextPtr XMLCALL xmlXPtrNewContext (xmlDocPtr doc, xmlNodePtr here, xmlNodePtr origin); -XMLPUBFUN xmlXPathObjectPtr XMLCALL +XMLPUBFUN xmlXPathObjectPtr XMLCALL xmlXPtrEval (const xmlChar *str, xmlXPathContextPtr ctx); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, - int nargs); -XMLPUBFUN xmlNodePtr XMLCALL + int nargs); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); -XMLPUBFUN void XMLCALL +XMLPUBFUN void XMLCALL xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); #ifdef __cplusplus } diff --git a/gnulib-local/lib/memory-ostream.oo.c b/gnulib-local/lib/memory-ostream.oo.c index 680cdeb..2468ed5 100644 --- a/gnulib-local/lib/memory-ostream.oo.c +++ b/gnulib-local/lib/memory-ostream.oo.c @@ -1,5 +1,5 @@ /* Output stream that accumulates the output in memory. - Copyright (C) 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/memory-ostream.oo.h b/gnulib-local/lib/memory-ostream.oo.h index 356bb73..ae9ef15 100644 --- a/gnulib-local/lib/memory-ostream.oo.h +++ b/gnulib-local/lib/memory-ostream.oo.h @@ -1,5 +1,5 @@ /* Output stream that accumulates the output in memory. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/moo.h b/gnulib-local/lib/moo.h index 93a12b3..f11a2b8 100644 --- a/gnulib-local/lib/moo.h +++ b/gnulib-local/lib/moo.h @@ -1,5 +1,5 @@ /* Minimal object-oriented facilities for C. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/ostream.oo.c b/gnulib-local/lib/ostream.oo.c index 49ee16f..3c178fa 100644 --- a/gnulib-local/lib/ostream.oo.c +++ b/gnulib-local/lib/ostream.oo.c @@ -1,5 +1,5 @@ /* Abstract output stream data type. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/ostream.oo.h b/gnulib-local/lib/ostream.oo.h index 2a9a7f3..87199df 100644 --- a/gnulib-local/lib/ostream.oo.h +++ b/gnulib-local/lib/ostream.oo.h @@ -1,5 +1,5 @@ /* Abstract output stream data type. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/styled-ostream.oo.c b/gnulib-local/lib/styled-ostream.oo.c index 9ec3525..03ecbc0 100644 --- a/gnulib-local/lib/styled-ostream.oo.c +++ b/gnulib-local/lib/styled-ostream.oo.c @@ -1,5 +1,5 @@ /* Abstract output stream for CSS styled text. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/styled-ostream.oo.h b/gnulib-local/lib/styled-ostream.oo.h index 944c191..4e9c8d0 100644 --- a/gnulib-local/lib/styled-ostream.oo.h +++ b/gnulib-local/lib/styled-ostream.oo.h @@ -1,5 +1,5 @@ /* Abstract output stream for CSS styled text. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/term-ostream.oo.c b/gnulib-local/lib/term-ostream.oo.c index 6556e15..243619a 100644 --- a/gnulib-local/lib/term-ostream.oo.c +++ b/gnulib-local/lib/term-ostream.oo.c @@ -1,5 +1,5 @@ /* Output stream for attributed text, producing ANSI escape sequences. - Copyright (C) 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2006-2008, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/term-ostream.oo.h b/gnulib-local/lib/term-ostream.oo.h index 1ace97b..8883b8f 100644 --- a/gnulib-local/lib/term-ostream.oo.h +++ b/gnulib-local/lib/term-ostream.oo.h @@ -1,5 +1,5 @@ /* Output stream for attributed text, producing ANSI escape sequences. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/term-styled-ostream.oo.c b/gnulib-local/lib/term-styled-ostream.oo.c index a08bf65..658574b 100644 --- a/gnulib-local/lib/term-styled-ostream.oo.c +++ b/gnulib-local/lib/term-styled-ostream.oo.c @@ -1,5 +1,5 @@ /* Output stream for CSS styled text, producing ANSI escape sequences. - Copyright (C) 2006-2007 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/term-styled-ostream.oo.h b/gnulib-local/lib/term-styled-ostream.oo.h index b890e3d..05335ce 100644 --- a/gnulib-local/lib/term-styled-ostream.oo.h +++ b/gnulib-local/lib/term-styled-ostream.oo.h @@ -1,5 +1,5 @@ /* Output stream for CSS styled text, producing ANSI escape sequences. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/termcap.h b/gnulib-local/lib/termcap.h index 8810d24..944c63d 100644 --- a/gnulib-local/lib/termcap.h +++ b/gnulib-local/lib/termcap.h @@ -1,5 +1,5 @@ /* Information about terminal capabilities. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/terminfo.h b/gnulib-local/lib/terminfo.h index 320aede..6e412f0 100644 --- a/gnulib-local/lib/terminfo.h +++ b/gnulib-local/lib/terminfo.h @@ -1,5 +1,5 @@ /* Information about terminal capabilities. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2006. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/tparm.c b/gnulib-local/lib/tparm.c index 69cb8f3..817a691 100644 --- a/gnulib-local/lib/tparm.c +++ b/gnulib-local/lib/tparm.c @@ -1,5 +1,5 @@ /* Substitution of parameters in strings from terminal descriptions. - Copyright (C) 2006, 2012 Free Software Foundation, Inc. + Copyright (C) 2006, 2012, 2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/gnulib-local/lib/tputs.c b/gnulib-local/lib/tputs.c index e45b99c..03c07f3 100644 --- a/gnulib-local/lib/tputs.c +++ b/gnulib-local/lib/tputs.c @@ -1,5 +1,5 @@ /* Output of string from terminal descriptions. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by diff --git a/gnulib-local/lib/unistd.in.h.diff b/gnulib-local/lib/unistd.in.h.diff index b339c4d..f1d6937 100644 --- a/gnulib-local/lib/unistd.in.h.diff +++ b/gnulib-local/lib/unistd.in.h.diff @@ -1,5 +1,5 @@ diff --git a/unistd.in.h b/unistd.in.h -index b4a3f5b..dd0d2c2 100644 +index b82be83..9df3f13 100644 --- a/unistd.in.h +++ b/unistd.in.h @@ -125,7 +125,11 @@ @@ -15,12 +15,3 @@ index b4a3f5b..dd0d2c2 100644 # define __need_getopt # include #endif -@@ -402,7 +406,7 @@ _GL_WARN_ON_USE (dup3, "dup3 is unportable - " - "VARIABLE=VALUE", terminated with a NULL. */ - # if defined __APPLE__ && defined __MACH__ - # include --# if !defined TARGET_OS_IPHONE && !defined TARGET_IPHONE_SIMULATOR -+# if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR - # define _GL_USE_CRT_EXTERNS - # endif - # endif diff --git a/gnulib-local/lib/xalloc.h b/gnulib-local/lib/xalloc.h index 1ad1009..b261994 100644 --- a/gnulib-local/lib/xalloc.h +++ b/gnulib-local/lib/xalloc.h @@ -1,5 +1,5 @@ /* malloc with out of memory checking. - Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/xerror.c b/gnulib-local/lib/xerror.c index b803f48..705b553 100644 --- a/gnulib-local/lib/xerror.c +++ b/gnulib-local/lib/xerror.c @@ -1,5 +1,5 @@ /* Multiline error-reporting functions. - Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/xerror.h b/gnulib-local/lib/xerror.h index 28b39c1..fc8b163 100644 --- a/gnulib-local/lib/xerror.h +++ b/gnulib-local/lib/xerror.h @@ -1,5 +1,5 @@ /* Multiline error-reporting functions. - Copyright (C) 2001-2003, 2006 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006, 2015 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software: you can redistribute it and/or modify diff --git a/gnulib-local/lib/xgetcwd.c b/gnulib-local/lib/xgetcwd.c index b2b8f0b..d939c63 100644 --- a/gnulib-local/lib/xgetcwd.c +++ b/gnulib-local/lib/xgetcwd.c @@ -1,5 +1,6 @@ /* xgetcwd.c -- return current directory with unlimited length - Copyright (C) 1992, 1996, 2000, 2003, 2005-2006, 2011 Free Software Foundation, Inc. + Copyright (C) 1992, 1996, 2000, 2003, 2005-2006, 2011, 2015 Free + Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gnulib-local/lib/xgetcwd.h b/gnulib-local/lib/xgetcwd.h index 961d73d..8c7e988 100644 --- a/gnulib-local/lib/xgetcwd.h +++ b/gnulib-local/lib/xgetcwd.h @@ -1,5 +1,5 @@ /* xgetcwd -- return current directory with unlimited length - Copyright (C) 1995, 2001-2002 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2002, 2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gnulib-local/lib/xmalloc.c b/gnulib-local/lib/xmalloc.c index 223f994..43dcb94 100644 --- a/gnulib-local/lib/xmalloc.c +++ b/gnulib-local/lib/xmalloc.c @@ -1,5 +1,6 @@ /* xmalloc.c -- malloc with out of memory checking - Copyright (C) 1990-1996, 2000-2003, 2005-2007, 2012 Free Software Foundation, Inc. + Copyright (C) 1990-1996, 2000-2003, 2005-2007, 2012, 2015 Free + Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gnulib-local/lib/xstrdup.c b/gnulib-local/lib/xstrdup.c index 9ad1b94..7aa09dc 100644 --- a/gnulib-local/lib/xstrdup.c +++ b/gnulib-local/lib/xstrdup.c @@ -1,5 +1,6 @@ /* xstrdup.c -- copy a string with out of memory checking - Copyright (C) 1990, 1996, 2000-2003, 2005-2006 Free Software Foundation, Inc. + Copyright (C) 1990, 1996, 2000-2003, 2005-2006, 2015 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -- cgit v1.2.1