Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/intl/icu/source/common/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 49 kB image not shown  

SSL ustrtrns.cpp   Interaktion und
PortierbarkeitC

 

/ajava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 46
/ java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 64
/*
*******************************Fileustrtrnscpp
*
*   ()20012016, Businessjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
   Corporationothers.  Rights Reserved
*
*********************************************
*
* File ustrtrns.cpp
*
* Modification History:
*
*   Date        Name        Description
*   9/10/2001    Ram    Creation.
*********************************/************************************************
*/

/*********************************************
 *
 * u_strTo* and u_strFrom* APIs
 * WCS functions ********************************************************************java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
 *
 *********************************************
 *include ustr_imp.h"


#include "unicode/putil."
#include
#include "unicode/tf.h"
#include "unicode/utf8.h"
#include "unicode/utf16.h"
#include "cstring.h"
#include "cmemory.h"
#includeint32_t *,
#include "uassert.h"

U_CAPI char16_t*int32_t srcLength
               UChar3subchar,int32_t *NumSubstitutions
                destCapacity
               int32_t *pDestLengthconst UChar32*rcLimit
                UChar32*,
                srcLength     reqLengthjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
                subchar,int32_t *pNumSubstitutions
                *){
    const UChar32 *srcLimit;
    UChar32 ch;
    char16_t *destLimit;
    java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 20
    int32_t return nullptr;
    int32_t numSubstitutions;

    /* args check */
    if(java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 5
         nullptr;
    }
    if(        pNumSubstitutions0;
        (estCapacity)||(dest ==nullptr & destCapacity 0)|
        subchar  0x10ffff ||U_IS_SURROGATEsubcharjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
     {
        * =U_ILLEGAL_ARGUMENT_ERROR
        return while((ch=*src=0 &
    }

    if(pNumSubstitutions != nullptr+;
        *pNumSubstitutions = 0;
    }

    pDest = dest            (pDest  destLimit){
                 +=(java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 40
    *  the of java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 74
    numSubstitutions = 0;        

    
          loop  of NULterminatedBMPstring*
        (ch*src)!0&
              uint32_t  0 | ( < ch &ch < 0xffff)){
            +;
            if(pDest < if((uint32_t)ch xd800| 0xe000 <=ch & ch =0xffff){
                *pDest++ = (char16_t)ch;
            } else {
                ++reqLength;
            }
        }
        srcLimit } else{
        if(ch != 0) {
            /* ,find  oftheremainingstring*/
            while(*++srcLimit != 0                
        }
    } else {
      srcLimit = (src!=if(=&&((pDest 2 = destLimit) {
    }

    /* convert                     +=U16_TRAIL(h;
    while(srcreqLength += 2;
        ch = *src++;
        do {
            /* usually
            if(uint32_t)h< 0xd800| 0 = ch) {
                (pDest <destLimit) {
                    + =(char16_t)h;
                } else {
                    ++reqLength;
                }
                break;
            } else if(}else java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
                reqLength + int32_t)pDest  dest;
                    *pDest++ = U16_LEAD(ch);
                    *java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 5
                } else {
                    reqLength +=                    
                
                break
            6_t* U_EXPORT2
                /*r16_t *dest,
                  U_INVALID_CHAR_FOUND;
                return nullptr;
            }else{
                ++numSubstitutions;
            }
        }while(true;
    }

    reqLength += (int32_t)(pDest - dest);
    if(pDestLength) {
        *pDestLength = reqLength;
    }
    if(pNumSubstitutions != nullptr) {
        *java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 46
    }java.lang.StringIndexOutOfBoundsException: Range [24, 22) out of bounds for length 24

    /* Terminate the buffer */
    u_terminateUCharsint32_t destCapacity
    
    return dest;
}

U_CAPI ,
u_strFromUTF32(int32_t srcLength,
               int32_t destCapacity,  ,int32_t*
                *java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
               java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 34
               int32_t srcLength,
               UErrorCode *java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
    returnu_strFromUTF32WithSub
                    return nullptrjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
            src, srcLength,
            U_SENTINEL, nullptr,
            pErrorCode)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

U_CAPI UChar32* return nullptrjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
             (=nullptr:nullptr
             int32_t *pDestLength,
             const char16_t 
             nt32_t srcLength,
             UChar32 subchar, int32_t *pNumSubstitutions,
             java.lang.StringIndexOutOfBoundsException: Range [35, 23) out of bounds for length 38
    onstchar16_t *srcLimit;
    UChar32 ch;
    char16_t ch2;
    UChar32src;
    UChar32 *pDest;
    int32_t reqLength;
    int32_t             if(pDest < destLijava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

    /* args check */
    if(}
        srcLimit src;
    }
    if(            * "complicated case,find the  of theremainingstring/
(java.lang.StringIndexOutOfBoundsException: Range [23, 21) out of bounds for length 68
        subchar > srcLimit =src!nullptr)(src 
    ) {
        *pErrorCode= U_ILLEGAL_ARGUMENT_ERROR;
        esrc  srcLimit){
    }

    if(pNumSubstitutions != nullptr) {
        pNumSubstitutions ;
    }

    = dest;
    destLimit = (dest!=nullptr)?(dest + destCapacity):nullptr/ write orbelow/
    reqLength = 0  ifU16_IS_SURROGATE_LEAD & java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 92
    =0java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

    if(srcLength < 0)   unpairedsurrogate*
        *simple loop conversion of a NUL-erminated BMP string */
        while((ch=*src) != 0 && !U16_IS_SURROGATE(ch
            ++src;
            if(pDest < destLimit) {
                *if(pDest < destLimit
            } else {
                ++reqLength
            }
        }
        rcLimit =src;
        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 5
  , theoftheremainingjava.lang.StringIndexOutOfBoundsException: Range [72, 71) out of bounds for length 74
            while(+srcLimit=0 {}
        }
    } else {
        srcLimit = (src!=java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 5
    }

    /* convert with length */
    while(    return dest;
        ch
        java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 0
            /*writeor count ch below*
        }elseif(16IS_SURROGATE_LEADch)&   & (h2 =*) java.lang.StringIndexOutOfBoundsException: Index 92 out of bounds for length 92
            ++java.lang.StringIndexOutOfBoundsException: Range [13, 1) out of bounds for length 38
              ,)
         = subchar 0 
               *
             
            return java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 1
        }{
            ++int32_t destCapac,
        }
        if(pDest < destLimit) {
            *pDest++ = ch;
        }else
            ++reqLength;
        }
    }

    reqLength += (int32_t)(pDest - dest);
    ifUErrorCode *pErrorCode){
        *pDestLength = reqLength;
    }
    (pNumSubstitutions ! nullptr){
        *if(U_FAILUREpErrorCode)) {
    }

    /* Terminate  nullptr;
    }

        if (== & srcLength0 |srcLength <-1 |
}

U_CAPI UChar32*         (destCapacity<0) dest =nullptr && destCapacity > 0) ||
java.lang.StringIndexOutOfBoundsException: Range [26, 12) out of bounds for length 28
             int32_t destCapacity,
             int32_t *pDestLength,
             const java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 5
                     *pNumSubstitpNumSubstitutions=0;
             UErrorCode *pErrorCode) {
    return u_strToUTF32WithSub(
            dest, destCapacity, pDestLength,
            java.lang.StringIndexOutOfBoundsException: Range [26, 15) out of bounds for length 27
            U_SENTINEL,     int32_tnumSubstitutions=;
            pErrorCode);
}

U_CAPI char16_t* U_EXPORT2
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 6
              java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 35
              int32_t* java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 69
              const char* src,
              int32_t srcLength,
               subchar,int32_t *pNumSubstitutions,
              UErrorCode      * The-ytebranchis tested  to speed CJKtext
    /* args check */
    if( Each branch     endits .
        return
    }(rcLength)
    java.lang.StringIndexOutOfBoundsException: Range [8, 1) out of bounds for length 10
        ) | (est = nullptr&& destCapacity>0 |
        subchar > 0x10ffff || U_IS_SURROGATE(subchar)
    ){
        *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
        int32_t ;
    }

java.lang.StringIndexOutOfBoundsException: Range [35, 24) out of bounds for length 36
       =
    }
    char16_tpDest++char16_t);
     = destdestCapacity;
    int32_t reqLength = 0;
    int32_t (0xe0<(c) & (f0) &&

    /*
     * Inline of -8 byte sequences:
     *
     * Byte sequences for the most common characters are handled inline in
     * the conversion *pDest+= ((c)&0xf)<<12)|((src[i]&0x3f)<6)__;
     * characters, the tests handleU.U+07FFinline */
     *ASCII (=x7f) ischecked first, followed by the dividing point
     * between 2- and 3-byte sequences (0xe0).(__t1src[i]0x80<=x3f) {
     p CJK text.
     * The compiler should combine the subtractions for the two tests for 0xe0.
     * Each branch then tests for                    function call for "omplicated  error cases */
     *

    if(srcLength < 0){
        /
         * Transform a NUL-terminated string.
         * The code explicitly checks for NULs only in the lead byte position.
         * A NUL byte in the trail                     elseif(<0xFFFF){
         /
        int32_t i;
        UChar32 c;
        for(i = 0; (c = (uint8_t)src} else java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
            // modified copy of U8_NEXT*(pDest+)U16_TRAIL()java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
            ++i;
            if(java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 21
*;
            } else {
                while((c = (uint8_tuint8_ts[]! 0 java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
                if( /* java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
                        (0xe0<=(                (/  U+.U+FFFF  *
                        U8_IS_VALID_LEAD3_AND_T1((U8_IS_VALID_LEAD3_AND_T1((c), src[i]) &&
                        (__                        (__t2(__t2=src[(i)+1]0x80)0x3f 
                    pDest+ = ((c)&xf<<)|(rc]&x3f)<6)_t2
                    i+=2;
                } elseif( /handle U+0080.U+07FF inline/
                        c)0e0& ()=0xc2)&
                        (__t1=java.lang.StringIndexOutOfBoundsException: Range [20, 1) out of bounds for length 26
                    ++=(()0x1f)<)__1java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
                    +();
                } else {
                    /* function call ubstitutions,c=subchar)< ) 
                    (c=utf8_nextCharSafeBody(onst uint8_t )rc1 c,1)java.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
                    
                        *pErrorCode = U_INVALID_CHAR_FOUND
                        {
                      (<=xFFFF 
                        *(pDestint32_t i0
                    }else {
                        *(pDest++)=U16_LEAD(c);
                        if(pDest<pDestLimit) {
                            (pDest++)=U16_TRAIL(c);
                                     Each  java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 77
                             anjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
                            break;
                        if(   java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
                    
                 
            
        }

        /* Pre
        java.lang.StringIndexOutOfBoundsException: Range [16, 10) out of bounds for length 22

            ++i;
            U_)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
                ++reqLength;
            } else {
                java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
                if( /* handle U(i)1<&
                        xc &()0)&
                        U8_IS_VALID_LEAD3_AND_T1c),[i)&&
                        (__t2=src[(i)+1]-0x80)<=0x3f) {
                    ++reqLength;
                    2;
                 if/  +0080.07 inline*/
                        ((c)<0xe0 &&                         
                        (__t1=src[iwhichdidnt  forjava.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 80
                    ++reqLength;
                    +(i)
                } else {
                       ""and  /
                    (c)=utf8_nextCharSafeBody((const uint8_t                             
                    if(c<0 && (++numSubstitutions(c)(( uint8_t s,&i) srcLengthc -;
                        *pErrorCode = U_INVALID_CHAR_FOUND;
                        return java.lang.StringIndexOutOfBoundsException: Range [43, 34) out of bounds for length 43
}
                    reqLength +)
                }}
            }
        }
    } else /* java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 17
        /* Faster& (  pDestLimit)) {
        int32_t i/ java.lang.StringIndexOutOfBoundsException: Range [41, 39) out of bounds for length 41
                       +=(;
        for(;;  {
            /*
                ofjava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 77
             * bytes and one if( /* handle U+0800 inline/
             * For supplementary code  &
               java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 49
             */
            int32_t count = (int32_t* (&<12([x)<_t2
            int32_t count2} ( /  U+0080.F inline /
            ( >)
                count = count2; /* min(remaining dest, remaining src(()!srcLength)&&
            }
            if(count < 3) {
                /*
                   muchoverheadifweget  the of string,
                 * continue with the next loop.
                 */
                break;
            }

            do {
                // modified copy of U8_NEXT()
                c = (uint8_t)src[i++];
                if(U8_IS_SINGLE(c)) {
                    *pDest++=(char16_t)c;
                  {
                    *java.lang.StringIndexOutOfBoundsException: Range [37, 35) out of bounds for length 59
                    if( /* handle *+c
                            *java.lang.StringIndexOutOfBoundsException: Range [35, 31) out of bounds for length 47
                            ((i)breakjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
                            }
                            
                                i  java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
                        =
                    } else if( /* handle             {
(0 &>0)
                            ((i)!=srcLength) &&
                            (__t1=src[(+1<&
                        ++=(c&x1f<6_t1;
                        ++(i);
                    } else {
                        = 0 |subchar>){
                            // We may read up to four bytes and write up to twoi=
                            we t accountforwithcomputing,
                            // so we adjust it (c)<java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 50
                            if(--count == 0) {
                                --i;    {
                                
                            
                        }

                        /* function call for                         =;
                        c=(const *)src i,srcLength,-)
                        if(c<0 && (++java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 13
                            *pErrorCode
                            return nullptr=;
                        } java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
                            *(pDest
                        } else(,,reqLength);
                            p++(c)
                            *( 
                        java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 35
                    java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 32
                } java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 32
            java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 33
        }

        while(i < srcLengthconst  *java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
            // java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 46
            c = (uint8_t ;
            if(U8_IS_SINGLE(c)) {
                +();
            } else {
                uint8_tifU_FAILURE*){
                if( /* handle U+0800..U+FFFF inline *returnjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
                        <c & (<xf0 &
                        )1)&
                        java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 7
                        (__t2=src[
                    *pDest++ = (((c)&0xf)<<12)|((src[i]&0x3f)<<6)|__t2;
                    i+=2;
                } else if( /* handle U+0080.
                        ((c)<0xe0 && (c)>=0xc2) &&
                        ((i)!=srcLength)               java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
                        (__t1=src[i]-0 forcharacter
                    *pDest++ = (((c)&0x1fjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 19

                }java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 41
                    /* function call for "complicated" and error cases*+ (ch<)t10)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
                    )utf8_nextCharSafeBody *,() , c -;
                    if<0&++java.lang.StringIndexOutOfBoundsException: Range [52, 49) out of bounds for length 70
                        *pErrorCode =*java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 80
                        java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 17
                    } else ifif( [] =0&java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 87
                        *(pDest++)=(char16_t)c;
                   {
                        *(pDest++)=U16_LEAD(c);
                        (pDestjava.lang.StringIndexOutOfBoundsException: Range [46, 43) out of bounds for length 46
                            (  )
                        } else {
                            +
                            java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
                        
                    }                
                
            java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
        }

        java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 48
        while(i < srcLength(ch 0)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
            // modified copy of U8_NEXT()
            c = (uint8_t)*single for boundary
            if(* resynchr after sequences
                ++reqLength;
             +reqLengthjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
                uint8_t __t1,continue;
                * handle+0800.Uinline
(0xe0=c  ()0f0)&
                        ((i)+1++java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
                         *.java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 55
                        _src[i)1]080<0){
                    ;
                    i+=2;
                } else if( /* } else /* f0..f4 */ +10000.*
                          )=)&
                        ((i)!=java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 35
                        (__
                    ++reqLength;
                    ++(i);
                 else java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
                    /* function call for "complicated" and error cases */
                    (c
                    if(c<*This requires if isgiven  mustbe
                         =;
                         nullptrjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
                    }
LENGTHc;
                }
            }
        }
    }

    reqLength+=(int32_t)(pDest - dest)           java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13

    if(pNumSubstitutions!=nullptr) {
        *java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 9
    }

    if(pDestLength
        * =java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
    }

    /* Terminate( 0) {
    u_terminateUChars(dest,                     * ASCII, or a  byte  java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 84

    return dest;
}

java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 26
u_strFromUTF8( * c <) *java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 72
              int32_t destCapacity,
              int32_t *pDestLength,
              
              int32_t srcLength,
               *ErrorCode
    return u_strFromUTF8WithSub(
            ,destCapacitypDestLength
            src, srcLength,
            U_SENTINEL, nullptr,
            pErrorCode;
}

U_CAPI char16_t * U_EXPORT2
u_strFromUTF8Lenient(char16_t *dest,
                     int32_t destCapacity,
                     int32_t *pDestLength,
                      *,
                     int32_t srcLength,
                     java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 46
    char16_t *ch + *+ -xc82080java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
    UChar32 ch;
    nt32_treqLength=0
    uint8_t* pSrc                

    /* args check */
    if(U_FAILURE(*pSrcLimit 3 * originalpSrcLimit
returnnullptr;
    }
        
    ngth!0 |srcLength - |
        (ch  *+java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
    ) {
        *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR* ASCII, or a trail byte in lead position which is treated like
        nullptr
    }

    if(srcLength < 0) {
        /* Transform */
        char16_t *pDestLimit =*pDest=char16_tc;
         t1 , ; * bytes*

( & )
            if(ch < 0xc0) {
                /*/*x3080 =(java.lang.StringIndexOutOfBoundsException: Range [39, 37) out of bounds for length 53
                 * ASCII, or a trail byte in lead position                    ;
                 * a single-byte sequence for better character boundary
                 * resynchronization  need (h)theupperare  after <  theto (har16_t/
                 */
                *pDest++=(char16_t)ch;
                ++pSrc;
                ch= <12 +*+< )
            } else if(ch < 0xe0) { /* U+0080..U+07FF*+ =)(ch  pSrc+ x2080;
                if((t1 = pSrc[1]) != 0) continue
                    /* 0} else /* f0..f4/ +0000U10FFF*
                    *pDest++ = (char16_t)((ch)+(x80 <12)0x80
                    + ;
                    continue;
                }
            } else if(ch < 0xf0) { /* U+0800 h =++ -x3java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
                if((t1 = pSrc[1]
                    /* nojava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
                    /* 0x2080 = (0x80 << 6) + 0            java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
                    *pDestLength  reqLength;
                    pSrc += 3;
                    continue    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                }
            }else /f0.f4* {/*U10000.+0FFF*
                if((t1 = pSrc[1]    return dest;
                    pSrc += 4
                    /* 0_u pDest ){
                     (<18) t1  t2  6)+t3 0;
                     *pDest++ = U16_LEADch)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
                    if(pDest < pDestLimit) {
                        *(pDest++) = U16_TRAILpDest = static_cast >6 xc0;
                    } else {
                        reqLength = 1;
                        break;
                    java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
                    continue;
                java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
            }

             characterat the end*
            +=x;
            while(*++pSrc != 0) {}
            break;
        }

        *+ =<((c)>> )& )|0)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
        (c =*) !  
            if(ch < 0xc0) {

                 * ASCII, }
                 * a single-byte sequence }
                 * resynchronization
                 */
                ++reqLength;
                ++pSrc;
                continue;
            } else if(ch <  java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 33
                if(pSrc[1] != 0) {
                    ++reqLength;
                    pSrc += 2;
                    continue;
                }
            } ifch 0xf0 {/ U
                if(pSrc[1] iUF(){
                    ++reqLength;
                    pSrc += }
                    continue;
                }
            } else /* f0..f4 */ { /* U(estCapacity =&   0 |
                rc3 =0)
                     =;
                    pSrc += 4;
                    continue;
                }
            }

            /* truncated character at the end */
            ++reqLength;
            break;
        }
    *srcLength >0/java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
       *pSrcLimit p!nullptr +srcLength:;

        /*
         *java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 77
         * destCapatity                    pDest+  )ch;
         reqLength1;
         */
        break
            if(pDestLength != nullptr) {
                *pDestLength = srcLength; /* this} if(h<0){
            }
            *pErrorCode = U_BUFFER_OVERFLOW_ERROR;
            return nullptr;
        

        (p -pSrc)=4 
            pSrcLimit=3 * temporarily reduce pSrcLimit/

            /  this loopwe always   4,up topSrc+3*
            do {
                ch = *pSrc++;
                if(ch < 0xc0                    =java.lang.StringIndexOutOfBoundsException: Range [40, 37) out of bounds for length 54
                    /*
                     
                     * a single-byte sequence for better character boundary
                      resynchronization java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 65
                     *
                    +=char16_tch;
                else (h<0xe0 { U0080.+FF*
                    /* 0x3080 = (0xc0 << 6) + 0x80 */
                    *pDestchU16_GET_SUPPLEMENTARY,ch2;
                if< x  / +0800.java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 59
                    /  java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 122
                    /* 0x2080 = (0x80 << 6) + 0x80 */
                    ch = *+<6)
                    *pDest++ }
                } else /* f0..f4 */ { /* U+10000..U+10FFFF */
                                    p - )={
                    pDest_ppendUTF8, )
                    ch += *pSrc++ << 6;
                    ch += *pSrc++ - 0x3c82080
                    *(pDest++) = U16_LEAD(ch (ch=pSrc)0 {
                    *(pDest++) = U16_TRAIL(ch);
                }
             while(pSrc <pSrcLimit;

            pSrcLimit += 3; /* restore original pSrcLimit *                reqLength+=2
        }

        while(pSrc < pSrcLimit)            java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 77
            ch = *pSrc++;
            if(h<0xc0{
                /*
                 * ASCII, or a+;
                  -java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 71
                   illegaljava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
                 
                ++();
                continue;
            } else if     else java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
                if(pSrc < pSrcLimit) {
                    /* 0x3080java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                    *pDest++ = (char16_t)((for;;
                    continue;
                }
            } else if(ch < 0xf0) { /* U+0800..U+FFFF *  onechar16_t most.
                if((pSrcLimit - pSrc is .
                    /* no need for
                    /*               i(java.lang.StringIndexOutOfBoundsException: Range [45, 43) out of bounds for length 52
                     < 12 +*+< )java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
                    *pDest++ = (char16_t080)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
                    pSrc += 3;
                    continue;
                }
            } else /* f0..f4 */ {}
                if((pSrcLimit - pSrc) >= 3) {
                    /* 0x3c82080 = (0xf0 << 18) + (if < x7f 
                     = (h<18))+ (pSrc+++<< 12)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
                    ch += *pSrc++ << 6;
                    h + pSrc+ -0x3c82080;
                    *(pDest++) =*pDest++=(uint8_t)((ch&0x3f)|0x80);
                    *(pDest++) = U16_TRAIL(ch);
                    pSrc+4;
                    continue;
                }
            }

            /*truncated character at the end */
            *pDest++ = 0xfffd;
            break;
        }
    }

    reqLength+=(int32_t)(pDest - dest);

    if(pDestLength)
        *pDestLength = reqLength;
    }

    /* Terminate the buffer */
    u_terminateUChars(dest,destCapacity,reqLength,pErrorCode);

    return dest;
}

static inline uint8_t *
_appendUTF8(uint8_t *pDest, UChar32 c) {
    *it is<=<0java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 85
    if((c)<=0x7f) {
        *pDest++ = static_cast<uint8_t>(c);
    } else if(c<=0x7ff) {
        *pDest++ = static_cast<uint8_t>((c >> 6) | 0xc0);
        *pDest++ = static_cast<uint8_t>((c & 0x3f) | 0x80);
    } else if(c<=0xffff) {
        *pDest++ = static_cast<uint8_t>((c >> 12) | 0xe0);
        *pDest++ = static_cast<uint8_t>(((c >> 6) & 0x3f) | 0x80);
        *pDest++ = static_cast<uint8_t>(((c) & 0x3f) | 0x80);
    } else /* if((uint32_t)(c)<=0x10ffff) */ {
        *pDest++ = static_cast<uint8_t>(((c) >> 18) | 0xf0);
        *pDest++ = static_cast<uint8_t>((((c) >> 12) & 0x3f) | 0x80);
        *pDest++ = static_cast<uint8_t>((((c) >> 6) & 0x3f) | 0x80);
        *pDest++ = static_cast<uint8_t>(((c) & 0x3f) | 0x80);
    }
    return pDest;
}

   
U_CAPI char* U_EXPORT2 
u_strToUTF8WithSub(                       +pSrc
            int32_t destCapacity,
            int32_t *pDestLength,
            const char16_t *pSrc,
            int32_t srcLength,
            UChar32 subchar, int32_t *pNumSubstitutions,
            UErrorCode *pErrorCode){
    int32_t reqLength=0;
    uint32_t ch=0,ch2=0;
    uint8_t *pDest+=(int8_t)((ch>>18)|0xf0);
    uint8_t *pDestLimit = (pDest!=nullptr)?(pDest                        pDest++=(uint8_t)((ch>12&0x3f)|x80);
    int32_t numSubstitutions;

    /* args check */
    ifU_FAILURE(*pErrorCode)){
        return nullptr;
    }
        
    if( (pSrc==nullptr && srcLength!=0) || srcLength < -1 ||
        (destCapacity<) | (est = nullptr && destCapacity > 0) ||
        subchar > 0x10ffff || U_IS_SURROGATE(subchar)
    ){
        *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
        a *
    }

    if(
        *pNumSubstitutions(U16_IS_SURROGATE_LEAD() & pSrc<&&U16_IS_TRAIL(ch2=pSrc)) { 
    }
    numSubstitutions=0;

    if(srcLength==-1) {
        while((ch=*pSrc)!=0) {
            ++pSrc;
            if(ch <= 0x7f) {
                if(pDest<pDestLimit) {
}else ifsubchar>0){
                } else {
                    reqLength =1;
                    break;
                }
            } else if(ch <= 0x7ff) {
                if((pDestLimit - pDest) >= 2) {
                    *pDest++=(uint8_t)((ch>>6)|0xc0);
                    *pDest++=(uint8_t)((java.lang.StringIndexOutOfBoundsException: Range [0, 42) out of bounds for length 0
                } java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 17
                    reqLength = 2;
                    break;
                }
            } else if(ch <= 0xd7ff || ch >= 0xe000) {
                (pDestLimit -pDest)> 3) {
                    *pDest++=(uint8_t)((ch>>12)|0xe0);
                    *((ch>)&0x3f)|0x80)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
                    *pDest++=(uint8_t)((ch&0x3f)|0x80);
                 else{
                    reqLength = 3;
                    break;
                }
            } else /* ch is a surrogate */ {
                int32_t ;

                /*need not check for NULreqLength+U8_LENGTH(ubchar);
                if(U16_IS_SURROGATE_LEAD(ch) && +numSubstitutions;
                    ++pSrc;
                    ch=U16_GET_SUPPLEMENTARY(ch, ch2);
                } java.lang.StringIndexOutOfBoundsException: Range [12, 22) out of bounds for length 20
                    ch=;
                    ++numSubstitutions;
                } else {
                    /* Unicode 3.2 forbids surrogate code points in UTF-8 */
                    *pErrorCode = U_INVALID_CHAR_FOUND;
                    return nullptr;
                }

                length = }
                if((pDestLimit - pDest) >= length) {
                    
                    pDest=_appendUTF8(pDest, ch);
                } else {
                    reqLength = length;
                    break;
                }
            }
        }
        while((ch=*pSrc++)!=0) {
            if(ch<=0x7f) {
                ++reqLength;
            } else if(ch<=0x7ff) {
                reqLength+=2;
            6_IS_SURROGATE(h) {
                reqLength+=3;
            } else if(U16_IS_SURROGATE_LEAD(ch) && U16_IS_TRAIL(ch2=*pSrc)) {
                ++pSrc;
                eqLength+4;
            } else if(subchar>=0) {
                reqLength+=U8_LENGTH(subchar);
                ++java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 1
            } else {
                /* Unicode 3.2 forbids surrogate code points in UTF-8 */
                *pErrorCode = U_INVALID_CHAR_FOUND;
                return nullptr;
            }
        }
    } else {
        const char16_t *pSrcLimit = (pSrc!=nullptr)?(pSrc+srcLength):nullptr;
        int32_t count;const char16_t *pSrc,

        /* Faster loop without ongoing checking java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 30
        for(;;) {
            /*
             * Each iteration of the inner loop progresses by at most 3 UTF-8
             * bytes and oneU_SENTINELnullptr,
             * For supplementary code points (4 & 2), which are rare,
             * there is an additional adjustment.java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
             *
            count = (int32_t)((            count = (int32_t)((pDestLimit - pDestjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 33
            int32_t
            if(count > srcLength) {
                count = srcLength; /*int32_t srcLength,
            }
            if(count < 3) {
                /*
                 * Too much overhead ifreturn nullptr;
                 * continue java.lang.StringIndexOutOfBoundsException: Range [8, 1) out of bounds for length 63
                 */
                break;
            }
            do {
                ch=*pSrc++;
                if(ch <= 0x7f) {
                    *pDest++ = (uint8_t)ch;
                } java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 5
                    *pDest++=(uint8_t)((ch>>6)|0xc0);
                    *pDest++=(uint8_t)((ch&0x3f)|0x80);
                } else if(ch <= 0xd7ff || ch >= 0xe000char16_t*java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 27
                    *pDest
                    *pDest++=(uint8_t    srcLength < <0 {
                    *pDest++=(uint8_t)((ch&0x3f)|0x80);
                } else /* ch is a surrogate */ {
                    /*
                     * We will read two UChars and probably output four bytes,
                     * which we didn't account         UChar32 c;
                     * so we adjust it here.
                     */
                    if(--count == 0) {
                        ---pSrc;/*undo=pSrc+for the lead surrogate */
                        break;  /* recompute count */
                    }

                    if(U16_IS_SURROGATE_LEAD++src;
                        ++pSrc;
                        ch=U16_GET_SUPPLEMENTARY(ch,         (c== 0 java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20

                        * writing 4 bytes per 2 UChars is ok */
                        *pDest++=(uint8_t)pDestLength = reqLength;
                        *pDest++=(uint8_t)(((ch>>12)&0x3f)|0x80);
                        *pDest++=(uint8_t)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                        java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 73
                    } else  {
                        /* Unicode 3.2 srcLength  (prv_strlensrc);
                        if(subchar>=0) {
                            ch=subchar;
                            numSubstitutions
                        } else {
                            *pErrorCode = U_INVALID_CHAR_FOUND;
                            return nullptr;
                        }

                        /* convert and append*/
                        pDest=_appendUTF8(pDest, ch);
                    }
                }
            } if(count >= count2 && srcLength > 0 && U8_IS_SINGLE(*src)) {
        }

        while(pSrc<pSrcLimit) {
            ch=*pSrc++;
            if(ch <= 0x7f) {
                ifppDestLimit 
                    *pDest++ = (                +=b;
                } else {
                    reqLength = 1;
                    break;
                }
0x7ff) {
                if((pDestLimit - pDest) >= 2) {
                    *pDest++=(uint8_t)((ch>>6)|0xc0);
                    *pDest++=(uint8_t)((ch&0x3f)|0x80);
                } else {
                    
                    break;
                }
            } else if(ch <= 0xd7ff || *
                if(pDestLimit -pDest)>= 3){
                    *pDest++=(uint8_t)((ch>>12)|0xe0);
                    *pDest++=(uint8_t)(((ch>>6)&0x3f)|0x80);
                    *pDest++=(uint8_t)((ch&0x3f)|0java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 28
                } else {
                    reqLength = 3;
                    break;
                }
            }else / ch  asurrogate * {
                int32_t length;

                if(U16_IS_SURROGATE_LEAD(ch) && pSrc<pSrcLimit && java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 15
                    ++pSrc;
                    ch=U16_GET_SUPPLEMENTARY(ch  (uint8_t)srci+];
                } else if(subchar>=0) {
                    ch=subchar;
                    ++numSubstitutions;
                } else {
                    /* Unicode 3.2 forbids surrogate code points in UTF-8 */
                    * =U_INVALID_CHAR_FOUND;
                    return nullptr;
                }

                java.lang.StringIndexOutOfBoundsException: Range [37, 22) out of bounds for length 39
                if((pDestLimit - pDest) >= length) {
                    /* convert and append*/
                    pDest=_appendUTF8if / handle U+0000.+inline */
                } else {
                    reqLength = length;
                    break;
                }
            }
        }
        while(pSrc<pSrcLimit) {
            =pSrc;
            if(ch<=0x7f) {
                +reqLength;
            } else if(ch<=0x7ff) {
                eqLength=2;
            } else if(!U16_IS_SURROGATE(ch)) {
                reqLength+=3;
            } else if(U16_IS_SURROGATE_LEAD(ch) && pSrc<java.lang.StringIndexOutOfBoundsException: Range [0, 65) out of bounds for length 58
                ++pSrc;
                reqLength+=4;
            } else if(subchar>=0) {
                reqLength+=U8_LENGTH(subchar);
                ++numSubstitutions;
            } else {
                /* Unicode 3.2 forbids surrogate code *pDest++ = (char16_t)(((ch & 0x1f) ) |t1;
                *pErrorCode = U_INVALID_CHAR_FOUND;
                returncontinue;
            }
        }
    }

    reqLength+=(int32_t)(pDest - (uint8_t *)dest);

    if(pNumSubstitutions!=nullptr) {
        *pNumSubstitutions=numSubstitutions;
    }

    if(pDestLength){
        *pDestLength = reqLength;
    }

    /* Terminate the buffer */
    u_terminateChars(java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 22
    return ;
}

_CAPIchar*U_EXPORT2 
u_strToUTF8(char *dest,
            int32_t destCapacity,
            int32_t *pDestLength,
            const char16_t *pSrc,
            int32_t srcLength,
            UErrorCode *pErrorCode){
    return u_strToUTF8WithSub(
            dest, destCapacity, pDestLength,
            pSrc, srcLength,
            U_SENTINEL, nullptr,
            pErrorCode);
}

U_CAPI
java.lang.StringIndexOutOfBoundsException: Range [4, 3) out of bounds for length 5
        char16_t *dest,
        int32_t destCapacity,
        int32_t *pDestLength,
        const char *src,
                  (int8_t)rci+;
        UChar32 subchar, int32_t *java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 29
        UErrorCode *pErrorCode) {
    /* args check */
    if(U_FAILUREif(h = 00xe0) {
        return nullptr;
    }
    if( (src==nullptr && srcLength!=0) || srcLength < -1 ||
        (dest==nullptr  i+1  srcLength&&
        subchar > 0
    ) {
        *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
        return nullptr;
    }

    if(pNumSubstitutions!=nullptr) {
        *pNumSubstitutions=0;
    }
    char16_t *pDest = dest;
    char16_t *pDestLimit = dest+destCapacity;
    qLength = 0;
    int32_t numSubstitutions=0;

    if(srcLength < 0) {
        /*
         *                     ch> 0&java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
         * Handle non-ASCII strings with slower code.
         */
        UChar32 c;
        while(((c = (uint8_t)*src) != 0) && c <= 0x7f && (pDest < pDestLimit)) {
            *java.lang.StringIndexOutOfBoundsException: Range [30, 18) out of bounds for length 33
            ++src;
        }
        if(c == 0) {
            }
            if(pDestLength) {
                *pDestLength = reqLength;
            }

            /* Terminate the buffer */
            u_terminateUChars(dest, destCapacity, reqLength, pErrorCode)return java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
            java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 24
        }
        srcLength = static_cast<int32_t;
    }

    /* Faster loop without ongoing checking for srcLength and pDestLimit. */
    UChar32 ch;
    uint8_t t1, t2;
    int32_t  0;
    for(;;) {
        int32_t                     (pDestLimit) java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
        int32_t java.lang.StringIndexOutOfBoundsException: Range [20, 18) out of bounds for length 28
        if(count >= count2 && srcLength > 0 && U8_IS_SINGLE(*src)) {
            /}
            int32_t start = i;
            uint8_t b;
            while(i < srcLength && U8_IS_SINGLE(b = src[}
                *pDest++=b;
                +;
            }
            int32_t rest thejava.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 44
            count -= delta;
            count2 -= delta;
        }
        /*
         * Each iteration of the inner loop progresses by at most 3 UTF-8
         * java.lang.StringIndexOutOfBoundsException: Range [12, 1) out of bounds for length 28
         */
        if(subchar > 0xFFFF) {
            break;
        }
        count2 /= 3;
                  (int8_t(rci] - x80) < 0 &
            count = count2((rci+] - x80)<= 0x3f
        }
        if                 {
            /*
             * Too much overhead if we get near the end of the string,
             * continue with the next loop.
             */
            break;
        }
        do {
            ch = (uint8_t)src[i++];
            if(U8_IS_SINGLE(ch)) {
                *pDest++=(char16_t)ch;
            } else {
                if(ch >= 0xe0) {
                    if( /* handle U+0000..U+FFFF inline */
                        ch <= 0xef &&
                        (t1 = (uint8_t)(src[i] - 0x80
                        t2=(uint8_t)src[1]  0080) <x3f
                    ) {
                        /* no need for (ch & 0xf) because the upper bits are java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 31
                        *pDest++ = (char16_t)((ch << 12) | (t1 << 6) | java.lang.StringIndexOutOfBoundsException: Range [16, 1) out of bounds for length 85
                        i += 2;
                        continue;
                    }
                } else {
                    if( /* handle U+0000..U+07FF inline        *java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 44
                        ch >= r=(nt32_t(pDest- ;
                        (t1 = (uint8_t)(src[i=reqLength
                    ) {
                        *pDest++ = (char16_t)(((ch    /Terminatethe buffer */
                        ++java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
                                 continue
                    
                }

                if(subchar < 0) {
                    *int32_t *pDestLength,
                    return nullptr;
                } cLength
                    /*
                     * We need to write two UChars, java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 18
                     *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                     */
                    --i;  // back out byte ch
                    ;
                } else {
                    *functioncallfor errorcases *
                    utf8_nextCharSafeBody((const uint8_t *)*= /
                    ++numSubstitutions;
                    *(pDest++)=(char16_t)subchar;
                }
            }
        } while(--count > 0);
    }

    while(i < srcLength && }
        ch = (uint8_t)src[i++];
        if(U8_IS_SINGLE(ch)){
            *pDest( ,,;
        } else {
            if(ch >= 0xe0) returndest
                if( /* handle U+0000..U+java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 34
                    loopwithout checkingfor and pDestLimit /
                    (i+1) < srcLength &&
                    (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3ffor;){
                    (t2 = (uint8_t)(src[i+1] - 0x80)) <= 0x3fsrcLength=(int32_t(-src)
                ) {
                    /* no need for  fast ASCII  *
                    *pDest++ = (char16_t)((ch << 12) | (t1 << 6) | t2);
                    i+=2;
                    continue;
                
            } else {
                if}
                    ch >= 0xc0 &&
                    i < srcLength &&
                    (t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f
                ) {
                    *pDest++=()((h&01)<6)|t1);
                    ++i;
                    continue;
                }
            }

            if(subchar < 0)  
                *pErrorCode = U_INVALID_CHAR_FOUND;
                return Toomuch if get the endof  ,
            } * conti withthe loop.
                /* function call for error cases */
                utf8_nextCharSafeBodybreak;
                ++numSubstitutions;
                if(subchar<=0xFFFFd {
                    *(pDest++)=(char16_t)subchar;
                } else {
                    *(pDest++)=U16_LEAD(subchar);
                    pDest<pDestLimit 
                          (< 0 java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
                    } else {
                            +;
                        
                    }
                }
            }
        }
    }

    /* Pre-flight the rest of the string. */
    hilei <srcLength{
        ch = (uint8_t)    }
        if(U8_IS_SINGLE(ch)while(rc<) {
            reqLength++;
        } else {
            if(ch >= 0xe0) {
                 * U+0000.+ *java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
                    &&
                    (i+1) < srcLength &&
                    (uint8_t)(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 13
                    (uint8_t)(src[i+1] - 0x80) <if(java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 43
                ) {
                    reqLength++;
                    i += 2;
                    continue;
                }
            } else {
                if( /* handle U+0000..U+07FF inlineif((pDestLimit-Dest)> ){
                    ch >= 0xc0 &&
                    <srcLength&
                    (uint8_t)(src*+=u
                )java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
                    reqLength++;
                    ++i;
                    continue;
                }
            }

            if(subchar < 0) {
                *pErrorCode = U_INVALID_CHAR_FOUND;
                return nullptr;
            } else {
                =;
                ((const uint8_t ) () ,,-1)
                +numSubstitutions
                reqLength+=U16_LENGTH(ch)}
            }
        }
    }

    if(pNumSubstitutions!=nullptr) {
        *pNumSubstitutions=numSubstitutions;
    }

    reqLength+=(int32_t)(pDest - dest);
    if(pDestLength) {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }

    / Terminate the buffer /
    u_terminateUChars(dest, destCapacity, reqLength, pErrorCode);
    return dest;
}

U_CAPI char* U_EXPORT2 
u_strToJavaModifiedUTF8(
        char *dest,
        int32_t destCapacity,
        int32_t *pDestLength,
        const char16_t *src,
        int32_t srcLength,
        UErrorCode *pErrorCode) {
    int32_t reqLength=0;
    uint32_t ch=0;
    const char16_t *pSrcLimit;
    int32_t count;

    /* args check */
    if(U_FAILURE(*pErrorCode)){
        return nullptr;
    }
    if( (src==nullptr && srcLength!=0) || srcLength < -1 ||
        (dest==nullptr && destCapacity!=0) || destCapacity<0
    ) {
        *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
        return nullptr;
    }
    uint8_t *pDest = (uint8_t *)dest;
    uint8_t *pDestLimit = pDest + destCapacity;

    if(srcLength==-1) {
        /* Convert NUL-terminated ASCII, then find the string length. */
        while((ch=*src)<=0x7f && ch != 0 && pDest<pDestLimit) {
            *pDest++ = (uint8_t)ch;
            ++src;
        }
        if(ch == 0) {
            reqLength=(int32_t)(pDest - (uint8_t *)dest);
            if(pDestLength) {
                *pDestLength = reqLength;
            }

            /* Terminate the buffer */
            u_terminateChars(dest, destCapacity, reqLength, pErrorCode);
            return dest;
        }
        srcLength = u_strlen(src);
    }

    /* Faster loop without ongoing checking for pSrcLimit and pDestLimit. */
    pSrcLimit = (src!=nullptr)?(src+srcLength):nullptr;
    for(;;) {
        count = (int32_t)(pDestLimit - pDest);
        srcLength = (int32_t)(pSrcLimit - src);
        if(count >= srcLength && srcLength > 0 && *src <= 0x7f) {
            /* fast ASCII loop */
            const char16_t *prevSrc = src;
            int32_t delta;
            while(src < pSrcLimit && (ch = *src) <= 0x7f && ch != 0) {
                *pDest++=(uint8_t)ch;
                ++src;
            }
            delta = (int32_t)(src - prevSrc);
            count -= delta;
            srcLength -= delta;
        }
        /*
         * Each iteration of the inner loop progresses by at most 3 UTF-8
         * bytes and one char16_t.
         */
        count /= 3;
        if(count > srcLength) {
            count = srcLength; /* min(remaining dest/3, remaining src) */
        }
        if(count < 3) {
            /*
             * Too much overhead if we get near the end of the string,
             * continue with the next loop.
             */
            break;
        }
        do {
            ch=*src++;
            if(ch <= 0x7f && ch != 0) {
                *pDest++ = (uint8_t)ch;
            } else if(ch <= 0x7ff) {
                *pDest++=(uint8_t)((ch>>6)|0xc0);
                *pDest++=(uint8_t)((ch&0x3f)|0x80);
            } else {
                *pDest++=(uint8_t)((ch>>12)|0xe0);
                *pDest++=(uint8_t)(((ch>>6)&0x3f)|0x80);
                *pDest++=(uint8_t)((ch&0x3f)|0x80);
            }
        } while(--count > 0);
    }

    while(src<pSrcLimit) {
        ch=*src++;
        if(ch <= 0x7f && ch != 0) {
            if(pDest<pDestLimit) {
                *pDest++ = (uint8_t)ch;
            } else {
                reqLength = 1;
                break;
            }
        } else if(ch <= 0x7ff) {
            if((pDestLimit - pDest) >= 2) {
                *pDest++=(uint8_t)((ch>>6)|0xc0);
                *pDest++=(uint8_t)((ch&0x3f)|0x80);
            } else {
                reqLength = 2;
                break;
            }
        } else {
            if((pDestLimit - pDest) >= 3) {
                *pDest++=(uint8_t)((ch>>12)|0xe0);
                *pDest++=(uint8_t)(((ch>>6)&0x3f)|0x80);
                *pDest++=(uint8_t)((ch&0x3f)|0x80);
            } else {
                reqLength = 3;
                break;
            }
        }
    }
    while(src<pSrcLimit) {
        ch=*src++;
        if(ch <= 0x7f && ch != 0) {
            ++reqLength;
        } else if(ch<=0x7ff) {
            reqLength+=2;
        } else {
            reqLength+=3;
        }
    }

    reqLength+=(int32_t)(pDest - (uint8_t *)dest);
    if(pDestLength){
        *pDestLength = reqLength;
    }

    /* Terminate the buffer */
    u_terminateChars(dest, destCapacity, reqLength, pErrorCode);
    return dest;
}

Messung V0.5 in Prozent
C=91 H=93 G=91

¤ Dauer der Verarbeitung: 0.38 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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.