change: decode metadata bytes

laumann
Sep 16, 2022, 9:04 PM
LVX6U4EKYXM6H32X5SZS4UBIM5PW4ND4F4QQOF5EQDX3DUHBYFGAC

Dependencies

  • [2] 4RYULBDD bincode: introduce a bincode_state struct
  • [3] YG4DZB3A add representation of hash, decode dependencies
  • [*] Q7TKZCJP Add initial support for reading the offsets from a (fixed) change
  • [*] OBKF6SII change: decompress the hashed section too
  • [*] Y26WT3ZF change: decode message, description and timestamp

Change contents

  • edit in change.c at line 298
    [3.2219]
    [3.2219]
  • edit in change.c at line 300
    [3.2220]
    [6.1373]
    /* metadata: Vec<u8> */
    len = bincode_getu64(&binstat);
    if (len > 0) {
    uint8_t *bytes = bincode_getbytes(&binstat, len);
    dump_buf("metadata", bytes, len);
    free(bytes);
    }
    dump_buf("buf", binstat.buf, binstat.avail);
    /* changes (without the contents): Vec<Hunk> */
    /* Hash of contents */
  • edit in bincode.h at line 45
    [2.1120]
    [7.2543]
    uint8_t *bincode_getbytes(struct bincode_state *, size_t);
  • edit in bincode.c at line 86
    [7.3462]
    [7.3462]
    }
    uint8_t *
    bincode_getbytes(struct bincode_state*s, size_t len)
    {
    uint8_t *ret;
    ret = xmalloc(len);
    memcpy(ret, s->buf, len);
    s->buf += len;
    s->avail -= len;
    return ret;