diff options
Diffstat (limited to '')
-rw-r--r-- | include/winapi/error.hpp | 3 | ||||
-rw-r--r-- | include/winapi/process.hpp | 5 | ||||
-rw-r--r-- | src/error.cpp | 9 | ||||
-rw-r--r-- | src/process.cpp | 7 | ||||
-rw-r--r-- | test/unit_tests/resource.cpp | 4 | ||||
-rw-r--r-- | test/unit_tests/shmem.cpp | 9 | ||||
-rw-r--r-- | test/unit_tests/worker/worker.cpp | 2 |
7 files changed, 22 insertions, 17 deletions
diff --git a/include/winapi/error.hpp b/include/winapi/error.hpp index 89bcfed..a14d333 100644 --- a/include/winapi/error.hpp +++ b/include/winapi/error.hpp @@ -9,6 +9,7 @@ #include <windows.h> +#include <cstdint> #include <sstream> #include <stdexcept> #include <string> @@ -23,7 +24,7 @@ public: const char* name() const BOOST_NOEXCEPT_OR_NOTHROW { return "Windows"; } - std::string message(int) const; + std::string message(int32_t) const; }; inline const CategoryWindows& category_windows() { diff --git a/include/winapi/process.hpp b/include/winapi/process.hpp index db5f5d1..2e1420f 100644 --- a/include/winapi/process.hpp +++ b/include/winapi/process.hpp @@ -15,6 +15,7 @@ #include <windows.h> +#include <cstdint> #include <string> #include <utility> @@ -89,8 +90,8 @@ public: static std::string get_exe_path(); - static Resource get_resource(unsigned int id); - static std::string get_resource_string(unsigned int id); + static Resource get_resource(uint32_t id); + static std::string get_resource_string(uint32_t id); private: explicit Process(Handle&& handle) : m_handle(std::move(handle)) {} 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); diff --git a/test/unit_tests/resource.cpp b/test/unit_tests/resource.cpp index 894edca..66556d5 100644 --- a/test/unit_tests/resource.cpp +++ b/test/unit_tests/resource.cpp @@ -12,6 +12,8 @@ #include <boost/format.hpp> #include <boost/test/unit_test.hpp> +#include <cstdint> + using namespace winapi; #include <ostream> @@ -20,7 +22,7 @@ using namespace winapi; namespace std { ostream& operator<<(ostream& os, unsigned char c) { - return os << boost::format("%|1$02x|") % static_cast<unsigned int>(c); + return os << boost::format("%|1$02x|") % static_cast<uint32_t>(c); } ostream& operator<<(ostream& os, const vector<unsigned char>& cs) { diff --git a/test/unit_tests/shmem.cpp b/test/unit_tests/shmem.cpp index 4220386..894a0f9 100644 --- a/test/unit_tests/shmem.cpp +++ b/test/unit_tests/shmem.cpp @@ -9,6 +9,7 @@ #include <boost/test/unit_test.hpp> #include <condition_variable> +#include <cstdint> #include <mutex> #include <thread> @@ -18,14 +19,14 @@ namespace { BOOST_CONSTEXPR_OR_CONST auto shmem_name = "test-data-struct"; -BOOST_CONSTEXPR_OR_CONST int main_data = -1; -BOOST_CONSTEXPR_OR_CONST int setter1_data = 69; -BOOST_CONSTEXPR_OR_CONST int setter2_data = 420; +BOOST_CONSTEXPR_OR_CONST int32_t main_data = -1; +BOOST_CONSTEXPR_OR_CONST int32_t setter1_data = 69; +BOOST_CONSTEXPR_OR_CONST int32_t setter2_data = 420; struct DataStruct { std::mutex mtx; std::condition_variable cv; - int data; + int32_t data; }; void setter1_main() { diff --git a/test/unit_tests/worker/worker.cpp b/test/unit_tests/worker/worker.cpp index 093bba8..c4dadf8 100644 --- a/test/unit_tests/worker/worker.cpp +++ b/test/unit_tests/worker/worker.cpp @@ -112,7 +112,7 @@ int loop() { } // namespace int main() { - int ec = loop(); + auto ec = loop(); std::this_thread::sleep_for(std::chrono::milliseconds{1000}); return ec; } |