Release 970914
[wine] / win32 / string32.c
1 /*
2  * Unicode string management
3  *
4  * Copyright 1996 Martin von Loewis
5  *
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  */
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <ctype.h>
14 #include "windows.h"
15 #include "string32.h"
16 #include "xmalloc.h"
17
18 LPWSTR STRING32_DupAnsiToUni(LPCSTR src)
19 {
20         LPWSTR dest=xmalloc(2*strlen(src)+2);
21         lstrcpyAtoW(dest,src);
22         return dest;
23 }
24
25 LPWSTR
26 STRING32_lstrchrW(LPCWSTR a,WCHAR c) {
27         while(*a) {
28                 if (*a==c)
29                         return a;
30                 a++;
31         }
32         return NULL;
33 }
34
35 LPWSTR
36 STRING32_strdupW(LPCWSTR a) {
37         LPWSTR  b;
38         int     len;
39
40         len=sizeof(WCHAR)*(lstrlen32W(a)+1);
41         b=(LPWSTR)xmalloc(len);
42         memcpy(b,a,len);
43         return b;
44 }