From 1511c27aad51d14f8b4abe1b4f18c7bedd3dd72b Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 9 Mar 2011 08:34:44 +1100 Subject: [PATCH] header-mangling-part-2-move-all-function-prototypes --- lrzip.c | 6 ++ lrzip.h | 203 +----------------------------------------- lrzip_private.h | 229 ++++++++++++++++++++++++++++++++++++++++++++++++ main.c | 12 +++ md5.c | 5 ++ runzip.c | 8 ++ runzip.h | 27 ++++++ rzip.c | 14 +-- rzip.h | 28 ------ stream.c | 12 ++- stream.h | 41 +++++++++ util.c | 12 ++- util.h | 33 +++++++ zpipe.h | 37 ++++++++ 14 files changed, 422 insertions(+), 245 deletions(-) create mode 100644 lrzip_private.h create mode 100644 runzip.h create mode 100644 stream.h create mode 100644 util.h create mode 100644 zpipe.h diff --git a/lrzip.c b/lrzip.c index 2ff2569..64f0b5c 100644 --- a/lrzip.c +++ b/lrzip.c @@ -17,7 +17,13 @@ along with this program. If not, see . */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "rzip.h" +#include "runzip.h" +#include "util.h" #include "liblrzip.h" /* flag defines */ void write_magic(rzip_control *control, int fd_in, int fd_out) diff --git a/lrzip.h b/lrzip.h index 4c15832..730a3d6 100644 --- a/lrzip.h +++ b/lrzip.h @@ -19,208 +19,7 @@ #ifndef LRZIP_H #define LRZIP_H -#define LRZIP_MAJOR_VERSION VMAJ -#define LRZIP_MINOR_VERSION VMIN -#define LRZIP_MINOR_SUBVERSION VMIC - -#define NUM_STREAMS 2 -#define STREAM_BUFSIZE (1024 * 1024 * 10) - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -#ifdef __APPLE__ -# define fmemopen fake_fmemopen -# define open_memstream fake_open_memstream -# define memstream_update_buffer fake_open_memstream_update_buffer -# define mremap fake_mremap -#else -# define memstream_update_buffer(A, B, C) (0) -#endif - -#ifndef uchar -#define uchar unsigned char -#endif - -#ifndef int32 -#if (SIZEOF_INT == 4) -#define int32 int -#elif (SIZEOF_LONG == 4) -#define int32 long -#elif (SIZEOF_SHORT == 4) -#define int32 short -#endif -#endif - -#ifndef int16 -#if (SIZEOF_INT == 2) -#define int16 int -#elif (SIZEOF_SHORT == 2) -#define int16 short -#endif -#endif - -#ifndef uint32 -#define uint32 unsigned int32 -#endif - -#ifndef uint16 -#define uint16 unsigned int16 -#endif - -#ifndef MIN -#define MIN(a, b) ((a) < (b)? (a): (b)) -#endif - -#ifndef MAX -#define MAX(a, b) ((a) > (b)? (a): (b)) -#endif - -#if !HAVE_STRERROR -extern char *sys_errlist[]; -#define strerror(i) sys_errlist[i] -#endif - -#ifndef HAVE_ERRNO_H -extern int errno; -#endif - -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) - -typedef long long int i64; -typedef uint16_t u16; -typedef uint32_t u32; - -#ifndef MAP_ANONYMOUS - #define MAP_ANONYMOUS MAP_ANON -#endif - -#if defined(NOTHREAD) || !defined(_SC_NPROCESSORS_ONLN) - #define PROCESSORS (1) -#else - #define PROCESSORS (sysconf(_SC_NPROCESSORS_ONLN)) -#endif - -#ifdef _SC_PAGE_SIZE - #define PAGE_SIZE (sysconf(_SC_PAGE_SIZE)) -#else - #define PAGE_SIZE (4096) -#endif - -typedef struct rzip_control rzip_control; -typedef struct md5_ctx md5_ctx; - -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - #define mremap fake_mremap -#endif - -#define FLAG_SHOW_PROGRESS (1 << 0) -#define FLAG_KEEP_FILES (1 << 1) -#define FLAG_TEST_ONLY (1 << 2) -#define FLAG_FORCE_REPLACE (1 << 3) -#define FLAG_DECOMPRESS (1 << 4) -#define FLAG_NO_COMPRESS (1 << 5) -#define FLAG_LZO_COMPRESS (1 << 6) -#define FLAG_BZIP2_COMPRESS (1 << 7) -#define FLAG_ZLIB_COMPRESS (1 << 8) -#define FLAG_ZPAQ_COMPRESS (1 << 9) -#define FLAG_VERBOSITY (1 << 10) -#define FLAG_VERBOSITY_MAX (1 << 11) -#define FLAG_STDIN (1 << 12) -#define FLAG_STDOUT (1 << 13) -#define FLAG_INFO (1 << 14) -#define FLAG_UNLIMITED (1 << 15) -#define FLAG_HASH (1 << 16) -#define FLAG_MD5 (1 << 17) -#define FLAG_CHECK (1 << 18) -#define FLAG_KEEP_BROKEN (1 << 19) -#define FLAG_THRESHOLD (1 << 20) - -#define NO_MD5 (!(HASH_CHECK) && !(HAS_MD5)) - -#define BITS32 (sizeof(long) == 4) - -#define CTYPE_NONE 3 -#define CTYPE_BZIP2 4 -#define CTYPE_LZO 5 -#define CTYPE_LZMA 6 -#define CTYPE_GZIP 7 -#define CTYPE_ZPAQ 8 - -/* Structure to save state of computation between the single steps. */ -struct md5_ctx -{ - uint32_t A; - uint32_t B; - uint32_t C; - uint32_t D; - - uint32_t total[2]; - uint32_t buflen; - uint32_t buffer[32]; -}; - -struct rzip_control { - char *infile; - char *outname; - char *outfile; - char *outdir; - char *tmpdir; // when stdin, stdout, or test used - FILE *msgout; //stream for output messages - const char *suffix; - int compression_level; - i64 overhead; // compressor overhead - i64 maxram; // the largest chunk of ram to allocate - unsigned char lzma_properties[5]; // lzma properties, encoded - i64 window; - unsigned long flags; - i64 ramsize; - i64 max_chunk; - i64 max_mmap; - int threads; - int nice_val; // added for consistency - int major_version; - int minor_version; - i64 st_size; - long page_size; - int fd_out; - md5_ctx ctx; - void *data; // random data pointer associated for use in callbacks - i64 md5_read; // How far into the file the md5 has done so far -}; - -struct stream { - i64 last_head; - uchar *buf; - i64 buflen; - i64 bufp; - int eos; - long uthread_no; - long unext_thread; - long base_thread; - int total_threads; -}; - -struct stream_info { - struct stream *s; - int num_streams; - int fd; - i64 bufsize; - i64 cur_pos; - i64 initial_pos; - i64 total_read; - i64 ram_alloced; - long thread_no; - long next_thread; - int chunks; - char chunk_bytes; -}; +#include "lrzip_private.h" void write_magic(rzip_control *control, int fd_in, int fd_out); void read_magic(rzip_control *control, int fd_in, i64 *expected_size); diff --git a/lrzip_private.h b/lrzip_private.h new file mode 100644 index 0000000..10ebc98 --- /dev/null +++ b/lrzip_private.h @@ -0,0 +1,229 @@ +/* + Copyright (C) 2006-2011 Con Kolivas + Copyright (C) 2011 Peter Hyman + Copyright (C) 1998-2003 Andrew Tridgell + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef LRZIP_PRIV_H +#define LRZIP_PRIV_H + +#define LRZIP_MAJOR_VERSION VMAJ +#define LRZIP_MINOR_VERSION VMIN +#define LRZIP_MINOR_SUBVERSION VMIC + +#define NUM_STREAMS 2 +#define STREAM_BUFSIZE (1024 * 1024 * 10) + +#include +#include +#include + +#ifdef __APPLE__ +# define fmemopen fake_fmemopen +# define open_memstream fake_open_memstream +# define memstream_update_buffer fake_open_memstream_update_buffer +# define mremap fake_mremap +#else +# define memstream_update_buffer(A, B, C) (0) +#endif + +#ifndef uchar +#define uchar unsigned char +#endif + +#ifndef int32 +#if (SIZEOF_INT == 4) +#define int32 int +#elif (SIZEOF_LONG == 4) +#define int32 long +#elif (SIZEOF_SHORT == 4) +#define int32 short +#endif +#endif + +#ifndef int16 +#if (SIZEOF_INT == 2) +#define int16 int +#elif (SIZEOF_SHORT == 2) +#define int16 short +#endif +#endif + +#ifndef uint32 +#define uint32 unsigned int32 +#endif + +#ifndef uint16 +#define uint16 unsigned int16 +#endif + +#ifndef MIN +#define MIN(a, b) ((a) < (b)? (a): (b)) +#endif + +#ifndef MAX +#define MAX(a, b) ((a) > (b)? (a): (b)) +#endif + +#if !HAVE_STRERROR +extern char *sys_errlist[]; +#define strerror(i) sys_errlist[i] +#endif + +#ifndef HAVE_ERRNO_H +extern int errno; +#endif + +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) + +typedef long long int i64; +typedef uint16_t u16; +typedef uint32_t u32; + +#ifndef MAP_ANONYMOUS +# define MAP_ANONYMOUS MAP_ANON +#endif + +#if defined(NOTHREAD) || !defined(_SC_NPROCESSORS_ONLN) +# define PROCESSORS (1) +#else +# define PROCESSORS (sysconf(_SC_NPROCESSORS_ONLN)) +#endif + +#ifdef _SC_PAGE_SIZE +# define PAGE_SIZE (sysconf(_SC_PAGE_SIZE)) +#else +# define PAGE_SIZE (4096) +#endif + +typedef struct rzip_control rzip_control; +typedef struct md5_ctx md5_ctx; + +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +# define mremap fake_mremap +#endif + +#define FLAG_SHOW_PROGRESS (1 << 0) +#define FLAG_KEEP_FILES (1 << 1) +#define FLAG_TEST_ONLY (1 << 2) +#define FLAG_FORCE_REPLACE (1 << 3) +#define FLAG_DECOMPRESS (1 << 4) +#define FLAG_NO_COMPRESS (1 << 5) +#define FLAG_LZO_COMPRESS (1 << 6) +#define FLAG_BZIP2_COMPRESS (1 << 7) +#define FLAG_ZLIB_COMPRESS (1 << 8) +#define FLAG_ZPAQ_COMPRESS (1 << 9) +#define FLAG_VERBOSITY (1 << 10) +#define FLAG_VERBOSITY_MAX (1 << 11) +#define FLAG_STDIN (1 << 12) +#define FLAG_STDOUT (1 << 13) +#define FLAG_INFO (1 << 14) +#define FLAG_UNLIMITED (1 << 15) +#define FLAG_HASH (1 << 16) +#define FLAG_MD5 (1 << 17) +#define FLAG_CHECK (1 << 18) +#define FLAG_KEEP_BROKEN (1 << 19) +#define FLAG_THRESHOLD (1 << 20) + +#define NO_MD5 (!(HASH_CHECK) && !(HAS_MD5)) + +#define BITS32 (sizeof(long) == 4) + +#define CTYPE_NONE 3 +#define CTYPE_BZIP2 4 +#define CTYPE_LZO 5 +#define CTYPE_LZMA 6 +#define CTYPE_GZIP 7 +#define CTYPE_ZPAQ 8 + +/* Needs to be less than 31 bits and page aligned on 32 bits */ +#define two_gig ((1ull << 31) - 4096) + +#define print_err(format, args...) do {\ + fprintf(stderr, format, ##args); \ +} while (0) + + +/* Structure to save state of computation between the single steps. */ +struct md5_ctx +{ + uint32_t A; + uint32_t B; + uint32_t C; + uint32_t D; + + uint32_t total[2]; + uint32_t buflen; + uint32_t buffer[32]; +}; + +struct rzip_control { + char *infile; + char *outname; + char *outfile; + char *outdir; + char *tmpdir; // when stdin, stdout, or test used + FILE *msgout; //stream for output messages + const char *suffix; + int compression_level; + i64 overhead; // compressor overhead + i64 maxram; // the largest chunk of ram to allocate + unsigned char lzma_properties[5]; // lzma properties, encoded + i64 window; + unsigned long flags; + i64 ramsize; + i64 max_chunk; + i64 max_mmap; + int threads; + int nice_val; // added for consistency + int major_version; + int minor_version; + i64 st_size; + long page_size; + int fd_out; + md5_ctx ctx; + void *data; // random data pointer associated for use in callbacks + i64 md5_read; // How far into the file the md5 has done so far +}; + +struct stream { + i64 last_head; + uchar *buf; + i64 buflen; + i64 bufp; + int eos; + long uthread_no; + long unext_thread; + long base_thread; + int total_threads; +}; + +struct stream_info { + struct stream *s; + int num_streams; + int fd; + i64 bufsize; + i64 cur_pos; + i64 initial_pos; + i64 total_read; + i64 ram_alloced; + long thread_no; + long next_thread; + int chunks; + char chunk_bytes; +}; +#endif diff --git a/main.c b/main.c index 3311420..de93ea2 100644 --- a/main.c +++ b/main.c @@ -18,7 +18,13 @@ */ /* lrzip compression - main program */ #define MAIN_C + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "rzip.h" +#include "util.h" /* main() defines, different from liblrzip defines */ #define FLAG_VERBOSE (FLAG_VERBOSITY | FLAG_VERBOSITY_MAX) @@ -159,6 +165,12 @@ static void usage(void) } +static void sighandler(int sig __UNUSED__) +{ + unlink_files(); + exit(0); +} + static void show_summary(void) { /* OK, if verbosity set, print summary of options selected */ diff --git a/md5.c b/md5.c index 0fd1be2..a13bce9 100644 --- a/md5.c +++ b/md5.c @@ -24,6 +24,11 @@ /* Written by Ulrich Drepper , 1995. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + + #include "rzip.h" #if USE_UNLOCKED_IO diff --git a/runzip.c b/runzip.c index 7070f86..30b3350 100644 --- a/runzip.c +++ b/runzip.c @@ -17,7 +17,15 @@ */ /* rzip decompression algorithm */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + + #include "rzip.h" +#include "runzip.h" +#include "stream.h" +#include "util.h" static inline uchar read_u8(rzip_control *control, void *ss, int stream) { diff --git a/runzip.h b/runzip.h new file mode 100644 index 0000000..1ed68e6 --- /dev/null +++ b/runzip.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2006-2011 Con Kolivas + Copyright (C) 2011 Peter Hyman + Copyright (C) 1998-2003 Andrew Tridgell + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef RUNZIP_H +#define RUNZIP_H + +#include "lrzip_private.h" + +i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 expected_size); + +#endif diff --git a/rzip.c b/rzip.c index 1e8d861..346e78c 100644 --- a/rzip.c +++ b/rzip.c @@ -19,7 +19,14 @@ along with this program. If not, see . */ /* rzip compression algorithm */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "rzip.h" +#include "stream.h" +#include "util.h" #define CHUNK_MULTIPLE (100 * 1024 * 1024) #define CKSUM_CHUNK 1024*1024 @@ -206,7 +213,7 @@ static void put_match(rzip_control *control, struct rzip_state *st, i64 p, i64 o } /* write some data to a stream mmap encoded. Return -1 on failure */ -int write_sbstream(rzip_control *control, void *ss, int stream, i64 p, i64 len) +static int write_sbstream(rzip_control *control, void *ss, int stream, i64 p, i64 len) { struct stream_info *sinfo = ss; @@ -719,9 +726,6 @@ static void rzip_chunk(rzip_control *control, struct rzip_state *st, int fd_in, fatal("Failed to flush/close streams in rzip_chunk\n"); } -/* Needs to be less than 31 bits and page aligned on 32 bits */ -const i64 two_gig = (1ull << 31) - 4096; - /* compress a whole file chunks at a time */ void rzip_fd(rzip_control *control, int fd_in, int fd_out) { @@ -783,7 +787,7 @@ void rzip_fd(rzip_control *control, int fd_in, int fd_out) /* On 32 bits we can have a big window with sliding mmap, but can * not enable much per mmap/malloc */ if (BITS32) - control->max_mmap = MIN(control->max_mmap, two_gig); + control->max_mmap = MIN((unsigned long long)control->max_mmap, two_gig); round_to_page(&control->max_mmap); /* Set maximum chunk size to 2/3 of ram if not unlimited or specified diff --git a/rzip.h b/rzip.h index 547e4b8..cf07e37 100644 --- a/rzip.h +++ b/rzip.h @@ -71,35 +71,7 @@ /* needed for CRC routines */ #include "lzma/C/7zCrc.h" -void fatal(const char *format, ...); -void failure(const char *format, ...); - -void sighandler(); -i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 expected_size); void rzip_fd(rzip_control *control, int fd_in, int fd_out); -void *open_stream_out(rzip_control *control, int f, int n, i64 limit, char cbytes); -void *open_stream_in(rzip_control *control, int f, int n); -int write_stream(rzip_control *control, void *ss, int stream, uchar *p, i64 len); -i64 read_stream(rzip_control *control, void *ss, int stream, uchar *p, i64 len); -int close_stream_out(rzip_control *control, void *ss); -int close_stream_in(void *ss); -void flush_buffer(rzip_control *control, struct stream_info *sinfo, int stream); -ssize_t write_1g(int fd, void *buf, i64 len); -ssize_t read_1g(int fd, void *buf, i64 len); -void zpipe_compress(FILE *in, FILE *out, FILE *msgout, long long int buf_len, int progress, long thread); -void zpipe_decompress(FILE *in, FILE *out, FILE *msgout, long long int buf_len, int progress, long thread); -const i64 two_gig; -void prepare_streamout_threads(rzip_control *control); -void close_streamout_threads(rzip_control *control); -void round_to_page(i64 *size); - -void register_infile(const char *name, char delete); -void register_outfile(const char *name, char delete); -void register_outputfile(FILE *f); - -#define print_err(format, args...) do {\ - fprintf(stderr, format, ##args); \ -} while (0) /* Macros for testing parameters */ diff --git a/stream.c b/stream.c index a6fb6fa..4f53579 100644 --- a/stream.c +++ b/stream.c @@ -19,7 +19,13 @@ /* multiplex N streams into a file - the streams are passed through different compressors */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "rzip.h" +#include "util.h" +#include "zpipe.h" #define STREAM_BUFSIZE (1024 * 1024 * 10) @@ -763,12 +769,12 @@ void close_streamout_threads(rzip_control *control) /* open a set of output streams, compressing with the given compression level and algorithm */ -void *open_stream_out(rzip_control *control, int f, int n, i64 chunk_limit, char cbytes) +void *open_stream_out(rzip_control *control, int f, unsigned int n, i64 chunk_limit, char cbytes) { struct stream_info *sinfo; i64 testsize, limit; uchar *testmalloc; - int i, testbufs; + unsigned int i, testbufs; sinfo = calloc(sizeof(struct stream_info), 1); if (unlikely(!sinfo)) @@ -798,7 +804,7 @@ void *open_stream_out(rzip_control *control, int f, int n, i64 chunk_limit, char /* Serious limits imposed on 32 bit capabilities */ if (BITS32) - limit = MIN(limit, (two_gig / testbufs) - + limit = MIN((unsigned long long)limit, (two_gig / testbufs) - (control->overhead * control->threads)); testsize = (limit * testbufs) + (control->overhead * control->threads); diff --git a/stream.h b/stream.h new file mode 100644 index 0000000..258d2be --- /dev/null +++ b/stream.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2006-2011 Con Kolivas + Copyright (C) 2011 Peter Hyman + Copyright (C) 1998-2003 Andrew Tridgell + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef LRZIP_STREAM_H +#define LRZIP_STREAM_H + +#include "lrzip_private.h" +#include + +void create_pthread(pthread_t *thread, pthread_attr_t *attr, + void * (*start_routine)(void *), void *arg); +void join_pthread(pthread_t th, void **thread_return); +ssize_t write_1g(int fd, void *buf, i64 len); +ssize_t read_1g(int fd, void *buf, i64 len); +void prepare_streamout_threads(rzip_control *control); +void close_streamout_threads(rzip_control *control); +void *open_stream_out(rzip_control *control, int f, unsigned int n, i64 chunk_limit, char cbytes); +void *open_stream_in(rzip_control *control, int f, int n); +void flush_buffer(rzip_control *control, struct stream_info *sinfo, int stream); +int write_stream(rzip_control *control, void *ss, int stream, uchar *p, i64 len); +i64 read_stream(rzip_control *control, void *ss, int stream, uchar *p, i64 len); +int close_stream_out(rzip_control *control, void *ss); +int close_stream_in(void *ss); + +#endif diff --git a/util.c b/util.c index cc1a465..66b0fda 100644 --- a/util.c +++ b/util.c @@ -30,6 +30,10 @@ * Peter Hyman, December 2008 */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "rzip.h" static const char *infile = NULL; @@ -55,7 +59,7 @@ void register_outputfile(FILE *f) outputfile = f; } -static void unlink_files(void) +void unlink_files(void) { /* Delete temporary files generated for testing or faking stdio */ if (outfile && delete_outfile) @@ -101,12 +105,6 @@ void failure(const char *format, ...) fatal_exit(); } -void sighandler() -{ - unlink_files(); - exit(0); -} - void round_to_page(i64 *size) { *size -= *size % PAGE_SIZE; diff --git a/util.h b/util.h new file mode 100644 index 0000000..5633738 --- /dev/null +++ b/util.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2006-2011 Con Kolivas + Copyright (C) 2011 Peter Hyman + Copyright (C) 1998 Andrew Tridgell + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#ifndef LRZIP_UTIL_H +#define LRZIP_UTIL_H + +#include +#include "lrzip_private.h" + +void register_infile(const char *name, char delete); +void register_outfile(const char *name, char delete); +void unlink_files(void); +void register_outputfile(FILE *f); +void fatal(const char *format, ...); +void failure(const char *format, ...); +void round_to_page(i64 *size); + +#endif diff --git a/zpipe.h b/zpipe.h new file mode 100644 index 0000000..73f3080 --- /dev/null +++ b/zpipe.h @@ -0,0 +1,37 @@ +/* zpipe streaming file compressor v1.0 + +(C) 2009, Ocarina Networks, Inc. + Written by Matt Mahoney, matmahoney@yahoo.com, Sept. 29, 2009. + + LICENSE + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details at + Visit . +*/ +#ifndef ZPIPE_H +#define ZPIPE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void zpipe_compress(FILE *in, FILE *out, FILE *msgout, long long int buf_len, + int progress, long thread); + +void zpipe_decompress(FILE *in, FILE *out, FILE *msgout, long long int buf_len, int progress, long thread); + +#ifdef __cplusplus +} +#endif + +#endif