[liblouis-liblouisxml] Re: Python bindings and output buffer size for lou_translate*

  • From: James Teh <jamie@xxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Tue, 27 Jul 2010 19:06:50 +1000

On 27/07/2010 7:00 PM, John J. Boyer wrote:
I don't know much about Python, but couldn't the calling program provide
the buffers and buffer sizes?
You're not supposed to have to worry about buffer sizes in Python. It should just give you the whole thing.

inlen and outlen are supposed to be
independent.
They aren't independent, though, because you need to know how long to make the output buffer so as to fit the entire translated input buffer. Unless you allocate a ridiculously huge output buffer all the time (and check that your input buffer never exceeds this), you have to try to guess how big to make outlen based on inlen.

How does liblouisxml determine the size of outlen?

Jamie

--
James Teh
Vice President
NV Access Inc, ABN 61773362390
Email: jamie@xxxxxxxxxxxx
Web site: http://www.nvaccess.org/
For a description of the software and to download it go to
http://www.jjb-software.com

Other related posts: