/*
*******************************************************************************
*
-* Copyright (C) 2003, International Business Machines
+* Copyright (C) 2003-2008, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
srcIndex=delta;
if(srcIndex>api->start) {
/* look for a position in the arrays with a known state */
- while(srcIndex<limit && chars[srcIndex]==UITER_NO_STATE) {
+ while(srcIndex<limit && states[srcIndex]==UITER_NO_STATE) {
++srcIndex;
}
}
srcIndex=destIndex-delta;
if(srcIndex<api->limit) {
/* look for a position in the arrays with a known state */
- while(srcIndex>start && chars[srcIndex]==UITER_NO_STATE) {
+ while(srcIndex>start && states[srcIndex]==UITER_NO_STATE) {
--srcIndex;
}
}
UCharIterator *api=&uni->api;
/* make capacity/4 room at the end of the arrays */
- int32_t limit, capacity, room, delta;
+ int32_t limit, capacity, room;
UErrorCode errorCode;
limit=api->limit;
capacity=uni->capacity;
room=capacity/4;
- delta=room-(capacity-limit);
- if(delta>0) {
+ if(room>(capacity-limit)) {
/* move array contents to make room */
- moveContentsTowardStart(api, uni->chars, uni->states, delta);
+ moveContentsTowardStart(api, uni->chars, uni->states, room);
api->index=limit=api->limit;
uni->hasPrevious=TRUE;
}
UCharIterator *api=&uni->api;
/* make capacity/4 room at the start of the arrays */
- int32_t start, capacity, room, delta;
+ int32_t start, capacity, room;
UErrorCode errorCode;
start=api->start;
capacity=uni->capacity;
room=capacity/4;
- delta=room-start;
- if(delta>0) {
+ if(room>start) {
/* move array contents to make room */
- moveContentsTowardEnd(api, uni->chars, uni->states, delta);
+ moveContentsTowardEnd(api, uni->chars, uni->states, room);
api->index=start=api->start;
uni->hasNext=TRUE;
}
/* allocate */
uni=NULL;
if(stackMem!=NULL && stackMemSize>=sizeof(UNormIterator)) {
- size_t align=U_ALIGNMENT_OFFSET(stackMem);
- if(align==0) {
+ if(U_ALIGNMENT_OFFSET(stackMem)==0) {
/* already aligned */
uni=(UNormIterator *)stackMem;
- } else if((stackMemSize-=align)>=sizeof(UNormIterator)) {
- /* needs alignment */
- uni=(UNormIterator *)((char *)stackMem+align);
} else {
- /* does not fit */
+ int32_t align=(int32_t)U_ALIGNMENT_OFFSET_UP(stackMem);
+ if((stackMemSize-=align)>=(int32_t)sizeof(UNormIterator)) {
+ /* needs alignment */
+ uni=(UNormIterator *)((char *)stackMem+align);
+ }
}
+ /* else does not fit */
}
if(uni!=NULL) {