Skip to content

Commit

Permalink
Update make_device_identifiers to accept nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Jun 13, 2024
1 parent 47f6385 commit 3711075
Show file tree
Hide file tree
Showing 2 changed files with 252 additions and 413 deletions.
19 changes: 11 additions & 8 deletions src/lib/libkrbn/include/libkrbn/impl/libkrbn_cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ class libkrbn_cpp final {
return libkrbn_components_manager_;
}

static krbn::device_identifiers make_device_identifiers(const libkrbn_device_identifiers& device_identifiers) {
krbn::device_identifiers identifiers(pqrs::hid::vendor_id::value_t(device_identifiers.vendor_id),
pqrs::hid::product_id::value_t(device_identifiers.product_id),
device_identifiers.is_keyboard,
device_identifiers.is_pointing_device,
device_identifiers.is_game_pad,
device_identifiers.device_address);
return identifiers;
static krbn::device_identifiers make_device_identifiers(const libkrbn_device_identifiers* device_identifiers) {
if (device_identifiers) {
return krbn::device_identifiers(pqrs::hid::vendor_id::value_t(device_identifiers->vendor_id),
pqrs::hid::product_id::value_t(device_identifiers->product_id),
device_identifiers->is_keyboard,
device_identifiers->is_pointing_device,
device_identifiers->is_game_pad,
device_identifiers->device_address);
}

return krbn::device_identifiers();
}
};
Loading

0 comments on commit 3711075

Please sign in to comment.