diff options
| author | 2016-04-29 23:57:30 +0100 | |
|---|---|---|
| committer | 2016-04-29 23:57:48 +0100 | |
| commit | 690dd7a33ddc90678367d73adf313533536e10f2 (patch) | |
| tree | 2276fe7c384ebbc222b40a19c536d5c3c5606ce8 /src/modules/rot13/libkvirot13.cpp | |
| parent | Add config for clang-format. (diff) | |
| download | KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.gz KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.bz2 KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.zip | |
Apply clang-format
Diffstat (limited to 'src/modules/rot13/libkvirot13.cpp')
| -rw-r--r-- | src/modules/rot13/libkvirot13.cpp | 116 |
1 files changed, 55 insertions, 61 deletions
diff --git a/src/modules/rot13/libkvirot13.cpp b/src/modules/rot13/libkvirot13.cpp index 81a0a83a0..f57858980 100644 --- a/src/modules/rot13/libkvirot13.cpp +++ b/src/modules/rot13/libkvirot13.cpp @@ -29,8 +29,6 @@ #include "kvi_debug.h" #include "KviLocale.h" - - /* @doc: rot13 @type: @@ -43,70 +41,67 @@ Performs the "rotate by 13 places" substitution. */ - - #ifdef COMPILE_CRYPT_SUPPORT - #include "KviMemory.h" - #include "KviPointerList.h" - #include "KviCryptEngineDescription.h" +#include "KviMemory.h" +#include "KviPointerList.h" +#include "KviCryptEngineDescription.h" - static KviPointerList<KviCryptEngine> * g_pEngineList = 0; +static KviPointerList<KviCryptEngine> * g_pEngineList = 0; - KviRot13Engine::KviRot13Engine() - : KviCryptEngine() - { - g_pEngineList->append(this); - } +KviRot13Engine::KviRot13Engine() + : KviCryptEngine() +{ + g_pEngineList->append(this); +} - KviRot13Engine::~KviRot13Engine() - { - g_pEngineList->removeRef(this); - } +KviRot13Engine::~KviRot13Engine() +{ + g_pEngineList->removeRef(this); +} - bool KviRot13Engine::init(const char *,int,const char *,int) - { - return true; - } +bool KviRot13Engine::init(const char *, int, const char *, int) +{ + return true; +} - KviCryptEngine::EncryptResult KviRot13Engine::encrypt(const char * plainText,KviCString &outBuffer) +KviCryptEngine::EncryptResult KviRot13Engine::encrypt(const char * plainText, KviCString & outBuffer) +{ + outBuffer = plainText; + unsigned char * aux = (unsigned char *)outBuffer.ptr(); + while(*aux) { - outBuffer = plainText; - unsigned char * aux = (unsigned char *)outBuffer.ptr(); - while(*aux) + if(isalpha(*aux)) { - if(isalpha(*aux)) - { - char l = toupper(*aux); - if (l >= 'N' && l <= 'Z') - *aux = *aux - 13; - else if (l >= 'A' && l <= 'M') - *aux = *aux + 13; - } - aux++; + char l = toupper(*aux); + if(l >= 'N' && l <= 'Z') + *aux = *aux - 13; + else if(l >= 'A' && l <= 'M') + *aux = *aux + 13; } - - return KviCryptEngine::Encoded; + aux++; } - KviCryptEngine::DecryptResult KviRot13Engine::decrypt(const char * inBuffer,KviCString &plainText) - { - plainText = inBuffer; - return KviCryptEngine::DecryptOkWasPlainText; - } + return KviCryptEngine::Encoded; +} - static KviCryptEngine * allocRot13Engine() - { - return new KviRot13Engine(); - } +KviCryptEngine::DecryptResult KviRot13Engine::decrypt(const char * inBuffer, KviCString & plainText) +{ + plainText = inBuffer; + return KviCryptEngine::DecryptOkWasPlainText; +} - static void deallocRot13Engine(KviCryptEngine * e) - { - delete e; - } +static KviCryptEngine * allocRot13Engine() +{ + return new KviRot13Engine(); +} -#endif +static void deallocRot13Engine(KviCryptEngine * e) +{ + delete e; +} +#endif // ======================================= // module routines @@ -132,7 +127,7 @@ static bool rot13_module_init(KviModule * m) #endif } -static bool rot13_module_cleanup(KviModule *m) +static bool rot13_module_cleanup(KviModule * m) { #ifdef COMPILE_CRYPT_SUPPORT while(g_pEngineList->first()) @@ -159,13 +154,12 @@ static bool rot13_module_can_unload(KviModule *) // plugin definition structure // ======================================= KVIRC_MODULE( - "ROT13 crypt engine", - "4.0.0", - "Aeriana <aeriana at quasarnet dot org>", - "Exports the ROT13 text transformation engine", - rot13_module_init, - rot13_module_can_unload, - 0, - rot13_module_cleanup, - 0 -) + "ROT13 crypt engine", + "4.0.0", + "Aeriana <aeriana at quasarnet dot org>", + "Exports the ROT13 text transformation engine", + rot13_module_init, + rot13_module_can_unload, + 0, + rot13_module_cleanup, + 0) |
