Commit 1b243b4f authored by Daniel Veillard's avatar Daniel Veillard
Browse files

applied patch from Rob Richards for the per thread I/O mappings Daniel

* globals.c xmlIO.c include/libxml/globals.h include/libxml/xmlIO.h:
  applied patch from Rob Richards for the per thread I/O mappings
Daniel
parent abf598b5
Tue Jun 8 12:14:16 CEST 2004 Daniel Veillard <daniel@veillard.com>
* globals.c xmlIO.c include/libxml/globals.h include/libxml/xmlIO.h:
applied patch from Rob Richards for the per thread I/O mappings
Tue Jun 8 09:58:31 HKT 2004 William Brack <wbrack@mmm.com.hk>
 
* xinclude.c: some further enhancement to take care of
......
......@@ -650,23 +650,6 @@ xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
return(old);
}
/**
* xmlParserInputBufferCreateFilename:
* @func: function pointer to the new ParserInputBufferCreateFilenameFunc
*
* Registers a callback for URI input file handling
*
* Returns the old value of the registration function
*/
xmlParserInputBufferCreateFilenameFunc
xmlParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
{
xmlParserInputBufferCreateFilenameFunc old = xmlParserInputBufferCreateFilenameValue;
xmlParserInputBufferCreateFilenameValue = func;
return(old);
}
xmlParserInputBufferCreateFilenameFunc
xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
{
......@@ -674,30 +657,16 @@ xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilena
xmlMutexLock(xmlThrDefMutex);
old = xmlParserInputBufferCreateFilenameValueThrDef;
if (old == NULL) {
old = __xmlParserInputBufferCreateFilename;
}
xmlParserInputBufferCreateFilenameValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
return(old);
}
/**
* xmlOutputBufferCreateFilename:
* @func: function pointer to the new OutputBufferCreateFilenameFunc
*
* Registers a callback for URI output file handling
*
* Returns the old value of the registration function
*/
xmlOutputBufferCreateFilenameFunc
xmlOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
{
xmlOutputBufferCreateFilenameFunc old = xmlOutputBufferCreateFilenameValue;
xmlOutputBufferCreateFilenameValue = func;
return(old);
}
xmlOutputBufferCreateFilenameFunc
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
{
......@@ -705,7 +674,11 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun
xmlMutexLock(xmlThrDefMutex);
old = xmlOutputBufferCreateFilenameValueThrDef;
#ifdef LIBXML_OUTPUT_ENABLED
if (old == NULL) {
old = __xmlOutputBufferCreateFilename;
}
#endif
xmlOutputBufferCreateFilenameValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
......@@ -1071,4 +1044,3 @@ __xmlOutputBufferCreateFilenameValue(void) {
else
return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
}
......@@ -69,9 +69,6 @@ XMLPUBFUN void XMLCALL xmlCleanupGlobals(void);
typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node);
typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, xmlCharEncoding enc);
typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression);
typedef struct _xmlGlobalState xmlGlobalState;
typedef xmlGlobalState *xmlGlobalStatePtr;
struct _xmlGlobalState
......@@ -139,11 +136,10 @@ XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNo
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL xmlParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL xmlOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func);
/** DOC_DISABLE */
/*
......
......@@ -62,6 +62,9 @@ typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
*/
typedef int (*xmlInputCloseCallback) (void * context);
typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, xmlCharEncoding enc);
typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression);
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Those are the functions and datatypes for the library output
......@@ -206,6 +209,16 @@ XMLPUBFUN int XMLCALL
xmlInputOpenCallback openFunc,
xmlInputReadCallback readFunc,
xmlInputCloseCallback closeFunc);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL
xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
xmlParserInputBufferPtr
__xmlParserInputBufferCreateFilename(const char *URI,
xmlCharEncoding enc);
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Interfaces for output
......@@ -258,6 +271,11 @@ XMLPUBFUN int XMLCALL
xmlOutputOpenCallback openFunc,
xmlOutputWriteCallback writeFunc,
xmlOutputCloseCallback closeFunc);
xmlOutputBufferPtr
__xmlOutputBufferCreateFilename(const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression);
#endif /* LIBXML_OUTPUT_ENABLED */
/* This function only exists if HTTP support built into the library */
......
......@@ -2125,7 +2125,7 @@ xmlOutputBufferClose(xmlOutputBufferPtr out)
}
#endif /* LIBXML_OUTPUT_ENABLED */
static xmlParserInputBufferPtr
xmlParserInputBufferPtr
__xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
int i = 0;
......@@ -2205,7 +2205,7 @@ xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
}
#ifdef LIBXML_OUTPUT_ENABLED
static xmlOutputBufferPtr
xmlOutputBufferPtr
__xmlOutputBufferCreateFilename(const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression ATTRIBUTE_UNUSED) {
......@@ -2598,6 +2598,47 @@ xmlOutputBufferCreateIO(xmlOutputWriteCallback iowrite,
}
#endif /* LIBXML_OUTPUT_ENABLED */
/**
* xmlParserInputBufferCreateFilenameDefault:
* @func: function pointer to the new ParserInputBufferCreateFilenameFunc
*
* Registers a callback for URI input file handling
*
* Returns the old value of the registration function
*/
xmlParserInputBufferCreateFilenameFunc
xmlParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
{
xmlParserInputBufferCreateFilenameFunc old = xmlParserInputBufferCreateFilenameValue;
if (old == NULL) {
old = __xmlParserInputBufferCreateFilename;
}
xmlParserInputBufferCreateFilenameValue = func;
return(old);
}
/**
* xmlOutputBufferCreateFilenameDefault:
* @func: function pointer to the new OutputBufferCreateFilenameFunc
*
* Registers a callback for URI output file handling
*
* Returns the old value of the registration function
*/
xmlOutputBufferCreateFilenameFunc
xmlOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
{
xmlOutputBufferCreateFilenameFunc old = xmlOutputBufferCreateFilenameValue;
#ifdef LIBXML_OUTPUT_ENABLED
if (old == NULL) {
old = __xmlOutputBufferCreateFilename;
}
#endif
xmlOutputBufferCreateFilenameValue = func;
return(old);
}
/**
* xmlParserInputBufferPush:
* @in: a buffered parser input
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment