[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pdf-devel] Patch for the Flate filter
From: |
jemarch |
Subject: |
Re: [pdf-devel] Patch for the Flate filter |
Date: |
Wed, 01 Oct 2008 20:36:11 +0200 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/23.0.60 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
Hi Gerel.
Here is a patch for the Flate filter implementation plus tests.
Many thanks.
Some comments about the patch follows.
base/pdf-stm-filter.h base/pdf-stm-filter.c \
base/pdf-stm-f-null.h base/pdf-stm-f-null.c \
base/pdf-stm-f-ahex.h base/pdf-stm-f-ahex.c \
- base/pdf-stm-f-rl.h base/pdf-stm-f-rl.c
+ base/pdf-stm-f-rl.h base/pdf-stm-f-rl.c \
+ base/pdf-stm-f-flate.h base/pdf-stm-f-flate.c
# if ZLIB
# STM_MODULE_SOURCES += base/pdf-stm-f-flate.c base/pdf-stm-f-flate.h
Note the Automake conditional. It uses the ZLIB conditional set by the
configure script to compile the flate filter only if the zlib is
available. All you need to do is to uncomment the # if ZLIB... region.
+ /* Initialize stream input/output parameters */
+ if (!st->zlib_init_p)
+ {
+ if (deflateInit (&(st->stream), Z_DEFAULT_COMPRESSION) != Z_OK)
+ {
+ return PDF_ERROR;
+ }
+ st->zlib_init_p = PDF_TRUE;
+ }
+
+ if (st->zret == Z_STREAM_END)
+ {
+ return PDF_EEOF;
+ }
What is the reason to initialize the zstream in the apply function
instead of the init function?
+ /*
+ * As read in the zlib documentation, our cache size must be at least 0.1%
+ * larger than the CHUNK size, plus 12 bytes.
+ * We assume that our cache size is of 4096 bytes.
+ */
+#define PDF_STM_F_FLATE_CHUNK 1024
What would happen if the user set a cache size of, say, 100 bytes? It
is possible to set the chunk size dinamically?
- [pdf-devel] Patch for the Flate filter, gerel, 2008/10/01
- Re: [pdf-devel] Patch for the Flate filter,
jemarch <=
- Re: [pdf-devel] Patch for the Flate filter, gerel, 2008/10/01
- Re: [pdf-devel] Patch for the Flate filter, gerel, 2008/10/01
- Re: [pdf-devel] Patch for the Flate filter, jemarch, 2008/10/02
- Re: [pdf-devel] Patch for the Flate filter, gerel, 2008/10/02
- Re: [pdf-devel] Patch for the Flate filter, jemarch, 2008/10/03