Skip to content

Commit

Permalink
change find_or_append_child_box() return type to unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Oct 20, 2024
1 parent 30c0678 commit d386233
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions libheif/box.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2342,9 +2342,9 @@ std::string Box_iprp::dump(Indent& indent) const
}


int Box_ipco::find_or_append_child_box(const std::shared_ptr<Box>& box)
uint32_t Box_ipco::find_or_append_child_box(const std::shared_ptr<Box>& box)
{
for (int i = 0; i < (int) m_children.size(); i++) {
for (uint32_t i = 0; i < (uint32_t) m_children.size(); i++) {
if (Box::equal(m_children[i], box)) {
return i;
}
Expand Down
4 changes: 2 additions & 2 deletions libheif/box.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class Box : public BoxHeader

const std::vector<std::shared_ptr<Box>>& get_all_child_boxes() const { return m_children; }

int append_child_box(const std::shared_ptr<Box>& box)
uint32_t append_child_box(const std::shared_ptr<Box>& box)
{
m_children.push_back(box);
return (int) m_children.size() - 1;
Expand Down Expand Up @@ -685,7 +685,7 @@ class Box_ipco : public Box
set_short_type(fourcc("ipco"));
}

int find_or_append_child_box(const std::shared_ptr<Box>& box);
uint32_t find_or_append_child_box(const std::shared_ptr<Box>& box);

Error get_properties_for_item_ID(heif_item_id itemID,
const std::shared_ptr<class Box_ipma>&,
Expand Down
12 changes: 6 additions & 6 deletions libheif/file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ void HeifFile::add_ispe_property(heif_item_id id, uint32_t width, uint32_t heigh
auto ispe = std::make_shared<Box_ispe>();
ispe->set_size(width, height);

int index = m_ipco_box->find_or_append_child_box(ispe);
uint32_t index = m_ipco_box->find_or_append_child_box(ispe);

m_ipma_box->add_property_for_item_ID(id, Box_ipma::PropertyAssociation{essential, uint16_t(index + 1)});
}
Expand All @@ -1027,7 +1027,7 @@ void HeifFile::add_ispe_property(heif_item_id id, uint32_t width, uint32_t heigh

heif_property_id HeifFile::add_property(heif_item_id id, const std::shared_ptr<Box>& property, bool essential)
{
int index = m_ipco_box->find_or_append_child_box(property);
uint32_t index = m_ipco_box->find_or_append_child_box(property);

m_ipma_box->add_property_for_item_ID(id, Box_ipma::PropertyAssociation{essential, uint16_t(index + 1)});

Expand All @@ -1037,7 +1037,7 @@ heif_property_id HeifFile::add_property(heif_item_id id, const std::shared_ptr<B

heif_property_id HeifFile::add_property_without_deduplication(heif_item_id id, const std::shared_ptr<Box>& property, bool essential)
{
int index = m_ipco_box->append_child_box(property);
uint32_t index = m_ipco_box->append_child_box(property);

m_ipma_box->add_property_for_item_ID(id, Box_ipma::PropertyAssociation{essential, uint16_t(index + 1)});

Expand Down Expand Up @@ -1091,7 +1091,7 @@ void HeifFile::add_orientation_properties(heif_item_id id, heif_orientation orie
auto irot = std::make_shared<Box_irot>();
irot->set_rotation_ccw(rotation_ccw);

int index = m_ipco_box->find_or_append_child_box(irot);
uint32_t index = m_ipco_box->find_or_append_child_box(irot);

m_ipma_box->add_property_for_item_ID(id, Box_ipma::PropertyAssociation{false, uint16_t(index + 1)});
}
Expand All @@ -1100,7 +1100,7 @@ void HeifFile::add_orientation_properties(heif_item_id id, heif_orientation orie
auto imir = std::make_shared<Box_imir>();
imir->set_mirror_direction(mirror);

int index = m_ipco_box->find_or_append_child_box(imir);
uint32_t index = m_ipco_box->find_or_append_child_box(imir);

m_ipma_box->add_property_for_item_ID(id, Box_ipma::PropertyAssociation{false, uint16_t(index + 1)});
}
Expand Down Expand Up @@ -1327,7 +1327,7 @@ void HeifFile::set_auxC_property(heif_item_id id, const std::string& type)
auto auxC = std::make_shared<Box_auxC>();
auxC->set_aux_type(type);

int index = m_ipco_box->find_or_append_child_box(auxC);
uint32_t index = m_ipco_box->find_or_append_child_box(auxC);

m_ipma_box->add_property_for_item_ID(id, Box_ipma::PropertyAssociation{true, uint16_t(index + 1)});
}
Expand Down

0 comments on commit d386233

Please sign in to comment.