aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/error.cpp
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-05-04 16:11:03 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-05-04 16:12:37 +0300
commit6845df16333e7504abd7cceb2b5cb4e7637c73fb (patch)
tree2de6857a5bec4a45d9d9cb89622481f6c422b7a7 /src/error.cpp
parentfix compiler warnings (diff)
downloadwinapi-common-6845df16333e7504abd7cceb2b5cb4e7637c73fb.tar.gz
winapi-common-6845df16333e7504abd7cceb2b5cb4e7637c73fb.zip
move away from variable-size ints
Diffstat (limited to 'src/error.cpp')
-rw-r--r--src/error.cpp9
1 files changed, 5 insertions, 4 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