changeset 7006:54c9fea273a1

8027775: Enhance ICU code. Reviewed-by: srl, bae, mschoene
author prr
date Mon, 16 Dec 2013 10:19:56 -0800
parents ea6ec524d828
children 5010db5b9b5a
files src/share/native/sun/font/layout/ContextualGlyphSubstProc2.cpp src/share/native/sun/font/layout/ContextualSubstSubtables.cpp src/share/native/sun/font/layout/LookupProcessor.cpp src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp src/share/native/sun/font/layout/OpenTypeUtilities.cpp src/share/native/sun/font/layout/SegmentArrayProcessor.cpp src/share/native/sun/font/layout/StateTableProcessor.cpp
diffstat 7 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/font/layout/ContextualGlyphSubstProc2.cpp	Fri Dec 13 18:03:41 2013 -0800
+++ b/src/share/native/sun/font/layout/ContextualGlyphSubstProc2.cpp	Mon Dec 16 10:19:56 2013 -0800
@@ -154,6 +154,7 @@
             TTGlyphID glyphCode = (TTGlyphID) LE_GET_GLYPH(gid);
             if ((glyphCode >= firstGlyph) && (glyphCode < lastGlyph)) {
               LEReferenceToArrayOf<LookupValue> valueArray(lookupTable8, success, &lookupTable8->valueArray[0], glyphCount);
+              if (LE_FAILURE(success)) { return newGlyph; }
               newGlyph = SWAPW(valueArray(glyphCode - firstGlyph, success));
             }
         }
--- a/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp	Fri Dec 13 18:03:41 2013 -0800
+++ b/src/share/native/sun/font/layout/ContextualSubstSubtables.cpp	Mon Dec 16 10:19:56 2013 -0800
@@ -110,6 +110,8 @@
     LEErrorCode &success,
                                                le_bool backtrack)
 {
+    if (LE_FAILURE(success)) { return FALSE; }
+
     le_int32 direction = 1;
     le_int32 match = 0;
 
@@ -255,6 +257,7 @@
                 le_uint16 matchCount = SWAPW(subRuleTable->glyphCount) - 1;
                 le_uint16 substCount = SWAPW(subRuleTable->substCount);
                 LEReferenceToArrayOf<TTGlyphID> inputGlyphArray(base, success, subRuleTable->inputGlyphArray, matchCount+2);
+                if (LE_FAILURE(success)) { return 0; }
                 if (matchGlyphIDs(inputGlyphArray, matchCount, glyphIterator)) {
                   LEReferenceToArrayOf<SubstitutionLookupRecord>
                     substLookupRecordArray(base, success, (const SubstitutionLookupRecord *) &subRuleTable->inputGlyphArray[matchCount], substCount);
@@ -315,6 +318,7 @@
 
                 LEReferenceToArrayOf<le_uint16> classArray(base, success, subClassRuleTable->classArray, matchCount+1);
 
+                if (LE_FAILURE(success)) { return 0; }
                 if (matchGlyphClasses(classArray, matchCount, glyphIterator, classDefinitionTable, success)) {
                     LEReferenceToArrayOf<SubstitutionLookupRecord>
                       substLookupRecordArray(base, success, (const SubstitutionLookupRecord *) &subClassRuleTable->classArray[matchCount], substCount);
@@ -573,7 +577,7 @@
                 if (matchGlyphClasses(inputClassArray, inputGlyphCount, glyphIterator, inputClassDefinitionTable, success)) {
                     LEReferenceToArrayOf<SubstitutionLookupRecord>
                       substLookupRecordArray(base, success, (const SubstitutionLookupRecord *) lookaheadClassArray.getAlias(lookaheadGlyphCount + 1, success), substCount);
-
+                    if (LE_FAILURE(success)) { return 0; }
                     applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
 
                     return inputGlyphCount + 1;
@@ -601,6 +605,7 @@
     le_uint16 backtrkGlyphCount = SWAPW(backtrackGlyphCount);
     le_uint16 inputGlyphCount = (le_uint16) SWAPW(backtrackCoverageTableOffsetArray[backtrkGlyphCount]);
     LEReferenceToArrayOf<Offset>   inputCoverageTableOffsetArray(base, success, &backtrackCoverageTableOffsetArray[backtrkGlyphCount + 1], inputGlyphCount+2); // offset
+    if (LE_FAILURE(success)) { return 0; }
     const le_uint16 lookaheadGlyphCount = (le_uint16) SWAPW(inputCoverageTableOffsetArray[inputGlyphCount]);
 
     if( LE_FAILURE(success) ) { return 0; }
--- a/src/share/native/sun/font/layout/LookupProcessor.cpp	Fri Dec 13 18:03:41 2013 -0800
+++ b/src/share/native/sun/font/layout/LookupProcessor.cpp	Mon Dec 16 10:19:56 2013 -0800
@@ -282,6 +282,7 @@
 
             for (le_uint16 feature = 0; feature < featureCount; feature += 1) {
               LEReferenceToArrayOf<le_uint16> featureIndexArray(langSysTable, success, langSysTable->featureIndexArray, featureCount);
+              if (LE_FAILURE(success)) { continue; }
               le_uint16 featureIndex = SWAPW(featureIndexArray.getObject(feature,success));
 
                 // don't add the required feature to the list more than once...
--- a/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp	Fri Dec 13 18:03:41 2013 -0800
+++ b/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp	Mon Dec 16 10:19:56 2013 -0800
@@ -67,6 +67,7 @@
 
     LEPoint markAnchor;
     LEReferenceTo<MarkArray> markArray(base, success,  (const MarkArray *) ((char *) this + SWAPW(markArrayOffset)));
+    if(LE_FAILURE(success)) return 0;
     le_int32 markClass = markArray->getMarkClass(markArray, markGlyph, markCoverage, fontInstance, markAnchor, success);
     le_uint16 mcCount = SWAPW(classCount);
 
--- a/src/share/native/sun/font/layout/OpenTypeUtilities.cpp	Fri Dec 13 18:03:41 2013 -0800
+++ b/src/share/native/sun/font/layout/OpenTypeUtilities.cpp	Mon Dec 16 10:19:56 2013 -0800
@@ -79,8 +79,8 @@
 
 Offset OpenTypeUtilities::getTagOffset(LETag tag, const LEReferenceToArrayOf<TagAndOffsetRecord> &records, LEErrorCode &success)
 {
+  if(LE_FAILURE(success)) return 0;
   const TagAndOffsetRecord *r0 = (const TagAndOffsetRecord*)records.getAlias();
-  if(LE_FAILURE(success)) return 0;
 
   le_uint32 recordCount = records.getCount();
   le_uint8 bit = highBit(recordCount);
--- a/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp	Fri Dec 13 18:03:41 2013 -0800
+++ b/src/share/native/sun/font/layout/SegmentArrayProcessor.cpp	Mon Dec 16 10:19:56 2013 -0800
@@ -73,6 +73,7 @@
 
             if (offset != 0) {
               LEReferenceToArrayOf<TTGlyphID> glyphArray(subtableHeader, success, offset, LE_UNBOUNDED_ARRAY);
+              if (LE_FAILURE(success)) { continue; }
               TTGlyphID   newGlyph   = SWAPW(glyphArray(LE_GET_GLYPH(thisGlyph) - firstGlyph, success));
               glyphStorage[glyph] = LE_SET_GLYPH(thisGlyph, newGlyph);
             }
--- a/src/share/native/sun/font/layout/StateTableProcessor.cpp	Fri Dec 13 18:03:41 2013 -0800
+++ b/src/share/native/sun/font/layout/StateTableProcessor.cpp	Mon Dec 16 10:19:56 2013 -0800
@@ -97,6 +97,7 @@
 
         LEReferenceToArrayOf<EntryTableIndex> stateArray(stHeader, success, currentState, LE_UNBOUNDED_ARRAY);
         EntryTableIndex entryTableIndex = stateArray.getObject((le_uint8)classCode, success);
+        if (LE_FAILURE(success)) { break; }
         LE_STATE_PATIENCE_CURR(le_int32, currGlyph);
         currentState = processStateEntry(glyphStorage, currGlyph, entryTableIndex);
         LE_STATE_PATIENCE_INCR(currGlyph);