mirror of
https://github.com/monero-project/monero.git
synced 2026-07-30 23:50:24 -07:00
trezor: replace use of boost::is_base_of with std::is_base_of
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <type_traits>
|
||||||
#include "device/device.hpp"
|
#include "device/device.hpp"
|
||||||
#include "device/device_default.hpp"
|
#include "device/device_default.hpp"
|
||||||
#include "device/device_cold.hpp"
|
#include "device/device_cold.hpp"
|
||||||
@@ -147,7 +148,7 @@ namespace trezor {
|
|||||||
bool open_session = false)
|
bool open_session = false)
|
||||||
{
|
{
|
||||||
// Require strictly protocol buffers response in the template.
|
// Require strictly protocol buffers response in the template.
|
||||||
BOOST_STATIC_ASSERT(boost::is_base_of<google::protobuf::Message, t_message>::value);
|
static_assert(std::is_base_of<google::protobuf::Message, t_message>::value);
|
||||||
const bool accepting_base = boost::is_same<google::protobuf::Message, t_message>::value;
|
const bool accepting_base = boost::is_same<google::protobuf::Message, t_message>::value;
|
||||||
if (resp_types && !accepting_base){
|
if (resp_types && !accepting_base){
|
||||||
throw std::invalid_argument("Cannot specify list of accepted types and not using generic response");
|
throw std::invalid_argument("Cannot specify list of accepted types and not using generic response");
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "transport.hpp"
|
#include "transport.hpp"
|
||||||
#include "messages/messages-debug.pb.h"
|
#include "messages/messages-debug.pb.h"
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
|
||||||
namespace hw {
|
namespace hw {
|
||||||
@@ -60,7 +61,7 @@ namespace trezor {
|
|||||||
const boost::optional<messages::MessageType> &resp_type = boost::none,
|
const boost::optional<messages::MessageType> &resp_type = boost::none,
|
||||||
bool no_wait = false)
|
bool no_wait = false)
|
||||||
{
|
{
|
||||||
BOOST_STATIC_ASSERT(boost::is_base_of<google::protobuf::Message, t_message>::value);
|
static_assert(std::is_base_of<google::protobuf::Message, t_message>::value);
|
||||||
|
|
||||||
m_transport->write(req);
|
m_transport->write(req);
|
||||||
if (no_wait){
|
if (no_wait){
|
||||||
|
|||||||
@@ -72,14 +72,14 @@ namespace trezor {
|
|||||||
|
|
||||||
template<class t_message=google::protobuf::Message>
|
template<class t_message=google::protobuf::Message>
|
||||||
static messages::MessageType get_message_wire_number() {
|
static messages::MessageType get_message_wire_number() {
|
||||||
BOOST_STATIC_ASSERT(boost::is_base_of<google::protobuf::Message, t_message>::value);
|
static_assert(std::is_base_of<google::protobuf::Message, t_message>::value);
|
||||||
return get_message_wire_number(t_message::default_instance().GetDescriptor()->name());
|
return get_message_wire_number(t_message::default_instance().GetDescriptor()->name());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class t_message=google::protobuf::Message>
|
template<class t_message=google::protobuf::Message>
|
||||||
std::shared_ptr<t_message> message_ptr_retype(std::shared_ptr<google::protobuf::Message> & in){
|
std::shared_ptr<t_message> message_ptr_retype(std::shared_ptr<google::protobuf::Message> & in){
|
||||||
BOOST_STATIC_ASSERT(boost::is_base_of<google::protobuf::Message, t_message>::value);
|
static_assert(std::is_base_of<google::protobuf::Message, t_message>::value);
|
||||||
if (!in){
|
if (!in){
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ namespace trezor {
|
|||||||
|
|
||||||
template<class t_message=google::protobuf::Message>
|
template<class t_message=google::protobuf::Message>
|
||||||
std::shared_ptr<t_message> message_ptr_retype_static(std::shared_ptr<google::protobuf::Message> & in){
|
std::shared_ptr<t_message> message_ptr_retype_static(std::shared_ptr<google::protobuf::Message> & in){
|
||||||
BOOST_STATIC_ASSERT(boost::is_base_of<google::protobuf::Message, t_message>::value);
|
static_assert(std::is_base_of<google::protobuf::Message, t_message>::value);
|
||||||
if (!in){
|
if (!in){
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ namespace trezor {
|
|||||||
boost::optional<messages::MessageType> resp_type = boost::none)
|
boost::optional<messages::MessageType> resp_type = boost::none)
|
||||||
{
|
{
|
||||||
// Require strictly protocol buffers response in the template.
|
// Require strictly protocol buffers response in the template.
|
||||||
BOOST_STATIC_ASSERT(boost::is_base_of<google::protobuf::Message, t_message>::value);
|
static_assert(std::is_base_of<google::protobuf::Message, t_message>::value);
|
||||||
|
|
||||||
// Write the request
|
// Write the request
|
||||||
transport.write(req);
|
transport.write(req);
|
||||||
|
|||||||
Reference in New Issue
Block a user