#define SANITIZE_SELF() SANITIZE_OBJ (*this)
#define SANITIZE_OBJ(X) SANITIZE_MEM(&(X), sizeof (X))
-#define SANITIZE_GET_SIZE() SANITIZE_SELF() && SANITIZE_MEM (this, this->get_size ())
#define SANITIZE_MEM(B,L) HB_LIKELY (_hb_sanitize_check (SANITIZE_ARG, CharP(B), (L)))
inline unsigned int get_size () const
{ return len.get_size () + len * Type::get_size (); }
+ inline bool sanitize_shallow (SANITIZE_ARG_DEF) {
+ TRACE_SANITIZE ();
+ return SANITIZE_SELF() && SANITIZE_ARRAY (this, Type::get_size (), len);
+ }
+
inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE ();
- if (!SANITIZE_GET_SIZE()) return false;
+ if (!HB_LIKELY (sanitize_shallow (SANITIZE_ARG))) return false;
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size, hence the return.
}
inline bool sanitize (SANITIZE_ARG_DEF, void *base) {
TRACE_SANITIZE ();
- if (!SANITIZE_GET_SIZE()) return false;
+ if (!HB_LIKELY (sanitize_shallow (SANITIZE_ARG))) return false;
unsigned int count = len;
for (unsigned int i = 0; i < count; i++)
if (!array()[i].sanitize (SANITIZE_ARG, base))
}
inline bool sanitize (SANITIZE_ARG_DEF, void *base, void *base2) {
TRACE_SANITIZE ();
- if (!SANITIZE_GET_SIZE()) return false;
+ if (!HB_LIKELY (sanitize_shallow (SANITIZE_ARG))) return false;
unsigned int count = len;
for (unsigned int i = 0; i < count; i++)
if (!array()[i].sanitize (SANITIZE_ARG, base, base2))
}
inline bool sanitize (SANITIZE_ARG_DEF, void *base, unsigned int user_data) {
TRACE_SANITIZE ();
- if (!SANITIZE_GET_SIZE()) return false;
+ if (!HB_LIKELY (sanitize_shallow (SANITIZE_ARG))) return false;
unsigned int count = len;
for (unsigned int i = 0; i < count; i++)
if (!array()[i].sanitize (SANITIZE_ARG, base, user_data))
inline unsigned int get_size () const
{ return len.get_size () + (len ? len - 1 : 0) * Type::get_size (); }
+ inline bool sanitize_shallow (SANITIZE_ARG_DEF) {
+ TRACE_SANITIZE ();
+ return SANITIZE_SELF() && SANITIZE_ARRAY (this, Type::get_size (), len);
+ }
+
inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE ();
- if (!SANITIZE_GET_SIZE()) return false;
+ if (!HB_LIKELY (sanitize_shallow (SANITIZE_ARG))) return false;
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size, hence the return.