--- In [email protected], "swzoh" <[EMAIL PROTECTED]> wrote:
>
> > maybe in ByteBlock case:
> > 263 = 272 - 6 - 4 + 1
> > where 6 is the byteblock's overhead, and 4 may be terminating null in
> >  unicode string case and among them 1 may be counted again as the
> > (plain) terminating null character.
> 
> Sorry, I think I counted wrongly here. I don't know why I counted 4,
> not 2 with the unicode string. Hmm, then, I don't know why it's 263.
> Alan may answer it if he reads this thread.

Alan, I think I got a valid conjecture about it. Try the following:

-----------------------------------------------------------------------
local sString,xString

sString="A"

dll.call("MultiByteToWideChar|ui ui s i x i",;;+
0,0,sString,-1,"xString",;;+
dll.call("MultiByteToWideChar|ui ui s i x i",;;+
0,0,sString,-1,"xString",0))

win.debug(binary.length("xString"),binary.dump("xString"))
quit
-----------------------------------------------------------------------

The length of the byteblock "xString" always return 263. I became
curious why it's not 2*2 or 266:

266 = 272 - 1 - 4 - 1

where 1-byte header, 4-byte size as int, 1-byte eos.

My conjecture is that the header is not 1-byte, but actually 4-byte.
Some kind of Struct Packing arose here, I suppose:

263 = 272 - 4 - 4 - 1

This might be also the cause to not report the correct size of
"xString" buffer, 2*2=4.

What do you think?

Sean





Attention: PowerPro's Web site has moved: http://www.ppro.org 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/power-pro/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to