| 522 | |
| 523 | |
| 524 | String __hxcpp_char_array_to_utf8_string(Array<int> &inChars,int inFirst, int inLen) |
| 525 | { |
| 526 | int len = inChars->length; |
| 527 | if (inFirst<0) |
| 528 | inFirst = 0; |
| 529 | if (inLen<0) inLen = len; |
| 530 | if (inFirst+inLen>len) |
| 531 | inLen = len-inFirst; |
| 532 | if (inLen<=0) |
| 533 | return String::emptyString; |
| 534 | |
| 535 | int *base = &inChars[0]; |
| 536 | #ifdef HX_SMART_STRINGS |
| 537 | bool hasBig = false; |
| 538 | for(int i=0;i<inLen;i++) |
| 539 | if (base[i+inFirst]>127) |
| 540 | { |
| 541 | hasBig = true; |
| 542 | break; |
| 543 | } |
| 544 | |
| 545 | if (hasBig) |
| 546 | { |
| 547 | char16_t *ptr = String::allocChar16Ptr(inLen); |
| 548 | for(int i=0;i<inLen;i++) |
| 549 | ptr[i] = base[i+inFirst]; |
| 550 | return String(ptr, inLen); |
| 551 | } |
| 552 | #endif |
| 553 | char *result = TConvertToUTF8(base+inFirst,&len,0,true); |
| 554 | return String(result,len); |
| 555 | } |
| 556 | |
| 557 | Array<int> __hxcpp_utf8_string_to_char_array(String &inString) |
| 558 | { |
nothing calls this directly
no test coverage detected