Fix indentation

This commit is contained in:
momo5502 2018-12-27 17:28:12 +01:00
parent 071dbfa5fc
commit a120591be3
7 changed files with 367 additions and 360 deletions

View File

@ -30,8 +30,8 @@ namespace demonware
printf("DW: Handling subservice of type %d\n", this->sub_type_);
const auto callback = this->callbacks.find(this->sub_type_);
if (callback != this->callbacks.end())
const auto callback = this->callbacks_.find(this->sub_type_);
if (callback != this->callbacks_.end())
{
callback->second(server, &buffer);
}
@ -42,21 +42,21 @@ namespace demonware
}
protected:
std::map<uint8_t, callback> callbacks{};
std::map<uint8_t, callback> callbacks_{};
template<typename Class, typename T, typename... Args>
void register_service(const uint8_t type, T(Class::*callback)(Args ...) const)
template <typename Class, typename T, typename... Args>
void register_service(const uint8_t type, T (Class::*callback)(Args ...) const)
{
this->callbacks[type] = [this, callback](Args... args) -> T
this->callbacks_[type] = [this, callback](Args ... args) -> T
{
return (reinterpret_cast<Class*>(this)->*callback)(args...);
};
}
template<typename Class, typename T, typename... Args>
void register_service(const uint8_t type, T(Class::*callback)(Args ...))
template <typename Class, typename T, typename... Args>
void register_service(const uint8_t type, T (Class::*callback)(Args ...))
{
this->callbacks[type] = [this, callback](Args... args) -> T
this->callbacks_[type] = [this, callback](Args ... args) -> T
{
return (reinterpret_cast<Class*>(this)->*callback)(args...);
};
@ -70,7 +70,7 @@ namespace demonware
uint8_t sub_type_{};
};
template<uint16_t Type>
template <uint16_t Type>
class i_generic_service : public i_service
{
public:

View File

@ -173,7 +173,7 @@ namespace demonware
auto iv_hash = utils::cryptography::tiger::compute(std::string(reinterpret_cast<char*>(&iv), 4));
const std::string key(reinterpret_cast<char*>(dw::get_key(false)), 24);
p_buffer = byte_buffer{ utils::cryptography::des3::decrypt(p_buffer.get_remaining(), iv_hash, key) };
p_buffer = byte_buffer{utils::cryptography::des3::decrypt(p_buffer.get_remaining(), iv_hash, key)};
p_buffer.set_use_data_types(false);
int checksum;

View File

@ -8,7 +8,8 @@ namespace demonware
public:
explicit service_server(std::string name);
template <typename T> void register_service()
template <typename T>
void register_service()
{
static_assert(std::is_base_of<i_service, T>::value, "Service must inherit from IService");

View File

@ -43,8 +43,9 @@ namespace demonware
const auto iv = utils::cryptography::tiger::compute(std::string(reinterpret_cast<char*>(&seed), 4));
const std::string enc_key (reinterpret_cast<char*>(&ticket[32]), 24);
auto enc_ticket = utils::cryptography::des3::encrypt(std::string(reinterpret_cast<char*>(&auth_ticket), sizeof(auth_ticket)), iv,enc_key );
const std::string enc_key(reinterpret_cast<char*>(&ticket[32]), 24);
auto enc_ticket = utils::cryptography::des3::encrypt(
std::string(reinterpret_cast<char*>(&auth_ticket), sizeof(auth_ticket)), iv, enc_key);
bit_buffer response;
response.set_use_data_types(false);

View File

@ -43,7 +43,7 @@ namespace demonware
bool bdStorage::load_publisher_resource(const std::string& name, std::string& buffer)
{
for(const auto& resource : this->publisher_resources_)
for (const auto& resource : this->publisher_resources_)
{
if (std::regex_match(name, resource.first))
{
@ -99,7 +99,7 @@ namespace demonware
printf("DW: Loading user file: %s\n", filename.data());
const auto path = get_user_file_path(filename);
if(utils::io::read_file(path, &data))
if (utils::io::read_file(path, &data))
{
auto reply = server->create_reply(this->get_sub_type());
reply->add(new bdFileData(data));
@ -127,7 +127,7 @@ namespace demonware
auto reply = server->create_reply(this->get_sub_type());
const auto path = get_user_file_path(filename);
if(utils::io::read_file(path, &data))
if (utils::io::read_file(path, &data))
{
auto* info = new bdFileInfo;
@ -252,7 +252,7 @@ namespace demonware
buffer->read_string(&platform);
const auto path = get_user_file_path(filename);
if(utils::io::read_file(path, &data))
if (utils::io::read_file(path, &data))
{
auto reply = server->create_reply(this->get_sub_type());
reply->add(new bdFileData(data));

View File

@ -60,9 +60,14 @@ namespace demonware
switch (type)
{
case 30: this->ip_discovery(s, to, tolen); break;
case 20: this->nat_discovery(s, to, tolen); break;
default: break;
case 30:
this->ip_discovery(s, to, tolen);
break;
case 20:
this->nat_discovery(s, to, tolen);
break;
default:
break;
}
return len;