// Prepare the RegexPattern object to receive the compiled pattern.
fRXPat->fPattern = utext_clone(fRXPat->fPattern, pat, FALSE, TRUE, fStatus);
+ if (U_FAILURE(*fStatus)) {
+ return;
+ }
fRXPat->fStaticSets = RegexStaticSets::gStaticSets->fPropSets;
fRXPat->fStaticSets8 = RegexStaticSets::gStaticSets->fPropSets8;
if (fPattern->fNeedsAltInput) {
fAltInputText = utext_clone(fAltInputText, fInputText, FALSE, TRUE, &fDeferredStatus);
}
+ if (U_FAILURE(fDeferredStatus)) {
+ return *this;
+ }
fInputLength = utext_nativeLength(fInputText);
reset();
if (fInputText != input) {
fInputText = utext_clone(fInputText, input, FALSE, TRUE, &fDeferredStatus);
if (fPattern->fNeedsAltInput) fAltInputText = utext_clone(fAltInputText, fInputText, FALSE, TRUE, &fDeferredStatus);
+ if (U_FAILURE(fDeferredStatus)) {
+ return *this;
+ }
fInputLength = utext_nativeLength(fInputText);
delete fInput;
//
/*
***************************************************************************
-* Copyright (C) 2002-2013 International Business Machines Corporation *
+* Copyright (C) 2002-2014 International Business Machines Corporation *
* and others. All rights reserved. *
***************************************************************************
*/
init();
// Copy simple fields
- if ( other.fPatternString == NULL ) {
+ fDeferredStatus = other.fDeferredStatus;
+
+ if (U_FAILURE(fDeferredStatus)) {
+ return *this;
+ }
+
+ if (other.fPatternString == NULL) {
fPatternString = NULL;
- fPattern = utext_clone(fPattern, other.fPattern, FALSE, TRUE, &fDeferredStatus);
+ fPattern = utext_clone(fPattern, other.fPattern, FALSE, TRUE, &fDeferredStatus);
} else {
fPatternString = new UnicodeString(*(other.fPatternString));
- UErrorCode status = U_ZERO_ERROR;
- fPattern = utext_openConstUnicodeString(NULL, fPatternString, &status);
- if (U_FAILURE(status)) {
+ if (fPatternString == NULL) {
fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
- return *this;
+ } else {
+ fPattern = utext_openConstUnicodeString(NULL, fPatternString, &fDeferredStatus);
}
}
+ if (U_FAILURE(fDeferredStatus)) {
+ return *this;
+ }
+
fFlags = other.fFlags;
fLiteralText = other.fLiteralText;
- fDeferredStatus = other.fDeferredStatus;
fMinMatchLen = other.fMinMatchLen;
fFrameSize = other.fFrameSize;
fDataSize = other.fDataSize;