Remove std::forward inside loops (#5424)

* [iter,cff] Remove std::forward from inside loops

Was moving multiple times, if args were movable.

* [CPAL] Handle an error

* [serialize] Remove another std::forward in a loop

* [bit-page] Fix a static-analysis out-of-range warning

Code was safe. Just rewrite.

* [ot-layout] Remove another std::forward from inside a loop
This commit is contained in:
Behdad Esfahbod authored and GitHub committed 2025-07-26 06:10:31 -06:00
1 parent 5087e53be9
commit a220479fae
6 files changed
+9 -8

No files matched your search

+1
View File
@@ -307,6 +307,7 @@ struct CPAL
if (first_color_to_layer_index.has (first_color_record_idx)) continue;
first_color_index_for_layer.push (first_color_record_idx);
if (unlikely (!c->serializer->propagate_error (first_color_index_for_layer))) return_trace (false);
first_color_to_layer_index.set (first_color_record_idx,
first_color_index_for_layer.length - 1);
}
+1 -1
View File
@@ -290,7 +290,7 @@ struct hb_bit_page_t
unsigned int j = m & ELT_MASK;
const elt_t vv = v[i] & ~((elt_t (1) << j) - 1);
for (const elt_t *p = &vv; i < len (); p = &v[++i])
for (const elt_t *p = &vv; i < len (); p = ((const elt_t *) &v[0]) + (++i))
if (*p)
{
*codepoint = i * ELT_BITS + elt_get_min (*p);
+3 -3
View File
@@ -972,7 +972,7 @@ struct
Proj&& f = hb_identity) const
{
for (auto it = hb_iter (c); it; ++it)
if (!hb_match (std::forward<Pred> (p), hb_get (std::forward<Proj> (f), *it)))
if (!hb_match (p, hb_get (f, *it)))
return false;
return true;
}
@@ -989,7 +989,7 @@ struct
Proj&& f = hb_identity) const
{
for (auto it = hb_iter (c); it; ++it)
if (hb_match (std::forward<Pred> (p), hb_get (std::forward<Proj> (f), *it)))
if (hb_match (p, hb_get (f, *it)))
return true;
return false;
}
@@ -1006,7 +1006,7 @@ struct
Proj&& f = hb_identity) const
{
for (auto it = hb_iter (c); it; ++it)
if (hb_match (std::forward<Pred> (p), hb_get (std::forward<Proj> (f), *it)))
if (hb_match (p, hb_get (f, *it)))
return false;
return true;
}
+1 -1
View File
@@ -79,7 +79,7 @@ struct Dict : UnsizedByteStr
{
TRACE_SERIALIZE (this);
for (unsigned int i = 0; i < dictval.get_count (); i++)
if (unlikely (!opszr.serialize (c, dictval[i], std::forward<Ts> (ds)...)))
if (unlikely (!opszr.serialize (c, dictval[i], ds...)))
return_trace (false);
return_trace (true);
+2 -2
View File
@@ -1337,7 +1337,7 @@ struct Lookup
TRACE_DISPATCH (this, lookup_type);
unsigned int count = get_subtable_count ();
for (unsigned int i = 0; i < count; i++) {
typename context_t::return_t r = get_subtable<TSubTable> (i).dispatch (c, lookup_type, std::forward<Ts> (ds)...);
typename context_t::return_t r = get_subtable<TSubTable> (i).dispatch (c, lookup_type, ds...);
if (c->stop_sublookup_iteration (r))
return_trace (r);
}
@@ -3442,7 +3442,7 @@ struct ItemVariationStore
for (unsigned i = 0; i < count; i++)
{
hb_inc_bimap_t *map = inner_maps.push ();
if (!c->propagate_error(inner_maps))
if (unlikely (!c->propagate_error(inner_maps)))
return_trace(nullptr);
auto &data = this+dataSets[i];
+1 -1
View File
@@ -724,7 +724,7 @@ struct hb_serialize_context_t
hb_requires (hb_is_iterator (Iterator)),
typename ...Ts>
void copy_all (Iterator it, Ts&&... ds)
{ for (decltype (*it) _ : it) copy (_, std::forward<Ts> (ds)...); }
{ for (decltype (*it) _ : it) copy (_, ds...); }
template <typename Type>
hb_serialize_context_t& operator << (const Type &obj) & { embed (obj); return *this; }