[sword-cvs] sword/src/utilfuns swbuf.cpp,1.1,1.2
sword@www.crosswire.org
sword@www.crosswire.org
Thu, 20 Feb 2003 00:25:22 -0700
Update of /usr/local/cvsroot/sword/src/utilfuns
In directory www:/tmp/cvs-serv18313/src/utilfuns
Modified Files:
swbuf.cpp
Log Message:
Started HUGE task of moving all char **buf over to SWBuf &buf
NEED YOUR HELP
Index: swbuf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/swbuf.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** swbuf.cpp 20 Feb 2003 03:12:37 -0000 1.1
--- swbuf.cpp 20 Feb 2003 07:25:20 -0000 1.2
***************
*** 24,31 ****
--- 24,34 ----
#include <string.h>
#include <stdlib.h>
+ #include <stdarg.h>
+ #include <stdio.h>
SWORD_NAMESPACE_START
char *SWBuf::nullStr = "";
+ char SWBuf::junkBuf[JUNKBUFSIZE];
/******************************************************************************
***************
*** 153,156 ****
--- 156,171 ----
}
+
+ // WARNING: This function can only write at most
+ // JUNKBUFSIZE to the string per call.
+ void SWBuf::appendFormatted(const char *format, ...) {
+ va_list argptr;
+
+ va_start(argptr, format);
+ int len = vsprintf(junkBuf, format, argptr);
+ assureSize((end-buf)+len);
+ end += vsprintf(end, format, argptr);
+ va_end(argptr);
+ }
SWORD_NAMESPACE_END