[sword-cvs] sword/src/modules/filters cipherfil.cpp,1.16,1.17
sword@www.crosswire.org
sword@www.crosswire.org
Thu, 24 Apr 2003 05:50:15 -0700
Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv17967/src/modules/filters
Modified Files:
cipherfil.cpp
Log Message:
fixed cipherfil.cpp to work with GCC 3.3
Index: cipherfil.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/cipherfil.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** cipherfil.cpp 19 Apr 2003 13:30:28 -0000 1.16
--- cipherfil.cpp 24 Apr 2003 12:50:13 -0000 1.17
***************
*** 27,44 ****
char CipherFilter::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
! int len = text.length()-2; //not unsigned, this eould lead to an overflow if text.length() < 2
! if (len > 0) {
if (!key) { // hack, using key to determine encipher, or decipher
! cipher->cipherBuf(&(unsigned int)len, text);
//memcpy(text, cipher->Buf(), (len < (unsigned int)(maxlen)) ? len : maxlen);
! text = cipher->Buf();
}
else if ((unsigned long)key == 1) {
cipher->Buf(text, len);
! text = cipher->cipherBuf(&(unsigned int)len);
//memcpy(text, cipher->cipherBuf(&len), (len < (unsigned int)(maxlen)) ? len : maxlen);
}
}
- // text[maxlen] = 0;
return 0;
}
--- 27,43 ----
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() - 2;
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
}
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);
}
}
return 0;
}