Skip to content

Commit eee310d

Browse files
committed
Enable the myExternalEntityLoader also on libxml 2.14.4 for MacOS
1 parent 95a8da3 commit eee310d

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: xml2
22
Title: Parse XML
3-
Version: 1.5.1.9000
3+
Version: 1.5.2
44
Authors@R: c(
55
person("Hadley", "Wickham", role = "aut"),
66
person("Jim", "Hester", role = "aut"),

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# xml2 1.5.2
2+
3+
* Enable the myExternalEntityLoader also on libxml 2.14.4 for MacOS
4+
15
# xml2 1.5.1
26

37
* Avoid shared libxml2 on MacOS because this reveals bugs in R.app (#471)

src/xml2_init.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

5858
static 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

Comments
 (0)