[sword-svn] r1840 - trunk/utilities

dglassey at crosswire.org dglassey at crosswire.org
Wed Jun 29 15:31:08 MST 2005


Author: dglassey
Date: 2005-06-29 15:31:08 -0700 (Wed, 29 Jun 2005)
New Revision: 1840

Modified:
   trunk/utilities/imp2gbs.cpp
   trunk/utilities/imp2ld.cpp
Log:
stop these crasing on final lines as well



Modified: trunk/utilities/imp2gbs.cpp
===================================================================
--- trunk/utilities/imp2gbs.cpp	2005-06-29 22:23:12 UTC (rev 1839)
+++ trunk/utilities/imp2gbs.cpp	2005-06-29 22:31:08 UTC (rev 1840)
@@ -107,7 +107,7 @@
   
   while (!infile.eof()) {
     std::getline(infile, linebuffer);
-    if (linebuffer.substr(0,3) == "$$$") {
+    if (linebuffer.size() > 3 && linebuffer.substr(0,3) == "$$$") {
       if (keybuffer.size() && entbuffer.size()) {
 	std::cout << keybuffer << std::endl;
 	treeKey->root();

Modified: trunk/utilities/imp2ld.cpp
===================================================================
--- trunk/utilities/imp2ld.cpp	2005-06-29 22:23:12 UTC (rev 1839)
+++ trunk/utilities/imp2ld.cpp	2005-06-29 22:31:08 UTC (rev 1840)
@@ -85,7 +85,7 @@
 
   while (!infile.eof()) {
     std::getline(infile, linebuffer);
-    if (linebuffer.substr(0,3) == "$$$") {
+    if (linebuffer.size() > 3 && linebuffer.substr(0,3) == "$$$") {
       if (keybuffer.size() && entbuffer.size()) {
 	std::cout << keybuffer << std::endl;
 	*key = keybuffer.c_str();
@@ -118,12 +118,13 @@
           }
 	}
       }
-      keybuffer = linebuffer.substr(3,linebuffer.size()) ;
+      if (linebuffer.size() > 3)
+      	keybuffer = linebuffer.substr(3,linebuffer.size()) ;
       entbuffer.resize(0);
       linkbuffer.clear();
       links = 0;
     }
-    else if (linebuffer.substr(0,3) == "%%%") {
+    else if (linebuffer.size() > 3 && linebuffer.substr(0,3) == "%%%") {
       linkbuffer.push_back(linebuffer.substr(3,linebuffer.size()));
       links++;
     }



More information about the sword-cvs mailing list