[xiph-commits] r9719 - icecast/branches/kh/icecast/src
karl at svn.xiph.org
karl at svn.xiph.org
Mon Aug 8 18:01:06 PDT 2005
Author: karl
Date: 2005-08-08 18:01:04 -0700 (Mon, 08 Aug 2005)
New Revision: 9719
Modified:
icecast/branches/kh/icecast/src/xslt.c
Log:
allow the use of a older libxslt on platforms other than win32
Modified: icecast/branches/kh/icecast/src/xslt.c
===================================================================
--- icecast/branches/kh/icecast/src/xslt.c 2005-08-08 19:21:54 UTC (rev 9718)
+++ icecast/branches/kh/icecast/src/xslt.c 2005-08-09 01:01:04 UTC (rev 9719)
@@ -30,14 +30,13 @@
#include <sys/stat.h>
#include <errno.h>
-#ifndef _WIN32
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-
-#ifdef WIN32
-#define snprintf _snprintf
-#endif
+#ifdef WIN32
+#define snprintf _snprintf
+#endif
#include "thread/thread.h"
#include "avl/avl.h"
@@ -63,41 +62,41 @@
xsltStylesheetPtr stylesheet;
} stylesheet_cache_t;
+#ifndef HAVE_XSLTSAVERESULTTOSTRING
+int xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len, xmlDocPtr result, xsltStylesheetPtr style) {
+ xmlOutputBufferPtr buf;
+
+ *doc_txt_ptr = NULL;
+ *doc_txt_len = 0;
+ if (result->children == NULL)
+ return(0);
+
+ buf = xmlAllocOutputBuffer(NULL);
+
+ if (buf == NULL)
+ return(-1);
+ xsltSaveResultTo(buf, result, style);
+ if (buf->conv != NULL) {
+ *doc_txt_len = buf->conv->use;
+ *doc_txt_ptr = xmlStrndup(buf->conv->content, *doc_txt_len);
+ } else {
+ *doc_txt_len = buf->buffer->use;
+ *doc_txt_ptr = xmlStrndup(buf->buffer->content, *doc_txt_len);
+ }
+ (void)xmlOutputBufferClose(buf);
+ return 0;
+}
+#endif
+
/* Keep it small... */
#define CACHESIZE 3
-
-#ifdef WIN32
-int xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len, xmlDocPtr result, xsltStylesheetPtr style) {
- xmlOutputBufferPtr buf;
-
- *doc_txt_ptr = NULL;
- *doc_txt_len = 0;
- if (result->children == NULL)
- return(0);
-
- buf = xmlAllocOutputBuffer(NULL);
-
- if (buf == NULL)
- return(-1);
- xsltSaveResultTo(buf, result, style);
- if (buf->conv != NULL) {
- *doc_txt_len = buf->conv->use;
- *doc_txt_ptr = xmlStrndup(buf->conv->content, *doc_txt_len);
- } else {
- *doc_txt_len = buf->buffer->use;
- *doc_txt_ptr = xmlStrndup(buf->buffer->content, *doc_txt_len);
- }
- (void)xmlOutputBufferClose(buf);
- return 0;
-}
-#endif
-stylesheet_cache_t cache[CACHESIZE];
-mutex_t xsltlock;
+static stylesheet_cache_t cache[CACHESIZE];
+static mutex_t xsltlock;
void xslt_initialize()
{
- xmlSubstituteEntitiesDefault(1);
+ xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
memset(cache, 0, sizeof(stylesheet_cache_t)*CACHESIZE);
More information about the commits
mailing list