[sword-cvs] sword/src/utilfuns swbuf.cpp,1.11,1.12

sword@www.crosswire.org sword@www.crosswire.org
Thu, 17 Jul 2003 16:20:43 -0700


Update of /usr/local/cvsroot/sword/src/utilfuns
In directory www:/tmp/cvs-serv8769/src/utilfuns

Modified Files:
	swbuf.cpp 
Log Message:


Index: swbuf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/swbuf.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- swbuf.cpp	16 Jul 2003 12:26:09 -0000	1.11
+++ swbuf.cpp	17 Jul 2003 23:20:41 -0000	1.12
@@ -35,7 +35,7 @@
 * 		to a value from a const char *
 *
 */
-SWBuf::SWBuf(const char *initVal, unsigned int initSize) {
+SWBuf::SWBuf(const char *initVal, unsigned long initSize) {
 	init(initSize);
 	set(initVal);
 }
@@ -45,7 +45,7 @@
 * 		to a value from another SWBuf
 *
 */
-SWBuf::SWBuf(const SWBuf &other, unsigned int initSize) {
+SWBuf::SWBuf(const SWBuf &other, unsigned long initSize) {
 	init(initSize);
 	set(other);
 }
@@ -55,7 +55,7 @@
 * 		to a value from a char
 *
 */
-SWBuf::SWBuf(char initVal, unsigned int initSize) {
+SWBuf::SWBuf(char initVal, unsigned long initSize) {
 	init(initSize);
 
 	allocSize = 15;
@@ -65,7 +65,7 @@
 	endAlloc = buf + allocSize-1;
 }
 
-void SWBuf::init(unsigned int initSize) {
+void SWBuf::init(unsigned long initSize) {
 	fillByte = ' ';
 	allocSize = 0;
 	endAlloc = 0;
@@ -88,7 +88,7 @@
 */
 void SWBuf::set(const char *newVal) {
 	if (newVal) {
-		unsigned int len = strlen(newVal) + 1;
+		unsigned long len = strlen(newVal) + 1;
 		assureSize(len);
 		memcpy(buf, newVal, len);
 		end = buf + (len - 1);
@@ -105,7 +105,7 @@
 * SWBuf::set - sets this buf to a new value
 */
 void SWBuf::set(const SWBuf &newVal) {
-	unsigned int len = newVal.length() + 1;
+	unsigned long len = newVal.length() + 1;
 	assureSize(len);
 	memcpy(buf, newVal.c_str(), len);
 	end = buf + (len-1);
@@ -115,11 +115,9 @@
 /******************************************************************************
 * SWBuf::append - appends a value to the current value of this SWBuf
 */
-void SWBuf::append(const char *str, int max) {
-	unsigned int len = strlen(str) + 1;
-	if ((max > -1) && (len > max + 1))
-		len = max + 1;
-	assureMore(len);
+void SWBuf::append(const char *str, long max) {
+	unsigned long len = (max > -1) ? max : strlen(str);
+	assureMore(++len);
 	memcpy(end, str, len-1);
 	end += (len-1);
 	*end = 0;
@@ -129,7 +127,7 @@
 /******************************************************************************
 * SWBuf::setSize - Size this buffer to a specific length
 */
-void SWBuf::setSize(unsigned int len) {
+void SWBuf::setSize(unsigned long len) {
 	assureSize(len+1);
 	if ((end - buf) < len)
 		memset(end, fillByte, len - (end-buf));