More hb_memcpy

This commit is contained in:
Behdad Esfahbod 2022-11-22 12:56:48 -07:00
parent 58a696d80e
commit 4afcdf675b
5 changed files with 16 additions and 16 deletions

View File

@ -121,7 +121,7 @@ struct CompositeGlyphRecord
if (flags & ARG_1_AND_2_ARE_WORDS)
{
// no overflow, copy and update value with deltas
memcpy (out, this, len);
hb_memcpy (out, this, len);
const HBINT16 *px = reinterpret_cast<const HBINT16 *> (p);
HBINT16 *o = reinterpret_cast<HBINT16 *> (out + len_before_val);
@ -135,7 +135,7 @@ struct CompositeGlyphRecord
if (new_x <= 127 && new_x >= -128 &&
new_y <= 127 && new_y >= -128)
{
memcpy (out, this, len);
hb_memcpy (out, this, len);
HBINT8 *o = reinterpret_cast<HBINT8 *> (out + len_before_val);
o[0] = new_x;
o[1] = new_y;
@ -143,7 +143,7 @@ struct CompositeGlyphRecord
else
{
// int8 overflows after deltas applied
memcpy (out, this, len_before_val);
hb_memcpy (out, this, len_before_val);
//update flags
CompositeGlyphRecord *o = reinterpret_cast<CompositeGlyphRecord *> (out);
@ -152,14 +152,14 @@ struct CompositeGlyphRecord
HBINT16 new_value;
new_value = new_x;
memcpy (out, &new_value, HBINT16::static_size);
hb_memcpy (out, &new_value, HBINT16::static_size);
out += HBINT16::static_size;
new_value = new_y;
memcpy (out, &new_value, HBINT16::static_size);
hb_memcpy (out, &new_value, HBINT16::static_size);
out += HBINT16::static_size;
memcpy (out, p+2, len - len_before_val - 2);
hb_memcpy (out, p+2, len - len_before_val - 2);
len += 2;
}
}
@ -382,7 +382,7 @@ struct CompositeGlyph
unsigned comp_len = component.get_size ();
if (component.is_anchored ())
{
memcpy (p, &component, comp_len);
hb_memcpy (p, &component, comp_len);
p += comp_len;
}
else
@ -398,7 +398,7 @@ struct CompositeGlyph
if (source_len > source_comp_len)
{
unsigned instr_len = source_len - source_comp_len;
memcpy (p, (const char *)c + source_comp_len, instr_len);
hb_memcpy (p, (const char *)c + source_comp_len, instr_len);
p += instr_len;
}

View File

@ -308,24 +308,24 @@ struct SimpleGlyph
const char *src = bytes.arrayZ + GlyphHeader::static_size;
char *cur = p;
memcpy (p, src, len_before_instrs);
hb_memcpy (p, src, len_before_instrs);
cur += len_before_instrs;
src += len_before_instrs;
if (!no_hinting)
{
memcpy (cur, src, len_instrs);
hb_memcpy (cur, src, len_instrs);
cur += len_instrs;
}
memcpy (cur, flags.arrayZ, flags.length);
hb_memcpy (cur, flags.arrayZ, flags.length);
cur += flags.length;
memcpy (cur, x_coords.arrayZ, x_coords.length);
hb_memcpy (cur, x_coords.arrayZ, x_coords.length);
cur += x_coords.length;
memcpy (cur, y_coords.arrayZ, y_coords.length);
hb_memcpy (cur, y_coords.arrayZ, y_coords.length);
dest_bytes = hb_bytes_t (p, total_len);
return true;

View File

@ -201,7 +201,7 @@ struct Lookup : public OT::Lookup
+ new_subtable_count * OT::Offset16::static_size;
char* buffer = (char*) hb_calloc (1, new_size);
c.add_buffer (buffer);
memcpy (buffer, v.obj.head, v.table_size());
hb_memcpy (buffer, v.obj.head, v.table_size());
v.obj.head = buffer;
v.obj.tail = buffer + new_size;

View File

@ -434,7 +434,7 @@ struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4<SmallType
char* start_addr = ((char*)&values[0]) + start * split_context.class1_record_size;
unsigned num_records = end - start;
memcpy (&pair_pos_prime->values[0],
hb_memcpy (&pair_pos_prime->values[0],
start_addr,
num_records * split_context.class1_record_size);

View File

@ -244,7 +244,7 @@ inline hb_blob_t* serialize (const graph_t& graph)
return nullptr;
}
memcpy (start, vertices[i].obj.head, size);
hb_memcpy (start, vertices[i].obj.head, size);
// Only real links needs to be serialized.
for (const auto& link : vertices[i].obj.real_links)