diff --git a/src/console.cpp b/src/console.cpp index 35ed82e..b8c6d71 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -72,7 +72,7 @@ namespace console #endif if (count < 0) return {}; - return {buffer, static_cast(count)}; + return {buffer, static_cast(count)}; } #ifdef _WIN32 @@ -91,7 +91,7 @@ namespace console #endif } - bool apply_color(const std::string& data, const size_t index, const color_type base_color) + bool apply_color(const std::string& data, const std::size_t index, const color_type base_color) { if (data[index] != '^' || (index + 1) >= data.size()) { @@ -122,7 +122,7 @@ namespace console lock _{}; set_color(base_color); - for (size_t i = 0; i < line.size(); ++i) + for (std::size_t i = 0; i < line.size(); ++i) { if (apply_color(line, i, base_color)) { diff --git a/src/utils/io.cpp b/src/utils/io.cpp index c1f4f22..2145539 100644 --- a/src/utils/io.cpp +++ b/src/utils/io.cpp @@ -7,12 +7,12 @@ namespace utils { bool remove_file(const std::string& file) { - return remove(file.data()) == 0; + return std::remove(file.data()) == 0; } bool move_file(const std::string& src, const std::string& target) { - return rename(src.data(), target.data()) == 0; + return std::rename(src.data(), target.data()) == 0; } bool file_exists(const std::string& file) diff --git a/src/utils/memory.cpp b/src/utils/memory.cpp index 880d4b5..3f91956 100644 --- a/src/utils/memory.cpp +++ b/src/utils/memory.cpp @@ -15,7 +15,7 @@ namespace utils { std::lock_guard _(this->mutex_); - for (auto& data : this->pool_) + for (const auto& data : this->pool_) { memory::free(data); } @@ -40,7 +40,7 @@ namespace utils this->free(const_cast(data)); } - void* memory::allocator::allocate(const size_t length) + void* memory::allocator::allocate(const std::size_t length) { std::lock_guard _(this->mutex_); @@ -63,9 +63,9 @@ namespace utils return data; } - void* memory::allocate(const size_t length) + void* memory::allocate(const std::size_t length) { - return calloc(length, 1); + return std::calloc(length, 1); } char* memory::duplicate_string(const std::string& string) @@ -77,10 +77,7 @@ namespace utils void memory::free(void* data) { - if (data) - { - ::free(data); - } + std::free(data); } void memory::free(const void* data) @@ -88,11 +85,11 @@ namespace utils free(const_cast(data)); } - bool memory::is_set(const void* mem, const char chr, const size_t length) + bool memory::is_set(const void* mem, const char chr, const std::size_t length) { auto* const mem_arr = static_cast(mem); - for (size_t i = 0; i < length; ++i) + for (std::size_t i = 0; i < length; ++i) { if (mem_arr[i] != chr) { diff --git a/src/utils/memory.hpp b/src/utils/memory.hpp index 09c0d4b..7d693c3 100644 --- a/src/utils/memory.hpp +++ b/src/utils/memory.hpp @@ -19,7 +19,7 @@ namespace utils void free(const void* data); - void* allocate(size_t length); + void* allocate(std::size_t length); template T* allocate() @@ -28,7 +28,7 @@ namespace utils } template - T* allocate_array(const size_t count = 1) + T* allocate_array(const std::size_t count = 1) { return static_cast(this->allocate(count * sizeof(T))); } @@ -42,7 +42,7 @@ namespace utils std::vector pool_; }; - static void* allocate(size_t length); + static void* allocate(std::size_t length); template static T* allocate() @@ -51,7 +51,7 @@ namespace utils } template - static T* allocate_array(const size_t count = 1) + static T* allocate_array(const std::size_t count = 1) { return static_cast(allocate(count * sizeof(T))); } @@ -61,7 +61,7 @@ namespace utils static void free(void* data); static void free(const void* data); - static bool is_set(const void* mem, char chr, size_t length); + static bool is_set(const void* mem, char chr, std::size_t length); static allocator* get_allocator(); diff --git a/src/utils/string.cpp b/src/utils/string.cpp index ff08cad..ba542e0 100644 --- a/src/utils/string.cpp +++ b/src/utils/string.cpp @@ -40,9 +40,9 @@ namespace utils std::string to_lower(std::string text) { std::transform(text.begin(), text.end(), text.begin(), [](const unsigned char input) - { - return static_cast(std::tolower(input)); - }); + { + return static_cast(std::tolower(input)); + }); return text; } @@ -50,9 +50,9 @@ namespace utils std::string to_upper(std::string text) { std::transform(text.begin(), text.end(), text.begin(), [](const unsigned char input) - { - return static_cast(std::toupper(input)); - }); + { + return static_cast(std::toupper(input)); + }); return text; }