[sword-cvs] sword/src/utilfuns swbuf.cpp,1.6,1.7
sword@www.crosswire.org
sword@www.crosswire.org
Thu, 27 Feb 2003 16:34:25 -0700
Update of /usr/local/cvsroot/sword/src/utilfuns
In directory www:/tmp/cvs-serv18458/src/utilfuns
Modified Files:
swbuf.cpp
Log Message:
final updates to swbuf. works as expected.
Index: swbuf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/swbuf.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** swbuf.cpp 27 Feb 2003 19:14:32 -0000 1.6
--- swbuf.cpp 27 Feb 2003 23:34:22 -0000 1.7
***************
*** 32,41 ****
char SWBuf::junkBuf[JUNKBUFSIZE];
- /******************************************************************************
- * SWBuf Constructor - Creates an empty SWBuf object or an SWBuf initialized
- * to a value from a const char *
- *
- */
-
SWBuf::SWBuf(const char *initVal) {
if (initVal) {
--- 32,35 ----
***************
*** 77,93 ****
}
- /******************************************************************************
- * SWBuf Destructor - Cleans up instance of SWBuf
- */
-
SWBuf::~SWBuf() {
free(buf);
}
-
- /******************************************************************************
- * SWBuf::set - sets this buf to a new value
- */
-
void SWBuf::set(const char *newVal) {
unsigned int len = strlen(newVal) + 1;
--- 71,78 ----
***************
*** 98,117 ****
- /******************************************************************************
- * SWBuf::set - sets this buf to a new value
- */
-
void SWBuf::set(const SWBuf &newVal) {
unsigned int len = newVal.length() + 1;
assureSize(len);
! memcpy(buf, newVal.raw_buf(), len);
end = buf + (len-1);
}
- /******************************************************************************
- * SWBuf::append - appends a value to the current value of this SWBuf
- */
-
void SWBuf::append(const char *str) {
unsigned int len = strlen(str) + 1;
--- 83,94 ----
void SWBuf::set(const SWBuf &newVal) {
unsigned int len = newVal.length() + 1;
assureSize(len);
! memcpy(buf, newVal.c_str(), len);
end = buf + (len-1);
}
void SWBuf::append(const char *str) {
unsigned int len = strlen(str) + 1;
***************
*** 121,143 ****
}
-
- /******************************************************************************
- * SWBuf::append - appends a value to the current value of this SWBuf
- */
-
void SWBuf::append(const SWBuf &str) {
unsigned int len = str.length() + 1;
assureSize((end-buf)+len);
! memcpy(end, str.raw_buf(), len);
end += (len-1);
}
-
-
-
- /******************************************************************************
- * SWBuf::setSize - Size this buffer to a specific length
- */
-
void SWBuf::setSize(unsigned int len) {
assureSize(len+1);
--- 98,108 ----
}
void SWBuf::append(const SWBuf &str) {
unsigned int len = str.length() + 1;
assureSize((end-buf)+len);
! memcpy(end, str.c_str(), len);
end += (len-1);
}
void SWBuf::setSize(unsigned int len) {
assureSize(len+1);
***************
*** 145,155 ****
memset(end, fillByte, len - (end-buf));
end = buf + len;
! end[1] = 0;
}
-
-
-
-
-
// WARNING: This function can only write at most
--- 110,115 ----
memset(end, fillByte, len - (end-buf));
end = buf + len;
! *end = 0;
}
// WARNING: This function can only write at most