提交 92806ee0 编写于 作者: B Behdad Esfahbod

Move null data definitions to hb-static.cc

Also remove "    " null data for Tag.  Just use zeroes.
上级 1b4d5a24
...@@ -140,7 +140,6 @@ struct Tag : HBUINT32 ...@@ -140,7 +140,6 @@ struct Tag : HBUINT32
public: public:
DEFINE_SIZE_STATIC (4); DEFINE_SIZE_STATIC (4);
}; };
DEFINE_NULL_DATA (OT, Tag, " ");
/* Glyph index number, same as uint16 (length = 16 bits) */ /* Glyph index number, same as uint16 (length = 16 bits) */
typedef HBUINT16 GlyphID; typedef HBUINT16 GlyphID;
...@@ -152,7 +151,7 @@ typedef HBUINT16 NameID; ...@@ -152,7 +151,7 @@ typedef HBUINT16 NameID;
struct Index : HBUINT16 { struct Index : HBUINT16 {
static const unsigned int NOT_FOUND_INDEX = 0xFFFFu; static const unsigned int NOT_FOUND_INDEX = 0xFFFFu;
}; };
DEFINE_NULL_DATA (OT, Index, "\xff\xff"); DECLARE_NULL_NAMESPACE_BYTES (OT, Index);
/* Offset, Null offset = 0 */ /* Offset, Null offset = 0 */
template <typename Type> template <typename Type>
......
...@@ -173,7 +173,7 @@ struct RangeRecord ...@@ -173,7 +173,7 @@ struct RangeRecord
public: public:
DEFINE_SIZE_STATIC (6); DEFINE_SIZE_STATIC (6);
}; };
DEFINE_NULL_DATA (OT, RangeRecord, "\000\001"); DECLARE_NULL_NAMESPACE_BYTES (OT, RangeRecord);
struct IndexArray : ArrayOf<Index> struct IndexArray : ArrayOf<Index>
...@@ -240,8 +240,7 @@ struct LangSys ...@@ -240,8 +240,7 @@ struct LangSys
public: public:
DEFINE_SIZE_ARRAY (6, featureIndex); DEFINE_SIZE_ARRAY (6, featureIndex);
}; };
DEFINE_NULL_DATA (OT, LangSys, "\0\0\xFF\xFF"); DECLARE_NULL_NAMESPACE_BYTES (OT, LangSys);
struct Script struct Script
{ {
......
...@@ -391,16 +391,18 @@ static inline Type const & Null (void) { ...@@ -391,16 +391,18 @@ static inline Type const & Null (void) {
#define Null(Type) Null<Type>() #define Null(Type) Null<Type>()
/* Specializaiton for arbitrary-content arbitrary-sized Null objects. */ /* Specializaiton for arbitrary-content arbitrary-sized Null objects. */
#define DEFINE_NULL_DATA(Namespace, Type, data) \ #define DECLARE_NULL_NAMESPACE_BYTES(Namespace, Type) \
} /* Close namespace. */ \ } /* Close namespace. */ \
static const char _Null##Type[sizeof (Namespace::Type) + 1] = data; /* +1 is for nul-termination in data */ \ extern HB_INTERNAL const unsigned char _hb_Null_##Namespace##_##Type[sizeof (Namespace::Type)]; \
template <> \ template <> \
/*static*/ inline const Namespace::Type& Null<Namespace::Type> (void) { \ /*static*/ inline const Namespace::Type& Null<Namespace::Type> (void) { \
return *reinterpret_cast<const Namespace::Type *> (_Null##Type); \ return *reinterpret_cast<const Namespace::Type *> (_hb_Null_##Namespace##_##Type); \
} \ } \
namespace Namespace { \ namespace Namespace { \
/* The following line really exists such that we end in a place needing semicolon */ \ static_assert (Namespace::Type::min_size <= sizeof (Type), "Null pool too small. Enlarge."); \
static_assert (Namespace::Type::min_size + 1 <= sizeof (_Null##Type), "Null pool too small. Enlarge.")
#define DEFINE_NULL_NAMESPACE_BYTES(Namespace, Type) \
const unsigned char _hb_Null_##Namespace##_##Type[sizeof (Namespace::Type)]
/* Global writable pool. Enlarge as necessary. */ /* Global writable pool. Enlarge as necessary. */
......
...@@ -25,8 +25,11 @@ ...@@ -25,8 +25,11 @@
*/ */
#include "hb-private.hh" #include "hb-private.hh"
#include "hb-face-private.hh"
#include "hb-open-type-private.hh" #include "hb-open-type-private.hh"
#include "hb-ot-layout-common-private.hh"
#include "hb-face-private.hh"
#include "hb-ot-head-table.hh" #include "hb-ot-head-table.hh"
#include "hb-ot-maxp-table.hh" #include "hb-ot-maxp-table.hh"
...@@ -35,6 +38,11 @@ ...@@ -35,6 +38,11 @@
hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {}; hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {};
/*thread_local*/ hb_vector_size_impl_t _hb_CrapPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {}; /*thread_local*/ hb_vector_size_impl_t _hb_CrapPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_size_impl_t) - 1) / sizeof (hb_vector_size_impl_t)] = {};
DEFINE_NULL_NAMESPACE_BYTES (OT, Index) = {0xFF,0xFF};
DEFINE_NULL_NAMESPACE_BYTES (OT, LangSys) = {0x00,0x00, 0xFF,0xFF, 0x00,0x00};
DEFINE_NULL_NAMESPACE_BYTES (OT, RangeRecord) = {0x00,0x01, 0x00,0x00, 0x00, 0x00};
void void
hb_face_t::load_num_glyphs (void) const hb_face_t::load_num_glyphs (void) const
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册