blob: f4a317b00b27e9fe6951a21abef473ad12a8af70 [file] [log] [blame]
/*
* Unicode string management
*
* Copyright 1996 Martin von Loewis
*
* Conversion between Unicode and ISO-8859-1 is inherently lossy,
* so the conversion code should be called only if it does not matter
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "windows.h"
#include "string32.h"
#include "xmalloc.h"
LPSTR STRING32_DupUniToAnsi(LPCWSTR src)
{
LPSTR dest=xmalloc(lstrlen32W(src)+1);
lstrcpyWtoA(dest,src);
return dest;
}
LPWSTR STRING32_DupAnsiToUni(LPCSTR src)
{
LPWSTR dest=xmalloc(2*strlen(src)+2);
lstrcpyAtoW(dest,src);
return dest;
}
/* not an API function */
WCHAR STRING32_tolowerW(WCHAR c)
{
/* FIXME: Unicode */
return tolower(c);
}
LPWSTR
STRING32_lstrchrW(LPCWSTR a,WCHAR c) {
while(*a) {
if (*a==c)
return a;
a++;
}
return NULL;
}
LPWSTR
STRING32_strdupW(LPCWSTR a) {
LPWSTR b;
int len;
len=sizeof(WCHAR)*(lstrlen32W(a)+1);
b=(LPWSTR)xmalloc(len);
memcpy(b,a,len);
return b;
}