[sword-svn] r3867 - in trunk: include src/modules

scribe at crosswire.org scribe at crosswire.org
Sun Oct 10 13:15:22 EDT 2021


Author: scribe
Date: 2021-10-10 13:15:21 -0400 (Sun, 10 Oct 2021)
New Revision: 3867

Modified:
   trunk/include/swmodule.h
   trunk/src/modules/swmodule.cpp
Log:
Update signatures to safer return value for stripText


Modified: trunk/include/swmodule.h
===================================================================
--- trunk/include/swmodule.h	2021-10-10 17:04:46 UTC (rev 3866)
+++ trunk/include/swmodule.h	2021-10-10 17:15:21 UTC (rev 3867)
@@ -751,7 +751,7 @@
 	 * @param len max len to process
 	 * @return result buffer
 	 */
-	virtual const char *stripText(const char *buf = 0, int len = -1);
+	SWBuf stripText(const char *buf = 0, int len = -1);
 	/**
 	 * @deprecated Use stripText
 	 */
@@ -766,7 +766,7 @@
 	 * @return result buffer
 	 */
 	SWBuf renderText(const char *buf, int len = -1, bool render = true) const;
-	 SWBuf renderText();
+	SWBuf renderText();
 	/**
 	 * @deprecated Use renderText
 	 */
@@ -782,7 +782,7 @@
 	 * @param tmpKey desired module entry
 	 * @return result buffer
 	 */
-	virtual const char *stripText(const SWKey *tmpKey);
+	SWBuf stripText(const SWKey *tmpKey);
 
 	/** Produces renderable text of the module entry at the supplied key
 	 * @param tmpKey key to use to grab text

Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp	2021-10-10 17:04:46 UTC (rev 3866)
+++ trunk/src/modules/swmodule.cpp	2021-10-10 17:15:21 UTC (rev 3867)
@@ -1002,10 +1002,8 @@
  * RET: this module's text at current key location massaged by Strip filters
  */
 
-const char *SWModule::stripText(const char *buf, int len) {
-	static SWBuf local;
-	local = renderText(buf, len, false);
-	return local.c_str();
+SWBuf SWModule::stripText(const char *buf, int len) {
+	return renderText(buf, len, false);
 }
 
 
@@ -1130,9 +1128,9 @@
  * RET: this module's text at specified key location massaged by Strip filters
  */
 
-const char *SWModule::stripText(const SWKey *tmpKey) {
+SWBuf SWModule::stripText(const SWKey *tmpKey) {
 	SWKey *saveKey;
-	const char *retVal;
+	SWBuf retVal;
 
 	if (!key->isPersist()) {
 		saveKey = createKey();



More information about the sword-cvs mailing list