]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/layout/Features.cpp
ICU-57132.0.1.tar.gz
[apple/icu.git] / icuSources / layout / Features.cpp
index e1c81a1ac9b460b30871e791375c1cfb642721ba..0f964f7ae71d9bec693d3da817fa59a00046080d 100644 (file)
@@ -1,31 +1,35 @@
 /*
  * @(#)Features.cpp 1.4 00/03/15
  *
- * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1998-2015 - All Rights Reserved
  *
  */
 
 #include "LETypes.h"
 #include "OpenTypeUtilities.h"
 #include "OpenTypeTables.h"
-#include "Features.h"
+#include "ICUFeatures.h"
 #include "LESwaps.h"
 
 U_NAMESPACE_BEGIN
 
-const FeatureTable *FeatureListTable::getFeatureTable(le_uint16 featureIndex, LETag *featureTag) const
+LEReferenceTo<FeatureTable> FeatureListTable::getFeatureTable(const LETableReference &base, le_uint16 featureIndex, LETag *featureTag, LEErrorCode &success) const
 {
-    if (featureIndex >= SWAPW(featureCount)) {
-        return 0;
-    }
+    LEReferenceToArrayOf<FeatureRecord>
+        featureRecordArrayRef(base, success, featureRecordArray, featureIndex+1);
+
+  if (featureIndex >= SWAPW(featureCount) || LE_FAILURE(success)) {
+    return LEReferenceTo<FeatureTable>();
+  }
 
     Offset featureTableOffset = featureRecordArray[featureIndex].featureTableOffset;
 
     *featureTag = SWAPT(featureRecordArray[featureIndex].featureTag);
 
-    return (const FeatureTable *) ((char *) this + SWAPW(featureTableOffset));
+    return LEReferenceTo<FeatureTable>(base, success, SWAPW(featureTableOffset));
 }
 
+#if 0
 /*
  * Note: according to the OpenType Spec. v 1.4, the entries in the Feature
  * List Table are sorted alphabetically by feature tag; however, there seem
@@ -57,5 +61,6 @@ const FeatureTable *FeatureListTable::getFeatureTable(LETag featureTag) const
     return 0;
 #endif
 }
+#endif
 
 U_NAMESPACE_END