Combine uses of map has() then get() with has(.., &..)
This commit is contained in:
parent
b99efa6c8d
commit
371e14d99c
|
@ -97,9 +97,10 @@ struct CPALV1Tail
|
|||
c->push ();
|
||||
for (const auto _ : colorLabels)
|
||||
{
|
||||
if (!color_index_map->has (_)) continue;
|
||||
hb_codepoint_t v;
|
||||
if (!color_index_map->has (_, &v)) continue;
|
||||
NameID new_color_idx;
|
||||
new_color_idx = color_index_map->get (_);
|
||||
new_color_idx = v;
|
||||
if (!c->copy<NameID> (new_color_idx))
|
||||
{
|
||||
c->pop_discard ();
|
||||
|
|
|
@ -659,7 +659,8 @@ struct LangSys
|
|||
auto *out = c->serializer->start_embed (*this);
|
||||
if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
|
||||
|
||||
out->reqFeatureIndex = l->feature_index_map->has (reqFeatureIndex) ? l->feature_index_map->get (reqFeatureIndex) : 0xFFFFu;
|
||||
unsigned v;
|
||||
out->reqFeatureIndex = l->feature_index_map->has (reqFeatureIndex, &v) ? v : 0xFFFFu;
|
||||
|
||||
if (!l->visitFeatureIndex (featureIndex.len))
|
||||
return_trace (false);
|
||||
|
|
|
@ -86,8 +86,7 @@ HB_INTERNAL bool postV2Tail::subset (hb_subset_context_t *c) const
|
|||
|
||||
unsigned new_index;
|
||||
if (old_index <= 257) new_index = old_index;
|
||||
else if (old_new_index_map.has (old_index)) new_index = old_new_index_map.get (old_index);
|
||||
else
|
||||
else if (!old_new_index_map.has (old_index, &new_index))
|
||||
{
|
||||
hb_bytes_t s = _post.find_glyph_name (old_gid);
|
||||
new_index = glyph_name_to_new_index.get (s);
|
||||
|
|
|
@ -430,7 +430,8 @@ struct graph_t
|
|||
auto new_subgraph =
|
||||
+ subgraph.keys ()
|
||||
| hb_map([&] (unsigned node_idx) {
|
||||
if (index_map.has (node_idx)) return index_map[node_idx];
|
||||
unsigned v;
|
||||
if (index_map.has (node_idx, &v)) return v;
|
||||
return node_idx;
|
||||
})
|
||||
;
|
||||
|
@ -442,10 +443,11 @@ struct graph_t
|
|||
unsigned next = HB_SET_VALUE_INVALID;
|
||||
while (roots.next (&next))
|
||||
{
|
||||
if (index_map.has (next))
|
||||
unsigned v;
|
||||
if (index_map.has (next, &v))
|
||||
{
|
||||
roots.del (next);
|
||||
roots.add (index_map[next]);
|
||||
roots.add (v);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -456,9 +458,10 @@ struct graph_t
|
|||
{
|
||||
for (const auto& link : vertices_[node_idx].obj.all_links ())
|
||||
{
|
||||
if (subgraph.has (link.objidx))
|
||||
unsigned v;
|
||||
if (subgraph.has (link.objidx, &v))
|
||||
{
|
||||
subgraph.set (link.objidx, subgraph[link.objidx] + 1);
|
||||
subgraph.set (link.objidx, v + 1);
|
||||
continue;
|
||||
}
|
||||
subgraph.set (link.objidx, 1);
|
||||
|
@ -940,10 +943,11 @@ struct graph_t
|
|||
{
|
||||
for (auto& link : vertices_[i].obj.all_links_writer ())
|
||||
{
|
||||
if (!id_map.has (link.objidx)) continue;
|
||||
unsigned v;
|
||||
if (!id_map.has (link.objidx, &v)) continue;
|
||||
if (only_wide && !(link.width == 4 && !link.is_signed)) continue;
|
||||
|
||||
reassign_link (link, i, id_map[link.objidx]);
|
||||
reassign_link (link, i, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue