Changeset 7333 for trunk/include/heapstring.h
- Timestamp:
- Nov 14, 2001, 1:27:02 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/heapstring.h
r5470 r7333 15 15 #define strncmpiW lstrncmpiW 16 16 #define _strlwr(a) strlwr(a) 17 17 18 18 19 /***************************************************************************** … … 57 58 INT WIN32API LocalToWideChar(LPWSTR pWide, LPSTR pLocal, INT dwChars); 58 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 ); \ 102 } 103 104 105 #endif 106
Note:
See TracChangeset
for help on using the changeset viewer.