source: trunk/include/heapstring.h@ 8706

Last change on this file since 8706 was 7513, checked in by sandervl, 24 years ago

compile fix

File size: 4.8 KB
Line 
1/*
2 * Project Odin Software License can be found in LICENSE.TXT
3 *
4 * Win32 compatibility string functions for OS/2
5 *
6 * Copyright 1999 Patrick Haller
7 */
8
9#include <odin.h>
10
11#include <wine\unicode.h>
12//SvL: strcase -> case insensitive!
13#define strncasecmp lstrncmpiA
14#define strcasecmp lstrcmpiA
15#define strncmpiW lstrncmpiW
16#define _strlwr(a) strlwr(a)
17
18
19/*****************************************************************************
20 * Prototypes *
21 *****************************************************************************/
22
23int WIN32API lstrlenA (LPCSTR arg1);
24int WIN32API lstrlenW (LPCWSTR arg1);
25LPSTR WIN32API lstrcatA (LPSTR arg1, LPCSTR arg2);
26LPWSTR WIN32API lstrcatW (LPWSTR arg1, LPCWSTR arg2);
27int WIN32API lstrcmpA (LPCSTR arg1, LPCSTR arg2);
28int WIN32API lstrcmpW (LPCWSTR arg1, LPCWSTR arg2);
29int WIN32API lstrncmpA (LPCSTR arg1, LPCSTR arg2, int i);
30int WIN32API lstrncmpW (LPCWSTR arg1, LPCWSTR arg2, int i);
31int WIN32API lstrncmpiA (LPCSTR arg1, LPCSTR arg2, int i);
32int WIN32API lstrncmpiW (LPCWSTR arg1, LPCWSTR arg2, int i);
33#define lstrcmpniW lstrncmpiW
34LPSTR WIN32API lstrcpyA (LPSTR arg1, LPCSTR arg2);
35LPWSTR WIN32API lstrcpyW (LPWSTR dest, LPCWSTR src);
36LPSTR WIN32API lstrcpynA (LPSTR arg1, LPCSTR arg2, int arg3);
37LPWSTR WIN32API lstrcpynW (LPWSTR dest, LPCWSTR src, int arg3);
38int WIN32API lstrcmpiA (LPCSTR arg1, LPCSTR arg2);
39int WIN32API lstrcmpiW (LPCWSTR arg1, LPCWSTR arg2);
40int WIN32API lstrcpynAtoW (LPWSTR unicode, LPCSTR ascii, int asciilen);
41int WIN32API lstrcpynWtoA (LPSTR ascii, LPCWSTR unicode, int unilen);
42LPSTR WIN32API lstrcpyWtoA (LPSTR ascii, LPCWSTR unicode);
43LPWSTR WIN32API lstrcpyAtoW (LPWSTR unicode, LPCSTR ascii);
44
45LPVOID WIN32API HEAP_xalloc ( HANDLE heap, DWORD flags, DWORD size );
46LPVOID WIN32API HEAP_xrealloc ( HANDLE heap, DWORD flags, LPVOID lpMem, DWORD size );
47LPVOID WIN32API HEAP_malloc ( DWORD size );
48LPVOID WIN32API HEAP_realloc ( LPVOID lpMem, DWORD size );
49DWORD WIN32API HEAP_size ( LPVOID lpMem );
50BOOL WIN32API HEAP_free ( LPVOID lpMem );
51
52LPSTR WIN32API HEAP_strdupA ( HANDLE heap, DWORD flags, LPCSTR str );
53LPWSTR WIN32API HEAP_strdupW ( HANDLE heap, DWORD flags, LPCWSTR str );
54LPWSTR WIN32API HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str );
55LPSTR WIN32API HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str );
56
57INT WIN32API WideCharToLocal(LPSTR pLocal, LPWSTR pWide, INT dwChars);
58INT WIN32API LocalToWideChar(LPWSTR pWide, LPSTR pLocal, INT dwChars);
59
60
61/*****************************************************************************
62 * Special accelerator macros (avoid heap trashing) *
63 *****************************************************************************/
64
65#ifdef __WIN32OS2__
66
67#ifndef CP_ACP
68// from include/win/winnls.h
69#define CP_ACP 0
70#endif
71
72#define STACK_strdupAtoW(strA,strW) \
73 if (!strA) strW = NULL; \
74 else \
75 { \
76 int len = MultiByteToWideChar( CP_ACP, 0, strA, -1, NULL, 0); \
77 strW = (LPWSTR)_alloca( len*sizeof(WCHAR) ); \
78 MultiByteToWideChar(CP_ACP, 0, strA, -1, strW, len); \
79 }
80
81#define STACK_strdupWtoA(strW,strA) \
82 if (!strW) strA = NULL; \
83 else \
84 { \
85 int len = WideCharToMultiByte( CP_ACP, 0, strW, -1, NULL, 0, 0, NULL);\
86 strA = (LPSTR)_alloca(len); \
87 WideCharToMultiByte(CP_ACP, 0, strW, -1, strA, len, 0, NULL ); \
88 }
89
90#define STACK_strdupA(strDest, strSrc) \
91 { \
92 int iLength = lstrlenA(strSrc) + 1; \
93 strDest = (LPSTR)_alloca( iLength ); \
94 memcpy( strDest, strSrc, iLength); \
95 }
96
97#define STACK_strdupW(strDest, strSrc) \
98 { \
99 int iLength = lstrlenW(strSrc) + 1; \
100 strDest = (LPWSTR)_alloca( iLength * sizeof(WCHAR) ); \
101 memcpy( strDest, strSrc, iLength * sizeof(WCHAR) ); \
102 }
103
104
105#endif
106
Note: See TracBrowser for help on using the repository browser.