From d7627fbf78ee906051ad54247b49c8da12fcc3a4 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Mon, 4 Nov 2002 17:04:59 +0000 Subject: remove the use of snprintf, and use libxml2 string API instead. try to * xsltproc/xsltproc.c: remove the use of snprintf, and use libxml2 string API instead. * configure.in libxslt/xsltconfig.h.in libxslt/xsltutils.c: try to cope with architecture lacking some of the string functions, reuse the trio ones compiled in libxml2 , should close #97113 Daniel --- ChangeLog | 8 ++++++++ config.h.in | 24 ++++++++++++++++++++++++ configure.in | 15 +++++++++++++++ libxslt/xsltconfig.h.in | 12 ++++++++++++ libxslt/xsltutils.c | 4 ++++ xsltproc/xsltproc.c | 6 +++--- 6 files changed, 66 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 635abfd2..1a95c7ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon Nov 4 06:55:36 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: remove the use of snprintf, and use + libxml2 string API instead. + * configure.in libxslt/xsltconfig.h.in libxslt/xsltutils.c: + try to cope with architecture lacking some of the string functions, + reuse the trio ones compiled in libxml2 , should close #97113 + Wed Oct 23 17:06:24 CEST 2002 Daniel Veillard * Makefile.am libxslt.spec.in doc/Makefile.am: cleaned up diff --git a/config.h.in b/config.h.in index bd8456bf..d7f6ba85 100644 --- a/config.h.in +++ b/config.h.in @@ -18,6 +18,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_FLOAT_H +/* Define to 1 if you have the `fprintf' function. */ +#undef HAVE_FPRINTF + /* Define to 1 if you have the header file. */ #undef HAVE_FP_CLASS_H @@ -51,6 +54,18 @@ /* Define to 1 if you have the header file. */ #undef HAVE_NAN_H +/* Define to 1 if you have the `printf' function. */ +#undef HAVE_PRINTF + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the `sprintf' function. */ +#undef HAVE_SPRINTF + +/* Define to 1 if you have the `sscanf' function. */ +#undef HAVE_SSCANF + /* Define to 1 if you have the `stat' function. */ #undef HAVE_STAT @@ -90,6 +105,15 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the `vfprintf' function. */ +#undef HAVE_VFPRINTF + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define to 1 if you have the `vsprintf' function. */ +#undef HAVE_VSPRINTF + /* Define to 1 if you have the `_stat' function. */ #undef HAVE__STAT diff --git a/configure.in b/configure.in index d7b21aa0..2c6f4801 100644 --- a/configure.in +++ b/configure.in @@ -121,6 +121,21 @@ AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs, AC_CHECK_FUNCS(gettimeofday) AC_CHECK_FUNCS(mktime localtime asctime time gmtime ftime) +dnl Checking the standard string functions availability +AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,, + NEED_TRIO=1) +dnl +dnl Check for trio string functions +dnl + +if test "${NEED_TRIO}" = "1" ; then + echo Reusing trio library for string functions + WITH_TRIO=1 +else + WITH_TRIO=0 +fi +AC_SUBST(WITH_TRIO) + dnl dnl Perl is just needed for generating some data for XSLtmark dnl diff --git a/libxslt/xsltconfig.h.in b/libxslt/xsltconfig.h.in index 6cff68a8..cbaa61a4 100644 --- a/libxslt/xsltconfig.h.in +++ b/libxslt/xsltconfig.h.in @@ -65,6 +65,18 @@ extern "C" { #define DEBUG_MEMORY_LOCATION #endif +/** + * XSLT_NEED_TRIO: + * + * should be activated in the existing libc library lacks some of the + * string formatting function, in that case reuse the Trio ones already + * compiled in the libxml2 library. + */ + +#if @WITH_TRIO@ +#define XSLT_NEED_TRIO +#endif + /** * WITH_XSLT_DEBUGGER: * diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c index a1914ccb..829de483 100644 --- a/libxslt/xsltutils.c +++ b/libxslt/xsltutils.c @@ -254,6 +254,10 @@ xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) { * * ************************************************************************/ +#ifdef XSLT_NEED_TRIO +#define vsnprintf trio_vsnprintf +#endif + #define XSLT_GET_VAR_STR(msg, str) { \ int size; \ int chars; \ diff --git a/xsltproc/xsltproc.c b/xsltproc/xsltproc.c index 2db74f20..09b239ff 100644 --- a/xsltproc/xsltproc.c +++ b/xsltproc/xsltproc.c @@ -175,10 +175,10 @@ xsltprocExternalEntityLoader(const char *URL, const char *ID, xmlChar *newURL; int len; - len = xmlStrlen(paths[i]) + xmlStrlen(BAD_CAST URL) + 5; - newURL = xmlMalloc(len); + newURL = xmlStrdup((const xmlChar *) paths[i]); + newURL = xmlStrcat(newURL, (const xmlChar *) "/"); + newURL = xmlStrcat(newURL, (const xmlChar *) URL); if (newURL != NULL) { - snprintf(newURL, len, "%s/%s", paths[i], URL); ret = defaultEntityLoader((const char *)newURL, ID, ctxt); xmlFree(newURL); if (ret != NULL) { -- cgit v1.2.3