[sword-svn] r3427 - in trunk: src/keys src/modules/filters src/utilfuns utilities utilities/diatheke
scribe at crosswire.org
scribe at crosswire.org
Sun Jul 3 07:30:33 MST 2016
Author: scribe
Date: 2016-07-03 07:30:33 -0700 (Sun, 03 Jul 2016)
New Revision: 3427
Modified:
trunk/src/keys/treekeyidx.cpp
trunk/src/modules/filters/gbfheadings.cpp
trunk/src/modules/filters/gbfmorph.cpp
trunk/src/modules/filters/gbfplain.cpp
trunk/src/modules/filters/gbfredletterwords.cpp
trunk/src/modules/filters/gbfrtf.cpp
trunk/src/modules/filters/gbfstrongs.cpp
trunk/src/modules/filters/gbfthml.cpp
trunk/src/modules/filters/gbfwordjs.cpp
trunk/src/modules/filters/osismorph.cpp
trunk/src/modules/filters/osiswordjs.cpp
trunk/src/modules/filters/thmlgbf.cpp
trunk/src/modules/filters/thmlplain.cpp
trunk/src/modules/filters/thmlstrongs.cpp
trunk/src/modules/filters/thmlwordjs.cpp
trunk/src/utilfuns/utilxml.cpp
trunk/utilities/diatheke/thmlcgi.cpp
trunk/utilities/emptyvss.cpp
Log:
Fixed misleading indenting or wrong blocking
Modified: trunk/src/keys/treekeyidx.cpp
===================================================================
--- trunk/src/keys/treekeyidx.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/keys/treekeyidx.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -259,15 +259,16 @@
getTreeNodeFromIdxOffset(currentNode.parent, &iterator);
getTreeNodeFromIdxOffset(iterator.firstChild, &iterator);
if (iterator.offset != target) {
- while ((iterator.next != target) && (iterator.next > -1))
+ while ((iterator.next != target) && (iterator.next > -1)) {
getTreeNodeFromIdxOffset(iterator.next, &iterator);
- if (iterator.next > -1) {
- TreeNode prev;
- getTreeNodeFromIdxOffset(iterator.offset, &prev);
- prev.next = node.next;
- saveTreeNodeOffsets(&prev);
- getTreeNodeFromIdxOffset(prev.offset, ¤tNode);
}
+ if (iterator.next > -1) {
+ TreeNode prev;
+ getTreeNodeFromIdxOffset(iterator.offset, &prev);
+ prev.next = node.next;
+ saveTreeNodeOffsets(&prev);
+ getTreeNodeFromIdxOffset(prev.offset, ¤tNode);
+ }
}
}
}
Modified: trunk/src/modules/filters/gbfheadings.cpp
===================================================================
--- trunk/src/modules/filters/gbfheadings.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/gbfheadings.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -93,11 +93,13 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
+ // TODO: why is this + 2 ?
token[tokpos+2] = 0;
+ }
}
- else {
+ else {
if (!hide) {
text += *from;
}
Modified: trunk/src/modules/filters/gbfmorph.cpp
===================================================================
--- trunk/src/modules/filters/gbfmorph.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/gbfmorph.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -84,11 +84,13 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
+ // TODO: why is this + 2 ?
token[tokpos+2] = 0;
+ }
}
- else {
+ else {
text += *from;
lastspace = (*from == ' ');
}
Modified: trunk/src/modules/filters/gbfplain.cpp
===================================================================
--- trunk/src/modules/filters/gbfplain.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/gbfplain.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -103,9 +103,11 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
+ // TODO: why is this + 2 ?
token[tokpos+2] = 0;
+ }
}
else text.append(*from);
}
Modified: trunk/src/modules/filters/gbfredletterwords.cpp
===================================================================
--- trunk/src/modules/filters/gbfredletterwords.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/gbfredletterwords.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -101,9 +101,12 @@
continue;
}
if (intoken) {
- if (tokpos < 4090)
+ if (tokpos < 4090) {
token[tokpos++] = *from;
+ // TODO: why is this + 2 ? The below comment still doesn't help me understand. The switch statment
+ // is commented out in this filter
token[tokpos+2] = 0; // +2 cuz we init token with 2 extra '0' because of switch statement
+ }
}
else {
text += *from;
Modified: trunk/src/modules/filters/gbfrtf.cpp
===================================================================
--- trunk/src/modules/filters/gbfrtf.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/gbfrtf.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -307,9 +307,11 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
+ // TODO: why is this + 2 ?
token[tokpos+2] = 0;
+ }
}
else {
if (!hideText) {
Modified: trunk/src/modules/filters/gbfstrongs.cpp
===================================================================
--- trunk/src/modules/filters/gbfstrongs.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/gbfstrongs.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -134,11 +134,13 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
+ // TODO: why is this + 2 ?
token[tokpos+2] = 0;
+ }
}
- else {
+ else {
text += *from;
lastspace = (*from == ' ');
}
Modified: trunk/src/modules/filters/gbfthml.cpp
===================================================================
--- trunk/src/modules/filters/gbfthml.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/gbfthml.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -52,8 +52,7 @@
token[2] = 0;
continue;
}
- if (*from == '>')
- {
+ if (*from == '>') {
intoken = false;
// process desired tokens
switch (*token) {
@@ -210,9 +209,15 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
+ //TODO: why is this + 2? Are we trying to keep 2 or 3 nulls after the last valid char?
+ // tokpos has been incremented past the last valid token. it should be pointing to null
+ // +1 should give us 2 nulls, but we're +2 here, which actually keeps 3 nulls after the
+ // last valid char. Why are we doing any of this? These were written before SWBuf and should
+ // probably be switched to SWBuf, but perf tests before and after the switch should be run
token[tokpos+2] = 0;
+ }
}
else text += *from;
}
Modified: trunk/src/modules/filters/gbfwordjs.cpp
===================================================================
--- trunk/src/modules/filters/gbfwordjs.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/gbfwordjs.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -223,11 +223,13 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
+ // TODO: why is this + 2 ?
token[tokpos+2] = 0;
+ }
}
- else {
+ else {
text += *from;
}
}
Modified: trunk/src/modules/filters/osismorph.cpp
===================================================================
--- trunk/src/modules/filters/osismorph.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/osismorph.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -90,11 +90,12 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
token[tokpos] = 0;
+ }
}
- else {
+ else {
text.append(*from);
}
}
Modified: trunk/src/modules/filters/osiswordjs.cpp
===================================================================
--- trunk/src/modules/filters/osiswordjs.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/osiswordjs.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -189,9 +189,10 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
token[tokpos+2] = 0;
+ }
}
else {
text.append(*from);
Modified: trunk/src/modules/filters/thmlgbf.cpp
===================================================================
--- trunk/src/modules/filters/thmlgbf.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/thmlgbf.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -269,9 +269,11 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
+ // TODO: why is this + 2 ?
token[tokpos+2] = 0;
+ }
}
else text += *from;
}
Modified: trunk/src/modules/filters/thmlplain.cpp
===================================================================
--- trunk/src/modules/filters/thmlplain.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/thmlplain.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -206,9 +206,15 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
+ //TODO: why is this + 2? Are we trying to keep 2 or 3 nulls after the last valid char?
+ // tokpos has been incremented past the last valid token. it should be pointing to null
+ // +1 should give us 2 nulls, but we're +2 here, which actually keeps 3 nulls after the
+ // last valid char. Why are we doing any of this? These were written before SWBuf and should
+ // probably be switched to SWBuf, but perf tests before and after the switch should be run
token[tokpos+2] = 0;
+ }
}
else text += *from;
}
Modified: trunk/src/modules/filters/thmlstrongs.cpp
===================================================================
--- trunk/src/modules/filters/thmlstrongs.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/thmlstrongs.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -154,11 +154,13 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
+ // TODO: why is this + 2 ?
token[tokpos+2] = 0;
+ }
}
- else {
+ else {
text += *from;
lastspace = (*from == ' ');
}
Modified: trunk/src/modules/filters/thmlwordjs.cpp
===================================================================
--- trunk/src/modules/filters/thmlwordjs.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/modules/filters/thmlwordjs.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -237,9 +237,11 @@
continue;
}
if (intoken) {
- if (tokpos < 2045)
+ if (tokpos < 2045) {
token[tokpos++] = *from;
+ // TODO: why is this + 2 ?
token[tokpos+2] = 0;
+ }
}
else {
text += *from;
Modified: trunk/src/utilfuns/utilxml.cpp
===================================================================
--- trunk/src/utilfuns/utilxml.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/src/utilfuns/utilxml.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -85,16 +85,14 @@
for (; ((buf[i]) && (buf[i] != quoteChar)); i++);
// Allow for empty quotes
- //if (i-start) {
- if (value)
- delete [] value;
- value = new char [ (i-start) + 1 ];
- if (i-start) {
- strncpy(value, buf+start, i-start);
- }
- value[i-start] = 0;
- attributes[name] = value;
- //}
+ if (value)
+ delete [] value;
+ value = new char [ (i-start) + 1 ];
+ if (i-start) {
+ strncpy(value, buf+start, i-start);
+ }
+ value[i-start] = 0;
+ attributes[name] = value;
}
}
}
Modified: trunk/utilities/diatheke/thmlcgi.cpp
===================================================================
--- trunk/utilities/diatheke/thmlcgi.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/utilities/diatheke/thmlcgi.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -198,9 +198,10 @@
else {
buf += '<';
- for (i = 0; i < strlen(token); i++)
+ for (i = 0; i < strlen(token); i++) {
buf += token[i];
- buf += '>';
+ }
+ buf += '>';
//return false; // we still didn't handle token
}
}
Modified: trunk/utilities/emptyvss.cpp
===================================================================
--- trunk/utilities/emptyvss.cpp 2016-07-03 14:28:33 UTC (rev 3426)
+++ trunk/utilities/emptyvss.cpp 2016-07-03 14:30:33 UTC (rev 3427)
@@ -73,9 +73,11 @@
while (!mod->popError()) {
- if (vkey->getVerse())
- if (!mod->renderText().length())
- std::cout << *vkey << std::endl;
- (*mod)++;
+ if (vkey->getVerse()) {
+ if (!mod->renderText().length()) {
+ std::cout << *vkey << std::endl;
+ }
+ (*mod)++;
+ }
}
}
More information about the sword-cvs
mailing list