@@ -53,7 +53,7 @@ void handleGenericError(void *ctx, const char *fmt, ...){
5353 Rf_error ("%s" , buffer );
5454}
5555
56- #if LIBXML_VERSION >= 21500
56+ #if LIBXML_VERSION >= 21404
5757
5858static xmlExternalEntityLoader defaultLoader = NULL ;
5959
@@ -65,7 +65,10 @@ xmlParserInput *download_file_callback(const char *url){
6565 int err = 1 ;
6666 SEXP out = PROTECT (R_tryEvalSilent (call , env , & err ));
6767 if (err ) return NULL ;
68- xmlParserInputFlags flags = XML_INPUT_BUF_STATIC | XML_INPUT_USE_SYS_CATALOG ;
68+ xmlParserInputFlags flags = XML_INPUT_BUF_STATIC ;
69+ #if LIBXML_VERSION >= 21500
70+ flags |= XML_INPUT_USE_SYS_CATALOG
71+ #endif
6972 xmlParserInput * buf = xmlNewInputFromMemory (url , RAW (out ), Rf_length (out ), flags );
7073 //xmlParserInputBuffer *buf = xmlParserInputBufferCreateMem((char*) RAW(out), Rf_length(out), XML_CHAR_ENCODING_UTF8);
7174 UNPROTECT (4 );
@@ -96,7 +99,7 @@ void init_libxml2_library(void) {
9699 xmlSetGenericErrorFunc (NULL , handleGenericError );
97100
98101 // Set custom download callback
99- #if LIBXML_VERSION >= 21500
102+ #if LIBXML_VERSION >= 21404
100103 defaultLoader = xmlGetExternalEntityLoader ();
101104 xmlSetExternalEntityLoader (myExternalEntityLoader );
102105#endif
0 commit comments