commit 824801e7ef276d0d8ca914cf56557ca92153acfc from: Stefan Sperling date: Sat Jan 27 00:15:40 2018 UTC Improve delta combiner docs and rename a macro for clarity. commit - 885d3e0206a04e896704eb67f94c5f39b6976d33 commit + 824801e7ef276d0d8ca914cf56557ca92153acfc blob - 48f534b64d3f4b9c1cb7a82e3cf5ebc14ed5e407 blob + d999e8a0e495d5f53e7b22eb8b13a3ac94d3d805 --- lib/delta.c +++ lib/delta.c @@ -252,7 +252,7 @@ got_delta_apply(FILE *base_compressed, const uint8_t * /* Decode and execute copy instructions from the delta stream. */ err = next_delta_byte(&p, &remain); while (err == NULL) { - if (*p & GOT_DELTA_COPY_OPCODE) { + if (*p & GOT_DELTA_BASE_COPY) { off_t offset = 0; size_t len = 0; err = parse_opcode(&offset, &len, &p, &remain); blob - 75cfc705330f66fe8da903edd8d787e0474dc7c5 blob + 84193ca76b0e39db46ace39f37ccb3854f6fed91 --- lib/delta.h +++ lib/delta.h @@ -55,12 +55,12 @@ const struct got_error *got_delta_apply(FILE *, const #define GOT_DELTA_SIZE_MORE 0x80 /* - * A delta stream contains copy opcodes and verbatim data. + * The rest of the delta stream contains copy instructions. * - * A copy opcode instructs the delta combiner to copy N bytes starting at - * offset X from the delta base to the output. Copy opcodes begin with a - * byte which has its MSB set. The remaining bits of this byte describe how - * many offset and length value bytes follow. + * A base copy instruction tells the delta combiner to copy N bytes starting + * at offset X from the delta base to the output. Base copy instructions begin + * with a byte which has its MSB set. The remaining bits of this byte describe + * how many offset and length value bytes follow. * The offset X is encoded in 1 to 4 bytes, and the length N is encoded in * 1 to 3 bytes. For both values, the first byte contributes the least * significant part and the last byte which is present contributes the @@ -68,13 +68,14 @@ const struct got_error *got_delta_apply(FILE *, const * If the offset value is omitted, an offset of zero is implied. * If the length value is omitted, a default length of 65536 bytes is implied. * - * Verbatim data is copied from the delta stream to the output. - * Verbatim data is preceded by one byte which does not have the MSB set - * and which specifies the length of the verbatim data which follows (i.e. + * An inline copy instruction tells the delta combiner to copy data from + * the delta stream to the output. + * Such instructions begin with one byte which does not have the MSB set + * and which specifies the length of the inline data which follows (i.e. * at most 127 bytes). A length value of zero is invalid. */ -#define GOT_DELTA_COPY_OPCODE 0x80 +#define GOT_DELTA_BASE_COPY 0x80 #define GOT_DELTA_COPY_OFF1 0x01 /* byte 1 of offset is present */ #define GOT_DELTA_COPY_OFF2 0x02 /* byte 2 of offset is present */