X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..08b89b0a244153b9f5bbb2f49c55ab0f7298122e:/icuSources/layout/Lookups.cpp diff --git a/icuSources/layout/Lookups.cpp b/icuSources/layout/Lookups.cpp index af6ee209..d762fec4 100644 --- a/icuSources/layout/Lookups.cpp +++ b/icuSources/layout/Lookups.cpp @@ -1,7 +1,6 @@ /* - * @(#)Lookups.cpp 1.5 00/03/15 * - * (C) Copyright IBM Corp. 1998, 1999, 2000, 2001 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -13,33 +12,35 @@ U_NAMESPACE_BEGIN -const LookupTable *LookupListTable::getLookupTable(le_uint16 lookupTableIndex) const +const LEReferenceTo LookupListTable::getLookupTable(const LEReferenceTo &base, le_uint16 lookupTableIndex, LEErrorCode &success) const { - if (lookupTableIndex >= SWAPW(lookupCount)) { - return 0; - } + LEReferenceToArrayOf lookupTableOffsetArrayRef(base, success, (const Offset*)&lookupTableOffsetArray, SWAPW(lookupCount)); - Offset lookupTableOffset = lookupTableOffsetArray[lookupTableIndex]; - - return (const LookupTable *) ((char *) this + SWAPW(lookupTableOffset)); + if(LE_FAILURE(success) || lookupTableIndex>lookupTableOffsetArrayRef.getCount()) { + return LEReferenceTo(); + } else { + return LEReferenceTo(base, success, SWAPW(lookupTableOffsetArrayRef.getObject(lookupTableIndex, success))); + } } -const LookupSubtable *LookupTable::getLookupSubtable(le_uint16 subtableIndex) const +const LEReferenceTo LookupTable::getLookupSubtable(const LEReferenceTo &base, le_uint16 subtableIndex, LEErrorCode &success) const { - if (subtableIndex >= SWAPW(subTableCount)) { - return 0; - } - - Offset subtableOffset = subTableOffsetArray[subtableIndex]; + LEReferenceToArrayOf subTableOffsetArrayRef(base, success, (const Offset*)&subTableOffsetArray, SWAPW(subTableCount)); - return (const LookupSubtable *) ((char *) this + SWAPW(subtableOffset)); + if(LE_FAILURE(success) || subtableIndex>subTableOffsetArrayRef.getCount()) { + return LEReferenceTo(); + } else { + return LEReferenceTo(base, success, SWAPW(subTableOffsetArrayRef.getObject(subtableIndex, success))); + } } -le_int32 LookupSubtable::getGlyphCoverage(Offset tableOffset, LEGlyphID glyphID) const +le_int32 LookupSubtable::getGlyphCoverage(const LEReferenceTo &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const { - const CoverageTable *coverageTable = (const CoverageTable *) ((char *) this + SWAPW(tableOffset)); + const LEReferenceTo coverageTable(base, success, SWAPW(tableOffset)); + + if(LE_FAILURE(success)) return 0; - return coverageTable->getGlyphCoverage(glyphID); + return coverageTable->getGlyphCoverage(glyphID); } U_NAMESPACE_END