Diff
Not logged in

Differences From Artifact [e99fd221b0]:

To Artifact [4d8ecc6ca8]:


769
770
771
772
773
774
775

776

777
778
779



780

781
782
783
784
785
786
787

const char *
Tcl_UtfAtIndex(
    register const char *src,	/* The UTF-8 string. */
    register size_t index)		/* The position of the desired character. */
{
    Tcl_UniChar ch = 0;

    int len = 1;


    if (index != (size_t)-1) {
	while (index--) {



	    src += TclUtfToUniChar(src, &ch);

	}
#if TCL_UTF_MAX <= 4
	if (!len) {
	    /* Index points at character following High Surrogate */
	    src += TclUtfToUniChar(src, &ch);
	}
#endif







>

>



>
>
>

>







769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793

const char *
Tcl_UtfAtIndex(
    register const char *src,	/* The UTF-8 string. */
    register size_t index)		/* The position of the desired character. */
{
    Tcl_UniChar ch = 0;
#if TCL_UTF_MAX <= 4
    int len = 1;
#endif

    if (index != (size_t)-1) {
	while (index--) {
#if TCL_UTF_MAX <= 4
	    src += (len = TclUtfToUniChar(src, &ch));
#else
	    src += TclUtfToUniChar(src, &ch);
#endif
	}
#if TCL_UTF_MAX <= 4
	if (!len) {
	    /* Index points at character following High Surrogate */
	    src += TclUtfToUniChar(src, &ch);
	}
#endif