Skip to content

Commit

Permalink
Issue 55 changes to make xml package work on OS X 10.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred McCann authored and jbowtie committed Oct 3, 2014
1 parent 4955df2 commit 3b759eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ _*
*.o
libxml/test/ctest/test
.DS_Store
test_output.txt
test_output.txt
.jank
jank.yml
16 changes: 8 additions & 8 deletions xml/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ int close_callback(void * ctx) {
}

xmlDoc* newEmptyXmlDoc() {
return xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION);
return xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION);
}

xmlElementType getNodeType(xmlNode *node) { return node->type; }

void xmlFreeChars(char *buffer) {
void xmlFreeChars(char *buffer) {
if (buffer) {
xmlFree((xmlChar*)buffer);
xmlFree((xmlChar*)buffer);
}
}

Expand All @@ -44,7 +44,7 @@ xmlDoc* xmlParse(void *buffer, int buffer_len, void *url, void *encoding, int op
const char *c_url = (char*)url;
const char *c_encoding = (char*)encoding;
xmlDoc *doc = NULL;

xmlResetLastError();
doc = xmlReadMemory(c_buffer, buffer_len, c_url, c_encoding, options);

Expand Down Expand Up @@ -77,7 +77,7 @@ xmlNode* xmlParseFragment(void *doc, void *buffer, int buffer_len, void *url, in
}
printf("errorcode %d\n", errCode);
return NULL;
}
}
return root_element;
}

Expand All @@ -101,7 +101,7 @@ void xmlSetContent(void *gonode, void *n, void *content) {
xmlNode *node = (xmlNode*)n;
xmlNode *child = node->children;
xmlNode *next = NULL;
char *encoded = xmlEncodeSpecialChars(node->doc, content);
unsigned char *encoded = xmlEncodeSpecialChars(node->doc, content);
if (encoded) {
while (child) {
next = child->next ;
Expand All @@ -124,15 +124,15 @@ int xmlUnlinkNodeWithCheck(xmlNode *node) {
}

int xmlNodePtrCheck(void *node) {
if (node == (void*)(-1))
if (node == (void*)(-1))
return 0;
return 1;
}

int xmlSaveNode(void *wbuffer, void *node, void *encoding, int options) {
xmlSaveCtxtPtr savectx;
const char *c_encoding = (char*)encoding;

savectx = xmlSaveToIO(
(xmlOutputWriteCallback)xml_write_callback,
(xmlOutputCloseCallback)close_callback,
Expand Down
2 changes: 2 additions & 0 deletions xml/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ char *htmlDocDumpToString(xmlDoc *doc, int format);
void xmlFreeChars(char *buffer);
int xmlUnlinkNodeWithCheck(xmlNode *node);
int xmlNodePtrCheck(void *node);
void xmlNodeWriteCallback(void *buffer, void *data, int data_len);
void xmlUnlinkNodeCallback(void *nodePtr, void *gonodePtr);

typedef struct XmlBufferContext {
void *obj;
Expand Down

0 comments on commit 3b759eb

Please sign in to comment.