X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..ef6cf650f4a75c3f97de06b51fa104f2069b9ea2:/icuSources/layout/SegmentArrayProcessor.cpp?ds=inline diff --git a/icuSources/layout/SegmentArrayProcessor.cpp b/icuSources/layout/SegmentArrayProcessor.cpp index b915cb9b..a87a5ebd 100644 --- a/icuSources/layout/SegmentArrayProcessor.cpp +++ b/icuSources/layout/SegmentArrayProcessor.cpp @@ -1,6 +1,6 @@ /* * - * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2015 - All Rights Reserved * */ @@ -21,37 +21,37 @@ SegmentArrayProcessor::SegmentArrayProcessor() { } -SegmentArrayProcessor::SegmentArrayProcessor(const MorphSubtableHeader *morphSubtableHeader) - : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader) +SegmentArrayProcessor::SegmentArrayProcessor(const LEReferenceTo &morphSubtableHeader, LEErrorCode &success) + : NonContextualGlyphSubstitutionProcessor(morphSubtableHeader, success) { - const NonContextualGlyphSubstitutionHeader *header = (const NonContextualGlyphSubstitutionHeader *) morphSubtableHeader; - - segmentArrayLookupTable = (const SegmentArrayLookupTable *) &header->table; + LEReferenceTo header(morphSubtableHeader, success); + segmentArrayLookupTable = LEReferenceTo(morphSubtableHeader, success, (const SegmentArrayLookupTable*)&header->table); } SegmentArrayProcessor::~SegmentArrayProcessor() { } -void SegmentArrayProcessor::process(LEGlyphStorage &glyphStorage) +void SegmentArrayProcessor::process(LEGlyphStorage &glyphStorage, LEErrorCode &success) { const LookupSegment *segments = segmentArrayLookupTable->segments; le_int32 glyphCount = glyphStorage.getGlyphCount(); le_int32 glyph; + if (LE_FAILURE(success)) return; + for (glyph = 0; glyph < glyphCount; glyph += 1) { LEGlyphID thisGlyph = glyphStorage[glyph]; - const LookupSegment *lookupSegment = segmentArrayLookupTable->lookupSegment(segments, thisGlyph); + const LookupSegment *lookupSegment = segmentArrayLookupTable->lookupSegment(segmentArrayLookupTable, segments, thisGlyph, success); if (lookupSegment != NULL) { TTGlyphID firstGlyph = SWAPW(lookupSegment->firstGlyph); le_int16 offset = SWAPW(lookupSegment->value); if (offset != 0) { - TTGlyphID *glyphArray = (TTGlyphID *) ((char *) subtableHeader + offset); - TTGlyphID newGlyph = SWAPW(glyphArray[LE_GET_GLYPH(thisGlyph) - firstGlyph]); - - glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); + LEReferenceToArrayOf glyphArray(subtableHeader, success, offset, LE_UNBOUNDED_ARRAY); + TTGlyphID newGlyph = SWAPW(glyphArray(LE_GET_GLYPH(thisGlyph) - firstGlyph, success)); + glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph); } } }