Procházet zdrojové kódy

Harden security within core module

Patrick-Christopher Mattulat před 1 dnem
rodič
revize
7e26655759

+ 2 - 2
source/ls-std/core/ConditionalFunctionExecutor.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-13
-* Changed:         2023-02-23
+* Changed:         2025-12-21
 *
 * */
 
@@ -12,7 +12,7 @@
 using ls::std::core::ConditionalFunctionExecutor;
 using std::function;
 
-ConditionalFunctionExecutor::ConditionalFunctionExecutor(bool _condition) : condition(_condition)
+ConditionalFunctionExecutor::ConditionalFunctionExecutor(const bool _condition) : condition(_condition)
 {}
 
 ConditionalFunctionExecutor::~ConditionalFunctionExecutor() = default;

+ 6 - 6
source/ls-std/core/Version.cpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-09-28
- * Changed:         2023-05-16
+ * Changed:         2025-12-21
  *
  * */
 
@@ -20,7 +20,7 @@ using std::string;
 using std::string_view;
 using std::to_string;
 
-Version::Version(version_type _majorVersion, version_type _minorVersion, version_type _patchVersion) : majorVersion(_majorVersion), minorVersion(_minorVersion), patchVersion(_patchVersion)
+Version::Version(const version_type _majorVersion, const version_type _minorVersion, const version_type _patchVersion) : majorVersion(_majorVersion), minorVersion(_minorVersion), patchVersion(_patchVersion)
 {}
 
 Version::~Version() noexcept = default;
@@ -76,22 +76,22 @@ bool Version::isValid(const string &_versionString)
   return Version::_isValid(_versionString);
 }
 
-void Version::setMajorVersion(version_type _major)
+void Version::setMajorVersion(const version_type _major)
 {
   this->majorVersion = _major;
 }
 
-void Version::setMinorVersion(version_type _minor)
+void Version::setMinorVersion(const version_type _minor)
 {
   this->minorVersion = _minor;
 }
 
-void Version::setPatchVersion(version_type _patch)
+void Version::setPatchVersion(const version_type _patch)
 {
   this->patchVersion = _patch;
 }
 
-bool Version::_isValid(string_view _versionString)
+bool Version::_isValid(const string_view _versionString)
 {
   bool isValidVersionString{};
   static regex versionRegex{R"(\d+[.]\d+[.]\d+)"};

+ 3 - 5
source/ls-std/core/evaluator/EmptyStringArgumentEvaluator.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-08
-* Changed:         2023-02-23
+* Changed:         2025-12-21
 *
 * */
 
@@ -31,9 +31,7 @@ void EmptyStringArgumentEvaluator::evaluate()
     {
       throw IllegalArgumentException{"passed argument is empty!"};
     }
-    else
-    {
-      throw IllegalArgumentException{this->message};
-    }
+
+    throw IllegalArgumentException{this->message};
   }
 }

+ 5 - 7
source/ls-std/core/evaluator/IndexOutOfBoundsEvaluator.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-05-16
+* Changed:         2025-12-21
 *
 * */
 
@@ -15,10 +15,10 @@ using ls::std::core::IndexOutOfBoundsException;
 using std::move;
 using std::string;
 
-IndexOutOfBoundsEvaluator::IndexOutOfBoundsEvaluator(size_t _index, size_t _size) : index(_index), size(_size)
+IndexOutOfBoundsEvaluator::IndexOutOfBoundsEvaluator(const size_t _index, const size_t _size) : index(_index), size(_size)
 {}
 
-IndexOutOfBoundsEvaluator::IndexOutOfBoundsEvaluator(size_t _index, size_t _size, string _message) : index(_index), message(::move(_message)), size(_size)
+IndexOutOfBoundsEvaluator::IndexOutOfBoundsEvaluator(const size_t _index, const size_t _size, string _message) : index(_index), message(::move(_message)), size(_size)
 {}
 
 IndexOutOfBoundsEvaluator::~IndexOutOfBoundsEvaluator() noexcept = default;
@@ -31,9 +31,7 @@ void IndexOutOfBoundsEvaluator::evaluate()
     {
       throw IndexOutOfBoundsException{};
     }
-    else
-    {
-      throw IndexOutOfBoundsException{this->message};
-    }
+
+    throw IndexOutOfBoundsException{this->message};
   }
 }

+ 1 - 2
source/ls-std/core/exception/EventNotHandledException.cpp

@@ -3,12 +3,11 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2023-02-04
- * Changed:         2023-05-19
+ * Changed:         2025-12-21
  *
  * */
 
 #include <ls-std/core/exception/EventNotHandledException.hpp>
-#include <ls-std/core/exception/ExceptionMessage.hpp>
 
 using ls::std::core::EventNotHandledException;
 using ls::std::core::Exception;

+ 2 - 2
source/ls-std/core/exception/Exception.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-22
-* Changed:         2023-05-19
+* Changed:         2025-12-21
 *
 * */
 
@@ -41,7 +41,7 @@ const char *Exception::_getIdentifiedMessage(const string &_defaultMessage) cons
   return ExceptionMessage{concatenatedMessage}.toCharacterPointer();
 }
 
-void Exception::_setMessage(string_view _message)
+void Exception::_setMessage(const string_view _message)
 {
   this->message = _message;
 }

+ 2 - 2
source/ls-std/core/exception/ExceptionMessage.cpp

@@ -3,7 +3,7 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-07
-* Changed:         2023-05-24
+* Changed:         2025-12-21
 *
 * */
 
@@ -14,7 +14,7 @@ using ls::std::core::ExceptionMessage;
 using std::move;
 using std::string;
 
-ExceptionMessage::ExceptionMessage(string _message) : message(::move(_message))
+ExceptionMessage::ExceptionMessage(string _message) : message(::move(_message)) // TODO: deprecated
 {}
 
 ExceptionMessage::~ExceptionMessage() = default;

+ 1 - 2
source/ls-std/core/exception/FileNotFoundException.cpp

@@ -3,11 +3,10 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2023-02-04
- * Changed:         2023-05-19
+ * Changed:         2025-12-21
  *
  * */
 
-#include <ls-std/core/exception/ExceptionMessage.hpp>
 #include <ls-std/core/exception/FileNotFoundException.hpp>
 
 using ls::std::core::Exception;

+ 1 - 2
source/ls-std/core/exception/FileOperationException.cpp

@@ -3,11 +3,10 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2023-02-04
- * Changed:         2023-05-19
+ * Changed:         2025-12-21
  *
  * */
 
-#include <ls-std/core/exception/ExceptionMessage.hpp>
 #include <ls-std/core/exception/FileOperationException.hpp>
 
 using ls::std::core::Exception;

+ 1 - 2
source/ls-std/core/exception/IllegalArgumentException.cpp

@@ -3,11 +3,10 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2023-02-04
- * Changed:         2023-05-19
+ * Changed:         2025-12-21
  *
  * */
 
-#include <ls-std/core/exception/ExceptionMessage.hpp>
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
 
 using ls::std::core::Exception;

+ 1 - 2
source/ls-std/core/exception/IllegalArithmeticOperationException.cpp

@@ -3,11 +3,10 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2023-02-04
- * Changed:         2023-05-19
+ * Changed:         2025-12-21
  *
  * */
 
-#include <ls-std/core/exception/ExceptionMessage.hpp>
 #include <ls-std/core/exception/IllegalArithmeticOperationException.hpp>
 
 using ls::std::core::Exception;

+ 1 - 2
source/ls-std/core/exception/IncompleteJsonException.cpp

@@ -3,11 +3,10 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2023-02-04
- * Changed:         2023-05-19
+ * Changed:         2025-12-21
  *
  * */
 
-#include <ls-std/core/exception/ExceptionMessage.hpp>
 #include <ls-std/core/exception/IncompleteJsonException.hpp>
 
 using ls::std::core::Exception;

+ 1 - 2
source/ls-std/core/exception/IndexOutOfBoundsException.cpp

@@ -3,11 +3,10 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-02-10
-* Changed:         2023-05-19
+* Changed:         2025-12-21
 *
 * */
 
-#include <ls-std/core/exception/ExceptionMessage.hpp>
 #include <ls-std/core/exception/IndexOutOfBoundsException.hpp>
 
 using ls::std::core::Exception;

+ 1 - 3
source/ls-std/core/exception/NotImplementedException.cpp

@@ -3,16 +3,14 @@
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2023-03-27
-* Changed:         2023-05-19
+* Changed:         2025-12-21
 *
 * */
 
-#include <ls-std/core/exception/ExceptionMessage.hpp>
 #include <ls-std/core/exception/NotImplementedException.hpp>
 #include <string>
 
 using ls::std::core::Exception;
-using ls::std::core::ExceptionMessage;
 using ls::std::core::NotImplementedException;
 using std::move;
 using std::string;

+ 1 - 2
source/ls-std/core/exception/NullPointerException.cpp

@@ -3,11 +3,10 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2023-02-04
- * Changed:         2023-05-19
+ * Changed:         2025-12-21
  *
  * */
 
-#include <ls-std/core/exception/ExceptionMessage.hpp>
 #include <ls-std/core/exception/NullPointerException.hpp>
 
 using ls::std::core::Exception;