[sword-svn] r2102 - in trunk: . include src/utilfuns
scribe at www.crosswire.org
scribe at www.crosswire.org
Mon Oct 8 11:17:45 MST 2007
Author: scribe
Date: 2007-10-08 11:17:44 -0700 (Mon, 08 Oct 2007)
New Revision: 2102
Modified:
trunk/configure.ac
trunk/include/config.h
trunk/include/swbuf.h
trunk/src/utilfuns/Makefile.am
trunk/src/utilfuns/swbuf.cpp
Log:
Added conditional define for NO_VSNPRINTF
Might need this on windows. Dunno if BCB has this method
or if it operates correctly with null dest string
Also bumped junkbuf up to 16K in case we need to default back
to dangerous code
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2007-10-07 20:37:43 UTC (rev 2101)
+++ trunk/configure.ac 2007-10-08 18:17:44 UTC (rev 2102)
@@ -220,6 +220,7 @@
use_clucene="yes"
fi
+AC_CHECK_FUNCS(vsnprintf, [have_vsnprintf="yes"])
# ---------------------------------------------------------------------
# Alter global conf directory only if not /etc
@@ -263,6 +264,7 @@
# ---------------------------------------------------------------------
# Conditional variables
# ---------------------------------------------------------------------
+AM_CONDITIONAL(HAVE_VSNPRINTF, test x$have_vsnprintf = xyes)
AM_CONDITIONAL(MINGW, test x$target_mingw32 = xyes)
AM_CONDITIONAL(ICU, test x$with_icu = xyes)
AM_CONDITIONAL(USELUCENE, test x$use_clucene = xyes)
Modified: trunk/include/config.h
===================================================================
--- trunk/include/config.h 2007-10-07 20:37:43 UTC (rev 2101)
+++ trunk/include/config.h 2007-10-08 18:17:44 UTC (rev 2102)
@@ -34,6 +34,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
/* Name of package */
#define PACKAGE "sword"
Modified: trunk/include/swbuf.h
===================================================================
--- trunk/include/swbuf.h 2007-10-07 20:37:43 UTC (rev 2101)
+++ trunk/include/swbuf.h 2007-10-08 18:17:44 UTC (rev 2102)
@@ -32,7 +32,7 @@
SWORD_NAMESPACE_START
-#define JUNKBUFSIZE 8191
+#define JUNKBUFSIZE 16383
/**
* This class is used as a transport and utility for data buffers.
Modified: trunk/src/utilfuns/Makefile.am
===================================================================
--- trunk/src/utilfuns/Makefile.am 2007-10-07 20:37:43 UTC (rev 2101)
+++ trunk/src/utilfuns/Makefile.am 2007-10-08 18:17:44 UTC (rev 2102)
@@ -1,4 +1,9 @@
+if HAVE_VSNPRINTF
+else
+CXXFLAGS += -DNO_VSNPRINTF
+endif
+
utilfunsdir = $(top_srcdir)/src/utilfuns
libsword_la_SOURCES += $(utilfunsdir)/swobject.cpp
libsword_la_SOURCES += $(utilfunsdir)/Greek2Greek.cpp
Modified: trunk/src/utilfuns/swbuf.cpp
===================================================================
--- trunk/src/utilfuns/swbuf.cpp 2007-10-07 20:37:43 UTC (rev 2101)
+++ trunk/src/utilfuns/swbuf.cpp 2007-10-08 18:17:44 UTC (rev 2102)
@@ -80,7 +80,11 @@
va_list argptr;
va_start(argptr, format);
+#ifdef NO_VSNPRINTF
int len = vsprintf(junkBuf, format, argptr)+1;
+#else
+ int len = vsnprintf(0, 0, format, argptr)+1;
+#endif
va_end(argptr);
assureSize(len);
va_start(argptr, format);
@@ -123,7 +127,11 @@
va_list argptr;
va_start(argptr, format);
+#ifdef NO_VSNPRINTF
int len = vsprintf(junkBuf, format, argptr)+1;
+#else
+ int len = vsnprintf(0, 0, format, argptr)+1;
+#endif
va_end(argptr);
assureMore(len);
va_start(argptr, format);
More information about the sword-cvs
mailing list