summaryrefslogtreecommitdiff
path: root/src/hb-dsalgs.hh
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2018-09-13 16:49:26 +0200
committerBehdad Esfahbod <behdad@behdad.org>2018-09-13 17:21:00 +0200
commitdbb764dceb61365b7360a48d581ba5a4b3526e98 (patch)
tree9a95f03270f90ca687193cb2d8b622fc9ab36454 /src/hb-dsalgs.hh
parent361fc2686152ad8c0ebaf19e0522e0fc58ba3953 (diff)
[dfont] Clean up sanitize()
I don't think I broke anything. Fuzzers will let me know..
Diffstat (limited to 'src/hb-dsalgs.hh')
-rw-r--r--src/hb-dsalgs.hh8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index def968eb..26e8e42a 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -532,9 +532,17 @@ struct hb_bytes_t
inline hb_bytes_t (void) : bytes (nullptr), len (0) {}
inline hb_bytes_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {}
inline hb_bytes_t (const void *bytes_, unsigned int len_) : bytes ((const char *) bytes_), len (len_) {}
+ template <typename T>
+ inline hb_bytes_t (const T& array) : bytes ((const char *) array.arrayZ), len (array.len) {}
inline void free (void) { ::free ((void *) bytes); bytes = nullptr; len = 0; }
+ template <typename Type>
+ inline const Type* as (void) const
+ {
+ return unlikely (!bytes) ? &Null(Type) : reinterpret_cast<const Type *> (bytes);
+ }
+
inline int cmp (const hb_bytes_t &a) const
{
if (len != a.len)