[layout] Remove unused "max-size" cruft

pull/4345/head
Behdad Esfahbod 1 year ago
parent 8eb7889fd4
commit 60db142784
  1. 1
      src/OT/Layout/GPOS/PairValueRecord.hh
  2. 1
      src/OT/Layout/GSUB/Ligature.hh
  3. 5
      src/hb-machinery.hh
  4. 9
      src/hb-null.hh
  5. 30
      src/hb-open-type.hh
  6. 2
      src/hb-ot-layout-gsubgpos.hh

@ -23,7 +23,6 @@ struct PairValueRecord
* followed by for second glyph */ * followed by for second glyph */
public: public:
DEFINE_SIZE_ARRAY (Types::HBGlyphID::static_size, values); DEFINE_SIZE_ARRAY (Types::HBGlyphID::static_size, values);
DEFINE_SIZE_MAX (Types::HBGlyphID::static_size + 2 * Value::static_size * 8 * sizeof (ValueFormat));
int cmp (hb_codepoint_t k) const int cmp (hb_codepoint_t k) const
{ return secondGlyph.cmp (k); } { return secondGlyph.cmp (k); }

@ -19,7 +19,6 @@ struct Ligature
* in writing direction */ * in writing direction */
public: public:
DEFINE_SIZE_ARRAY (Types::size + 2, component); DEFINE_SIZE_ARRAY (Types::size + 2, component);
DEFINE_SIZE_MAX (65536 * Types::HBGlyphID::static_size);
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {

@ -104,7 +104,6 @@ static inline Type& StructAfter(TObject &X)
unsigned int get_size () const { return (size); } \ unsigned int get_size () const { return (size); } \
static constexpr unsigned null_size = (size); \ static constexpr unsigned null_size = (size); \
static constexpr unsigned min_size = (size); \ static constexpr unsigned min_size = (size); \
static constexpr unsigned max_size = (size); \
static constexpr unsigned static_size = (size) static constexpr unsigned static_size = (size)
#define DEFINE_SIZE_UNION(size, _member) \ #define DEFINE_SIZE_UNION(size, _member) \
@ -132,10 +131,6 @@ static inline Type& StructAfter(TObject &X)
unsigned int get_size () const { return (size - (array).min_size + (array).get_size ()); } \ unsigned int get_size () const { return (size - (array).min_size + (array).get_size ()); } \
DEFINE_SIZE_ARRAY(size, array) DEFINE_SIZE_ARRAY(size, array)
#define DEFINE_SIZE_MAX(size) \
DEFINE_INSTANCE_ASSERTION (sizeof (*this) <= (size)) \
static constexpr unsigned max_size = (size)
/* /*

@ -48,15 +48,6 @@ template <typename T>
using hb_has_min_size = _hb_has_min_size<T, void>; using hb_has_min_size = _hb_has_min_size<T, void>;
#define hb_has_min_size(T) hb_has_min_size<T>::value #define hb_has_min_size(T) hb_has_min_size<T>::value
template <typename T, typename>
struct _hb_has_max_size : hb_false_type {};
template <typename T>
struct _hb_has_max_size<T, hb_void_t<decltype (T::max_size)>>
: hb_true_type {};
template <typename T>
using hb_has_max_size = _hb_has_max_size<T, void>;
#define hb_has_max_size(T) hb_has_max_size<T>::value
template <typename T, typename> template <typename T, typename>
struct _hb_has_null_size : hb_false_type {}; struct _hb_has_null_size : hb_false_type {};
template <typename T> template <typename T>

@ -718,36 +718,6 @@ struct ArrayOf
return_trace (out); return_trace (out);
} }
/* Special-case ArrayOf Offset16To structs with a maximum size.
*
* Currently disabled, because this throws off max_op accounting
* and can cause timeouts in further operations.
* https://oss-fuzz.com/testcase-detail/6153196517851136
*/
template <typename T = Type,
typename Base = void,
hb_enable_if (false &&
hb_has_max_size (typename T::target_t) &&
sizeof (T) == 2)>
HB_ALWAYS_INLINE
bool sanitize (hb_sanitize_context_t *c, const Base *base) const
{
TRACE_SANITIZE (this);
if (unlikely (!sanitize_shallow (c))) return_trace (false);
unsigned max_len = 65536 + Type::target_t::max_size;
if (unlikely (c->check_range_fast (base, max_len)))
return_trace (true);
unsigned int count = len;
for (unsigned int i = 0; i < count; i++)
if (unlikely (!c->dispatch (arrayZ[i], base)))
return_trace (false);
return_trace (true);
}
template <typename ...Ts> template <typename ...Ts>
HB_ALWAYS_INLINE HB_ALWAYS_INLINE
bool sanitize (hb_sanitize_context_t *c, Ts&&... ds) const bool sanitize (hb_sanitize_context_t *c, Ts&&... ds) const

@ -2087,7 +2087,6 @@ struct Rule
* design order */ * design order */
public: public:
DEFINE_SIZE_ARRAY (4, inputZ); DEFINE_SIZE_ARRAY (4, inputZ);
DEFINE_SIZE_MAX (65536 * (Types::HBUINT::static_size + LookupRecord::static_size));
}; };
template <typename Types> template <typename Types>
@ -3262,7 +3261,6 @@ struct ChainRule
* design order) */ * design order) */
public: public:
DEFINE_SIZE_MIN (8); DEFINE_SIZE_MIN (8);
DEFINE_SIZE_MAX (65536 * (3 * Types::HBUINT::static_size + LookupRecord::static_size));
}; };
template <typename Types> template <typename Types>

Loading…
Cancel
Save