Remove redundant void from C++ sources (#1486)

This commit is contained in:
Ebrahim Byagowi 2018-12-17 21:31:01 +03:30 committed by Behdad Esfahbod
parent 7ace10078c
commit e412008599
118 changed files with 862 additions and 1025 deletions

View File

@ -27,7 +27,7 @@
#include "hb-ot-shape-complex-indic.hh" #include "hb-ot-shape-complex-indic.hh"
int int
main (void) main ()
{ {
for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++) for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++)
{ {

View File

@ -27,7 +27,7 @@
#include "hb-ot-shape-complex-khmer.hh" #include "hb-ot-shape-complex-khmer.hh"
int int
main (void) main ()
{ {
for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++) for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++)
{ {

View File

@ -27,7 +27,7 @@
#include "hb-ot-shape-complex-myanmar.hh" #include "hb-ot-shape-complex-myanmar.hh"
int int
main (void) main ()
{ {
for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++) for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++)
{ {

View File

@ -27,7 +27,7 @@
#include "hb-ot-shape-complex-use.hh" #include "hb-ot-shape-complex-use.hh"
int int
main (void) main ()
{ {
for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++) for (hb_codepoint_t u = 0; u <= 0x10FFFF; u++)
{ {

View File

@ -40,11 +40,11 @@ namespace AAT {
struct FontDescriptor struct FontDescriptor
{ {
bool has_data (void) const { return tag; } bool has_data () const { return tag; }
int cmp (hb_tag_t a) const { return tag.cmp (a); } int cmp (hb_tag_t a) const { return tag.cmp (a); }
float get_value (void) const { return u.value.to_float (); } float get_value () const { return u.value.to_float (); }
enum non_alphabetic_value_t { enum non_alphabetic_value_t {
Alphabetic = 0, Alphabetic = 0,

View File

@ -419,17 +419,14 @@ struct Lookup
/* Ugly hand-coded null objects for template Lookup<> :(. */ /* Ugly hand-coded null objects for template Lookup<> :(. */
extern HB_INTERNAL const unsigned char _hb_Null_AAT_Lookup[2]; extern HB_INTERNAL const unsigned char _hb_Null_AAT_Lookup[2];
template <> template <>
/*static*/ inline const AAT::Lookup<OT::HBUINT16>& Null<AAT::Lookup<OT::HBUINT16> > (void) { /*static*/ inline const AAT::Lookup<OT::HBUINT16>& Null<AAT::Lookup<OT::HBUINT16> > ()
return *reinterpret_cast<const AAT::Lookup<OT::HBUINT16> *> (_hb_Null_AAT_Lookup); { return *reinterpret_cast<const AAT::Lookup<OT::HBUINT16> *> (_hb_Null_AAT_Lookup); }
}
template <> template <>
/*static*/ inline const AAT::Lookup<OT::HBUINT32>& Null<AAT::Lookup<OT::HBUINT32> > (void) { /*static*/ inline const AAT::Lookup<OT::HBUINT32>& Null<AAT::Lookup<OT::HBUINT32> > ()
return *reinterpret_cast<const AAT::Lookup<OT::HBUINT32> *> (_hb_Null_AAT_Lookup); { return *reinterpret_cast<const AAT::Lookup<OT::HBUINT32> *> (_hb_Null_AAT_Lookup); }
}
template <> template <>
/*static*/ inline const AAT::Lookup<OT::Offset<OT::HBUINT16, false> >& Null<AAT::Lookup<OT::Offset<OT::HBUINT16, false> > > (void) { /*static*/ inline const AAT::Lookup<OT::Offset<OT::HBUINT16, false> >& Null<AAT::Lookup<OT::Offset<OT::HBUINT16, false> > > ()
return *reinterpret_cast<const AAT::Lookup<OT::Offset<OT::HBUINT16, false> > *> (_hb_Null_AAT_Lookup); { return *reinterpret_cast<const AAT::Lookup<OT::Offset<OT::HBUINT16, false> > *> (_hb_Null_AAT_Lookup); }
}
namespace AAT { namespace AAT {
enum { DELETED_GLYPH = 0xFFFF }; enum { DELETED_GLYPH = 0xFFFF };
@ -511,7 +508,7 @@ struct StateTable
return (this+classTable).get_class (glyph_id, num_glyphs, 1); return (this+classTable).get_class (glyph_id, num_glyphs, 1);
} }
const Entry<Extra> *get_entries (void) const const Entry<Extra> *get_entries () const
{ return (this+entryTable).arrayZ; } { return (this+entryTable).arrayZ; }
const Entry<Extra> *get_entryZ (int state, unsigned int klass) const const Entry<Extra> *get_entryZ (int state, unsigned int klass) const
@ -816,10 +813,10 @@ struct ankr;
struct hb_aat_apply_context_t : struct hb_aat_apply_context_t :
hb_dispatch_context_t<hb_aat_apply_context_t, bool, HB_DEBUG_APPLY> hb_dispatch_context_t<hb_aat_apply_context_t, bool, HB_DEBUG_APPLY>
{ {
const char *get_name (void) { return "APPLY"; } const char *get_name () { return "APPLY"; }
template <typename T> template <typename T>
return_t dispatch (const T &obj) { return obj.apply (this); } return_t dispatch (const T &obj) { return obj.apply (this); }
static return_t default_return_value (void) { return false; } static return_t default_return_value () { return false; }
bool stop_sublookup_iteration (return_t r) const { return r; } bool stop_sublookup_iteration (return_t r) const { return r; }
const hb_ot_shape_plan_t *plan; const hb_ot_shape_plan_t *plan;
@ -839,7 +836,7 @@ struct hb_aat_apply_context_t :
hb_buffer_t *buffer_, hb_buffer_t *buffer_,
hb_blob_t *blob = const_cast<hb_blob_t *> (&Null(hb_blob_t))); hb_blob_t *blob = const_cast<hb_blob_t *> (&Null(hb_blob_t)));
HB_INTERNAL ~hb_aat_apply_context_t (void); HB_INTERNAL ~hb_aat_apply_context_t ();
HB_INTERNAL void set_ankr_table (const AAT::ankr *ankr_table_, const char *ankr_end_); HB_INTERNAL void set_ankr_table (const AAT::ankr *ankr_table_, const char *ankr_end_);

View File

@ -44,7 +44,7 @@ struct SettingName
int cmp (hb_aat_layout_feature_selector_t key) const int cmp (hb_aat_layout_feature_selector_t key) const
{ return (int) key - (int) setting; } { return (int) key - (int) setting; }
hb_aat_layout_feature_selector_t get_selector (void) const hb_aat_layout_feature_selector_t get_selector () const
{ return (hb_aat_layout_feature_selector_t) (unsigned) setting; } { return (hb_aat_layout_feature_selector_t) (unsigned) setting; }
void get_info (hb_aat_layout_feature_selector_info_t *s, void get_info (hb_aat_layout_feature_selector_info_t *s,
@ -125,10 +125,10 @@ struct FeatureName
return settings_table.len; return settings_table.len;
} }
hb_aat_layout_feature_type_t get_feature_type (void) const hb_aat_layout_feature_type_t get_feature_type () const
{ return (hb_aat_layout_feature_type_t) (unsigned int) feature; } { return (hb_aat_layout_feature_type_t) (unsigned int) feature; }
hb_ot_name_id_t get_feature_name_id (void) const { return nameIndex; } hb_ot_name_id_t get_feature_name_id () const { return nameIndex; }
bool sanitize (hb_sanitize_context_t *c, const void *base) const bool sanitize (hb_sanitize_context_t *c, const void *base) const
{ {
@ -157,7 +157,7 @@ struct feat
{ {
enum { tableTag = HB_AAT_TAG_feat }; enum { tableTag = HB_AAT_TAG_feat };
bool has_data (void) const { return version.to_int (); } bool has_data () const { return version.to_int (); }
unsigned int get_feature_types (unsigned int start_offset, unsigned int get_feature_types (unsigned int start_offset,
unsigned int *count, unsigned int *count,

View File

@ -178,7 +178,7 @@ struct RepeatedAddGlyphAction
struct ActionSubrecord struct ActionSubrecord
{ {
unsigned int get_length (void) const { return u.header.actionLength; } unsigned int get_length () const { return u.header.actionLength; }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {

View File

@ -66,8 +66,7 @@ struct hb_glyph_pair_t
struct KernPair struct KernPair
{ {
int get_kerning (void) const int get_kerning () const { return value; }
{ return value; }
int cmp (const hb_glyph_pair_t &o) const int cmp (const hb_glyph_pair_t &o) const
{ {
@ -635,7 +634,7 @@ struct KerxSubTableFormat6
ValuesAreLong = 0x00000001, ValuesAreLong = 0x00000001,
}; };
bool is_long (void) const { return flags & ValuesAreLong; } bool is_long () const { return flags & ValuesAreLong; }
int get_kerning (hb_codepoint_t left, hb_codepoint_t right, int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
hb_aat_apply_context_t *c) const hb_aat_apply_context_t *c) const
@ -743,8 +742,8 @@ struct KerxSubTableHeader
{ {
typedef ExtendedTypes Types; typedef ExtendedTypes Types;
unsigned int tuple_count (void) const { return tupleCount; } unsigned int tuple_count () const { return tupleCount; }
bool is_horizontal (void) const { return !(coverage & Vertical); } bool is_horizontal () const { return !(coverage & Vertical); }
enum Coverage enum Coverage
{ {
@ -778,8 +777,8 @@ struct KerxSubTable
{ {
friend struct kerx; friend struct kerx;
unsigned int get_size (void) const { return u.header.length; } unsigned int get_size () const { return u.header.length; }
unsigned int get_type (void) const { return u.header.coverage & u.header.SubtableType; } unsigned int get_type () const { return u.header.coverage & u.header.SubtableType; }
template <typename context_t> template <typename context_t>
typename context_t::return_t dispatch (context_t *c) const typename context_t::return_t dispatch (context_t *c) const
@ -829,9 +828,9 @@ template <typename T>
struct KerxTable struct KerxTable
{ {
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */ /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
const T* thiz (void) const { return static_cast<const T *> (this); } const T* thiz () const { return static_cast<const T *> (this); }
bool has_state_machine (void) const bool has_state_machine () const
{ {
typedef typename T::SubTable SubTable; typedef typename T::SubTable SubTable;
@ -846,7 +845,7 @@ struct KerxTable
return false; return false;
} }
bool has_cross_stream (void) const bool has_cross_stream () const
{ {
typedef typename T::SubTable SubTable; typedef typename T::SubTable SubTable;
@ -989,7 +988,7 @@ struct kerx : KerxTable<kerx>
typedef SubTableHeader::Types Types; typedef SubTableHeader::Types Types;
typedef KerxSubTable SubTable; typedef KerxSubTable SubTable;
bool has_data (void) const { return version; } bool has_data () const { return version; }
protected: protected:
HBUINT16 version; /* The version number of the extended kerning table HBUINT16 version; /* The version number of the extended kerning table

View File

@ -868,9 +868,9 @@ struct ChainSubtable
template <typename T> template <typename T>
friend struct Chain; friend struct Chain;
unsigned int get_size (void) const { return length; } unsigned int get_size () const { return length; }
unsigned int get_type (void) const { return coverage & 0xFF; } unsigned int get_type () const { return coverage & 0xFF; }
unsigned int get_coverage (void) const { return coverage >> (sizeof (HBUINT) * 8 - 8); } unsigned int get_coverage () const { return coverage >> (sizeof (HBUINT) * 8 - 8); }
enum Coverage enum Coverage
{ {
@ -1049,7 +1049,7 @@ struct Chain
} }
} }
unsigned int get_size (void) const { return length; } unsigned int get_size () const { return length; }
bool sanitize (hb_sanitize_context_t *c, unsigned int version HB_UNUSED) const bool sanitize (hb_sanitize_context_t *c, unsigned int version HB_UNUSED) const
{ {
@ -1098,7 +1098,7 @@ struct mortmorx
{ {
enum { tableTag = HB_AAT_TAG_morx }; enum { tableTag = HB_AAT_TAG_morx };
bool has_data (void) const { return version != 0; } bool has_data () const { return version != 0; }
void compile_flags (const hb_aat_map_builder_t *mapper, void compile_flags (const hb_aat_map_builder_t *mapper,
hb_aat_map_t *map) const hb_aat_map_t *map) const

View File

@ -46,7 +46,7 @@ struct TrackTableEntry
{ {
friend struct TrackData; friend struct TrackData;
float get_track_value (void) const { return track.to_float (); } float get_track_value () const { return track.to_float (); }
int get_value (const void *base, unsigned int index, int get_value (const void *base, unsigned int index,
unsigned int table_size) const unsigned int table_size) const
@ -162,7 +162,7 @@ struct trak
{ {
enum { tableTag = HB_AAT_TAG_trak }; enum { tableTag = HB_AAT_TAG_trak };
bool has_data (void) const { return version.to_int (); } bool has_data () const { return version.to_int (); }
bool apply (hb_aat_apply_context_t *c) const bool apply (hb_aat_apply_context_t *c) const
{ {

View File

@ -167,10 +167,8 @@ AAT::hb_aat_apply_context_t::hb_aat_apply_context_t (const hb_ot_shape_plan_t *p
sanitizer.set_max_ops (HB_SANITIZE_MAX_OPS_MAX); sanitizer.set_max_ops (HB_SANITIZE_MAX_OPS_MAX);
} }
AAT::hb_aat_apply_context_t::~hb_aat_apply_context_t (void) AAT::hb_aat_apply_context_t::~hb_aat_apply_context_t ()
{ { sanitizer.end_processing (); }
sanitizer.end_processing ();
}
void void
AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_, AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_,

View File

@ -36,12 +36,12 @@ struct hb_aat_map_t
public: public:
void init (void) void init ()
{ {
memset (this, 0, sizeof (*this)); memset (this, 0, sizeof (*this));
chain_flags.init (); chain_flags.init ();
} }
void fini (void) { chain_flags.fini (); } void fini () { chain_flags.fini (); }
public: public:
hb_vector_t<hb_mask_t, 1> chain_flags; hb_vector_t<hb_mask_t, 1> chain_flags;

View File

@ -42,7 +42,7 @@ struct hb_array_t
/* /*
* Constructors. * Constructors.
*/ */
hb_array_t (void) : arrayZ (nullptr), len (0) {} hb_array_t () : arrayZ (nullptr), len (0) {}
hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), len (o.len) {} hb_array_t (const hb_array_t &o) : arrayZ (o.arrayZ), len (o.len) {}
hb_array_t (Type *array_, unsigned int len_) : arrayZ (array_), len (len_) {} hb_array_t (Type *array_, unsigned int len_) : arrayZ (array_), len (len_) {}
template <unsigned int len_> hb_array_t (Type (&array_)[len_]) : arrayZ (array_), len (len_) {} template <unsigned int len_> hb_array_t (Type (&array_)[len_]) : arrayZ (array_), len (len_) {}
@ -58,11 +58,11 @@ struct hb_array_t
return arrayZ[i]; return arrayZ[i];
} }
explicit_operator bool (void) const { return len; } explicit_operator bool () const { return len; }
Type * operator & (void) const { return arrayZ; } Type * operator & () const { return arrayZ; }
Type & operator * (void) { return (this->operator [])[0]; } Type & operator * () { return (this->operator [])[0]; }
operator hb_array_t<const Type> (void) { return hb_array_t<const Type> (arrayZ, len); } operator hb_array_t<const Type> () { return hb_array_t<const Type> (arrayZ, len); }
template <typename T> operator T * (void) const { return arrayZ; } template <typename T> operator T * () const { return arrayZ; }
hb_array_t<Type> & operator += (unsigned int count) hb_array_t<Type> & operator += (unsigned int count)
{ {
@ -79,8 +79,8 @@ struct hb_array_t
len -= count; len -= count;
return *this; return *this;
} }
hb_array_t<Type> & operator ++ (void) { *this += 1; } hb_array_t<Type> & operator ++ () { *this += 1; }
hb_array_t<Type> & operator -- (void) { *this -= 1; } hb_array_t<Type> & operator -- () { *this -= 1; }
hb_array_t<Type> operator + (unsigned int count) hb_array_t<Type> operator + (unsigned int count)
{ hb_array_t<Type> copy (*this); *this += count; return copy; } { hb_array_t<Type> copy (*this); *this += count; return copy; }
hb_array_t<Type> operator - (unsigned int count) hb_array_t<Type> operator - (unsigned int count)
@ -132,7 +132,7 @@ struct hb_array_t
::qsort (arrayZ, len, item_size, cmp_); ::qsort (arrayZ, len, item_size, cmp_);
return hb_sorted_array_t<Type> (*this); return hb_sorted_array_t<Type> (*this);
} }
hb_sorted_array_t<Type> qsort (void) hb_sorted_array_t<Type> qsort ()
{ {
::qsort (arrayZ, len, item_size, Type::cmp); ::qsort (arrayZ, len, item_size, Type::cmp);
return hb_sorted_array_t<Type> (*this); return hb_sorted_array_t<Type> (*this);
@ -148,7 +148,7 @@ struct hb_array_t
* Other methods. * Other methods.
*/ */
unsigned int get_size (void) const { return len * item_size; } unsigned int get_size () const { return len * item_size; }
hb_array_t<Type> sub_array (unsigned int start_offset = 0, unsigned int *seg_count = nullptr /* IN/OUT */) const hb_array_t<Type> sub_array (unsigned int start_offset = 0, unsigned int *seg_count = nullptr /* IN/OUT */) const
{ {
@ -168,7 +168,7 @@ struct hb_array_t
{ return sub_array (start_offset, &seg_count); } { return sub_array (start_offset, &seg_count); }
/* Only call if you allocated the underlying array using malloc() or similar. */ /* Only call if you allocated the underlying array using malloc() or similar. */
void free (void) void free ()
{ ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; } { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; }
template <typename hb_sanitize_context_t> template <typename hb_sanitize_context_t>
@ -198,7 +198,7 @@ enum hb_bfind_not_found_t
template <typename Type> template <typename Type>
struct hb_sorted_array_t : hb_array_t<Type> struct hb_sorted_array_t : hb_array_t<Type>
{ {
hb_sorted_array_t (void) : hb_array_t<Type> () {} hb_sorted_array_t () : hb_array_t<Type> () {}
hb_sorted_array_t (const hb_array_t<Type> &o) : hb_array_t<Type> (o) {} hb_sorted_array_t (const hb_array_t<Type> &o) : hb_array_t<Type> (o) {}
hb_sorted_array_t (Type *array_, unsigned int len_) : hb_array_t<Type> (array_, len_) {} hb_sorted_array_t (Type *array_, unsigned int len_) : hb_array_t<Type> (array_, len_) {}

View File

@ -104,7 +104,7 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
#include <windows.h> #include <windows.h>
static inline void _hb_memory_barrier (void) static inline void _hb_memory_barrier ()
{ {
#if !defined(MemoryBarrier) #if !defined(MemoryBarrier)
/* MinGW has a convoluted history of supporting MemoryBarrier. */ /* MinGW has a convoluted history of supporting MemoryBarrier. */
@ -269,10 +269,10 @@ struct hb_atomic_int_t
{ {
void set_relaxed (int v_) { hb_atomic_int_impl_set_relaxed (&v, v_); } void set_relaxed (int v_) { hb_atomic_int_impl_set_relaxed (&v, v_); }
void set (int v_) { hb_atomic_int_impl_set (&v, v_); } void set (int v_) { hb_atomic_int_impl_set (&v, v_); }
int get_relaxed (void) const { return hb_atomic_int_impl_get_relaxed (&v); } int get_relaxed () const { return hb_atomic_int_impl_get_relaxed (&v); }
int get (void) const { return hb_atomic_int_impl_get (&v); } int get () const { return hb_atomic_int_impl_get (&v); }
int inc (void) { return hb_atomic_int_impl_add (&v, 1); } int inc () { return hb_atomic_int_impl_add (&v, 1); }
int dec (void) { return hb_atomic_int_impl_add (&v, -1); } int dec () { return hb_atomic_int_impl_add (&v, -1); }
int v; int v;
}; };
@ -286,12 +286,12 @@ struct hb_atomic_ptr_t
void init (T* v_ = nullptr) { set_relaxed (v_); } void init (T* v_ = nullptr) { set_relaxed (v_); }
void set_relaxed (T* v_) { hb_atomic_ptr_impl_set_relaxed (&v, v_); } void set_relaxed (T* v_) { hb_atomic_ptr_impl_set_relaxed (&v, v_); }
T *get_relaxed (void) const { return (T *) hb_atomic_ptr_impl_get_relaxed (&v); } T *get_relaxed () const { return (T *) hb_atomic_ptr_impl_get_relaxed (&v); }
T *get (void) const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); } T *get () const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); }
bool cmpexch (const T *old, T *new_) const { return hb_atomic_ptr_impl_cmpexch ((void **) &v, (void *) old, (void *) new_); } bool cmpexch (const T *old, T *new_) const { return hb_atomic_ptr_impl_cmpexch ((void **) &v, (void *) old, (void *) new_); }
T * operator -> (void) const { return get (); } T * operator -> () const { return get (); }
template <typename C> operator C * (void) const { return get (); } template <typename C> operator C * () const { return get (); }
T *v; T *v;
}; };

View File

@ -188,7 +188,7 @@ hb_blob_copy_writable_or_fail (hb_blob_t *blob)
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_blob_t * hb_blob_t *
hb_blob_get_empty (void) hb_blob_get_empty ()
{ {
return const_cast<hb_blob_t *> (&Null(hb_blob_t)); return const_cast<hb_blob_t *> (&Null(hb_blob_t));
} }
@ -378,7 +378,7 @@ hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length)
bool bool
hb_blob_t::try_make_writable_inplace_unix (void) hb_blob_t::try_make_writable_inplace_unix ()
{ {
#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MPROTECT) #if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MPROTECT)
uintptr_t pagesize = -1, mask, length; uintptr_t pagesize = -1, mask, length;
@ -421,7 +421,7 @@ hb_blob_t::try_make_writable_inplace_unix (void)
} }
bool bool
hb_blob_t::try_make_writable_inplace (void) hb_blob_t::try_make_writable_inplace ()
{ {
DEBUG_MSG_FUNC (BLOB, this, "making writable inplace\n"); DEBUG_MSG_FUNC (BLOB, this, "making writable inplace\n");
@ -436,7 +436,7 @@ hb_blob_t::try_make_writable_inplace (void)
} }
bool bool
hb_blob_t::try_make_writable (void) hb_blob_t::try_make_writable ()
{ {
if (hb_object_is_immutable (this)) if (hb_object_is_immutable (this))
return false; return false;

View File

@ -38,12 +38,9 @@
struct hb_blob_t struct hb_blob_t
{ {
void fini_shallow (void) void fini_shallow () { destroy_user_data (); }
{
destroy_user_data ();
}
void destroy_user_data (void) void destroy_user_data ()
{ {
if (destroy) if (destroy)
{ {
@ -53,16 +50,16 @@ struct hb_blob_t
} }
} }
HB_INTERNAL bool try_make_writable (void); HB_INTERNAL bool try_make_writable ();
HB_INTERNAL bool try_make_writable_inplace (void); HB_INTERNAL bool try_make_writable_inplace ();
HB_INTERNAL bool try_make_writable_inplace_unix (void); HB_INTERNAL bool try_make_writable_inplace_unix ();
template <typename Type> template <typename Type>
const Type* as (void) const const Type* as () const
{ {
return length < hb_null_size (Type) ? &Null(Type) : reinterpret_cast<const Type *> (data); return length < hb_null_size (Type) ? &Null(Type) : reinterpret_cast<const Type *> (data);
} }
hb_bytes_t as_bytes (void) const hb_bytes_t as_bytes () const
{ return hb_bytes_t (data, length); } { return hb_bytes_t (data, length); }
public: public:
@ -88,14 +85,14 @@ struct hb_blob_ptr_t
hb_blob_ptr_t (hb_blob_t *b_ = nullptr) : b (b_) {} hb_blob_ptr_t (hb_blob_t *b_ = nullptr) : b (b_) {}
hb_blob_t * operator = (hb_blob_t *b_) { return b = b_; } hb_blob_t * operator = (hb_blob_t *b_) { return b = b_; }
const T * operator -> (void) const { return get (); } const T * operator -> () const { return get (); }
const T & operator * (void) const { return *get (); } const T & operator * () const { return *get (); }
template <typename C> operator const C * (void) const { return get (); } template <typename C> operator const C * () const { return get (); }
operator const char * (void) const { return (const char *) get (); } operator const char * () const { return (const char *) get (); }
const T * get (void) const { return b->as<T> (); } const T * get () const { return b->as<T> (); }
hb_blob_t * get_blob (void) const { return b.get_raw (); } hb_blob_t * get_blob () const { return b.get_raw (); }
unsigned int get_length (void) const { return b.get ()->length; } unsigned int get_length () const { return b.get ()->length; }
void destroy (void) { hb_blob_destroy (b.get ()); b = nullptr; } void destroy () { hb_blob_destroy (b.get ()); b = nullptr; }
hb_nonnull_ptr_t<hb_blob_t> b; hb_nonnull_ptr_t<hb_blob_t> b;
}; };

View File

@ -44,7 +44,7 @@ static const char *serialize_formats[] = {
* Since: 0.9.7 * Since: 0.9.7
**/ **/
const char ** const char **
hb_buffer_serialize_list_formats (void) hb_buffer_serialize_list_formats ()
{ {
return serialize_formats; return serialize_formats;
} }

View File

@ -215,7 +215,7 @@ hb_buffer_t::get_scratch_buffer (unsigned int *size)
/* HarfBuzz-Internal API */ /* HarfBuzz-Internal API */
void void
hb_buffer_t::reset (void) hb_buffer_t::reset ()
{ {
if (unlikely (hb_object_is_immutable (this))) if (unlikely (hb_object_is_immutable (this)))
return; return;
@ -230,7 +230,7 @@ hb_buffer_t::reset (void)
} }
void void
hb_buffer_t::clear (void) hb_buffer_t::clear ()
{ {
if (unlikely (hb_object_is_immutable (this))) if (unlikely (hb_object_is_immutable (this)))
return; return;
@ -287,7 +287,7 @@ hb_buffer_t::add_info (const hb_glyph_info_t &glyph_info)
void void
hb_buffer_t::remove_output (void) hb_buffer_t::remove_output ()
{ {
if (unlikely (hb_object_is_immutable (this))) if (unlikely (hb_object_is_immutable (this)))
return; return;
@ -300,7 +300,7 @@ hb_buffer_t::remove_output (void)
} }
void void
hb_buffer_t::clear_output (void) hb_buffer_t::clear_output ()
{ {
if (unlikely (hb_object_is_immutable (this))) if (unlikely (hb_object_is_immutable (this)))
return; return;
@ -313,7 +313,7 @@ hb_buffer_t::clear_output (void)
} }
void void
hb_buffer_t::clear_positions (void) hb_buffer_t::clear_positions ()
{ {
if (unlikely (hb_object_is_immutable (this))) if (unlikely (hb_object_is_immutable (this)))
return; return;
@ -328,7 +328,7 @@ hb_buffer_t::clear_positions (void)
} }
void void
hb_buffer_t::swap_buffers (void) hb_buffer_t::swap_buffers ()
{ {
if (unlikely (!successful)) return; if (unlikely (!successful)) return;
@ -480,7 +480,7 @@ hb_buffer_t::reverse_range (unsigned int start,
} }
void void
hb_buffer_t::reverse (void) hb_buffer_t::reverse ()
{ {
if (unlikely (!len)) if (unlikely (!len))
return; return;
@ -489,7 +489,7 @@ hb_buffer_t::reverse (void)
} }
void void
hb_buffer_t::reverse_clusters (void) hb_buffer_t::reverse_clusters ()
{ {
unsigned int i, start, count, last_cluster; unsigned int i, start, count, last_cluster;
@ -574,7 +574,7 @@ hb_buffer_t::merge_out_clusters (unsigned int start,
set_cluster (out_info[i], cluster); set_cluster (out_info[i], cluster);
} }
void void
hb_buffer_t::delete_glyph (void) hb_buffer_t::delete_glyph ()
{ {
/* The logic here is duplicated in hb_ot_hide_default_ignorables(). */ /* The logic here is duplicated in hb_ot_hide_default_ignorables(). */
@ -636,7 +636,7 @@ hb_buffer_t::unsafe_to_break_from_outbuffer (unsigned int start, unsigned int en
} }
void void
hb_buffer_t::guess_segment_properties (void) hb_buffer_t::guess_segment_properties ()
{ {
assert (content_type == HB_BUFFER_CONTENT_TYPE_UNICODE || assert (content_type == HB_BUFFER_CONTENT_TYPE_UNICODE ||
(!len && content_type == HB_BUFFER_CONTENT_TYPE_INVALID)); (!len && content_type == HB_BUFFER_CONTENT_TYPE_INVALID));
@ -709,7 +709,7 @@ DEFINE_NULL_INSTANCE (hb_buffer_t) =
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_buffer_t * hb_buffer_t *
hb_buffer_create (void) hb_buffer_create ()
{ {
hb_buffer_t *buffer; hb_buffer_t *buffer;
@ -734,7 +734,7 @@ hb_buffer_create (void)
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_buffer_t * hb_buffer_t *
hb_buffer_get_empty (void) hb_buffer_get_empty ()
{ {
return const_cast<hb_buffer_t *> (&Null(hb_buffer_t)); return const_cast<hb_buffer_t *> (&Null(hb_buffer_t));
} }

View File

@ -166,7 +166,7 @@ struct hb_buffer_t
assert (bits == (allocated_var_bits & bits)); assert (bits == (allocated_var_bits & bits));
#endif #endif
} }
void deallocate_var_all (void) void deallocate_var_all ()
{ {
#ifndef HB_NDEBUG #ifndef HB_NDEBUG
allocated_var_bits = 0; allocated_var_bits = 0;
@ -179,34 +179,32 @@ struct hb_buffer_t
hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; } hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; } hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; } hb_glyph_info_t &prev () { return out_info[out_len ? out_len - 1 : 0]; }
hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; } hb_glyph_info_t prev () const { return out_info[out_len ? out_len - 1 : 0]; }
bool has_separate_output (void) const { return info != out_info; } bool has_separate_output () const { return info != out_info; }
HB_INTERNAL void reset (void); HB_INTERNAL void reset ();
HB_INTERNAL void clear (void); HB_INTERNAL void clear ();
unsigned int backtrack_len (void) const unsigned int backtrack_len () const { return have_output? out_len : idx; }
{ return have_output? out_len : idx; } unsigned int lookahead_len () const { return len - idx; }
unsigned int lookahead_len (void) const unsigned int next_serial () { return serial++; }
{ return len - idx; }
unsigned int next_serial (void) { return serial++; }
HB_INTERNAL void add (hb_codepoint_t codepoint, HB_INTERNAL void add (hb_codepoint_t codepoint,
unsigned int cluster); unsigned int cluster);
HB_INTERNAL void add_info (const hb_glyph_info_t &glyph_info); HB_INTERNAL void add_info (const hb_glyph_info_t &glyph_info);
HB_INTERNAL void reverse_range (unsigned int start, unsigned int end); HB_INTERNAL void reverse_range (unsigned int start, unsigned int end);
HB_INTERNAL void reverse (void); HB_INTERNAL void reverse ();
HB_INTERNAL void reverse_clusters (void); HB_INTERNAL void reverse_clusters ();
HB_INTERNAL void guess_segment_properties (void); HB_INTERNAL void guess_segment_properties ();
HB_INTERNAL void swap_buffers (void); HB_INTERNAL void swap_buffers ();
HB_INTERNAL void remove_output (void); HB_INTERNAL void remove_output ();
HB_INTERNAL void clear_output (void); HB_INTERNAL void clear_output ();
HB_INTERNAL void clear_positions (void); HB_INTERNAL void clear_positions ();
HB_INTERNAL void replace_glyphs (unsigned int num_in, HB_INTERNAL void replace_glyphs (unsigned int num_in,
unsigned int num_out, unsigned int num_out,
@ -247,7 +245,7 @@ struct hb_buffer_t
out_len++; out_len++;
} }
/* Copies glyph at idx to output but doesn't advance idx */ /* Copies glyph at idx to output but doesn't advance idx */
void copy_glyph (void) void copy_glyph ()
{ {
if (unlikely (!make_room_for (0, 1))) return; if (unlikely (!make_room_for (0, 1))) return;
@ -258,7 +256,7 @@ struct hb_buffer_t
/* Copies glyph at idx to output and advance idx. /* Copies glyph at idx to output and advance idx.
* If there's no output, just advance idx. */ * If there's no output, just advance idx. */
void void
next_glyph (void) next_glyph ()
{ {
if (have_output) if (have_output)
{ {
@ -290,10 +288,7 @@ struct hb_buffer_t
idx += n; idx += n;
} }
/* Advance idx without copying to output. */ /* Advance idx without copying to output. */
void skip_glyph (void) void skip_glyph () { idx++; }
{
idx++;
}
void reset_masks (hb_mask_t mask) void reset_masks (hb_mask_t mask)
{ {
for (unsigned int j = 0; j < len; j++) for (unsigned int j = 0; j < len; j++)
@ -316,7 +311,7 @@ struct hb_buffer_t
HB_INTERNAL void merge_clusters_impl (unsigned int start, unsigned int end); HB_INTERNAL void merge_clusters_impl (unsigned int start, unsigned int end);
HB_INTERNAL void merge_out_clusters (unsigned int start, unsigned int end); HB_INTERNAL void merge_out_clusters (unsigned int start, unsigned int end);
/* Merge clusters for deleting current glyph, and skip it. */ /* Merge clusters for deleting current glyph, and skip it. */
HB_INTERNAL void delete_glyph (void); HB_INTERNAL void delete_glyph ();
void unsafe_to_break (unsigned int start, void unsafe_to_break (unsigned int start,
unsigned int end) unsigned int end)
@ -350,7 +345,7 @@ struct hb_buffer_t
HB_INTERNAL void sort (unsigned int start, unsigned int end, int(*compar)(const hb_glyph_info_t *, const hb_glyph_info_t *)); HB_INTERNAL void sort (unsigned int start, unsigned int end, int(*compar)(const hb_glyph_info_t *, const hb_glyph_info_t *));
bool messaging (void) { return unlikely (message_func); } bool messaging () { return unlikely (message_func); }
bool message (hb_font_t *font, const char *fmt, ...) HB_PRINTF_FUNC(3, 4) bool message (hb_font_t *font, const char *fmt, ...) HB_PRINTF_FUNC(3, 4)
{ {
if (!messaging ()) if (!messaging ())
@ -398,9 +393,9 @@ struct hb_buffer_t
} }
} }
void unsafe_to_break_all (void) void unsafe_to_break_all ()
{ unsafe_to_break_impl (0, len); } { unsafe_to_break_impl (0, len); }
void safe_to_break_all (void) void safe_to_break_all ()
{ {
for (unsigned int i = 0; i < len; i++) for (unsigned int i = 0; i < len; i++)
info[i].mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK; info[i].mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK;

View File

@ -39,10 +39,10 @@ struct hb_cache_t
static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (hb_atomic_int_t)), ""); static_assert ((key_bits + value_bits - cache_bits <= 8 * sizeof (hb_atomic_int_t)), "");
static_assert (sizeof (hb_atomic_int_t) == sizeof (unsigned int), ""); static_assert (sizeof (hb_atomic_int_t) == sizeof (unsigned int), "");
void init (void) { clear (); } void init () { clear (); }
void fini (void) {} void fini () {}
void clear (void) void clear ()
{ {
for (unsigned i = 0; i < ARRAY_LENGTH (values); i++) for (unsigned i = 0; i < ARRAY_LENGTH (values); i++)
values[i].set_relaxed (-1); values[i].set_relaxed (-1);

View File

@ -217,23 +217,22 @@ inline unsigned int OpCode_Size (OpCode op) { return Is_OpCode_ESC (op) ? 2: 1;
struct Number struct Number
{ {
void init (void) { set_real (0.0); } void init () { set_real (0.0); }
void fini (void) {} void fini () {}
void set_int (int v) { value = (double) v; } void set_int (int v) { value = (double) v; }
int to_int (void) const { return (int) value; } int to_int () const { return (int) value; }
void set_fixed (int32_t v) { value = v / 65536.0; } void set_fixed (int32_t v) { value = v / 65536.0; }
int32_t to_fixed (void) const int32_t to_fixed () const { return (int32_t) (value * 65536.0); }
{
return (int32_t)(value * 65536.0);
}
void set_real (double v) { value = v; } void set_real (double v) { value = v; }
double to_real (void) const { return value; } double to_real () const { return value; }
int ceil (void) const { return (int) ::ceil (value); } int ceil () const { return (int) ::ceil (value); }
int floor (void) const { return (int) ::floor (value); } int floor () const { return (int) ::floor (value); }
bool in_int_range (void) const bool in_int_range () const
{ return ((double) (int16_t) to_int () == value); } { return ((double) (int16_t) to_int () == value); }
bool operator > (const Number &n) const bool operator > (const Number &n) const
@ -300,7 +299,7 @@ struct UnsizedByteStr : UnsizedArrayOf <HBUINT8>
struct ByteStr struct ByteStr
{ {
ByteStr (void) ByteStr ()
: str (&Null(UnsizedByteStr)), len (0) {} : str (&Null(UnsizedByteStr)), len (0) {}
ByteStr (const UnsizedByteStr& s, unsigned int l) ByteStr (const UnsizedByteStr& s, unsigned int l)
: str (&s), len (l) {} : str (&s), len (l) {}
@ -333,7 +332,7 @@ struct ByteStr
return_trace (true); return_trace (true);
} }
unsigned int get_size (void) const { return len; } unsigned int get_size () const { return len; }
bool check_limit (unsigned int offset, unsigned int count) const bool check_limit (unsigned int offset, unsigned int count) const
{ return (offset + count <= len); } { return (offset + count <= len); }
@ -344,17 +343,17 @@ struct ByteStr
struct SubByteStr struct SubByteStr
{ {
SubByteStr (void) SubByteStr ()
{ init (); } { init (); }
void init (void) void init ()
{ {
str = ByteStr (0); str = ByteStr (0);
offset = 0; offset = 0;
error = false; error = false;
} }
void fini (void) {} void fini () {}
SubByteStr (const ByteStr &str_, unsigned int offset_ = 0) SubByteStr (const ByteStr &str_, unsigned int offset_ = 0)
: str (str_), offset (offset_), error (false) {} : str (str_), offset (offset_), error (false) {}
@ -376,7 +375,7 @@ struct SubByteStr
return str[offset + i]; return str[offset + i];
} }
operator ByteStr (void) const { return ByteStr (str, offset, str.len - offset); } operator ByteStr () const { return ByteStr (str, offset, str.len - offset); }
bool avail (unsigned int count=1) const bool avail (unsigned int count=1) const
{ {
@ -395,8 +394,8 @@ struct SubByteStr
} }
} }
void set_error (void) { error = true; } void set_error () { error = true; }
bool in_error (void) const { return error; } bool in_error () const { return error; }
ByteStr str; ByteStr str;
unsigned int offset; /* beginning of the sub-string within str */ unsigned int offset; /* beginning of the sub-string within str */
@ -411,7 +410,7 @@ typedef hb_vector_t<ByteStr> ByteStrArray;
template <typename ELEM, int LIMIT> template <typename ELEM, int LIMIT>
struct Stack struct Stack
{ {
void init (void) void init ()
{ {
error = false; error = false;
count = 0; count = 0;
@ -421,7 +420,7 @@ struct Stack
elements[i].init (); elements[i].init ();
} }
void fini (void) void fini ()
{ {
elements.fini_deep (); elements.fini_deep ();
} }
@ -440,7 +439,7 @@ struct Stack
set_error (); set_error ();
} }
ELEM &push (void) ELEM &push ()
{ {
if (likely (count < elements.len)) if (likely (count < elements.len))
return elements[count++]; return elements[count++];
@ -451,7 +450,7 @@ struct Stack
} }
} }
ELEM& pop (void) ELEM& pop ()
{ {
if (likely (count > 0)) if (likely (count > 0))
return elements[--count]; return elements[--count];
@ -470,7 +469,7 @@ struct Stack
set_error (); set_error ();
} }
const ELEM& peek (void) const ELEM& peek ()
{ {
if (likely (count > 0)) if (likely (count > 0))
return elements[count-1]; return elements[count-1];
@ -481,7 +480,7 @@ struct Stack
} }
} }
void unpop (void) void unpop ()
{ {
if (likely (count < elements.len)) if (likely (count < elements.len))
count++; count++;
@ -489,13 +488,13 @@ struct Stack
set_error (); set_error ();
} }
void clear (void) { count = 0; } void clear () { count = 0; }
bool in_error (void) const { return (error || elements.in_error ()); } bool in_error () const { return (error || elements.in_error ()); }
void set_error (void) { error = true; } void set_error () { error = true; }
unsigned int get_count (void) const { return count; } unsigned int get_count () const { return count; }
bool is_empty (void) const { return count == 0; } bool is_empty () const { return count == 0; }
static const unsigned int kSizeLimit = LIMIT; static const unsigned int kSizeLimit = LIMIT;
@ -527,17 +526,11 @@ struct ArgStack : Stack<ARG, 513>
n.set_real (v); n.set_real (v);
} }
ARG& pop_num (void) ARG& pop_num () { return this->pop (); }
{
return this->pop ();
}
int pop_int (void) int pop_int () { return this->pop ().to_int (); }
{
return this->pop ().to_int ();
}
unsigned int pop_uint (void) unsigned int pop_uint ()
{ {
int i = pop_int (); int i = pop_int ();
if (unlikely (i < 0)) if (unlikely (i < 0))
@ -575,8 +568,8 @@ struct ArgStack : Stack<ARG, 513>
/* an operator prefixed by its operands in a byte string */ /* an operator prefixed by its operands in a byte string */
struct OpStr struct OpStr
{ {
void init (void) {} void init () {}
void fini (void) {} void fini () {}
OpCode op; OpCode op;
ByteStr str; ByteStr str;
@ -600,16 +593,12 @@ struct OpSerializer
template <typename VAL> template <typename VAL>
struct ParsedValues struct ParsedValues
{ {
void init (void) void init ()
{ {
opStart = 0; opStart = 0;
values.init (); values.init ();
} }
void fini () { values.fini_deep (); }
void fini (void)
{
values.fini_deep ();
}
void add_op (OpCode op, const SubByteStr& substr = SubByteStr ()) void add_op (OpCode op, const SubByteStr& substr = SubByteStr ())
{ {
@ -634,7 +623,7 @@ struct ParsedValues
return false; return false;
} }
unsigned get_count (void) const { return values.len; } unsigned get_count () const { return values.len; }
const VAL &get_value (unsigned int i) const { return values[i]; } const VAL &get_value (unsigned int i) const { return values[i]; }
const VAL &operator [] (unsigned int i) const { return get_value (i); } const VAL &operator [] (unsigned int i) const { return get_value (i); }
@ -651,20 +640,14 @@ struct InterpEnv
argStack.init (); argStack.init ();
error = false; error = false;
} }
void fini () { argStack.fini (); }
void fini (void) bool in_error () const
{ { return error || substr.in_error () || argStack.in_error (); }
argStack.fini ();
}
bool in_error (void) const void set_error () { error = true; }
{
return error || substr.in_error () || argStack.in_error ();
}
void set_error (void) { error = true; } OpCode fetch_op ()
OpCode fetch_op (void)
{ {
OpCode op = OpCode_Invalid; OpCode op = OpCode_Invalid;
if (unlikely (!substr.avail ())) if (unlikely (!substr.avail ()))
@ -685,7 +668,7 @@ struct InterpEnv
return argStack[i]; return argStack[i];
} }
ARG& pop_arg (void) ARG& pop_arg ()
{ {
return argStack.pop (); return argStack.pop ();
} }
@ -695,7 +678,7 @@ struct InterpEnv
argStack.pop (n); argStack.pop (n);
} }
void clear_args (void) void clear_args ()
{ {
pop_n_args (argStack.get_count ()); pop_n_args (argStack.get_count ());
} }
@ -749,9 +732,9 @@ struct OpSet
template <typename ENV> template <typename ENV>
struct Interpreter { struct Interpreter {
~Interpreter(void) { fini (); } ~Interpreter() { fini (); }
void fini (void) { env.fini (); } void fini () { env.fini (); }
ENV env; ENV env;
}; };

View File

@ -48,7 +48,7 @@ struct CallContext
subr_num = subr_num_; subr_num = subr_num_;
} }
void fini (void) {} void fini () {}
SubByteStr substr; SubByteStr substr;
CSType type; CSType type;
@ -74,10 +74,10 @@ struct BiasedSubrs
bias = 32768; bias = 32768;
} }
void fini (void) {} void fini () {}
unsigned int get_count (void) const { return (subrs == nullptr)? 0: subrs->count; } unsigned int get_count () const { return (subrs == nullptr)? 0: subrs->count; }
unsigned int get_bias (void) const { return bias; } unsigned int get_bias () const { return bias; }
ByteStr operator [] (unsigned int index) const ByteStr operator [] (unsigned int index) const
{ {
@ -94,7 +94,7 @@ struct BiasedSubrs
struct Point struct Point
{ {
void init (void) void init ()
{ {
x.init (); x.init ();
y.init (); y.init ();
@ -132,7 +132,7 @@ struct CSInterpEnv : InterpEnv<ARG>
globalSubrs.init (globalSubrs_); globalSubrs.init (globalSubrs_);
localSubrs.init (localSubrs_); localSubrs.init (localSubrs_);
} }
void fini (void) void fini ()
{ {
InterpEnv<ARG>::fini (); InterpEnv<ARG>::fini ();
@ -141,7 +141,7 @@ struct CSInterpEnv : InterpEnv<ARG>
localSubrs.fini (); localSubrs.fini ();
} }
bool in_error (void) const bool in_error () const
{ {
return callStack.in_error () || SUPER::in_error (); return callStack.in_error () || SUPER::in_error ();
} }
@ -174,7 +174,7 @@ struct CSInterpEnv : InterpEnv<ARG>
SUPER::substr = context.substr; SUPER::substr = context.substr;
} }
void returnFromSubr (void) void returnFromSubr ()
{ {
if (unlikely (SUPER::substr.in_error ())) if (unlikely (SUPER::substr.in_error ()))
SUPER::set_error (); SUPER::set_error ();
@ -182,7 +182,7 @@ struct CSInterpEnv : InterpEnv<ARG>
SUPER::substr = context.substr; SUPER::substr = context.substr;
} }
void determine_hintmask_size (void) void determine_hintmask_size ()
{ {
if (!seen_hintmask) if (!seen_hintmask)
{ {
@ -193,11 +193,11 @@ struct CSInterpEnv : InterpEnv<ARG>
} }
void set_endchar (bool endchar_flag_) { endchar_flag = endchar_flag_; } void set_endchar (bool endchar_flag_) { endchar_flag = endchar_flag_; }
bool is_endchar (void) const { return endchar_flag; } bool is_endchar () const { return endchar_flag; }
const Number &get_x (void) const { return pt.x; } const Number &get_x () const { return pt.x; }
const Number &get_y (void) const { return pt.y; } const Number &get_y () const { return pt.y; }
const Point &get_pt (void) const { return pt; } const Point &get_pt () const { return pt; }
void moveto (const Point &pt_ ) { pt = pt_; } void moveto (const Point &pt_ ) { pt = pt_; }

View File

@ -37,8 +37,8 @@ using namespace OT;
/* an opstr and the parsed out dict value(s) */ /* an opstr and the parsed out dict value(s) */
struct DictVal : OpStr struct DictVal : OpStr
{ {
void init (void) { single_val.set_int (0); } void init () { single_val.set_int (0); }
void fini (void) {} void fini () {}
Number single_val; Number single_val;
}; };
@ -50,17 +50,13 @@ template <typename VAL> struct DictValues : ParsedValues<VAL> {};
template <typename OPSTR=OpStr> template <typename OPSTR=OpStr>
struct TopDictValues : DictValues<OPSTR> struct TopDictValues : DictValues<OPSTR>
{ {
void init (void) void init ()
{ {
DictValues<OPSTR>::init (); DictValues<OPSTR>::init ();
charStringsOffset = 0; charStringsOffset = 0;
FDArrayOffset = 0; FDArrayOffset = 0;
} }
void fini () { DictValues<OPSTR>::fini (); }
void fini (void)
{
DictValues<OPSTR>::fini ();
}
unsigned int calculate_serialized_op_size (const OPSTR& opstr) const unsigned int calculate_serialized_op_size (const OPSTR& opstr) const
{ {

View File

@ -47,7 +47,7 @@ struct CFF1CSInterpEnv : CSInterpEnv<Number, CFF1Subrs>
in_seac = false; in_seac = false;
} }
void fini (void) { SUPER::fini (); } void fini () { SUPER::fini (); }
void set_width (bool has_width_) void set_width (bool has_width_)
{ {
@ -63,7 +63,7 @@ struct CFF1CSInterpEnv : CSInterpEnv<Number, CFF1Subrs>
processed_width = true; processed_width = true;
} }
void clear_args (void) void clear_args ()
{ {
arg_start = 0; arg_start = 0;
SUPER::clear_args (); SUPER::clear_args ();

View File

@ -35,13 +35,13 @@ using namespace OT;
struct BlendArg : Number struct BlendArg : Number
{ {
void init (void) void init ()
{ {
Number::init (); Number::init ();
deltas.init (); deltas.init ();
} }
void fini (void) void fini ()
{ {
Number::fini (); Number::fini ();
deltas.fini_deep (); deltas.fini_deep ();
@ -61,8 +61,8 @@ struct BlendArg : Number
deltas[i] = blends_[i]; deltas[i] = blends_[i];
} }
bool blending (void) const { return deltas.len > 0; } bool blending () const { return deltas.len > 0; }
void reset_blends (void) void reset_blends ()
{ {
numValues = valueIndex = 0; numValues = valueIndex = 0;
deltas.resize (0); deltas.resize (0);
@ -94,13 +94,13 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
set_ivs (acc.privateDicts[fd].ivs); set_ivs (acc.privateDicts[fd].ivs);
} }
void fini (void) void fini ()
{ {
scalars.fini (); scalars.fini ();
SUPER::fini (); SUPER::fini ();
} }
OpCode fetch_op (void) OpCode fetch_op ()
{ {
if (this->substr.avail ()) if (this->substr.avail ())
return SUPER::fetch_op (); return SUPER::fetch_op ();
@ -119,14 +119,14 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
return arg; return arg;
} }
const BlendArg& pop_arg (void) const BlendArg& pop_arg ()
{ {
BlendArg &arg = argStack.pop (); BlendArg &arg = argStack.pop ();
blend_arg (arg); blend_arg (arg);
return arg; return arg;
} }
void process_blend (void) void process_blend ()
{ {
if (!seen_blend) if (!seen_blend)
{ {
@ -142,7 +142,7 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
} }
} }
void process_vsindex (void) void process_vsindex ()
{ {
unsigned int index = argStack.pop_uint (); unsigned int index = argStack.pop_uint ();
if (unlikely (seen_vsindex () || seen_blend)) if (unlikely (seen_vsindex () || seen_blend))
@ -156,11 +156,11 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
seen_vsindex_ = true; seen_vsindex_ = true;
} }
unsigned int get_region_count (void) const { return region_count; } unsigned int get_region_count () const { return region_count; }
void set_region_count (unsigned int region_count_) { region_count = region_count_; } void set_region_count (unsigned int region_count_) { region_count = region_count_; }
unsigned int get_ivs (void) const { return ivs; } unsigned int get_ivs () const { return ivs; }
void set_ivs (unsigned int ivs_) { ivs = ivs_; } void set_ivs (unsigned int ivs_) { ivs = ivs_; }
bool seen_vsindex (void) const { return seen_vsindex_; } bool seen_vsindex () const { return seen_vsindex_; }
protected: protected:
void blend_arg (BlendArg &arg) void blend_arg (BlendArg &arg)

View File

@ -51,7 +51,7 @@
hb_atomic_int_t _hb_options; hb_atomic_int_t _hb_options;
void void
_hb_options_init (void) _hb_options_init ()
{ {
hb_options_union_t u; hb_options_union_t u;
u.i = 0; u.i = 0;
@ -267,7 +267,7 @@ struct hb_language_item_t {
return *this; return *this;
} }
void fini (void) { free ((void *) lang); } void fini () { free ((void *) lang); }
}; };
@ -277,7 +277,7 @@ static hb_atomic_ptr_t <hb_language_item_t> langs;
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static void static void
free_langs (void) free_langs ()
{ {
retry: retry:
hb_language_item_t *first_lang = langs; hb_language_item_t *first_lang = langs;
@ -403,7 +403,7 @@ hb_language_to_string (hb_language_t language)
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_language_t hb_language_t
hb_language_get_default (void) hb_language_get_default ()
{ {
static hb_atomic_ptr_t <hb_language_t> default_language; static hb_atomic_ptr_t <hb_language_t> default_language;
@ -667,7 +667,7 @@ hb_version (unsigned int *major,
* Since: 0.9.2 * Since: 0.9.2
**/ **/
const char * const char *
hb_version_string (void) hb_version_string ()
{ {
return HB_VERSION_STRING; return HB_VERSION_STRING;
} }
@ -780,13 +780,13 @@ parse_uint32 (const char **pp, const char *end, uint32_t *pv)
#ifdef USE_XLOCALE #ifdef USE_XLOCALE
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_C_locale (void); static void free_static_C_locale ();
#endif #endif
static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (HB_LOCALE_T), static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (HB_LOCALE_T),
hb_C_locale_lazy_loader_t> hb_C_locale_lazy_loader_t>
{ {
static HB_LOCALE_T create (void) static HB_LOCALE_T create ()
{ {
HB_LOCALE_T C_locale = HB_CREATE_LOCALE ("C"); HB_LOCALE_T C_locale = HB_CREATE_LOCALE ("C");
@ -800,7 +800,7 @@ static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (HB
{ {
HB_FREE_LOCALE (p); HB_FREE_LOCALE (p);
} }
static HB_LOCALE_T get_null (void) static HB_LOCALE_T get_null ()
{ {
return nullptr; return nullptr;
} }
@ -808,14 +808,14 @@ static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (HB
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_C_locale (void) void free_static_C_locale ()
{ {
static_C_locale.free_instance (); static_C_locale.free_instance ();
} }
#endif #endif
static HB_LOCALE_T static HB_LOCALE_T
get_C_locale (void) get_C_locale ()
{ {
return static_C_locale.get_unconst (); return static_C_locale.get_unconst ();
} }

View File

@ -100,7 +100,7 @@ _hb_cg_font_release (void *data)
static CTFontDescriptorRef static CTFontDescriptorRef
get_last_resort_font_desc (void) get_last_resort_font_desc ()
{ {
// TODO Handle allocation failures? // TODO Handle allocation failures?
CTFontDescriptorRef last_resort = CTFontDescriptorCreateWithNameAndSize (CFSTR("LastResort"), 0); CTFontDescriptorRef last_resort = CTFontDescriptorCreateWithNameAndSize (CFSTR("LastResort"), 0);

View File

@ -56,12 +56,12 @@ union hb_options_union_t {
static_assert ((sizeof (hb_atomic_int_t) >= sizeof (hb_options_union_t)), ""); static_assert ((sizeof (hb_atomic_int_t) >= sizeof (hb_options_union_t)), "");
HB_INTERNAL void HB_INTERNAL void
_hb_options_init (void); _hb_options_init ();
extern HB_INTERNAL hb_atomic_int_t _hb_options; extern HB_INTERNAL hb_atomic_int_t _hb_options;
static inline hb_options_t static inline hb_options_t
hb_options (void) hb_options ()
{ {
/* Make a local copy, so we can access bitfield threadsafely. */ /* Make a local copy, so we can access bitfield threadsafely. */
hb_options_union_t u; hb_options_union_t u;
@ -284,7 +284,7 @@ struct hb_auto_trace_t
_hb_debug_msg_va<max_level> (what, obj, func, true, plevel ? *plevel : 0, +1, message, ap); _hb_debug_msg_va<max_level> (what, obj, func, true, plevel ? *plevel : 0, +1, message, ap);
va_end (ap); va_end (ap);
} }
~hb_auto_trace_t (void) ~hb_auto_trace_t ()
{ {
_hb_warn_no_return<ret_t> (returned); _hb_warn_no_return<ret_t> (returned);
if (!returned) { if (!returned) {

View File

@ -59,8 +59,8 @@ public:
// IUnknown interface // IUnknown interface
IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject) IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject)
{ return S_OK; } { return S_OK; }
IFACEMETHOD_ (ULONG, AddRef) (void) { return 1; } IFACEMETHOD_ (ULONG, AddRef) () { return 1; }
IFACEMETHOD_ (ULONG, Release) (void) { return 1; } IFACEMETHOD_ (ULONG, Release) () { return 1; }
// IDWriteFontFileLoader methods // IDWriteFontFileLoader methods
virtual HRESULT STDMETHODCALLTYPE virtual HRESULT STDMETHODCALLTYPE
@ -88,8 +88,8 @@ public:
// IUnknown interface // IUnknown interface
IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject) IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject)
{ return S_OK; } { return S_OK; }
IFACEMETHOD_ (ULONG, AddRef) (void) { return 1; } IFACEMETHOD_ (ULONG, AddRef) () { return 1; }
IFACEMETHOD_ (ULONG, Release) (void) { return 1; } IFACEMETHOD_ (ULONG, Release) () { return 1; }
// IDWriteFontFileStream methods // IDWriteFontFileStream methods
virtual HRESULT STDMETHODCALLTYPE virtual HRESULT STDMETHODCALLTYPE
@ -253,8 +253,8 @@ public:
IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject) IFACEMETHOD (QueryInterface) (IID const& iid, OUT void** ppObject)
{ return S_OK; } { return S_OK; }
IFACEMETHOD_ (ULONG, AddRef) (void) { return 1; } IFACEMETHOD_ (ULONG, AddRef) () { return 1; }
IFACEMETHOD_ (ULONG, Release) (void) { return 1; } IFACEMETHOD_ (ULONG, Release) () { return 1; }
// A single contiguous run of characters containing the same analysis // A single contiguous run of characters containing the same analysis
// results. // results.
@ -283,7 +283,7 @@ public:
const wchar_t* localeName, DWRITE_READING_DIRECTION readingDirection) const wchar_t* localeName, DWRITE_READING_DIRECTION readingDirection)
: mText (text), mTextLength (textLength), mLocaleName (localeName), : mText (text), mTextLength (textLength), mLocaleName (localeName),
mReadingDirection (readingDirection), mCurrentRun (nullptr) {} mReadingDirection (readingDirection), mCurrentRun (nullptr) {}
~TextAnalysis (void) ~TextAnalysis ()
{ {
// delete runs, except mRunHead which is part of the TextAnalysis object // delete runs, except mRunHead which is part of the TextAnalysis object
for (Run *run = mRunHead.nextRun; run;) for (Run *run = mRunHead.nextRun; run;)
@ -360,7 +360,7 @@ public:
} }
IFACEMETHODIMP_ (DWRITE_READING_DIRECTION) IFACEMETHODIMP_ (DWRITE_READING_DIRECTION)
GetParagraphReadingDirection (void) { return mReadingDirection; } GetParagraphReadingDirection () { return mReadingDirection; }
IFACEMETHODIMP GetLocaleName (uint32_t textPosition, uint32_t* textLength, IFACEMETHODIMP GetLocaleName (uint32_t textPosition, uint32_t* textLength,
wchar_t const** localeName) wchar_t const** localeName)

View File

@ -592,7 +592,7 @@ struct hb_vector_size_t
{ return process<HbOpAnd> (o); } { return process<HbOpAnd> (o); }
hb_vector_size_t operator ^ (const hb_vector_size_t &o) const hb_vector_size_t operator ^ (const hb_vector_size_t &o) const
{ return process<HbOpXor> (o); } { return process<HbOpXor> (o); }
hb_vector_size_t operator ~ (void) const hb_vector_size_t operator ~ () const
{ {
hb_vector_size_t r; hb_vector_size_t r;
#if HB_VECTOR_SIZE && 0 #if HB_VECTOR_SIZE && 0

View File

@ -224,7 +224,7 @@ hb_face_create (hb_blob_t *blob,
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_face_t * hb_face_t *
hb_face_get_empty (void) hb_face_get_empty ()
{ {
return const_cast<hb_face_t *> (&Null(hb_face_t)); return const_cast<hb_face_t *> (&Null(hb_face_t));
} }
@ -603,7 +603,7 @@ struct hb_face_builder_data_t
}; };
static hb_face_builder_data_t * static hb_face_builder_data_t *
_hb_face_builder_data_create (void) _hb_face_builder_data_create ()
{ {
hb_face_builder_data_t *data = (hb_face_builder_data_t *) calloc (1, sizeof (hb_face_builder_data_t)); hb_face_builder_data_t *data = (hb_face_builder_data_t *) calloc (1, sizeof (hb_face_builder_data_t));
if (unlikely (!data)) if (unlikely (!data))
@ -692,7 +692,7 @@ _hb_face_builder_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void
* Since: 1.9.0 * Since: 1.9.0
**/ **/
hb_face_t * hb_face_t *
hb_face_builder_create (void) hb_face_builder_create ()
{ {
hb_face_builder_data_t *data = _hb_face_builder_data_create (); hb_face_builder_data_t *data = _hb_face_builder_data_create ();
if (unlikely (!data)) return hb_face_get_empty (); if (unlikely (!data)) return hb_face_get_empty ();

View File

@ -81,7 +81,7 @@ struct hb_face_t
return blob; return blob;
} }
HB_PURE_FUNC unsigned int get_upem (void) const HB_PURE_FUNC unsigned int get_upem () const
{ {
unsigned int ret = upem.get_relaxed (); unsigned int ret = upem.get_relaxed ();
if (unlikely (!ret)) if (unlikely (!ret))
@ -91,7 +91,7 @@ struct hb_face_t
return ret; return ret;
} }
unsigned int get_num_glyphs (void) const unsigned int get_num_glyphs () const
{ {
unsigned int ret = num_glyphs.get_relaxed (); unsigned int ret = num_glyphs.get_relaxed ();
if (unlikely (ret == (unsigned int) -1)) if (unlikely (ret == (unsigned int) -1))
@ -100,8 +100,8 @@ struct hb_face_t
} }
private: private:
HB_INTERNAL unsigned int load_upem (void) const; HB_INTERNAL unsigned int load_upem () const;
HB_INTERNAL unsigned int load_num_glyphs (void) const; HB_INTERNAL unsigned int load_num_glyphs () const;
}; };
DECLARE_NULL_INSTANCE (hb_face_t); DECLARE_NULL_INSTANCE (hb_face_t);

View File

@ -523,7 +523,7 @@ static const hb_font_funcs_t _hb_font_funcs_default = {
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_font_funcs_t * hb_font_funcs_t *
hb_font_funcs_create (void) hb_font_funcs_create ()
{ {
hb_font_funcs_t *ffuncs; hb_font_funcs_t *ffuncs;
@ -545,7 +545,7 @@ hb_font_funcs_create (void)
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_font_funcs_t * hb_font_funcs_t *
hb_font_funcs_get_empty (void) hb_font_funcs_get_empty ()
{ {
return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_default); return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_default);
} }
@ -1408,7 +1408,7 @@ hb_font_create_sub_font (hb_font_t *parent)
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_font_t * hb_font_t *
hb_font_get_empty (void) hb_font_get_empty ()
{ {
return const_cast<hb_font_t *> (&Null(hb_font_t)); return const_cast<hb_font_t *> (&Null(hb_font_t));
} }

View File

@ -86,7 +86,7 @@ struct hb_font_funcs_t
#define HB_FONT_FUNC_IMPLEMENT(name) +1 #define HB_FONT_FUNC_IMPLEMENT(name) +1
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT #undef HB_FONT_FUNC_IMPLEMENT
]) (void); ]) ();
} get; } get;
}; };
DECLARE_NULL_INSTANCE (hb_font_funcs_t); DECLARE_NULL_INSTANCE (hb_font_funcs_t);
@ -176,14 +176,14 @@ struct hb_font_t
/* has_* ... */ /* has_* ... */
#define HB_FONT_FUNC_IMPLEMENT(name) \ #define HB_FONT_FUNC_IMPLEMENT(name) \
bool \ bool \
has_##name##_func (void) \ has_##name##_func () \
{ \ { \
hb_font_funcs_t *funcs = this->klass; \ hb_font_funcs_t *funcs = this->klass; \
unsigned int i = offsetof (hb_font_funcs_t::get_t::get_funcs_t, name) / sizeof (funcs->get.array[0]); \ unsigned int i = offsetof (hb_font_funcs_t::get_t::get_funcs_t, name) / sizeof (funcs->get.array[0]); \
return has_func (i); \ return has_func (i); \
} \ } \
bool \ bool \
has_##name##_func_set (void) \ has_##name##_func_set () \
{ \ { \
hb_font_funcs_t *funcs = this->klass; \ hb_font_funcs_t *funcs = this->klass; \
unsigned int i = offsetof (hb_font_funcs_t::get_t::get_funcs_t, name) / sizeof (funcs->get.array[0]); \ unsigned int i = offsetof (hb_font_funcs_t::get_t::get_funcs_t, name) / sizeof (funcs->get.array[0]); \

View File

@ -479,12 +479,12 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED,
} }
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_ft_funcs (void); static void free_static_ft_funcs ();
#endif #endif
static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft_font_funcs_lazy_loader_t> static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft_font_funcs_lazy_loader_t>
{ {
static hb_font_funcs_t *create (void) static hb_font_funcs_t *create ()
{ {
hb_font_funcs_t *funcs = hb_font_funcs_create (); hb_font_funcs_t *funcs = hb_font_funcs_create ();
@ -514,14 +514,14 @@ static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_ft_funcs (void) void free_static_ft_funcs ()
{ {
static_ft_funcs.free_instance (); static_ft_funcs.free_instance ();
} }
#endif #endif
static hb_font_funcs_t * static hb_font_funcs_t *
_hb_ft_get_font_funcs (void) _hb_ft_get_font_funcs ()
{ {
return static_ft_funcs.get_unconst (); return static_ft_funcs.get_unconst ();
} }
@ -745,13 +745,13 @@ hb_ft_font_create_referenced (FT_Face ft_face)
} }
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_ft_library (void); static void free_static_ft_library ();
#endif #endif
static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (FT_Library), static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (FT_Library),
hb_ft_library_lazy_loader_t> hb_ft_library_lazy_loader_t>
{ {
static FT_Library create (void) static FT_Library create ()
{ {
FT_Library l; FT_Library l;
if (FT_Init_FreeType (&l)) if (FT_Init_FreeType (&l))
@ -767,7 +767,7 @@ static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (
{ {
FT_Done_FreeType (l); FT_Done_FreeType (l);
} }
static FT_Library get_null (void) static FT_Library get_null ()
{ {
return nullptr; return nullptr;
} }
@ -775,14 +775,14 @@ static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_pointer (
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_ft_library (void) void free_static_ft_library ()
{ {
static_ft_library.free_instance (); static_ft_library.free_instance ();
} }
#endif #endif
static FT_Library static FT_Library
get_ft_library (void) get_ft_library ()
{ {
return static_ft_library.get_unconst (); return static_ft_library.get_unconst ();
} }

View File

@ -337,12 +337,12 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_glib_funcs (void); static void free_static_glib_funcs ();
#endif #endif
static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_glib_unicode_funcs_lazy_loader_t> static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_glib_unicode_funcs_lazy_loader_t>
{ {
static hb_unicode_funcs_t *create (void) static hb_unicode_funcs_t *create ()
{ {
hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr); hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr);
@ -365,14 +365,14 @@ static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_glib_funcs (void) void free_static_glib_funcs ()
{ {
static_glib_funcs.free_instance (); static_glib_funcs.free_instance ();
} }
#endif #endif
hb_unicode_funcs_t * hb_unicode_funcs_t *
hb_glib_get_unicode_funcs (void) hb_glib_get_unicode_funcs ()
{ {
return static_glib_funcs.get_unconst (); return static_glib_funcs.get_unconst ();
} }

View File

@ -46,7 +46,7 @@
/*** BEGIN value-header ***/ /*** BEGIN value-header ***/
GType GType
@enum_name@_get_type (void) @enum_name@_get_type ()
{ {
static gsize type_id = 0; static gsize type_id = 0;

View File

@ -43,7 +43,7 @@ HB_BEGIN_DECLS
/*** BEGIN value-header ***/ /*** BEGIN value-header ***/
HB_EXTERN GType HB_EXTERN GType
@enum_name@_get_type (void) G_GNUC_CONST; @enum_name@_get_type () G_GNUC_CONST;
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) #define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/ /*** END value-header ***/

View File

@ -51,7 +51,7 @@
#define HB_DEFINE_BOXED_TYPE(name,copy_func,free_func) \ #define HB_DEFINE_BOXED_TYPE(name,copy_func,free_func) \
GType \ GType \
hb_gobject_##name##_get_type (void) \ hb_gobject_##name##_get_type () \
{ \ { \
static gsize type_id = 0; \ static gsize type_id = 0; \
if (g_once_init_enter (&type_id)) { \ if (g_once_init_enter (&type_id)) { \

View File

@ -302,12 +302,12 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_icu_funcs (void); static void free_static_icu_funcs ();
#endif #endif
static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_icu_unicode_funcs_lazy_loader_t> static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_icu_unicode_funcs_lazy_loader_t>
{ {
static hb_unicode_funcs_t *create (void) static hb_unicode_funcs_t *create ()
{ {
void *user_data = nullptr; void *user_data = nullptr;
#if U_ICU_VERSION_MAJOR_NUM >= 49 #if U_ICU_VERSION_MAJOR_NUM >= 49
@ -337,14 +337,14 @@ static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_icu_funcs (void) void free_static_icu_funcs ()
{ {
static_icu_funcs.free_instance (); static_icu_funcs.free_instance ();
} }
#endif #endif
hb_unicode_funcs_t * hb_unicode_funcs_t *
hb_icu_get_unicode_funcs (void) hb_icu_get_unicode_funcs ()
{ {
return static_icu_funcs.get_unconst (); return static_icu_funcs.get_unconst ();
} }

View File

@ -72,21 +72,18 @@ struct Iter<T *>
array (array_), length (length_) {} array (array_), length (length_) {}
/* Emptiness. */ /* Emptiness. */
explicit_operator bool (void) const { return length; } explicit_operator bool () const { return length; }
/* Current item. */ /* Current item. */
T &operator * (void) T &operator * ()
{ {
if (unlikely (!length)) return CrapOrNull(T); if (unlikely (!length)) return CrapOrNull(T);
return *array; return *array;
} }
T &operator -> (void) T &operator -> () { return (operator *); }
{
return (operator *);
}
/* Next. */ /* Next. */
Iter<T *> & operator ++ (void) Iter<T *> & operator ++ ()
{ {
if (unlikely (!length)) return *this; if (unlikely (!length)) return *this;
array++; array++;
@ -102,7 +99,7 @@ struct Iter<T *>
} }
/* Some iterators might implement len(). */ /* Some iterators might implement len(). */
unsigned int len (void) const { return length; } unsigned int len () const { return length; }
/* Some iterators might implement fast-forward. /* Some iterators might implement fast-forward.
* Only implement it if it's constant-time. */ * Only implement it if it's constant-time. */
@ -129,7 +126,7 @@ struct Iter<T *>
/* XXX Remove /* XXX Remove
* Just to test these compile. */ * Just to test these compile. */
static inline void static inline void
m (void) m ()
{ {
const int src[10] = {}; const int src[10] = {};
int dst[20]; int dst[20];

View File

@ -82,14 +82,14 @@ static inline Type& StructAfter(TObject &X)
/* Check _assertion in a method environment */ /* Check _assertion in a method environment */
#define _DEFINE_INSTANCE_ASSERTION1(_line, _assertion) \ #define _DEFINE_INSTANCE_ASSERTION1(_line, _assertion) \
void _instance_assertion_on_line_##_line (void) const \ void _instance_assertion_on_line_##_line () const \
{ static_assert ((_assertion), ""); } { static_assert ((_assertion), ""); }
# define _DEFINE_INSTANCE_ASSERTION0(_line, _assertion) _DEFINE_INSTANCE_ASSERTION1 (_line, _assertion) # define _DEFINE_INSTANCE_ASSERTION0(_line, _assertion) _DEFINE_INSTANCE_ASSERTION1 (_line, _assertion)
# define DEFINE_INSTANCE_ASSERTION(_assertion) _DEFINE_INSTANCE_ASSERTION0 (__LINE__, _assertion) # define DEFINE_INSTANCE_ASSERTION(_assertion) _DEFINE_INSTANCE_ASSERTION0 (__LINE__, _assertion)
/* Check that _code compiles in a method environment */ /* Check that _code compiles in a method environment */
#define _DEFINE_COMPILES_ASSERTION1(_line, _code) \ #define _DEFINE_COMPILES_ASSERTION1(_line, _code) \
void _compiles_assertion_on_line_##_line (void) const \ void _compiles_assertion_on_line_##_line () const \
{ _code; } { _code; }
# define _DEFINE_COMPILES_ASSERTION0(_line, _code) _DEFINE_COMPILES_ASSERTION1 (_line, _code) # define _DEFINE_COMPILES_ASSERTION0(_line, _code) _DEFINE_COMPILES_ASSERTION1 (_line, _code)
# define DEFINE_COMPILES_ASSERTION(_code) _DEFINE_COMPILES_ASSERTION0 (__LINE__, _code) # define DEFINE_COMPILES_ASSERTION(_code) _DEFINE_COMPILES_ASSERTION0 (__LINE__, _code)
@ -97,7 +97,7 @@ static inline Type& StructAfter(TObject &X)
#define DEFINE_SIZE_STATIC(size) \ #define DEFINE_SIZE_STATIC(size) \
DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)) \ DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)) \
unsigned int get_size (void) const { return (size); } \ unsigned int get_size () const { return (size); } \
enum { null_size = (size) }; \ enum { null_size = (size) }; \
enum { min_size = (size) }; \ enum { min_size = (size) }; \
enum { static_size = (size) } enum { static_size = (size) }
@ -124,7 +124,7 @@ static inline Type& StructAfter(TObject &X)
enum { min_size = (size) } enum { min_size = (size) }
#define DEFINE_SIZE_ARRAY_SIZED(size, array) \ #define DEFINE_SIZE_ARRAY_SIZED(size, array) \
unsigned int get_size (void) 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)
@ -139,7 +139,7 @@ struct hb_dispatch_context_t
typedef Return return_t; typedef Return return_t;
template <typename T, typename F> template <typename T, typename F>
bool may_dispatch (const T *obj HB_UNUSED, const F *format HB_UNUSED) { return true; } bool may_dispatch (const T *obj HB_UNUSED, const F *format HB_UNUSED) { return true; }
static return_t no_dispatch_return_value (void) { return Context::default_return_value (); } static return_t no_dispatch_return_value () { return Context::default_return_value (); }
static bool stop_sublookup_iteration (const return_t r HB_UNUSED) { return false; } static bool stop_sublookup_iteration (const return_t r HB_UNUSED) { return false; }
}; };
@ -227,7 +227,7 @@ struct hb_dispatch_context_t
struct hb_sanitize_context_t : struct hb_sanitize_context_t :
hb_dispatch_context_t<hb_sanitize_context_t, bool, HB_DEBUG_SANITIZE> hb_dispatch_context_t<hb_sanitize_context_t, bool, HB_DEBUG_SANITIZE>
{ {
hb_sanitize_context_t (void) : hb_sanitize_context_t () :
debug_depth (0), debug_depth (0),
start (nullptr), end (nullptr), start (nullptr), end (nullptr),
max_ops (0), max_ops (0),
@ -236,14 +236,14 @@ struct hb_sanitize_context_t :
num_glyphs (65536), num_glyphs (65536),
num_glyphs_set (false) {} num_glyphs_set (false) {}
const char *get_name (void) { return "SANITIZE"; } const char *get_name () { return "SANITIZE"; }
template <typename T, typename F> template <typename T, typename F>
bool may_dispatch (const T *obj HB_UNUSED, const F *format) bool may_dispatch (const T *obj HB_UNUSED, const F *format)
{ return format->sanitize (this); } { return format->sanitize (this); }
template <typename T> template <typename T>
return_t dispatch (const T &obj) { return obj.sanitize (this); } return_t dispatch (const T &obj) { return obj.sanitize (this); }
static return_t default_return_value (void) { return true; } static return_t default_return_value () { return true; }
static return_t no_dispatch_return_value (void) { return false; } static return_t no_dispatch_return_value () { return false; }
bool stop_sublookup_iteration (const return_t r) const { return !r; } bool stop_sublookup_iteration (const return_t r) const { return !r; }
void init (hb_blob_t *b) void init (hb_blob_t *b)
@ -257,7 +257,7 @@ struct hb_sanitize_context_t :
num_glyphs = num_glyphs_; num_glyphs = num_glyphs_;
num_glyphs_set = true; num_glyphs_set = true;
} }
unsigned int get_num_glyphs (void) { return num_glyphs; } unsigned int get_num_glyphs () { return num_glyphs; }
void set_max_ops (int max_ops_) { max_ops = max_ops_; } void set_max_ops (int max_ops_) { max_ops = max_ops_; }
@ -281,14 +281,14 @@ struct hb_sanitize_context_t :
} }
} }
void reset_object (void) void reset_object ()
{ {
this->start = this->blob->data; this->start = this->blob->data;
this->end = this->start + this->blob->length; this->end = this->start + this->blob->length;
assert (this->start <= this->end); /* Must not overflow. */ assert (this->start <= this->end); /* Must not overflow. */
} }
void start_processing (void) void start_processing ()
{ {
reset_object (); reset_object ();
this->max_ops = MAX ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR, this->max_ops = MAX ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR,
@ -302,7 +302,7 @@ struct hb_sanitize_context_t :
(unsigned long) (this->end - this->start)); (unsigned long) (this->end - this->start));
} }
void end_processing (void) void end_processing ()
{ {
DEBUG_MSG_LEVEL (SANITIZE, this->start, 0, -1, DEBUG_MSG_LEVEL (SANITIZE, this->start, 0, -1,
"end [%p..%p] %u edit requests", "end [%p..%p] %u edit requests",
@ -488,7 +488,7 @@ struct hb_sanitize_with_object_t
hb_sanitize_with_object_t (hb_sanitize_context_t *c, hb_sanitize_with_object_t (hb_sanitize_context_t *c,
const T& obj) : c (c) const T& obj) : c (c)
{ c->set_object (obj); } { c->set_object (obj); }
~hb_sanitize_with_object_t (void) ~hb_sanitize_with_object_t ()
{ c->reset_object (); } { c->reset_object (); }
private: private:
@ -509,7 +509,7 @@ struct hb_serialize_context_t
reset (); reset ();
} }
void reset (void) void reset ()
{ {
this->ran_out_of_room = false; this->ran_out_of_room = false;
this->head = this->start; this->head = this->start;
@ -520,7 +520,7 @@ struct hb_serialize_context_t
/* To be called around main operation. */ /* To be called around main operation. */
template <typename Type> template <typename Type>
Type *start_serialize (void) Type *start_serialize ()
{ {
DEBUG_MSG_LEVEL (SERIALIZE, this->start, 0, +1, DEBUG_MSG_LEVEL (SERIALIZE, this->start, 0, +1,
"start [%p..%p] (%lu bytes)", "start [%p..%p] (%lu bytes)",
@ -529,7 +529,7 @@ struct hb_serialize_context_t
return start_embed<Type> (); return start_embed<Type> ();
} }
void end_serialize (void) void end_serialize ()
{ {
DEBUG_MSG_LEVEL (SERIALIZE, this->start, 0, -1, DEBUG_MSG_LEVEL (SERIALIZE, this->start, 0, -1,
"end [%p..%p] serialized %d bytes; %s", "end [%p..%p] serialized %d bytes; %s",
@ -538,7 +538,7 @@ struct hb_serialize_context_t
this->ran_out_of_room ? "RAN OUT OF ROOM" : "did not ran out of room"); this->ran_out_of_room ? "RAN OUT OF ROOM" : "did not ran out of room");
} }
unsigned int length (void) const { return this->head - this->start; } unsigned int length () const { return this->head - this->start; }
void align (unsigned int alignment) void align (unsigned int alignment)
{ {
@ -568,7 +568,7 @@ struct hb_serialize_context_t
} }
template <typename Type> template <typename Type>
Type *allocate_min (void) Type *allocate_min ()
{ {
return this->allocate_size<Type> (Type::min_size); return this->allocate_size<Type> (Type::min_size);
} }
@ -601,7 +601,7 @@ struct hb_serialize_context_t
/* Output routines. */ /* Output routines. */
template <typename Type> template <typename Type>
Type *copy (void) const Type *copy () const
{ {
assert (!this->ran_out_of_room); assert (!this->ran_out_of_room);
unsigned int len = this->head - this->start; unsigned int len = this->head - this->start;
@ -610,7 +610,7 @@ struct hb_serialize_context_t
memcpy (p, this->start, len); memcpy (p, this->start, len);
return reinterpret_cast<Type *> (p); return reinterpret_cast<Type *> (p);
} }
hb_bytes_t copy_bytes (void) const hb_bytes_t copy_bytes () const
{ {
assert (!this->ran_out_of_room); assert (!this->ran_out_of_room);
unsigned int len = this->head - this->start; unsigned int len = this->head - this->start;
@ -621,7 +621,7 @@ struct hb_serialize_context_t
return hb_bytes_t (); return hb_bytes_t ();
return hb_bytes_t ((char *) p, len); return hb_bytes_t ((char *) p, len);
} }
hb_blob_t *copy_blob (void) const hb_blob_t *copy_blob () const
{ {
assert (!this->ran_out_of_room); assert (!this->ran_out_of_room);
return hb_blob_create (this->start, return hb_blob_create (this->start,
@ -649,10 +649,8 @@ struct BEInt<Type, 1>
{ {
public: public:
typedef Type type; typedef Type type;
void set (Type V) void set (Type V) { v = V; }
{ v = V; } operator Type () const { return v; }
operator Type (void) const
{ return v; }
private: uint8_t v; private: uint8_t v;
}; };
template <typename Type> template <typename Type>
@ -665,7 +663,7 @@ struct BEInt<Type, 2>
v[0] = (V >> 8) & 0xFF; v[0] = (V >> 8) & 0xFF;
v[1] = (V ) & 0xFF; v[1] = (V ) & 0xFF;
} }
operator Type (void) const operator Type () const
{ {
#if (defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__) #if (defined(__GNUC__) && __GNUC__ >= 5) || defined(__clang__)
/* Spoon-feed the compiler a big-endian integer with alignment 1. /* Spoon-feed the compiler a big-endian integer with alignment 1.
@ -689,7 +687,7 @@ struct BEInt<Type, 3>
v[1] = (V >> 8) & 0xFF; v[1] = (V >> 8) & 0xFF;
v[2] = (V ) & 0xFF; v[2] = (V ) & 0xFF;
} }
operator Type (void) const operator Type () const
{ {
return (v[0] << 16) return (v[0] << 16)
+ (v[1] << 8) + (v[1] << 8)
@ -709,7 +707,7 @@ struct BEInt<Type, 4>
v[2] = (V >> 8) & 0xFF; v[2] = (V >> 8) & 0xFF;
v[3] = (V ) & 0xFF; v[3] = (V ) & 0xFF;
} }
operator Type (void) const operator Type () const
{ {
return (v[0] << 24) return (v[0] << 24)
+ (v[1] << 16) + (v[1] << 16)
@ -729,23 +727,21 @@ struct hb_data_wrapper_t
{ {
static_assert (WheresData > 0, ""); static_assert (WheresData > 0, "");
Data * get_data (void) const Data * get_data () const
{ { return *(((Data **) (void *) this) - WheresData); }
return *(((Data **) (void *) this) - WheresData);
}
bool is_inert (void) const { return !get_data (); } bool is_inert () const { return !get_data (); }
template <typename Stored, typename Subclass> template <typename Stored, typename Subclass>
Stored * call_create (void) const { return Subclass::create (get_data ()); } Stored * call_create () const { return Subclass::create (get_data ()); }
}; };
template <> template <>
struct hb_data_wrapper_t<void, 0> struct hb_data_wrapper_t<void, 0>
{ {
bool is_inert (void) const { return false; } bool is_inert () const { return false; }
template <typename Stored, typename Funcs> template <typename Stored, typename Funcs>
Stored * call_create (void) const { return Funcs::create (); } Stored * call_create () const { return Funcs::create (); }
}; };
template <typename T1, typename T2> struct hb_non_void_t { typedef T1 value; }; template <typename T1, typename T2> struct hb_non_void_t { typedef T1 value; };
@ -762,13 +758,11 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
hb_lazy_loader_t<Returned,Subclass,Data,WheresData,Stored> hb_lazy_loader_t<Returned,Subclass,Data,WheresData,Stored>
>::value Funcs; >::value Funcs;
void init0 (void) {} /* Init, when memory is already set to 0. No-op for us. */ void init0 () {} /* Init, when memory is already set to 0. No-op for us. */
void init (void) { instance.set_relaxed (nullptr); } void init () { instance.set_relaxed (nullptr); }
void fini (void) void fini () { do_destroy (instance.get ()); }
{
do_destroy (instance.get ()); void free_instance ()
}
void free_instance (void)
{ {
retry: retry:
Stored *p = instance.get (); Stored *p = instance.get ();
@ -783,13 +777,13 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
Funcs::destroy (p); Funcs::destroy (p);
} }
const Returned * operator -> (void) const { return get (); } const Returned * operator -> () const { return get (); }
const Returned & operator * (void) const { return *get (); } const Returned & operator * () const { return *get (); }
explicit_operator bool (void) const explicit_operator bool () const
{ return get_stored () != Funcs::get_null (); } { return get_stored () != Funcs::get_null (); }
template <typename C> operator const C * (void) const { return get (); } template <typename C> operator const C * () const { return get (); }
Stored * get_stored (void) const Stored * get_stored () const
{ {
retry: retry:
Stored *p = this->instance.get (); Stored *p = this->instance.get ();
@ -810,7 +804,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
} }
return p; return p;
} }
Stored * get_stored_relaxed (void) const Stored * get_stored_relaxed () const
{ {
return this->instance.get_relaxed (); return this->instance.get_relaxed ();
} }
@ -821,15 +815,15 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
return this->instance.cmpexch (current, value); return this->instance.cmpexch (current, value);
} }
const Returned * get (void) const { return Funcs::convert (get_stored ()); } const Returned * get () const { return Funcs::convert (get_stored ()); }
const Returned * get_relaxed (void) const { return Funcs::convert (get_stored_relaxed ()); } const Returned * get_relaxed () const { return Funcs::convert (get_stored_relaxed ()); }
Returned * get_unconst (void) const { return const_cast<Returned *> (Funcs::convert (get_stored ())); } Returned * get_unconst () const { return const_cast<Returned *> (Funcs::convert (get_stored ())); }
/* To be possibly overloaded by subclasses. */ /* To be possibly overloaded by subclasses. */
static Returned* convert (Stored *p) { return p; } static Returned* convert (Stored *p) { return p; }
/* By default null/init/fini the object. */ /* By default null/init/fini the object. */
static const Stored* get_null (void) { return &Null(Stored); } static const Stored* get_null () { return &Null(Stored); }
static Stored *create (Data *data) static Stored *create (Data *data)
{ {
Stored *p = (Stored *) calloc (1, sizeof (Stored)); Stored *p = (Stored *) calloc (1, sizeof (Stored));
@ -837,7 +831,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
p->init (data); p->init (data);
return p; return p;
} }
static Stored *create (void) static Stored *create ()
{ {
Stored *p = (Stored *) calloc (1, sizeof (Stored)); Stored *p = (Stored *) calloc (1, sizeof (Stored));
if (likely (p)) if (likely (p))
@ -869,51 +863,33 @@ struct hb_table_lazy_loader_t : hb_lazy_loader_t<T,
hb_blob_t> hb_blob_t>
{ {
static hb_blob_t *create (hb_face_t *face) static hb_blob_t *create (hb_face_t *face)
{ { return hb_sanitize_context_t ().reference_table<T> (face); }
return hb_sanitize_context_t ().reference_table<T> (face); static void destroy (hb_blob_t *p) { hb_blob_destroy (p); }
}
static void destroy (hb_blob_t *p)
{
hb_blob_destroy (p);
}
static const hb_blob_t *get_null (void)
{
return hb_blob_get_empty ();
}
static const T* convert (const hb_blob_t *blob)
{
return blob->as<T> ();
}
hb_blob_t* get_blob (void) const static const hb_blob_t *get_null ()
{ { return hb_blob_get_empty (); }
return this->get_stored ();
} static const T* convert (const hb_blob_t *blob)
{ return blob->as<T> (); }
hb_blob_t* get_blob () const { return this->get_stored (); }
}; };
template <typename Subclass> template <typename Subclass>
struct hb_font_funcs_lazy_loader_t : hb_lazy_loader_t<hb_font_funcs_t, Subclass> struct hb_font_funcs_lazy_loader_t : hb_lazy_loader_t<hb_font_funcs_t, Subclass>
{ {
static void destroy (hb_font_funcs_t *p) static void destroy (hb_font_funcs_t *p)
{ { hb_font_funcs_destroy (p); }
hb_font_funcs_destroy (p); static const hb_font_funcs_t *get_null ()
} { return hb_font_funcs_get_empty (); }
static const hb_font_funcs_t *get_null (void)
{
return hb_font_funcs_get_empty ();
}
}; };
template <typename Subclass> template <typename Subclass>
struct hb_unicode_funcs_lazy_loader_t : hb_lazy_loader_t<hb_unicode_funcs_t, Subclass> struct hb_unicode_funcs_lazy_loader_t : hb_lazy_loader_t<hb_unicode_funcs_t, Subclass>
{ {
static void destroy (hb_unicode_funcs_t *p) static void destroy (hb_unicode_funcs_t *p)
{ { hb_unicode_funcs_destroy (p); }
hb_unicode_funcs_destroy (p); static const hb_unicode_funcs_t *get_null ()
} { return hb_unicode_funcs_get_empty (); }
static const hb_unicode_funcs_t *get_null (void)
{
return hb_unicode_funcs_get_empty ();
}
}; };

View File

@ -47,7 +47,7 @@
* Since: 1.7.7 * Since: 1.7.7
**/ **/
hb_map_t * hb_map_t *
hb_map_create (void) hb_map_create ()
{ {
hb_map_t *map; hb_map_t *map;
@ -67,7 +67,7 @@ hb_map_create (void)
* Since: 1.7.7 * Since: 1.7.7
**/ **/
hb_map_t * hb_map_t *
hb_map_get_empty (void) hb_map_get_empty ()
{ {
return const_cast<hb_map_t *> (&Null(hb_map_t)); return const_cast<hb_map_t *> (&Null(hb_map_t));
} }

View File

@ -45,16 +45,16 @@ inline uint32_t Hash (const T &v)
struct hb_map_t struct hb_map_t
{ {
HB_NO_COPY_ASSIGN (hb_map_t); HB_NO_COPY_ASSIGN (hb_map_t);
hb_map_t (void) { init (); } hb_map_t () { init (); }
~hb_map_t (void) { fini (); } ~hb_map_t () { fini (); }
struct item_t struct item_t
{ {
hb_codepoint_t key; hb_codepoint_t key;
hb_codepoint_t value; hb_codepoint_t value;
bool is_unused (void) const { return key == INVALID; } bool is_unused () const { return key == INVALID; }
bool is_tombstone (void) const { return key != INVALID && value == INVALID; } bool is_tombstone () const { return key != INVALID && value == INVALID; }
}; };
hb_object_header_t header; hb_object_header_t header;
@ -65,7 +65,7 @@ struct hb_map_t
unsigned int prime; unsigned int prime;
item_t *items; item_t *items;
void init_shallow (void) void init_shallow ()
{ {
successful = true; successful = true;
population = occupancy = 0; population = occupancy = 0;
@ -73,24 +73,24 @@ struct hb_map_t
prime = 0; prime = 0;
items = nullptr; items = nullptr;
} }
void init (void) void init ()
{ {
hb_object_init (this); hb_object_init (this);
init_shallow (); init_shallow ();
} }
void fini_shallow (void) void fini_shallow ()
{ {
free (items); free (items);
items = nullptr; items = nullptr;
} }
void fini (void) void fini ()
{ {
population = occupancy = 0; population = occupancy = 0;
hb_object_fini (this); hb_object_fini (this);
fini_shallow (); fini_shallow ();
} }
bool resize (void) bool resize ()
{ {
if (unlikely (!successful)) return false; if (unlikely (!successful)) return false;
@ -166,15 +166,15 @@ struct hb_map_t
enum { INVALID = HB_MAP_VALUE_INVALID }; enum { INVALID = HB_MAP_VALUE_INVALID };
void clear (void) void clear ()
{ {
memset (items, 0xFF, ((size_t) mask + 1) * sizeof (item_t)); memset (items, 0xFF, ((size_t) mask + 1) * sizeof (item_t));
population = occupancy = 0; population = occupancy = 0;
} }
bool is_empty (void) const { return population == 0; } bool is_empty () const { return population == 0; }
unsigned int get_population (void) const { return population; } unsigned int get_population () const { return population; }
protected: protected:

View File

@ -131,16 +131,16 @@ struct hb_mutex_t
hb_mutex_impl_t m; hb_mutex_impl_t m;
void init (void) { hb_mutex_impl_init (&m); } void init () { hb_mutex_impl_init (&m); }
void lock (void) { hb_mutex_impl_lock (&m); } void lock () { hb_mutex_impl_lock (&m); }
void unlock (void) { hb_mutex_impl_unlock (&m); } void unlock () { hb_mutex_impl_unlock (&m); }
void fini (void) { hb_mutex_impl_finish (&m); } void fini () { hb_mutex_impl_finish (&m); }
}; };
struct hb_lock_t struct hb_lock_t
{ {
hb_lock_t (hb_mutex_t &mutex_) : mutex (mutex_) { mutex.lock (); } hb_lock_t (hb_mutex_t &mutex_) : mutex (mutex_) { mutex.lock (); }
~hb_lock_t (void) { mutex.unlock (); } ~hb_lock_t () { mutex.unlock (); }
private: private:
hb_mutex_t &mutex; hb_mutex_t &mutex;
}; };

View File

@ -83,7 +83,7 @@ hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_
/* Generic nul-content Null objects. */ /* Generic nul-content Null objects. */
template <typename Type> template <typename Type>
static inline Type const & Null (void) { static inline Type const & Null () {
static_assert (hb_null_size (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE."); static_assert (hb_null_size (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
return *reinterpret_cast<Type const *> (_hb_NullPool); return *reinterpret_cast<Type const *> (_hb_NullPool);
} }
@ -91,7 +91,7 @@ template <typename QType>
struct NullHelper struct NullHelper
{ {
typedef typename hb_remove_const (typename hb_remove_reference (QType)) Type; typedef typename hb_remove_const (typename hb_remove_reference (QType)) Type;
static const Type & get_null (void) { return Null<Type> (); } static const Type & get_null () { return Null<Type> (); }
}; };
#define Null(Type) NullHelper<Type>::get_null () #define Null(Type) NullHelper<Type>::get_null ()
@ -100,7 +100,7 @@ struct NullHelper
} /* Close namespace. */ \ } /* Close namespace. */ \
extern HB_INTERNAL const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::null_size]; \ extern HB_INTERNAL const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::null_size]; \
template <> \ template <> \
/*static*/ inline const Namespace::Type& Null<Namespace::Type> (void) { \ /*static*/ inline const Namespace::Type& Null<Namespace::Type> () { \
return *reinterpret_cast<const Namespace::Type *> (_hb_Null_##Namespace##_##Type); \ return *reinterpret_cast<const Namespace::Type *> (_hb_Null_##Namespace##_##Type); \
} \ } \
namespace Namespace { \ namespace Namespace { \
@ -112,7 +112,7 @@ struct NullHelper
#define DECLARE_NULL_INSTANCE(Type) \ #define DECLARE_NULL_INSTANCE(Type) \
extern HB_INTERNAL const Type _hb_Null_##Type; \ extern HB_INTERNAL const Type _hb_Null_##Type; \
template <> \ template <> \
/*static*/ inline const Type& Null<Type> (void) { \ /*static*/ inline const Type& Null<Type> () { \
return _hb_Null_##Type; \ return _hb_Null_##Type; \
} \ } \
static_assert (true, "Just so we take semicolon after.") static_assert (true, "Just so we take semicolon after.")
@ -130,7 +130,7 @@ extern HB_INTERNAL
/* CRAP pool: Common Region for Access Protection. */ /* CRAP pool: Common Region for Access Protection. */
template <typename Type> template <typename Type>
static inline Type& Crap (void) { static inline Type& Crap () {
static_assert (hb_null_size (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE."); static_assert (hb_null_size (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
Type *obj = reinterpret_cast<Type *> (_hb_CrapPool); Type *obj = reinterpret_cast<Type *> (_hb_CrapPool);
memcpy (obj, &Null(Type), sizeof (*obj)); memcpy (obj, &Null(Type), sizeof (*obj));
@ -140,17 +140,17 @@ template <typename QType>
struct CrapHelper struct CrapHelper
{ {
typedef typename hb_remove_const (typename hb_remove_reference (QType)) Type; typedef typename hb_remove_const (typename hb_remove_reference (QType)) Type;
static Type & get_crap (void) { return Crap<Type> (); } static Type & get_crap () { return Crap<Type> (); }
}; };
#define Crap(Type) CrapHelper<Type>::get_crap () #define Crap(Type) CrapHelper<Type>::get_crap ()
template <typename Type> template <typename Type>
struct CrapOrNullHelper { struct CrapOrNullHelper {
static Type & get (void) { return Crap(Type); } static Type & get () { return Crap(Type); }
}; };
template <typename Type> template <typename Type>
struct CrapOrNullHelper<const Type> { struct CrapOrNullHelper<const Type> {
static const Type & get (void) { return Null(Type); } static const Type & get () { return Null(Type); }
}; };
#define CrapOrNull(Type) CrapOrNullHelper<Type>::get () #define CrapOrNull(Type) CrapOrNullHelper<Type>::get ()
@ -166,14 +166,14 @@ struct hb_nonnull_ptr_t
hb_nonnull_ptr_t (T *v_ = nullptr) : v (v_) {} hb_nonnull_ptr_t (T *v_ = nullptr) : v (v_) {}
T * operator = (T *v_) { return v = v_; } T * operator = (T *v_) { return v = v_; }
T * operator -> (void) const { return get (); } T * operator -> () const { return get (); }
T & operator * (void) const { return *get (); } T & operator * () const { return *get (); }
T ** operator & (void) const { return &v; } T ** operator & () const { return &v; }
/* Only auto-cast to const types. */ /* Only auto-cast to const types. */
template <typename C> operator const C * (void) const { return get (); } template <typename C> operator const C * () const { return get (); }
operator const char * (void) const { return (const char *) get (); } operator const char * () const { return (const char *) get (); }
T * get (void) const { return v ? v : const_cast<T *> (&Null(T)); } T * get () const { return v ? v : const_cast<T *> (&Null(T)); }
T * get_raw (void) const { return v; } T * get_raw () const { return v; }
T *v; T *v;
}; };

View File

@ -47,7 +47,7 @@ struct hb_lockable_set_t
{ {
hb_vector_t <item_t, 1> items; hb_vector_t <item_t, 1> items;
void init (void) { items.init (); } void init () { items.init (); }
template <typename T> template <typename T>
item_t *replace_or_insert (T v, lock_t &l, bool replace) item_t *replace_or_insert (T v, lock_t &l, bool replace)
@ -146,13 +146,13 @@ struct hb_reference_count_t
mutable hb_atomic_int_t ref_count; mutable hb_atomic_int_t ref_count;
void init (int v = 1) { ref_count.set_relaxed (v); } void init (int v = 1) { ref_count.set_relaxed (v); }
int get_relaxed (void) const { return ref_count.get_relaxed (); } int get_relaxed () const { return ref_count.get_relaxed (); }
int inc (void) const { return ref_count.inc (); } int inc () const { return ref_count.inc (); }
int dec (void) const { return ref_count.dec (); } int dec () const { return ref_count.dec (); }
void fini (void) { ref_count.set_relaxed (HB_REFERENCE_COUNT_POISON_VALUE); } void fini () { ref_count.set_relaxed (HB_REFERENCE_COUNT_POISON_VALUE); }
bool is_inert (void) const { return ref_count.get_relaxed () == HB_REFERENCE_COUNT_INERT_VALUE; } bool is_inert () const { return ref_count.get_relaxed () == HB_REFERENCE_COUNT_INERT_VALUE; }
bool is_valid (void) const { return ref_count.get_relaxed () > 0; } bool is_valid () const { return ref_count.get_relaxed () > 0; }
}; };
@ -168,13 +168,13 @@ struct hb_user_data_array_t
bool operator == (hb_user_data_key_t *other_key) const { return key == other_key; } bool operator == (hb_user_data_key_t *other_key) const { return key == other_key; }
bool operator == (hb_user_data_item_t &other) const { return key == other.key; } bool operator == (hb_user_data_item_t &other) const { return key == other.key; }
void fini (void) { if (destroy) destroy (data); } void fini () { if (destroy) destroy (data); }
}; };
hb_mutex_t lock; hb_mutex_t lock;
hb_lockable_set_t<hb_user_data_item_t, hb_mutex_t> items; hb_lockable_set_t<hb_user_data_item_t, hb_mutex_t> items;
void init (void) { lock.init (); items.init (); } void init () { lock.init (); items.init (); }
HB_INTERNAL bool set (hb_user_data_key_t *key, HB_INTERNAL bool set (hb_user_data_key_t *key,
void * data, void * data,
@ -183,7 +183,7 @@ struct hb_user_data_array_t
HB_INTERNAL void *get (hb_user_data_key_t *key); HB_INTERNAL void *get (hb_user_data_key_t *key);
void fini (void) { items.fini (lock); lock.fini (); } void fini () { items.fini (lock); lock.fini (); }
}; };
@ -219,7 +219,7 @@ static inline void hb_object_trace (const Type *obj, const char *function)
} }
template <typename Type> template <typename Type>
static inline Type *hb_object_create (void) static inline Type *hb_object_create ()
{ {
Type *obj = (Type *) calloc (1, sizeof (Type)); Type *obj = (Type *) calloc (1, sizeof (Type));

View File

@ -54,8 +54,7 @@ struct TTCHeader;
typedef struct TableRecord typedef struct TableRecord
{ {
int cmp (Tag t) const int cmp (Tag t) const { return -t.cmp (tag); }
{ return -t.cmp (tag); }
static int cmp (const void *pa, const void *pb) static int cmp (const void *pa, const void *pb)
{ {
@ -83,12 +82,9 @@ typedef struct OffsetTable
{ {
friend struct OpenTypeFontFile; friend struct OpenTypeFontFile;
unsigned int get_table_count (void) const unsigned int get_table_count () const { return tables.len; }
{ return tables.len; }
const TableRecord& get_table (unsigned int i) const const TableRecord& get_table (unsigned int i) const
{ { return tables[i]; }
return tables[i];
}
unsigned int get_table_tags (unsigned int start_offset, unsigned int get_table_tags (unsigned int start_offset,
unsigned int *table_count, /* IN/OUT */ unsigned int *table_count, /* IN/OUT */
hb_tag_t *table_tags /* OUT */) const hb_tag_t *table_tags /* OUT */) const
@ -214,7 +210,7 @@ struct TTCHeaderVersion1
{ {
friend struct TTCHeader; friend struct TTCHeader;
unsigned int get_face_count (void) const { return table.len; } unsigned int get_face_count () const { return table.len; }
const OpenTypeFontFace& get_face (unsigned int i) const { return this+table[i]; } const OpenTypeFontFace& get_face (unsigned int i) const { return this+table[i]; }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
@ -240,7 +236,7 @@ struct TTCHeader
private: private:
unsigned int get_face_count (void) const unsigned int get_face_count () const
{ {
switch (u.header.version.major) { switch (u.header.version.major) {
case 2: /* version 2 is compatible with version 1 */ case 2: /* version 2 is compatible with version 1 */
@ -316,16 +312,14 @@ struct ResourceRecord
struct ResourceTypeRecord struct ResourceTypeRecord
{ {
unsigned int get_resource_count (void) const unsigned int get_resource_count () const
{ return tag == HB_TAG_sfnt ? resCountM1 + 1 : 0; } { return tag == HB_TAG_sfnt ? resCountM1 + 1 : 0; }
bool is_sfnt (void) const { return tag == HB_TAG_sfnt; } bool is_sfnt () const { return tag == HB_TAG_sfnt; }
const ResourceRecord& get_resource_record (unsigned int i, const ResourceRecord& get_resource_record (unsigned int i,
const void *type_base) const const void *type_base) const
{ { return (type_base+resourcesZ).as_array (get_resource_count ())[i]; }
return (type_base+resourcesZ).as_array (get_resource_count ())[i];
}
bool sanitize (hb_sanitize_context_t *c, bool sanitize (hb_sanitize_context_t *c,
const void *type_base, const void *type_base,
@ -350,7 +344,7 @@ struct ResourceTypeRecord
struct ResourceMap struct ResourceMap
{ {
unsigned int get_face_count (void) const unsigned int get_face_count () const
{ {
unsigned int count = get_type_count (); unsigned int count = get_type_count ();
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
@ -387,7 +381,7 @@ struct ResourceMap
} }
private: private:
unsigned int get_type_count (void) const { return (this+typeList).lenM1 + 1; } unsigned int get_type_count () const { return (this+typeList).lenM1 + 1; }
const ResourceTypeRecord& get_type_record (unsigned int i) const const ResourceTypeRecord& get_type_record (unsigned int i) const
{ return (this+typeList)[i]; } { return (this+typeList)[i]; }
@ -408,7 +402,7 @@ struct ResourceMap
struct ResourceForkHeader struct ResourceForkHeader
{ {
unsigned int get_face_count (void) const unsigned int get_face_count () const
{ return (this+map).get_face_count (); } { return (this+map).get_face_count (); }
const OpenTypeFontFace& get_face (unsigned int idx, const OpenTypeFontFace& get_face (unsigned int idx,
@ -456,9 +450,9 @@ struct OpenTypeFontFile
Typ1Tag = HB_TAG ('t','y','p','1') /* Obsolete Apple Type1 font in SFNT container */ Typ1Tag = HB_TAG ('t','y','p','1') /* Obsolete Apple Type1 font in SFNT container */
}; };
hb_tag_t get_tag (void) const { return u.tag; } hb_tag_t get_tag () const { return u.tag; }
unsigned int get_face_count (void) const unsigned int get_face_count () const
{ {
switch (u.tag) { switch (u.tag) {
case CFFTag: /* All the non-collection tags */ case CFFTag: /* All the non-collection tags */

View File

@ -64,7 +64,7 @@ struct IntType
typedef typename hb_signedness_int<hb_is_signed<Type>::value>::value wide_type; typedef typename hb_signedness_int<hb_is_signed<Type>::value>::value wide_type;
void set (wide_type i) { v.set (i); } void set (wide_type i) { v.set (i); }
operator wide_type (void) const { return v; } operator wide_type () const { return v; }
bool operator == (const IntType<Type,Size> &o) const { return (Type) v == (Type) o.v; } bool operator == (const IntType<Type,Size> &o) const { return (Type) v == (Type) o.v; }
bool operator != (const IntType<Type,Size> &o) const { return !(*this == o); } bool operator != (const IntType<Type,Size> &o) const { return !(*this == o); }
static int cmp (const IntType<Type,Size> *a, const IntType<Type,Size> *b) { return b->cmp (*a); } static int cmp (const IntType<Type,Size> *a, const IntType<Type,Size> *b) { return b->cmp (*a); }
@ -111,7 +111,7 @@ typedef HBUINT16 UFWORD;
struct F2DOT14 : HBINT16 struct F2DOT14 : HBINT16
{ {
// 16384 means 1<<14 // 16384 means 1<<14
float to_float (void) const { return ((int32_t) v) / 16384.f; } float to_float () const { return ((int32_t) v) / 16384.f; }
void set_float (float f) { v.set (round (f * 16384.f)); } void set_float (float f) { v.set (round (f * 16384.f)); }
public: public:
DEFINE_SIZE_STATIC (2); DEFINE_SIZE_STATIC (2);
@ -121,7 +121,7 @@ struct F2DOT14 : HBINT16
struct Fixed : HBINT32 struct Fixed : HBINT32
{ {
// 65536 means 1<<16 // 65536 means 1<<16
float to_float (void) const { return ((int32_t) v) / 65536.f; } float to_float () const { return ((int32_t) v) / 65536.f; }
void set_float (float f) { v.set (round (f * 65536.f)); } void set_float (float f) { v.set (round (f * 65536.f)); }
public: public:
DEFINE_SIZE_STATIC (4); DEFINE_SIZE_STATIC (4);
@ -148,8 +148,8 @@ struct LONGDATETIME
struct Tag : HBUINT32 struct Tag : HBUINT32
{ {
/* What the char* converters return is NOT nul-terminated. Print using "%.4s" */ /* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
operator const char* (void) const { return reinterpret_cast<const char *> (&this->v); } operator const char* () const { return reinterpret_cast<const char *> (&this->v); }
operator char* (void) { return reinterpret_cast<char *> (&this->v); } operator char* () { return reinterpret_cast<char *> (&this->v); }
public: public:
DEFINE_SIZE_STATIC (4); DEFINE_SIZE_STATIC (4);
}; };
@ -171,7 +171,7 @@ struct Offset : Type
{ {
typedef Type type; typedef Type type;
bool is_null (void) const { return has_null && 0 == *this; } bool is_null () const { return has_null && 0 == *this; }
void *serialize (hb_serialize_context_t *c, const void *base) void *serialize (hb_serialize_context_t *c, const void *base)
{ {
@ -219,7 +219,7 @@ struct CheckSum : HBUINT32
template <typename FixedType=HBUINT16> template <typename FixedType=HBUINT16>
struct FixedVersion struct FixedVersion
{ {
uint32_t to_int (void) const { return (major << (sizeof (FixedType) * 8)) + minor; } uint32_t to_int () const { return (major << (sizeof (FixedType) * 8)) + minor; }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {
@ -242,14 +242,14 @@ struct FixedVersion
template <typename Type, bool has_null> template <typename Type, bool has_null>
struct _hb_has_null struct _hb_has_null
{ {
static const Type *get_null (void) { return nullptr; } static const Type *get_null () { return nullptr; }
static Type *get_crap (void) { return nullptr; } static Type *get_crap () { return nullptr; }
}; };
template <typename Type> template <typename Type>
struct _hb_has_null<Type, true> struct _hb_has_null<Type, true>
{ {
static const Type *get_null (void) { return &Null(Type); } static const Type *get_null () { return &Null(Type); }
static Type *get_crap (void) { return &Crap(Type); } static Type *get_crap () { return &Crap(Type); }
}; };
template <typename Type, typename OffsetType=HBUINT16, bool has_null=true> template <typename Type, typename OffsetType=HBUINT16, bool has_null=true>
@ -375,14 +375,14 @@ struct UnsizedArrayOf
unsigned int get_size (unsigned int len) const unsigned int get_size (unsigned int len) const
{ return len * Type::static_size; } { return len * Type::static_size; }
template <typename T> operator T * (void) { return arrayZ; } template <typename T> operator T * () { return arrayZ; }
template <typename T> operator const T * (void) const { return arrayZ; } template <typename T> operator const T * () const { return arrayZ; }
hb_array_t<Type> as_array (unsigned int len) hb_array_t<Type> as_array (unsigned int len)
{ return hb_array (arrayZ, len); } { return hb_array (arrayZ, len); }
hb_array_t<const Type> as_array (unsigned int len) const hb_array_t<const Type> as_array (unsigned int len) const
{ return hb_array (arrayZ, len); } { return hb_array (arrayZ, len); }
operator hb_array_t<Type> (void) { return as_array (); } operator hb_array_t<Type> () { return as_array (); }
operator hb_array_t<const Type> (void) const { return as_array (); } operator hb_array_t<const Type> () const { return as_array (); }
template <typename T> template <typename T>
Type &lsearch (unsigned int len, const T &x, Type &not_found = Crap (Type)) Type &lsearch (unsigned int len, const T &x, Type &not_found = Crap (Type))
@ -487,8 +487,8 @@ struct SortedUnsizedArrayOf : UnsizedArrayOf<Type>
{ return hb_sorted_array (this->arrayZ, len); } { return hb_sorted_array (this->arrayZ, len); }
hb_sorted_array_t<const Type> as_array (unsigned int len) const hb_sorted_array_t<const Type> as_array (unsigned int len) const
{ return hb_sorted_array (this->arrayZ, len); } { return hb_sorted_array (this->arrayZ, len); }
operator hb_sorted_array_t<Type> (void) { return as_array (); } operator hb_sorted_array_t<Type> () { return as_array (); }
operator hb_sorted_array_t<const Type> (void) const { return as_array (); } operator hb_sorted_array_t<const Type> () const { return as_array (); }
template <typename T> template <typename T>
Type &bsearch (unsigned int len, const T &x, Type &not_found = Crap (Type)) Type &bsearch (unsigned int len, const T &x, Type &not_found = Crap (Type))
@ -526,12 +526,12 @@ struct ArrayOf
return arrayZ[i]; return arrayZ[i];
} }
unsigned int get_size (void) const unsigned int get_size () const
{ return len.static_size + len * Type::static_size; } { return len.static_size + len * Type::static_size; }
hb_array_t<Type> as_array (void) hb_array_t<Type> as_array ()
{ return hb_array (arrayZ, len); } { return hb_array (arrayZ, len); }
hb_array_t<const Type> as_array (void) const hb_array_t<const Type> as_array () const
{ return hb_array (arrayZ, len); } { return hb_array (arrayZ, len); }
operator hb_array_t<Type> (void) { return as_array (); } operator hb_array_t<Type> (void) { return as_array (); }
operator hb_array_t<const Type> (void) const { return as_array (); } operator hb_array_t<const Type> (void) const { return as_array (); }
@ -697,7 +697,7 @@ struct HeadlessArrayOf
if (unlikely (i >= lenP1 || !i)) return Crap (Type); if (unlikely (i >= lenP1 || !i)) return Crap (Type);
return arrayZ[i-1]; return arrayZ[i-1];
} }
unsigned int get_size (void) const unsigned int get_size () const
{ return lenP1.static_size + (lenP1 ? lenP1 - 1 : 0) * Type::static_size; } { return lenP1.static_size + (lenP1 ? lenP1 - 1 : 0) * Type::static_size; }
bool serialize (hb_serialize_context_t *c, bool serialize (hb_serialize_context_t *c,
@ -765,7 +765,7 @@ struct ArrayOfM1
if (unlikely (i > lenM1)) return Crap (Type); if (unlikely (i > lenM1)) return Crap (Type);
return arrayZ[i]; return arrayZ[i];
} }
unsigned int get_size (void) const unsigned int get_size () const
{ return lenM1.static_size + (lenM1 + 1) * Type::static_size; } { return lenM1.static_size + (lenM1 + 1) * Type::static_size; }
template <typename T> template <typename T>
@ -799,12 +799,12 @@ struct ArrayOfM1
template <typename Type, typename LenType=HBUINT16> template <typename Type, typename LenType=HBUINT16>
struct SortedArrayOf : ArrayOf<Type, LenType> struct SortedArrayOf : ArrayOf<Type, LenType>
{ {
hb_sorted_array_t<Type> as_array (void) hb_sorted_array_t<Type> as_array ()
{ return hb_sorted_array (this->arrayZ, this->len); } { return hb_sorted_array (this->arrayZ, this->len); }
hb_sorted_array_t<const Type> as_array (void) const hb_sorted_array_t<const Type> as_array () const
{ return hb_sorted_array (this->arrayZ, this->len); } { return hb_sorted_array (this->arrayZ, this->len); }
operator hb_sorted_array_t<Type> (void) { return as_array (); } operator hb_sorted_array_t<Type> () { return as_array (); }
operator hb_sorted_array_t<const Type> (void) const { return as_array (); } operator hb_sorted_array_t<const Type> () const { return as_array (); }
hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const hb_array_t<const Type> sub_array (unsigned int start_offset, unsigned int count) const
{ return as_array ().sub_array (start_offset, count);} { return as_array ().sub_array (start_offset, count);}
@ -835,7 +835,7 @@ struct SortedArrayOf : ArrayOf<Type, LenType>
template <typename LenType=HBUINT16> template <typename LenType=HBUINT16>
struct BinSearchHeader struct BinSearchHeader
{ {
operator uint32_t (void) const { return len; } operator uint32_t () const { return len; }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {
@ -897,7 +897,7 @@ struct VarSizedBinSearchArrayOf
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (VarSizedBinSearchArrayOf, Type); HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (VarSizedBinSearchArrayOf, Type);
bool last_is_terminator (void) const bool last_is_terminator () const
{ {
if (unlikely (!header.nUnits)) return false; if (unlikely (!header.nUnits)) return false;
@ -925,11 +925,9 @@ struct VarSizedBinSearchArrayOf
if (unlikely (i >= get_length ())) return Crap (Type); if (unlikely (i >= get_length ())) return Crap (Type);
return StructAtOffset<Type> (&bytesZ, i * header.unitSize); return StructAtOffset<Type> (&bytesZ, i * header.unitSize);
} }
unsigned int get_length (void) const unsigned int get_length () const
{ { return header.nUnits - last_is_terminator (); }
return header.nUnits - last_is_terminator (); unsigned int get_size () const
}
unsigned int get_size (void) const
{ return header.static_size + header.nUnits * header.unitSize; } { return header.static_size + header.nUnits * header.unitSize; }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const

View File

@ -64,9 +64,9 @@ struct code_pair
typedef hb_vector_t<char, 1> StrBuff; typedef hb_vector_t<char, 1> StrBuff;
struct StrBuffArray : hb_vector_t<StrBuff> struct StrBuffArray : hb_vector_t<StrBuff>
{ {
void fini (void) { SUPER::fini_deep (); } void fini () { SUPER::fini_deep (); }
unsigned int total_size (void) const unsigned int total_size () const
{ {
unsigned int size = 0; unsigned int size = 0;
for (unsigned int i = 0; i < len; i++) for (unsigned int i = 0; i < len; i++)
@ -94,7 +94,7 @@ struct CFFIndex
static unsigned int calculate_offset_array_size (unsigned int offSize, unsigned int count) static unsigned int calculate_offset_array_size (unsigned int offSize, unsigned int count)
{ return offSize * (count + 1); } { return offSize * (count + 1); }
unsigned int offset_array_size (void) const unsigned int offset_array_size () const
{ return calculate_offset_array_size (offSize, count); } { return calculate_offset_array_size (offSize, count); }
static unsigned int calculate_serialized_size (unsigned int offSize, unsigned int count, unsigned int dataSize) static unsigned int calculate_serialized_size (unsigned int offSize, unsigned int count, unsigned int dataSize)
@ -205,11 +205,10 @@ struct CFFIndex
return 0; return 0;
} }
const char *data_base (void) const const char *data_base () const
{ return (const char *)this + min_size + offset_array_size (); } { return (const char *)this + min_size + offset_array_size (); }
unsigned int data_size (void) const unsigned int data_size () const { return HBINT8::static_size; }
{ return HBINT8::static_size; }
ByteStr operator [] (unsigned int index) const ByteStr operator [] (unsigned int index) const
{ {
@ -219,7 +218,7 @@ struct CFFIndex
return Null(ByteStr); return Null(ByteStr);
} }
unsigned int get_size (void) const unsigned int get_size () const
{ {
if (this != &Null(CFFIndex)) if (this != &Null(CFFIndex))
{ {
@ -233,7 +232,7 @@ struct CFFIndex
} }
protected: protected:
unsigned int max_offset (void) const unsigned int max_offset () const
{ {
unsigned int max = 0; unsigned int max = 0;
for (unsigned int i = 0; i < count + 1u; i++) for (unsigned int i = 0; i < count + 1u; i++)
@ -407,7 +406,7 @@ struct PrivateDict : Dict {};
struct TableInfo struct TableInfo
{ {
void init (void) { offSize = offset = size = 0; } void init () { offSize = offset = size = 0; }
unsigned int offset; unsigned int offset;
unsigned int size; unsigned int size;
@ -418,9 +417,9 @@ struct TableInfo
* set to CFF_UNDEF_CODE if excluded from subset */ * set to CFF_UNDEF_CODE if excluded from subset */
struct Remap : hb_vector_t<hb_codepoint_t> struct Remap : hb_vector_t<hb_codepoint_t>
{ {
void init (void) { SUPER::init (); } void init () { SUPER::init (); }
void fini (void) { SUPER::fini (); } void fini () { SUPER::fini (); }
bool reset (unsigned int size) bool reset (unsigned int size)
{ {
@ -456,8 +455,7 @@ struct Remap : hb_vector_t<hb_codepoint_t>
return (*this)[i]; return (*this)[i];
} }
hb_codepoint_t get_count (void) const hb_codepoint_t get_count () const { return count; }
{ return count; }
protected: protected:
hb_codepoint_t count; hb_codepoint_t count;
@ -603,7 +601,7 @@ struct FDSelect3_4_Range {
template <typename GID_TYPE, typename FD_TYPE> template <typename GID_TYPE, typename FD_TYPE>
struct FDSelect3_4 { struct FDSelect3_4 {
unsigned int get_size (void) const unsigned int get_size () const
{ return GID_TYPE::static_size * 2 + FDSelect3_4_Range<GID_TYPE, FD_TYPE>::static_size * nRanges; } { return GID_TYPE::static_size * 2 + FDSelect3_4_Range<GID_TYPE, FD_TYPE>::static_size * nRanges; }
bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
@ -635,8 +633,8 @@ struct FDSelect3_4 {
return (hb_codepoint_t)ranges[i - 1].fd; return (hb_codepoint_t)ranges[i - 1].fd;
} }
GID_TYPE &sentinel (void) { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); } GID_TYPE &sentinel () { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
const GID_TYPE &sentinel (void) const { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); } const GID_TYPE &sentinel () const { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
GID_TYPE nRanges; GID_TYPE nRanges;
FDSelect3_4_Range<GID_TYPE, FD_TYPE> ranges[VAR]; FDSelect3_4_Range<GID_TYPE, FD_TYPE> ranges[VAR];

View File

@ -163,7 +163,7 @@ hb_codepoint_t OT::cff1::lookup_standard_encoding_for_sid (hb_codepoint_t code)
struct Bounds struct Bounds
{ {
void init (void) void init ()
{ {
min.set_int (0x7FFFFFFF, 0x7FFFFFFF); min.set_int (0x7FFFFFFF, 0x7FFFFFFF);
max.set_int (-0x80000000, -0x80000000); max.set_int (-0x80000000, -0x80000000);
@ -199,10 +199,8 @@ struct Bounds
} }
} }
bool empty (void) const bool empty () const
{ { return (min.x >= max.x) || (min.y >= max.y); }
return (min.x >= max.x) || (min.y >= max.y);
}
Point min; Point min;
Point max; Point max;
@ -217,9 +215,9 @@ struct ExtentsParam
bounds.init (); bounds.init ();
} }
void start_path (void) { path_open = true; } void start_path () { path_open = true; }
void end_path (void) { path_open = false; } void end_path () { path_open = false; }
bool is_path_open (void) const { return path_open; } bool is_path_open () const { return path_open; }
bool path_open; bool path_open;
Bounds bounds; Bounds bounds;
@ -345,8 +343,7 @@ struct GetSeacParam
accent = 0; accent = 0;
} }
bool has_seac (void) const bool has_seac () const { return base && accent; }
{ return base && accent; }
const OT::cff1::accelerator_t *cff; const OT::cff1::accelerator_t *cff;
hb_codepoint_t base; hb_codepoint_t base;

View File

@ -74,7 +74,7 @@ struct Encoding0 {
return CFF_UNDEF_CODE; return CFF_UNDEF_CODE;
} }
unsigned int get_size (void) const unsigned int get_size () const
{ return HBUINT8::static_size * (nCodes + 1); } { return HBUINT8::static_size * (nCodes + 1); }
HBUINT8 nCodes; HBUINT8 nCodes;
@ -97,7 +97,7 @@ struct Encoding1_Range {
}; };
struct Encoding1 { struct Encoding1 {
unsigned int get_size (void) const unsigned int get_size () const
{ return HBUINT8::static_size + Encoding1_Range::static_size * nRanges; } { return HBUINT8::static_size + Encoding1_Range::static_size * nRanges; }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
@ -154,7 +154,7 @@ struct CFF1SuppEncData {
codes.push (supps[i].code); codes.push (supps[i].code);
} }
unsigned int get_size (void) const unsigned int get_size () const
{ return HBUINT8::static_size + SuppEncoding::static_size * nSups; } { return HBUINT8::static_size + SuppEncoding::static_size * nSups; }
HBUINT8 nSups; HBUINT8 nSups;
@ -257,7 +257,7 @@ struct Encoding {
return size; return size;
} }
unsigned int get_size (void) const unsigned int get_size () const
{ {
unsigned int size = min_size; unsigned int size = min_size;
if (table_format () == 0) if (table_format () == 0)
@ -277,8 +277,8 @@ struct Encoding {
return u.format1.get_code (glyph); return u.format1.get_code (glyph);
} }
uint8_t table_format (void) const { return (format & 0x7F); } uint8_t table_format () const { return (format & 0x7F); }
bool has_supplement (void) const { return (format & 0x80) != 0; } bool has_supplement () const { return (format & 0x80) != 0; }
void get_supplement_codes (hb_codepoint_t sid, hb_vector_t<hb_codepoint_t> &codes) const void get_supplement_codes (hb_codepoint_t sid, hb_vector_t<hb_codepoint_t> &codes) const
{ {
@ -288,7 +288,7 @@ struct Encoding {
} }
protected: protected:
const CFF1SuppEncData &suppEncData (void) const const CFF1SuppEncData &suppEncData () const
{ {
if ((format & 0x7F) == 0) if ((format & 0x7F) == 0)
return StructAfter<CFF1SuppEncData> (u.format0.codes[u.format0.nCodes-1]); return StructAfter<CFF1SuppEncData> (u.format0.codes[u.format0.nCodes-1]);
@ -619,7 +619,7 @@ struct CFF1StringIndex : CFF1Index
struct CFF1TopDictInterpEnv : NumInterpEnv struct CFF1TopDictInterpEnv : NumInterpEnv
{ {
CFF1TopDictInterpEnv (void) CFF1TopDictInterpEnv ()
: NumInterpEnv(), prev_offset(0), last_offset(0) {} : NumInterpEnv(), prev_offset(0), last_offset(0) {}
unsigned int prev_offset; unsigned int prev_offset;
@ -645,7 +645,7 @@ struct NameDictValues
ValCount ValCount
}; };
void init (void) void init ()
{ {
for (unsigned int i = 0; i < ValCount; i++) for (unsigned int i = 0; i < ValCount; i++)
values[i] = CFF_UNDEF_SID; values[i] = CFF_UNDEF_SID;
@ -692,7 +692,7 @@ struct CFF1TopDictVal : OpStr
struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal> struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
{ {
void init (void) void init ()
{ {
TopDictValues<CFF1TopDictVal>::init (); TopDictValues<CFF1TopDictVal>::init ();
@ -704,9 +704,9 @@ struct CFF1TopDictValues : TopDictValues<CFF1TopDictVal>
FDSelectOffset = 0; FDSelectOffset = 0;
privateDictInfo.init (); privateDictInfo.init ();
} }
void fini (void) { TopDictValues<CFF1TopDictVal>::fini (); } void fini () { TopDictValues<CFF1TopDictVal>::fini (); }
bool is_CID (void) const bool is_CID () const
{ return nameSIDs[NameDictValues::registry] != CFF_UNDEF_SID; } { return nameSIDs[NameDictValues::registry] != CFF_UNDEF_SID; }
NameDictValues nameSIDs; NameDictValues nameSIDs;
@ -809,17 +809,13 @@ struct CFF1TopDictOpSet : TopDictOpSet<CFF1TopDictVal>
struct CFF1FontDictValues : DictValues<OpStr> struct CFF1FontDictValues : DictValues<OpStr>
{ {
void init (void) void init ()
{ {
DictValues<OpStr>::init (); DictValues<OpStr>::init ();
privateDictInfo.init (); privateDictInfo.init ();
fontName = CFF_UNDEF_SID; fontName = CFF_UNDEF_SID;
} }
void fini () { DictValues<OpStr>::fini (); }
void fini (void)
{
DictValues<OpStr>::fini ();
}
TableInfo privateDictInfo; TableInfo privateDictInfo;
unsigned int fontName; unsigned int fontName;
@ -859,19 +855,15 @@ struct CFF1FontDictOpSet : DictOpSet
template <typename VAL> template <typename VAL>
struct CFF1PrivateDictValues_Base : DictValues<VAL> struct CFF1PrivateDictValues_Base : DictValues<VAL>
{ {
void init (void) void init ()
{ {
DictValues<VAL>::init (); DictValues<VAL>::init ();
subrsOffset = 0; subrsOffset = 0;
localSubrs = &Null(CFF1Subrs); localSubrs = &Null(CFF1Subrs);
} }
void fini () { DictValues<VAL>::fini (); }
void fini (void) unsigned int calculate_serialized_size () const
{
DictValues<VAL>::fini ();
}
unsigned int calculate_serialized_size (void) const
{ {
unsigned int size = 0; unsigned int size = 0;
for (unsigned int i = 0; i < DictValues<VAL>::get_count; i++) for (unsigned int i = 0; i < DictValues<VAL>::get_count; i++)
@ -1132,7 +1124,7 @@ struct cff1
} }
} }
void fini (void) void fini ()
{ {
sc.end_processing (); sc.end_processing ();
topDict.fini (); topDict.fini ();
@ -1142,10 +1134,10 @@ struct cff1
blob = nullptr; blob = nullptr;
} }
bool is_valid (void) const { return blob != nullptr; } bool is_valid () const { return blob != nullptr; }
bool is_CID (void) const { return topDict.is_CID (); } bool is_CID () const { return topDict.is_CID (); }
bool is_predef_charset (void) const { return topDict.CharsetOffset <= ExpertSubsetCharset; } bool is_predef_charset () const { return topDict.CharsetOffset <= ExpertSubsetCharset; }
unsigned int std_code_to_glyph (hb_codepoint_t code) const unsigned int std_code_to_glyph (hb_codepoint_t code) const
{ {
@ -1211,7 +1203,7 @@ struct cff1
} }
} }
bool is_predef_encoding (void) const { return topDict.EncodingOffset <= ExpertEncoding; } bool is_predef_encoding () const { return topDict.EncodingOffset <= ExpertEncoding; }
hb_codepoint_t glyph_to_code (hb_codepoint_t glyph) const hb_codepoint_t glyph_to_code (hb_codepoint_t glyph) const
{ {

View File

@ -31,7 +31,7 @@ using namespace CFF;
struct ExtentsParam struct ExtentsParam
{ {
void init (void) void init ()
{ {
path_open = false; path_open = false;
min_x.set_int (0x7FFFFFFF); min_x.set_int (0x7FFFFFFF);
@ -40,9 +40,9 @@ struct ExtentsParam
max_y.set_int (-0x80000000); max_y.set_int (-0x80000000);
} }
void start_path (void) { path_open = true; } void start_path () { path_open = true; }
void end_path (void) { path_open = false; } void end_path () { path_open = false; }
bool is_path_open (void) const { return path_open; } bool is_path_open () const { return path_open; }
void update_bounds (const Point &pt) void update_bounds (const Point &pt)
{ {

View File

@ -128,7 +128,7 @@ struct CFF2VariationStore
return_trace (true); return_trace (true);
} }
unsigned int get_size (void) const { return HBUINT16::static_size + size; } unsigned int get_size () const { return HBUINT16::static_size + size; }
HBUINT16 size; HBUINT16 size;
VariationStore varStore; VariationStore varStore;
@ -138,15 +138,15 @@ struct CFF2VariationStore
struct CFF2TopDictValues : TopDictValues<> struct CFF2TopDictValues : TopDictValues<>
{ {
void init (void) void init ()
{ {
TopDictValues<>::init (); TopDictValues<>::init ();
vstoreOffset = 0; vstoreOffset = 0;
FDSelectOffset = 0; FDSelectOffset = 0;
} }
void fini (void) { TopDictValues<>::fini (); } void fini () { TopDictValues<>::fini (); }
unsigned int calculate_serialized_size (void) const unsigned int calculate_serialized_size () const
{ {
unsigned int size = 0; unsigned int size = 0;
for (unsigned int i = 0; i < get_count (); i++) for (unsigned int i = 0; i < get_count (); i++)
@ -209,16 +209,12 @@ struct CFF2TopDictOpSet : TopDictOpSet<>
struct CFF2FontDictValues : DictValues<OpStr> struct CFF2FontDictValues : DictValues<OpStr>
{ {
void init (void) void init ()
{ {
DictValues<OpStr>::init (); DictValues<OpStr>::init ();
privateDictInfo.init (); privateDictInfo.init ();
} }
void fini () { DictValues<OpStr>::fini (); }
void fini (void)
{
DictValues<OpStr>::fini ();
}
TableInfo privateDictInfo; TableInfo privateDictInfo;
}; };
@ -252,20 +248,16 @@ struct CFF2FontDictOpSet : DictOpSet
template <typename VAL> template <typename VAL>
struct CFF2PrivateDictValues_Base : DictValues<VAL> struct CFF2PrivateDictValues_Base : DictValues<VAL>
{ {
void init (void) void init ()
{ {
DictValues<VAL>::init (); DictValues<VAL>::init ();
subrsOffset = 0; subrsOffset = 0;
localSubrs = &Null(CFF2Subrs); localSubrs = &Null(CFF2Subrs);
ivs = 0; ivs = 0;
} }
void fini () { DictValues<VAL>::fini (); }
void fini (void) unsigned int calculate_serialized_size () const
{
DictValues<VAL>::fini ();
}
unsigned int calculate_serialized_size (void) const
{ {
unsigned int size = 0; unsigned int size = 0;
for (unsigned int i = 0; i < DictValues<VAL>::get_count; i++) for (unsigned int i = 0; i < DictValues<VAL>::get_count; i++)
@ -293,7 +285,7 @@ struct CFF2PrivDictInterpEnv : NumInterpEnv
seen_vsindex = false; seen_vsindex = false;
} }
void process_vsindex (void) void process_vsindex ()
{ {
if (likely (!seen_vsindex)) if (likely (!seen_vsindex))
{ {
@ -302,7 +294,7 @@ struct CFF2PrivDictInterpEnv : NumInterpEnv
seen_vsindex = true; seen_vsindex = true;
} }
unsigned int get_ivs (void) const { return ivs; } unsigned int get_ivs () const { return ivs; }
void set_ivs (unsigned int ivs_) { ivs = ivs_; } void set_ivs (unsigned int ivs_) { ivs = ivs_; }
protected: protected:
@ -501,7 +493,7 @@ struct cff2
} }
} }
void fini (void) void fini ()
{ {
sc.end_processing (); sc.end_processing ();
fontDicts.fini_deep (); fontDicts.fini_deep ();
@ -510,7 +502,7 @@ struct cff2
blob = nullptr; blob = nullptr;
} }
bool is_valid (void) const { return blob != nullptr; } bool is_valid () const { return blob != nullptr; }
protected: protected:
hb_blob_t *blob; hb_blob_t *blob;

View File

@ -226,9 +226,9 @@ struct CmapSubtableFormat4
struct accelerator_t struct accelerator_t
{ {
accelerator_t (void) {} accelerator_t () {}
accelerator_t (const CmapSubtableFormat4 *subtable) { init (subtable); } accelerator_t (const CmapSubtableFormat4 *subtable) { init (subtable); }
~accelerator_t (void) { fini (); } ~accelerator_t () { fini (); }
void init (const CmapSubtableFormat4 *subtable) void init (const CmapSubtableFormat4 *subtable)
{ {
@ -240,7 +240,7 @@ struct CmapSubtableFormat4
glyphIdArray = idRangeOffset + segCount; glyphIdArray = idRangeOffset + segCount;
glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2; glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2;
} }
void fini (void) {} void fini () {}
bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
{ {
@ -846,7 +846,7 @@ struct cmap
struct subset_plan struct subset_plan
{ {
size_t final_size (void) const size_t final_size () const
{ {
return 4 // header return 4 // header
+ 8 * 3 // 3 EncodingRecord + 8 * 3 // 3 EncodingRecord
@ -1031,7 +1031,7 @@ struct cmap
} }
} }
void fini (void) { this->table.destroy (); } void fini () { this->table.destroy (); }
bool get_nominal_glyph (hb_codepoint_t unicode, bool get_nominal_glyph (hb_codepoint_t unicode,
hb_codepoint_t *glyph) const hb_codepoint_t *glyph) const

View File

@ -390,7 +390,7 @@ struct CBDT
upem = hb_face_get_upem (face); upem = hb_face_get_upem (face);
} }
void fini (void) void fini ()
{ {
this->cblc.destroy (); this->cblc.destroy ();
this->cbdt.destroy (); this->cbdt.destroy ();
@ -505,7 +505,7 @@ struct CBDT
return hb_blob_get_empty (); return hb_blob_get_empty ();
} }
bool has_data (void) const { return cbdt.get_length (); } bool has_data () const { return cbdt.get_length (); }
private: private:
hb_blob_ptr_t<CBLC> cblc; hb_blob_ptr_t<CBLC> cblc;

View File

@ -89,7 +89,7 @@ struct COLR
{ {
enum { tableTag = HB_OT_TAG_COLR }; enum { tableTag = HB_OT_TAG_COLR };
bool has_data (void) const { return numBaseGlyphs; } bool has_data () const { return numBaseGlyphs; }
unsigned int get_glyph_layers (hb_codepoint_t glyph, unsigned int get_glyph_layers (hb_codepoint_t glyph,
unsigned int start_offset, unsigned int start_offset,

View File

@ -109,13 +109,13 @@ struct CPAL
{ {
enum { tableTag = HB_OT_TAG_CPAL }; enum { tableTag = HB_OT_TAG_CPAL };
bool has_data (void) const { return numPalettes; } bool has_data () const { return numPalettes; }
unsigned int get_size (void) const unsigned int get_size () const
{ return min_size + numPalettes * sizeof (colorRecordIndicesZ[0]); } { return min_size + numPalettes * sizeof (colorRecordIndicesZ[0]); }
unsigned int get_palette_count (void) const { return numPalettes; } unsigned int get_palette_count () const { return numPalettes; }
unsigned int get_color_count (void) const { return numColors; } unsigned int get_color_count () const { return numColors; }
hb_ot_color_palette_flags_t get_palette_flags (unsigned int palette_index) const hb_ot_color_palette_flags_t get_palette_flags (unsigned int palette_index) const
{ return v1 ().get_palette_flags (this, palette_index, numPalettes); } { return v1 ().get_palette_flags (this, palette_index, numPalettes); }
@ -153,7 +153,7 @@ struct CPAL
} }
private: private:
const CPALV1Tail& v1 (void) const const CPALV1Tail& v1 () const
{ {
if (version == 0) return Null(CPALV1Tail); if (version == 0) return Null(CPALV1Tail);
return StructAfter<CPALV1Tail> (*this); return StructAfter<CPALV1Tail> (*this);

View File

@ -132,7 +132,7 @@ struct sbix
{ {
enum { tableTag = HB_OT_TAG_sbix }; enum { tableTag = HB_OT_TAG_sbix };
bool has_data (void) const { return version; } bool has_data () const { return version; }
const SBIXStrike &get_strike (unsigned int i) const { return this+strikes[i]; } const SBIXStrike &get_strike (unsigned int i) const { return this+strikes[i]; }
@ -143,10 +143,9 @@ struct sbix
table = hb_sanitize_context_t().reference_table<sbix> (face); table = hb_sanitize_context_t().reference_table<sbix> (face);
num_glyphs = face->get_num_glyphs (); num_glyphs = face->get_num_glyphs ();
} }
void fini () { table.destroy (); }
void fini (void) { table.destroy (); } bool has_data () const { return table->has_data (); }
bool has_data (void) const { return table->has_data (); }
bool get_extents (hb_font_t *font, bool get_extents (hb_font_t *font,
hb_codepoint_t glyph, hb_codepoint_t glyph,

View File

@ -75,14 +75,13 @@ struct SVG
{ {
enum { tableTag = HB_OT_TAG_SVG }; enum { tableTag = HB_OT_TAG_SVG };
bool has_data (void) const { return svgDocEntries; } bool has_data () const { return svgDocEntries; }
struct accelerator_t struct accelerator_t
{ {
void init (hb_face_t *face) void init (hb_face_t *face)
{ table = hb_sanitize_context_t().reference_table<SVG> (face); } { table = hb_sanitize_context_t().reference_table<SVG> (face); }
void fini () { table.destroy (); }
void fini (void) { table.destroy (); }
hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id) const hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id) const
{ {
@ -90,7 +89,7 @@ struct SVG
table->svgDocEntries); table->svgDocEntries);
} }
bool has_data (void) const { return table->has_data (); } bool has_data () const { return table->has_data (); }
private: private:
hb_blob_ptr_t<SVG> table; hb_blob_ptr_t<SVG> table;

View File

@ -51,7 +51,7 @@ void hb_ot_face_t::init0 (hb_face_t *face)
#undef HB_OT_ACCELERATOR #undef HB_OT_ACCELERATOR
#undef HB_OT_TABLE #undef HB_OT_TABLE
} }
void hb_ot_face_t::fini (void) void hb_ot_face_t::fini ()
{ {
#define HB_OT_TABLE(Namespace, Type) Type.fini (); #define HB_OT_TABLE(Namespace, Type) Type.fini ();
#define HB_OT_ACCELERATOR(Namespace, Type) HB_OT_TABLE (Namespace, Type) #define HB_OT_ACCELERATOR(Namespace, Type) HB_OT_TABLE (Namespace, Type)

View File

@ -92,7 +92,7 @@ HB_OT_TABLES
struct hb_ot_face_t struct hb_ot_face_t
{ {
HB_INTERNAL void init0 (hb_face_t *face); HB_INTERNAL void init0 (hb_face_t *face);
HB_INTERNAL void fini (void); HB_INTERNAL void fini ();
#define HB_OT_TABLE_ORDER(Namespace, Type) \ #define HB_OT_TABLE_ORDER(Namespace, Type) \
HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type))) HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type)))

View File

@ -250,12 +250,12 @@ hb_ot_get_font_v_extents (hb_font_t *font,
} }
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_ot_funcs (void); static void free_static_ot_funcs ();
#endif #endif
static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot_font_funcs_lazy_loader_t> static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot_font_funcs_lazy_loader_t>
{ {
static hb_font_funcs_t *create (void) static hb_font_funcs_t *create ()
{ {
hb_font_funcs_t *funcs = hb_font_funcs_create (); hb_font_funcs_t *funcs = hb_font_funcs_create ();
@ -285,14 +285,14 @@ static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_ot_funcs (void) void free_static_ot_funcs ()
{ {
static_ot_funcs.free_instance (); static_ot_funcs.free_instance ();
} }
#endif #endif
static hb_font_funcs_t * static hb_font_funcs_t *
_hb_ot_get_font_funcs (void) _hb_ot_get_font_funcs ()
{ {
return static_ot_funcs.get_unconst (); return static_ot_funcs.get_unconst ();
} }

View File

@ -153,7 +153,7 @@ struct glyf
HBUINT16 flags; HBUINT16 flags;
GlyphID glyphIndex; GlyphID glyphIndex;
unsigned int get_size (void) const unsigned int get_size () const
{ {
unsigned int size = min_size; unsigned int size = min_size;
// arg1 and 2 are int16 // arg1 and 2 are int16
@ -177,7 +177,7 @@ struct glyf
const char *glyph_end; const char *glyph_end;
const CompositeGlyphHeader *current; const CompositeGlyphHeader *current;
bool move_to_next (void) bool move_to_next ()
{ {
if (current->flags & CompositeGlyphHeader::MORE_COMPONENTS) if (current->flags & CompositeGlyphHeader::MORE_COMPONENTS)
{ {
@ -244,7 +244,7 @@ struct glyf
num_glyphs = MAX (1u, loca_table.get_length () / (short_offset ? 2 : 4)) - 1; num_glyphs = MAX (1u, loca_table.get_length () / (short_offset ? 2 : 4)) - 1;
} }
void fini (void) void fini ()
{ {
loca_table.destroy (); loca_table.destroy ();
glyf_table.destroy (); glyf_table.destroy ();

View File

@ -56,7 +56,7 @@ struct DeviceRecord
this->subset_plan = subset_plan; this->subset_plan = subset_plan;
} }
unsigned int len (void) const unsigned int len () const
{ return this->subset_plan->glyphs.len; } { return this->subset_plan->glyphs.len; }
const HBUINT8* operator [] (unsigned int i) const const HBUINT8* operator [] (unsigned int i) const
@ -121,7 +121,7 @@ struct hdmx
{ {
enum { tableTag = HB_OT_TAG_hdmx }; enum { tableTag = HB_OT_TAG_hdmx };
unsigned int get_size (void) const unsigned int get_size () const
{ return min_size + numRecords * sizeDeviceRecord; } { return min_size + numRecords * sizeDeviceRecord; }
const DeviceRecord& operator [] (unsigned int i) const const DeviceRecord& operator [] (unsigned int i) const

View File

@ -47,7 +47,7 @@ struct head
enum { tableTag = HB_OT_TAG_head }; enum { tableTag = HB_OT_TAG_head };
unsigned int get_upem (void) const unsigned int get_upem () const
{ {
unsigned int upem = unitsPerEm; unsigned int upem = unitsPerEm;
/* If no valid head table found, assume 1000, which matches typical Type1 usage. */ /* If no valid head table found, assume 1000, which matches typical Type1 usage. */
@ -63,9 +63,9 @@ struct head
CONDENSED = 1u<<5 CONDENSED = 1u<<5
}; };
bool is_bold (void) const { return macStyle & BOLD; } bool is_bold () const { return macStyle & BOLD; }
bool is_italic (void) const { return macStyle & ITALIC; } bool is_italic () const { return macStyle & ITALIC; }
bool is_condensed (void) const { return macStyle & CONDENSED; } bool is_condensed () const { return macStyle & CONDENSED; }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {

View File

@ -234,7 +234,7 @@ struct hmtxvmtx
var_table = hb_sanitize_context_t().reference_table<HVARVVAR> (face, T::variationsTag); var_table = hb_sanitize_context_t().reference_table<HVARVVAR> (face, T::variationsTag);
} }
void fini (void) void fini ()
{ {
table.destroy (); table.destroy ();
var_table.destroy (); var_table.destroy ();

View File

@ -109,8 +109,8 @@ struct KernSubTableFormat3
template <typename KernSubTableHeader> template <typename KernSubTableHeader>
struct KernSubTable struct KernSubTable
{ {
unsigned int get_size (void) const { return u.header.length; } unsigned int get_size () const { return u.header.length; }
unsigned int get_type (void) const { return u.header.format; } unsigned int get_type () const { return u.header.format; }
int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
{ {
@ -163,8 +163,8 @@ struct KernOTSubTableHeader
enum { apple = false }; enum { apple = false };
typedef AAT::ObsoleteTypes Types; typedef AAT::ObsoleteTypes Types;
unsigned int tuple_count (void) const { return 0; } unsigned int tuple_count () const { return 0; }
bool is_horizontal (void) const { return (coverage & Horizontal); } bool is_horizontal () const { return (coverage & Horizontal); }
enum Coverage enum Coverage
{ {
@ -218,8 +218,8 @@ struct KernAATSubTableHeader
enum { apple = true }; enum { apple = true };
typedef AAT::ObsoleteTypes Types; typedef AAT::ObsoleteTypes Types;
unsigned int tuple_count (void) const { return 0; } unsigned int tuple_count () const { return 0; }
bool is_horizontal (void) const { return !(coverage & Vertical); } bool is_horizontal () const { return !(coverage & Vertical); }
enum Coverage enum Coverage
{ {
@ -271,10 +271,10 @@ struct kern
{ {
enum { tableTag = HB_OT_TAG_kern }; enum { tableTag = HB_OT_TAG_kern };
bool has_data (void) const { return u.version32; } bool has_data () const { return u.version32; }
unsigned int get_type (void) const { return u.major; } unsigned int get_type () const { return u.major; }
bool has_state_machine (void) const bool has_state_machine () const
{ {
switch (get_type ()) { switch (get_type ()) {
case 0: return u.ot.has_state_machine (); case 0: return u.ot.has_state_machine ();
@ -283,7 +283,7 @@ struct kern
} }
} }
bool has_cross_stream (void) const bool has_cross_stream () const
{ {
switch (get_type ()) { switch (get_type ()) {
case 0: return u.ot.has_cross_stream (); case 0: return u.ot.has_cross_stream ();

View File

@ -44,7 +44,7 @@ namespace OT {
struct BaseCoordFormat1 struct BaseCoordFormat1
{ {
hb_position_t get_coord (void) const { return coordinate; } hb_position_t get_coord () const { return coordinate; }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {
@ -61,7 +61,7 @@ struct BaseCoordFormat1
struct BaseCoordFormat2 struct BaseCoordFormat2
{ {
hb_position_t get_coord (void) const hb_position_t get_coord () const
{ {
/* TODO */ /* TODO */
return coordinate; return coordinate;
@ -280,7 +280,7 @@ struct BaseLangSysRecord
0; 0;
} }
const MinMax &get_min_max (void) const const MinMax &get_min_max () const
{ return this+minMax; } { return this+minMax; }
bool sanitize (hb_sanitize_context_t *c, const void *base) const bool sanitize (hb_sanitize_context_t *c, const void *base) const
@ -315,7 +315,7 @@ struct BaseScript
const BaseCoord &get_base_coord (int baseline_tag_index) const const BaseCoord &get_base_coord (int baseline_tag_index) const
{ return (this+baseValues).get_base_coord (baseline_tag_index); } { return (this+baseValues).get_base_coord (baseline_tag_index); }
bool is_empty (void) const { return !baseValues; } bool is_empty () const { return !baseValues; }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {
@ -469,7 +469,7 @@ struct BASE
const Axis &get_axis (hb_direction_t direction) const const Axis &get_axis (hb_direction_t direction) const
{ return HB_DIRECTION_IS_VERTICAL (direction) ? this+vAxis : this+hAxis; } { return HB_DIRECTION_IS_VERTICAL (direction) ? this+vAxis : this+hAxis; }
const VariationStore &get_var_store (void) const const VariationStore &get_var_store () const
{ return version.to_int () < 0x00010001u ? Null (VariationStore) : this+varStore; } { return version.to_int () < 0x00010001u ? Null (VariationStore) : this+varStore; }
bool get_baseline (hb_font_t *font, bool get_baseline (hb_font_t *font,

View File

@ -211,7 +211,7 @@ struct Feature;
struct LangSys struct LangSys
{ {
unsigned int get_feature_count (void) const unsigned int get_feature_count () const
{ return featureIndex.len; } { return featureIndex.len; }
hb_tag_t get_feature_index (unsigned int i) const hb_tag_t get_feature_index (unsigned int i) const
{ return featureIndex[i]; } { return featureIndex[i]; }
@ -222,8 +222,8 @@ struct LangSys
void add_feature_indexes_to (hb_set_t *feature_indexes) const void add_feature_indexes_to (hb_set_t *feature_indexes) const
{ featureIndex.add_indexes_to (feature_indexes); } { featureIndex.add_indexes_to (feature_indexes); }
bool has_required_feature (void) const { return reqFeatureIndex != 0xFFFFu; } bool has_required_feature () const { return reqFeatureIndex != 0xFFFFu; }
unsigned int get_required_feature_index (void) const unsigned int get_required_feature_index () const
{ {
if (reqFeatureIndex == 0xFFFFu) if (reqFeatureIndex == 0xFFFFu)
return Index::NOT_FOUND_INDEX; return Index::NOT_FOUND_INDEX;
@ -256,7 +256,7 @@ DECLARE_NULL_NAMESPACE_BYTES (OT, LangSys);
struct Script struct Script
{ {
unsigned int get_lang_sys_count (void) const unsigned int get_lang_sys_count () const
{ return langSys.len; } { return langSys.len; }
const Tag& get_lang_sys_tag (unsigned int i) const const Tag& get_lang_sys_tag (unsigned int i) const
{ return langSys.get_tag (i); } { return langSys.get_tag (i); }
@ -272,8 +272,8 @@ struct Script
bool find_lang_sys_index (hb_tag_t tag, unsigned int *index) const bool find_lang_sys_index (hb_tag_t tag, unsigned int *index) const
{ return langSys.find_index (tag, index); } { return langSys.find_index (tag, index); }
bool has_default_lang_sys (void) const { return defaultLangSys != 0; } bool has_default_lang_sys () const { return defaultLangSys != 0; }
const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; } const LangSys& get_default_lang_sys () const { return this+defaultLangSys; }
bool subset (hb_subset_context_t *c) const bool subset (hb_subset_context_t *c) const
{ {
@ -543,7 +543,7 @@ struct FeatureParams
struct Feature struct Feature
{ {
unsigned int get_lookup_count (void) const unsigned int get_lookup_count () const
{ return lookupIndex.len; } { return lookupIndex.len; }
hb_tag_t get_lookup_index (unsigned int i) const hb_tag_t get_lookup_index (unsigned int i) const
{ return lookupIndex[i]; } { return lookupIndex[i]; }
@ -554,7 +554,7 @@ struct Feature
void add_lookup_indexes_to (hb_set_t *lookup_indexes) const void add_lookup_indexes_to (hb_set_t *lookup_indexes) const
{ lookupIndex.add_indexes_to (lookup_indexes); } { lookupIndex.add_indexes_to (lookup_indexes); }
const FeatureParams &get_feature_params (void) const const FeatureParams &get_feature_params () const
{ return this+featureParams; } { return this+featureParams; }
bool subset (hb_subset_context_t *c) const bool subset (hb_subset_context_t *c) const
@ -646,20 +646,20 @@ namespace OT {
struct Lookup struct Lookup
{ {
unsigned int get_subtable_count (void) const { return subTable.len; } unsigned int get_subtable_count () const { return subTable.len; }
template <typename TSubTable> template <typename TSubTable>
const TSubTable& get_subtable (unsigned int i) const const TSubTable& get_subtable (unsigned int i) const
{ return this+CastR<OffsetArrayOf<TSubTable> > (subTable)[i]; } { return this+CastR<OffsetArrayOf<TSubTable> > (subTable)[i]; }
template <typename TSubTable> template <typename TSubTable>
const OffsetArrayOf<TSubTable>& get_subtables (void) const const OffsetArrayOf<TSubTable>& get_subtables () const
{ return CastR<OffsetArrayOf<TSubTable> > (subTable); } { return CastR<OffsetArrayOf<TSubTable> > (subTable); }
template <typename TSubTable> template <typename TSubTable>
OffsetArrayOf<TSubTable>& get_subtables (void) OffsetArrayOf<TSubTable>& get_subtables ()
{ return CastR<OffsetArrayOf<TSubTable> > (subTable); } { return CastR<OffsetArrayOf<TSubTable> > (subTable); }
unsigned int get_size (void) const unsigned int get_size () const
{ {
const HBUINT16 &markFilteringSet = StructAfter<const HBUINT16> (subTable); const HBUINT16 &markFilteringSet = StructAfter<const HBUINT16> (subTable);
if (lookupFlag & LookupFlag::UseMarkFilteringSet) if (lookupFlag & LookupFlag::UseMarkFilteringSet)
@ -667,12 +667,12 @@ struct Lookup
return (const char *) &markFilteringSet - (const char *) this; return (const char *) &markFilteringSet - (const char *) this;
} }
unsigned int get_type (void) const { return lookupType; } unsigned int get_type () const { return lookupType; }
/* lookup_props is a 32-bit integer where the lower 16-bit is LookupFlag and /* lookup_props is a 32-bit integer where the lower 16-bit is LookupFlag and
* higher 16-bit is mark-filtering-set if the lookup uses one. * higher 16-bit is mark-filtering-set if the lookup uses one.
* Not to be confused with glyph_props which is very similar. */ * Not to be confused with glyph_props which is very similar. */
uint32_t get_props (void) const uint32_t get_props () const
{ {
unsigned int flag = lookupFlag; unsigned int flag = lookupFlag;
if (unlikely (flag & LookupFlag::UseMarkFilteringSet)) if (unlikely (flag & LookupFlag::UseMarkFilteringSet))
@ -868,11 +868,11 @@ struct CoverageFormat1
/* Older compilers need this to be public. */ /* Older compilers need this to be public. */
struct Iter { struct Iter {
void init (const struct CoverageFormat1 &c_) { c = &c_; i = 0; } void init (const struct CoverageFormat1 &c_) { c = &c_; i = 0; }
void fini (void) {} void fini () {}
bool more (void) { return i < c->glyphArray.len; } bool more () { return i < c->glyphArray.len; }
void next (void) { i++; } void next () { i++; }
hb_codepoint_t get_glyph (void) { return c->glyphArray[i]; } hb_codepoint_t get_glyph () { return c->glyphArray[i]; }
unsigned int get_coverage (void) { return i; } unsigned int get_coverage () { return i; }
private: private:
const struct CoverageFormat1 *c; const struct CoverageFormat1 *c;
@ -995,9 +995,9 @@ struct CoverageFormat2
i = c->rangeRecord.len; i = c->rangeRecord.len;
} }
} }
void fini (void) {} void fini () {}
bool more (void) { return i < c->rangeRecord.len; } bool more () { return i < c->rangeRecord.len; }
void next (void) void next ()
{ {
if (j >= c->rangeRecord[i].end) if (j >= c->rangeRecord[i].end)
{ {
@ -1019,8 +1019,8 @@ struct CoverageFormat2
coverage++; coverage++;
j++; j++;
} }
hb_codepoint_t get_glyph (void) { return j; } hb_codepoint_t get_glyph () { return j; }
unsigned int get_coverage (void) { return coverage; } unsigned int get_coverage () { return coverage; }
private: private:
const struct CoverageFormat2 *c; const struct CoverageFormat2 *c;
@ -1128,7 +1128,7 @@ struct Coverage
default: return; default: return;
} }
} }
bool more (void) bool more ()
{ {
switch (format) switch (format)
{ {
@ -1137,7 +1137,7 @@ struct Coverage
default:return false; default:return false;
} }
} }
void next (void) void next ()
{ {
switch (format) switch (format)
{ {
@ -1146,7 +1146,7 @@ struct Coverage
default: break; default: break;
} }
} }
hb_codepoint_t get_glyph (void) hb_codepoint_t get_glyph ()
{ {
switch (format) switch (format)
{ {
@ -1155,7 +1155,7 @@ struct Coverage
default:return 0; default:return 0;
} }
} }
unsigned int get_coverage (void) unsigned int get_coverage ()
{ {
switch (format) switch (format)
{ {
@ -1696,8 +1696,7 @@ struct VarRegionList
axesZ.sanitize (c, (unsigned int) axisCount * (unsigned int) regionCount)); axesZ.sanitize (c, (unsigned int) axisCount * (unsigned int) regionCount));
} }
unsigned int get_region_count (void) const unsigned int get_region_count () const { return regionCount; }
{ return regionCount; }
protected: protected:
HBUINT16 axisCount; HBUINT16 axisCount;
@ -1710,13 +1709,13 @@ struct VarRegionList
struct VarData struct VarData
{ {
unsigned int get_region_index_count (void) const unsigned int get_region_index_count () const
{ return regionIndices.len; } { return regionIndices.len; }
unsigned int get_row_size (void) const unsigned int get_row_size () const
{ return shortCount + regionIndices.len; } { return shortCount + regionIndices.len; }
unsigned int get_size (void) const unsigned int get_size () const
{ return itemCount * get_row_size (); } { return itemCount * get_row_size (); }
float get_delta (unsigned int inner, float get_delta (unsigned int inner,
@ -2049,7 +2048,7 @@ struct HintingDevice
hb_position_t get_y_delta (hb_font_t *font) const hb_position_t get_y_delta (hb_font_t *font) const
{ return get_delta (font->y_ppem, font->y_scale); } { return get_delta (font->y_ppem, font->y_scale); }
unsigned int get_size (void) const unsigned int get_size () const
{ {
unsigned int f = deltaFormat; unsigned int f = deltaFormat;
if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * HBUINT16::static_size; if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * HBUINT16::static_size;

View File

@ -351,25 +351,25 @@ struct GDEF
ComponentGlyph = 4 ComponentGlyph = 4
}; };
bool has_data (void) const { return version.to_int (); } bool has_data () const { return version.to_int (); }
bool has_glyph_classes (void) const { return glyphClassDef != 0; } bool has_glyph_classes () const { return glyphClassDef != 0; }
unsigned int get_glyph_class (hb_codepoint_t glyph) const unsigned int get_glyph_class (hb_codepoint_t glyph) const
{ return (this+glyphClassDef).get_class (glyph); } { return (this+glyphClassDef).get_class (glyph); }
void get_glyphs_in_class (unsigned int klass, hb_set_t *glyphs) const void get_glyphs_in_class (unsigned int klass, hb_set_t *glyphs) const
{ (this+glyphClassDef).add_class (glyphs, klass); } { (this+glyphClassDef).add_class (glyphs, klass); }
bool has_mark_attachment_types (void) const { return markAttachClassDef != 0; } bool has_mark_attachment_types () const { return markAttachClassDef != 0; }
unsigned int get_mark_attachment_type (hb_codepoint_t glyph) const unsigned int get_mark_attachment_type (hb_codepoint_t glyph) const
{ return (this+markAttachClassDef).get_class (glyph); } { return (this+markAttachClassDef).get_class (glyph); }
bool has_attach_points (void) const { return attachList != 0; } bool has_attach_points () const { return attachList != 0; }
unsigned int get_attach_points (hb_codepoint_t glyph_id, unsigned int get_attach_points (hb_codepoint_t glyph_id,
unsigned int start_offset, unsigned int start_offset,
unsigned int *point_count /* IN/OUT */, unsigned int *point_count /* IN/OUT */,
unsigned int *point_array /* OUT */) const unsigned int *point_array /* OUT */) const
{ return (this+attachList).get_attach_points (glyph_id, start_offset, point_count, point_array); } { return (this+attachList).get_attach_points (glyph_id, start_offset, point_count, point_array); }
bool has_lig_carets (void) const { return ligCaretList != 0; } bool has_lig_carets () const { return ligCaretList != 0; }
unsigned int get_lig_carets (hb_font_t *font, unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction, hb_direction_t direction,
hb_codepoint_t glyph_id, hb_codepoint_t glyph_id,
@ -380,12 +380,12 @@ struct GDEF
direction, glyph_id, get_var_store(), direction, glyph_id, get_var_store(),
start_offset, caret_count, caret_array); } start_offset, caret_count, caret_array); }
bool has_mark_sets (void) const { return version.to_int () >= 0x00010002u && markGlyphSetsDef != 0; } bool has_mark_sets () const { return version.to_int () >= 0x00010002u && markGlyphSetsDef != 0; }
bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const
{ return version.to_int () >= 0x00010002u && (this+markGlyphSetsDef).covers (set_index, glyph_id); } { return version.to_int () >= 0x00010002u && (this+markGlyphSetsDef).covers (set_index, glyph_id); }
bool has_var_store (void) const { return version.to_int () >= 0x00010003u && varStore != 0; } bool has_var_store () const { return version.to_int () >= 0x00010003u && varStore != 0; }
const VariationStore &get_var_store (void) const const VariationStore &get_var_store () const
{ return version.to_int () >= 0x00010003u ? this+varStore : Null(VariationStore); } { return version.to_int () >= 0x00010003u ? this+varStore : Null(VariationStore); }
/* glyph_props is a 16-bit integer where the lower 8-bit have bits representing /* glyph_props is a 16-bit integer where the lower 8-bit have bits representing
@ -424,12 +424,12 @@ struct GDEF
} }
} }
void fini (void) { this->table.destroy (); } void fini () { this->table.destroy (); }
hb_blob_ptr_t<GDEF> table; hb_blob_ptr_t<GDEF> table;
}; };
unsigned int get_size (void) const unsigned int get_size () const
{ {
return min_size + return min_size +
(version.to_int () >= 0x00010002u ? markGlyphSetsDef.static_size : 0) + (version.to_int () >= 0x00010002u ? markGlyphSetsDef.static_size : 0) +

View File

@ -98,10 +98,8 @@ struct ValueFormat : HBUINT16
* PosTable (may be NULL) */ * PosTable (may be NULL) */
#endif #endif
unsigned int get_len (void) const unsigned int get_len () const { return hb_popcount ((unsigned int) *this); }
{ return hb_popcount ((unsigned int) *this); } unsigned int get_size () const { return get_len () * Value::static_size; }
unsigned int get_size (void) const
{ return get_len () * Value::static_size; }
bool apply_value (hb_ot_apply_context_t *c, bool apply_value (hb_ot_apply_context_t *c,
const void *base, const void *base,
@ -191,7 +189,7 @@ struct ValueFormat : HBUINT16
public: public:
bool has_device (void) const bool has_device () const
{ {
unsigned int format = *this; unsigned int format = *this;
return (format & devices) != 0; return (format & devices) != 0;
@ -479,8 +477,7 @@ struct SinglePosFormat1
if (unlikely (!(this+coverage).add_coverage (c->input))) return; if (unlikely (!(this+coverage).add_coverage (c->input))) return;
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -535,8 +532,7 @@ struct SinglePosFormat2
if (unlikely (!(this+coverage).add_coverage (c->input))) return; if (unlikely (!(this+coverage).add_coverage (c->input))) return;
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -754,8 +750,7 @@ struct PairPosFormat1
(this+pairSet[i]).collect_glyphs (c, valueFormat); (this+pairSet[i]).collect_glyphs (c, valueFormat);
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -830,8 +825,7 @@ struct PairPosFormat2
if (unlikely (!(this+classDef2).add_coverage (c->input))) return; if (unlikely (!(this+classDef2).add_coverage (c->input))) return;
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -982,8 +976,7 @@ struct CursivePosFormat1
if (unlikely (!(this+coverage).add_coverage (c->input))) return; if (unlikely (!(this+coverage).add_coverage (c->input))) return;
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -1150,8 +1143,7 @@ struct MarkBasePosFormat1
if (unlikely (!(this+baseCoverage).add_coverage (c->input))) return; if (unlikely (!(this+baseCoverage).add_coverage (c->input))) return;
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+markCoverage; }
{ return this+markCoverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -1273,8 +1265,7 @@ struct MarkLigPosFormat1
if (unlikely (!(this+ligatureCoverage).add_coverage (c->input))) return; if (unlikely (!(this+ligatureCoverage).add_coverage (c->input))) return;
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+markCoverage; }
{ return this+markCoverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -1395,8 +1386,7 @@ struct MarkMarkPosFormat1
if (unlikely (!(this+mark2Coverage).add_coverage (c->input))) return; if (unlikely (!(this+mark2Coverage).add_coverage (c->input))) return;
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+mark1Coverage; }
{ return this+mark1Coverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -1576,7 +1566,7 @@ struct PosLookup : Lookup
const SubTable& get_subtable (unsigned int i) const const SubTable& get_subtable (unsigned int i) const
{ return Lookup::get_subtable<SubTable> (i); } { return Lookup::get_subtable<SubTable> (i); }
bool is_reverse (void) const bool is_reverse () const
{ {
return false; return false;
} }

View File

@ -71,8 +71,7 @@ struct SingleSubstFormat1
} }
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool would_apply (hb_would_apply_context_t *c) const bool would_apply (hb_would_apply_context_t *c) const
{ {
@ -180,8 +179,7 @@ struct SingleSubstFormat2
} }
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool would_apply (hb_would_apply_context_t *c) const bool would_apply (hb_would_apply_context_t *c) const
{ {
@ -415,8 +413,7 @@ struct MultipleSubstFormat1
(this+sequence[i]).collect_glyphs (c); (this+sequence[i]).collect_glyphs (c);
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool would_apply (hb_would_apply_context_t *c) const bool would_apply (hb_would_apply_context_t *c) const
{ {
@ -609,8 +606,7 @@ struct AlternateSubstFormat1
} }
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool would_apply (hb_would_apply_context_t *c) const bool would_apply (hb_would_apply_context_t *c) const
{ {
@ -945,8 +941,7 @@ struct LigatureSubstFormat1
} }
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool would_apply (hb_would_apply_context_t *c) const bool would_apply (hb_would_apply_context_t *c) const
{ {
@ -1069,7 +1064,7 @@ struct ExtensionSubst : Extension<ExtensionSubst>
{ {
typedef struct SubstLookupSubTable SubTable; typedef struct SubstLookupSubTable SubTable;
bool is_reverse (void) const; bool is_reverse () const;
}; };
@ -1146,8 +1141,7 @@ struct ReverseChainSingleSubstFormat1
c->output->add_array (substitute.arrayZ, substitute.len); c->output->add_array (substitute.arrayZ, substitute.len);
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool would_apply (hb_would_apply_context_t *c) const bool would_apply (hb_would_apply_context_t *c) const
{ {
@ -1312,7 +1306,7 @@ struct SubstLookup : Lookup
static bool lookup_type_is_reverse (unsigned int lookup_type) static bool lookup_type_is_reverse (unsigned int lookup_type)
{ return lookup_type == SubTable::ReverseChainSingle; } { return lookup_type == SubTable::ReverseChainSingle; }
bool is_reverse (void) const bool is_reverse () const
{ {
unsigned int type = get_type (); unsigned int type = get_type ();
if (unlikely (type == SubTable::Extension)) if (unlikely (type == SubTable::Extension))
@ -1498,7 +1492,7 @@ struct GSUB_accelerator_t : GSUB::accelerator_t {};
/* Out-of-class implementation for methods recursing */ /* Out-of-class implementation for methods recursing */
/*static*/ inline bool ExtensionSubst::is_reverse (void) const /*static*/ inline bool ExtensionSubst::is_reverse () const
{ {
unsigned int type = get_type (); unsigned int type = get_type ();
if (unlikely (type == SubTable::Extension)) if (unlikely (type == SubTable::Extension))

View File

@ -44,10 +44,10 @@ namespace OT {
struct hb_intersects_context_t : struct hb_intersects_context_t :
hb_dispatch_context_t<hb_intersects_context_t, bool, 0> hb_dispatch_context_t<hb_intersects_context_t, bool, 0>
{ {
const char *get_name (void) { return "INTERSECTS"; } const char *get_name () { return "INTERSECTS"; }
template <typename T> template <typename T>
return_t dispatch (const T &obj) { return obj.intersects (this->glyphs); } return_t dispatch (const T &obj) { return obj.intersects (this->glyphs); }
static return_t default_return_value (void) { return false; } static return_t default_return_value () { return false; }
bool stop_sublookup_iteration (return_t r) const { return r; } bool stop_sublookup_iteration (return_t r) const { return r; }
const hb_set_t *glyphs; const hb_set_t *glyphs;
@ -61,11 +61,11 @@ struct hb_intersects_context_t :
struct hb_closure_context_t : struct hb_closure_context_t :
hb_dispatch_context_t<hb_closure_context_t, hb_void_t, HB_DEBUG_CLOSURE> hb_dispatch_context_t<hb_closure_context_t, hb_void_t, HB_DEBUG_CLOSURE>
{ {
const char *get_name (void) { return "CLOSURE"; } const char *get_name () { return "CLOSURE"; }
typedef return_t (*recurse_func_t) (hb_closure_context_t *c, unsigned int lookup_index); typedef return_t (*recurse_func_t) (hb_closure_context_t *c, unsigned int lookup_index);
template <typename T> template <typename T>
return_t dispatch (const T &obj) { obj.closure (this); return HB_VOID; } return_t dispatch (const T &obj) { obj.closure (this); return HB_VOID; }
static return_t default_return_value (void) { return HB_VOID; } static return_t default_return_value () { return HB_VOID; }
void recurse (unsigned int lookup_index) void recurse (unsigned int lookup_index)
{ {
if (unlikely (nesting_level_left == 0 || !recurse_func)) if (unlikely (nesting_level_left == 0 || !recurse_func))
@ -108,14 +108,11 @@ struct hb_closure_context_t :
debug_depth (0), debug_depth (0),
done_lookups (done_lookups_) {} done_lookups (done_lookups_) {}
~hb_closure_context_t (void) ~hb_closure_context_t () { flush (); }
{
flush ();
}
void set_recurse_func (recurse_func_t func) { recurse_func = func; } void set_recurse_func (recurse_func_t func) { recurse_func = func; }
void flush (void) void flush ()
{ {
hb_set_union (glyphs, out); hb_set_union (glyphs, out);
hb_set_clear (out); hb_set_clear (out);
@ -129,10 +126,10 @@ struct hb_closure_context_t :
struct hb_would_apply_context_t : struct hb_would_apply_context_t :
hb_dispatch_context_t<hb_would_apply_context_t, bool, HB_DEBUG_WOULD_APPLY> hb_dispatch_context_t<hb_would_apply_context_t, bool, HB_DEBUG_WOULD_APPLY>
{ {
const char *get_name (void) { return "WOULD_APPLY"; } const char *get_name () { return "WOULD_APPLY"; }
template <typename T> template <typename T>
return_t dispatch (const T &obj) { return obj.would_apply (this); } return_t dispatch (const T &obj) { return obj.would_apply (this); }
static return_t default_return_value (void) { return false; } static return_t default_return_value () { return false; }
bool stop_sublookup_iteration (return_t r) const { return r; } bool stop_sublookup_iteration (return_t r) const { return r; }
hb_face_t *face; hb_face_t *face;
@ -156,11 +153,11 @@ struct hb_would_apply_context_t :
struct hb_collect_glyphs_context_t : struct hb_collect_glyphs_context_t :
hb_dispatch_context_t<hb_collect_glyphs_context_t, hb_void_t, HB_DEBUG_COLLECT_GLYPHS> hb_dispatch_context_t<hb_collect_glyphs_context_t, hb_void_t, HB_DEBUG_COLLECT_GLYPHS>
{ {
const char *get_name (void) { return "COLLECT_GLYPHS"; } const char *get_name () { return "COLLECT_GLYPHS"; }
typedef return_t (*recurse_func_t) (hb_collect_glyphs_context_t *c, unsigned int lookup_index); typedef return_t (*recurse_func_t) (hb_collect_glyphs_context_t *c, unsigned int lookup_index);
template <typename T> template <typename T>
return_t dispatch (const T &obj) { obj.collect_glyphs (this); return HB_VOID; } return_t dispatch (const T &obj) { obj.collect_glyphs (this); return HB_VOID; }
static return_t default_return_value (void) { return HB_VOID; } static return_t default_return_value () { return HB_VOID; }
void recurse (unsigned int lookup_index) void recurse (unsigned int lookup_index)
{ {
if (unlikely (nesting_level_left == 0 || !recurse_func)) if (unlikely (nesting_level_left == 0 || !recurse_func))
@ -224,7 +221,7 @@ struct hb_collect_glyphs_context_t :
recursed_lookups (hb_set_create ()), recursed_lookups (hb_set_create ()),
nesting_level_left (nesting_level_left_), nesting_level_left (nesting_level_left_),
debug_depth (0) {} debug_depth (0) {}
~hb_collect_glyphs_context_t (void) { hb_set_destroy (recursed_lookups); } ~hb_collect_glyphs_context_t () { hb_set_destroy (recursed_lookups); }
void set_recurse_func (recurse_func_t func) { recurse_func = func; } void set_recurse_func (recurse_func_t func) { recurse_func = func; }
}; };
@ -235,11 +232,11 @@ template <typename set_t>
struct hb_add_coverage_context_t : struct hb_add_coverage_context_t :
hb_dispatch_context_t<hb_add_coverage_context_t<set_t>, const Coverage &, HB_DEBUG_GET_COVERAGE> hb_dispatch_context_t<hb_add_coverage_context_t<set_t>, const Coverage &, HB_DEBUG_GET_COVERAGE>
{ {
const char *get_name (void) { return "GET_COVERAGE"; } const char *get_name () { return "GET_COVERAGE"; }
typedef const Coverage &return_t; typedef const Coverage &return_t;
template <typename T> template <typename T>
return_t dispatch (const T &obj) { return obj.get_coverage (); } return_t dispatch (const T &obj) { return obj.get_coverage (); }
static return_t default_return_value (void) { return Null(Coverage); } static return_t default_return_value () { return Null(Coverage); }
bool stop_sublookup_iteration (return_t r) const bool stop_sublookup_iteration (return_t r) const
{ {
r.add_coverage (set); r.add_coverage (set);
@ -260,7 +257,7 @@ struct hb_ot_apply_context_t :
{ {
struct matcher_t struct matcher_t
{ {
matcher_t (void) : matcher_t () :
lookup_props (0), lookup_props (0),
ignore_zwnj (false), ignore_zwnj (false),
ignore_zwj (false), ignore_zwj (false),
@ -366,15 +363,13 @@ struct hb_ot_apply_context_t :
matcher.set_syllable (start_index_ == c->buffer->idx ? c->buffer->cur().syllable () : 0); matcher.set_syllable (start_index_ == c->buffer->idx ? c->buffer->cur().syllable () : 0);
} }
void reject (void) { num_items++; match_glyph_data--; } void reject () { num_items++; match_glyph_data--; }
matcher_t::may_skip_t matcher_t::may_skip_t
may_skip (const hb_glyph_info_t &info) const may_skip (const hb_glyph_info_t &info) const
{ { return matcher.may_skip (c, info); }
return matcher.may_skip (c, info);
}
bool next (void) bool next ()
{ {
assert (num_items > 0); assert (num_items > 0);
while (idx + num_items < end) while (idx + num_items < end)
@ -401,7 +396,7 @@ struct hb_ot_apply_context_t :
} }
return false; return false;
} }
bool prev (void) bool prev ()
{ {
assert (num_items > 0); assert (num_items > 0);
while (idx > num_items - 1) while (idx > num_items - 1)
@ -440,11 +435,11 @@ struct hb_ot_apply_context_t :
}; };
const char *get_name (void) { return "APPLY"; } const char *get_name () { return "APPLY"; }
typedef return_t (*recurse_func_t) (hb_ot_apply_context_t *c, unsigned int lookup_index); typedef return_t (*recurse_func_t) (hb_ot_apply_context_t *c, unsigned int lookup_index);
template <typename T> template <typename T>
return_t dispatch (const T &obj) { return obj.apply (this); } return_t dispatch (const T &obj) { return obj.apply (this); }
static return_t default_return_value (void) { return false; } static return_t default_return_value () { return false; }
bool stop_sublookup_iteration (return_t r) const { return r; } bool stop_sublookup_iteration (return_t r) const { return r; }
return_t recurse (unsigned int sub_lookup_index) return_t recurse (unsigned int sub_lookup_index)
{ {
@ -503,7 +498,7 @@ struct hb_ot_apply_context_t :
random (false), random (false),
random_state (1) { init_iters (); } random_state (1) { init_iters (); }
void init_iters (void) void init_iters ()
{ {
iter_input.init (this, false); iter_input.init (this, false);
iter_context.init (this, true); iter_context.init (this, true);
@ -517,7 +512,7 @@ struct hb_ot_apply_context_t :
void set_lookup_index (unsigned int lookup_index_) { lookup_index = lookup_index_; } void set_lookup_index (unsigned int lookup_index_) { lookup_index = lookup_index_; }
void set_lookup_props (unsigned int lookup_props_) { lookup_props = lookup_props_; init_iters (); } void set_lookup_props (unsigned int lookup_props_) { lookup_props = lookup_props_; init_iters (); }
uint32_t random_number (void) uint32_t random_number ()
{ {
/* http://www.cplusplus.com/reference/random/minstd_rand/ */ /* http://www.cplusplus.com/reference/random/minstd_rand/ */
random_state = random_state * 48271 % 2147483647; random_state = random_state * 48271 % 2147483647;
@ -651,7 +646,7 @@ struct hb_get_subtables_context_t :
typedef hb_vector_t<hb_applicable_t, 2> array_t; typedef hb_vector_t<hb_applicable_t, 2> array_t;
/* Dispatch interface. */ /* Dispatch interface. */
const char *get_name (void) { return "GET_SUBTABLES"; } const char *get_name () { return "GET_SUBTABLES"; }
template <typename T> template <typename T>
return_t dispatch (const T &obj) return_t dispatch (const T &obj)
{ {
@ -659,7 +654,7 @@ struct hb_get_subtables_context_t :
entry->init (obj, apply_to<T>); entry->init (obj, apply_to<T>);
return HB_VOID; return HB_VOID;
} }
static return_t default_return_value (void) { return HB_VOID; } static return_t default_return_value () { return HB_VOID; }
hb_get_subtables_context_t (array_t &array_) : hb_get_subtables_context_t (array_t &array_) :
array (array_), array (array_),
@ -1504,8 +1499,7 @@ struct ContextFormat1
return_trace (rule_set.would_apply (c, lookup_context)); return_trace (rule_set.would_apply (c, lookup_context));
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -1622,8 +1616,7 @@ struct ContextFormat2
return_trace (rule_set.would_apply (c, lookup_context)); return_trace (rule_set.would_apply (c, lookup_context));
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -1732,8 +1725,7 @@ struct ContextFormat3
return_trace (context_would_apply_lookup (c, glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1), lookupCount, lookupRecord, lookup_context)); return_trace (context_would_apply_lookup (c, glyphCount, (const HBUINT16 *) (coverageZ.arrayZ + 1), lookupCount, lookupRecord, lookup_context));
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverageZ[0]; }
{ return this+coverageZ[0]; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -2171,8 +2163,7 @@ struct ChainContextFormat1
return_trace (rule_set.would_apply (c, lookup_context)); return_trace (rule_set.would_apply (c, lookup_context));
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -2304,8 +2295,7 @@ struct ChainContextFormat2
return_trace (rule_set.would_apply (c, lookup_context)); return_trace (rule_set.would_apply (c, lookup_context));
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const { return this+coverage; }
{ return this+coverage; }
bool apply (hb_ot_apply_context_t *c) const bool apply (hb_ot_apply_context_t *c) const
{ {
@ -2451,7 +2441,7 @@ struct ChainContextFormat3
lookup.len, lookup.arrayZ, lookup_context)); lookup.len, lookup.arrayZ, lookup_context));
} }
const Coverage &get_coverage (void) const const Coverage &get_coverage () const
{ {
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack); const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
return this+input[0]; return this+input[0];
@ -2547,10 +2537,10 @@ struct ChainContext
template <typename T> template <typename T>
struct ExtensionFormat1 struct ExtensionFormat1
{ {
unsigned int get_type (void) const { return extensionLookupType; } unsigned int get_type () const { return extensionLookupType; }
template <typename X> template <typename X>
const X& get_subtable (void) const const X& get_subtable () const
{ {
unsigned int offset = extensionOffset; unsigned int offset = extensionOffset;
if (unlikely (!offset)) return Null(typename T::SubTable); if (unlikely (!offset)) return Null(typename T::SubTable);
@ -2588,7 +2578,7 @@ struct ExtensionFormat1
template <typename T> template <typename T>
struct Extension struct Extension
{ {
unsigned int get_type (void) const unsigned int get_type () const
{ {
switch (u.format) { switch (u.format) {
case 1: return u.format1.get_type (); case 1: return u.format1.get_type ();
@ -2596,7 +2586,7 @@ struct Extension
} }
} }
template <typename X> template <typename X>
const X& get_subtable (void) const const X& get_subtable () const
{ {
switch (u.format) { switch (u.format) {
case 1: return u.format1.template get_subtable<typename T::SubTable> (); case 1: return u.format1.template get_subtable<typename T::SubTable> ();
@ -2639,7 +2629,7 @@ struct hb_ot_layout_lookup_accelerator_t
OT::hb_get_subtables_context_t c_get_subtables (subtables); OT::hb_get_subtables_context_t c_get_subtables (subtables);
lookup.dispatch (&c_get_subtables); lookup.dispatch (&c_get_subtables);
} }
void fini (void) { subtables.fini (); } void fini () { subtables.fini (); }
bool may_have (hb_codepoint_t g) const bool may_have (hb_codepoint_t g) const
{ return digest.may_have (g); } { return digest.may_have (g); }
@ -2659,8 +2649,8 @@ struct hb_ot_layout_lookup_accelerator_t
struct GSUBGPOS struct GSUBGPOS
{ {
bool has_data (void) const { return version.to_int (); } bool has_data () const { return version.to_int (); }
unsigned int get_script_count (void) const unsigned int get_script_count () const
{ return (this+scriptList).len; } { return (this+scriptList).len; }
const Tag& get_script_tag (unsigned int i) const const Tag& get_script_tag (unsigned int i) const
{ return (this+scriptList).get_tag (i); } { return (this+scriptList).get_tag (i); }
@ -2673,7 +2663,7 @@ struct GSUBGPOS
bool find_script_index (hb_tag_t tag, unsigned int *index) const bool find_script_index (hb_tag_t tag, unsigned int *index) const
{ return (this+scriptList).find_index (tag, index); } { return (this+scriptList).find_index (tag, index); }
unsigned int get_feature_count (void) const unsigned int get_feature_count () const
{ return (this+featureList).len; } { return (this+featureList).len; }
hb_tag_t get_feature_tag (unsigned int i) const hb_tag_t get_feature_tag (unsigned int i) const
{ return i == Index::NOT_FOUND_INDEX ? HB_TAG_NONE : (this+featureList).get_tag (i); } { return i == Index::NOT_FOUND_INDEX ? HB_TAG_NONE : (this+featureList).get_tag (i); }
@ -2686,7 +2676,7 @@ struct GSUBGPOS
bool find_feature_index (hb_tag_t tag, unsigned int *index) const bool find_feature_index (hb_tag_t tag, unsigned int *index) const
{ return (this+featureList).find_index (tag, index); } { return (this+featureList).find_index (tag, index); }
unsigned int get_lookup_count (void) const unsigned int get_lookup_count () const
{ return (this+lookupList).len; } { return (this+lookupList).len; }
const Lookup& get_lookup (unsigned int i) const const Lookup& get_lookup (unsigned int i) const
{ return (this+lookupList)[i]; } { return (this+lookupList)[i]; }
@ -2732,7 +2722,7 @@ struct GSUBGPOS
return_trace (true); return_trace (true);
} }
unsigned int get_size (void) const unsigned int get_size () const
{ {
return min_size + return min_size +
(version.to_int () >= 0x00010001u ? featureVars.static_size : 0); (version.to_int () >= 0x00010001u ? featureVars.static_size : 0);
@ -2773,7 +2763,7 @@ struct GSUBGPOS
this->accels[i].init (table->get_lookup (i)); this->accels[i].init (table->get_lookup (i));
} }
void fini (void) void fini ()
{ {
for (unsigned int i = 0; i < this->lookup_count; i++) for (unsigned int i = 0; i < this->lookup_count; i++)
this->accels[i].fini (); this->accels[i].fini ();

View File

@ -145,7 +145,7 @@ typedef SortedArrayOf<GlyphID> ExtenderGlyphs;
struct JstfScript struct JstfScript
{ {
unsigned int get_lang_sys_count (void) const unsigned int get_lang_sys_count () const
{ return langSys.len; } { return langSys.len; }
const Tag& get_lang_sys_tag (unsigned int i) const const Tag& get_lang_sys_tag (unsigned int i) const
{ return langSys.get_tag (i); } { return langSys.get_tag (i); }
@ -161,8 +161,8 @@ struct JstfScript
bool find_lang_sys_index (hb_tag_t tag, unsigned int *index) const bool find_lang_sys_index (hb_tag_t tag, unsigned int *index) const
{ return langSys.find_index (tag, index); } { return langSys.find_index (tag, index); }
bool has_default_lang_sys (void) const { return defaultLangSys != 0; } bool has_default_lang_sys () const { return defaultLangSys != 0; }
const JstfLangSys& get_default_lang_sys (void) const { return this+defaultLangSys; } const JstfLangSys& get_default_lang_sys () const { return this+defaultLangSys; }
bool sanitize (hb_sanitize_context_t *c, bool sanitize (hb_sanitize_context_t *c,
const Record_sanitize_closure_t * = nullptr) const const Record_sanitize_closure_t * = nullptr) const
@ -197,7 +197,7 @@ struct JSTF
{ {
enum { tableTag = HB_OT_TAG_JSTF }; enum { tableTag = HB_OT_TAG_JSTF };
unsigned int get_script_count (void) const unsigned int get_script_count () const
{ return scriptList.len; } { return scriptList.len; }
const Tag& get_script_tag (unsigned int i) const const Tag& get_script_tag (unsigned int i) const
{ return scriptList.get_tag (i); } { return scriptList.get_tag (i); }

View File

@ -68,7 +68,7 @@ hb_ot_map_builder_t::hb_ot_map_builder_t (hb_face_t *face_,
} }
} }
hb_ot_map_builder_t::~hb_ot_map_builder_t (void) hb_ot_map_builder_t::~hb_ot_map_builder_t ()
{ {
feature_infos.fini (); feature_infos.fini ();
for (unsigned int table_index = 0; table_index < 2; table_index++) for (unsigned int table_index = 0; table_index < 2; table_index++)

View File

@ -83,7 +83,7 @@ struct hb_ot_map_t
pause_func_t pause_func; pause_func_t pause_func;
}; };
void init (void) void init ()
{ {
memset (this, 0, sizeof (*this)); memset (this, 0, sizeof (*this));
@ -94,7 +94,7 @@ struct hb_ot_map_t
stages[table_index].init (); stages[table_index].init ();
} }
} }
void fini (void) void fini ()
{ {
features.fini (); features.fini ();
for (unsigned int table_index = 0; table_index < 2; table_index++) for (unsigned int table_index = 0; table_index < 2; table_index++)
@ -104,7 +104,7 @@ struct hb_ot_map_t
} }
} }
hb_mask_t get_global_mask (void) const { return global_mask; } hb_mask_t get_global_mask () const { return global_mask; }
hb_mask_t get_mask (hb_tag_t feature_tag, unsigned int *shift = nullptr) const hb_mask_t get_mask (hb_tag_t feature_tag, unsigned int *shift = nullptr) const
{ {
@ -203,7 +203,7 @@ struct hb_ot_map_builder_t
HB_INTERNAL hb_ot_map_builder_t (hb_face_t *face_, HB_INTERNAL hb_ot_map_builder_t (hb_face_t *face_,
const hb_segment_properties_t *props_); const hb_segment_properties_t *props_);
HB_INTERNAL ~hb_ot_map_builder_t (void); HB_INTERNAL ~hb_ot_map_builder_t ();
HB_INTERNAL void add_feature (hb_tag_t tag, HB_INTERNAL void add_feature (hb_tag_t tag,
hb_ot_map_feature_flags_t flags=F_NONE, hb_ot_map_feature_flags_t flags=F_NONE,

View File

@ -543,8 +543,7 @@ struct MathGlyphConstruction
mathGlyphVariantRecord.sanitize (c)); mathGlyphVariantRecord.sanitize (c));
} }
const MathGlyphAssembly &get_assembly (void) const const MathGlyphAssembly &get_assembly () const { return this+glyphAssembly; }
{ return this+glyphAssembly; }
unsigned int get_variants (hb_direction_t direction, unsigned int get_variants (hb_direction_t direction,
hb_font_t *font, hb_font_t *font,
@ -682,7 +681,7 @@ struct MATH
{ {
enum { tableTag = HB_OT_TAG_MATH }; enum { tableTag = HB_OT_TAG_MATH };
bool has_data (void) const { return version.to_int (); } bool has_data () const { return version.to_int (); }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {
@ -698,11 +697,9 @@ struct MATH
hb_font_t *font) const hb_font_t *font) const
{ return (this+mathConstants).get_value (constant, font); } { return (this+mathConstants).get_value (constant, font); }
const MathGlyphInfo &get_glyph_info (void) const const MathGlyphInfo &get_glyph_info () const { return this+mathGlyphInfo; }
{ return this+mathGlyphInfo; }
const MathVariants &get_variants (void) const const MathVariants &get_variants () const { return this+mathVariants; }
{ return this+mathVariants; }
protected: protected:
FixedVersion<>version; /* Version of the MATH table FixedVersion<>version; /* Version of the MATH table

View File

@ -73,10 +73,7 @@ struct maxp
{ {
enum { tableTag = HB_OT_TAG_maxp }; enum { tableTag = HB_OT_TAG_maxp };
unsigned int get_num_glyphs (void) const unsigned int get_num_glyphs () const { return numGlyphs; }
{
return numGlyphs;
}
void set_num_glyphs (unsigned int count) void set_num_glyphs (unsigned int count)
{ {

View File

@ -66,7 +66,7 @@ struct NameRecord
return HB_LANGUAGE_INVALID; return HB_LANGUAGE_INVALID;
} }
uint16_t score (void) const uint16_t score () const
{ {
/* Same order as in cmap::find_best_subtable(). */ /* Same order as in cmap::find_best_subtable(). */
unsigned int p = platformID; unsigned int p = platformID;
@ -153,7 +153,7 @@ struct name
{ {
enum { tableTag = HB_OT_TAG_name }; enum { tableTag = HB_OT_TAG_name };
unsigned int get_size (void) const unsigned int get_size () const
{ return min_size + count * nameRecordZ.item_size; } { return min_size + count * nameRecordZ.item_size; }
bool sanitize_records (hb_sanitize_context_t *c) const bool sanitize_records (hb_sanitize_context_t *c) const
@ -218,7 +218,7 @@ struct name
this->names.resize (j); this->names.resize (j);
} }
void fini (void) void fini ()
{ {
this->names.fini (); this->names.fini ();
this->table.destroy (); this->table.destroy ();

View File

@ -94,11 +94,11 @@ struct OS2
{ {
enum { tableTag = HB_OT_TAG_OS2 }; enum { tableTag = HB_OT_TAG_OS2 };
bool has_data (void) const { return this != &Null (OS2); } bool has_data () const { return this != &Null (OS2); }
const OS2V1Tail &v1 (void) const { return version >= 1 ? v1X : Null (OS2V1Tail); } const OS2V1Tail &v1 () const { return version >= 1 ? v1X : Null (OS2V1Tail); }
const OS2V2Tail &v2 (void) const { return version >= 2 ? v2X : Null (OS2V2Tail); } const OS2V2Tail &v2 () const { return version >= 2 ? v2X : Null (OS2V2Tail); }
const OS2V5Tail &v5 (void) const { return version >= 5 ? v5X : Null (OS2V5Tail); } const OS2V5Tail &v5 () const { return version >= 5 ? v5X : Null (OS2V5Tail); }
enum selection_flag_t { enum selection_flag_t {
ITALIC = 1u<<0, ITALIC = 1u<<0,
@ -113,9 +113,9 @@ struct OS2
OBLIQUE = 1u<<9 OBLIQUE = 1u<<9
}; };
bool is_italic (void) const { return fsSelection & ITALIC; } bool is_italic () const { return fsSelection & ITALIC; }
bool is_oblique (void) const { return fsSelection & OBLIQUE; } bool is_oblique () const { return fsSelection & OBLIQUE; }
bool is_typo_metrics (void) const { return fsSelection & USE_TYPO_METRICS; } bool is_typo_metrics () const { return fsSelection & USE_TYPO_METRICS; }
enum width_class_t { enum width_class_t {
FWIDTH_ULTRA_CONDENSED = 1, /* 50% */ FWIDTH_ULTRA_CONDENSED = 1, /* 50% */
@ -129,7 +129,7 @@ struct OS2
FWIDTH_ULTRA_EXPANDED = 9 /* 200% */ FWIDTH_ULTRA_EXPANDED = 9 /* 200% */
}; };
float get_width (void) const float get_width () const
{ {
switch (usWidthClass) { switch (usWidthClass) {
case FWIDTH_ULTRA_CONDENSED:return 50.f; case FWIDTH_ULTRA_CONDENSED:return 50.f;
@ -215,7 +215,7 @@ struct OS2
}; };
// https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681 // https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681
font_page_t get_font_page (void) const font_page_t get_font_page () const
{ return (font_page_t) (version == 0 ? fsSelection & 0xFF00 : 0); } { return (font_page_t) (version == 0 ? fsSelection & 0xFF00 : 0); }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const

View File

@ -118,7 +118,7 @@ struct post
data += 1 + *data) data += 1 + *data)
index_to_offset.push (data - pool); index_to_offset.push (data - pool);
} }
void fini (void) void fini ()
{ {
index_to_offset.fini (); index_to_offset.fini ();
free (gids_sorted_by_name.get ()); free (gids_sorted_by_name.get ());
@ -180,7 +180,7 @@ struct post
protected: protected:
unsigned int get_glyph_count (void) const unsigned int get_glyph_count () const
{ {
if (version == 0x00010000) if (version == 0x00010000)
return NUM_FORMAT1_NAMES; return NUM_FORMAT1_NAMES;

View File

@ -189,7 +189,7 @@ hb_ot_shape_plan_t::init0 (hb_face_t *face,
} }
void void
hb_ot_shape_plan_t::fini (void) hb_ot_shape_plan_t::fini ()
{ {
if (shaper->data_destroy) if (shaper->data_destroy)
shaper->data_destroy (const_cast<void *> (data)); shaper->data_destroy (const_cast<void *> (data));

View File

@ -98,7 +98,7 @@ struct hb_ot_shape_plan_t
HB_INTERNAL bool init0 (hb_face_t *face, HB_INTERNAL bool init0 (hb_face_t *face,
const hb_shape_plan_key_t *key); const hb_shape_plan_key_t *key);
HB_INTERNAL void fini (void); HB_INTERNAL void fini ();
HB_INTERNAL void substitute (hb_font_t *font, hb_buffer_t *buffer) const; HB_INTERNAL void substitute (hb_font_t *font, hb_buffer_t *buffer) const;
HB_INTERNAL void position (hb_font_t *font, hb_buffer_t *buffer) const; HB_INTERNAL void position (hb_font_t *font, hb_buffer_t *buffer) const;

View File

@ -503,7 +503,7 @@ hb_ot_tags_to_script_and_language (hb_tag_t script_tag,
#ifdef MAIN #ifdef MAIN
static inline void static inline void
test_langs_sorted (void) test_langs_sorted ()
{ {
for (unsigned int i = 1; i < ARRAY_LENGTH (ot_languages); i++) for (unsigned int i = 1; i < ARRAY_LENGTH (ot_languages); i++)
{ {
@ -518,7 +518,7 @@ test_langs_sorted (void)
} }
int int
main (void) main ()
{ {
test_langs_sorted (); test_langs_sorted ();
return 0; return 0;

View File

@ -98,7 +98,7 @@ struct fvar
{ {
enum { tableTag = HB_OT_TAG_fvar }; enum { tableTag = HB_OT_TAG_fvar };
bool has_data (void) const { return version.to_int (); } bool has_data () const { return version.to_int (); }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const
{ {
@ -112,7 +112,7 @@ struct fvar
c->check_range (get_instance (0), instanceCount, instanceSize)); c->check_range (get_instance (0), instanceCount, instanceSize));
} }
unsigned int get_axis_count (void) const { return axisCount; } unsigned int get_axis_count () const { return axisCount; }
void get_axis_deprecated (unsigned int axis_index, void get_axis_deprecated (unsigned int axis_index,
hb_ot_var_axis_t *info) const hb_ot_var_axis_t *info) const
@ -234,8 +234,7 @@ struct fvar
return (int) (v * 16384.f + (v >= 0.f ? .5f : -.5f)); return (int) (v * 16384.f + (v >= 0.f ? .5f : -.5f));
} }
unsigned int get_instance_count (void) const unsigned int get_instance_count () const { return instanceCount; }
{ return instanceCount; }
hb_ot_name_id_t get_instance_subfamily_name_id (unsigned int instance_index) const hb_ot_name_id_t get_instance_subfamily_name_id (unsigned int instance_index) const
{ {
@ -276,7 +275,7 @@ struct fvar
} }
protected: protected:
hb_array_t<const AxisRecord> get_axes (void) const hb_array_t<const AxisRecord> get_axes () const
{ return hb_array (&(this+firstAxis), axisCount); } { return hb_array (&(this+firstAxis), axisCount); }
const InstanceRecord *get_instance (unsigned int i) const const InstanceRecord *get_instance (unsigned int i) const

View File

@ -73,11 +73,9 @@ struct DeltaSetIndexMap
} }
protected: protected:
unsigned int get_width (void) const unsigned int get_width () const { return ((format >> 4) & 3) + 1; }
{ return ((format >> 4) & 3) + 1; }
unsigned int get_inner_bitcount (void) const unsigned int get_inner_bitcount () const { return (format & 0xF) + 1; }
{ return (format & 0xF) + 1; }
protected: protected:
HBUINT16 format; /* A packed field that describes the compressed HBUINT16 format; /* A packed field that describes the compressed
@ -123,8 +121,7 @@ struct HVARVVAR
return (this+varStore).get_delta (varidx, coords, coord_count); return (this+varStore).get_delta (varidx, coords, coord_count);
} }
bool has_sidebearing_deltas (void) const bool has_sidebearing_deltas () const { return lsbMap && rsbMap; }
{ return lsbMap && rsbMap; }
protected: protected:
FixedVersion<>version; /* Version of the metrics variation table FixedVersion<>version; /* Version of the metrics variation table

View File

@ -59,7 +59,7 @@ struct VORG
{ {
enum { tableTag = HB_OT_TAG_VORG }; enum { tableTag = HB_OT_TAG_VORG };
bool has_data (void) const { return version.to_int (); } bool has_data () const { return version.to_int (); }
int get_y_origin (hb_codepoint_t glyph) const int get_y_origin (hb_codepoint_t glyph) const
{ {

View File

@ -61,7 +61,7 @@ struct hb_set_digest_lowest_bits_t
static_assert ((shift < sizeof (hb_codepoint_t) * 8), ""); static_assert ((shift < sizeof (hb_codepoint_t) * 8), "");
static_assert ((shift + num_bits <= sizeof (hb_codepoint_t) * 8), ""); static_assert ((shift + num_bits <= sizeof (hb_codepoint_t) * 8), "");
void init (void) { mask = 0; } void init () { mask = 0; }
void add (hb_codepoint_t g) { mask |= mask_for (g); } void add (hb_codepoint_t g) { mask |= mask_for (g); }
@ -110,7 +110,7 @@ struct hb_set_digest_lowest_bits_t
template <typename head_t, typename tail_t> template <typename head_t, typename tail_t>
struct hb_set_digest_combiner_t struct hb_set_digest_combiner_t
{ {
void init (void) void init ()
{ {
head.init (); head.init ();
tail.init (); tail.init ();

View File

@ -47,7 +47,7 @@
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_set_t * hb_set_t *
hb_set_create (void) hb_set_create ()
{ {
hb_set_t *set; hb_set_t *set;
@ -67,7 +67,7 @@ hb_set_create (void)
* Since: 0.9.2 * Since: 0.9.2
**/ **/
hb_set_t * hb_set_t *
hb_set_get_empty (void) hb_set_get_empty ()
{ {
return const_cast<hb_set_t *> (&Null(hb_set_t)); return const_cast<hb_set_t *> (&Null(hb_set_t));
} }

View File

@ -40,8 +40,8 @@
struct hb_set_t struct hb_set_t
{ {
HB_NO_COPY_ASSIGN (hb_set_t); HB_NO_COPY_ASSIGN (hb_set_t);
hb_set_t (void) { init (); } hb_set_t () { init (); }
~hb_set_t (void) { fini (); } ~hb_set_t () { fini (); }
struct page_map_t struct page_map_t
{ {
@ -53,13 +53,13 @@ struct hb_set_t
struct page_t struct page_t
{ {
void init0 (void) { v.clear (); } void init0 () { v.clear (); }
void init1 (void) { v.clear (0xFF); } void init1 () { v.clear (0xFF); }
unsigned int len (void) const unsigned int len () const
{ return ARRAY_LENGTH_CONST (v); } { return ARRAY_LENGTH_CONST (v); }
bool is_empty (void) const bool is_empty () const
{ {
for (unsigned int i = 0; i < len (); i++) for (unsigned int i = 0; i < len (); i++)
if (v[i]) if (v[i])
@ -93,7 +93,7 @@ struct hb_set_t
return 0 == hb_memcmp (&v, &other->v, sizeof (v)); return 0 == hb_memcmp (&v, &other->v, sizeof (v));
} }
unsigned int get_population (void) const unsigned int get_population () const
{ {
unsigned int pop = 0; unsigned int pop = 0;
for (unsigned int i = 0; i < len (); i++) for (unsigned int i = 0; i < len (); i++)
@ -145,14 +145,14 @@ struct hb_set_t
*codepoint = INVALID; *codepoint = INVALID;
return false; return false;
} }
hb_codepoint_t get_min (void) const hb_codepoint_t get_min () const
{ {
for (unsigned int i = 0; i < len (); i++) for (unsigned int i = 0; i < len (); i++)
if (v[i]) if (v[i])
return i * ELT_BITS + elt_get_min (v[i]); return i * ELT_BITS + elt_get_min (v[i]);
return INVALID; return INVALID;
} }
hb_codepoint_t get_max (void) const hb_codepoint_t get_max () const
{ {
for (int i = len () - 1; i >= 0; i--) for (int i = len () - 1; i >= 0; i--)
if (v[i]) if (v[i])
@ -189,25 +189,25 @@ struct hb_set_t
hb_vector_t<page_map_t, 1> page_map; hb_vector_t<page_map_t, 1> page_map;
hb_vector_t<page_t, 1> pages; hb_vector_t<page_t, 1> pages;
void init_shallow (void) void init_shallow ()
{ {
successful = true; successful = true;
population = 0; population = 0;
page_map.init (); page_map.init ();
pages.init (); pages.init ();
} }
void init (void) void init ()
{ {
hb_object_init (this); hb_object_init (this);
init_shallow (); init_shallow ();
} }
void fini_shallow (void) void fini_shallow ()
{ {
population = 0; population = 0;
page_map.fini (); page_map.fini ();
pages.fini (); pages.fini ();
} }
void fini (void) void fini ()
{ {
hb_object_fini (this); hb_object_fini (this);
fini_shallow (); fini_shallow ();
@ -225,7 +225,7 @@ struct hb_set_t
return true; return true;
} }
void clear (void) void clear ()
{ {
if (unlikely (hb_object_is_immutable (this))) if (unlikely (hb_object_is_immutable (this)))
return; return;
@ -234,7 +234,7 @@ struct hb_set_t
page_map.resize (0); page_map.resize (0);
pages.resize (0); pages.resize (0);
} }
bool is_empty (void) const bool is_empty () const
{ {
unsigned int count = pages.len; unsigned int count = pages.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
@ -243,7 +243,7 @@ struct hb_set_t
return true; return true;
} }
void dirty (void) { population = (unsigned int) -1; } void dirty () { population = (unsigned int) -1; }
void add (hb_codepoint_t g) void add (hb_codepoint_t g)
{ {
@ -634,7 +634,7 @@ struct hb_set_t
return true; return true;
} }
unsigned int get_population (void) const unsigned int get_population () const
{ {
if (population != (unsigned int) -1) if (population != (unsigned int) -1)
return population; return population;
@ -647,7 +647,7 @@ struct hb_set_t
population = pop; population = pop;
return pop; return pop;
} }
hb_codepoint_t get_min (void) const hb_codepoint_t get_min () const
{ {
unsigned int count = pages.len; unsigned int count = pages.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
@ -655,7 +655,7 @@ struct hb_set_t
return page_map[i].major * page_t::PAGE_BITS + page_at (i).get_min (); return page_map[i].major * page_t::PAGE_BITS + page_at (i).get_min ();
return INVALID; return INVALID;
} }
hb_codepoint_t get_max (void) const hb_codepoint_t get_max () const
{ {
unsigned int count = pages.len; unsigned int count = pages.len;
for (int i = count - 1; i >= 0; i++) for (int i = count - 1; i >= 0; i++)

View File

@ -247,7 +247,7 @@ bail:
* Since: 0.9.7 * Since: 0.9.7
**/ **/
hb_shape_plan_t * hb_shape_plan_t *
hb_shape_plan_get_empty (void) hb_shape_plan_get_empty ()
{ {
return const_cast<hb_shape_plan_t *> (&Null(hb_shape_plan_t)); return const_cast<hb_shape_plan_t *> (&Null(hb_shape_plan_t));
} }

View File

@ -53,10 +53,7 @@ struct hb_shape_plan_key_t
unsigned int num_coords, unsigned int num_coords,
const char * const *shaper_list); const char * const *shaper_list);
HB_INTERNAL inline void free (void) HB_INTERNAL inline void free () { ::free ((void *) user_features); }
{
::free ((void *) user_features);
}
HB_INTERNAL bool user_features_match (const hb_shape_plan_key_t *other); HB_INTERNAL bool user_features_match (const hb_shape_plan_key_t *other);

View File

@ -49,7 +49,7 @@
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_shaper_list (void); static void free_static_shaper_list ();
#endif #endif
static const char *nil_shaper_list[] = {nullptr}; static const char *nil_shaper_list[] = {nullptr};
@ -57,7 +57,7 @@ static const char *nil_shaper_list[] = {nullptr};
static struct hb_shaper_list_lazy_loader_t : hb_lazy_loader_t<const char *, static struct hb_shaper_list_lazy_loader_t : hb_lazy_loader_t<const char *,
hb_shaper_list_lazy_loader_t> hb_shaper_list_lazy_loader_t>
{ {
static const char ** create (void) static const char ** create ()
{ {
const char **shaper_list = (const char **) calloc (1 + HB_SHAPERS_COUNT, sizeof (const char *)); const char **shaper_list = (const char **) calloc (1 + HB_SHAPERS_COUNT, sizeof (const char *));
if (unlikely (!shaper_list)) if (unlikely (!shaper_list))
@ -77,13 +77,13 @@ static struct hb_shaper_list_lazy_loader_t : hb_lazy_loader_t<const char *,
} }
static void destroy (const char **l) static void destroy (const char **l)
{ free (l); } { free (l); }
static const char ** get_null (void) static const char ** get_null ()
{ return nil_shaper_list; } { return nil_shaper_list; }
} static_shaper_list; } static_shaper_list;
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_shaper_list (void) void free_static_shaper_list ()
{ {
static_shaper_list.free_instance (); static_shaper_list.free_instance ();
} }
@ -101,7 +101,7 @@ void free_static_shaper_list (void)
* Since: 0.9.2 * Since: 0.9.2
**/ **/
const char ** const char **
hb_shape_list_shapers (void) hb_shape_list_shapers ()
{ {
return static_shaper_list.get_unconst (); return static_shaper_list.get_unconst ();
} }

View File

@ -36,13 +36,13 @@ static const hb_shaper_entry_t all_shapers[] = {
}; };
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static void free_static_shapers (void); static void free_static_shapers ();
#endif #endif
static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_entry_t, static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_entry_t,
hb_shapers_lazy_loader_t> hb_shapers_lazy_loader_t>
{ {
static hb_shaper_entry_t *create (void) static hb_shaper_entry_t *create ()
{ {
char *env = getenv ("HB_SHAPER_LIST"); char *env = getenv ("HB_SHAPER_LIST");
if (!env || !*env) if (!env || !*env)
@ -86,22 +86,20 @@ static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_entry_
return shapers; return shapers;
} }
static void destroy (const hb_shaper_entry_t *p) static void destroy (const hb_shaper_entry_t *p) { free ((void *) p); }
{ free ((void *) p); } static const hb_shaper_entry_t *get_null () { return all_shapers; }
static const hb_shaper_entry_t *get_null (void)
{ return all_shapers; }
} static_shapers; } static_shapers;
#if HB_USE_ATEXIT #if HB_USE_ATEXIT
static static
void free_static_shapers (void) void free_static_shapers ()
{ {
static_shapers.free_instance (); static_shapers.free_instance ();
} }
#endif #endif
const hb_shaper_entry_t * const hb_shaper_entry_t *
_hb_shapers_get (void) _hb_shapers_get ()
{ {
return static_shapers.get_unconst (); return static_shapers.get_unconst ();
} }

View File

@ -47,7 +47,7 @@ struct hb_shaper_entry_t {
}; };
HB_INTERNAL const hb_shaper_entry_t * HB_INTERNAL const hb_shaper_entry_t *
_hb_shapers_get (void); _hb_shapers_get ();
template <typename Data, unsigned int WheresData, typename T> template <typename Data, unsigned int WheresData, typename T>
@ -98,7 +98,7 @@ template <enum hb_shaper_order_t order, typename Object> struct hb_shaper_object
typedef HB_SHAPER_DATA_TYPE(shaper, object) Type; \ typedef HB_SHAPER_DATA_TYPE(shaper, object) Type; \
static Type* create (hb_##object##_t *data) \ static Type* create (hb_##object##_t *data) \
{ return HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (data); } \ { return HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (data); } \
static Type *get_null (void) { return nullptr; } \ static Type *get_null () { return nullptr; } \
static void destroy (Type *p) { HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (p); } \ static void destroy (Type *p) { HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (p); } \
}; \ }; \
\ \
@ -115,7 +115,7 @@ struct hb_shaper_object_dataset_t
#include "hb-shaper-list.hh" #include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT #undef HB_SHAPER_IMPLEMENT
} }
void fini (void) void fini ()
{ {
#define HB_SHAPER_IMPLEMENT(shaper) shaper.fini (); #define HB_SHAPER_IMPLEMENT(shaper) shaper.fini ();
#include "hb-shaper-list.hh" #include "hb-shaper-list.hh"

View File

@ -51,7 +51,7 @@ const unsigned char _hb_Null_AAT_Lookup[2] = {0xFF, 0xFF};
unsigned int unsigned int
hb_face_t::load_num_glyphs (void) const hb_face_t::load_num_glyphs () const
{ {
hb_sanitize_context_t c = hb_sanitize_context_t (); hb_sanitize_context_t c = hb_sanitize_context_t ();
c.set_num_glyphs (0); /* So we don't recurse ad infinitum. */ c.set_num_glyphs (0); /* So we don't recurse ad infinitum. */
@ -65,7 +65,7 @@ hb_face_t::load_num_glyphs (void) const
} }
unsigned int unsigned int
hb_face_t::load_upem (void) const hb_face_t::load_upem () const
{ {
unsigned int ret = table.head->get_upem (); unsigned int ret = table.head->get_upem ();
upem.set_relaxed (ret); upem.set_relaxed (ret);

View File

@ -38,13 +38,9 @@ namespace CFF {
struct StrEncoder struct StrEncoder
{ {
StrEncoder (StrBuff &buff_) StrEncoder (StrBuff &buff_)
: buff (buff_), error (false) : buff (buff_), error (false) {}
{}
void reset (void) void reset () { buff.resize (0); }
{
buff.resize (0);
}
void encode_byte (unsigned char b) void encode_byte (unsigned char b)
{ {
@ -123,19 +119,17 @@ struct StrEncoder
memcpy (&buff[offset], &str.str[0], str.len); memcpy (&buff[offset], &str.str[0], str.len);
} }
bool is_error (void) const { return error; } bool is_error () const { return error; }
protected: protected:
void set_error (void) { error = true; } void set_error () { error = true; }
StrBuff &buff; StrBuff &buff;
bool error; bool error;
}; };
struct CFFSubTableOffsets { struct CFFSubTableOffsets {
CFFSubTableOffsets (void) CFFSubTableOffsets () : privateDictsOffset (0)
: privateDictsOffset (0)
{ {
topDictInfo.init (); topDictInfo.init ();
FDSelectInfo.init (); FDSelectInfo.init ();
@ -145,10 +139,7 @@ struct CFFSubTableOffsets {
localSubrsInfos.init (); localSubrsInfos.init ();
} }
~CFFSubTableOffsets (void) ~CFFSubTableOffsets () { localSubrsInfos.fini (); }
{
localSubrsInfos.fini ();
}
TableInfo topDictInfo; TableInfo topDictInfo;
TableInfo FDSelectInfo; TableInfo FDSelectInfo;
@ -331,12 +322,8 @@ struct SubrFlattener
struct SubrClosures struct SubrClosures
{ {
SubrClosures (void) SubrClosures () : valid (false), global_closure (nullptr)
: valid (false), { local_closures.init (); }
global_closure (nullptr)
{
local_closures.init ();
}
void init (unsigned int fd_count) void init (unsigned int fd_count)
{ {
@ -355,7 +342,7 @@ struct SubrClosures
} }
} }
void fini (void) void fini ()
{ {
hb_set_destroy (global_closure); hb_set_destroy (global_closure);
for (unsigned int i = 0; i < local_closures.len; i++) for (unsigned int i = 0; i < local_closures.len; i++)
@ -363,14 +350,14 @@ struct SubrClosures
local_closures.fini (); local_closures.fini ();
} }
void reset (void) void reset ()
{ {
hb_set_clear (global_closure); hb_set_clear (global_closure);
for (unsigned int i = 0; i < local_closures.len; i++) for (unsigned int i = 0; i < local_closures.len; i++)
hb_set_clear (local_closures[i]); hb_set_clear (local_closures[i]);
} }
bool is_valid (void) const { return valid; } bool is_valid () const { return valid; }
bool valid; bool valid;
hb_set_t *global_closure; hb_set_t *global_closure;
hb_vector_t<hb_set_t *> local_closures; hb_vector_t<hb_set_t *> local_closures;
@ -387,17 +374,16 @@ struct ParsedCSOp : OpStr
skip_flag = false; skip_flag = false;
} }
void fini (void) void fini () { OpStr::fini (); }
{
OpStr::fini ();
}
bool for_drop (void) const { return drop_flag; } bool for_drop () const { return drop_flag; }
void set_drop (void) { if (!for_keep ()) drop_flag = true; } void set_drop () { if (!for_keep ()) drop_flag = true; }
bool for_keep (void) const { return keep_flag; }
void set_keep (void) { keep_flag = true; } bool for_keep () const { return keep_flag; }
bool for_skip (void) const { return skip_flag; } void set_keep () { keep_flag = true; }
void set_skip (void) { skip_flag = true; }
bool for_skip () const { return skip_flag; }
void set_skip () { skip_flag = true; }
unsigned int subr_num; unsigned int subr_num;
@ -409,7 +395,7 @@ struct ParsedCSOp : OpStr
struct ParsedCStr : ParsedValues<ParsedCSOp> struct ParsedCStr : ParsedValues<ParsedCSOp>
{ {
void init (void) void init ()
{ {
SUPER::init (); SUPER::init ();
parsed = false; parsed = false;
@ -450,15 +436,18 @@ struct ParsedCStr : ParsedValues<ParsedCSOp>
|| (values[pos + 1].op == OpCode_return)); || (values[pos + 1].op == OpCode_return));
} }
bool is_parsed (void) const { return parsed; } bool is_parsed () const { return parsed; }
void set_parsed (void) { parsed = true; } void set_parsed () { parsed = true; }
bool is_hint_dropped (void) const { return hint_dropped; }
void set_hint_dropped (void) { hint_dropped = true; } bool is_hint_dropped () const { return hint_dropped; }
bool is_vsindex_dropped (void) const { return vsindex_dropped; } void set_hint_dropped () { hint_dropped = true; }
void set_vsindex_dropped (void) { vsindex_dropped = true; }
bool has_prefix (void) const { return has_prefix_; } bool is_vsindex_dropped () const { return vsindex_dropped; }
OpCode prefix_op (void) const { return prefix_op_; } void set_vsindex_dropped () { vsindex_dropped = true; }
const Number &prefix_num (void) const { return prefix_num_; }
bool has_prefix () const { return has_prefix_; }
OpCode prefix_op () const { return prefix_op_; }
const Number &prefix_num () const { return prefix_num_; }
protected: protected:
bool parsed; bool parsed;
@ -481,7 +470,7 @@ struct ParsedCStrs : hb_vector_t<ParsedCStr>
for (unsigned int i = 0; i < len; i++) for (unsigned int i = 0; i < len; i++)
(*this)[i].init (); (*this)[i].init ();
} }
void fini (void) { SUPER::fini_deep (); } void fini () { SUPER::fini_deep (); }
private: private:
typedef hb_vector_t<ParsedCStr> SUPER; typedef hb_vector_t<ParsedCStr> SUPER;
@ -593,13 +582,13 @@ struct SubrRemap : Remap
struct SubrRemaps struct SubrRemaps
{ {
SubrRemaps (void) SubrRemaps ()
{ {
global_remap.init (); global_remap.init ();
local_remaps.init (); local_remaps.init ();
} }
~SubrRemaps (void) { fini (); } ~SubrRemaps () { fini (); }
void init (unsigned int fdCount) void init (unsigned int fdCount)
{ {
@ -615,7 +604,7 @@ struct SubrRemaps
local_remaps[i].create (closures.local_closures[i]); local_remaps[i].create (closures.local_closures[i]);
} }
void fini (void) void fini ()
{ {
global_remap.fini (); global_remap.fini ();
local_remaps.fini_deep (); local_remaps.fini_deep ();
@ -628,14 +617,14 @@ struct SubrRemaps
template <typename SUBSETTER, typename SUBRS, typename ACC, typename ENV, typename OPSET> template <typename SUBSETTER, typename SUBRS, typename ACC, typename ENV, typename OPSET>
struct SubrSubsetter struct SubrSubsetter
{ {
SubrSubsetter (void) SubrSubsetter ()
{ {
parsed_charstrings.init (); parsed_charstrings.init ();
parsed_global_subrs.init (); parsed_global_subrs.init ();
parsed_local_subrs.init (); parsed_local_subrs.init ();
} }
~SubrSubsetter (void) ~SubrSubsetter ()
{ {
closures.fini (); closures.fini ();
remaps.fini (); remaps.fini ();
@ -788,7 +777,7 @@ struct SubrSubsetter
protected: protected:
struct DropHintsParam struct DropHintsParam
{ {
DropHintsParam (void) DropHintsParam ()
: seen_moveto (false), : seen_moveto (false),
ends_in_hint (false), ends_in_hint (false),
vsindex_dropped (false) {} vsindex_dropped (false) {}

View File

@ -61,7 +61,7 @@ struct RemapSID : Remap
struct CFF1SubTableOffsets : CFFSubTableOffsets struct CFF1SubTableOffsets : CFFSubTableOffsets
{ {
CFF1SubTableOffsets (void) CFF1SubTableOffsets ()
: CFFSubTableOffsets (), : CFFSubTableOffsets (),
nameIndexOffset (0), nameIndexOffset (0),
encodingOffset (0) encodingOffset (0)
@ -87,12 +87,9 @@ struct CFF1TopDictValuesMod : CFF1TopDictValues
base = base_; base = base_;
} }
void fini (void) { SUPER::fini (); } void fini () { SUPER::fini (); }
unsigned get_count (void) const unsigned get_count () const { return base->get_count () + SUPER::get_count (); }
{
return base->get_count () + SUPER::get_count ();
}
const CFF1TopDictVal &get_value (unsigned int i) const const CFF1TopDictVal &get_value (unsigned int i) const
{ {
if (i < base->get_count ()) if (i < base->get_count ())
@ -228,10 +225,7 @@ struct FontDictValuesMod
privateDictInfo = privateDictInfo_; privateDictInfo = privateDictInfo_;
} }
unsigned get_count (void) const unsigned get_count () const { return base->get_count (); }
{
return base->get_count ();
}
const OpStr &operator [] (unsigned int i) const { return (*base)[i]; } const OpStr &operator [] (unsigned int i) const { return (*base)[i]; }
@ -423,7 +417,7 @@ struct CFF1SubrSubsetter : SubrSubsetter<CFF1SubrSubsetter, CFF1Subrs, const OT:
}; };
struct cff_subset_plan { struct cff_subset_plan {
cff_subset_plan (void) cff_subset_plan ()
: final_size (0), : final_size (0),
offsets (), offsets (),
orig_fdcount (0), orig_fdcount (0),
@ -449,7 +443,7 @@ struct cff_subset_plan {
topDictModSIDs[i] = CFF_UNDEF_SID; topDictModSIDs[i] = CFF_UNDEF_SID;
} }
~cff_subset_plan (void) ~cff_subset_plan ()
{ {
topdict_sizes.fini (); topdict_sizes.fini ();
topdict_mod.fini (); topdict_mod.fini ();
@ -828,7 +822,7 @@ struct cff_subset_plan {
&& (fontdicts_mod.len == subset_fdcount)); && (fontdicts_mod.len == subset_fdcount));
} }
unsigned int get_final_size (void) const { return final_size; } unsigned int get_final_size () const { return final_size; }
unsigned int final_size; unsigned int final_size;
hb_vector_t<unsigned int> topdict_sizes; hb_vector_t<unsigned int> topdict_sizes;

Some files were not shown because too many files have changed in this diff Show More