/*
******************************************************************************
*
-* Copyright (C) 2000-2007, International Business Machines
+* Copyright (C) 2000-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
#include "unicode/ustring.h"
#include "unicode/uchar.h"
#include "unicode/ubidi.h"
+#include "unicode/utf16.h"
#include "cmemory.h"
#include "ustr_imp.h"
#include "ubidiimp.h"
return srcLength;
}
do {
- UTF_NEXT_CHAR(src, i, srcLength, c);
+ U16_NEXT(src, i, srcLength, c);
c=u_charMirror(c);
- UTF_APPEND_CHAR_UNSAFE(dest, j, c);
+ U16_APPEND_UNSAFE(dest, j, c);
} while(i<srcLength);
return srcLength;
}
UChar32 c;
do {
i=0;
- UTF_NEXT_CHAR(src, i, srcLength, c);
+ U16_NEXT(src, i, srcLength, c);
src+=i;
srcLength-=i;
if(!IS_BIDI_CONTROL_CHAR(c)) {
return destSize-remaining;
}
c=u_charMirror(c);
- UTF_APPEND_CHAR_UNSAFE(dest, j, c);
+ U16_APPEND_UNSAFE(dest, j, c);
}
} while(srcLength>0);
return j;
i=srcLength;
/* collect code units for one base character */
- UTF_BACK_1(src, 0, srcLength);
+ U16_BACK_1(src, 0, srcLength);
/* copy this base character */
j=srcLength;
/* collect code units and modifier letters for one base character */
do {
- UTF_PREV_CHAR(src, 0, srcLength, c);
+ U16_PREV(src, 0, srcLength, c);
} while(srcLength>0 && IS_COMBINING(u_charType(c)));
/* copy this "user character" */
i=srcLength;
/* collect code units for one base character */
- UTF_PREV_CHAR(src, 0, srcLength, c);
+ U16_PREV(src, 0, srcLength, c);
if(options&UBIDI_KEEP_BASE_COMBINING) {
/* collect modifier letters for this base character */
while(srcLength>0 && IS_COMBINING(u_charType(c))) {
- UTF_PREV_CHAR(src, 0, srcLength, c);
+ U16_PREV(src, 0, srcLength, c);
}
}
/* mirror only the base character */
int32_t k=0;
c=u_charMirror(c);
- UTF_APPEND_CHAR_UNSAFE(dest, k, c);
+ U16_APPEND_UNSAFE(dest, k, c);
dest+=k;
j+=k;
}
dest, destSize,
options, pErrorCode);
}
- dest+=runLength;
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
destSize-=runLength;
}
} else {
runLength=doWriteForward(src, runLength,
dest, destSize,
(uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
- dest+=runLength;
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
destSize-=runLength;
if((pBiDi->isInverse) &&
runLength=doWriteReverse(src, runLength,
dest, destSize,
options, pErrorCode);
- dest+=runLength;
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
destSize-=runLength;
if((pBiDi->isInverse) &&
dest, destSize,
options, pErrorCode);
}
- dest+=runLength;
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
destSize-=runLength;
}
} else {
runLength=doWriteReverse(src, runLength,
dest, destSize,
(uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
- dest+=runLength;
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
destSize-=runLength;
if(/*run>0 &&*/ dirProps[logicalStart]!=L) {
runLength=doWriteForward(src, runLength,
dest, destSize,
options, pErrorCode);
- dest+=runLength;
+ if(dest!=NULL) {
+ dest+=runLength;
+ }
destSize-=runLength;
if(/*run>0 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart+runLength-1]))) {