[sword-cvs] sword/src/modules/filters gbffootnotes.cpp,1.14,1.15 gbfheadings.cpp,1.6,1.7 gbfredletterwords.cpp,1.1,1.2

sword@www.crosswire.org sword@www.crosswire.org
Thu, 20 Feb 2003 16:01:27 -0700


Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv31431/src/modules/filters

Modified Files:
	gbffootnotes.cpp gbfheadings.cpp gbfredletterwords.cpp 
Log Message:
more simple gbf filters updated

Index: gbffootnotes.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/gbffootnotes.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** gbffootnotes.cpp	1 Oct 2002 19:52:40 -0000	1.14
--- gbffootnotes.cpp	20 Feb 2003 23:01:25 -0000	1.15
***************
*** 42,49 ****
  }
  
! char GBFFootnotes::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
  {
  	if (!option) {	// if we don't want footnotes
! 		char *to, *from, token[4096]; // cheese.  Fix.
  		int tokpos = 0;
  		bool intoken = false;
--- 42,49 ----
  }
  
! char GBFFootnotes::processText (SWBuf &text, const SWKey *key, const SWModule *module)
  {
  	if (!option) {	// if we don't want footnotes
! 		char token[4096]; // cheese.  Fix.
  		int tokpos = 0;
  		bool intoken = false;
***************
*** 51,62 ****
  		bool hide = false;
  
! 		len = strlen(text) + 1;	// shift string to right of buffer
! 		if (len < maxlen) {
! 			memmove(&text[maxlen - len], text, len);
! 			from = &text[maxlen - len];
! 		}
! 		else	from = text;	// -------------------------------
! 
! 		for (to = text; *from; from++) {
  			if (*from == '<') {
  				intoken = true;
--- 51,58 ----
  		bool hide = false;
  
! 	const char *from;
! 	SWBuf orig = text;
! 	from = orig.c_str();
! 	for (text = ""; *from; from++) {
  			if (*from == '<') {
  				intoken = true;
***************
*** 95,102 ****
  				// if not a footnote token, keep token in text
  				if (!hide) {
! 					*to++ = '<';
  					for (char *tok = token; *tok; tok++)
! 						*to++ = *tok;
! 					*to++ = '>';
  				}
  				continue;
--- 91,98 ----
  				// if not a footnote token, keep token in text
  				if (!hide) {
! 					text += '<';
  					for (char *tok = token; *tok; tok++)
! 						text += *tok;
! 					text += '>';
  				}
  				continue;
***************
*** 109,118 ****
  			else	{
  				if (!hide) {
! 					*to++ = *from;
  				}
  			}
  		}
- 		*to++ = 0;
- 		*to = 0;
  	}
  	return 0;
--- 105,112 ----
  			else	{
  				if (!hide) {
! 					text += *from;
  				}
  			}
  		}
  	}
  	return 0;

Index: gbfheadings.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/gbfheadings.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** gbfheadings.cpp	1 Oct 2002 19:52:40 -0000	1.6
--- gbfheadings.cpp	20 Feb 2003 23:01:25 -0000	1.7
***************
*** 43,50 ****
  }
  
! char GBFHeadings::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
  {
  	if (!option) {	// if we don't want headings
! 		char *to, *from, token[2048]; // cheese.  Fix.
  		int tokpos = 0;
  		bool intoken = false;
--- 43,50 ----
  }
  
! char GBFHeadings::processText (SWBuf &text, const SWKey *key, const SWModule *module)
  {
  	if (!option) {	// if we don't want headings
! 		char token[2048]; // cheese.  Fix.
  		int tokpos = 0;
  		bool intoken = false;
***************
*** 52,63 ****
  		bool hide = false;
  
! 		len = strlen(text) + 1;	// shift string to right of buffer
! 		if (len < maxlen) {
! 			memmove(&text[maxlen - len], text, len);
! 			from = &text[maxlen - len];
! 		}
! 		else	from = text;	// -------------------------------
! 
! 		for (to = text; *from; from++) {
  			if (*from == '<') {
  				intoken = true;
--- 52,59 ----
  		bool hide = false;
  
! 	const char *from;
! 	SWBuf orig = text;
! 	from = orig.c_str();
! 	for (text = ""; *from; from++) {
  			if (*from == '<') {
  				intoken = true;
***************
*** 85,92 ****
  				// if not a heading token, keep token in text
  				if (!hide) {
! 					*to++ = '<';
  					for (char *tok = token; *tok; tok++)
! 						*to++ = *tok;
! 					*to++ = '>';
  				}
  				continue;
--- 81,88 ----
  				// if not a heading token, keep token in text
  				if (!hide) {
! 					text += '<';
  					for (char *tok = token; *tok; tok++)
! 						text += *tok;
! 					text += '>';
  				}
  				continue;
***************
*** 99,108 ****
  			else	{
  				if (!hide) {
! 					*to++ = *from;
  				}
  			}
  		}
- 		*to++ = 0;
- 		*to = 0;
  	}
  	return 0;
--- 95,102 ----
  			else	{
  				if (!hide) {
! 					text += *from;
  				}
  			}
  		}
  	}
  	return 0;

Index: gbfredletterwords.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/gbfredletterwords.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** gbfredletterwords.cpp	14 Jan 2003 19:30:18 -0000	1.1
--- gbfredletterwords.cpp	20 Feb 2003 23:01:25 -0000	1.2
***************
*** 44,48 ****
  }
  
! char GBFRedLetterWords::ProcessText(char *text, int maxlen, const SWKey *key, const SWModule *module)
  {
  /** This function removes the red letter words in Bible like the WEB
--- 44,48 ----
  }
  
! char GBFRedLetterWords::processText(SWBuf &text, const SWKey *key, const SWModule *module)
  {
  /** This function removes the red letter words in Bible like the WEB
***************
*** 50,54 ****
  */
  	if (!option) {	// if we don't want footnotes
! 		char *to, *from, token[4096]; // cheese.  Fix.
  		int tokpos = 0;
  		bool intoken = false;
--- 50,54 ----
  */
  	if (!option) {	// if we don't want footnotes
! 		char token[4096]; // cheese.  Fix.
  		int tokpos = 0;
  		bool intoken = false;
***************
*** 56,67 ****
  		bool hide = false;
  
! 		len = strlen(text) + 1;	// shift string to right of buffer
! 		if (len < maxlen) {
! 			memmove(&text[maxlen - len], text, len);
! 			from = &text[maxlen - len];
! 		}
! 		else	from = text;	// -------------------------------
! 
! 		for (to = text; *from; from++) {
  			if (*from == '<') {
  				intoken = true;
--- 56,63 ----
  		bool hide = false;
  
! 	const char *from;
! 	SWBuf orig = text;
! 	from = orig.c_str();
! 	for (text = ""; *from; from++) {
  			if (*from == '<') {
  				intoken = true;
***************
*** 93,100 ****
  				// if not a red letter word token, keep token in text
  				if (!hide) {
! 					*to++ = '<';
  					for (char *tok = token; *tok; tok++)
! 						*to++ = *tok;
! 					*to++ = '>';
  				}
  				continue;
--- 89,96 ----
  				// if not a red letter word token, keep token in text
  				if (!hide) {
! 					text += '<';
  					for (char *tok = token; *tok; tok++)
! 						text += *tok;
! 					text += '>';
  				}
  				continue;
***************
*** 106,114 ****
  			}
  			else {
! 				*to++ = *from;
  			}
  		}
- 		*to++ = 0;
- 		*to = 0;
  	}
  	return 0;
--- 102,108 ----
  			}
  			else {
! 				text += *from;
  			}
  		}
  	}
  	return 0;