ICU-11786 Terminate internalNext/Prev when we reach text limit, not just at UBRK_DONE, so more tests for #11770 can pass

X-SVN-Rev: 37913
This commit is contained in:
Peter Edberg 2015-09-09 03:55:20 +00:00
parent 36ef10c2df
commit e4d76d4125

View File

@ -342,9 +342,10 @@ SimpleFilteredSentenceBreakIterator::internalNext(int32_t n) {
// refresh text
resetState(status);
if(U_FAILURE(status)) return UBRK_DONE; // bail out
int64_t utextLen = utext_nativeLength(fText.getAlias());
//if(debug2) u_printf("str, native len=%d\n", utext_nativeLength(fText.getAlias()));
while (n != UBRK_DONE) { // outer loop runs once per underlying break (from fDelegate).
while (n != UBRK_DONE && n != utextLen) { // outer loop runs once per underlying break (from fDelegate).
SimpleFilteredSentenceBreakIterator::EFBMatchResult m = breakExceptionAt(n);
switch(m) {
@ -373,7 +374,7 @@ SimpleFilteredSentenceBreakIterator::internalPrev(int32_t n) {
if(U_FAILURE(status)) return UBRK_DONE; // bail out
//if(debug2) u_printf("str, native len=%d\n", utext_nativeLength(fText.getAlias()));
while (n != UBRK_DONE) { // outer loop runs once per underlying break (from fDelegate).
while (n != UBRK_DONE && n != 0) { // outer loop runs once per underlying break (from fDelegate).
SimpleFilteredSentenceBreakIterator::EFBMatchResult m = breakExceptionAt(n);
switch(m) {