Mostly style nits:
+ event_cookie->set_mac(reinterpret_cast<char const*>(cookie.mac), sizeof(cookie.mac));
reinterpret_cast<> should be the penultimate resort to do something non-portable. That isn't the case here as *no cast is required*.
~~~~
+ std::array<uint8_t, 20> mac; int32_t deviceId; int32_t source; int32_t action; @@ -81,7 +81,7 @@ struct Motion { uint32_t seq; int64_t eventTime; - uint64_t mac; + std::array<uint8_t, 20> mac;
mir::cookie::Mac
std::begin(cookie.mac) + sizeof(cookie.mac)
can be written
std::end(cookie.mac)
+ mir::cookie::Mac mac; + auto cookie = cookie_factory->timestamp_to_cookie(timestamp.count()); + std::copy(std::begin(cookie.mac), std::begin(cookie.mac) + sizeof(cookie.mac), mac.begin());
Why stick the "auto cookie..." line between creating and initializing mac?
=== modified file 'src/client/input/input_event.cpp' ... +#include <string.h> +
Not needed.
=== modified file 'src/server/input/default_event_builder.cpp' ... +#include <string.h>
Finally, just a (non-blocking) comment:
+ std::copy(old_kev.mac.begin(), old_kev.mac.end(), std::begin(cookie.mac));
could be written as
std::copy(begin(old_kev.mac), end(old_kev.mac), std::begin(cookie.mac));
« Back to merge proposal
Mostly style nits:
+ event_cookie- >set_mac( reinterpret_ cast<char const*> (cookie. mac), sizeof( cookie. mac));
reinterpret_cast<> should be the penultimate resort to do something non-portable. That isn't the case here as *no cast is required*.
~~~~
+ std::array<uint8_t, 20> mac;
int32_ t deviceId;
int32_ t source;
int32_ t action;
uint32_ t seq;
int64_ t eventTime;
@@ -81,7 +81,7 @@
struct Motion {
- uint64_t mac;
+ std::array<uint8_t, 20> mac;
mir::cookie::Mac
~~~~
std::begin( cookie. mac) + sizeof(cookie.mac)
can be written
std::end( cookie. mac)
~~~~
+ mir::cookie::Mac mac; factory- >timestamp_ to_cookie( timestamp. count() ); std::begin( cookie. mac), std::begin( cookie. mac) + sizeof(cookie.mac), mac.begin());
+ auto cookie = cookie_
+ std::copy(
Why stick the "auto cookie..." line between creating and initializing mac?
~~~~
=== modified file 'src/client/ input/input_ event.cpp'
...
+#include <string.h>
+
Not needed.
~~~~
=== modified file 'src/server/ input/default_ event_builder. cpp'
...
+#include <string.h>
Not needed.
~~~~
Finally, just a (non-blocking) comment:
+ std::copy( old_kev. mac.begin( ), old_kev.mac.end(), std::begin( cookie. mac));
could be written as
std: :copy(begin( old_kev. mac), end(old_kev.mac), std::begin( cookie. mac));