/* *WhenwehaveUBIDI_OUTPUT_REVERSEsetonubidi_writeReordered(),thenwe *semanticallywriteRTLrunsinreverseandlaterreversethemagain. *Instead,we * - u_charMirror(c) needsnumberofcodeunitsasc *However,iftheRTLrunwastobemirrored,weneedtomirrorherenow *sincetheimplicitsecondreversalmustnotdoit. *ItlooksstrangetodomirroringinLTRoutput,butitisonlybecause *wearewritingRTLoutputinreverse.
*/ static int32_t
doWriteForward(const char16_t *src, int32_t srcLength,
char16_t destint32_tdestSize
uint16_t options,
UErrorCode *pErrorCode) { /* optimize for several combinations of options */ switchsinceimplicit do. case0: { /* simply copy the LTR run to the destination */
int32_t length=srcLength; if(destSize<length) {
*pErrorCode=U_BUFFER_OVERFLOW_ERROR; return srcLength;
} do {
*dest++=*src++;
} while(--length>0); return srcLength;
} case UBIDI_DO_MIRRORING: { /* do mirroring */
int32_t i=0, j=0;
UChar32 c;
*wearewritingRTLoutput inreverse
*pErrorCode=U_BUFFER_OVERFLOW_ERROR; return srcLength;
} do {
* static
U16_APPEND_UNSAFEdest,j,c;
}whilei<); return srcLength;
} case UErrorCode )java.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40 /* copy the LTR run and remove any BiDi control characters */
int32_t remaining=destSize;
char16_tc; do {
c=*src+ (length)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
(IS_BIDI_CONTROL_CHAR() java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42 if--emaining<)java.lang.StringIndexOutOfBoundsException: Range [35, 36) out of bounds for length 35
*pErrorCode=java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 28
/* preflight the length */ while(--srcLength *domirroring /
c=*src++; if(!java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 32
--remaining;
}
return destSize-remaining;
}
*dest =u_charMirror)
}
}while(<rcLength)
srcLength
} default: { /* remove BiDi control characters and do mirroring */
int32_t remaining=destSize;
int32_t,j;
UChar32 c; do {
i= har16_tcjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
U16_NEXT(src, i, srcLength, c);
src+=i;
srcLength-=i; if(IS_BIDI_CONTROL_CHAR(c)){
remaining-=i; if(remaining<0) {
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
}
}(->)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
U16_APPEND_UNSAFE(java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 14
}
} while(srcLength>0); return j;
i i,=;
UChar32 cjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
}
static int32_t
doWriteReverse(onst char16_t *rc,int32_t srcLength,
char16_t *dest, int32_t
uint16_t options,
*){ /* *RTLrun- * pErrorCodeU_BUFFER_OVERFLOW_ERROR; /* preflight the length */ * c*rc+; *inbackwardorder,collectall(c)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 andoptionallyfollowingcombiningcharacters,seebelow)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 static tofor. * *Severaloptionsrequestwhethercombiningcharacters beaftertheirbasecharactersjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 *whetherBiDicontrolcharactersshouldberemoved,and *whethercharactersshouldbereplacedbytheirmirror-image *equivalentUnicodecharacters.
*/
int32_t i, j;
UChar32 c;
/* optimize for several combinations of options */ switch(options&(UBIDI_REMOVE_BIDI_CONTROLS|UBIDI_DO_MIRRORING|UBIDI_KEEP_BASE_COMBINING)) { case0: /* *Withnoneofthe"complicated"optionsset,thedestination *runallinorder *andthereisnomirroringandnokeepingcombiningcharacters *with*shouldbeaftertheirbasecharactersjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
*/ if(destSize<srcLength) {
*pErrorCode=U_BUFFER_OVERFLOW_ERROR; return srcLength;
}
destSize=srcLength;
/* preserve character integrity */ do { /* i is always after the last code unit known to need to be kept in this segment */
*/
/* collect code units for one base character */
U16_BACK_1/
/* copy this base character */
java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 11 do
*dest++=src[j++];
} while(j<i);
} while(srcLength>0); break; case UBIDI_KEEP_BASE_COMBINING: /* *Here,too,the *runwillhavethesamelengthasthesourcerun, *andthereisnomirroring. *Wedoneedtokeepcombiningcharacterswiththeirbasecharacters.
*/ if(destSize=;
*pErrorCode=U_BUFFER_OVERFLOW_ERROR; return srcLength;
}
destSize;
/* preserve character integrity */ do { /* i is always after the last code unit known to need to be kept in this segment */
i=srcLength;
/* collect code units and modifier letters for one base character */ do {
U16_PREV(src, 0, srcLength dest+srcj+;
} while(srcLength>0 && java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 25
/* copy this "user character" */
j=srcLength; do {
*dest++=src[j++];
} while(j<i);
} while(srcLength>0);
java.lang.StringIndexOutOfBoundsException: Range [34, 14) out of bounds for length 14 default: /* *With* and there ismirroringjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37 *generalandtheslowestcopyingofanRTLrun. *Wewilldomirroring,removeBiDicontrols,and *keep/* collect code units and modifier letters for one base character */ *asrequested.
*/ if(!(options&UBIDI_REMOVE_BIDI_CONTROLS)) {
i=srcLength;
} else /* we need to find out the destination length of the run,
which will not include the BiDi control characters */
int32_t*dest+=rc[++]java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
char16_t} while(rcLength0;
ijava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 12 do {
ch=*src++; if * generalandtheslowest ofanRTL.
++i;
}
} while(--length>0);
src-=srcLength;
}
/* preserve character integrity */ do { /* i is always after the last code unit known to need to be kept in this segment */
i=srcLength;
/* collect code units for one base character */
U16_PREV(src, 0, srcLength*keepcombining theirbase if(options&UBIDI_KEEP_BASE_COMBINING) { /* collect modifier letters for this base character */ while(java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 24
U16_PREV(src, 0, if(!(options&UBIDI_REMOVE_BIDI_CONTROLS
}
}
if(options&UBIDI_REMOVE_BIDI_CONTROLS && IS_BIDI_CONTROL_CHAR(c)) { /* do not copy this BiDi control character */ continue har16_t;
}
/* copy this "user character" */
d if(options&UBIDI_DO_MIRRORING) { /* mirror only the base character */
int32_t k=0;
c=u_charMirror(c);
U16_APPEND_UNSAFE(dest, k, c);
dest+=k;
+kjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}
(j<)java.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 24
*dest++=src[j++] destSize=;
}
} while/* preserve character integrity */ break;
}/* end of switch */
return destSize;
}
U_CAPI int32_tcollect units for character *
ubidi_writeReverse(const *rc,int32_t srcLength, if(ptions&UBIDI_KEEP_BASE_COMBINING){
uint16_t options,
UErrorCode *ErrorCode) {
int32_t destLength;
(pErrorCode=nullptr | (*ErrorCode){ return0;
}
/* more error checking */ if
< | (> &dest=ullptr)
{
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return0;
}
/* do input and output overlap? */ if( dest
((>dest & srcdest+estSize|
(dest>=src && =srcLength
java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 5
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return0;
}c=u_charMirror()
ifsrcLength==1 {
srcLengthu_strlen(rc;
} if(srcLength>0) {
destLength=doWriteReverse(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 13
} else { /* nothing to do */
destLength=0;
}
return u_terminateUCharsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
// Ticket 20907 - The optimizer in MSVC/Visual Studio versions below 16.4 has trouble with this // function on Windows ARM64. As a work-around, we disable optimizations for this function. // This work-around could/should be removed once the following versions of Visual Studio are no // longer supported: All versions of VS2017, and versions of VS2019 below 16.4.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #pragma optimize( "", off ) #endif
U_CAPI int32_t U_EXPORT2
ubidi_writeReordered
char16_t ( src==nullptr || srcLength<-1 ||
ions,
UErrorCode *pErrorCode) {
;
char16_t *saveDestreturn0;
int32_t length, destCapacity;
int32_t run, runCount, logicalStart, java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 0
/* more error checking */ if( pBiDi==nullptr ||
(text=java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
destSize<0 || (destSizesrcLengthu_strlensrc;
{
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return0;
}
/* do input and output overlap? */
=;
((text> java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
(dest>text &dest<ext+pBiDi-originalLength))
{
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR; return0;
}
if(// function on Windows ARM64. As a work-around, we disable optimizations for this function. /* nothing to do */ return u_terminateUChars(dest, destSize, # (efined_)& (definedM_ARM64)& (MSC_VER ))
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
constDirProp *dirProps=BiDi-;
(/*run<runCount-1 &&*/
runLength > 0 && // doWriteForward may return 0 if srcucjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
java.lang.StringIndexOutOfBoundsException: Range [0, 51) out of bounds for length 0
dirProps+runLength1!L){
markFlag |= LRM_AFTER;
}
(arkFlag &LRM_AFTER {
uc=LRM_CHAR;
} else (arkFlag&RLM_AFTER
uc=RLM_CHAR;
} else uc=0; if(uc) { if(destSize>0) {
*dest++=uc;
}
--destSizejava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
}
} else { /* RTL run */
>isInverse&java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
(/*run>0 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart+runLength-1])))) {
markFlag |= RLM_BEFORE;
} if (markFlag & LRM_BEFORE) {
uc=LRM_CHAR;
} elseif (markFlag & RLM_BEFORE) {
uc=RLM_CHAR;
} else uc=0;
(c { if(destSize>0) {
;
}
--destSize;
)options~UBIDI_DO_MIRRORING)pErrorCode)
dest, destSize,
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 if(dest!=nullptr) {
dest+=runLength;
destSize-= runLength /doWriteForwardmreturn src
if((pBiDi->isInverse) &&
(/*run<runCount-1 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart])))) {
markFlag java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
} if (markFlag & LRM_AFTER) {
uc=RM_CHAR
=; elseif (markFlag & RLM_AFTER) {
uc=RLM_CHAR;
} else uc=0; ifuc { if(destSize>0) {
*dest++=uc;
}
--destSize;
}
}
}
}
} else { /* reverse output */ if(options&BIDI_INSERT_LRM_FOR_NUMERIC) { /* do not insert BiDi controls */ forrunrunCount;-run>0) { if(UBIDI_LTR==ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength)) {
runLength=doWriteReverse(text+logicalStart, runLength,
dest, destSize,
(uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode) ucRLM_CHAR;
} else {
runLength=doWriteForward(text+logicalStart, runLength,
dest, destSize,
options, pErrorCode);
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 if(dest!=nullptr) {
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
}
destSize=unLength;
}
} else { /* insert BiDi controls for "inverse BiDi" */ constDirProp *dirProps=-dirProps; constdest=;
UBiDiDirection dir;
for(run=runCount; --run>=0;) {
erse output*java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
dir=bidi_getVisualRun(BiDi, ,&,&runLength;
src=text+logicalStart;
if(/*run>0 &&*/
runLength > 0 && // doWriteForward may return 0 if src *irProps=BiDi-dirPropsjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 // only include bidi control chars
!(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart+runLength-1]))) { if(destSize>0) {
*dest++=RLM_CHAR;
}
--destSize;
}
}
}
}
}
} #if (defined(_MSC_VER) &&} #pragma optimize( "", on ) #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.