[sword-cvs] sword/src/modules/common rawstr.cpp,1.39,1.40 rawstr4.cpp,1.21,1.22 rawverse.cpp,1.31,1.32 zstr.cpp,1.20,1.21 zverse.cpp,1.30,1.31
sword@www.crosswire.org
sword@www.crosswire.org
Wed, 16 Jul 2003 05:26:11 -0700
Update of /usr/local/cvsroot/sword/src/modules/common
In directory www:/tmp/cvs-serv24686/src/modules/common
Modified Files:
rawstr.cpp rawstr4.cpp rawverse.cpp zstr.cpp zverse.cpp
Log Message:
Some very small optimizations
Index: rawstr.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/common/rawstr.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- rawstr.cpp 27 Jun 2003 01:41:07 -0000 1.39
+++ rawstr.cpp 16 Jul 2003 12:26:09 -0000 1.40
@@ -272,8 +272,9 @@
void RawStr::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]) {
+ char *rawBuf = buf.getRawData();
+ for (to = from = 0; rawBuf[from]; from++) {
+ switch (rawBuf[from]) {
case 10:
if (!realdata)
continue;
@@ -282,7 +283,7 @@
nlcnt++;
if (nlcnt > 1) {
// *to++ = nl;
- buf[to++] = 10;
+ rawBuf[to++] = 10;
// *to++ = nl[1];
// nlcnt = 0;
}
@@ -291,7 +292,7 @@
if (!realdata)
continue;
// *to++ = nl[0];
- buf[to++] = 10;
+ rawBuf[to++] = 10;
space = 0;
cr = 1;
continue;
@@ -300,19 +301,19 @@
nlcnt = 0;
if (space) {
space = 0;
- if (buf[from] != ' ') {
- buf[to++] = ' ';
+ if (rawBuf[from] != ' ') {
+ rawBuf[to++] = ' ';
from--;
continue;
}
}
- buf[to++] = buf[from];
+ rawBuf[to++] = rawBuf[from];
}
buf.setSize(to);
while (to > 1) { // remove trailing excess
to--;
- if ((buf[to] == 10) || (buf[to] == ' '))
+ if ((rawBuf[to] == 10) || (rawBuf[to] == ' '))
buf.setSize(to);
else break;
}
Index: rawstr4.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/common/rawstr4.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- rawstr4.cpp 27 Jun 2003 01:41:07 -0000 1.21
+++ rawstr4.cpp 16 Jul 2003 12:26:09 -0000 1.22
@@ -276,12 +276,12 @@
* text.
*/
-void RawStr4::prepText(SWBuf &buf)
-{
+void RawStr4::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]) {
+ char *rawBuf = buf.getRawData();
+ for (to = from = 0; rawBuf[from]; from++) {
+ switch (rawBuf[from]) {
case 10:
if (!realdata)
continue;
@@ -290,7 +290,7 @@
nlcnt++;
if (nlcnt > 1) {
// *to++ = nl;
- buf[to++] = 10;
+ rawBuf[to++] = 10;
// *to++ = nl[1];
// nlcnt = 0;
}
@@ -299,7 +299,7 @@
if (!realdata)
continue;
// *to++ = nl[0];
- buf[to++] = 10;
+ rawBuf[to++] = 10;
space = 0;
cr = 1;
continue;
@@ -308,19 +308,19 @@
nlcnt = 0;
if (space) {
space = 0;
- if (buf[from] != ' ') {
- buf[to++] = ' ';
+ if (rawBuf[from] != ' ') {
+ rawBuf[to++] = ' ';
from--;
continue;
}
}
- buf[to++] = buf[from];
+ rawBuf[to++] = rawBuf[from];
}
buf.setSize(to);
while (to > 1) { // remove trailing excess
to--;
- if ((buf[to] == 10) || (buf[to] == ' '))
+ if ((rawBuf[to] == 10) || (rawBuf[to] == ' '))
buf.setSize(to);
else break;
}
Index: rawverse.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/common/rawverse.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- rawverse.cpp 27 Jun 2003 01:41:07 -0000 1.31
+++ rawverse.cpp 16 Jul 2003 12:26:09 -0000 1.32
@@ -140,8 +140,9 @@
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]) {
+ char *rawBuf = buf.getRawData();
+ for (to = from = 0; rawBuf[from]; from++) {
+ switch (rawBuf[from]) {
case 10:
if (!realdata)
continue;
@@ -150,7 +151,7 @@
nlcnt++;
if (nlcnt > 1) {
// *to++ = nl;
- buf[to++] = 10;
+ rawBuf[to++] = 10;
// *to++ = nl[1];
// nlcnt = 0;
}
@@ -159,7 +160,7 @@
if (!realdata)
continue;
// *to++ = nl[0];
- buf[to++] = 10;
+ rawBuf[to++] = 10;
space = 0;
cr = 1;
continue;
@@ -168,19 +169,19 @@
nlcnt = 0;
if (space) {
space = 0;
- if (buf[from] != ' ') {
- buf[to++] = ' ';
+ if (rawBuf[from] != ' ') {
+ rawBuf[to++] = ' ';
from--;
continue;
}
}
- buf[to++] = buf[from];
+ rawBuf[to++] = rawBuf[from];
}
buf.setSize(to);
while (to > 1) { // remove trailing excess
to--;
- if ((buf[to] == 10) || (buf[to] == ' '))
+ if ((rawBuf[to] == 10) || (rawBuf[to] == ' '))
buf.setSize(to);
else break;
}
Index: zstr.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/common/zstr.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- zstr.cpp 27 Jun 2003 01:41:07 -0000 1.20
+++ zstr.cpp 16 Jul 2003 12:26:09 -0000 1.21
@@ -284,8 +284,9 @@
void zStr::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]) {
+ char *rawBuf = buf.getRawData();
+ for (to = from = 0; rawBuf[from]; from++) {
+ switch (rawBuf[from]) {
case 10:
if (!realdata)
continue;
@@ -294,7 +295,7 @@
nlcnt++;
if (nlcnt > 1) {
// *to++ = nl;
- buf[to++] = 10;
+ rawBuf[to++] = 10;
// *to++ = nl[1];
// nlcnt = 0;
}
@@ -303,7 +304,7 @@
if (!realdata)
continue;
// *to++ = nl[0];
- buf[to++] = 10;
+ rawBuf[to++] = 10;
space = 0;
cr = 1;
continue;
@@ -312,19 +313,19 @@
nlcnt = 0;
if (space) {
space = 0;
- if (buf[from] != ' ') {
- buf[to++] = ' ';
+ if (rawBuf[from] != ' ') {
+ rawBuf[to++] = ' ';
from--;
continue;
}
}
- buf[to++] = buf[from];
+ rawBuf[to++] = rawBuf[from];
}
buf.setSize(to);
while (to > 1) { // remove trailing excess
to--;
- if ((buf[to] == 10) || (buf[to] == ' '))
+ if ((rawBuf[to] == 10) || (rawBuf[to] == ' '))
buf.setSize(to);
else break;
}
Index: zverse.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/common/zverse.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- zverse.cpp 27 Jun 2003 01:41:07 -0000 1.30
+++ zverse.cpp 16 Jul 2003 12:26:09 -0000 1.31
@@ -487,8 +487,9 @@
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]) {
+ char *rawBuf = buf.getRawData();
+ for (to = from = 0; rawBuf[from]; from++) {
+ switch (rawBuf[from]) {
case 10:
if (!realdata)
continue;
@@ -497,7 +498,7 @@
nlcnt++;
if (nlcnt > 1) {
// *to++ = nl;
- buf[to++] = 10;
+ rawBuf[to++] = 10;
// *to++ = nl[1];
// nlcnt = 0;
}
@@ -506,7 +507,7 @@
if (!realdata)
continue;
// *to++ = nl[0];
- buf[to++] = 10;
+ rawBuf[to++] = 10;
space = 0;
cr = 1;
continue;
@@ -515,19 +516,19 @@
nlcnt = 0;
if (space) {
space = 0;
- if (buf[from] != ' ') {
- buf[to++] = ' ';
+ if (rawBuf[from] != ' ') {
+ rawBuf[to++] = ' ';
from--;
continue;
}
}
- buf[to++] = buf[from];
+ rawBuf[to++] = rawBuf[from];
}
buf.setSize(to);
while (to > 1) { // remove trailing excess
to--;
- if ((buf[to] == 10) || (buf[to] == ' '))
+ if ((rawBuf[to] == 10) || (rawBuf[to] == ' '))
buf.setSize(to);
else break;
}