libcamera: Use 'struct' for structure types
Add back the 'struct' keyword for structure types. C++ allows omitting the 'struct' keywork. Add it back to make clear we're dealing with structures and not class types. While at there re-sort fields of media_v2_* type in populate() function to reflect the declaration order in the kernel headers. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
4e5a93da83
commit
171f4c0a0d
1 changed files with 17 additions and 17 deletions
|
@ -206,9 +206,9 @@ int MediaDevice::populate()
|
|||
{
|
||||
struct media_v2_topology topology = { };
|
||||
struct media_v2_entity *ents = nullptr;
|
||||
struct media_v2_interface *interfaces = nullptr;
|
||||
struct media_v2_link *links = nullptr;
|
||||
struct media_v2_pad *pads = nullptr;
|
||||
struct media_v2_interface *interfaces = nullptr;
|
||||
__u64 version = -1;
|
||||
int ret;
|
||||
|
||||
|
@ -220,9 +220,9 @@ int MediaDevice::populate()
|
|||
while (true) {
|
||||
topology.topology_version = 0;
|
||||
topology.ptr_entities = reinterpret_cast<__u64>(ents);
|
||||
topology.ptr_interfaces = reinterpret_cast<__u64>(interfaces);
|
||||
topology.ptr_links = reinterpret_cast<__u64>(links);
|
||||
topology.ptr_pads = reinterpret_cast<__u64>(pads);
|
||||
topology.ptr_interfaces = reinterpret_cast<__u64>(interfaces);
|
||||
|
||||
ret = ioctl(fd_, MEDIA_IOC_G_TOPOLOGY, &topology);
|
||||
if (ret < 0) {
|
||||
|
@ -235,15 +235,15 @@ int MediaDevice::populate()
|
|||
if (version == topology.topology_version)
|
||||
break;
|
||||
|
||||
delete[] links;
|
||||
delete[] ents;
|
||||
delete[] pads;
|
||||
delete[] interfaces;
|
||||
delete[] pads;
|
||||
delete[] links;
|
||||
|
||||
ents = new media_v2_entity[topology.num_entities]();
|
||||
links = new media_v2_link[topology.num_links]();
|
||||
pads = new media_v2_pad[topology.num_pads]();
|
||||
interfaces = new media_v2_interface[topology.num_interfaces]();
|
||||
ents = new struct media_v2_entity[topology.num_entities]();
|
||||
interfaces = new struct media_v2_interface[topology.num_interfaces]();
|
||||
links = new struct media_v2_link[topology.num_links]();
|
||||
pads = new struct media_v2_pad[topology.num_pads]();
|
||||
|
||||
version = topology.topology_version;
|
||||
}
|
||||
|
@ -254,10 +254,10 @@ int MediaDevice::populate()
|
|||
populateLinks(topology))
|
||||
valid_ = true;
|
||||
|
||||
delete[] links;
|
||||
delete[] ents;
|
||||
delete[] pads;
|
||||
delete[] interfaces;
|
||||
delete[] pads;
|
||||
delete[] links;
|
||||
|
||||
if (!valid_) {
|
||||
clear();
|
||||
|
@ -417,7 +417,7 @@ struct media_v2_interface *MediaDevice::findInterface(const struct media_v2_topo
|
|||
*/
|
||||
bool MediaDevice::populateEntities(const struct media_v2_topology &topology)
|
||||
{
|
||||
media_v2_entity *mediaEntities = reinterpret_cast<media_v2_entity *>
|
||||
struct media_v2_entity *mediaEntities = reinterpret_cast<struct media_v2_entity *>
|
||||
(topology.ptr_entities);
|
||||
|
||||
for (unsigned int i = 0; i < topology.num_entities; ++i) {
|
||||
|
@ -449,7 +449,7 @@ bool MediaDevice::populateEntities(const struct media_v2_topology &topology)
|
|||
|
||||
bool MediaDevice::populatePads(const struct media_v2_topology &topology)
|
||||
{
|
||||
media_v2_pad *mediaPads = reinterpret_cast<media_v2_pad *>
|
||||
struct media_v2_pad *mediaPads = reinterpret_cast<struct media_v2_pad *>
|
||||
(topology.ptr_pads);
|
||||
|
||||
for (unsigned int i = 0; i < topology.num_pads; ++i) {
|
||||
|
@ -478,7 +478,7 @@ bool MediaDevice::populatePads(const struct media_v2_topology &topology)
|
|||
|
||||
bool MediaDevice::populateLinks(const struct media_v2_topology &topology)
|
||||
{
|
||||
media_v2_link *mediaLinks = reinterpret_cast<media_v2_link *>
|
||||
struct media_v2_link *mediaLinks = reinterpret_cast<struct media_v2_link *>
|
||||
(topology.ptr_links);
|
||||
|
||||
for (unsigned int i = 0; i < topology.num_links; ++i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue