mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-20 20:19:32 +00:00
X-SVN-Rev: 30353
This commit is contained in:
parent
a1b3ab982e
commit
a108b1825f
20 changed files with 151 additions and 76 deletions
|
@ -254,7 +254,7 @@ public:
|
|||
capacity=otherCapacity;
|
||||
needToRelease=FALSE;
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Deletes the array (if owned) and allocates a new one, copying length T items.
|
||||
* Returns the new array pointer.
|
||||
|
@ -288,11 +288,11 @@ private:
|
|||
}
|
||||
}
|
||||
/* No comparison operators with other MaybeStackArray's. */
|
||||
bool operator==(const MaybeStackArray & /*other*/) {return FALSE;};
|
||||
bool operator!=(const MaybeStackArray & /*other*/) {return TRUE;};
|
||||
bool operator==(const MaybeStackArray & /*other*/) {return FALSE;}
|
||||
bool operator!=(const MaybeStackArray & /*other*/) {return TRUE;}
|
||||
/* No ownership transfer: No copy constructor, no assignment operator. */
|
||||
MaybeStackArray(const MaybeStackArray & /*other*/) {};
|
||||
void operator=(const MaybeStackArray & /*other*/) {};
|
||||
MaybeStackArray(const MaybeStackArray & /*other*/) {}
|
||||
void operator=(const MaybeStackArray & /*other*/) {}
|
||||
|
||||
// No heap allocation. Use only on the stack.
|
||||
// (Declaring these functions private triggers a cascade of problems:
|
||||
|
@ -425,7 +425,7 @@ public:
|
|||
capacity=otherCapacity;
|
||||
needToRelease=FALSE;
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Deletes the memory block (if owned) and allocates a new one,
|
||||
* copying the header and length T array items.
|
||||
|
@ -462,11 +462,11 @@ private:
|
|||
}
|
||||
}
|
||||
/* No comparison operators with other MaybeStackHeaderAndArray's. */
|
||||
bool operator==(const MaybeStackHeaderAndArray & /*other*/) {return FALSE;};
|
||||
bool operator!=(const MaybeStackHeaderAndArray & /*other*/) {return TRUE;};
|
||||
bool operator==(const MaybeStackHeaderAndArray & /*other*/) {return FALSE;}
|
||||
bool operator!=(const MaybeStackHeaderAndArray & /*other*/) {return TRUE;}
|
||||
/* No ownership transfer: No copy constructor, no assignment operator. */
|
||||
MaybeStackHeaderAndArray(const MaybeStackHeaderAndArray & /*other*/) {};
|
||||
void operator=(const MaybeStackHeaderAndArray & /*other*/) {};
|
||||
MaybeStackHeaderAndArray(const MaybeStackHeaderAndArray & /*other*/) {}
|
||||
void operator=(const MaybeStackHeaderAndArray & /*other*/) {}
|
||||
|
||||
// No heap allocation. Use only on the stack.
|
||||
// (Declaring these functions private triggers a cascade of problems;
|
||||
|
|
|
@ -621,7 +621,7 @@ int32_t RuleBasedBreakIterator::previous(void) {
|
|||
|
||||
int32_t start = current();
|
||||
|
||||
UTEXT_PREVIOUS32(fText);
|
||||
(void)UTEXT_PREVIOUS32(fText);
|
||||
int32_t lastResult = handlePrevious(fData->fReverseTable);
|
||||
if (lastResult == UBRK_DONE) {
|
||||
lastResult = 0;
|
||||
|
@ -717,7 +717,7 @@ int32_t RuleBasedBreakIterator::following(int32_t offset) {
|
|||
// move forward one codepoint to prepare for moving back to a
|
||||
// safe point.
|
||||
// this handles offset being between a supplementary character
|
||||
UTEXT_NEXT32(fText);
|
||||
(void)UTEXT_NEXT32(fText);
|
||||
// handlePrevious will move most of the time to < 1 boundary away
|
||||
handlePrevious(fData->fSafeRevTable);
|
||||
int32_t result = next();
|
||||
|
@ -729,7 +729,7 @@ int32_t RuleBasedBreakIterator::following(int32_t offset) {
|
|||
if (fData->fSafeFwdTable != NULL) {
|
||||
// backup plan if forward safe table is not available
|
||||
utext_setNativeIndex(fText, offset);
|
||||
UTEXT_PREVIOUS32(fText);
|
||||
(void)UTEXT_PREVIOUS32(fText);
|
||||
// handle next will give result >= offset
|
||||
handleNext(fData->fSafeFwdTable);
|
||||
// previous will give result 0 or 1 boundary away from offset,
|
||||
|
@ -829,7 +829,7 @@ int32_t RuleBasedBreakIterator::preceding(int32_t offset) {
|
|||
// indices to the containing code point.
|
||||
// For breakitereator::preceding only, these non-code-point indices need to be moved
|
||||
// up to refer to the following codepoint.
|
||||
UTEXT_NEXT32(fText);
|
||||
(void)UTEXT_NEXT32(fText);
|
||||
offset = (int32_t)UTEXT_GETNATIVEINDEX(fText);
|
||||
}
|
||||
|
||||
|
@ -838,7 +838,7 @@ int32_t RuleBasedBreakIterator::preceding(int32_t offset) {
|
|||
// (Change would interact with safe rules.)
|
||||
// TODO: change RBBI behavior for off-boundary indices to match that of UText?
|
||||
// affects only preceding(), seems cleaner, but is slightly different.
|
||||
UTEXT_PREVIOUS32(fText);
|
||||
(void)UTEXT_PREVIOUS32(fText);
|
||||
handleNext(fData->fSafeFwdTable);
|
||||
int32_t result = (int32_t)UTEXT_GETNATIVEINDEX(fText);
|
||||
while (result >= offset) {
|
||||
|
@ -853,7 +853,7 @@ int32_t RuleBasedBreakIterator::preceding(int32_t offset) {
|
|||
// if they use safe tables at all. We have certainly never described
|
||||
// to anyone how to work with just one safe table.
|
||||
utext_setNativeIndex(fText, offset);
|
||||
UTEXT_NEXT32(fText);
|
||||
(void)UTEXT_NEXT32(fText);
|
||||
|
||||
// handle previous will give result <= offset
|
||||
handlePrevious(fData->fSafeRevTable);
|
||||
|
@ -1233,7 +1233,7 @@ int32_t RuleBasedBreakIterator::handlePrevious(const RBBIStateTable *statetable)
|
|||
// Ran off start, no match found.
|
||||
// move one index one (towards the start, since we are doing a previous())
|
||||
UTEXT_SETNATIVEINDEX(fText, initialPosition);
|
||||
UTEXT_PREVIOUS32(fText); // TODO: shouldn't be necessary. We're already at beginning. Check.
|
||||
(void)UTEXT_PREVIOUS32(fText); // TODO: shouldn't be necessary. We're already at beginning. Check.
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3956,15 +3956,20 @@ UnicodeString::startsWith(const UnicodeString& srcText,
|
|||
{ return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; }
|
||||
|
||||
inline UBool
|
||||
UnicodeString::startsWith(const UChar *srcChars,
|
||||
int32_t srcLength) const
|
||||
{ return doCompare(0, srcLength, srcChars, 0, srcLength) == 0; }
|
||||
UnicodeString::startsWith(const UChar *srcChars, int32_t srcLength) const {
|
||||
if(srcLength < 0) {
|
||||
srcLength = u_strlen(srcChars);
|
||||
}
|
||||
return doCompare(0, srcLength, srcChars, 0, srcLength) == 0;
|
||||
}
|
||||
|
||||
inline UBool
|
||||
UnicodeString::startsWith(const UChar *srcChars,
|
||||
int32_t srcStart,
|
||||
int32_t srcLength) const
|
||||
{ return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0;}
|
||||
UnicodeString::startsWith(const UChar *srcChars, int32_t srcStart, int32_t srcLength) const {
|
||||
if(srcLength < 0) {
|
||||
srcLength = u_strlen(srcChars);
|
||||
}
|
||||
return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0;
|
||||
}
|
||||
|
||||
inline UBool
|
||||
UnicodeString::endsWith(const UnicodeString& text) const
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## -*-makefile-*-
|
||||
## Darwin-specific setup (Darwin is the Mac OS X developer preview, successor
|
||||
## to Rhapsody, aka Mac OS X Server)
|
||||
## Copyright (c) 1999-2009 International Business Machines Corporation and
|
||||
## Copyright (c) 1999-2011 International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
|
||||
## Flags for position independent code
|
||||
|
@ -25,11 +25,15 @@ SHLIB.c= $(CC) -dynamiclib -dynamic $(CFLAGS) $(LDFLAGS) $(LD_SOOPTIONS)
|
|||
SHLIB.cc= $(CXX) -dynamiclib -dynamic $(CXXFLAGS) $(LDFLAGS) $(LD_SOOPTIONS)
|
||||
|
||||
## Compiler switches to embed a library name and version information
|
||||
ifeq ($(ENABLE_RPATH),YES)
|
||||
LD_SONAME = -Wl,-compatibility_version -Wl,$(SO_TARGET_VERSION_MAJOR) -Wl,-current_version -Wl,$(SO_TARGET_VERSION) -install_name $(libdir)/$(notdir $(MIDDLE_SO_TARGET))
|
||||
else
|
||||
LD_SONAME = -Wl,-compatibility_version -Wl,$(SO_TARGET_VERSION_MAJOR) -Wl,-current_version -Wl,$(SO_TARGET_VERSION) -install_name $(notdir $(MIDDLE_SO_TARGET))
|
||||
endif
|
||||
|
||||
## Compiler switch to embed a runtime search path
|
||||
LD_RPATH=
|
||||
LD_RPATH_PRE=
|
||||
LD_RPATH_PRE= -Wl,-rpath,
|
||||
|
||||
## Environment variable to set a runtime search path
|
||||
LDLIBRARYPATH_ENVVAR = DYLD_LIBRARY_PATH
|
||||
|
|
|
@ -1735,7 +1735,6 @@ DecimalFormat::parseForCurrency(const UnicodeString& text,
|
|||
int32_t pos = -1;
|
||||
const UHashElement* element = NULL;
|
||||
while ( (element = fAffixPatternsForCurrency->nextElement(pos)) != NULL ) {
|
||||
const UHashTok keyTok = element->key;
|
||||
const UHashTok valueTok = element->value;
|
||||
const AffixPatternsForCurrency* affixPtn = (AffixPatternsForCurrency*)valueTok.pointer;
|
||||
UBool tmpStatus[fgStatusLength];
|
||||
|
@ -4746,7 +4745,6 @@ DecimalFormat::deleteHashForAffix(Hashtable*& table)
|
|||
int32_t pos = -1;
|
||||
const UHashElement* element = NULL;
|
||||
while ( (element = table->nextElement(pos)) != NULL ) {
|
||||
const UHashTok keyTok = element->key;
|
||||
const UHashTok valueTok = element->value;
|
||||
const AffixesForCurrency* value = (AffixesForCurrency*)valueTok.pointer;
|
||||
delete value;
|
||||
|
@ -4766,7 +4764,6 @@ DecimalFormat::deleteHashForAffixPattern()
|
|||
int32_t pos = -1;
|
||||
const UHashElement* element = NULL;
|
||||
while ( (element = fAffixPatternsForCurrency->nextElement(pos)) != NULL ) {
|
||||
const UHashTok keyTok = element->key;
|
||||
const UHashTok valueTok = element->value;
|
||||
const AffixPatternsForCurrency* value = (AffixPatternsForCurrency*)valueTok.pointer;
|
||||
delete value;
|
||||
|
|
|
@ -148,7 +148,7 @@ public:
|
|||
int32_t compare(const DigitList& other);
|
||||
|
||||
|
||||
inline UBool operator!=(const DigitList& other) const { return !operator==(other); };
|
||||
inline UBool operator!=(const DigitList& other) const { return !operator==(other); }
|
||||
|
||||
/**
|
||||
* Clears out the digits.
|
||||
|
@ -279,9 +279,9 @@ public:
|
|||
/** Test for a Nan
|
||||
* @return TRUE if the number is a NaN
|
||||
*/
|
||||
UBool isNaN(void) const {return decNumberIsNaN(fDecNumber);};
|
||||
UBool isNaN(void) const {return decNumberIsNaN(fDecNumber);}
|
||||
|
||||
UBool isInfinite() const {return decNumberIsInfinite(fDecNumber);};
|
||||
UBool isInfinite() const {return decNumberIsInfinite(fDecNumber);}
|
||||
|
||||
/** Reduce, or normalize. Removes trailing zeroes, adjusts exponent appropriately. */
|
||||
void reduce();
|
||||
|
@ -290,10 +290,10 @@ public:
|
|||
void trim();
|
||||
|
||||
/** Set to zero */
|
||||
void setToZero() {uprv_decNumberZero(fDecNumber);};
|
||||
void setToZero() {uprv_decNumberZero(fDecNumber);}
|
||||
|
||||
/** get the number of digits in the decimal number */
|
||||
int32_t digits() const {return fDecNumber->digits;};
|
||||
int32_t digits() const {return fDecNumber->digits;}
|
||||
|
||||
/**
|
||||
* Round the number to the given number of digits.
|
||||
|
@ -310,7 +310,7 @@ public:
|
|||
*/
|
||||
void ensureCapacity(int32_t requestedSize, UErrorCode &status);
|
||||
|
||||
UBool isPositive(void) const { return decNumberIsNegative(fDecNumber) == 0;};
|
||||
UBool isPositive(void) const { return decNumberIsNegative(fDecNumber) == 0;}
|
||||
void setPositive(UBool s);
|
||||
|
||||
void setDecimalAt(int32_t d);
|
||||
|
|
|
@ -576,7 +576,6 @@ DateIntervalInfo::deleteHash(Hashtable* hTable)
|
|||
int32_t pos = -1;
|
||||
const UHashElement* element = NULL;
|
||||
while ( (element = hTable->nextElement(pos)) != NULL ) {
|
||||
const UHashTok keyTok = element->key;
|
||||
const UHashTok valueTok = element->value;
|
||||
const UnicodeString* value = (UnicodeString*)valueTok.pointer;
|
||||
delete[] value;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007-2009, International Business Machines Corporation and
|
||||
* Copyright (C) 2007-2011, International Business Machines Corporation and
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
void set(const UnicodeString& patternString);
|
||||
UBool isQuoteLiteral(const UnicodeString& s) const;
|
||||
void getQuoteLiteral(UnicodeString& quote, int32_t *itemIndex);
|
||||
int32_t getCanonicalIndex(const UnicodeString& s) { return getCanonicalIndex(s, TRUE); };
|
||||
int32_t getCanonicalIndex(const UnicodeString& s) { return getCanonicalIndex(s, TRUE); }
|
||||
int32_t getCanonicalIndex(const UnicodeString& s, UBool strict);
|
||||
UBool isPatternSeparator(UnicodeString& field);
|
||||
void setFilter(UErrorCode &status);
|
||||
|
@ -165,12 +165,12 @@ public:
|
|||
int32_t missingFieldMask;
|
||||
int32_t extraFieldMask;
|
||||
|
||||
DistanceInfo() {};
|
||||
virtual ~DistanceInfo() {};
|
||||
void clear() { missingFieldMask = extraFieldMask = 0; };
|
||||
DistanceInfo() {}
|
||||
virtual ~DistanceInfo() {}
|
||||
void clear() { missingFieldMask = extraFieldMask = 0; }
|
||||
void setTo(DistanceInfo& other);
|
||||
void addMissing(int32_t field) { missingFieldMask |= (1<<field); };
|
||||
void addExtra(int32_t field) { extraFieldMask |= (1<<field); };
|
||||
void addMissing(int32_t field) { missingFieldMask |= (1<<field); }
|
||||
void addExtra(int32_t field) { extraFieldMask |= (1<<field); }
|
||||
};
|
||||
|
||||
class DateTimeMatcher: public UMemory {
|
||||
|
@ -188,7 +188,7 @@ public:
|
|||
int32_t getDistance(const DateTimeMatcher& other, int32_t includeMask, DistanceInfo& distanceInfo);
|
||||
DateTimeMatcher();
|
||||
DateTimeMatcher(const DateTimeMatcher& other);
|
||||
virtual ~DateTimeMatcher() {};
|
||||
virtual ~DateTimeMatcher() {}
|
||||
int32_t getFieldMask();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 1997-2008, International Business Machines
|
||||
* Copyright (C) 1997-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
******************************************************************************
|
||||
* file name: nfrlist.h
|
||||
|
@ -39,7 +39,7 @@ public:
|
|||
NFRuleList(uint32_t capacity = 10)
|
||||
: fStuff(capacity ? (NFRule**)uprv_malloc(capacity * sizeof(NFRule*)) : NULL)
|
||||
, fCount(0)
|
||||
, fCapacity(capacity) {};
|
||||
, fCapacity(capacity) {}
|
||||
~NFRuleList() {
|
||||
if (fStuff) {
|
||||
for(uint32_t i = 0; i < fCount; ++i) {
|
||||
|
|
|
@ -75,7 +75,7 @@ The RTTI code was also removed due to lack of code coverage.
|
|||
*/
|
||||
class LocalizationInfo : public UMemory {
|
||||
protected:
|
||||
virtual ~LocalizationInfo() {};
|
||||
virtual ~LocalizationInfo() {}
|
||||
uint32_t refcount;
|
||||
|
||||
public:
|
||||
|
|
|
@ -378,13 +378,13 @@ RegexMatcher &RegexMatcher::appendReplacement(UText *dest,
|
|||
// TODO: Report errors for mal-formed \u escapes?
|
||||
// As this is, the original sequence is output, which may be OK.
|
||||
if (context.lastOffset == offset) {
|
||||
UTEXT_PREVIOUS32(replacement);
|
||||
(void)UTEXT_PREVIOUS32(replacement);
|
||||
} else if (context.lastOffset != offset-1) {
|
||||
utext_moveIndex32(replacement, offset - context.lastOffset - 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
UTEXT_NEXT32(replacement);
|
||||
(void)UTEXT_NEXT32(replacement);
|
||||
// Plain backslash escape. Just put out the escaped character.
|
||||
if (U_IS_BMP(c)) {
|
||||
UChar c16 = (UChar)c;
|
||||
|
@ -427,7 +427,7 @@ RegexMatcher &RegexMatcher::appendReplacement(UText *dest,
|
|||
if (u_isdigit(digitC) == FALSE) {
|
||||
break;
|
||||
}
|
||||
UTEXT_NEXT32(replacement);
|
||||
(void)UTEXT_NEXT32(replacement);
|
||||
groupNum=groupNum*10 + u_charDigitValue(digitC);
|
||||
numDigits++;
|
||||
if (numDigits >= fPattern->fMaxCaptureDigits) {
|
||||
|
@ -616,7 +616,7 @@ UBool RegexMatcher::find() {
|
|||
return FALSE;
|
||||
}
|
||||
UTEXT_SETNATIVEINDEX(fInputText, startPos);
|
||||
UTEXT_NEXT32(fInputText);
|
||||
(void)UTEXT_NEXT32(fInputText);
|
||||
startPos = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
}
|
||||
} else {
|
||||
|
@ -668,7 +668,7 @@ UBool RegexMatcher::find() {
|
|||
return FALSE;
|
||||
}
|
||||
UTEXT_SETNATIVEINDEX(fInputText, startPos);
|
||||
UTEXT_NEXT32(fInputText);
|
||||
(void)UTEXT_NEXT32(fInputText);
|
||||
startPos = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
// Note that it's perfectly OK for a pattern to have a zero-length
|
||||
// match at the end of a string, so we must make sure that the loop
|
||||
|
@ -810,7 +810,7 @@ UBool RegexMatcher::find() {
|
|||
if (((c & 0x7f) <= 0x29) && // First quickly bypass as many chars as possible
|
||||
((c<=0x0d && c>=0x0a) || c==0x85 ||c==0x2028 || c==0x2029 )) {
|
||||
if (c == 0x0d && startPos < fActiveLimit && UTEXT_CURRENT32(fInputText) == 0x0a) {
|
||||
UTEXT_NEXT32(fInputText);
|
||||
(void)UTEXT_NEXT32(fInputText);
|
||||
startPos = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
}
|
||||
MatchAt(startPos, FALSE, fDeferredStatus);
|
||||
|
@ -3023,7 +3023,7 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
|
|||
if (UTEXT_GETNATIVEINDEX(fInputText) >= fAnchorLimit) {
|
||||
if ((c>=0x0a && c<=0x0d) || c==0x85 || c==0x2028 || c==0x2029) {
|
||||
// If not in the middle of a CR/LF sequence
|
||||
if ( !(c==0x0a && fp->fInputIdx>fAnchorStart && (UTEXT_PREVIOUS32(fInputText), UTEXT_PREVIOUS32(fInputText))==0x0d)) {
|
||||
if ( !(c==0x0a && fp->fInputIdx>fAnchorStart && ((void)UTEXT_PREVIOUS32(fInputText), UTEXT_PREVIOUS32(fInputText))==0x0d)) {
|
||||
// At new-line at end of input. Success
|
||||
fHitEnd = TRUE;
|
||||
fRequireEnd = TRUE;
|
||||
|
@ -3250,7 +3250,7 @@ GC_L:
|
|||
if (sets[URX_GC_LV]->contains(c)) goto GC_V;
|
||||
if (sets[URX_GC_LVT]->contains(c)) goto GC_T;
|
||||
if (sets[URX_GC_V]->contains(c)) goto GC_V;
|
||||
UTEXT_PREVIOUS32(fInputText);
|
||||
(void)UTEXT_PREVIOUS32(fInputText);
|
||||
fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
goto GC_Extend;
|
||||
|
||||
|
@ -3260,7 +3260,7 @@ GC_V:
|
|||
fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
if (sets[URX_GC_V]->contains(c)) goto GC_V;
|
||||
if (sets[URX_GC_T]->contains(c)) goto GC_T;
|
||||
UTEXT_PREVIOUS32(fInputText);
|
||||
(void)UTEXT_PREVIOUS32(fInputText);
|
||||
fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
goto GC_Extend;
|
||||
|
||||
|
@ -3269,7 +3269,7 @@ GC_T:
|
|||
c = UTEXT_NEXT32(fInputText);
|
||||
fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
if (sets[URX_GC_T]->contains(c)) goto GC_T;
|
||||
UTEXT_PREVIOUS32(fInputText);
|
||||
(void)UTEXT_PREVIOUS32(fInputText);
|
||||
fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
goto GC_Extend;
|
||||
|
||||
|
@ -3283,7 +3283,7 @@ GC_Extend:
|
|||
if (sets[URX_GC_EXTEND]->contains(c) == FALSE) {
|
||||
break;
|
||||
}
|
||||
UTEXT_NEXT32(fInputText);
|
||||
(void)UTEXT_NEXT32(fInputText);
|
||||
fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
}
|
||||
goto GC_Done;
|
||||
|
@ -3581,7 +3581,7 @@ GC_Done:
|
|||
// In the case of a CR/LF, we need to advance over both.
|
||||
UChar32 nextc = UTEXT_CURRENT32(fInputText);
|
||||
if (nextc == 0x0a) {
|
||||
UTEXT_NEXT32(fInputText);
|
||||
(void)UTEXT_NEXT32(fInputText);
|
||||
fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
}
|
||||
}
|
||||
|
@ -4098,7 +4098,7 @@ GC_Done:
|
|||
(*lbStartIdx)--;
|
||||
} else {
|
||||
UTEXT_SETNATIVEINDEX(fInputText, *lbStartIdx);
|
||||
UTEXT_PREVIOUS32(fInputText);
|
||||
(void)UTEXT_PREVIOUS32(fInputText);
|
||||
*lbStartIdx = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
}
|
||||
}
|
||||
|
@ -4174,7 +4174,7 @@ GC_Done:
|
|||
(*lbStartIdx)--;
|
||||
} else {
|
||||
UTEXT_SETNATIVEINDEX(fInputText, *lbStartIdx);
|
||||
UTEXT_PREVIOUS32(fInputText);
|
||||
(void)UTEXT_PREVIOUS32(fInputText);
|
||||
*lbStartIdx = UTEXT_GETNATIVEINDEX(fInputText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ private:
|
|||
};
|
||||
|
||||
TimeZoneFormatImpl::TimeZoneFormatImpl(const Locale& locale, UErrorCode& status)
|
||||
: fLocale(locale), fTimeZoneNames(NULL), fTimeZoneGenericNames(NULL), fLock(NULL) {
|
||||
: fLock(NULL),fLocale(locale), fTimeZoneNames(NULL), fTimeZoneGenericNames(NULL) {
|
||||
|
||||
const char* region = fLocale.getCountry();
|
||||
int32_t regionLen = uprv_strlen(region);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
********************************************************************************
|
||||
* Copyright (C) 1997-2010, International Business Machines
|
||||
* Copyright (C) 1997-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
********************************************************************************
|
||||
*
|
||||
|
@ -600,7 +600,7 @@ public:
|
|||
* big decimal formatting.
|
||||
* @internal
|
||||
*/
|
||||
DigitList *getDigitList() const { return fDecimalNum;};
|
||||
DigitList *getDigitList() const { return fDecimalNum;}
|
||||
|
||||
/**
|
||||
* Adopt, and set value from, a DigitList
|
||||
|
|
|
@ -142,7 +142,7 @@ public:
|
|||
* @return TRUE if the objects are different.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
inline UBool operator!=(const RegexPattern& that) const {return ! operator ==(that);};
|
||||
inline UBool operator!=(const RegexPattern& that) const {return ! operator ==(that);}
|
||||
|
||||
/**
|
||||
* Assignment operator. After assignment, this RegexPattern will behave identically
|
||||
|
|
|
@ -3448,7 +3448,13 @@ U_NAMESPACE_BEGIN
|
|||
//
|
||||
// CEBuffer A circular buffer of CEs from the text being searched.
|
||||
//
|
||||
#define DEFAULT_CEBUFFER_SIZE 50
|
||||
#define DEFAULT_CEBUFFER_SIZE 96
|
||||
#define CEBUFFER_EXTRA 32
|
||||
// Some typical max values to make buffer size more reasonable for asymmetric search.
|
||||
// #8694 is for a better long-term solution to allocation of this buffer.
|
||||
#define MAX_TARGET_IGNORABLES_PER_PAT_JAMO_L 8
|
||||
#define MAX_TARGET_IGNORABLES_PER_PAT_OTHER 3
|
||||
#define MIGHT_BE_JAMO_L(c) ((c >= 0x1100 && c <= 0x115E) || (c >= 0x3131 && c <= 0x314E) || (c >= 0x3165 && c <= 0x3186))
|
||||
struct CEBuffer {
|
||||
CEI defBuf[DEFAULT_CEBUFFER_SIZE];
|
||||
CEI *buf;
|
||||
|
@ -3470,7 +3476,22 @@ struct CEBuffer {
|
|||
CEBuffer::CEBuffer(UStringSearch *ss, UErrorCode *status) {
|
||||
buf = defBuf;
|
||||
strSearch = ss;
|
||||
bufSize = ss->pattern.PCELength+10;
|
||||
bufSize = ss->pattern.PCELength + CEBUFFER_EXTRA;
|
||||
if (ss->search->elementComparisonType != 0) {
|
||||
const UChar * patText = ss->pattern.text;
|
||||
if (patText) {
|
||||
const UChar * patTextLimit = patText + ss->pattern.textLength;
|
||||
while ( patText < patTextLimit ) {
|
||||
UChar c = *patText++;
|
||||
if (MIGHT_BE_JAMO_L(c)) {
|
||||
bufSize += MAX_TARGET_IGNORABLES_PER_PAT_JAMO_L;
|
||||
} else {
|
||||
// No check for surrogates, we might allocate slightly more buffer than necessary.
|
||||
bufSize += MAX_TARGET_IGNORABLES_PER_PAT_OTHER;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ceIter = ss->textIter;
|
||||
firstIx = 0;
|
||||
limitIx = 0;
|
||||
|
@ -3853,6 +3874,16 @@ U_CAPI UBool U_EXPORT2 usearch_search(UStringSearch *strsrch,
|
|||
// position from the outer loop.
|
||||
int32_t targetIxOffset = 0;
|
||||
int64_t patCE = 0;
|
||||
// For targetIx > 0, this ceb.get gets a CE that is as far back in the ring buffer
|
||||
// (compared to the last CE fetched for the previous targetIx value) as we need to go
|
||||
// for this targetIx value, so if it is non-NULL then other ceb.get calls should be OK.
|
||||
const CEI *firstCEI = ceb.get(targetIx);
|
||||
if (firstCEI == NULL) {
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
found = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
for (patIx=0; patIx<strsrch->pattern.PCELength; patIx++) {
|
||||
patCE = strsrch->pattern.PCE[patIx];
|
||||
targetCEI = ceb.get(targetIx+patIx+targetIxOffset);
|
||||
|
@ -3892,7 +3923,6 @@ U_CAPI UBool U_EXPORT2 usearch_search(UStringSearch *strsrch,
|
|||
// There still is a chance of match failure if the CE range not correspond to
|
||||
// an acceptable character range.
|
||||
//
|
||||
const CEI *firstCEI = ceb.get(targetIx);
|
||||
const CEI *lastCEI = ceb.get(targetIx + targetIxOffset - 1);
|
||||
|
||||
mStart = firstCEI->lowIndex;
|
||||
|
@ -4123,6 +4153,15 @@ U_CAPI UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch,
|
|||
for(targetIx = limitIx; ; targetIx += 1)
|
||||
{
|
||||
found = TRUE;
|
||||
// For targetIx > limitIx, this ceb.getPrevious gets a CE that is as far back in the ring buffer
|
||||
// (compared to the last CE fetched for the previous targetIx value) as we need to go
|
||||
// for this targetIx value, so if it is non-NULL then other ceb.getPrevious calls should be OK.
|
||||
const CEI *lastCEI = ceb.getPrevious(targetIx);
|
||||
if (lastCEI == NULL) {
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
found = FALSE;
|
||||
break;
|
||||
}
|
||||
// Inner loop checks for a match beginning at each
|
||||
// position from the outer loop.
|
||||
int32_t targetIxOffset = 0;
|
||||
|
@ -4185,7 +4224,6 @@ U_CAPI UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch,
|
|||
}
|
||||
|
||||
|
||||
const CEI *lastCEI = ceb.getPrevious(targetIx);
|
||||
minLimit = lastCEI->lowIndex;
|
||||
|
||||
if (targetIx > 0) {
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
|
||||
#if !UCONFIG_NO_NORMALIZATION
|
||||
|
||||
|
||||
#include <stdio.h> // debug
|
||||
|
||||
U_NAMESPACE_USE
|
||||
|
||||
|
||||
|
@ -255,7 +252,7 @@ uspoof_check(const USpoofChecker *sc,
|
|||
UBool haveMultipleMarks = FALSE;
|
||||
UnicodeSet marksSeenSoFar; // Set of combining marks in a single combining sequence.
|
||||
|
||||
for (i=0; i<length ;) {
|
||||
for (i=0; i<nfdLength ;) {
|
||||
U16_NEXT(nfdText, i, nfdLength, c);
|
||||
if (u_charType(c) != U_NON_SPACING_MARK) {
|
||||
firstNonspacingMark = 0;
|
||||
|
@ -278,6 +275,11 @@ uspoof_check(const USpoofChecker *sc,
|
|||
// No need to find more than the first failure.
|
||||
result |= USPOOF_INVISIBLE;
|
||||
failPos = i;
|
||||
// TODO: Bug 8655: failPos is the position in the NFD buffer, but what we want
|
||||
// to give back to our caller is a position in the original input string.
|
||||
if (failPos > length) {
|
||||
failPos = length;
|
||||
}
|
||||
break;
|
||||
}
|
||||
marksSeenSoFar.add(c);
|
||||
|
|
|
@ -91,7 +91,13 @@ void IntlTestSpoof::runIndexedTest( int32_t index, UBool exec, const char* &name
|
|||
testConfData();
|
||||
}
|
||||
break;
|
||||
default: name=""; break;
|
||||
case 5:
|
||||
name = "testBug8654";
|
||||
if (exec) {
|
||||
testBug8654();
|
||||
}
|
||||
break;
|
||||
default: name=""; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,7 +257,7 @@ void IntlTestSpoof::testInvisible() {
|
|||
TEST_ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_EQ(7, position);
|
||||
|
||||
// Tow acute accents, one from the composed a with acute accent, \u00e1,
|
||||
// Two acute accents, one from the composed a with acute accent, \u00e1,
|
||||
// and one separate.
|
||||
position = -42;
|
||||
UnicodeString s3 = UnicodeString("abcd\\u00e1\\u0301xyz").unescape();
|
||||
|
@ -261,6 +267,15 @@ void IntlTestSpoof::testInvisible() {
|
|||
TEST_TEARDOWN;
|
||||
}
|
||||
|
||||
void IntlTestSpoof::testBug8654() {
|
||||
TEST_SETUP
|
||||
UnicodeString s = UnicodeString("B\\u00c1\\u0301").unescape();
|
||||
int32_t position = -42;
|
||||
TEST_ASSERT_EQ(USPOOF_INVISIBLE, uspoof_checkUnicodeString(sc, s, &position, &status) & USPOOF_INVISIBLE );
|
||||
TEST_ASSERT_SUCCESS(status);
|
||||
TEST_ASSERT_EQ(3, position);
|
||||
TEST_TEARDOWN;
|
||||
}
|
||||
|
||||
static UnicodeString parseHex(const UnicodeString &in) {
|
||||
// Convert a series of hex numbers in a Unicode String to a string with the
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 2009, International Business Machines Corporation
|
||||
* Copyright (C) 2011, International Business Machines Corporation
|
||||
* and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*/
|
||||
|
@ -34,6 +34,8 @@ public:
|
|||
|
||||
void testConfData();
|
||||
|
||||
void testBug8654();
|
||||
|
||||
// Internal function to run a single skeleton test case.
|
||||
void checkSkeleton(const USpoofChecker *sc, uint32_t flags,
|
||||
const char *input, const char *expected, int32_t lineNum);
|
||||
|
|
|
@ -66,6 +66,7 @@ void UnicodeStringTest::runIndexedTest( int32_t index, UBool exec, const char* &
|
|||
case 20: name = "TestAppendable"; if (exec) TestAppendable(); break;
|
||||
case 21: name = "TestUnicodeStringImplementsAppendable"; if (exec) TestUnicodeStringImplementsAppendable(); break;
|
||||
case 22: name = "TestSizeofUnicodeString"; if (exec) TestSizeofUnicodeString(); break;
|
||||
case 23: name = "TestStartsWithAndEndsWithNulTerminated"; if (exec) TestStartsWithAndEndsWithNulTerminated(); break;
|
||||
|
||||
default: name = ""; break; //needed to end loop
|
||||
}
|
||||
|
@ -970,6 +971,17 @@ UnicodeStringTest::TestPrefixAndSuffix()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
UnicodeStringTest::TestStartsWithAndEndsWithNulTerminated() {
|
||||
UnicodeString test("abcde");
|
||||
const UChar ab[] = { 0x61, 0x62, 0 };
|
||||
const UChar de[] = { 0x64, 0x65, 0 };
|
||||
assertTrue("abcde.startsWith(ab, -1)", test.startsWith(ab, -1));
|
||||
assertTrue("abcde.startsWith(ab, 0, -1)", test.startsWith(ab, 0, -1));
|
||||
assertTrue("abcde.endsWith(de, -1)", test.endsWith(de, -1));
|
||||
assertTrue("abcde.endsWith(de, 0, -1)", test.endsWith(de, 0, -1));
|
||||
}
|
||||
|
||||
void
|
||||
UnicodeStringTest::TestFindAndReplace()
|
||||
{
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
* Test methods startsWith and endsWith
|
||||
**/
|
||||
void TestPrefixAndSuffix(void);
|
||||
void TestStartsWithAndEndsWithNulTerminated();
|
||||
/**
|
||||
* Test method findAndReplace
|
||||
**/
|
||||
|
|
Loading…
Add table
Reference in a new issue