]> sjero.net Git - linphone/commitdiff
Fix lpc2xml for old libxml version
authorYann Diorcet <yann.diorcet@belledonne-communications.com>
Thu, 17 Jan 2013 09:57:59 +0000 (10:57 +0100)
committerYann Diorcet <yann.diorcet@belledonne-communications.com>
Thu, 17 Jan 2013 10:01:28 +0000 (11:01 +0100)
configure.ac
tools/lpc2xml.c
tools/lpc2xml.h

index dc411434a54c9582696e08e58da4fbe08c635d37..1d8f92278e81e4d598fb275a9eda0d3831ec3a9c 100644 (file)
@@ -150,7 +150,7 @@ AC_ARG_ENABLE(tools,
 
 dnl check libxml2 (needed for tools)
 if test "$build_tools" != "false" ; then
-       PKG_CHECK_MODULES(LIBXML2, [libxml-2.0 >= 2.9 ],[],
+       PKG_CHECK_MODULES(LIBXML2, [libxml-2.0],[],
        [
                if test "$build_tools" = "true" ; then
                        AC_MSG_ERROR([Could not found libxml2, tools cannot be compiled.])
index 12af75322d78519db36bd104354cb1086dd54eb5..feabdde2e4bf0473aa8e0f8c9d3a7ee8549cfa3e 100644 (file)
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "lpc2xml.h"
 #include <string.h>
 #include <libxml/xmlsave.h>
-
+#include <libxml/xmlversion.h>
 
 #define LPC2XML_BZ 2048
 
@@ -216,7 +216,7 @@ int lpc2xml_convert_fd(lpc2xml_context* context, int fd) {
        return ret;
 }
 
-int lpc2xml_convert_string(lpc2xml_context* context, unsigned char **content) {
+int lpc2xml_convert_string(lpc2xml_context* context, char **content) {
        int ret = 0;
        xmlBufferPtr buffer = xmlBufferCreate();
        xmlSaveCtxtPtr save_ctx = xmlSaveToBuffer(buffer, "UTF-8", XML_SAVE_FORMAT);
@@ -226,7 +226,11 @@ int lpc2xml_convert_string(lpc2xml_context* context, unsigned char **content) {
        }
        xmlSaveClose(save_ctx);
        if(ret == 0) {
-               *content = xmlBufferDetach(buffer);
+#if LIBXML_VERSION >= 20800
+               *content = (char *)xmlBufferDetach(buffer);
+#else
+               *content = strdup((const char *)xmlBufferContent(buffer));
+#endif
        }
        xmlBufferFree(buffer);
        return ret;
index f1583109b21159ce5da0de7bac6037218e9ce455..02540090749a93c93124bc9f369020bf44af78d1 100644 (file)
@@ -40,7 +40,7 @@ int lpc2xml_set_lpc(lpc2xml_context* context, const LpConfig *lpc);
 
 int lpc2xml_convert_file(lpc2xml_context* context, const char *filename);
 int lpc2xml_convert_fd(lpc2xml_context* context, int fd);
-int lpc2xml_convert_string(lpc2xml_context* context, unsigned char **content);
+int lpc2xml_convert_string(lpc2xml_context* context, char **content);
 
 
 #endif //LPC2XML_H_