Release 961222
[wine/gsoc-2012-control.git] / win32 / string32.c
blobf4a317b00b27e9fe6951a21abef473ad12a8af70
1 /*
2 * Unicode string management
4 * Copyright 1996 Martin von Loewis
6 * Conversion between Unicode and ISO-8859-1 is inherently lossy,
7 * so the conversion code should be called only if it does not matter
8 *
9 */
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <ctype.h>
14 #include "windows.h"
15 #include "string32.h"
16 #include "xmalloc.h"
18 LPSTR STRING32_DupUniToAnsi(LPCWSTR src)
20 LPSTR dest=xmalloc(lstrlen32W(src)+1);
21 lstrcpyWtoA(dest,src);
22 return dest;
25 LPWSTR STRING32_DupAnsiToUni(LPCSTR src)
27 LPWSTR dest=xmalloc(2*strlen(src)+2);
28 lstrcpyAtoW(dest,src);
29 return dest;
32 /* not an API function */
34 WCHAR STRING32_tolowerW(WCHAR c)
36 /* FIXME: Unicode */
37 return tolower(c);
40 LPWSTR
41 STRING32_lstrchrW(LPCWSTR a,WCHAR c) {
42 while(*a) {
43 if (*a==c)
44 return a;
45 a++;
47 return NULL;
50 LPWSTR
51 STRING32_strdupW(LPCWSTR a) {
52 LPWSTR b;
53 int len;
55 len=sizeof(WCHAR)*(lstrlen32W(a)+1);
56 b=(LPWSTR)xmalloc(len);
57 memcpy(b,a,len);
58 return b;