Lines Matching defs:buf

176 uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc)
181 crc = xz_crc32_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8);
324 static inline uint32_t get_unaligned_le32(const uint8_t *buf)
326 return (uint32_t)buf[0]
327 | ((uint32_t)buf[1] << 8)
328 | ((uint32_t)buf[2] << 16)
329 | ((uint32_t)buf[3] << 24);
334 static inline uint32_t get_unaligned_be32(const uint8_t *buf)
336 return (uint32_t)(buf[0] << 24)
337 | ((uint32_t)buf[1] << 16)
338 | ((uint32_t)buf[2] << 8)
339 | (uint32_t)buf[3];
344 static inline void put_unaligned_le32(uint32_t val, uint8_t *buf)
346 buf[0] = (uint8_t)val;
347 buf[1] = (uint8_t)(val >> 8);
348 buf[2] = (uint8_t)(val >> 16);
349 buf[3] = (uint8_t)(val >> 24);
354 static inline void put_unaligned_be32(uint32_t val, uint8_t *buf)
356 buf[0] = (uint8_t)(val >> 24);
357 buf[1] = (uint8_t)(val >> 16);
358 buf[2] = (uint8_t)(val >> 8);
359 buf[3] = (uint8_t)val;
450 /* Amount of already filtered data in the beginning of buf */
453 /* Total amount of data currently stored in buf */
468 uint8_t buf[16];
499 static size_t bcj_x86(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
519 if ((buf[i] & 0xFE) != 0xE8)
528 b = buf[i + 4 - mask_to_bit_num[prev_mask]];
540 if (bcj_x86_test_msbyte(buf[i + 4])) {
541 src = get_unaligned_le32(buf + i + 1);
557 put_unaligned_le32(dest, buf + i + 1);
571 static size_t bcj_powerpc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
577 instr = get_unaligned_be32(buf + i);
583 put_unaligned_be32(instr, buf + i);
592 static size_t bcj_ia64(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
634 mask = branch_table[buf[i] & 0x1F];
643 instr |= (uint64_t)(buf[i + j + byte_pos])
665 buf[i + j + byte_pos]
676 static size_t bcj_arm(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
682 if (buf[i + 3] == 0xEB) {
683 addr = (uint32_t)buf[i] | ((uint32_t)buf[i + 1] << 8)
684 | ((uint32_t)buf[i + 2] << 16);
688 buf[i] = (uint8_t)addr;
689 buf[i + 1] = (uint8_t)(addr >> 8);
690 buf[i + 2] = (uint8_t)(addr >> 16);
699 static size_t bcj_armthumb(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
705 if ((buf[i + 1] & 0xF8) == 0xF0
706 && (buf[i + 3] & 0xF8) == 0xF8) {
707 addr = (((uint32_t)buf[i + 1] & 0x07) << 19)
708 | ((uint32_t)buf[i] << 11)
709 | (((uint32_t)buf[i + 3] & 0x07) << 8)
710 | (uint32_t)buf[i + 2];
714 buf[i + 1] = (uint8_t)(0xF0 | ((addr >> 19) & 0x07));
715 buf[i] = (uint8_t)(addr >> 11);
716 buf[i + 3] = (uint8_t)(0xF8 | ((addr >> 8) & 0x07));
717 buf[i + 2] = (uint8_t)addr;
727 static size_t bcj_sparc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
733 instr = get_unaligned_be32(buf + i);
740 put_unaligned_be32(instr, buf + i);
757 uint8_t *buf, size_t *pos, size_t size)
761 buf += *pos;
767 filtered = bcj_x86(s, buf, size);
772 filtered = bcj_powerpc(s, buf, size);
777 filtered = bcj_ia64(s, buf, size);
782 filtered = bcj_arm(s, buf, size);
787 filtered = bcj_armthumb(s, buf, size);
792 filtered = bcj_sparc(s, buf, size);
815 memcpy(b->out + b->out_pos, s->temp.buf, copy_size);
820 memmove(s->temp.buf, s->temp.buf + copy_size, s->temp.size);
862 memcpy(b->out + b->out_pos, s->temp.buf, s->temp.size);
882 memcpy(s->temp.buf, b->out + b->out_pos, s->temp.size);
906 b->out = s->temp.buf;
908 b->out_size = sizeof(s->temp.buf);
920 bcj_apply(s, s->temp.buf, &s->temp.filtered, s->temp.size);
1212 uint8_t *buf;
1214 /* Old position in buf (before decoding more data) */
1217 /* Position in buf */
1226 /* Write limit; we don't write to buf[limit] or later bytes. */
1263 * temp.buf or the caller-provided input buffer.
1430 uint8_t buf[3 * LZMA_IN_REQUIRED];
1475 return dict->full > 0 ? dict->buf[offset] : 0;
1483 dict->buf[dict->pos++] = byte;
1509 dict->buf[dict->pos++] = dict->buf[back++];
1537 memcpy(dict->buf + dict->pos, b->in + b->in_pos, copy_size);
1568 memcpy(b->out + b->out_pos, dict->buf + dict->start,
1984 * s->temp.buf, which (hopefully) gets filled on the next call to this
2001 memcpy(s->temp.buf + s->temp.size, b->in + b->in_pos, tmp);
2004 memset(s->temp.buf + s->temp.size + tmp, 0,
2005 sizeof(s->temp.buf)
2016 s->rc.in = s->temp.buf;
2026 memmove(s->temp.buf, s->temp.buf + s->rc.in_pos,
2060 memcpy(s->temp.buf, b->in + b->in_pos, in_avail);
2251 s->dict.buf = NULL;
2272 free(s->dict.buf);
2273 s->dict.buf = malloc(s->dict.size);
2274 if (s->dict.buf == NULL) {
2450 * so we reserve space according to that. buf[] has to be aligned
2457 uint8_t buf[1024];
2481 * to copy into s->temp.buf. Return true once s->temp.pos has reached
2488 memcpy(s->temp.buf + s->temp.pos, b->in + b->in_pos, copy_size);
2576 uint8_t *buf = b->out + s->out_start;
2578 s->crc = xz_crc64_table[*buf++ ^ (s->crc & 0xFF)] ^ (s->crc >> 8);
2719 if (!memeq(s->temp.buf, HEADER_MAGIC, HEADER_MAGIC_SIZE))
2722 if (xz_crc32(s->temp.buf + HEADER_MAGIC_SIZE, 2, 0)
2723 != get_le32(s->temp.buf + HEADER_MAGIC_SIZE + 2))
2726 if (s->temp.buf[HEADER_MAGIC_SIZE] != 0)
2736 s->check_type = s->temp.buf[HEADER_MAGIC_SIZE + 1];
2750 if (!memeq(s->temp.buf + 10, FOOTER_MAGIC, FOOTER_MAGIC_SIZE))
2753 if (xz_crc32(s->temp.buf + 4, 6, 0) != get_le32(s->temp.buf))
2761 if ((s->index.size >> 2) != get_le32(s->temp.buf + 4))
2764 if (s->temp.buf[8] != 0 || s->temp.buf[9] != s->check_type)
2784 if (xz_crc32(s->temp.buf, s->temp.size, 0)
2785 != get_le32(s->temp.buf + s->temp.size))
2795 if (s->temp.buf[1] & 0x3E)
2797 if (s->temp.buf[1] & 0x3F)
2802 if (s->temp.buf[1] & 0x40) {
2803 if (dec_vli(s, s->temp.buf, &s->temp.pos, s->temp.size)
2813 if (s->temp.buf[1] & 0x80) {
2814 if (dec_vli(s, s->temp.buf, &s->temp.pos, s->temp.size)
2825 s->bcj_active = s->temp.buf[1] & 0x01;
2830 ret = xz_dec_bcj_reset(s->bcj, s->temp.buf[s->temp.pos++]);
2838 if (s->temp.buf[s->temp.pos++] != 0x00)
2848 if (s->temp.buf[s->temp.pos++] != 0x21)
2852 if (s->temp.buf[s->temp.pos++] != 0x01)
2859 ret = xz_dec_lzma2_reset(s->lzma2, s->temp.buf[s->temp.pos++]);
2865 if (s->temp.buf[s->temp.pos++] != 0x00)
3128 free((s->lzma2)->dict.buf);