Fix compilation errors on FreeBSD.
[wine] / include / heap.h
1 /*
2  * Win32 heap definitions
3  *
4  * Copyright 1996 Alexandre Julliard
5  */
6
7 #ifndef __WINE_HEAP_H
8 #define __WINE_HEAP_H
9
10 #include <string.h>
11
12 #include "winbase.h"
13 #include "winnls.h"
14 #include "wine/unicode.h"
15
16 /* strdup macros */
17 /* DO NOT USE THEM!!  they will go away soon */
18
19 inline static LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str )
20 {
21     LPWSTR ret;
22     INT len;
23
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;
29 }
30
31 inline static LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str )
32 {
33     LPSTR ret;
34     INT len;
35
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;
41 }
42
43 #endif  /* __WINE_HEAP_H */