[subset] rename serializer::set_error() to err().

This commit is contained in:
Garret Rieger 2021-03-18 11:20:03 -07:00
parent f561fa6e4c
commit 3827a3eb56
2 changed files with 9 additions and 10 deletions

View File

@ -738,13 +738,13 @@ hb_resolve_overflows (const hb_vector_t<hb_serialize_context_t::object_t *>& pac
} }
DEBUG_MSG (SUBSET_REPACK, nullptr, "No resolution available :("); DEBUG_MSG (SUBSET_REPACK, nullptr, "No resolution available :(");
c->set_error (HB_SERIALIZE_ERROR_OFFSET_OVERFLOW); c->err (HB_SERIALIZE_ERROR_OFFSET_OVERFLOW);
return; return;
} }
if (sorted_graph.in_error ()) if (sorted_graph.in_error ())
{ {
c->set_error (HB_SERIALIZE_ERROR_OTHER); c->err (HB_SERIALIZE_ERROR_OTHER);
return; return;
} }
sorted_graph.serialize (c); sorted_graph.serialize (c);

View File

@ -161,7 +161,7 @@ struct hb_serialize_context_t
hb_serialize_error_t err_type = HB_SERIALIZE_ERROR_OTHER) hb_serialize_error_t err_type = HB_SERIALIZE_ERROR_OTHER)
{ {
return successful () return successful ()
&& (success || (set_error (err_type), false)); && (success || err (err_type));
} }
template <typename T1, typename T2> template <typename T1, typename T2>
@ -169,8 +169,7 @@ struct hb_serialize_context_t
{ {
if ((long long) v1 != (long long) v2) if ((long long) v1 != (long long) v2)
{ {
set_error (err_type); return err (err_type);
return false;
} }
return true; return true;
} }
@ -213,7 +212,7 @@ struct hb_serialize_context_t
{ {
// Offset overflows that occur before link resolution cannot be handled // Offset overflows that occur before link resolution cannot be handled
// by repacking, so set a more general error. // by repacking, so set a more general error.
if (offset_overflow ()) set_error (HB_SERIALIZE_ERROR_OTHER); if (offset_overflow ()) err (HB_SERIALIZE_ERROR_OTHER);
return; return;
} }
@ -394,7 +393,7 @@ struct hb_serialize_context_t
for (const object_t::link_t &link : parent->links) for (const object_t::link_t &link : parent->links)
{ {
const object_t* child = packed[link.objidx]; const object_t* child = packed[link.objidx];
if (unlikely (!child)) { set_error (HB_SERIALIZE_ERROR_OTHER); return; } if (unlikely (!child)) { err (HB_SERIALIZE_ERROR_OTHER); return; }
unsigned offset = 0; unsigned offset = 0;
switch ((whence_t) link.whence) { switch ((whence_t) link.whence) {
case Head: offset = child->head - parent->head; break; case Head: offset = child->head - parent->head; break;
@ -441,9 +440,9 @@ struct hb_serialize_context_t
Type *start_embed (const Type &obj) const Type *start_embed (const Type &obj) const
{ return start_embed (hb_addressof (obj)); } { return start_embed (hb_addressof (obj)); }
void set_error (hb_serialize_error_t err_type) bool err (hb_serialize_error_t err_type)
{ {
errors = errors | err_type; return bool ((errors = (errors | err_type)));
} }
template <typename Type> template <typename Type>
@ -453,7 +452,7 @@ struct hb_serialize_context_t
if (this->tail - this->head < ptrdiff_t (size)) if (this->tail - this->head < ptrdiff_t (size))
{ {
set_error (HB_SERIALIZE_ERROR_OUT_OF_ROOM); err (HB_SERIALIZE_ERROR_OUT_OF_ROOM);
return nullptr; return nullptr;
} }
memset (this->head, 0, size); memset (this->head, 0, size);