diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dbghelp.cpp | 6 | ||||
-rw-r--r-- | src/module.cpp | 6 | ||||
-rw-r--r-- | src/utils/file.cpp | 5 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/dbghelp.cpp b/src/dbghelp.cpp index 40c2ba5..af8d64d 100644 --- a/src/dbghelp.cpp +++ b/src/dbghelp.cpp @@ -5,8 +5,9 @@ #include "pdb/all.hpp" +#include <SafeInt.hpp> + #include <Windows.h> -#include <safeint.h> #pragma warning(push, 0) #include <DbgHelp.h> #pragma warning(pop, 0) @@ -39,7 +40,6 @@ Address next_offline_base = 0x10000000; Address gen_next_offline_base(std::size_t pdb_size) { const auto base = next_offline_base; - using msl::utilities::SafeAdd; if (!SafeAdd(next_offline_base, pdb_size, next_offline_base)) throw std::runtime_error{ "no more PDB files can be added, the internal address space is exhausted"}; @@ -75,7 +75,7 @@ void DbgHelp::close() { ModuleInfo DbgHelp::load_pdb(const std::string& path) const { DWORD size = 0; - if (!msl::utilities::SafeCast(file::get_size(path), size)) + if (!SafeCast(file::get_size(path), size)) throw std::range_error{"PDB file is too large"}; const auto offline_base = diff --git a/src/module.cpp b/src/module.cpp index 0bf9329..9f12599 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -5,7 +5,7 @@ #include "pdb/all.hpp" -#include <safeint.h> +#include <SafeInt.hpp> #include <cstring> #include <sstream> @@ -33,7 +33,7 @@ Address Module::translate_offline_address(Address offline) const { throw std::range_error{invalid_offline_address(offline)}; const auto offset = offline - get_offline_base(); auto online = offset; - if (!msl::utilities::SafeAdd(online, get_online_base(), online)) + if (!SafeAdd(online, get_online_base(), online)) throw std::range_error{invalid_offline_address(offline)}; return online; } @@ -43,7 +43,7 @@ Address Module::translate_online_address(Address online) const { throw std::range_error{invalid_online_address(online)}; const auto offset = online - get_online_base(); auto offline = offset; - if (!msl::utilities::SafeAdd(offline, get_offline_base(), offline)) + if (!SafeAdd(offline, get_offline_base(), offline)) throw std::range_error{invalid_online_address(offline)}; return offline; } diff --git a/src/utils/file.cpp b/src/utils/file.cpp index c25307a..85af444 100644 --- a/src/utils/file.cpp +++ b/src/utils/file.cpp @@ -5,8 +5,9 @@ #include "pdb/all.hpp" +#include <SafeInt.hpp> + #include <Windows.h> -#include <safeint.h> #include <cstddef> #include <stdexcept> @@ -34,7 +35,7 @@ std::size_t get_size(const std::string& path) { std::size_t result = 0; - if (!msl::utilities::SafeCast(size.QuadPart, result)) + if (!SafeCast(size.QuadPart, result)) throw std::runtime_error{"invalid file size"}; return result; |