Check-in [d74c9c42c0]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fix encoding issues in tclcompiler
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d74c9c42c0b57a11a484308d8c222ecdc44b6ecd
User & Date: chw 2019-07-06 08:48:00.067
References
2019-07-07
05:18
improve fix from [d74c9c42c0] check-in: ab2836e6c1 user: chw tags: trunk
Context
2019-07-06
19:28
add logic to load/mount kit from non-native filesystem check-in: f125b3dc59 user: chw tags: trunk
08:48
fix encoding issues in tclcompiler check-in: d74c9c42c0 user: chw tags: trunk
2019-07-05
19:46
add tcl upstream changes check-in: 5438017a85 user: chw tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
jni/tcl/library/msgs/ja.msg became executable.
Changes to undroid/tclcompiler/cmpWrite.c.
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
A85EncodeBytes(interp, bytesPtr, numBytes, ctxPtr)
    Tcl_Interp *interp;		/* the current interpreter */
    unsigned char *bytesPtr;	/* the 4-byte sequence to encode */
    int numBytes;		/* how many bytes to encode. If < 4, this
                                 * is the last set in the run. */
    A85EncodeContext *ctxPtr;	/* the encoding context */
{
    long int word = 0;
    int i;
    char toEmit[5];

    for (i=numBytes ; i < 4 ; i++) {
        bytesPtr[i] = 0;
    }

    for (i=3 ; i >= 0 ; i--) {
        word <<= 8;
        word |= bytesPtr[i];
    }

    if (word == 0) {
        A85EmitChar(interp, 'z', ctxPtr);
    }  else {
        int tmp = 0;

        if (word < 0) {
            /* Because some don't support unsigned long */
            tmp = 32;
            word = word - (long)(85L * 85 * 85 * 85 * 32);
        }
        if (word < 0) {
            tmp = 64;
            word = word - (long)(85L * 85 * 85 * 85 * 32);
        }

        /*
         * we emit from least significant to most significant char, so that
         * the 0 chars from an incomplete 4-tuple are the last ones in the
         * sequence and can be omitted (for the last 4-tuple in the array)
         */

        toEmit[4] = EN((word / (long)(85L * 85 * 85 * 85)) + tmp);
        word %= (long)(85L * 85 * 85 * 85);
        toEmit[3] = EN(word / (85L * 85 * 85));
        word %= (85L * 85 * 85);
        toEmit[2] = EN(word / (85L * 85));
        word %= (85L * 85);
        toEmit[1] = EN(word / 85);
        word %= 85;
        toEmit[0] = EN(word);

        /*
         * Emit only 'numBytes+1' chars, since the extra ones are all '!'
         * and can therefore be reconstructed by the decoder (if we know the
         * number of bytes that were encoded).
         */







|














|
<

<
<
<
<
<
<
<
<
<
<

|

|


|
|
|
|
|
|
|
|







4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549

4550










4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
A85EncodeBytes(interp, bytesPtr, numBytes, ctxPtr)
    Tcl_Interp *interp;		/* the current interpreter */
    unsigned char *bytesPtr;	/* the 4-byte sequence to encode */
    int numBytes;		/* how many bytes to encode. If < 4, this
                                 * is the last set in the run. */
    A85EncodeContext *ctxPtr;	/* the encoding context */
{
    unsigned long word = 0;
    int i;
    char toEmit[5];

    for (i=numBytes ; i < 4 ; i++) {
        bytesPtr[i] = 0;
    }

    for (i=3 ; i >= 0 ; i--) {
        word <<= 8;
        word |= bytesPtr[i];
    }

    if (word == 0) {
        A85EmitChar(interp, 'z', ctxPtr);
    } else {












        /*
         * We emit from least significant to most significant char, so that
         * the 0 chars from an incomplete 4-tuple are the last ones in the
         * sequence and can be omitted (for the last 4-tuple in the array).
         */

        toEmit[4] = EN(word / (85UL * 85 * 85 * 85));
        word %= (85UL * 85 * 85 * 85);
        toEmit[3] = EN(word / (85UL * 85 * 85));
        word %= (85UL * 85 * 85);
        toEmit[2] = EN(word / (85UL * 85));
        word %= (85UL * 85);
        toEmit[1] = EN(word / 85UL);
        word %= 85UL;
        toEmit[0] = EN(word);

        /*
         * Emit only 'numBytes+1' chars, since the extra ones are all '!'
         * and can therefore be reconstructed by the decoder (if we know the
         * number of bytes that were encoded).
         */