[xmoto-dev] Re: Xmoto 0.3.1 is out + Windows bug

[ Thread Index | Date Index | More lists.tuxfamily.org/xmoto-dev Archives ]


On 7/3/07, Nicolas Adenis-Lamarre <nadenislamarre@xxxxxxx> wrote:
xmoto 0.3.1 is out.

Great, I just built the Mac binary and put it here:
http://vasi.dyndns.org:3128/files/ports/xmoto-0.3.1-macosx-universal.dmg
. Thank you for taking my patches, it made the build much easier.
(Also, the new website looks great, thanks Wosp.)


About the Windows bug, I have a suspicion--though I can't test it
since I only have a Mac. It looks like we're calling
WideCharToMultiByte wrong:

 WideCharToMultiByte(CP_UTF8, 0, szProfilePath,
wcslen(szProfilePath), v_tmp, 1024-1, NULL, NULL);

Microsoft's docs say that the sizes should both *include* the null
terminator, but we pass the sizes without the terminator. Also, we
should check the return code (in case our buffer isn't long enough,
for example). Look at the source for sqlite:

 zFilename = sqliteMalloc( nByte );
 ...
 nByte = WideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1,
zFilename, nByte, 0, 0);

That's the way we should be calling it:

  if (!WideCharToMultiByte(CP_UTF8, 0, szProfilePath, -1, v_tmp,
1024, NULL, NULL))
    // throw an exception

Dave



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/