1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-24 21:33:51 +03:00

legacy: Add stubs for disabled modules

When legacy support is requested, always enable stubs for FTP and
XPointer location modules which were removed from the standard
configuration. Going forward, the --with-legacy configuration option
should be used to provide maximum ABI compatibility.

Fixes #433.
This commit is contained in:
Nick Wellnhofer 2023-08-20 22:50:57 +02:00
parent ed3bd05284
commit 778cca386d
5 changed files with 278 additions and 8 deletions

View File

@ -20,6 +20,14 @@ gcc:minimum:
BASE_CONFIG: "--with-minimum" BASE_CONFIG: "--with-minimum"
CFLAGS: "-O2" CFLAGS: "-O2"
gcc:legacy:
extends: .test
only:
- schedules
variables:
BASE_CONFIG: "--with-legacy"
CFLAGS: "-O2"
gcc:python3: gcc:python3:
extends: .test extends: .test
variables: variables:

View File

@ -14,7 +14,7 @@
#include <libxml/xmlversion.h> #include <libxml/xmlversion.h>
#ifdef LIBXML_FTP_ENABLED #if defined(LIBXML_FTP_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
/* Needed for portability to Windows 64 bits */ /* Needed for portability to Windows 64 bits */
#if defined(_WIN32) #if defined(_WIN32)
@ -182,5 +182,5 @@ XMLPUBFUN int
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* LIBXML_FTP_ENABLED */ #endif /* defined(LIBXML_FTP_ENABLED) || defined(LIBXML_LEGACY_ENABLED) */
#endif /* __NANO_FTP_H__ */ #endif /* __NANO_FTP_H__ */

View File

@ -349,7 +349,7 @@ XMLPUBFUN int
/** /**
* Default 'ftp://' protocol callbacks * Default 'ftp://' protocol callbacks
*/ */
#ifdef LIBXML_FTP_ENABLED #if defined(LIBXML_FTP_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
XMLPUBFUN int XMLPUBFUN int
xmlIOFTPMatch (const char *filename); xmlIOFTPMatch (const char *filename);
XMLPUBFUN void * XMLPUBFUN void *
@ -360,7 +360,7 @@ XMLPUBFUN int
int len); int len);
XMLPUBFUN int XMLPUBFUN int
xmlIOFTPClose (void * context); xmlIOFTPClose (void * context);
#endif /* LIBXML_FTP_ENABLED */ #endif /* defined(LIBXML_FTP_ENABLED) || defined(LIBXML_LEGACY_ENABLED) */
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -28,7 +28,7 @@
extern "C" { extern "C" {
#endif #endif
#ifdef LIBXML_XPTR_LOCS_ENABLED #if defined(LIBXML_XPTR_LOCS_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
/* /*
* A Location Set * A Location Set
*/ */
@ -105,7 +105,7 @@ XML_DEPRECATED
XMLPUBFUN void XMLPUBFUN void
xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, xmlXPtrLocationSetRemove (xmlLocationSetPtr cur,
int val); int val);
#endif /* LIBXML_XPTR_LOCS_ENABLED */ #endif /* defined(LIBXML_XPTR_LOCS_ENABLED) || defined(LIBXML_LEGACY_ENABLED) */
/* /*
* Functions. * Functions.
@ -117,7 +117,8 @@ XMLPUBFUN xmlXPathContextPtr
XMLPUBFUN xmlXPathObjectPtr XMLPUBFUN xmlXPathObjectPtr
xmlXPtrEval (const xmlChar *str, xmlXPtrEval (const xmlChar *str,
xmlXPathContextPtr ctx); xmlXPathContextPtr ctx);
#ifdef LIBXML_XPTR_LOCS_ENABLED
#if defined(LIBXML_XPTR_LOCS_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
XML_DEPRECATED XML_DEPRECATED
XMLPUBFUN void XMLPUBFUN void
xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
@ -128,7 +129,7 @@ XMLPUBFUN xmlNodePtr
XML_DEPRECATED XML_DEPRECATED
XMLPUBFUN void XMLPUBFUN void
xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt);
#endif /* LIBXML_XPTR_LOCS_ENABLED */ #endif /* defined(LIBXML_XPTR_LOCS_ENABLED) || defined(LIBXML_LEGACY_ENABLED) */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

261
legacy.c
View File

@ -1338,5 +1338,266 @@ cdataBlock(void *ctx, const xmlChar * value, int len)
xmlSAX2CDataBlock(ctx, value, len); xmlSAX2CDataBlock(ctx, value, len);
} }
/*
* nanoftp.h
*/
#ifndef LIBXML_FTP_ENABLED
#include <libxml/nanoftp.h>
void
xmlNanoFTPInit(void) {
}
void
xmlNanoFTPCleanup(void) {
}
void
xmlNanoFTPProxy(const char *host ATTRIBUTE_UNUSED, int port ATTRIBUTE_UNUSED,
const char *user ATTRIBUTE_UNUSED,
const char *passwd ATTRIBUTE_UNUSED, int type ATTRIBUTE_UNUSED) {
}
int
xmlNanoFTPUpdateURL(void *ctx ATTRIBUTE_UNUSED,
const char *URL ATTRIBUTE_UNUSED) {
return(-1);
}
void
xmlNanoFTPScanProxy(const char *URL ATTRIBUTE_UNUSED) {
}
void*
xmlNanoFTPNewCtxt(const char *URL ATTRIBUTE_UNUSED) {
return(NULL);
}
void
xmlNanoFTPFreeCtxt(void * ctx ATTRIBUTE_UNUSED) {
}
int
xmlNanoFTPGetResponse(void *ctx ATTRIBUTE_UNUSED) {
return(-1);
}
int
xmlNanoFTPCheckResponse(void *ctx ATTRIBUTE_UNUSED) {
return(-1);
}
int
xmlNanoFTPQuit(void *ctx ATTRIBUTE_UNUSED) {
return(-1);
}
int
xmlNanoFTPConnect(void *ctx ATTRIBUTE_UNUSED) {
return(-1);
}
void*
xmlNanoFTPConnectTo(const char *server ATTRIBUTE_UNUSED,
int port ATTRIBUTE_UNUSED) {
return(NULL);
}
int
xmlNanoFTPCwd(void *ctx ATTRIBUTE_UNUSED,
const char *directory ATTRIBUTE_UNUSED) {
return(-1);
}
int
xmlNanoFTPDele(void *ctx ATTRIBUTE_UNUSED, const char *file ATTRIBUTE_UNUSED) {
return(-1);
}
SOCKET
xmlNanoFTPGetConnection(void *ctx ATTRIBUTE_UNUSED) {
return(-1);
}
int
xmlNanoFTPCloseConnection(void *ctx ATTRIBUTE_UNUSED) {
return(-1);
}
int
xmlNanoFTPList(void *ctx ATTRIBUTE_UNUSED,
ftpListCallback callback ATTRIBUTE_UNUSED,
void *userData ATTRIBUTE_UNUSED,
const char *filename ATTRIBUTE_UNUSED) {
return(-1);
}
SOCKET
xmlNanoFTPGetSocket(void *ctx ATTRIBUTE_UNUSED,
const char *filename ATTRIBUTE_UNUSED) {
return(-1);
}
int
xmlNanoFTPGet(void *ctx ATTRIBUTE_UNUSED,
ftpDataCallback callback ATTRIBUTE_UNUSED,
void *userData ATTRIBUTE_UNUSED,
const char *filename ATTRIBUTE_UNUSED) {
return(-1);
}
int
xmlNanoFTPRead(void *ctx ATTRIBUTE_UNUSED, void *dest ATTRIBUTE_UNUSED,
int len ATTRIBUTE_UNUSED) {
return(-1);
}
void*
xmlNanoFTPOpen(const char *URL ATTRIBUTE_UNUSED) {
return(NULL);
}
int
xmlNanoFTPClose(void *ctx ATTRIBUTE_UNUSED) {
return(-1);
}
int
xmlIOFTPMatch(const char *filename ATTRIBUTE_UNUSED) {
return(0);
}
void *
xmlIOFTPOpen(const char *filename ATTRIBUTE_UNUSED) {
return(NULL);
}
int
xmlIOFTPRead(void *context ATTRIBUTE_UNUSED, char *buffer ATTRIBUTE_UNUSED,
int len ATTRIBUTE_UNUSED) {
return(-1);
}
int
xmlIOFTPClose(void *context ATTRIBUTE_UNUSED) {
return(-1);
}
#endif /* #ifndef LIBXML_FTP_ENABLED */
/*
* xpointer.h
*/
#ifndef LIBXML_XPTR_LOCS_ENABLED
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <libxml/xpointer.h>
xmlXPathObjectPtr
xmlXPtrNewRange(xmlNodePtr start ATTRIBUTE_UNUSED,
int startindex ATTRIBUTE_UNUSED,
xmlNodePtr end ATTRIBUTE_UNUSED,
int endindex ATTRIBUTE_UNUSED) {
return(NULL);
}
xmlXPathObjectPtr
xmlXPtrNewRangePoints(xmlXPathObjectPtr start ATTRIBUTE_UNUSED,
xmlXPathObjectPtr end ATTRIBUTE_UNUSED) {
return(NULL);
}
xmlXPathObjectPtr
xmlXPtrNewRangePointNode(xmlXPathObjectPtr start ATTRIBUTE_UNUSED,
xmlNodePtr end ATTRIBUTE_UNUSED) {
return(NULL);
}
xmlXPathObjectPtr
xmlXPtrNewRangeNodePoint(xmlNodePtr start ATTRIBUTE_UNUSED,
xmlXPathObjectPtr end ATTRIBUTE_UNUSED) {
return(NULL);
}
xmlXPathObjectPtr
xmlXPtrNewRangeNodes(xmlNodePtr start ATTRIBUTE_UNUSED,
xmlNodePtr end ATTRIBUTE_UNUSED) {
return(NULL);
}
xmlXPathObjectPtr
xmlXPtrNewCollapsedRange(xmlNodePtr start ATTRIBUTE_UNUSED) {
return(NULL);
}
xmlXPathObjectPtr
xmlXPtrNewRangeNodeObject(xmlNodePtr start ATTRIBUTE_UNUSED,
xmlXPathObjectPtr end ATTRIBUTE_UNUSED) {
return(NULL);
}
xmlLocationSetPtr
xmlXPtrLocationSetCreate(xmlXPathObjectPtr val ATTRIBUTE_UNUSED) {
return(NULL);
}
void
xmlXPtrLocationSetAdd(xmlLocationSetPtr cur ATTRIBUTE_UNUSED,
xmlXPathObjectPtr val ATTRIBUTE_UNUSED) {
}
xmlLocationSetPtr
xmlXPtrLocationSetMerge(xmlLocationSetPtr val1 ATTRIBUTE_UNUSED,
xmlLocationSetPtr val2 ATTRIBUTE_UNUSED) {
return(NULL);
}
void
xmlXPtrLocationSetDel(xmlLocationSetPtr cur ATTRIBUTE_UNUSED,
xmlXPathObjectPtr val ATTRIBUTE_UNUSED) {
}
void
xmlXPtrLocationSetRemove(xmlLocationSetPtr cur ATTRIBUTE_UNUSED,
int val ATTRIBUTE_UNUSED) {
}
void
xmlXPtrFreeLocationSet(xmlLocationSetPtr obj ATTRIBUTE_UNUSED) {
}
xmlXPathObjectPtr
xmlXPtrNewLocationSetNodes(xmlNodePtr start ATTRIBUTE_UNUSED,
xmlNodePtr end ATTRIBUTE_UNUSED) {
return(NULL);
}
xmlXPathObjectPtr
xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set ATTRIBUTE_UNUSED) {
return(NULL);
}
xmlXPathObjectPtr
xmlXPtrWrapLocationSet(xmlLocationSetPtr val ATTRIBUTE_UNUSED) {
return(NULL);
}
xmlNodePtr
xmlXPtrBuildNodeList(xmlXPathObjectPtr obj ATTRIBUTE_UNUSED) {
return(NULL);
}
void
xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt,
int nargs ATTRIBUTE_UNUSED) {
XP_ERROR(XPATH_EXPR_ERROR);
}
#endif /* #ifndef LIBXML_XPTR_LOCS_ENABLED */
#endif /* LIBXML_LEGACY_ENABLED */ #endif /* LIBXML_LEGACY_ENABLED */