Improve blob->as<>
It's true that blob->as<> should only be called on null or sanitized data. But this change is safe, so keep it.
This commit is contained in:
parent
5854d3fa25
commit
4d4e526b5c
|
@ -60,7 +60,7 @@ struct hb_blob_t
|
|||
template <typename Type>
|
||||
inline const Type* as (void) const
|
||||
{
|
||||
return unlikely (!data) ? &Null(Type) : reinterpret_cast<const Type *> (data);
|
||||
return length < Type::min_size ? &Null(Type) : reinterpret_cast<const Type *> (data);
|
||||
}
|
||||
inline hb_bytes_t as_bytes (void) const
|
||||
{
|
||||
|
|
|
@ -55,6 +55,7 @@ struct loca
|
|||
|
||||
protected:
|
||||
UnsizedArrayOf<HBUINT8> dataZ; /* Location data. */
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (0, dataZ);
|
||||
};
|
||||
|
||||
|
@ -484,7 +485,7 @@ struct glyf
|
|||
|
||||
protected:
|
||||
UnsizedArrayOf<HBUINT8> dataZ; /* Glyphs data. */
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (0, dataZ);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue