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

  • From: James Teh <jamie@xxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Thu, 05 Aug 2010 03:26:22 +1000

I've committed this patch in r371.

Jamie

On 5/08/2010 2:26 AM, Michael Whapples wrote:
On 04/08/10 17:07, James Teh wrote:
On 4/08/2010 10:33 PM, Michael Whapples wrote:
OK, on the naming, may be what you suggest is better, it was late here
when I created the patch.
That's fine. I wasn't criticising; I just think this is clearer.

There is one thing I am not fully sure of on
how you arrived at the value, the default for outlenMultiplier, its
probably long enough I just don't know where it comes from.
Well, for 16 bit unicode, the undefined character strings are in the
format:
'\xnnnn'
So the 4 refers to the characters that aren't numeric (first, second,
third and final).
The maximum number of hex digits will depend on how many bytes you
have for widechar. There are two hex digits to 1 byte, so it's 2 times
the size of widechar. Thus, for 16 bit unicode:
outlenMultiplier = 4 + 2 (widechar bytes) * 2 = 8
For 32 bit:
outlenMultiplier = 4 + 4 (widechar bytes) * 2 = 12
Thanks, that makes it clear, the size of widechar part wasn't clear
before.

Michael Whapples

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