Add long long support for printf-style functions.

This commit is contained in:
Michael R Sweet 2009-04-18 17:05:52 +00:00
parent fa33165459
commit 9ac6418218
6 changed files with 101 additions and 6 deletions

View File

@ -1,9 +1,10 @@
CHANGES - 2009-03-20
CHANGES - 2009-04-18
--------------------
CHANGES IN Mini-XML 2.6
- Documentation fixes (STR #91, STR #92)
- Added support for "long long" printf formats.
- The XML parser now rejects UTF-8 XML files that start with a BOM
(STR #89)
- The mxmldoc program now supports generating Xcode documentation

View File

@ -3,7 +3,7 @@
*
* Configuration file for Mini-XML, a small XML-like file parsing library.
*
* Copyright 2003-2007 by Michael Sweet.
* Copyright 2003-2009 by Michael Sweet.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -41,6 +41,13 @@
#define inline
/*
* Long long support...
*/
#undef HAVE_LONG_LONG
/*
* Do we have the snprintf() and vsnprintf() functions?
*/

61
configure vendored
View File

@ -3756,6 +3756,67 @@ done
fi
{ echo "$as_me:$LINENO: checking for long long int" >&5
echo $ECHO_N "checking for long long int... $ECHO_C" >&6; }
if test "${ac_cv_c_long_long+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$GCC" = yes; then
ac_cv_c_long_long=yes
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
long long int i;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_cv_c_long_long=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_c_long_long=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
fi
{ echo "$as_me:$LINENO: result: $ac_cv_c_long_long" >&5
echo "${ECHO_T}$ac_cv_c_long_long" >&6; }
if test $ac_cv_c_long_long = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_LONG_LONG 1
_ACEOF
fi
# Check whether --enable-threads was given.
if test "${enable_threads+set}" = set; then
enableval=$enable_threads;

View File

@ -3,7 +3,7 @@ dnl "$Id$"
dnl
dnl Configuration script for Mini-XML, a small XML-like file parsing library.
dnl
dnl Copyright 2003-2008 by Michael Sweet.
dnl Copyright 2003-2009 by Michael Sweet.
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
@ -106,6 +106,20 @@ if test "x$use_vsnprintf" != xyes; then
AC_CHECK_FUNCS(snprintf vsnprintf)
fi
dnl Check for "long long" support...
AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
[if test "$GCC" = yes; then
ac_cv_c_long_long=yes
else
AC_TRY_COMPILE(,[long long int i;],
ac_cv_c_long_long=yes,
ac_cv_c_long_long=no)
fi])
if test $ac_cv_c_long_long = yes; then
AC_DEFINE(HAVE_LONG_LONG)
fi
dnl Threading support
AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support])

View File

@ -3,7 +3,7 @@
*
* String functions for Mini-XML, a small XML-like file parsing library.
*
* Copyright 2003-2007 by Michael Sweet.
* Copyright 2003-2009 by Michael Sweet.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -287,6 +287,11 @@ _mxml_vsnprintf(char *buffer, /* O - Output buffer */
if ((width + 2) > sizeof(temp))
break;
#ifdef HAVE_LONG_LONG
if (size == 'L')
sprintf(temp, tformat, va_arg(ap, long long));
else
#endif /* HAVE_LONG_LONG */
sprintf(temp, tformat, va_arg(ap, int));
bytes += strlen(temp);

View File

@ -3,7 +3,7 @@
*
* Configuration file for Mini-XML, a small XML-like file parsing library.
*
* Copyright 2003-2008 by Michael Sweet.
* Copyright 2003-2009 by Michael Sweet.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -66,7 +66,7 @@
* Version number...
*/
#define MXML_VERSION "Mini-XML v2.4.1"
#define MXML_VERSION "Mini-XML v2.6"
/*
@ -76,6 +76,13 @@
#define inline _inline
/*
* Long long support...
*/
#define HAVE_LONG_LONG 1
/*
* Do we have the snprintf() and vsnprintf() functions?
*/