--- a/jdk/src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.cpp Wed May 14 15:40:39 2014 +0200
+++ b/jdk/src/java.desktop/share/native/libfontmanager/layout/ContextualSubstSubtables.cpp Thu May 22 12:28:27 2014 -0700
@@ -243,12 +243,22 @@
le_uint16 srSetCount = SWAPW(subRuleSetCount);
if (coverageIndex < srSetCount) {
+ LEReferenceToArrayOf<Offset> subRuleSetTableOffsetArrayRef(base, success,
+ &subRuleSetTableOffsetArray[coverageIndex], 1);
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
Offset subRuleSetTableOffset = SWAPW(subRuleSetTableOffsetArray[coverageIndex]);
LEReferenceTo<SubRuleSetTable>
subRuleSetTable(base, success, (const SubRuleSetTable *) ((char *) this + subRuleSetTableOffset));
le_uint16 subRuleCount = SWAPW(subRuleSetTable->subRuleCount);
le_int32 position = glyphIterator->getCurrStreamPosition();
+ LEReferenceToArrayOf<Offset> subRuleTableOffsetArrayRef(base, success,
+ subRuleSetTable->subRuleTableOffsetArray, subRuleCount);
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
for (le_uint16 subRule = 0; subRule < subRuleCount; subRule += 1) {
Offset subRuleTableOffset =
SWAPW(subRuleSetTable->subRuleTableOffsetArray[subRule]);
@@ -301,34 +311,44 @@
glyphIterator->getCurrGlyphID(),
success);
- if (setClass < scSetCount && subClassSetTableOffsetArray[setClass] != 0) {
- Offset subClassSetTableOffset = SWAPW(subClassSetTableOffsetArray[setClass]);
- LEReferenceTo<SubClassSetTable>
- subClassSetTable(base, success, (const SubClassSetTable *) ((char *) this + subClassSetTableOffset));
- le_uint16 subClassRuleCount = SWAPW(subClassSetTable->subClassRuleCount);
- le_int32 position = glyphIterator->getCurrStreamPosition();
+ if (setClass < scSetCount) {
+ LEReferenceToArrayOf<Offset>
+ subClassSetTableOffsetArrayRef(base, success, subClassSetTableOffsetArray, setClass);
+ if (LE_FAILURE(success)) { return 0; }
+ if (subClassSetTableOffsetArray[setClass] != 0) {
- for (le_uint16 scRule = 0; scRule < subClassRuleCount; scRule += 1) {
- Offset subClassRuleTableOffset =
- SWAPW(subClassSetTable->subClassRuleTableOffsetArray[scRule]);
- LEReferenceTo<SubClassRuleTable>
- subClassRuleTable(subClassSetTable, success, subClassRuleTableOffset);
- le_uint16 matchCount = SWAPW(subClassRuleTable->glyphCount) - 1;
- le_uint16 substCount = SWAPW(subClassRuleTable->substCount);
-
- LEReferenceToArrayOf<le_uint16> classArray(base, success, subClassRuleTable->classArray, matchCount+1);
+ Offset subClassSetTableOffset = SWAPW(subClassSetTableOffsetArray[setClass]);
+ LEReferenceTo<SubClassSetTable>
+ subClassSetTable(base, success, (const SubClassSetTable *) ((char *) this + subClassSetTableOffset));
+ le_uint16 subClassRuleCount = SWAPW(subClassSetTable->subClassRuleCount);
+ le_int32 position = glyphIterator->getCurrStreamPosition();
+ LEReferenceToArrayOf<Offset>
+ subClassRuleTableOffsetArrayRef(base, success, subClassSetTable->subClassRuleTableOffsetArray, subClassRuleCount);
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
+ for (le_uint16 scRule = 0; scRule < subClassRuleCount; scRule += 1) {
+ Offset subClassRuleTableOffset =
+ SWAPW(subClassSetTable->subClassRuleTableOffsetArray[scRule]);
+ LEReferenceTo<SubClassRuleTable>
+ subClassRuleTable(subClassSetTable, success, subClassRuleTableOffset);
+ le_uint16 matchCount = SWAPW(subClassRuleTable->glyphCount) - 1;
+ le_uint16 substCount = SWAPW(subClassRuleTable->substCount);
- if (LE_FAILURE(success)) { return 0; }
- if (matchGlyphClasses(classArray, matchCount, glyphIterator, classDefinitionTable, success)) {
- LEReferenceToArrayOf<SubstitutionLookupRecord>
- substLookupRecordArray(base, success, (const SubstitutionLookupRecord *) &subClassRuleTable->classArray[matchCount], substCount);
+ 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);
- applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
+ applySubstitutionLookups(lookupProcessor, substLookupRecordArray, substCount, glyphIterator, fontInstance, position, success);
- return matchCount + 1;
+ return matchCount + 1;
+ }
+
+ glyphIterator->setCurrStreamPosition(position);
}
-
- glyphIterator->setCurrStreamPosition(position);
}
}
@@ -442,13 +462,22 @@
le_uint16 srSetCount = SWAPW(chainSubRuleSetCount);
if (coverageIndex < srSetCount) {
+ LEReferenceToArrayOf<Offset>
+ chainSubRuleSetTableOffsetArrayRef(base, success, chainSubRuleSetTableOffsetArray, coverageIndex);
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
Offset chainSubRuleSetTableOffset = SWAPW(chainSubRuleSetTableOffsetArray[coverageIndex]);
LEReferenceTo<ChainSubRuleSetTable>
chainSubRuleSetTable(base, success, (const ChainSubRuleSetTable *) ((char *) this + chainSubRuleSetTableOffset));
le_uint16 chainSubRuleCount = SWAPW(chainSubRuleSetTable->chainSubRuleCount);
le_int32 position = glyphIterator->getCurrStreamPosition();
GlyphIterator tempIterator(*glyphIterator, emptyFeatureList);
-
+ LEReferenceToArrayOf<Offset>
+ chainSubRuleTableOffsetArrayRef(base, success, chainSubRuleSetTable->chainSubRuleTableOffsetArray, chainSubRuleCount);
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
for (le_uint16 subRule = 0; subRule < chainSubRuleCount; subRule += 1) {
Offset chainSubRuleTableOffset =
SWAPW(chainSubRuleSetTable->chainSubRuleTableOffsetArray[subRule]);
@@ -530,6 +559,11 @@
le_int32 setClass = inputClassDefinitionTable->getGlyphClass(inputClassDefinitionTable,
glyphIterator->getCurrGlyphID(),
success);
+ LEReferenceToArrayOf<Offset>
+ chainSubClassSetTableOffsetArrayRef(base, success, chainSubClassSetTableOffsetArray, setClass);
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
if (setClass < scSetCount && chainSubClassSetTableOffsetArray[setClass] != 0) {
Offset chainSubClassSetTableOffset = SWAPW(chainSubClassSetTableOffsetArray[setClass]);
@@ -538,7 +572,11 @@
le_uint16 chainSubClassRuleCount = SWAPW(chainSubClassSetTable->chainSubClassRuleCount);
le_int32 position = glyphIterator->getCurrStreamPosition();
GlyphIterator tempIterator(*glyphIterator, emptyFeatureList);
-
+ LEReferenceToArrayOf<Offset>
+ chainSubClassRuleTableOffsetArrayRef(base, success, chainSubClassSetTable->chainSubClassRuleTableOffsetArray, chainSubClassRuleCount);
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
for (le_uint16 scRule = 0; scRule < chainSubClassRuleCount; scRule += 1) {
Offset chainSubClassRuleTableOffset =
SWAPW(chainSubClassSetTable->chainSubClassRuleTableOffsetArray[scRule]);
@@ -603,12 +641,14 @@
}
le_uint16 backtrkGlyphCount = SWAPW(backtrackGlyphCount);
+ LEReferenceToArrayOf<Offset> backtrackGlyphArrayRef(base, success, backtrackCoverageTableOffsetArray, backtrkGlyphCount);
+ if (LE_FAILURE(success)) {
+ return 0;
+ }
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; }
LEReferenceToArrayOf<Offset> lookaheadCoverageTableOffsetArray(base, success, inputCoverageTableOffsetArray.getAlias(inputGlyphCount + 1, success), lookaheadGlyphCount+2);
if( LE_FAILURE(success) ) { return 0; }