Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: source/common/rbbiscan.cpp

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/common/putilimp.h ('k') | source/common/rbbistbl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/common/rbbiscan.cpp
diff --git a/source/common/rbbiscan.cpp b/source/common/rbbiscan.cpp
index dd33aaeb46db71d51495f8299ec65661236c8bfa..1dc6b704d01094c7233e9d3d5f3b19566b7d5b3e 100644
--- a/source/common/rbbiscan.cpp
+++ b/source/common/rbbiscan.cpp
@@ -1,8 +1,7 @@
-
//
// file: rbbiscan.cpp
//
-// Copyright (C) 2002-2014, International Business Machines Corporation and others.
+// Copyright (C) 2002-2015, International Business Machines Corporation and others.
// All Rights Reserved.
//
// This file contains the Rule Based Break Iterator Rule Builder functions for
@@ -211,6 +210,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
fixOpStack(RBBINode::precOpCat);
RBBINode *operandNode = fNodeStack[fNodeStackPtr--];
RBBINode *orNode = pushNewNode(RBBINode::opOr);
+ if (U_FAILURE(*fRB->fStatus)) {
+ break;
+ }
orNode->fLeftChild = operandNode;
operandNode->fParent = orNode;
}
@@ -225,6 +227,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
fixOpStack(RBBINode::precOpCat);
RBBINode *operandNode = fNodeStack[fNodeStackPtr--];
RBBINode *catNode = pushNewNode(RBBINode::opCat);
+ if (U_FAILURE(*fRB->fStatus)) {
+ break;
+ }
catNode->fLeftChild = operandNode;
operandNode->fParent = catNode;
}
@@ -320,6 +325,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
RBBINode *thisRule = fNodeStack[fNodeStackPtr];
RBBINode *endNode = pushNewNode(RBBINode::endMark);
RBBINode *catNode = pushNewNode(RBBINode::opCat);
+ if (U_FAILURE(*fRB->fStatus)) {
+ break;
+ }
fNodeStackPtr -= 2;
catNode->fLeftChild = thisRule;
catNode->fRightChild = endNode;
@@ -347,6 +355,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
RBBINode *thisRule = fNodeStack[fNodeStackPtr];
RBBINode *prevRules = *destRules;
RBBINode *orNode = pushNewNode(RBBINode::opOr);
+ if (U_FAILURE(*fRB->fStatus)) {
+ break;
+ }
orNode->fLeftChild = prevRules;
prevRules->fParent = orNode;
orNode->fRightChild = thisRule;
@@ -387,6 +398,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
{
RBBINode *operandNode = fNodeStack[fNodeStackPtr--];
RBBINode *plusNode = pushNewNode(RBBINode::opPlus);
+ if (U_FAILURE(*fRB->fStatus)) {
+ break;
+ }
plusNode->fLeftChild = operandNode;
operandNode->fParent = plusNode;
}
@@ -396,6 +410,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
{
RBBINode *operandNode = fNodeStack[fNodeStackPtr--];
RBBINode *qNode = pushNewNode(RBBINode::opQuestion);
+ if (U_FAILURE(*fRB->fStatus)) {
+ break;
+ }
qNode->fLeftChild = operandNode;
operandNode->fParent = qNode;
}
@@ -405,6 +422,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
{
RBBINode *operandNode = fNodeStack[fNodeStackPtr--];
RBBINode *starNode = pushNewNode(RBBINode::opStar);
+ if (U_FAILURE(*fRB->fStatus)) {
+ break;
+ }
starNode->fLeftChild = operandNode;
operandNode->fParent = starNode;
}
@@ -418,6 +438,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
// sets that just happen to contain only one character.
{
n = pushNewNode(RBBINode::setRef);
+ if (U_FAILURE(*fRB->fStatus)) {
+ break;
+ }
findSetFor(UnicodeString(fC.fChar), n);
n->fFirstPos = fScanIndex;
n->fLastPos = fNextIndex;
@@ -429,6 +452,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
// scanned a ".", meaning match any single character.
{
n = pushNewNode(RBBINode::setRef);
+ if (U_FAILURE(*fRB->fStatus)) {
+ break;
+ }
findSetFor(UnicodeString(TRUE, kAny, 3), n);
n->fFirstPos = fScanIndex;
n->fLastPos = fNextIndex;
@@ -439,6 +465,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
case doSlash:
// Scanned a '/', which identifies a look-ahead break position in a rule.
n = pushNewNode(RBBINode::lookAhead);
+ if (U_FAILURE(*fRB->fStatus)) {
+ break;
+ }
n->fVal = fRuleNum;
n->fFirstPos = fScanIndex;
n->fLastPos = fNextIndex;
@@ -450,6 +479,9 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
case doStartTagValue:
// Scanned a '{', the opening delimiter for a tag value within a rule.
n = pushNewNode(RBBINode::tag);
+ if (U_FAILURE(*fRB->fStatus)) {
+ break;
+ }
n->fVal = 0;
n->fFirstPos = fScanIndex;
n->fLastPos = fNextIndex;
@@ -560,7 +592,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
returnVal = FALSE;
break;
}
- return returnVal;
+ return returnVal && U_SUCCESS(*fRB->fStatus);
}
@@ -1051,6 +1083,9 @@ void RBBIRuleScanner::parse() {
if (fRB->fReverseTree == NULL) {
fRB->fReverseTree = pushNewNode(RBBINode::opStar);
RBBINode *operand = pushNewNode(RBBINode::setRef);
+ if (U_FAILURE(*fRB->fStatus)) {
+ return;
+ }
findSetFor(UnicodeString(TRUE, kAny, 3), operand);
fRB->fReverseTree->fLeftChild = operand;
operand->fParent = fRB->fReverseTree;
@@ -1103,6 +1138,9 @@ void RBBIRuleScanner::printNodeStack(const char *title) {
//
//------------------------------------------------------------------------------
RBBINode *RBBIRuleScanner::pushNewNode(RBBINode::NodeType t) {
+ if (U_FAILURE(*fRB->fStatus)) {
+ return NULL;
+ }
fNodeStackPtr++;
if (fNodeStackPtr >= kStackSize) {
error(U_BRK_INTERNAL_ERROR);
@@ -1192,6 +1230,9 @@ void RBBIRuleScanner::scanSet() {
RBBINode *n;
n = pushNewNode(RBBINode::setRef);
+ if (U_FAILURE(*fRB->fStatus)) {
+ return;
+ }
n->fFirstPos = startPos;
n->fLastPos = fNextIndex;
fRB->fRules.extractBetween(n->fFirstPos, n->fLastPos, n->fText);
« no previous file with comments | « source/common/putilimp.h ('k') | source/common/rbbistbl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698