On 19/08/15 16:38, Eli Zaretskii wrote:
Indeed. Actually, there's no need to allocate memory dynamically,
neither will malloc nor with alloca, since Windows file names have
fixed size limitation that is known in advance. So each conversion
function can use a fixed-sized local wchar_t array. Doing that will
also avoid the need for 2 calls to MultiByteToWideChar, the first one
to find out how much space to allocate.
Nope. These functions would receive full path names, so there's no
maximum length.* Although it is appropiate
to attempt a local buffer first, and only if it turns out to be
insufficient, change into alloca()
* _Some_ Windows when using _some_ filesystems / apis have fixed limits,
but there are ways to produce larger paths...