projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed type to avoid warning
[yaz-moved-to-github.git]
/
src
/
libxml2_error.c
diff --git
a/src/libxml2_error.c
b/src/libxml2_error.c
index
3241a63
..
d7abcf8
100644
(file)
--- a/
src/libxml2_error.c
+++ b/
src/libxml2_error.c
@@
-1,8
+1,6
@@
-/*
- * Copyright (C) 2006, Index Data ApS
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2008 Index Data
* See the file LICENSE for details.
* See the file LICENSE for details.
- *
- * $Id: libxml2_error.c,v 1.1 2006-05-07 17:45:41 adam Exp $
*/
/**
* \file libxml2_error.c
*/
/**
* \file libxml2_error.c
@@
-12,18
+10,20
@@
#include <stdlib.h>
#include <stdarg.h>
#include <yaz/log.h>
#include <stdlib.h>
#include <stdarg.h>
#include <yaz/log.h>
+#include <yaz/snprintf.h>
#include <yaz/libxml2_error.h>
#include <yaz/libxml2_error.h>
-#if HAVE_XML2
+#if YAZ_HAVE_XML2
#include <libxml/xmlerror.h>
#endif
#include <libxml/xmlerror.h>
#endif
-#if HAVE_XSLT
+#if YAZ_HAVE_XSLT
#include <libxslt/xsltutils.h>
#endif
static int libxml2_error_level = 0;
#include <libxslt/xsltutils.h>
#endif
static int libxml2_error_level = 0;
+#if YAZ_HAVE_XML2
static void proxy_xml_error_handler(void *ctx, const char *fmt, ...)
{
char buf[1024];
static void proxy_xml_error_handler(void *ctx, const char *fmt, ...)
{
char buf[1024];
@@
-31,24
+31,21
@@
static void proxy_xml_error_handler(void *ctx, const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
va_list ap;
va_start(ap, fmt);
-#ifdef WIN32
- vsprintf(buf, fmt, ap);
-#else
- vsnprintf(buf, sizeof(buf), fmt, ap);
-#endif
+ yaz_vsnprintf(buf, sizeof(buf)-1, fmt, ap);
yaz_log(libxml2_error_level, "%s: %s", (char*) ctx, buf);
va_end (ap);
}
yaz_log(libxml2_error_level, "%s: %s", (char*) ctx, buf);
va_end (ap);
}
+#endif
int libxml2_error_to_yazlog(int level, const char *lead_msg)
{
libxml2_error_level = level;
int libxml2_error_to_yazlog(int level, const char *lead_msg)
{
libxml2_error_level = level;
-#if HAVE_XSLT
+#if YAZ_HAVE_XML2
+ xmlSetGenericErrorFunc((void *) "XML", proxy_xml_error_handler);
+#if YAZ_HAVE_XSLT
xsltSetGenericErrorFunc((void *) "XSLT", proxy_xml_error_handler);
#endif
xsltSetGenericErrorFunc((void *) "XSLT", proxy_xml_error_handler);
#endif
-#if HAVE_XML2
- xmlSetGenericErrorFunc((void *) "XML", proxy_xml_error_handler);
return 0;
#else
return -1;
return 0;
#else
return -1;