Remove Offset::serialize()
Finishing https://github.com/harfbuzz/harfbuzz/pull/2355
This commit is contained in:
parent
63e15eac4f
commit
29c9833e57
|
@ -133,18 +133,24 @@ typedef struct OpenTypeOffsetTable
|
||||||
/* Write OffsetTables, alloc for and write actual table blobs. */
|
/* Write OffsetTables, alloc for and write actual table blobs. */
|
||||||
for (unsigned int i = 0; i < tables.len; i++)
|
for (unsigned int i = 0; i < tables.len; i++)
|
||||||
{
|
{
|
||||||
TableRecord &rec = tables.arrayZ[i];
|
|
||||||
hb_blob_t *blob = items[i].blob;
|
hb_blob_t *blob = items[i].blob;
|
||||||
rec.tag = items[i].tag;
|
unsigned len = blob->length;
|
||||||
rec.length = blob->length;
|
|
||||||
rec.offset.serialize (c, this);
|
|
||||||
|
|
||||||
/* Allocate room for the table and copy it. */
|
/* Allocate room for the table and copy it. */
|
||||||
char *start = (char *) c->allocate_size<void> (rec.length);
|
char *start = (char *) c->allocate_size<void> (len);
|
||||||
if (unlikely (!start)) return false;
|
if (unlikely (!start)) return false;
|
||||||
|
|
||||||
if (likely (rec.length))
|
TableRecord &rec = tables.arrayZ[i];
|
||||||
memcpy (start, blob->data, rec.length);
|
rec.tag = items[i].tag;
|
||||||
|
rec.length = len;
|
||||||
|
rec.offset = 0;
|
||||||
|
if (unlikely (!c->check_assign (rec.offset,
|
||||||
|
(unsigned) ((char *) start - (char *) this),
|
||||||
|
HB_SERIALIZE_ERROR_OFFSET_OVERFLOW)))
|
||||||
|
return_trace (false);
|
||||||
|
|
||||||
|
if (likely (len))
|
||||||
|
memcpy (start, blob->data, len);
|
||||||
|
|
||||||
/* 4-byte alignment. */
|
/* 4-byte alignment. */
|
||||||
c->align (4);
|
c->align (4);
|
||||||
|
|
|
@ -212,15 +212,6 @@ struct Offset : Type
|
||||||
|
|
||||||
bool is_null () const { return has_null && 0 == *this; }
|
bool is_null () const { return has_null && 0 == *this; }
|
||||||
|
|
||||||
void *serialize (hb_serialize_context_t *c, const void *base)
|
|
||||||
{
|
|
||||||
void *t = c->start_embed<void> ();
|
|
||||||
c->check_assign (*this,
|
|
||||||
(unsigned) ((char *) t - (char *) base),
|
|
||||||
HB_SERIALIZE_ERROR_OFFSET_OVERFLOW);
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_STATIC (sizeof (Type));
|
DEFINE_SIZE_STATIC (sizeof (Type));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue