[sword-cvs] sword/src/modules/filters cipherfil.cpp,1.20,1.21

sword@www.crosswire.org sword@www.crosswire.org
Tue, 12 Aug 2003 03:37:09 -0700


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

Modified Files:
	cipherfil.cpp 
Log Message:



Index: cipherfil.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/cipherfil.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- cipherfil.cpp	12 Aug 2003 05:36:30 -0000	1.20
+++ cipherfil.cpp	12 Aug 2003 10:37:06 -0000	1.21
@@ -26,16 +26,16 @@
 
 char CipherFilter::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
 	if (text.length() > 2) { //check if it's large enough to substract 2 in the next step.
-		unsigned int len = text.length();
+		unsigned long len = text.length();
 		if (!key) {	// hack, using key to determine encipher, or decipher
-			cipher->cipherBuf(&len, text); //set buffer to enciphered text
-			//memcpy(text, cipher->Buf(), (len < (unsigned int)(maxlen)) ? len : maxlen);
-			text = cipher->Buf(); //get the deciphered buffer
+			cipher->cipherBuf(&len, text.getRawData()); //set buffer to enciphered text
+			memcpy(text.getRawData(), cipher->Buf(), len);
+//			text = cipher->Buf(); //get the deciphered buffer
 		}
 		else if ((unsigned long)key == 1) {
-			cipher->Buf(text, len);
-			text = cipher->cipherBuf(&len);
-			//memcpy(text, cipher->cipherBuf(&len), (len < (unsigned int)(maxlen)) ? len : maxlen);
+			cipher->Buf(text.getRawData(), len);
+			memcpy(text.getRawData(), cipher->cipherBuf(&len), len);
+//			text = cipher->cipherBuf(&len);
 		}
 	}
 	return 0;