From 3318c119ba3e65e8e37d196d023a15b2bf288ae4 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Thu, 30 Mar 2006 20:08:34 +0000 Subject: [PATCH] ICU-5032 Undo last two checkins. They were invalid. X-SVN-Rev: 19491 --- icu4c/source/common/uiter.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/icu4c/source/common/uiter.cpp b/icu4c/source/common/uiter.cpp index e5d8b130fe3..ee2c604c908 100644 --- a/icu4c/source/common/uiter.cpp +++ b/icu4c/source/common/uiter.cpp @@ -180,8 +180,11 @@ stringIteratorGetState(const UCharIterator *iter) { static void U_CALLCONV stringIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { - /* Some parameter checking has already been done by uiter_setState */ - if((int32_t)statestart || iter->limit<(int32_t)state) { + if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + /* do nothing */ + } else if(iter==NULL) { + *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; + } else if((int32_t)statestart || iter->limit<(int32_t)state) { *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; } else { iter->index=(int32_t)state; @@ -437,8 +440,9 @@ characterIteratorGetState(const UCharIterator *iter) { static void U_CALLCONV characterIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { - /* Some parameter checking has already been done by uiter_setState */ - if(iter->context==NULL) { + if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + /* do nothing */ + } else if(iter==NULL || iter->context==NULL) { *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; } else if((int32_t)state<((CharacterIterator *)(iter->context))->startIndex() || ((CharacterIterator *)(iter->context))->endIndex()<(int32_t)state) { *pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR; @@ -960,8 +964,11 @@ utf8IteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { - /* Some parameter checking has already been done by uiter_setState */ - if(state==utf8IteratorGetState(iter)) { + if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) { + /* do nothing */ + } else if(iter==NULL) { + *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; + } else if(state==utf8IteratorGetState(iter)) { /* setting to the current state: no-op */ } else { int32_t index=(int32_t)(state>>1); /* UTF-8 index */ @@ -1111,4 +1118,4 @@ uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) { } } -U_CDECL_END +U_CDECL_END \ No newline at end of file