2 * CRTDLL multi-byte string functions
4 * Copyright 1999 Alexandre Julliard
21 /*********************************************************************
22 * CRTDLL__mbsinc (CRTDLL.205)
24 LPSTR __cdecl
CRTDLL__mbsinc( LPCSTR str
)
26 int len
= mblen( str
, MB_LEN_MAX
);
28 return (LPSTR
)(str
+ len
);
32 /*********************************************************************
33 * CRTDLL__mbslen (CRTDLL.206)
35 INT __cdecl
CRTDLL__mbslen( LPCSTR str
)
38 while ((len
= mblen( str
, MB_LEN_MAX
)) > 0)
47 /*********************************************************************
48 * CRTDLL_mbstowcs (CRTDLL.429)
50 INT __cdecl
CRTDLL_mbstowcs( LPWSTR dst
, LPCSTR src
, INT n
)
55 if (!(buffer
= CRTDLL_malloc( n
* sizeof(wchar_t) ))) return -1;
56 ret
= mbstowcs( buffer
, src
, n
);
57 if (ret
< n
) n
= ret
+ 1; /* nb of chars to copy (including terminating null) */
59 while (n
-- > 0) *dst
++ = (WCHAR
)*p
++;
60 CRTDLL_free( buffer
);
65 /*********************************************************************
66 * CRTDLL_mbtowc (CRTDLL.430)
68 INT __cdecl
CRTDLL_mbtowc( WCHAR
*dst
, LPCSTR str
, INT n
)
71 int ret
= mbtowc( &res
, str
, n
);
72 if (dst
) *dst
= (WCHAR
)res
;