SHARP_BadApple/heatshrink_decoder.cpp
HSD_sink_res heatshrink_decoder_sink(heatshrink_decoder *hsd,
        uint8_t *in_buf, size_t size, size_t *input_size) {
    if ((hsd == NULL) || (in_buf == NULL) || (input_size == NULL)) {
        return HSDR_SINK_ERROR_NULL;
    }

    size_t rem = HEATSHRINK_DECODER_INPUT_BUFFER_SIZE(hsd) - hsd->input_size;
    if (rem == 0) {
        *input_size = 0;
        return HSDR_SINK_FULL;
    }

    size = rem < size ? rem : size;
    LOG("-- sinking %zd bytes\n", size);
    /* copy into input buffer (at head of buffers) */
    memcpy(&hsd->buffers[hsd->input_size], in_buf, size);
    hsd->input_size += size;
    *input_size = size;
    return HSDR_SINK_OK;
}
/* Copy SIZE bytes into the decoder's input buffer, if it will fit. */
Copy SIZE bytes into the decoder's input buffer, if it will fit.
Copy SIZE bytes into the decoder ' s input buffer if it will fit .
HSD_sink_res heatshrink_decoder_sink(heatshrink_decoder *hsd,
        uint8_t *in_buf, size_t size, size_t *input_size) {
    if ((hsd == NULL) || (in_buf == NULL) || (input_size == NULL)) {
        return HSDR_SINK_ERROR_NULL;
    }
    size_t rem = HEATSHRINK_DECODER_INPUT_BUFFER_SIZE(hsd) - hsd->input_size;
    if (rem == 0) {
        *input_size = 0;
        return HSDR_SINK_FULL;
    }
    size = rem < size ? rem : size;
    LOG("-- sinking %zd bytes\n", size);
    memcpy(&hsd->buffers[hsd->input_size], in_buf, size);
    hsd->input_size += size;
    *input_size = size;
    return HSDR_SINK_OK;
}
HSD_sink_res heatshrink_decoder_sink ( heatshrink_decoder * hsd , uint8_t * in_buf , size_t size , size_t * input_size ) { if ( ( hsd == NULL ) || ( in_buf == NULL ) || ( input_size == NULL ) ) { return HSDR_SINK_ERROR_NULL ; } size_t rem = HEATSHRINK_DECODER_INPUT_BUFFER_SIZE ( hsd ) - hsd -> input_size ; if ( rem == 0 ) { * input_size = 0 ; return HSDR_SINK_FULL ; } size = rem < size ? rem : size ; LOG ( " \n " , size ) ; memcpy ( & hsd -> buffers [ hsd -> input_size ] , in_buf , size ) ; hsd -> input_size += size ; * input_size = size ; return HSDR_SINK_OK ; }
Copy SIZE bytes into the decoder's input buffer, if it will fit.
Copy SIZE bytes into the decoder ' s input buffer if it will fit .
/* copy into input buffer (at head of buffers) */