|
|
| version 1.8, 2006/12/23 12:49:22 | version 1.9, 2006/12/23 23:34:32 |
|---|---|
| Line 5 | Line 5 |
| // Use WinAPI version | // Use WinAPI version |
| UINT oemtext_mbtoucs2(UINT cp, WCHAR *dst, UINT dcnt, const char *src, UINT scnt) { | UINT oemtext_mbtoucs2(UINT cp, wchar_t *dst, UINT dcnt, const char *src, UINT scnt) { |
| int srccnt; | int srccnt; |
| int dstcnt; | int dstcnt; |
| Line 45 UINT oemtext_mbtoucs2(UINT cp, WCHAR *ds | Line 45 UINT oemtext_mbtoucs2(UINT cp, WCHAR *ds |
| return(r); | return(r); |
| } | } |
| UINT oemtext_ucs2tomb(UINT cp, char *dst, UINT dcnt, const WCHAR *src, UINT scnt) { | UINT oemtext_ucs2tomb(UINT cp, char *dst, UINT dcnt, const wchar_t *src, UINT scnt) { |
| int srccnt; | int srccnt; |
| int dstcnt; | int dstcnt; |
| Line 88 UINT oemtext_ucs2tomb(UINT cp, char *dst | Line 88 UINT oemtext_ucs2tomb(UINT cp, char *dst |
| UINT oemtext_mbtoutf8(UINT cp, char *dst, UINT dcnt, const char *src, UINT scnt) { | UINT oemtext_mbtoutf8(UINT cp, char *dst, UINT dcnt, const char *src, UINT scnt) { |
| UINT leng; | UINT leng; |
| WCHAR *ucs2; | wchar_t *ucs2; |
| UINT ret; | UINT ret; |
| (void)scnt; | (void)scnt; |
| Line 97 UINT oemtext_mbtoutf8(UINT cp, char *dst | Line 97 UINT oemtext_mbtoutf8(UINT cp, char *dst |
| if (leng == 0) { | if (leng == 0) { |
| return(0); | return(0); |
| } | } |
| ucs2 = (WCHAR *)_MALLOC(leng * sizeof(WCHAR), ""); | ucs2 = (wchar_t *)_MALLOC(leng * sizeof(wchar_t), ""); |
| if (ucs2 == NULL) { | if (ucs2 == NULL) { |
| return(0); | return(0); |
| } | } |
| Line 105 UINT oemtext_mbtoutf8(UINT cp, char *dst | Line 105 UINT oemtext_mbtoutf8(UINT cp, char *dst |
| if (((SINT)scnt) < 0) { | if (((SINT)scnt) < 0) { |
| leng = (UINT)-1; | leng = (UINT)-1; |
| } | } |
| ret = codecnv_ucs2toutf8(dst, dcnt, ucs2, leng); | ret = codecnv_ucs2toutf8(dst, dcnt, (UINT16 *)ucs2, leng); |
| _MFREE(ucs2); | _MFREE(ucs2); |
| return(ret); | return(ret); |
| } | } |
| Line 113 UINT oemtext_mbtoutf8(UINT cp, char *dst | Line 113 UINT oemtext_mbtoutf8(UINT cp, char *dst |
| UINT oemtext_utf8tomb(UINT cp, char *dst, UINT dcnt, const char *src, UINT scnt) { | UINT oemtext_utf8tomb(UINT cp, char *dst, UINT dcnt, const char *src, UINT scnt) { |
| UINT leng; | UINT leng; |
| WCHAR *ucs2; | wchar_t *ucs2; |
| UINT ret; | UINT ret; |
| (void)scnt; | (void)scnt; |
| Line 122 UINT oemtext_utf8tomb(UINT cp, char *dst | Line 122 UINT oemtext_utf8tomb(UINT cp, char *dst |
| if (leng == 0) { | if (leng == 0) { |
| return(0); | return(0); |
| } | } |
| ucs2 = (WCHAR *)_MALLOC(leng * sizeof(WCHAR), ""); | ucs2 = (wchar_t *)_MALLOC(leng * sizeof(wchar_t), ""); |
| if (ucs2 == NULL) { | if (ucs2 == NULL) { |
| return(0); | return(0); |
| } | } |
| codecnv_utf8toucs2(ucs2, leng, src, scnt); | codecnv_utf8toucs2((UINT16 *)ucs2, leng, src, scnt); |
| if (((SINT)scnt) < 0) { | if (((SINT)scnt) < 0) { |
| leng = (UINT)-1; | leng = (UINT)-1; |
| } | } |
| Line 138 UINT oemtext_utf8tomb(UINT cp, char *dst | Line 138 UINT oemtext_utf8tomb(UINT cp, char *dst |
| // ---- | // ---- |
| UINT oemtext_chartoucs2(WCHAR *dst, UINT dcnt, const char *src, UINT scnt) { | UINT oemtext_chartoucs2(wchar_t *dst, UINT dcnt, const char *src, UINT scnt) { |
| return(oemtext_mbtoucs2(CP_ACP, dst, dcnt, src, scnt)); | return(oemtext_mbtoucs2(CP_ACP, dst, dcnt, src, scnt)); |
| } | } |
| UINT oemtext_ucs2tochar(char *dst, UINT dcnt, const WCHAR *src, UINT scnt) { | UINT oemtext_ucs2tochar(char *dst, UINT dcnt, const wchar_t *src, UINT scnt) { |
| return(oemtext_ucs2tomb(CP_ACP, dst, dcnt, src, scnt)); | return(oemtext_ucs2tomb(CP_ACP, dst, dcnt, src, scnt)); |
| } | } |