[sword-cvs] sword/src/modules/common zverse.cpp,1.28,1.29
sword@www.crosswire.org
sword@www.crosswire.org
Tue, 25 Feb 2003 21:49:15 -0700
Update of /usr/local/cvsroot/sword/src/modules/common
In directory www:/tmp/cvs-serv32606/src/modules/common
Modified Files:
zverse.cpp
Log Message:
no message
Index: zverse.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/common/zverse.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** zverse.cpp 1 Oct 2002 19:52:40 -0000 1.28
--- zverse.cpp 26 Feb 2003 04:49:12 -0000 1.29
***************
*** 135,139 ****
*/
! void zVerse::findoffset(char testmt, long idxoff, long *start, unsigned short *size)
{
// set start to offset in
--- 135,139 ----
*/
! void zVerse::findOffset(char testmt, long idxoff, long *start, unsigned short *size)
{
// set start to offset in
***************
*** 263,273 ****
*/
! void zVerse::zreadtext(char testmt, long start, unsigned short size, char *inbuf)
! {
! memset(inbuf, 0, size);
! if (size > 2) {
if (cacheBuf)
! strncpy(inbuf, &(cacheBuf[start]), size-2);
}
}
--- 263,275 ----
*/
! void zVerse::zReadText(char testmt, long start, unsigned short size, SWBuf &inBuf) {
! inBuf = "";
! inBuf.setFillByte(0);
! inBuf.setSize(size+1);
! if (size > 0) {
if (cacheBuf)
! strncpy(inBuf.getRawData(), &(cacheBuf[start]), size);
}
+ inBuf.setSize(strlen(inBuf.c_str()));
}
***************
*** 282,286 ****
*/
! void zVerse::settext(char testmt, long idxoff, const char *buf, long len) {
len = (len < 0) ? strlen(buf) : len;
--- 284,288 ----
*/
! void zVerse::doSetText(char testmt, long idxoff, const char *buf, long len) {
len = (len < 0) ? strlen(buf) : len;
***************
*** 376,380 ****
*/
! void zVerse::linkentry(char testmt, long destidxoff, long srcidxoff) {
long bufidx;
long start;
--- 378,382 ----
*/
! void zVerse::doLinkEntry(char testmt, long destidxoff, long srcidxoff) {
long bufidx;
long start;
***************
*** 484,493 ****
*/
! void zVerse::preptext(char *buf)
! {
! char *to, *from, space = 0, cr = 0, realdata = 0, nlcnt = 0;
!
! for (to = from = buf; *from; from++) {
! switch (*from) {
case 10:
if (!realdata)
--- 486,494 ----
*/
! void zVerse::prepText(SWBuf &buf) {
! unsigned int to, from;
! char space = 0, cr = 0, realdata = 0, nlcnt = 0;
! for (to = from = 0; buf[from]; from++) {
! switch (buf[from]) {
case 10:
if (!realdata)
***************
*** 498,502 ****
if (nlcnt > 1) {
// *to++ = nl;
! *to++ = nl;
// nlcnt = 0;
}
--- 499,504 ----
if (nlcnt > 1) {
// *to++ = nl;
! buf[to++] = 10;
! // *to++ = nl[1];
// nlcnt = 0;
}
***************
*** 505,509 ****
if (!realdata)
continue;
! *to++ = nl;
space = 0;
cr = 1;
--- 507,512 ----
if (!realdata)
continue;
! // *to++ = nl[0];
! buf[to++] = 10;
space = 0;
cr = 1;
***************
*** 514,535 ****
if (space) {
space = 0;
! if (*from != ' ') {
! *to++ = ' ';
from--;
continue;
}
}
! *to++ = *from;
}
! *to = 0;
! if (to > buf) {
! for (to--; to > buf; to--) { // remove trailing excess
! if ((*to == 10) || (*to == ' '))
! *to = 0;
! else break;
! }
! }
}
SWORD_NAMESPACE_END
--- 517,538 ----
if (space) {
space = 0;
! if (buf[from] != ' ') {
! buf[to++] = ' ';
from--;
continue;
}
}
! buf[to++] = buf[from];
}
! buf.setSize(to);
! while (to > 1) { // remove trailing excess
! to--;
! if ((buf[to] == 10) || (buf[to] == ' '))
! buf.setSize(to);
! else break;
! }
}
+
SWORD_NAMESPACE_END