提交 a6065d05 编写于 作者: E Ebrahim Byagowi

Don't call memcpy when a table is empty

上级 c85f624b
......@@ -141,14 +141,15 @@ typedef struct OffsetTable
TableRecord &rec = tables.arrayZ[i];
hb_blob_t *blob = items[i].blob;
rec.tag = items[i].tag;
rec.length = hb_blob_get_length (blob);
rec.length = blob->length;
rec.offset.serialize (c, this);
/* Allocate room for the table and copy it. */
char *start = (char *) c->allocate_size<void> (rec.length);
if (unlikely (!start)) {return false;}
if (unlikely (!start)) return false;
memcpy (start, hb_blob_get_data (blob, nullptr), rec.length);
if (likely (rec.length))
memcpy (start, blob->data, rec.length);
/* 4-byte alignment. */
c->align (4);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册