Changeset 7375cdd8819c706aaf6f9f015e1915e1939d7db9
- Timestamp:
- 03/14/07 17:47:53
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1173890873 +0000
- git-parent:
[8353a94d8de7b76b191ec5dddd7abe87d066c4d8]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1173890873 +0000
- Message:
Fix MB2MB and use it
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3d411bb |
r7375cdd |
|
| 63 | 63 | #endif |
|---|
| 64 | 64 | |
|---|
| 65 | | #ifndef ASSUME_UTF8 |
|---|
| 66 | | # if defined (HAVE_ICONV) |
|---|
| 67 | | /* libiconv is more powerful than Win32 API (it has translit) */ |
|---|
| 68 | | # define USE_ICONV 1 |
|---|
| 69 | | # elif defined (WIN32) || defined (UNDER_CE) |
|---|
| 70 | | # define USE_MB2MB 1 |
|---|
| 71 | | # else |
|---|
| 72 | | # error No UTF8 charset conversion implemented on this platform! |
|---|
| 73 | | # endif |
|---|
| | 65 | #if defined (ASSUME_UTF8) |
|---|
| | 66 | /* Cool */ |
|---|
| | 67 | #elif defined (WIN32) || defined (UNDER_CE) |
|---|
| | 68 | # define USE_MB2MB 1 |
|---|
| | 69 | #elif defined (HAVE_ICONV) |
|---|
| | 70 | # define USE_ICONV 1 |
|---|
| | 71 | #else |
|---|
| | 72 | # error No UTF8 charset conversion implemented on this platform! |
|---|
| 74 | 73 | #endif |
|---|
| 75 | 74 | |
|---|
| … | … | |
| 193 | 192 | return NULL; |
|---|
| 194 | 193 | |
|---|
| 195 | | len = MultiByteToWideChar (p->fromCP, 0, string, -1, NULL, 0); |
|---|
| 196 | | if (len == 0) |
|---|
| | 194 | len = 1 + MultiByteToWideChar (p->fromCP, 0, string, -1, NULL, 0); |
|---|
| | 195 | wchar_t wide[len]; |
|---|
| | 196 | |
|---|
| | 197 | MultiByteToWideChar (p->fromCP, 0, string, -1, wide, len); |
|---|
| | 198 | len = 1 + WideCharToMultiByte (p->toCP, 0, wide, -1, NULL, 0, NULL, NULL); |
|---|
| | 199 | out = malloc (len); |
|---|
| | 200 | if (out == NULL) |
|---|
| 197 | 201 | return NULL; |
|---|
| 198 | | |
|---|
| 199 | | wchar_t wide[len]; |
|---|
| 200 | | |
|---|
| 201 | | MultiByteToWideChar (p->fromCP, 0, string, -1, wide, len); |
|---|
| 202 | | len = WideCharToMultiByte (p->toCP, 0, wide, -1, NULL, 0, NULL, NULL); |
|---|
| 203 | | if (len == 0) |
|---|
| 204 | | return NULL; |
|---|
| 205 | | out = malloc (len); |
|---|
| 206 | 202 | |
|---|
| 207 | 203 | WideCharToMultiByte (p->toCP, 0, wide, -1, out, len, NULL, NULL); |
|---|