Remove GET_FOR_DATA macros

The major-version check is now handled by sanitize.  If major
doesn't match, we reject and fall back to the Null object.
diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh
index f45ba8f..a3efaf1 100644
--- a/src/hb-open-file-private.hh
+++ b/src/hb-open-file-private.hh
@@ -66,8 +66,6 @@
 {
   friend struct OpenTypeFontFile;
 
-  STATIC_DEFINE_GET_FOR_DATA (OffsetTable);
-
   inline unsigned int get_table_count (void) const
   { return numTables; }
   inline const Tag& get_table_tag (unsigned int i) const
@@ -201,8 +199,6 @@
   static const hb_tag_t TrueTypeTag	= HB_TAG ( 0 , 1 , 0 , 0 );
   static const hb_tag_t TTCTag		= HB_TAG ('t','t','c','f');
 
-  STATIC_DEFINE_GET_FOR_DATA (OpenTypeFontFile);
-
   inline hb_tag_t get_tag (void) const { return u.tag; }
 
   inline unsigned int get_face_count (void) const
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 1a11cd1..232a61e 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -107,25 +107,6 @@
 #define Null(Type) Null<Type>()
 
 
-/* get_for_data() is a static class method returning a reference to an
- * instance of Type located at the input data location.  It's just a
- * fancy, NULL-safe, cast! */
-#define STATIC_DEFINE_GET_FOR_DATA(Type) \
-  static inline const Type& get_for_data (const char *data) \
-  { \
-    if (HB_UNLIKELY (data == NULL)) return Null(Type); \
-    return Cast<Type> (*data); \
-  }
-/* Like get_for_data(), but checks major version first. */
-#define STATIC_DEFINE_GET_FOR_DATA_CHECK_MAJOR_VERSION(Type, MajorMin, MajorMax) \
-  static inline const Type& get_for_data (const char *data) \
-  { \
-    if (HB_UNLIKELY (data == NULL)) return Null(Type); \
-    const Type& t = Cast<Type> (*data); \
-    if (HB_UNLIKELY (t.version.major < MajorMin || t.version.major > MajorMax)) return Null(Type); \
-    return t; \
-  }
-
 
 /*
  * Sanitize
@@ -299,7 +280,7 @@
 
     _hb_sanitize_init (&context, blob);
 
-    /* We drop const here */
+    /* Note: We drop const here */
     Type *t = &Cast<Type> (* (char *) CharP(context.start));
 
     sane = t->sanitize (SANITIZE_ARG_INIT);
@@ -345,7 +326,7 @@
   }
 
   static const Type& lock_instance (hb_blob_t *blob) {
-    return Type::get_for_data (hb_blob_lock (blob));
+    return Cast<Type> (* (const char *) hb_blob_lock (blob));
   }
 };
 
diff --git a/src/hb-ot-layout-gdef-private.hh b/src/hb-ot-layout-gdef-private.hh
index 4de5740..14bef8c 100644
--- a/src/hb-ot-layout-gdef-private.hh
+++ b/src/hb-ot-layout-gdef-private.hh
@@ -314,8 +314,6 @@
     ComponentGlyph	= 4
   };
 
-  STATIC_DEFINE_GET_FOR_DATA_CHECK_MAJOR_VERSION (GDEF, 1, 1);
-
   inline bool has_glyph_classes () const { return glyphClassDef != 0; }
   inline hb_ot_layout_class_t get_glyph_class (hb_codepoint_t glyph) const
   { return (this+glyphClassDef).get_class (glyph); }
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 65937fb..73ac56d 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -1520,9 +1520,6 @@
 {
   static const hb_tag_t Tag	= HB_OT_TAG_GPOS;
 
-  static inline const GPOS& get_for_data (const char *data)
-  { return Cast<GPOS> (GSUBGPOS::get_for_data (data)); }
-
   inline const PosLookup& get_lookup (unsigned int i) const
   { return Cast<PosLookup> (GSUBGPOS::get_lookup (i)); }
 
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index 0d6bbc9..fc3bb29 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -855,9 +855,6 @@
 {
   static const hb_tag_t Tag	= HB_OT_TAG_GSUB;
 
-  static inline const GSUB& get_for_data (const char *data)
-  { return Cast<GSUB> (GSUBGPOS::get_for_data (data)); }
-
   inline const SubstLookup& get_lookup (unsigned int i) const
   { return Cast<SubstLookup> (GSUBGPOS::get_lookup (i)); }
 
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 74d9b04..73e6283 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -896,8 +896,6 @@
   static const hb_tag_t GSUBTag	= HB_OT_TAG_GSUB;
   static const hb_tag_t GPOSTag	= HB_OT_TAG_GPOS;
 
-  STATIC_DEFINE_GET_FOR_DATA_CHECK_MAJOR_VERSION (GSUBGPOS, 1, 1);
-
   inline unsigned int get_script_count (void) const
   { return (this+scriptList).len; }
   inline const Tag& get_script_tag (unsigned int i) const
diff --git a/src/main.cc b/src/main.cc
index b4123b5..badf91b 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -61,7 +61,7 @@
 
   printf ("Opened font file %s: %d bytes long\n", argv[1], len);
 
-  const OpenTypeFontFile &ot = OpenTypeFontFile::get_for_data (font_data);
+  const OpenTypeFontFile &ot = Cast<OpenTypeFontFile> (font_data);
 
   switch (ot.get_tag ()) {
   case OpenTypeFontFile::TrueTypeTag:
@@ -99,7 +99,7 @@
       case GSUBGPOS::GPOSTag:
 	{
 
-	const GSUBGPOS &g = GSUBGPOS::get_for_data ((const char *) &ot + table.offset);
+	const GSUBGPOS &g = Cast<GSUBGPOS> (font_data + table.offset);
 
 	int num_scripts = g.get_script_count ();
 	printf ("    %d script(s) found in table\n", num_scripts);
@@ -162,7 +162,7 @@
       case GDEF::Tag:
 	{
 
-	const GDEF &gdef = GDEF::get_for_data ((const char *) &ot + table.offset);
+	const GDEF &gdef = Cast<GDEF> (font_data + table.offset);
 
 	printf ("    Has %sglyph classes\n",
 		  gdef.has_glyph_classes () ? "" : "no ");