Commit Graph

151 Commits

Author SHA1 Message Date
Nick Wellnhofer
fab8458458 tests: Fix build with older MSVC
Regressed in 9b5cce7a.

Fixes #620.
2023-11-23 16:20:54 +01:00
Nick Wellnhofer
c682089421 tests: Regenerate testapi.c 2023-11-04 19:32:48 +01:00
Nick Wellnhofer
61034116d0 error: Make more xmlError structs constant
Prepare for future changes, see 45470611.
2023-10-24 15:02:36 +02:00
Nick Wellnhofer
6eb2a00da4 tests: Update testapi.c 2023-09-21 22:58:02 +02:00
Nick Wellnhofer
9fc5090c05 hash: Clean up libxml/hash.h
Rename variables, fix subincludes, whitespace.
2023-09-21 14:47:25 +02:00
Nick Wellnhofer
9b5cce7a71 include: Remove more unnecessary includes 2023-09-21 01:50:53 +02:00
David Kilzer
5f54bac9eb testapi: test_xmlSAXDefaultVersion() leaves xmlSAX2DefaultVersionValue set to 1 with LIBXML_SAX1_ENABLED
Add code to save and to restore the default value of
xmlSAX2DefaultVersionValue.

Fixes #554.
2023-06-10 10:55:38 -07:00
Nick Wellnhofer
cb8ccb1078 testapi: Don't set http_proxy environment variable
We already disable network access, so this has no effect.
2023-05-25 03:17:45 +02:00
Nick Wellnhofer
886bf4e63b Stop calling xmlMemoryDump
This was used to check for memory leaks but could potentially create a
.memdump file. These days, there are better ways to check for memory
leaks.
2023-04-30 15:48:41 +02:00
Nick Wellnhofer
6e12409b33 Regenerate docs and testapi.c 2023-04-26 21:22:17 +02:00
Nick Wellnhofer
25ea7b6aa0 testapi.c: Initialize catalog early
Avoid leak reports when testing --with-mem-debug.
2022-12-08 19:44:09 +01:00
Nick Wellnhofer
eaebf37fb6 gentest.py: Fix memory leak in API tests
Regressed in commit ff34ba3e.
2022-12-08 19:18:10 +01:00
Nick Wellnhofer
b0556e1449 testapi: Disable on Windows for now
It's incredibly slow for some reason.
2022-09-04 20:27:21 +02:00
Nick Wellnhofer
b218abce43 Don't create missing.xml when running testapi
Side effect of b31e07db. Use a non-existing directory to avoid creating
a file.
2022-08-26 02:52:17 +02:00
Nick Wellnhofer
0f568c0b73 Consolidate private header files
Private functions were previously declared

- in header files in the root directory
- in public headers guarded with IN_LIBXML
- in libxml.h
- redundantly in source files that used them.

Consolidate all private header files in include/private.
2022-08-26 02:11:56 +02:00
Nick Wellnhofer
34a050cdee Move some HTML functions to correct header file 2022-08-24 16:44:39 +02:00
Nick Wellnhofer
9a82b94a94 Introduce xmlNewSAXParserCtxt and htmlNewSAXParserCtxt
Add API functions to create a parser context with a custom SAX handler
without having to mess with ctxt->sax manually.
2022-08-24 14:07:55 +02:00
Nick Wellnhofer
e519c6e1c6 Fix testapi when building --without-sax1
Broken in commit c61e1273.
2022-08-22 15:30:22 +02:00
Nick Wellnhofer
351dbdfe8b Disable network in API tests
Avoids hangs when trying to make network connections.
2022-05-20 14:53:33 +02:00
Mike Gilbert
b31e07dbf4 testapi: remove leading slash from "/missing.xml"
Fixes an error when running tests in a sandbox on Gentoo Linux.

Bug: https://bugs.gentoo.org/839804
2022-04-22 20:14:05 -04:00
Nick Wellnhofer
c61e12739f Fix warnings when testing --with-minimum build
There's no simple way to make the doc/examples tests handle different
configurations. But these tests aren't especially valuable, so remove
the result file checks.
2022-04-21 06:58:14 +02:00
Nick Wellnhofer
670701075b Add configuration flag for XPointer locations support
Add a new configuration flag that controls whether the outdated support
for XPointer locations (ranges and points) is enabled.

    --with-xptr-locs          # Autotools
    LIBXML2_WITH_XPTR_LOCS    # CMake

The latest spec for what it essentially an XPath extension seems to be
this working draft from 2002:

    https://www.w3.org/TR/xptr-xpointer/

The xpointer() scheme is listed as "being reviewed" in the XPointer
registry since at least 2006. libxml2 seems to be the only modern
software that tries to implement this spec, but the code has many bugs
and quality issues.

The flag defaults to "off" and support for this extensions has to be
requested explicitly. The relevant API functions are deprecated.
2022-04-21 02:41:58 +02:00
Nick Wellnhofer
9a0be0dc4d Regenerate api.xml and testapi.c 2022-04-21 01:58:59 +02:00
Nick Wellnhofer
96889d195b Disable legacy support by default
If you need support for legacy APIs, you have to enable it explicitly:

    ./configure --with-legacy
2022-02-20 21:49:04 +01:00
Nick Wellnhofer
a2fe74c08a Add XML_DEPRECATED macro
__attribute__((deprecated)) is available since at least GCC 3.1, so an
exact version check is probably unnecessary.
2022-02-20 21:49:04 +01:00
Nick Wellnhofer
9b8ef34dc9 Fix unused function warning in testapi.c 2022-02-04 14:42:16 +01:00
Daniel Veillard
e1bcffea18 Release of libxml2-2.9.11
Prompted by CVE-2021-3541, but this includes an awful lot of serious bug
fixes by Nick and others.
- configure.ac: bumped to new release
- doc/* updated and regenerated
2021-05-13 15:35:21 +02:00
Nick Wellnhofer
20c60886e4 Fix typos
Resolves #133.
2020-03-08 17:41:53 +01:00
Jared Yanovich
2a350ee9b4 Large batch of typo fixes
Closes #109.
2019-09-30 18:04:38 +02:00
Nick Wellnhofer
e8fdf5df6e Fix unused function warning in testapi.c
Check whether all param and return types are known before generating
functions for param types. Otherwise, unused functions end up in
testapi.c.
2019-01-06 14:25:18 +01:00
Daniel Veillard
18890f471c Release of libxml2-2.9.8
* configure.ac doc/* libxml2.syms testapi.c: updated for the new release
2018-03-05 17:09:43 +01:00
Nick Wellnhofer
00859f9118 Fix callback signature in testapi.c 2017-11-14 16:03:31 +01:00
Daniel Veillard
2960178fe8 Release of libxml2-2.9.5
* configure.ac, doc/xslt.html: updated for the release
* doc/*, python/setup.py, testapi.c: regenerated
2017-09-04 15:38:47 +02:00
Nick Wellnhofer
ff34ba3e88 Avoid out-of-bound array access in API tests
The API tests combine string buffers with arbitrary length values which
makes ASan detect out-of-bound array accesses. Even without ASan, this
could lead to unwanted test failures.

Add a check for "len", "size", and "start" arguments, assuming they
apply to the nearest char pointer. Skip the test if they exceed the
buffer size. This is a somewhat naive heuristic but it seems to work
well.
2017-06-01 14:31:28 +02:00
Daniel Veillard
8effcb578e Fix apibuild for a recently added construct
commit c71f9305a9 added __XML_EXTERNC
cpp construct which not understood by apibuild, leading to make dist
failures, ask to ignore that construct.
2016-05-09 10:31:09 +08:00
Jan Pokorný
bb654feb9a Fix typos: dictio{ nn -> n }ar{y,ies}
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2016-04-15 22:22:48 +08:00
David Kilzer
e6b97476a0 Bug 758572: ASAN crash in make check <https://bugzilla.gnome.org/show_bug.cgi?id=758572>
Instead of sending a random string length into API methods,
compute the string length properly to fix out-of-bounds accesses
caught with AddressSanitizer turned on.

* testapi.c:
(test_htmlCreateMemoryParserCtxt):
(test_htmlCreatePushParserCtxt):
(test_htmlCtxtReadMemory):
(test_htmlParseChunk):
(test_htmlReadMemory):
(test_xmlDictExists):
(test_xmlDictLookup):
(test_xmlCreatePushParserCtxt):
(test_xmlCtxtReadMemory):
(test_xmlCtxtResetPush):
(test_xmlParseChunk):
(test_xmlParseInNodeContext):
(test_xmlParseMemory):
(test_xmlReadMemory):
(test_xmlRecoverMemory):
(test_xmlSAXParseMemory):
(test_xmlSAXParseMemoryWithData):
(test_xmlSAXUserParseMemory):
(test_xmlCreateMemoryParserCtxt):
(test_xmlRelaxNGNewMemParserCtxt):
(test_xmlBufferAdd):
(test_xmlBufferAddHead):
(test_xmlBuildQName):
(test_xmlDocDumpFormatMemory):
(test_xmlDocDumpFormatMemoryEnc):
(test_xmlDocDumpMemory):
(test_xmlNewCDataBlock):
(test_xmlNewDocTextLen):
(test_xmlNewTextLen):
(test_xmlNodeAddContentLen):
(test_xmlNodeSetContentLen):
(test_xmlSplitQName3):
(test_xmlStringLenGetNodeList):
(test_xmlTextConcat):
(test_xmlOutputBufferWrite):
(test_xmlParserInputBufferCreateMem):
(test_xmlParserInputBufferCreateStatic):
(test_xmlParserInputBufferPush):
(test_xmlReaderForMemory):
(test_xmlReaderNewMemory):
(test_xmlSchemaNewMemParserCtxt):
(test_xmlCharStrndup):
(test_xmlStrncatNew):
(test_xmlStrncmp):
(test_xmlStrndup):
(test_xmlStrsub):
(test_xmlTextWriterWriteBase64):
(test_xmlTextWriterWriteBinHex):
(test_xmlTextWriterWriteRawLen):
2016-04-08 10:18:06 +08:00
Daniel Veillard
6657afe83a Release of libxml2-2.9.3
* configure.ac: updated
* doc/*: regenerated
2015-11-20 17:55:11 +08:00
Daniel Veillard
af62eb4fab Python generator bug raised by the const change
the doc methode for xmlDocGetRootElement wasn't generated anymore
2014-10-13 16:40:56 +08:00
Daniel Veillard
54ae471c14 Regenerated API, and testapi, rebuild documentation
After the previous commit adding 2 new entry points
2013-04-01 16:42:12 +08:00
Michael Wood
fb27e2cd20 Fix spelling of "length". 2012-10-30 10:18:49 +08:00
Daniel Veillard
38bbd3412d Release of libxml2-2.9.0
* libxml.spec.in: update
* doc/*: updated and regenerated
* libxml2.syms testapi.c: regenerated
2012-09-11 15:00:08 +08:00
Daniel Veillard
f8e3db0445 Big space and tab cleanup
Remove all space before tabs and space and tabs at end of lines.
2012-09-11 13:26:36 +08:00
Daniel Veillard
82cdfc4eb3 Expose xmlBufShrink in the public tree API
As suggested by Andrew W. Nosenko:
Proposal: expose the new xmlBufShrink() to the "public" API for
compatibility with xmlBufUse().

Reason: the following scenario:

1. Read something into  xmlParserInputBuffer (e.g. using
xmlParserInputBufferRead())
2. Extract content through xmlBufContent()
3. Extract content length through xmlBufUse().  Result have type
'size_t'.
4. Use this content
5. Now, you need to shrink the buffer.  How to do it?  Doing that
through legacy xmlBufferShrink() is unsafe because it uses 'unsigned
int' and the whole point of introducing the new API was handling the
cases, when 'unsigned int' is not enough.  Therefore, need to use the
new xmlBufShrink().  But it is "private".

Therefore, I propose to expose the new xmlBufShrink() in the same way,
as xmlBufContent() and xmlBufUse() are exposed.
2012-08-22 11:05:09 +08:00
Daniel Veillard
ff7227f2c1 Patch for portability of latin characters in C files
Coming from LibreOffice repository:
http://cgit.freedesktop.org/libreoffice/core/plain/libxml2/libxml2-latin.patch
2012-08-20 20:58:24 +08:00
Daniel Veillard
baaeadcf65 Regenerated testapi.c 2012-08-15 09:15:30 +08:00
Roumen Petrov
c3b1d09ba2 clean redefinition of {v}snprintf in C-source
as those from *config.h are preferable (e.g. win32config.h)
2012-08-13 16:57:30 +08:00
Roumen Petrov
1f0453f715 minimize use of HAVE_CONFIG_H
as build process for supported platforms provide "config.h" header file
2012-08-13 16:57:30 +08:00
Daniel Richard G
5706b6d876 Various "make distcheck" and portability fixups
Makefile.am:

* Don't use @VAR@, use $(VAR). Autoconf's AC_SUBST provides us the Make
   variable, it allows overriding the value at the command line, and
   (notably) it avoids a Make parse error in the libxml2_la_LDFLAGS
   assignment when @MODULE_PLATFORM_LIBS@ is empty

* Changed how the THREADS_W32 mechanism switches the build between
   testThreads.c and testThreadsWin32.c as appropriate; using AM_CONDITIONAL
   allows this to work cleanly and plays well with dependencies

* testapi.c should be specified as BUILT_SOURCES

* Create symlinks to the test/ and result/ subdirs so that the runtests
   target is usable in out-of-source-tree builds

* Don't do MAKEFLAGS+=--silent as this is not portable to non-GNU Makes

* Fixed incorrect find(1) syntax in the "cleanup" rule, and doing "rm -f"
   instead of just "rm" is good form

* (DIST)CLEANFILES needed a bit more coverage to allow "make distcheck" to
   pass

configure.in:

* Need AC_PROG_LN_S to create test/ and result/ symlinks in Makefile.am

* AC_LIBTOOL_WIN32_DLL and AM_PROG_LIBTOOL are obsolete; these have been
   superceded by LT_INIT

* Don't rebuild docs by default, as this requires GNU Make (as
   implemented)

* Check for uint32_t as some platforms don't provide it

* Check for some more functions, and undefine HAVE_MMAP if we don't also
   HAVE_MUNMAP (one system I tested on actually needed this)

* Changed THREADS_W32 from a filename insert into an Automake conditional

* The "Copyright" file will not be in the current directory if builddir !=
   srcdir

doc/Makefile.am:

* EXTRA_DIST cannot use wildcards when they refer to generated files; this
   breaks dependencies. What I did was define EXTRA_DIST_wc, which uses GNU
   Make $(wildcard) directives to build up a list of files, and EXTRA_DIST,
   as a literal expansion of EXTRA_DIST_wc. I also added a new rule,
   "check-extra-dist", to simplify checking that the two variables are
   equivalent. (Note that this works only when builddir == srcdir)

   (I can implement this differently if desired; this is just one way of
   doing it)

* Don't define an "all" target; this steps on Automake's toes

* Fixed up the "libxml2-api.xml ..." rule by using $(wildcard) for
   dependencies (as Make doesn't process the wildcards otherwise) and
   qualifying appropriate files with $(srcdir)

   (Note that $(srcdir) is not needed in the dependencies, thanks to VPATH,
   which we can count on as this is GNU-Make-only code anyway)

doc/devhelp/Makefile.am:

* Qualified appropriate files with $(srcdir)

* Added an "uninstall-local" rule so that "make distcheck" passes

doc/examples/Makefile.am:

* Rather than use a wildcard that doesn't work, use a substitution that
   most Make programs can handle

doc/examples/index.py:

* Do the same here

include/libxml/nanoftp.h:

* Some platforms (e.g. MSVC 6) already #define INVALID_SOCKET:

     user@host:/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/\
     Include$ grep -R INVALID_SOCKET .
     ./WINSOCK.H:#define INVALID_SOCKET  (SOCKET)(~0)
     ./WINSOCK2.H:#define INVALID_SOCKET  (SOCKET)(~0)

include/libxml/xmlversion.h.in:

* Support ancient GCCs (I was actually able to build the library with 2.5
   but for this bit)

python/Makefile.am:

* Expanded CLEANFILES to allow "make distcheck" to pass

python/tests/Makefile.am:

* Define CLEANFILES instead of a "clean" rule, and added tmp.xml to allow
   "make distcheck" to pass

testRelax.c:

* Use HAVE_MMAP instead of the less explicit HAVE_SYS_MMAN_H (as some
   systems have the header but not the function)

testSchemas.c:

* Use HAVE_MMAP instead of the less explicit HAVE_SYS_MMAN_H

testapi.c:

* Don't use putenv() if it's not available

threads.c:

* This fixes the following build error on Solaris 8:

     libtool: compile:  cc -DHAVE_CONFIG_H -I. -I./include -I./include \
     -D_REENTRANT -D__EXTENSIONS__ -D_REENTRANT -Dsparc -Xa -mt -v \
     -xarch=v9 -xcrossfile -xO5 -c threads.c  -KPIC -DPIC -o threads.o
     "threads.c", line 442: controlling expressions must have scalar type
     "threads.c", line 512: controlling expressions must have scalar type
     cc: acomp failed for threads.c
     *** Error code 1

trio.c:

* Define isascii() if the system doesn't provide it

trio.h:

* The trio library's HAVE_CONFIG_H header is not the same as LibXML2's
   HAVE_CONFIG_H header; this change is needed to avoid a double-inclusion

win32/configure.js:

* Added support for the LZMA compression option

win32/Makefile.{bcb,mingw,msvc}:

* Added appropriate bits to support WITH_LZMA=1

* Install the header files under $(INCPREFIX)\libxml2\libxml instead of
   $(INCPREFIX)\libxml, to mirror the install location on Unix+Autotools

xml2-config.in:

* @MODULE_PLATFORM_LIBS@ (usually "-ldl") needs to be in there in order for
   `xml2-config --libs` to provide a complete set of dependencies

xmllint.c:

* Use HAVE_MMAP instead of the less-explicit HAVE_SYS_MMAN_H
2012-08-06 11:32:54 +08:00
Daniel Veillard
c943f708f1 Release of libxml2-2.8.0
- Makefile.am: don't package .git
- configure.in : update to new release
- doc/xml.html: added the new release
- doc/* testapi.c: regenerated
2012-05-23 17:10:59 +08:00