Commit 0288e1ab643f4cebd9b05605eb9769c161a06035
1 parent
e9413392
Fixed Loggin
Showing
5 changed files
with
5 additions
and
92 deletions
src/CMakeLists.txt
src/crypter.cpp
| 1 | -/* **************************************************************************** | ||
| 2 | - * Copyright 2019 Open Systems Development BV * | ||
| 3 | - * * | ||
| 4 | - * Permission is hereby granted, free of charge, to any person obtaining a * | ||
| 5 | - * copy of this software and associated documentation files (the "Software"), * | ||
| 6 | - * to deal in the Software without restriction, including without limitation * | ||
| 7 | - * the rights to use, copy, modify, merge, publish, distribute, sublicense, * | ||
| 8 | - * and/or sell copies of the Software, and to permit persons to whom the * | ||
| 9 | - * Software is furnished to do so, subject to the following conditions: * | ||
| 10 | - * * | ||
| 11 | - * The above copyright notice and this permission notice shall be included in * | ||
| 12 | - * all copies or substantial portions of the Software. * | ||
| 13 | - * * | ||
| 14 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * | ||
| 15 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * | ||
| 16 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * | ||
| 17 | - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * | ||
| 18 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * | ||
| 19 | - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * | ||
| 20 | - * DEALINGS IN THE SOFTWARE. * | ||
| 21 | - * ***************************************************************************/ | ||
| 22 | - | ||
| 23 | #include "crypter.h" | 1 | #include "crypter.h" |
| 24 | 2 | ||
| 25 | // std | 3 | // std |
| @@ -103,7 +81,7 @@ std::string Crypter::encrypt( const std::string& message, Crypter::AlgorithmEnum | @@ -103,7 +81,7 @@ std::string Crypter::encrypt( const std::string& message, Crypter::AlgorithmEnum | ||
| 103 | auto errorCode = EVP_DigestInit_ex( mdContext.get(), md, NULL ); | 81 | auto errorCode = EVP_DigestInit_ex( mdContext.get(), md, NULL ); |
| 104 | if( 1 != errorCode ) | 82 | if( 1 != errorCode ) |
| 105 | { | 83 | { |
| 106 | - LogError( "[Crypter::encrypt]", QString( "No encryption digest environment created." ) ); | 84 | + LogError( "[Crypter::encrypt]", std::string( "No encryption digest environment created." ) ); |
| 107 | throw std::system_error( errorCode, std::system_category(), "No encryption digest environment created." ); | 85 | throw std::system_error( errorCode, std::system_category(), "No encryption digest environment created." ); |
| 108 | } | 86 | } |
| 109 | 87 | ||
| @@ -111,7 +89,7 @@ std::string Crypter::encrypt( const std::string& message, Crypter::AlgorithmEnum | @@ -111,7 +89,7 @@ std::string Crypter::encrypt( const std::string& message, Crypter::AlgorithmEnum | ||
| 111 | errorCode = EVP_DigestUpdate( mdContext.get(), message.c_str(), message.length() ); | 89 | errorCode = EVP_DigestUpdate( mdContext.get(), message.c_str(), message.length() ); |
| 112 | if( 1 != errorCode ) | 90 | if( 1 != errorCode ) |
| 113 | { | 91 | { |
| 114 | - LogError( "[Crypter::encrypt]", QString("Digest failed.") ); | 92 | + LogError( "[Crypter::encrypt]", std::string("Digest failed.") ); |
| 115 | throw std::system_error( errorCode, std::system_category(), "Digest failed.." ); | 93 | throw std::system_error( errorCode, std::system_category(), "Digest failed.." ); |
| 116 | } | 94 | } |
| 117 | 95 | ||
| @@ -121,7 +99,7 @@ std::string Crypter::encrypt( const std::string& message, Crypter::AlgorithmEnum | @@ -121,7 +99,7 @@ std::string Crypter::encrypt( const std::string& message, Crypter::AlgorithmEnum | ||
| 121 | errorCode = EVP_DigestFinal_ex( mdContext.get(), mdValue, &mdLen ); | 99 | errorCode = EVP_DigestFinal_ex( mdContext.get(), mdValue, &mdLen ); |
| 122 | if( 1 != errorCode ) | 100 | if( 1 != errorCode ) |
| 123 | { | 101 | { |
| 124 | - LogError( "[Crypter::encrypt]", QString("There was an error closing the digest environment.") ); | 102 | + LogError( "[Crypter::encrypt]", std::string("There was an error closing the digest environment.") ); |
| 125 | throw std::system_error( errorCode, std::system_category(), "There was an error closing the digest environment." ); | 103 | throw std::system_error( errorCode, std::system_category(), "There was an error closing the digest environment." ); |
| 126 | } | 104 | } |
| 127 | 105 |
src/crypter.h
| 1 | -/* **************************************************************************** | ||
| 2 | - * Copyright 2019 Open Systems Development BV * | ||
| 3 | - * * | ||
| 4 | - * Permission is hereby granted, free of charge, to any person obtaining a * | ||
| 5 | - * copy of this software and associated documentation files (the "Software"), * | ||
| 6 | - * to deal in the Software without restriction, including without limitation * | ||
| 7 | - * the rights to use, copy, modify, merge, publish, distribute, sublicense, * | ||
| 8 | - * and/or sell copies of the Software, and to permit persons to whom the * | ||
| 9 | - * Software is furnished to do so, subject to the following conditions: * | ||
| 10 | - * * | ||
| 11 | - * The above copyright notice and this permission notice shall be included in * | ||
| 12 | - * all copies or substantial portions of the Software. * | ||
| 13 | - * * | ||
| 14 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * | ||
| 15 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * | ||
| 16 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * | ||
| 17 | - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * | ||
| 18 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * | ||
| 19 | - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * | ||
| 20 | - * DEALINGS IN THE SOFTWARE. * | ||
| 21 | - * ***************************************************************************/ | ||
| 22 | - | ||
| 23 | #ifndef OSDEV_COMPONENTS_CRYPTER_H | 1 | #ifndef OSDEV_COMPONENTS_CRYPTER_H |
| 24 | #define OSDEV_COMPONENTS_CRYPTER_H | 2 | #define OSDEV_COMPONENTS_CRYPTER_H |
| 25 | 3 |
src/scopeguard.cpp
| 1 | -/* **************************************************************************** | ||
| 2 | - * Copyright 2019 Open Systems Development BV * | ||
| 3 | - * * | ||
| 4 | - * Permission is hereby granted, free of charge, to any person obtaining a * | ||
| 5 | - * copy of this software and associated documentation files (the "Software"), * | ||
| 6 | - * to deal in the Software without restriction, including without limitation * | ||
| 7 | - * the rights to use, copy, modify, merge, publish, distribute, sublicense, * | ||
| 8 | - * and/or sell copies of the Software, and to permit persons to whom the * | ||
| 9 | - * Software is furnished to do so, subject to the following conditions: * | ||
| 10 | - * * | ||
| 11 | - * The above copyright notice and this permission notice shall be included in * | ||
| 12 | - * all copies or substantial portions of the Software. * | ||
| 13 | - * * | ||
| 14 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * | ||
| 15 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * | ||
| 16 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * | ||
| 17 | - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * | ||
| 18 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * | ||
| 19 | - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * | ||
| 20 | - * DEALINGS IN THE SOFTWARE. * | ||
| 21 | - * ***************************************************************************/ | ||
| 22 | - | ||
| 23 | #include "scopeguard.h" | 1 | #include "scopeguard.h" |
| 24 | 2 | ||
| 25 | using namespace osdev::components; | 3 | using namespace osdev::components; |
src/scopeguard.h
| 1 | -/* **************************************************************************** | ||
| 2 | - * Copyright 2019 Open Systems Development BV * | ||
| 3 | - * * | ||
| 4 | - * Permission is hereby granted, free of charge, to any person obtaining a * | ||
| 5 | - * copy of this software and associated documentation files (the "Software"), * | ||
| 6 | - * to deal in the Software without restriction, including without limitation * | ||
| 7 | - * the rights to use, copy, modify, merge, publish, distribute, sublicense, * | ||
| 8 | - * and/or sell copies of the Software, and to permit persons to whom the * | ||
| 9 | - * Software is furnished to do so, subject to the following conditions: * | ||
| 10 | - * * | ||
| 11 | - * The above copyright notice and this permission notice shall be included in * | ||
| 12 | - * all copies or substantial portions of the Software. * | ||
| 13 | - * * | ||
| 14 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * | ||
| 15 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * | ||
| 16 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * | ||
| 17 | - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * | ||
| 18 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * | ||
| 19 | - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * | ||
| 20 | - * DEALINGS IN THE SOFTWARE. * | ||
| 21 | - * ***************************************************************************/ | ||
| 22 | - | ||
| 23 | #ifndef OSDEV_COMPONENTS_SCOPEGUARD_H | 1 | #ifndef OSDEV_COMPONENTS_SCOPEGUARD_H |
| 24 | #define OSDEV_COMPONENTS_SCOPEGUARD_H | 2 | #define OSDEV_COMPONENTS_SCOPEGUARD_H |
| 25 | 3 | ||
| @@ -28,7 +6,7 @@ | @@ -28,7 +6,7 @@ | ||
| 28 | namespace osdev { | 6 | namespace osdev { |
| 29 | namespace components { | 7 | namespace components { |
| 30 | 8 | ||
| 31 | -using CleanUpFunction = std::function<void() noexcept>; | 9 | +using CleanUpFunction = std::function<void()>; |
| 32 | 10 | ||
| 33 | /** | 11 | /** |
| 34 | * @brief Ensures that a cleanup function is called at the end of the current scope. | 12 | * @brief Ensures that a cleanup function is called at the end of the current scope. |