sync_flush.c | sync_flush.c | |||
---|---|---|---|---|
skipping to change at line 17 | skipping to change at line 17 | |||
// | // | |||
// This file has been put into the public domain. | // This file has been put into the public domain. | |||
// You can do whatever you want with this file. | // You can do whatever you want with this file. | |||
// | // | |||
/////////////////////////////////////////////////////////////////////////// //// | /////////////////////////////////////////////////////////////////////////// //// | |||
#include "sysdefs.h" | #include "sysdefs.h" | |||
#include "lzma.h" | #include "lzma.h" | |||
#include <stdio.h> | #include <stdio.h> | |||
#define CHUNK 64 | ||||
static lzma_stream strm = LZMA_STREAM_INIT; | static lzma_stream strm = LZMA_STREAM_INIT; | |||
static FILE *file_in; | static FILE *file_in; | |||
static void | static void | |||
encode(size_t size, lzma_action action) | encode(size_t size, lzma_action action) | |||
{ | { | |||
static const size_t CHUNK = 64; | ||||
uint8_t in[CHUNK]; | uint8_t in[CHUNK]; | |||
uint8_t out[CHUNK]; | uint8_t out[CHUNK]; | |||
lzma_ret ret; | lzma_ret ret; | |||
do { | do { | |||
if (strm.avail_in == 0 && size > 0) { | if (strm.avail_in == 0 && size > 0) { | |||
const size_t amount = my_min(size, CHUNK); | const size_t amount = my_min(size, CHUNK); | |||
strm.avail_in = fread(in, 1, amount, file_in); | strm.avail_in = fread(in, 1, amount, file_in); | |||
strm.next_in = in; | strm.next_in = in; | |||
size -= amount; // Intentionally not using avail_in. | size -= amount; // Intentionally not using avail_in. | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |