[sword-cvs] sword/src/modules/common rawverse.cpp,1.29,1.30
sword@www.crosswire.org
sword@www.crosswire.org
Mon, 24 Feb 2003 21:12:50 -0700
Update of /usr/local/cvsroot/sword/src/modules/common
In directory www:/tmp/cvs-serv2325/src/modules/common
Modified Files:
rawverse.cpp
Log Message:
no message
Index: rawverse.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/common/rawverse.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** rawverse.cpp 1 Oct 2002 19:52:40 -0000 1.29
--- rawverse.cpp 25 Feb 2003 04:12:47 -0000 1.30
***************
*** 107,111 ****
*/
! void RawVerse::findoffset(char testmt, long idxoff, long *start, unsigned short *size) {
idxoff *= 6;
if (!testmt)
--- 107,111 ----
*/
! void RawVerse::findOffset(char testmt, long idxoff, long *start, unsigned short *size) {
idxoff *= 6;
if (!testmt)
***************
*** 139,148 ****
*/
! void RawVerse::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)
--- 139,147 ----
*/
! void RawVerse::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)
***************
*** 153,157 ****
if (nlcnt > 1) {
// *to++ = nl;
! *to++ = 10;
// *to++ = nl[1];
// nlcnt = 0;
--- 152,156 ----
if (nlcnt > 1) {
// *to++ = nl;
! buf[to++] = 10;
// *to++ = nl[1];
// nlcnt = 0;
***************
*** 162,166 ****
continue;
// *to++ = nl[0];
! *to++ = 10;
space = 0;
cr = 1;
--- 161,165 ----
continue;
// *to++ = nl[0];
! buf[to++] = 10;
space = 0;
cr = 1;
***************
*** 171,188 ****
if (space) {
space = 0;
! if (*from != ' ') {
! *to++ = ' ';
from--;
continue;
}
}
! *to++ = *from;
}
! *to = 0;
! while (to > (buf+1)) { // remove trailing excess
to--;
! if ((*to == 10) || (*to == ' '))
! *to = 0;
else break;
}
--- 170,187 ----
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;
}
***************
*** 200,205 ****
*/
! void RawVerse::readtext(char testmt, long start, unsigned short size, char *buf) {
! memset(buf, 0, size);
if (!testmt)
testmt = ((idxfp[1]) ? 1:2);
--- 199,206 ----
*/
! void RawVerse::readText(char testmt, long start, unsigned short size, SWBuf &buf) {
! buf = "";
! buf.setFillByte(0);
! buf.setSize(size + 1);
if (!testmt)
testmt = ((idxfp[1]) ? 1:2);
***************
*** 207,211 ****
if (textfp[testmt-1]->getFd() >= 0) {
lseek(textfp[testmt-1]->getFd(), start, SEEK_SET);
! read(textfp[testmt-1]->getFd(), buf, (int)size - 2);
}
}
--- 208,212 ----
if (textfp[testmt-1]->getFd() >= 0) {
lseek(textfp[testmt-1]->getFd(), start, SEEK_SET);
! read(textfp[testmt-1]->getFd(), buf.getRawData(), (int)size);
}
}
***************
*** 222,226 ****
*/
! void RawVerse::settext(char testmt, long idxoff, const char *buf, long len)
{
long start, outstart;
--- 223,227 ----
*/
! void RawVerse::doSetText(char testmt, long idxoff, const char *buf, long len)
{
long start, outstart;
***************
*** 266,270 ****
*/
! void RawVerse::linkentry(char testmt, long destidxoff, long srcidxoff) {
long start;
unsigned short size;
--- 267,271 ----
*/
! void RawVerse::doLinkEntry(char testmt, long destidxoff, long srcidxoff) {
long start;
unsigned short size;