/* * Note: Uncompressed chunk size is used in the compressor side * (userspace side for compression). * It is hardcoded because there is not proper way to extract it * from the binary stream which is generated by the preliminary * version of LZ4 tool so far.
*/ #define LZ4_DEFAULT_UNCOMPRESSED_CHUNK_SIZE (8 << 20) #define ARCHIVE_MAGICNUMBER 0x184C2102
STATICinlineint INIT unlz4(u8 *input, long in_len, long (*fill)(void *, unsignedlong), long (*flush)(void *, unsignedlong),
u8 *output, long *posp, void (*error) (char *x))
{ int ret = -1;
size_t chunksize = 0;
size_t uncomp_chunksize = LZ4_DEFAULT_UNCOMPRESSED_CHUNK_SIZE;
u8 *inp;
u8 *inp_start;
u8 *outp; long size = in_len; #ifdef PREBOOT
size_t out_len = get_unaligned_le32(input + in_len); #endif
size_t dest_len;
if (output) {
outp = output;
} elseif (!flush) {
error("NULL output pointer and no flush function provided"); goto exit_0;
} else {
outp = large_malloc(uncomp_chunksize); if (!outp) {
error("Could not allocate output buffer"); goto exit_0;
}
}
if (input && fill) {
error("Both input pointer and fill function provided,"); goto exit_1;
} elseif (input) {
inp = input;
} elseif (!fill) {
error("NULL input pointer and missing fill function"); goto exit_1;
} else {
inp = large_malloc(LZ4_compressBound(uncomp_chunksize)); if (!inp) {
error("Could not allocate input buffer"); goto exit_1;
}
}
inp_start = inp;
if (posp)
*posp = 0;
if (fill) {
size = fill(inp, 4); if (size < 4) {
error("data corrupted"); goto exit_2;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.