Added support for special treatments (use 2 or more fonts, codepage
[wine.git] / dlls / crtdll / mbstring.c
blob71e0db3561662c3a31a2d74ea32d6ae4fd23b542
1 /*
2 * CRTDLL multi-byte string functions
4 * Copyright 1999 Alexandre Julliard
5 */
7 #include "windef.h"
8 #include "winbase.h"
9 #include "crtdll.h"
12 /*********************************************************************
13 * CRTDLL__mbsinc (CRTDLL.205)
15 LPSTR __cdecl CRTDLL__mbsinc( LPCSTR str )
17 if (IsDBCSLeadByte( *str )) str++;
18 return (LPSTR)(str + 1);
22 /*********************************************************************
23 * CRTDLL__mbslen (CRTDLL.206)
25 INT __cdecl CRTDLL__mbslen( LPCSTR str )
27 INT len;
28 for (len = 0; *str; len++, str++) if (IsDBCSLeadByte(str[0]) && str[1]) str++;
29 return len;
33 /*********************************************************************
34 * CRTDLL_mbtowc (CRTDLL.430)
36 INT __cdecl CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n )
38 if (n <= 0) return 0;
39 if (!str) return 0;
40 if (!MultiByteToWideChar( CP_ACP, 0, str, n, dst, 1 )) return 0;
41 /* return the number of bytes from src that have been used */
42 if (!*str) return 0;
43 if (n >= 2 && IsDBCSLeadByte(*str) && str[1]) return 2;
44 return 1;