pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pdf-devel] Patch for the Flate filter


From: gerel
Subject: Re: [pdf-devel] Patch for the Flate filter
Date: Wed, 01 Oct 2008 15:19:05 -0700 (PDT)

 > Date: Wed, 01 Oct 2008 20:36:11 +0200
 > From: address@hidden
 > 
 > Hi Gerel.
 > 

Hi jemarch.

 >    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.

Ah sorry, fixed.


 > 
 > 
 >    +  /* 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?

I was using it before, but now it's not needed, thanks for noticing it.


 > 
 >    + /* 
 >    +  * 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?

Actually, I've detected some flaws about this on the code, so I'll fix it and
send the patch again :-)

cheers
-gerel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]