summaryrefslogtreecommitdiff
path: root/contrib/blast/blast.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2013-08-24 01:53:31 -0700
committerMark Adler <madler@alumni.caltech.edu>2013-08-24 10:36:32 -0700
commit799c87c0d8fc5af306f8c7a160dfd3d75746c2ce (patch)
tree7394e6ec8269edf9a15f0c4d4f2f018a7f1cb316 /contrib/blast/blast.h
parent89e335abb49cd5c7d29d94e8f506d3f8ed71315a (diff)
downloadzlib-799c87c0d8fc5af306f8c7a160dfd3d75746c2ce.tar.gz
zlib-799c87c0d8fc5af306f8c7a160dfd3d75746c2ce.tar.bz2
zlib-799c87c0d8fc5af306f8c7a160dfd3d75746c2ce.zip
Improve contrib/blast to return unused bytes. Fix the test code
to report the count of unused bytes at the end correctly. Add the ability to provide initial input to blast().
Diffstat (limited to '')
-rw-r--r--contrib/blast/blast.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/contrib/blast/blast.h b/contrib/blast/blast.h
index 658cfd3..6cf65ed 100644
--- a/contrib/blast/blast.h
+++ b/contrib/blast/blast.h
@@ -1,6 +1,6 @@
1/* blast.h -- interface for blast.c 1/* blast.h -- interface for blast.c
2 Copyright (C) 2003, 2012 Mark Adler 2 Copyright (C) 2003, 2012, 2013 Mark Adler
3 version 1.2, 24 Oct 2012 3 version 1.3, 24 Aug 2013
4 4
5 This software is provided 'as-is', without any express or implied 5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the author be held liable for any damages 6 warranty. In no event will the author be held liable for any damages
@@ -42,7 +42,8 @@ typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len);
42 */ 42 */
43 43
44 44
45int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow); 45int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow,
46 unsigned *left, unsigned char **in);
46/* Decompress input to output using the provided infun() and outfun() calls. 47/* Decompress input to output using the provided infun() and outfun() calls.
47 * On success, the return value of blast() is zero. If there is an error in 48 * On success, the return value of blast() is zero. If there is an error in
48 * the source data, i.e. it is not in the proper format, then a negative value 49 * the source data, i.e. it is not in the proper format, then a negative value
@@ -55,12 +56,19 @@ int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow);
55 * an input error. (blast() only asks for input if it needs it.) inhow is for 56 * an input error. (blast() only asks for input if it needs it.) inhow is for
56 * use by the application to pass an input descriptor to infun(), if desired. 57 * use by the application to pass an input descriptor to infun(), if desired.
57 * 58 *
59 * If left and in are not NULL and *left is not zero when blast() is called,
60 * then the *left bytes are *in are consumed for input before infun() is used.
61 *
58 * The output function is invoked: err = outfun(how, buf, len), where the bytes 62 * The output function is invoked: err = outfun(how, buf, len), where the bytes
59 * to be written are buf[0..len-1]. If err is not zero, then blast() returns 63 * to be written are buf[0..len-1]. If err is not zero, then blast() returns
60 * with an output error. outfun() is always called with len <= 4096. outhow 64 * with an output error. outfun() is always called with len <= 4096. outhow
61 * is for use by the application to pass an output descriptor to outfun(), if 65 * is for use by the application to pass an output descriptor to outfun(), if
62 * desired. 66 * desired.
63 * 67 *
68 * If there is any unused input, *left is set to the number of bytes that were
69 * read and *in points to them. Otherwise *left is set to zero and *in is set
70 * to NULL. If left or in are NULL, then they are not set.
71 *
64 * The return codes are: 72 * The return codes are:
65 * 73 *
66 * 2: ran out of input before completing decompression 74 * 2: ran out of input before completing decompression