mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-13 07:53:23 -05:00
[pipe/mxml] Add compability with older versions of mxml
This commit is contained in:
parent
97aa544945
commit
b6f969d96e
@ -110,7 +110,7 @@ FORK_FUNC_REQUIRE([COMMON], [GNU libunistring], [LIBUNISTRING], [unistring],
|
||||
FORK_MODULES_CHECK([FORKED], [ZLIB], [zlib], [deflate], [zlib.h])
|
||||
FORK_MODULES_CHECK([FORKED], [CONFUSE], [libconfuse], [cfg_init], [confuse.h])
|
||||
FORK_MODULES_CHECK([FORKED], [MINIXML], [mxml], [mxmlNewElement], [mxml.h],
|
||||
[AC_CHECK_FUNCS([mxmlGetOpaque])])
|
||||
[AC_CHECK_FUNCS([mxmlGetOpaque] [mxmlGetText] [mxmlGetType] [mxmlGetFirstChild])])
|
||||
|
||||
dnl SQLite3 requires extra checks
|
||||
FORK_MODULES_CHECK([COMMON], [SQLITE3], [sqlite3 >= 3.5.0],
|
||||
|
@ -118,7 +118,7 @@ forked_daapd_SOURCES = main.c \
|
||||
$(MPD_SRC) \
|
||||
listener.c listener.h \
|
||||
commands.c commands.h \
|
||||
ffmpeg-compat.h \
|
||||
ffmpeg-compat.h mxml-compat.h \
|
||||
$(GPERF_SRC) \
|
||||
$(ANTLR_SRC)
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include <event2/buffer.h>
|
||||
#include <mxml.h>
|
||||
|
||||
#include "input.h"
|
||||
#include "misc.h"
|
||||
#include "logger.h"
|
||||
#include "db.h"
|
||||
@ -54,7 +55,7 @@
|
||||
#include "listener.h"
|
||||
#include "player.h"
|
||||
#include "worker.h"
|
||||
#include "input.h"
|
||||
#include "mxml-compat.h"
|
||||
|
||||
// Maximum number of pipes to watch for data
|
||||
#define PIPE_MAX_WATCH 4
|
||||
|
20
src/lastfm.c
20
src/lastfm.c
@ -35,6 +35,8 @@
|
||||
#include <event2/http.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
#include "mxml-compat.h"
|
||||
|
||||
#include "db.h"
|
||||
#include "lastfm.h"
|
||||
#include "logger.h"
|
||||
@ -215,24 +217,6 @@ param_sign(struct keyval *kv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* For compability with mxml 2.6 */
|
||||
#ifndef HAVE_MXMLGETOPAQUE
|
||||
const char * /* O - Opaque string or NULL */
|
||||
mxmlGetOpaque(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
if (!node)
|
||||
return (NULL);
|
||||
|
||||
if (node->type == MXML_OPAQUE)
|
||||
return (node->value.opaque);
|
||||
else if (node->type == MXML_ELEMENT &&
|
||||
node->child &&
|
||||
node->child->type == MXML_OPAQUE)
|
||||
return (node->child->value.opaque);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* --------------------------------- MAIN --------------------------------- */
|
||||
|
||||
|
58
src/mxml-compat.h
Normal file
58
src/mxml-compat.h
Normal file
@ -0,0 +1,58 @@
|
||||
#ifndef __MXML_COMPAT_H__
|
||||
#define __MXML_COMPAT_H__
|
||||
|
||||
/* For compability with mxml 2.6 */
|
||||
#ifndef HAVE_MXMLGETTEXT
|
||||
static const char * /* O - Text string or NULL */
|
||||
mxmlGetText(mxml_node_t *node, /* I - Node to get */
|
||||
int *whitespace) /* O - 1 if string is preceded by whitespace, 0 otherwise */
|
||||
{
|
||||
if (node->type == MXML_TEXT)
|
||||
return (node->value.text.string);
|
||||
else if (node->type == MXML_ELEMENT &&
|
||||
node->child &&
|
||||
node->child->type == MXML_TEXT)
|
||||
return (node->child->value.text.string);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MXMLGETOPAQUE
|
||||
const char * /* O - Opaque string or NULL */
|
||||
mxmlGetOpaque(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
if (!node)
|
||||
return (NULL);
|
||||
|
||||
if (node->type == MXML_OPAQUE)
|
||||
return (node->value.opaque);
|
||||
else if (node->type == MXML_ELEMENT &&
|
||||
node->child &&
|
||||
node->child->type == MXML_OPAQUE)
|
||||
return (node->child->value.opaque);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MXMLGETFIRSTCHILD
|
||||
static mxml_node_t * /* O - First child or NULL */
|
||||
mxmlGetFirstChild(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
if (!node || node->type != MXML_ELEMENT)
|
||||
return (NULL);
|
||||
|
||||
return (node->child);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MXMLGETTYPE
|
||||
static mxml_type_t /* O - Type of node */
|
||||
mxmlGetType(mxml_node_t *node) /* I - Node to get */
|
||||
{
|
||||
return (node->type);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !__MXML_COMPAT_H__ */
|
Loading…
Reference in New Issue
Block a user