Fix compilation errors on FreeBSD.
[wine/dibdrv.git] / include / heap.h
blobda35319429b083a86188e4e9215f202334699c5b
1 /*
2 * Win32 heap definitions
4 * Copyright 1996 Alexandre Julliard
5 */
7 #ifndef __WINE_HEAP_H
8 #define __WINE_HEAP_H
10 #include <string.h>
12 #include "winbase.h"
13 #include "winnls.h"
14 #include "wine/unicode.h"
16 /* strdup macros */
17 /* DO NOT USE THEM!! they will go away soon */
19 inline static LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str )
21 LPWSTR ret;
22 INT len;
24 if (!str) return NULL;
25 len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
26 ret = HeapAlloc( heap, flags, len * sizeof(WCHAR) );
27 if (ret) MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
28 return ret;
31 inline static LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str )
33 LPSTR ret;
34 INT len;
36 if (!str) return NULL;
37 len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
38 ret = HeapAlloc( heap, flags, len );
39 if(ret) WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
40 return ret;
43 #endif /* __WINE_HEAP_H */