X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Flibxml2_error.c;h=fe1f978c2faf8aaaf3fc033014bd6c8e9e780f27;hb=30be9a32fd26a2d08aa4413942408500c93ad4a3;hp=3241a63956ef192daa008372b807f1f84b431b1d;hpb=27481680fb1a69456e789e5bc8e1ec914337287d;p=yaz-moved-to-github.git diff --git a/src/libxml2_error.c b/src/libxml2_error.c index 3241a63..fe1f978 100644 --- 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-2009 Index Data * 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 @@ -12,18 +10,20 @@ #include #include #include +#include #include -#if HAVE_XML2 +#if YAZ_HAVE_XML2 #include #endif -#if HAVE_XSLT +#if YAZ_HAVE_XSLT #include #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]; @@ -31,24 +31,21 @@ static void proxy_xml_error_handler(void *ctx, const char *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); } +#endif 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 -#if HAVE_XML2 - xmlSetGenericErrorFunc((void *) "XML", proxy_xml_error_handler); return 0; #else return -1; @@ -58,6 +55,7 @@ int libxml2_error_to_yazlog(int level, const char *lead_msg) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab