source: trunk/include/heapstring.h@ 9673

Last change on this file since 9673 was 9673, checked in by sandervl, 23 years ago

PF: Updates for GCC builds

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