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

  • From: Michael Whapples <mwhapples@xxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Wed, 04 Aug 2010 17:26:06 +0100

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

Jamie


For a description of the software and to download it go to
http://www.jjb-software.com

Other related posts: