|
From: | Ángel González |
Subject: | Re: [Bug-wget] bad filenames (again) |
Date: | Wed, 19 Aug 2015 23:43:17 +0200 |
User-agent: | Thunderbird |
On 19/08/15 16:38, Eli Zaretskii wrote:
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()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.
* _Some_ Windows when using _some_ filesystems / apis have fixed limits, but there are ways to produce larger paths...
[Prev in Thread] | Current Thread | [Next in Thread] |