diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-04 16:11:03 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-05-04 16:12:37 +0300 |
commit | 6845df16333e7504abd7cceb2b5cb4e7637c73fb (patch) | |
tree | 2de6857a5bec4a45d9d9cb89622481f6c422b7a7 /src | |
parent | fix compiler warnings (diff) | |
download | winapi-common-6845df16333e7504abd7cceb2b5cb4e7637c73fb.tar.gz winapi-common-6845df16333e7504abd7cceb2b5cb4e7637c73fb.zip |
move away from variable-size ints
Diffstat (limited to 'src')
-rw-r--r-- | src/error.cpp | 9 | ||||
-rw-r--r-- | src/process.cpp | 7 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/error.cpp b/src/error.cpp index ff755b6..d0c8a53 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -8,6 +8,7 @@ #include <windows.h> +#include <cstdint> #include <sstream> #include <string> #include <system_error> @@ -29,7 +30,7 @@ std::string build_what(DWORD code, const char* function) { return what.str(); } -std::string format_message(int code) { +std::string format_message(int32_t code) { wchar_t* buf; const auto len = ::FormatMessageW( @@ -53,14 +54,14 @@ std::string format_message(int code) { } // namespace -std::string CategoryWindows::message(int code) const { +std::string CategoryWindows::message(int32_t code) const { return format_message(code); } std::system_error windows(DWORD code, const char* function) { - static_assert(sizeof(DWORD) == sizeof(int), "Aren't DWORDs the same size as ints?"); + static_assert(sizeof(DWORD) == sizeof(int32_t), "Aren't DWORDs the same size as ints?"); return std::system_error{ - static_cast<int>(code), category_windows(), build_what(code, function)}; + static_cast<int32_t>(code), category_windows(), build_what(code, function)}; } } // namespace error diff --git a/src/process.cpp b/src/process.cpp index 2be7f0d..0d9837b 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -124,8 +124,7 @@ Handle shell_execute(const ShellParameters& params) { const auto lpFile = widen(params.cmd_line.get_argv0()); const auto lpParameters = widen(params.cmd_line.args_to_string()); - BOOST_STATIC_CONSTEXPR unsigned long default_fMask = - SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI; + BOOST_STATIC_CONSTEXPR uint32_t default_fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI; auto fMask = default_fMask; auto nShow = SW_SHOWDEFAULT; @@ -325,7 +324,7 @@ std::string Process::get_exe_path() { } } -std::string Process::get_resource_string(unsigned int id) { +std::string Process::get_resource_string(uint32_t id) { wchar_t* s = nullptr; const auto nch = ::LoadStringW(get_exe_module(), id, reinterpret_cast<wchar_t*>(&s), 0); @@ -337,7 +336,7 @@ std::string Process::get_resource_string(unsigned int id) { return narrow(s, nch * sizeof(wchar_t)); } -Resource Process::get_resource(unsigned int id) { +Resource Process::get_resource(uint32_t id) { const auto module = get_exe_module(); const auto src = ::FindResourceA(module, MAKEINTRESOURCEA(id), RT_RCDATA); |