[sword-svn] r1721 - trunk/utilities

chrislit at crosswire.org chrislit at crosswire.org
Fri Feb 18 01:21:04 MST 2005


Author: chrislit
Date: 2005-02-18 01:21:04 -0700 (Fri, 18 Feb 2005)
New Revision: 1721

Modified:
   trunk/utilities/osis2mod.cpp
Log:
fixed some type errors through casting & taking the .c_str() of some objects

Modified: trunk/utilities/osis2mod.cpp
===================================================================
--- trunk/utilities/osis2mod.cpp	2005-02-18 06:04:17 UTC (rev 1720)
+++ trunk/utilities/osis2mod.cpp	2005-02-18 08:21:04 UTC (rev 1721)
@@ -226,14 +226,14 @@
 			//make sure we don't insert the preverse title which belongs to the first verse of this chapter!
 			const char* chapterTagEnd = strchr(text.c_str(), '>');
 			const char* titleTagStart = strstr(text.c_str(), "<title");
-			
+
 			if (chapterTagEnd+1 == titleTagStart) {
 				const char* titleTagEnd = strstr(text.c_str(), "</title>");
 				while (strstr(titleTagEnd+8, "</title>")) {
 					titleTagEnd = strstr(titleTagEnd+8, "</title>");
 				}
+
 				
-				
 				const char* textEnd = text.c_str() + text.length();
 				if (titleTagEnd+8 == textEnd) {
 					text.setSize(chapterTagEnd+1-text.c_str()); //only insert the <chapter...> part
@@ -275,22 +275,22 @@
 	else if ((!strcmp(token.getName(), "verse")) && (token.isEndTag() || (token.getAttribute("eID")))) {
         	inVerse = false;
 		if (lastTitle.length()) {
-			char* end = strchr(lastTitle, '>');
+			const char* end = strchr(lastTitle, '>');
 // 			printf("length=%d, tag; %s\n", end+1 - lastTitle.c_str(), lastTitle.c_str());
-			
+
 			SWBuf titleTagText;
 			titleTagText.append(lastTitle.c_str(), end+1 - lastTitle.c_str());
 // 			printf("tagText: %s\n", titleTagText.c_str());
-			
+
 			XMLTag titleTag(titleTagText);
 			titleTag.setAttribute("type", "section");
 			titleTag.setAttribute("subtype", "x-preverse");
-			
+
 			//we insert the title into the text again - make sure to remove the old title text
-			char* pos = strstr(text, lastTitle);
+			const char* pos = strstr(text, lastTitle);
 			if (pos) {
 				SWBuf temp;
-				temp.append(text, pos-text);
+				temp.append(text, pos-text.c_str());
 				temp.append(pos+lastTitle.length());
 				text = temp;
 			}
@@ -298,9 +298,9 @@
 			//if a title was already inserted at the beginning insert this one after that first title
 			int titlePos = 0;
 			if (!strncmp(text.c_str(),"<title ",7)) {
-				char* tmp = strstr(text.c_str(), "</title>");
+				const char* tmp = strstr(text.c_str(), "</title>");
 				if (tmp) {
-					titlePos = (tmp-text) + 8;
+					titlePos = (tmp-text.c_str()) + 8;
 				}
 			}
  			text.insert(titlePos, end+1);



More information about the sword-cvs mailing list