From 690dd7a33ddc90678367d73adf313533536e10f2 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Fri, 29 Apr 2016 23:57:30 +0100 Subject: Apply clang-format --- src/modules/rot13/libkvirot13.cpp | 116 ++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 61 deletions(-) (limited to 'src/modules/rot13/libkvirot13.cpp') 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 * g_pEngineList = 0; +static KviPointerList * 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 ", - "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 ", + "Exports the ROT13 text transformation engine", + rot13_module_init, + rot13_module_can_unload, + 0, + rot13_module_cleanup, + 0) -- cgit v1.3.1-10-gc9f91