Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/archival/libarchive/unxz/xz_dec_bcj.c

    r2725 r3621  
    7878#ifdef XZ_DEC_X86
    7979/*
    80  * This is macro used to test the most significant byte of a memory address
     80 * This is used to test the most significant byte of a memory address
    8181 * in an x86 instruction.
    8282 */
    83 #define bcj_x86_test_msbyte(b) ((b) == 0x00 || (b) == 0xFF)
     83static inline int bcj_x86_test_msbyte(uint8_t b)
     84{
     85    return b == 0x00 || b == 0xFF;
     86}
    8487
    8588static noinline_for_stack size_t XZ_FUNC bcj_x86(
     
    444447     * in the output buffer. If everything cannot be filtered, copy it
    445448     * to temp and rewind the output buffer position accordingly.
     449     *
     450     * This needs to be always run when temp.size == 0 to handle a special
     451     * case where the output buffer is full and the next filter has no
     452     * more output coming but hasn't returned XZ_STREAM_END yet.
    446453     */
    447     if (s->temp.size < b->out_size - b->out_pos) {
     454    if (s->temp.size < b->out_size - b->out_pos || s->temp.size == 0) {
    448455        out_start = b->out_pos;
    449456        memcpy(b->out + b->out_pos, s->temp.buf, s->temp.size);
     
    468475        b->out_pos -= s->temp.size;
    469476        memcpy(s->temp.buf, b->out + b->out_pos, s->temp.size);
     477
     478        /*
     479         * If there wasn't enough input to the next filter to fill
     480         * the output buffer with unfiltered data, there's no point
     481         * to try decoding more data to temp.
     482         */
     483        if (b->out_pos + s->temp.size < b->out_size)
     484            return XZ_OK;
    470485    }
    471486
    472487    /*
    473      * If we have unfiltered data in temp, try to fill by decoding more
    474      * data from the next filter. Apply the BCJ filter on temp. Then we
    475      * hopefully can fill the actual output buffer by copying filtered
    476      * data from temp. A mix of filtered and unfiltered data may be left
    477      * in temp; it will be taken care on the next call to this function.
     488     * We have unfiltered data in temp. If the output buffer isn't full
     489     * yet, try to fill the temp buffer by decoding more data from the
     490     * next filter. Apply the BCJ filter on temp. Then we hopefully can
     491     * fill the actual output buffer by copying filtered data from temp.
     492     * A mix of filtered and unfiltered data may be left in temp; it will
     493     * be taken care on the next call to this function.
    478494     */
    479     if (s->temp.size > 0) {
     495    if (b->out_pos < b->out_size) {
    480496        /* Make b->out{,_pos,_size} temporarily point to s->temp. */
    481497        s->out = b->out;
Note: See TracChangeset for help on using the changeset viewer.