Hi Gerel.

   Ok, it seems that we can fix it storing really_finish_p in the filter
   structure, so the value will be persistent through several calls to
   apply. 

   I already did that little change and it seems to work, but I will test
   it tomorrow at the morning and apply it if it really fix the problem.

Here is the patch, just in case you want to try it with your filters.


=== modified file 'src/base/pdf-stm-filter.c'
--- src/base/pdf-stm-filter.c   2008-10-02 20:49:15 +0000
+++ src/base/pdf-stm-filter.c   2008-10-04 02:35:11 +0000
@@ -1,4 +1,4 @@
-/* -*- mode: C -*- Time-stamp: "08/10/02 22:44:22 jemarch"
+/* -*- mode: C -*- Time-stamp: "08/10/04 04:35:11 jemarch"
  *
  *       File:         pdf-stm-filter.c
  *       Date:         Thu Jun 12 22:13:31 2008
@@ -110,6 +110,7 @@
   new->impl.init_fn (new->params,
                      &(new->state));
   new->status = PDF_OK;
+  new->really_finish_p = PDF_FALSE;
 
   return new;
 }
@@ -164,7 +165,6 @@
   pdf_status_t ret;
   pdf_status_t apply_ret;
   pdf_status_t ret_in;
-  pdf_bool_t really_finish_p;
 
   /* If the filter is in an error state or it is in an eof state, just
      communicate it to the caller */
@@ -173,7 +173,6 @@
       return filter->status;
     }
 
-  really_finish_p = PDF_FALSE;
   ret = PDF_OK;
   while (!pdf_stm_buffer_full_p (filter->out))
     {
@@ -182,7 +181,7 @@
                                          filter->state,
                                          filter->in,
                                          filter->out,
-                                         really_finish_p);
+                                         filter->really_finish_p);
       if (apply_ret == PDF_ERROR)
         {
           /* The filter is now in an error condition. We should not
@@ -213,9 +212,9 @@
           else if ((ret_in == PDF_EEOF) 
                    && (pdf_stm_buffer_eob_p (filter->in)))
             {
-              if ((finish_p) && (!really_finish_p))
+              if ((finish_p) && (!filter->really_finish_p))
                 {
-                  really_finish_p = PDF_TRUE;
+                  filter->really_finish_p = PDF_TRUE;
                 }
               else
                 {
@@ -240,6 +239,7 @@
 pdf_stm_filter_reset (pdf_stm_filter_t filter)
 {
   filter->status = PDF_OK;
+  filter->really_finish_p = PDF_FALSE;
   return filter->impl.init_fn (filter->params,
                                &(filter->state));
 }

=== modified file 'src/base/pdf-stm-filter.h'
--- src/base/pdf-stm-filter.h   2008-10-02 20:49:15 +0000
+++ src/base/pdf-stm-filter.h   2008-10-04 02:34:08 +0000
@@ -1,4 +1,4 @@
-/* -*- mode: C -*- Time-stamp: "08/10/02 22:44:10 jemarch"
+/* -*- mode: C -*- Time-stamp: "08/10/04 04:34:08 jemarch"
  *
  *       File:         pdf-stm-filter.h
  *       Date:         Thu Jun 12 22:05:06 2008
@@ -84,6 +84,7 @@
 
   /* Filter status */
   pdf_status_t status;
+  pdf_bool_t really_finish_p;
 };
 
 typedef struct pdf_stm_filter_s *pdf_stm_filter_t;


Reply via email to