[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pdf-devel] pdf_stm_read_char fails after 4096 bytes on a memory str
From: |
Michael Gold |
Subject: |
Re: [pdf-devel] pdf_stm_read_char fails after 4096 bytes on a memory stream |
Date: |
Wed, 21 Oct 2009 02:33:06 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Tue, Oct 20, 2009 at 23:02:24 -0400, Michael Gold wrote:
> Hi all,
>
> If I create a stream with pdf_stm_mem_new and use pdf_stm_read_char to
> read each character, I get PDF_EEOF after 4096 bytes. The attached
> patch adds a test case to check for this, but I haven't found the cause
> yet. Does anyone know what's going on?
The problem was that pdf_stm_read_peek_char would detect the cache was
empty (i.e. it was at the end of the buffer), but wasn't resetting the
read/write pointers before trying to read data from the filter. The fix
is to call
pdf_buffer_rewind (stm->cache);
before pdf_stm_filter_apply. I'll include this in the tokeniser patch
I'm working on.
I found a possible bug in pdf_stm_f_null_apply while looking into this.
Shouldn't the code
memcpy ((char *) out->data,
(char *) in->data,
bytes_to_copy);
be
memcpy ((char *) out->data + out->wp,
(char *) in->data + in->rp,
bytes_to_copy);
?
-- Michael
signature.asc
Description: Digital signature