On 31.08.2016 22:21, Andrew Eikum wrote:
+static inline char *strdupWA_sized( const WCHAR *src, DWORD size ) +{
- char *dst = NULL;
- if (src)
- {
int len = WideCharToMultiByte( CP_ACP, 0, src, size, NULL, 0, NULL, NULL ) + 1;
if ((dst = heap_alloc( len )))
{
WideCharToMultiByte( CP_ACP, 0, src, len, dst, size, NULL, NULL );
dst[len - 1] = 0;
}
- }
- return dst;
+}
This is usually called strndup* in Wine dlls. Also 'len' and 'size' seem to be misplaced, and I'm not sure it will do the right thing if for negative size, unless it's not meant to ever be negative.