On 06/21/16 14:42, Hugh McMaster wrote:
size = MSVCRT_wcstombs(NULL, str, 0) + 1;
buffer = MSVCRT_malloc(size);
if (!buffer) return;
MSVCRT_wcstombs(buffer, str, size);
Please handle MSVCRT_wcstombs failure.
Thanks, Piotr
On Tuesday, 21 June 2016 10:58 PM, Piotr Caban wrote:
On 06/21/16 14:42, Hugh McMaster wrote:
+ size = MSVCRT_wcstombs(NULL, str, 0) + 1; + buffer = MSVCRT_malloc(size); + if (!buffer) return; + MSVCRT_wcstombs(buffer, str, size);
Please handle MSVCRT_wcstombs failure.
Other than checking for a return value of -1 and freeing the buffer, is there any other error handling needed?
MSDN says errno is set to EILSEQ on failure, but I'm assuming MSVCRT_wcstombs does this by itself.
Thanks, Hugh
On 06/21/16 15:17, Hugh McMaster wrote:
On Tuesday, 21 June 2016 10:58 PM, Piotr Caban wrote:
On 06/21/16 14:42, Hugh McMaster wrote:
size = MSVCRT_wcstombs(NULL, str, 0) + 1;
buffer = MSVCRT_malloc(size);
if (!buffer) return;
MSVCRT_wcstombs(buffer, str, size);
Please handle MSVCRT_wcstombs failure.
Other than checking for a return value of -1 and freeing the buffer, is there any other error handling needed?
Probably not.
Thanks, Piotr