From d50564853f69136418a11124be27a69cd05cc723 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 1 Jun 2017 05:09:07 +0300 Subject: um: fix compiler warnings --- um/wrappers/simple/src/device.cpp | 4 +++- um/wrappers/special/nt_namespace/src/device.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/um/wrappers/simple/src/device.cpp b/um/wrappers/simple/src/device.cpp index 2523be6..d1a0d42 100644 --- a/um/wrappers/simple/src/device.cpp +++ b/um/wrappers/simple/src/device.cpp @@ -23,10 +23,12 @@ namespace simple unsigned int Device::exchange_ints(unsigned int src) const { + static_assert(sizeof(exchange_ints_ctl_code) == sizeof(service::Device::Code), "CTL_CODE() must produce DWORDs"); + unsigned int dest; send_control_code( - exchange_ints_ctl_code, + static_cast(exchange_ints_ctl_code), &src, sizeof(src), &dest, diff --git a/um/wrappers/special/nt_namespace/src/device.cpp b/um/wrappers/special/nt_namespace/src/device.cpp index 1697e45..4f9021b 100644 --- a/um/wrappers/special/nt_namespace/src/device.cpp +++ b/um/wrappers/special/nt_namespace/src/device.cpp @@ -29,15 +29,17 @@ namespace nt_namespace const auto in_buf = src.c_str(); const auto in_buf_size = (src.size() + 1) * sizeof(wchar_t); + static_assert(sizeof(control_code) == sizeof(service::Device::Code), "CTL_CODE() must return DWORDs"); + const auto nbreq = get_required_output_size( - control_code, + static_cast(control_code), in_buf, in_buf_size); std::vector output(nbreq); send_control_code( - control_code, + static_cast(control_code), in_buf, in_buf_size, output.data(), -- cgit v1.2.3