ReactOS  0.4.12-dev-914-g71f84a3
win_iconv.c File Reference
#include <windows.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
Include dependency graph for win_iconv.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  compat_t
 
struct  csconv_t
 
struct  rec_iconv_t
 
struct  iso2022_esc_t
 

Macros

#define WINVER   0x0500
 
#define STRICT
 
#define UNUSED
 
#define GetProcAddressA   GetProcAddress
 
#define DEFAULT_LIBICONV_DLL   ""
 
#define MB_CHAR_MAX   16
 
#define UNICODE_MODE_BOM_DONE   1
 
#define UNICODE_MODE_SWAPPED   2
 
#define FLAG_USE_BOM   1
 
#define FLAG_TRANSLIT   2 /* //TRANSLIT */
 
#define FLAG_IGNORE   4 /* //IGNORE */
 
#define COMPAT_IN   1
 
#define COMPAT_OUT   2
 
#define ISO2022_MODE(cs, shift)   (((cs) << 8) | (shift))
 
#define ISO2022_MODE_CS(mode)   (((mode) >> 8) & 0xFF)
 
#define ISO2022_MODE_SHIFT(mode)   ((mode) & 0xFF)
 
#define ISO2022_SI   0
 
#define ISO2022_SO   1
 
#define ISO2022JP_CS_ASCII   0
 
#define ISO2022JP_CS_JISX0201_ROMAN   1
 
#define ISO2022JP_CS_JISX0201_KANA   2
 
#define ISO2022JP_CS_JISX0208_1978   3
 
#define ISO2022JP_CS_JISX0208_1983   4
 
#define ISO2022JP_CS_JISX0212   5
 

Typedefs

typedef unsigned char uchar
 
typedef unsigned short ushort
 
typedef unsigned int uint
 
typedef voidiconv_t
 
typedef struct compat_t compat_t
 
typedef struct csconv_t csconv_t
 
typedef struct rec_iconv_t rec_iconv_t
 
typedef iconv_t(* f_iconv_open) (const char *tocode, const char *fromcode)
 
typedef int(* f_iconv_close) (iconv_t cd)
 
typedef size_t(* f_iconv) (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
 
typedef int *(* f_errno) (void)
 
typedef int(* f_mbtowc) (csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)
 
typedef int(* f_wctomb) (csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
 
typedef int(* f_mblen) (csconv_t *cv, const uchar *buf, int bufsize)
 
typedef int(* f_flush) (csconv_t *cv, uchar *buf, int bufsize)
 
typedef HRESULT(WINAPICONVERTINETSTRING) (LPDWORD lpdwMode, DWORD dwSrcEncoding, DWORD dwDstEncoding, LPCSTR lpSrcStr, LPINT lpnSrcSize, LPBYTE lpDstStr, LPINT lpnDstSize)
 
typedef HRESULT(WINAPICONVERTINETMULTIBYTETOUNICODE) (LPDWORD lpdwMode, DWORD dwSrcEncoding, LPCSTR lpSrcStr, LPINT lpnMultiCharCount, LPWSTR lpDstStr, LPINT lpnWideCharCount)
 
typedef HRESULT(WINAPICONVERTINETUNICODETOMULTIBYTE) (LPDWORD lpdwMode, DWORD dwEncoding, LPCWSTR lpSrcStr, LPINT lpnWideCharCount, LPSTR lpDstStr, LPINT lpnMultiCharCount)
 
typedef HRESULT(WINAPIISCONVERTINETSTRINGAVAILABLE) (DWORD dwSrcEncoding, DWORD dwDstEncoding)
 
typedef HRESULT(WINAPILCIDTORFC1766A) (LCID Locale, LPSTR pszRfc1766, int nChar)
 
typedef HRESULT(WINAPILCIDTORFC1766W) (LCID Locale, LPWSTR pszRfc1766, int nChar)
 
typedef HRESULT(WINAPIRFC1766TOLCIDA) (LCID *pLocale, LPSTR pszRfc1766)
 
typedef HRESULT(WINAPIRFC1766TOLCIDW) (LCID *pLocale, LPWSTR pszRfc1766)
 
typedef struct iso2022_esc_t iso2022_esc_t
 

Functions

iconv_t iconv_open (const char *tocode, const char *fromcode)
 
int iconv_close (iconv_t cd)
 
size_t iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
 
static int win_iconv_open (rec_iconv_t *cd, const char *tocode, const char *fromcode)
 
static int win_iconv_close (iconv_t cd)
 
static size_t win_iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
 
static int load_mlang (void)
 
static int make_csconv (const char *name, csconv_t *cv)
 
static int name_to_codepage (const char *name)
 
static uint utf16_to_ucs4 (const ushort *wbuf)
 
static void ucs4_to_utf16 (uint wc, ushort *wbuf, int *wbufsize)
 
static int mbtowc_flags (int codepage)
 
static int must_use_null_useddefaultchar (int codepage)
 
static charstrrstr (const char *str, const char *token)
 
static charxstrndup (const char *s, size_t n)
 
static int seterror (int err)
 
static int sbcs_mblen (csconv_t *cv, const uchar *buf, int bufsize)
 
static int dbcs_mblen (csconv_t *cv, const uchar *buf, int bufsize)
 
static int mbcs_mblen (csconv_t *cv, const uchar *buf, int bufsize)
 
static int utf8_mblen (csconv_t *cv, const uchar *buf, int bufsize)
 
static int eucjp_mblen (csconv_t *cv, const uchar *buf, int bufsize)
 
static int kernel_mbtowc (csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)
 
static int kernel_wctomb (csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
 
static int mlang_mbtowc (csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)
 
static int mlang_wctomb (csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
 
static int utf16_mbtowc (csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)
 
static int utf16_wctomb (csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
 
static int utf32_mbtowc (csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)
 
static int utf32_wctomb (csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
 
static int iso2022jp_mbtowc (csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)
 
static int iso2022jp_wctomb (csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
 
static int iso2022jp_flush (csconv_t *cv, uchar *buf, int bufsize)
 
static int sbcs_mblen (csconv_t *cv UNUSED, const uchar *buf UNUSED, int bufsize UNUSED)
 
static int utf8_mblen (csconv_t *cv UNUSED, const uchar *buf, int bufsize)
 
static int eucjp_mblen (csconv_t *cv UNUSED, const uchar *buf, int bufsize)
 

Variables

struct {
   int   codepage
 
   const char *   name
 
codepage_alias []
 
static compat_t cp932_compat []
 
static compat_t cp20932_compat []
 
static compat_tcp51932_compat = cp932_compat
 
static compat_tcp5022x_compat = cp932_compat
 
static CONVERTINETSTRING ConvertINetString
 
static CONVERTINETMULTIBYTETOUNICODE ConvertINetMultiByteToUnicode
 
static CONVERTINETUNICODETOMULTIBYTE ConvertINetUnicodeToMultiByte
 
static ISCONVERTINETSTRINGAVAILABLE IsConvertINetStringAvailable
 
static LCIDTORFC1766A LcidToRfc1766A
 
static RFC1766TOLCIDA Rfc1766ToLcidA
 
static const char iso2022_SI_seq [] = "\x0F"
 
static const char iso2022_SO_seq [] = "\x0E"
 
static iso2022_esc_t iso2022jp_esc []
 

Macro Definition Documentation

◆ COMPAT_IN

#define COMPAT_IN   1

Definition at line 81 of file win_iconv.c.

◆ COMPAT_OUT

#define COMPAT_OUT   2

Definition at line 82 of file win_iconv.c.

◆ DEFAULT_LIBICONV_DLL

#define DEFAULT_LIBICONV_DLL   ""

Definition at line 36 of file win_iconv.c.

◆ FLAG_IGNORE

#define FLAG_IGNORE   4 /* //IGNORE */

Definition at line 46 of file win_iconv.c.

◆ FLAG_TRANSLIT

#define FLAG_TRANSLIT   2 /* //TRANSLIT */

Definition at line 45 of file win_iconv.c.

◆ FLAG_USE_BOM

#define FLAG_USE_BOM   1

Definition at line 44 of file win_iconv.c.

◆ GetProcAddressA

#define GetProcAddressA   GetProcAddress

Definition at line 26 of file win_iconv.c.

◆ ISO2022_MODE

#define ISO2022_MODE (   cs,
  shift 
)    (((cs) << 8) | (shift))

Definition at line 1662 of file win_iconv.c.

◆ ISO2022_MODE_CS

#define ISO2022_MODE_CS (   mode)    (((mode) >> 8) & 0xFF)

Definition at line 1663 of file win_iconv.c.

◆ ISO2022_MODE_SHIFT

#define ISO2022_MODE_SHIFT (   mode)    ((mode) & 0xFF)

Definition at line 1664 of file win_iconv.c.

◆ ISO2022_SI

#define ISO2022_SI   0

Definition at line 1666 of file win_iconv.c.

◆ ISO2022_SO

#define ISO2022_SO   1

Definition at line 1667 of file win_iconv.c.

◆ ISO2022JP_CS_ASCII

#define ISO2022JP_CS_ASCII   0

Definition at line 1682 of file win_iconv.c.

◆ ISO2022JP_CS_JISX0201_KANA

#define ISO2022JP_CS_JISX0201_KANA   2

Definition at line 1684 of file win_iconv.c.

◆ ISO2022JP_CS_JISX0201_ROMAN

#define ISO2022JP_CS_JISX0201_ROMAN   1

Definition at line 1683 of file win_iconv.c.

◆ ISO2022JP_CS_JISX0208_1978

#define ISO2022JP_CS_JISX0208_1978   3

Definition at line 1685 of file win_iconv.c.

◆ ISO2022JP_CS_JISX0208_1983

#define ISO2022JP_CS_JISX0208_1983   4

Definition at line 1686 of file win_iconv.c.

◆ ISO2022JP_CS_JISX0212

#define ISO2022JP_CS_JISX0212   5

Definition at line 1687 of file win_iconv.c.

◆ MB_CHAR_MAX

#define MB_CHAR_MAX   16

Definition at line 39 of file win_iconv.c.

◆ STRICT

#define STRICT

Definition at line 12 of file win_iconv.c.

◆ UNICODE_MODE_BOM_DONE

#define UNICODE_MODE_BOM_DONE   1

Definition at line 41 of file win_iconv.c.

◆ UNICODE_MODE_SWAPPED

#define UNICODE_MODE_SWAPPED   2

Definition at line 42 of file win_iconv.c.

◆ UNUSED

#define UNUSED

Definition at line 21 of file win_iconv.c.

◆ WINVER

#define WINVER   0x0500

Definition at line 9 of file win_iconv.c.

Typedef Documentation

◆ compat_t

Definition at line 68 of file win_iconv.c.

◆ CONVERTINETMULTIBYTETOUNICODE

typedef HRESULT(WINAPI * CONVERTINETMULTIBYTETOUNICODE) (LPDWORD lpdwMode, DWORD dwSrcEncoding, LPCSTR lpSrcStr, LPINT lpnMultiCharCount, LPWSTR lpDstStr, LPINT lpnWideCharCount)

Definition at line 666 of file win_iconv.c.

◆ CONVERTINETSTRING

typedef HRESULT(WINAPI * CONVERTINETSTRING) (LPDWORD lpdwMode, DWORD dwSrcEncoding, DWORD dwDstEncoding, LPCSTR lpSrcStr, LPINT lpnSrcSize, LPBYTE lpDstStr, LPINT lpnDstSize)

Definition at line 657 of file win_iconv.c.

◆ CONVERTINETUNICODETOMULTIBYTE

typedef HRESULT(WINAPI * CONVERTINETUNICODETOMULTIBYTE) (LPDWORD lpdwMode, DWORD dwEncoding, LPCWSTR lpSrcStr, LPINT lpnWideCharCount, LPSTR lpDstStr, LPINT lpnMultiCharCount)

Definition at line 674 of file win_iconv.c.

◆ csconv_t

Definition at line 69 of file win_iconv.c.

◆ f_errno

typedef int*(* f_errno) (void)

Definition at line 75 of file win_iconv.c.

◆ f_flush

typedef int(* f_flush) (csconv_t *cv, uchar *buf, int bufsize)

Definition at line 79 of file win_iconv.c.

◆ f_iconv

typedef size_t(* f_iconv) (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)

Definition at line 74 of file win_iconv.c.

◆ f_iconv_close

typedef int(* f_iconv_close) (iconv_t cd)

Definition at line 73 of file win_iconv.c.

◆ f_iconv_open

typedef iconv_t(* f_iconv_open) (const char *tocode, const char *fromcode)

Definition at line 72 of file win_iconv.c.

◆ f_mblen

typedef int(* f_mblen) (csconv_t *cv, const uchar *buf, int bufsize)

Definition at line 78 of file win_iconv.c.

◆ f_mbtowc

typedef int(* f_mbtowc) (csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)

Definition at line 76 of file win_iconv.c.

◆ f_wctomb

typedef int(* f_wctomb) (csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)

Definition at line 77 of file win_iconv.c.

◆ iconv_t

typedef void* iconv_t

Definition at line 52 of file win_iconv.c.

◆ ISCONVERTINETSTRINGAVAILABLE

typedef HRESULT(WINAPI * ISCONVERTINETSTRINGAVAILABLE) (DWORD dwSrcEncoding, DWORD dwDstEncoding)

Definition at line 682 of file win_iconv.c.

◆ iso2022_esc_t

Definition at line 1674 of file win_iconv.c.

◆ LCIDTORFC1766A

typedef HRESULT(WINAPI * LCIDTORFC1766A) (LCID Locale, LPSTR pszRfc1766, int nChar)

Definition at line 686 of file win_iconv.c.

◆ LCIDTORFC1766W

typedef HRESULT(WINAPI * LCIDTORFC1766W) (LCID Locale, LPWSTR pszRfc1766, int nChar)

Definition at line 691 of file win_iconv.c.

◆ rec_iconv_t

Definition at line 70 of file win_iconv.c.

◆ RFC1766TOLCIDA

typedef HRESULT(WINAPI * RFC1766TOLCIDA) (LCID *pLocale, LPSTR pszRfc1766)

Definition at line 696 of file win_iconv.c.

◆ RFC1766TOLCIDW

typedef HRESULT(WINAPI * RFC1766TOLCIDW) (LCID *pLocale, LPWSTR pszRfc1766)

Definition at line 700 of file win_iconv.c.

◆ uchar

typedef unsigned char uchar

Definition at line 48 of file win_iconv.c.

◆ uint

typedef unsigned int uint

Definition at line 50 of file win_iconv.c.

◆ ushort

typedef unsigned short ushort

Definition at line 49 of file win_iconv.c.

Function Documentation

◆ dbcs_mblen()

static int dbcs_mblen ( csconv_t cv,
const uchar buf,
int  bufsize 
)
static

Definition at line 1288 of file win_iconv.c.

1289 {
1290  int len = IsDBCSLeadByteEx(cv->codepage, buf[0]) ? 2 : 1;
1291  if (bufsize < len)
1292  return seterror(EINVAL);
1293  return len;
1294 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: arc.h:39
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
BOOL WINAPI IsDBCSLeadByteEx(UINT CodePage, BYTE TestByte)
Definition: nls.c:2108
GLenum GLsizei len
Definition: glext.h:6722
int codepage
Definition: win_iconv.c:92
static int seterror(int err)
Definition: win_iconv.c:1139

Referenced by make_csconv().

◆ eucjp_mblen() [1/2]

static int eucjp_mblen ( csconv_t cv,
const uchar buf,
int  bufsize 
)
static

Referenced by make_csconv().

◆ eucjp_mblen() [2/2]

static int eucjp_mblen ( csconv_t *cv  UNUSED,
const uchar buf,
int  bufsize 
)
static

Definition at line 1338 of file win_iconv.c.

1339 {
1340  if (buf[0] < 0x80) /* ASCII */
1341  return 1;
1342  else if (buf[0] == 0x8E) /* JIS X 0201 */
1343  {
1344  if (bufsize < 2)
1345  return seterror(EINVAL);
1346  else if (!(0xA1 <= buf[1] && buf[1] <= 0xDF))
1347  return seterror(EILSEQ);
1348  return 2;
1349  }
1350  else if (buf[0] == 0x8F) /* JIS X 0212 */
1351  {
1352  if (bufsize < 3)
1353  return seterror(EINVAL);
1354  else if (!(0xA1 <= buf[1] && buf[1] <= 0xFE)
1355  || !(0xA1 <= buf[2] && buf[2] <= 0xFE))
1356  return seterror(EILSEQ);
1357  return 3;
1358  }
1359  else /* JIS X 0208 */
1360  {
1361  if (bufsize < 2)
1362  return seterror(EINVAL);
1363  else if (!(0xA1 <= buf[0] && buf[0] <= 0xFE)
1364  || !(0xA1 <= buf[1] && buf[1] <= 0xFE))
1365  return seterror(EILSEQ);
1366  return 2;
1367  }
1368 }
#define EILSEQ
Definition: errno.h:97
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: arc.h:39
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
static int seterror(int err)
Definition: win_iconv.c:1139

◆ iconv()

size_t iconv ( iconv_t  cd,
const char **  inbuf,
size_t inbytesleft,
char **  outbuf,
size_t outbytesleft 
)

Definition at line 771 of file win_iconv.c.

772 {
773  rec_iconv_t *cd = (rec_iconv_t *)_cd;
774  size_t r = cd->iconv(cd->cd, inbuf, inbytesleft, outbuf, outbytesleft);
775  errno = *(cd->_errno());
776  return r;
777 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static struct cd_image cd
Definition: cdmake.c:182
int errno
uchar inbuf[M_BLOCK]
Definition: unzcrash.c:40
uchar outbuf[M_BLOCK_OUT]
Definition: unzcrash.c:41

Referenced by conv_charset(), convert_to_unicode(), joliet_strlen(), rdp_in_unistr(), rdp_out_unistr(), test(), ui_clip_handle_data(), and xclip_send_data_with_convert().

◆ iconv_close()

int iconv_close ( iconv_t  cd)

Definition at line 756 of file win_iconv.c.

757 {
758  rec_iconv_t *cd = (rec_iconv_t *)_cd;
759  int r = cd->iconv_close(cd->cd);
760  int e = *(cd->_errno());
761 #if defined(USE_LIBICONV_DLL)
762  if (cd->hlibiconv != NULL)
763  FreeLibrary(cd->hlibiconv);
764 #endif
765  free(cd);
766  errno = e;
767  return r;
768 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static struct cd_image cd
Definition: cdmake.c:182
#define free
Definition: debug_ros.c:5
int errno
#define e
Definition: ke_i.h:82
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:405

Referenced by check_enc(), rdp_in_unistr(), rdp_out_unistr(), sic_close(), ui_clip_handle_data(), xclip_send_data_with_convert(), xmlCharEncCloseFunc(), and xmlFindCharEncodingHandler().

◆ iconv_open()

iconv_t iconv_open ( const char tocode,
const char fromcode 
)

Definition at line 730 of file win_iconv.c.

731 {
732  rec_iconv_t *cd;
733 
734  cd = (rec_iconv_t *)calloc(1, sizeof(rec_iconv_t));
735  if (cd == NULL)
736  return (iconv_t)(-1);
737 
738 #if defined(USE_LIBICONV_DLL)
739  errno = 0;
740  if (libiconv_iconv_open(cd, tocode, fromcode))
741  return (iconv_t)cd;
742 #endif
743 
744  /* reset the errno to prevent reporting wrong error code.
745  * 0 for unsorted error. */
746  errno = 0;
747  if (win_iconv_open(cd, tocode, fromcode))
748  return (iconv_t)cd;
749 
750  free(cd);
751 
752  return (iconv_t)(-1);
753 }
static int win_iconv_open(rec_iconv_t *cd, const char *tocode, const char *fromcode)
Definition: win_iconv.c:780
static struct cd_image cd
Definition: cdmake.c:182
#define free
Definition: debug_ros.c:5
int errno
smooth NULL
Definition: ftsmooth.c:416
#define calloc
Definition: rosglue.h:14

Referenced by check_enc(), rdp_in_unistr(), rdp_out_unistr(), test(), ui_clip_handle_data(), xclip_send_data_with_convert(), and xmlFindCharEncodingHandler().

◆ iso2022jp_flush()

static int iso2022jp_flush ( csconv_t cv,
uchar buf,
int  bufsize 
)
static

Definition at line 1900 of file win_iconv.c.

1901 {
1902  iso2022_esc_t *iesc = iso2022jp_esc;
1903  int esc_len;
1904 
1906  {
1907  esc_len = 0;
1908  if (ISO2022_MODE_SHIFT(cv->mode) != ISO2022_SI)
1909  esc_len += 1;
1911  esc_len += iesc[ISO2022JP_CS_ASCII].esc_len;
1912  if (bufsize < esc_len)
1913  return seterror(E2BIG);
1914 
1915  esc_len = 0;
1916  if (ISO2022_MODE_SHIFT(cv->mode) != ISO2022_SI)
1917  {
1918  memcpy(buf, iso2022_SI_seq, 1);
1919  esc_len += 1;
1920  }
1922  {
1923  memcpy(buf + esc_len, iesc[ISO2022JP_CS_ASCII].esc,
1924  iesc[ISO2022JP_CS_ASCII].esc_len);
1925  esc_len += iesc[ISO2022JP_CS_ASCII].esc_len;
1926  }
1927  return esc_len;
1928  }
1929  return 0;
1930 }
Definition: arc.h:33
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
static iso2022_esc_t iso2022jp_esc[]
Definition: win_iconv.c:1689
DWORD mode
Definition: win_iconv.c:98
#define ISO2022_MODE_SHIFT(mode)
Definition: win_iconv.c:1664
#define ISO2022_SI
Definition: win_iconv.c:1666
#define ISO2022_MODE(cs, shift)
Definition: win_iconv.c:1662
#define ISO2022_MODE_CS(mode)
Definition: win_iconv.c:1663
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ISO2022JP_CS_ASCII
Definition: win_iconv.c:1682
static const char iso2022_SI_seq[]
Definition: win_iconv.c:1670
static int seterror(int err)
Definition: win_iconv.c:1139

Referenced by make_csconv().

◆ iso2022jp_mbtowc()

static int iso2022jp_mbtowc ( csconv_t cv,
const uchar buf,
int  bufsize,
ushort wbuf,
int wbufsize 
)
static

Definition at line 1700 of file win_iconv.c.

1701 {
1702  iso2022_esc_t *iesc = iso2022jp_esc;
1703  char tmp[MB_CHAR_MAX];
1704  int insize;
1705  HRESULT hr;
1706  DWORD dummy = 0;
1707  int len;
1708  int esc_len;
1709  int cs;
1710  int shift;
1711  int i;
1712 
1713  if (buf[0] == 0x1B)
1714  {
1715  for (i = 0; iesc[i].esc != NULL; ++i)
1716  {
1717  esc_len = iesc[i].esc_len;
1718  if (bufsize < esc_len)
1719  {
1720  if (strncmp((char *)buf, iesc[i].esc, bufsize) == 0)
1721  return seterror(EINVAL);
1722  }
1723  else
1724  {
1725  if (strncmp((char *)buf, iesc[i].esc, esc_len) == 0)
1726  {
1727  cv->mode = ISO2022_MODE(iesc[i].cs, ISO2022_SI);
1728  *wbufsize = 0;
1729  return esc_len;
1730  }
1731  }
1732  }
1733  /* not supported escape sequence */
1734  return seterror(EILSEQ);
1735  }
1736  else if (buf[0] == iso2022_SO_seq[0])
1737  {
1739  *wbufsize = 0;
1740  return 1;
1741  }
1742  else if (buf[0] == iso2022_SI_seq[0])
1743  {
1745  *wbufsize = 0;
1746  return 1;
1747  }
1748 
1749  cs = ISO2022_MODE_CS(cv->mode);
1750  shift = ISO2022_MODE_SHIFT(cv->mode);
1751 
1752  /* reset the mode for informal sequence */
1753  if (buf[0] < 0x20)
1754  {
1756  shift = ISO2022_SI;
1757  }
1758 
1759  len = iesc[cs].len;
1760  if (bufsize < len)
1761  return seterror(EINVAL);
1762  for (i = 0; i < len; ++i)
1763  if (!(buf[i] < 0x80))
1764  return seterror(EILSEQ);
1765  esc_len = iesc[cs].esc_len;
1766  memcpy(tmp, iesc[cs].esc, esc_len);
1767  if (shift == ISO2022_SO)
1768  {
1769  memcpy(tmp + esc_len, iso2022_SO_seq, 1);
1770  esc_len += 1;
1771  }
1772  memcpy(tmp + esc_len, buf, len);
1773 
1774  if ((cv->codepage == 50220 || cv->codepage == 50221
1775  || cv->codepage == 50222) && shift == ISO2022_SO)
1776  {
1777  /* XXX: shift-out cannot be used for mbtowc (both kernel and
1778  * mlang) */
1779  esc_len = iesc[ISO2022JP_CS_JISX0201_KANA].esc_len;
1780  memcpy(tmp, iesc[ISO2022JP_CS_JISX0201_KANA].esc, esc_len);
1781  memcpy(tmp + esc_len, buf, len);
1782  }
1783 
1784  insize = len + esc_len;
1786  (const char *)tmp, &insize, (wchar_t *)wbuf, wbufsize);
1787  if (hr != S_OK || insize != len + esc_len)
1788  return seterror(EILSEQ);
1789 
1790  /* Check for conversion error. Assuming defaultChar is 0x3F. */
1791  /* ascii should be converted from ascii */
1792  if (wbuf[0] == buf[0]
1794  return seterror(EILSEQ);
1795 
1796  /* reset the mode for informal sequence */
1797  if (cv->mode != ISO2022_MODE(cs, shift))
1798  cv->mode = ISO2022_MODE(cs, shift);
1799 
1800  return len;
1801 }
#define EILSEQ
Definition: errno.h:97
#define shift
Definition: input.c:1668
static CONVERTINETMULTIBYTETOUNICODE ConvertINetMultiByteToUnicode
Definition: win_iconv.c:705
HRESULT hr
Definition: shlfolder.c:183
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: arc.h:39
#define MB_CHAR_MAX
Definition: win_iconv.c:39
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
static iso2022_esc_t iso2022jp_esc[]
Definition: win_iconv.c:1689
const char * esc
Definition: win_iconv.c:1676
uint32_t cs
Definition: isohybrid.c:75
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD mode
Definition: win_iconv.c:98
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ISO2022_MODE_SHIFT(mode)
Definition: win_iconv.c:1664
#define ISO2022_SI
Definition: win_iconv.c:1666
#define ISO2022_MODE(cs, shift)
Definition: win_iconv.c:1662
#define ISO2022_MODE_CS(mode)
Definition: win_iconv.c:1663
const unsigned char unsigned long insize
Definition: jpeglib.h:982
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define ISO2022JP_CS_JISX0201_KANA
Definition: win_iconv.c:1684
#define S_OK
Definition: intsafe.h:59
#define ISO2022JP_CS_ASCII
Definition: win_iconv.c:1682
static const char iso2022_SI_seq[]
Definition: win_iconv.c:1670
static const char iso2022_SO_seq[]
Definition: win_iconv.c:1672
int codepage
Definition: win_iconv.c:92
static int seterror(int err)
Definition: win_iconv.c:1139
#define ISO2022_SO
Definition: win_iconv.c:1667

Referenced by make_csconv().

◆ iso2022jp_wctomb()

static int iso2022jp_wctomb ( csconv_t cv,
ushort wbuf,
int  wbufsize,
uchar buf,
int  bufsize 
)
static

Definition at line 1804 of file win_iconv.c.

1805 {
1806  iso2022_esc_t *iesc = iso2022jp_esc;
1807  char tmp[MB_CHAR_MAX];
1808  int tmpsize = MB_CHAR_MAX;
1809  int insize = wbufsize;
1810  HRESULT hr;
1811  DWORD dummy = 0;
1812  int len;
1813  int esc_len;
1814  int cs;
1815  int shift;
1816  int i;
1817 
1818  /*
1819  * MultiByte = [escape sequence] + character + [escape sequence]
1820  *
1821  * Whether trailing escape sequence is added depends on which API is
1822  * used (kernel or MLang, and its version).
1823  */
1825  (const wchar_t *)wbuf, &wbufsize, tmp, &tmpsize);
1826  if (hr != S_OK || insize != wbufsize)
1827  return seterror(EILSEQ);
1828  else if (bufsize < tmpsize)
1829  return seterror(E2BIG);
1830 
1831  if (tmpsize == 1)
1832  {
1834  esc_len = 0;
1835  }
1836  else
1837  {
1838  for (i = 1; iesc[i].esc != NULL; ++i)
1839  {
1840  esc_len = iesc[i].esc_len;
1841  if (strncmp(tmp, iesc[i].esc, esc_len) == 0)
1842  {
1843  cs = iesc[i].cs;
1844  break;
1845  }
1846  }
1847  if (iesc[i].esc == NULL)
1848  /* not supported escape sequence */
1849  return seterror(EILSEQ);
1850  }
1851 
1852  shift = ISO2022_SI;
1853  if (tmp[esc_len] == iso2022_SO_seq[0])
1854  {
1855  shift = ISO2022_SO;
1856  esc_len += 1;
1857  }
1858 
1859  len = iesc[cs].len;
1860 
1861  /* Check for converting error. Assuming defaultChar is 0x3F. */
1862  /* ascii should be converted from ascii */
1863  if (cs == ISO2022JP_CS_ASCII && !(wbuf[0] < 0x80))
1864  return seterror(EILSEQ);
1865  else if (tmpsize < esc_len + len)
1866  return seterror(EILSEQ);
1867 
1868  if (cv->mode == ISO2022_MODE(cs, shift))
1869  {
1870  /* remove escape sequence */
1871  if (esc_len != 0)
1872  memmove(tmp, tmp + esc_len, len);
1873  esc_len = 0;
1874  }
1875  else
1876  {
1877  if (cs == ISO2022JP_CS_ASCII)
1878  {
1879  esc_len = iesc[ISO2022JP_CS_ASCII].esc_len;
1880  memmove(tmp + esc_len, tmp, len);
1881  memcpy(tmp, iesc[ISO2022JP_CS_ASCII].esc, esc_len);
1882  }
1883  if (ISO2022_MODE_SHIFT(cv->mode) == ISO2022_SO)
1884  {
1885  /* shift-in before changing to other mode */
1886  memmove(tmp + 1, tmp, len + esc_len);
1887  memcpy(tmp, iso2022_SI_seq, 1);
1888  esc_len += 1;
1889  }
1890  }
1891 
1892  if (bufsize < len + esc_len)
1893  return seterror(E2BIG);
1894  memcpy(buf, tmp, len + esc_len);
1895  cv->mode = ISO2022_MODE(cs, shift);
1896  return len + esc_len;
1897 }
#define EILSEQ
Definition: errno.h:97
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
Definition: arc.h:33
#define shift
Definition: input.c:1668
HRESULT hr
Definition: shlfolder.c:183
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define MB_CHAR_MAX
Definition: win_iconv.c:39
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
static iso2022_esc_t iso2022jp_esc[]
Definition: win_iconv.c:1689
const char * esc
Definition: win_iconv.c:1676
uint32_t cs
Definition: isohybrid.c:75
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD mode
Definition: win_iconv.c:98
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ISO2022_MODE_SHIFT(mode)
Definition: win_iconv.c:1664
#define ISO2022_SI
Definition: win_iconv.c:1666
#define ISO2022_MODE(cs, shift)
Definition: win_iconv.c:1662
const unsigned char unsigned long insize
Definition: jpeglib.h:982
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
#define ISO2022JP_CS_ASCII
Definition: win_iconv.c:1682
static const char iso2022_SI_seq[]
Definition: win_iconv.c:1670
static const char iso2022_SO_seq[]
Definition: win_iconv.c:1672
int codepage
Definition: win_iconv.c:92
static int seterror(int err)
Definition: win_iconv.c:1139
static CONVERTINETUNICODETOMULTIBYTE ConvertINetUnicodeToMultiByte
Definition: win_iconv.c:706
#define ISO2022_SO
Definition: win_iconv.c:1667

Referenced by make_csconv().

◆ kernel_mbtowc()

static int kernel_mbtowc ( csconv_t cv,
const uchar buf,
int  bufsize,
ushort wbuf,
int wbufsize 
)
static

Definition at line 1371 of file win_iconv.c.

1372 {
1373  int len;
1374 
1375  len = cv->mblen(cv, buf, bufsize);
1376  if (len == -1)
1377  return -1;
1378  *wbufsize = MultiByteToWideChar(cv->codepage, mbtowc_flags (cv->codepage),
1379  (const char *)buf, len, (wchar_t *)wbuf, *wbufsize);
1380  if (*wbufsize == 0)
1381  return seterror(EILSEQ);
1382  return len;
1383 }
#define EILSEQ
Definition: errno.h:97
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
static int mbtowc_flags(int codepage)
Definition: win_iconv.c:1083
f_mblen mblen
Definition: win_iconv.c:96
GLenum GLsizei len
Definition: glext.h:6722
int codepage
Definition: win_iconv.c:92
#define MultiByteToWideChar
Definition: compat.h:100
static int seterror(int err)
Definition: win_iconv.c:1139

Referenced by make_csconv().

◆ kernel_wctomb()

static int kernel_wctomb ( csconv_t cv,
ushort wbuf,
int  wbufsize,
uchar buf,
int  bufsize 
)
static

Definition at line 1386 of file win_iconv.c.

1387 {
1388  BOOL usedDefaultChar = 0;
1389  BOOL *p = NULL;
1390  int flags = 0;
1391  int len;
1392 
1393  if (bufsize == 0)
1394  return seterror(E2BIG);
1396  {
1397  p = &usedDefaultChar;
1398 #ifdef WC_NO_BEST_FIT_CHARS
1399  if (!(cv->flags & FLAG_TRANSLIT))
1401 #endif
1402  }
1404  (const wchar_t *)wbuf, wbufsize, (char *)buf, bufsize, NULL, p);
1405  if (len == 0)
1406  {
1408  return seterror(E2BIG);
1409  return seterror(EILSEQ);
1410  }
1411  else if (usedDefaultChar && !(cv->flags & FLAG_TRANSLIT))
1412  return seterror(EILSEQ);
1413  else if (cv->mblen(cv, buf, len) != len) /* validate result */
1414  return seterror(EILSEQ);
1415  return len;
1416 }
#define EILSEQ
Definition: errno.h:97
Definition: arc.h:33
#define WideCharToMultiByte
Definition: compat.h:101
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
f_mblen mblen
Definition: win_iconv.c:96
GLbitfield flags
Definition: glext.h:7161
#define WC_NO_BEST_FIT_CHARS
Definition: unicode.h:46
GLenum GLsizei len
Definition: glext.h:6722
#define FLAG_TRANSLIT
Definition: win_iconv.c:45
static int must_use_null_useddefaultchar(int codepage)
Definition: win_iconv.c:1102
int codepage
Definition: win_iconv.c:92
static int seterror(int err)
Definition: win_iconv.c:1139
int flags
Definition: win_iconv.c:93
GLfloat GLfloat p
Definition: glext.h:8902
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by make_csconv().

◆ load_mlang()

static int load_mlang ( void  )
static

Definition at line 712 of file win_iconv.c.

713 {
714  HMODULE h;
715  if (ConvertINetString != NULL)
716  return TRUE;
717  h = LoadLibrary(TEXT("mlang.dll"));
718  if (!h)
719  return FALSE;
720  ConvertINetString = (CONVERTINETSTRING)GetProcAddressA(h, "ConvertINetString");
724  LcidToRfc1766A = (LCIDTORFC1766A)GetProcAddressA(h, "LcidToRfc1766A");
725  Rfc1766ToLcidA = (RFC1766TOLCIDA)GetProcAddressA(h, "Rfc1766ToLcidA");
726  return TRUE;
727 }
static LCIDTORFC1766A LcidToRfc1766A
Definition: win_iconv.c:708
HRESULT(WINAPI * ISCONVERTINETSTRINGAVAILABLE)(DWORD dwSrcEncoding, DWORD dwDstEncoding)
Definition: win_iconv.c:682
#define TRUE
Definition: types.h:120
static CONVERTINETMULTIBYTETOUNICODE ConvertINetMultiByteToUnicode
Definition: win_iconv.c:705
#define LoadLibrary
Definition: winbase.h:3676
HRESULT(WINAPI * CONVERTINETMULTIBYTETOUNICODE)(LPDWORD lpdwMode, DWORD dwSrcEncoding, LPCSTR lpSrcStr, LPINT lpnMultiCharCount, LPWSTR lpDstStr, LPINT lpnWideCharCount)
Definition: win_iconv.c:666
static CONVERTINETSTRING ConvertINetString
Definition: win_iconv.c:704
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static ISCONVERTINETSTRINGAVAILABLE IsConvertINetStringAvailable
Definition: win_iconv.c:707
HRESULT(WINAPI * LCIDTORFC1766A)(LCID Locale, LPSTR pszRfc1766, int nChar)
Definition: win_iconv.c:686
smooth NULL
Definition: ftsmooth.c:416
HRESULT(WINAPI * RFC1766TOLCIDA)(LCID *pLocale, LPSTR pszRfc1766)
Definition: win_iconv.c:696
HRESULT(WINAPI * CONVERTINETUNICODETOMULTIBYTE)(LPDWORD lpdwMode, DWORD dwEncoding, LPCWSTR lpSrcStr, LPINT lpnWideCharCount, LPSTR lpDstStr, LPINT lpnMultiCharCount)
Definition: win_iconv.c:674
static RFC1766TOLCIDA Rfc1766ToLcidA
Definition: win_iconv.c:709
#define TEXT(s)
Definition: k32.h:26
static CONVERTINETUNICODETOMULTIBYTE ConvertINetUnicodeToMultiByte
Definition: win_iconv.c:706
#define GetProcAddressA
Definition: win_iconv.c:26
HRESULT(WINAPI * CONVERTINETSTRING)(LPDWORD lpdwMode, DWORD dwSrcEncoding, DWORD dwDstEncoding, LPCSTR lpSrcStr, LPINT lpnSrcSize, LPBYTE lpDstStr, LPINT lpnDstSize)
Definition: win_iconv.c:657

Referenced by make_csconv().

◆ make_csconv()

static int make_csconv ( const char name,
csconv_t cv 
)
static

Definition at line 920 of file win_iconv.c.

921 {
922  CPINFO cpinfo;
923  int use_compat = TRUE;
924  int flag = 0;
925  char *name;
926  char *p;
927 
928  name = xstrndup(_name, strlen(_name));
929  if (name == NULL)
930  return FALSE;
931 
932  /* check for option "enc_name//opt1//opt2" */
933  while ((p = strrstr(name, "//")) != NULL)
934  {
935  if (_stricmp(p + 2, "nocompat") == 0)
936  use_compat = FALSE;
937  else if (_stricmp(p + 2, "translit") == 0)
938  flag |= FLAG_TRANSLIT;
939  else if (_stricmp(p + 2, "ignore") == 0)
940  flag |= FLAG_IGNORE;
941  *p = 0;
942  }
943 
944  cv->mode = 0;
945  cv->flags = flag;
946  cv->mblen = NULL;
947  cv->flush = NULL;
948  cv->compat = NULL;
950  if (cv->codepage == 1200 || cv->codepage == 1201)
951  {
952  cv->mbtowc = utf16_mbtowc;
953  cv->wctomb = utf16_wctomb;
954  if (_stricmp(name, "UTF-16") == 0 || _stricmp(name, "UTF16") == 0 ||
955  _stricmp(name, "UCS-2") == 0 || _stricmp(name, "UCS2") == 0)
956  cv->flags |= FLAG_USE_BOM;
957  }
958  else if (cv->codepage == 12000 || cv->codepage == 12001)
959  {
960  cv->mbtowc = utf32_mbtowc;
961  cv->wctomb = utf32_wctomb;
962  if (_stricmp(name, "UTF-32") == 0 || _stricmp(name, "UTF32") == 0 ||
963  _stricmp(name, "UCS-4") == 0 || _stricmp(name, "UCS4") == 0)
964  cv->flags |= FLAG_USE_BOM;
965  }
966  else if (cv->codepage == 65001)
967  {
968  cv->mbtowc = kernel_mbtowc;
969  cv->wctomb = kernel_wctomb;
970  cv->mblen = utf8_mblen;
971  }
972  else if ((cv->codepage == 50220 || cv->codepage == 50221 || cv->codepage == 50222) && load_mlang())
973  {
974  cv->mbtowc = iso2022jp_mbtowc;
975  cv->wctomb = iso2022jp_wctomb;
976  cv->flush = iso2022jp_flush;
977  }
978  else if (cv->codepage == 51932 && load_mlang())
979  {
980  cv->mbtowc = mlang_mbtowc;
981  cv->wctomb = mlang_wctomb;
982  cv->mblen = eucjp_mblen;
983  }
984  else if (IsValidCodePage(cv->codepage)
985  && GetCPInfo(cv->codepage, &cpinfo) != 0)
986  {
987  cv->mbtowc = kernel_mbtowc;
988  cv->wctomb = kernel_wctomb;
989  if (cpinfo.MaxCharSize == 1)
990  cv->mblen = sbcs_mblen;
991  else if (cpinfo.MaxCharSize == 2)
992  cv->mblen = dbcs_mblen;
993  else
994  cv->mblen = mbcs_mblen;
995  }
996  else
997  {
998  /* not supported */
999  free(name);
1000  errno = EINVAL;
1001  return FALSE;
1002  }
1003 
1004  if (use_compat)
1005  {
1006  switch (cv->codepage)
1007  {
1008  case 932: cv->compat = cp932_compat; break;
1009  case 20932: cv->compat = cp20932_compat; break;
1010  case 51932: cv->compat = cp51932_compat; break;
1011  case 50220: case 50221: case 50222: cv->compat = cp5022x_compat; break;
1012  }
1013  }
1014 
1015  free(name);
1016 
1017  return TRUE;
1018 }
compat_t * compat
Definition: win_iconv.c:99
BOOL WINAPI GetCPInfo(UINT CodePage, LPCPINFO CodePageInfo)
Definition: nls.c:1813
#define TRUE
Definition: types.h:120
static int kernel_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)
Definition: win_iconv.c:1371
static int mlang_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
Definition: win_iconv.c:1445
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
Definition: arc.h:39
#define free
Definition: debug_ros.c:5
f_mbtowc mbtowc
Definition: win_iconv.c:94
static int utf16_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
Definition: win_iconv.c:1516
UINT MaxCharSize
Definition: winnls.h:578
static int utf16_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)
Definition: win_iconv.c:1465
int errno
static compat_t cp932_compat[]
Definition: win_iconv.c:626
#define _stricmp
Definition: cat.c:22
static int utf8_mblen(csconv_t *cv, const uchar *buf, int bufsize)
static int iso2022jp_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)
Definition: win_iconv.c:1700
DWORD mode
Definition: win_iconv.c:98
static char * strrstr(const char *str, const char *token)
Definition: win_iconv.c:1114
static int eucjp_mblen(csconv_t *cv, const uchar *buf, int bufsize)
smooth NULL
Definition: ftsmooth.c:416
static int dbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize)
Definition: win_iconv.c:1288
static int mlang_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)
Definition: win_iconv.c:1427
static int load_mlang(void)
Definition: win_iconv.c:712
f_mblen mblen
Definition: win_iconv.c:96
static compat_t * cp51932_compat
Definition: win_iconv.c:652
static int utf32_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
Definition: win_iconv.c:1607
static compat_t * cp5022x_compat
Definition: win_iconv.c:655
static int utf32_mbtowc(csconv_t *cv, const uchar *buf, int bufsize, ushort *wbuf, int *wbufsize)
Definition: win_iconv.c:1568
static compat_t cp20932_compat[]
Definition: win_iconv.c:639
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
static int iso2022jp_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
Definition: win_iconv.c:1804
#define FLAG_TRANSLIT
Definition: win_iconv.c:45
static int iso2022jp_flush(csconv_t *cv, uchar *buf, int bufsize)
Definition: win_iconv.c:1900
BOOL WINAPI IsValidCodePage(UINT CodePage)
Definition: nls.c:1377
f_flush flush
Definition: win_iconv.c:97
int codepage
Definition: win_iconv.c:92
static int sbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize)
static int mbcs_mblen(csconv_t *cv, const uchar *buf, int bufsize)
Definition: win_iconv.c:1297
static char * xstrndup(const char *s, size_t n)
Definition: win_iconv.c:1126
#define FLAG_IGNORE
Definition: win_iconv.c:46
Definition: name.c:36
int flags
Definition: win_iconv.c:93
#define FLAG_USE_BOM
Definition: win_iconv.c:44
GLfloat GLfloat p
Definition: glext.h:8902
f_wctomb wctomb
Definition: win_iconv.c:95
static int kernel_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
Definition: win_iconv.c:1386
const char * name
Definition: win_iconv.c:157
static int name_to_codepage(const char *name)
Definition: win_iconv.c:1021

Referenced by win_iconv_open().

◆ mbcs_mblen()

static int mbcs_mblen ( csconv_t cv,
const uchar buf,
int  bufsize 
)
static

Definition at line 1297 of file win_iconv.c.

1298 {
1299  int len = 0;
1300 
1301  if (cv->codepage == 54936) {
1302  if (buf[0] <= 0x7F) len = 1;
1303  else if (buf[0] >= 0x81 && buf[0] <= 0xFE &&
1304  bufsize >= 2 &&
1305  ((buf[1] >= 0x40 && buf[1] <= 0x7E) ||
1306  (buf[1] >= 0x80 && buf[1] <= 0xFE))) len = 2;
1307  else if (buf[0] >= 0x81 && buf[0] <= 0xFE &&
1308  bufsize >= 4 &&
1309  buf[1] >= 0x30 && buf[1] <= 0x39) len = 4;
1310  else
1311  return seterror(EINVAL);
1312  return len;
1313  }
1314  else
1315  return seterror(EINVAL);
1316 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: arc.h:39
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
GLenum GLsizei len
Definition: glext.h:6722
int codepage
Definition: win_iconv.c:92
static int seterror(int err)
Definition: win_iconv.c:1139

Referenced by make_csconv().

◆ mbtowc_flags()

static int mbtowc_flags ( int  codepage)
static

Definition at line 1083 of file win_iconv.c.

1084 {
1085  return (codepage == 50220 || codepage == 50221 ||
1086  codepage == 50222 || codepage == 50225 ||
1087  codepage == 50227 || codepage == 50229 ||
1088  codepage == 52936 || codepage == 54936 ||
1089  (codepage >= 57002 && codepage <= 57011) ||
1090  codepage == 65000 || codepage == 42) ? 0 : MB_ERR_INVALID_CHARS;
1091 }
#define MB_ERR_INVALID_CHARS
Definition: unicode.h:41
int codepage
Definition: win_iconv.c:156

Referenced by kernel_mbtowc().

◆ mlang_mbtowc()

static int mlang_mbtowc ( csconv_t cv,
const uchar buf,
int  bufsize,
ushort wbuf,
int wbufsize 
)
static

Definition at line 1427 of file win_iconv.c.

1428 {
1429  int len;
1430  int insize;
1431  HRESULT hr;
1432 
1433  len = cv->mblen(cv, buf, bufsize);
1434  if (len == -1)
1435  return -1;
1436  insize = len;
1438  (const char *)buf, &insize, (wchar_t *)wbuf, wbufsize);
1439  if (hr != S_OK || insize != len)
1440  return seterror(EILSEQ);
1441  return len;
1442 }
#define EILSEQ
Definition: errno.h:97
static CONVERTINETMULTIBYTETOUNICODE ConvertINetMultiByteToUnicode
Definition: win_iconv.c:705
HRESULT hr
Definition: shlfolder.c:183
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
DWORD mode
Definition: win_iconv.c:98
f_mblen mblen
Definition: win_iconv.c:96
LONG HRESULT
Definition: typedefs.h:77
const unsigned char unsigned long insize
Definition: jpeglib.h:982
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
int codepage
Definition: win_iconv.c:92
static int seterror(int err)
Definition: win_iconv.c:1139

Referenced by make_csconv().

◆ mlang_wctomb()

static int mlang_wctomb ( csconv_t cv,
ushort wbuf,
int  wbufsize,
uchar buf,
int  bufsize 
)
static

Definition at line 1445 of file win_iconv.c.

1446 {
1447  char tmpbuf[MB_CHAR_MAX]; /* enough room for one character */
1448  int tmpsize = MB_CHAR_MAX;
1449  int insize = wbufsize;
1450  HRESULT hr;
1451 
1453  (const wchar_t *)wbuf, &wbufsize, tmpbuf, &tmpsize);
1454  if (hr != S_OK || insize != wbufsize)
1455  return seterror(EILSEQ);
1456  else if (bufsize < tmpsize)
1457  return seterror(E2BIG);
1458  else if (cv->mblen(cv, (uchar *)tmpbuf, tmpsize) != tmpsize)
1459  return seterror(EILSEQ);
1460  memcpy(buf, tmpbuf, tmpsize);
1461  return tmpsize;
1462 }
#define EILSEQ
Definition: errno.h:97
Definition: arc.h:33
HRESULT hr
Definition: shlfolder.c:183
unsigned char uchar
Definition: Unfrag.h:59
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define MB_CHAR_MAX
Definition: win_iconv.c:39
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
DWORD mode
Definition: win_iconv.c:98
f_mblen mblen
Definition: win_iconv.c:96
LONG HRESULT
Definition: typedefs.h:77
const unsigned char unsigned long insize
Definition: jpeglib.h:982
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
int codepage
Definition: win_iconv.c:92
static int seterror(int err)
Definition: win_iconv.c:1139
static CONVERTINETUNICODETOMULTIBYTE ConvertINetUnicodeToMultiByte
Definition: win_iconv.c:706

Referenced by make_csconv().

◆ must_use_null_useddefaultchar()

static int must_use_null_useddefaultchar ( int  codepage)
static

Definition at line 1102 of file win_iconv.c.

1103 {
1104  return (codepage == 65000 || codepage == 65001 ||
1105  codepage == 50220 || codepage == 50221 ||
1106  codepage == 50222 || codepage == 50225 ||
1107  codepage == 50227 || codepage == 50229 ||
1108  codepage == 52936 || codepage == 54936 ||
1109  (codepage >= 57002 && codepage <= 57011) ||
1110  codepage == 42);
1111 }
int codepage
Definition: win_iconv.c:156

Referenced by kernel_wctomb().

◆ name_to_codepage()

static int name_to_codepage ( const char name)
static

Definition at line 1021 of file win_iconv.c.

1022 {
1023  int i;
1024 
1025  if (*name == '\0' ||
1026  strcmp(name, "char") == 0)
1027  return GetACP();
1028  else if (strcmp(name, "wchar_t") == 0)
1029  return 1200;
1030  else if (_strnicmp(name, "cp", 2) == 0)
1031  return atoi(name + 2); /* CP123 */
1032  else if ('0' <= name[0] && name[0] <= '9')
1033  return atoi(name); /* 123 */
1034  else if (_strnicmp(name, "xx", 2) == 0)
1035  return atoi(name + 2); /* XX123 for debug */
1036 
1037  for (i = 0; codepage_alias[i].name != NULL; ++i)
1038  if (_stricmp(name, codepage_alias[i].name) == 0)
1039  return codepage_alias[i].codepage;
1040  return -1;
1041 }
#define _stricmp
Definition: cat.c:22
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_ _CRTIMP int __cdecl _strnicmp(_In_reads_or_z_(_MaxCount) const char *_Str1, _In_reads_or_z_(_MaxCount) const char *_Str2, _In_ size_t _MaxCount)
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI GetACP(VOID)
Definition: nls.c:2078
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
static struct @3859 codepage_alias[]
Definition: name.c:36
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by make_csconv().

◆ sbcs_mblen() [1/2]

static int sbcs_mblen ( csconv_t cv,
const uchar buf,
int  bufsize 
)
static

Referenced by make_csconv().

◆ sbcs_mblen() [2/2]

static int sbcs_mblen ( csconv_t *cv  UNUSED,
const uchar *buf  UNUSED,
int bufsize  UNUSED 
)
static

Definition at line 1282 of file win_iconv.c.

1283 {
1284  return 1;
1285 }

◆ seterror()

static int seterror ( int  err)
static

◆ strrstr()

static char * strrstr ( const char str,
const char token 
)
static

Definition at line 1114 of file win_iconv.c.

1115 {
1116  int len = strlen(token);
1117  const char *p = str + strlen(str);
1118 
1119  while (str <= --p)
1120  if (p[0] == token[0] && strncmp(p, token, len) == 0)
1121  return (char *)p;
1122  return NULL;
1123 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by make_csconv().

◆ ucs4_to_utf16()

static void ucs4_to_utf16 ( uint  wc,
ushort wbuf,
int wbufsize 
)
static

Definition at line 1056 of file win_iconv.c.

1057 {
1058  if (wc < 0x10000)
1059  {
1060  wbuf[0] = wc;
1061  *wbufsize = 1;
1062  }
1063  else
1064  {
1065  wc -= 0x10000;
1066  wbuf[0] = 0xD800 | ((wc >> 10) & 0x3FF);
1067  wbuf[1] = 0xDC00 | (wc & 0x3FF);
1068  *wbufsize = 2;
1069  }
1070 }

Referenced by utf32_mbtowc(), and win_iconv().

◆ utf16_mbtowc()

static int utf16_mbtowc ( csconv_t cv,
const uchar buf,
int  bufsize,
ushort wbuf,
int wbufsize 
)
static

Definition at line 1465 of file win_iconv.c.

1466 {
1467  int codepage = cv->codepage;
1468 
1469  /* swap endian: 1200 <-> 1201 */
1470  if (cv->mode & UNICODE_MODE_SWAPPED)
1471  codepage ^= 1;
1472 
1473  if (bufsize < 2)
1474  return seterror(EINVAL);
1475  if (codepage == 1200) /* little endian */
1476  wbuf[0] = (buf[1] << 8) | buf[0];
1477  else if (codepage == 1201) /* big endian */
1478  wbuf[0] = (buf[0] << 8) | buf[1];
1479 
1480  if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE))
1481  {
1482  cv->mode |= UNICODE_MODE_BOM_DONE;
1483  if (wbuf[0] == 0xFFFE)
1484  {
1485  cv->mode |= UNICODE_MODE_SWAPPED;
1486  *wbufsize = 0;
1487  return 2;
1488  }
1489  else if (wbuf[0] == 0xFEFF)
1490  {
1491  *wbufsize = 0;
1492  return 2;
1493  }
1494  }
1495 
1496  if (0xDC00 <= wbuf[0] && wbuf[0] <= 0xDFFF)
1497  return seterror(EILSEQ);
1498  if (0xD800 <= wbuf[0] && wbuf[0] <= 0xDBFF)
1499  {
1500  if (bufsize < 4)
1501  return seterror(EINVAL);
1502  if (codepage == 1200) /* little endian */
1503  wbuf[1] = (buf[3] << 8) | buf[2];
1504  else if (codepage == 1201) /* big endian */
1505  wbuf[1] = (buf[2] << 8) | buf[3];
1506  if (!(0xDC00 <= wbuf[1] && wbuf[1] <= 0xDFFF))
1507  return seterror(EILSEQ);
1508  *wbufsize = 2;
1509  return 4;
1510  }
1511  *wbufsize = 1;
1512  return 2;
1513 }
#define EILSEQ
Definition: errno.h:97
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: arc.h:39
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
#define UNICODE_MODE_BOM_DONE
Definition: win_iconv.c:41
DWORD mode
Definition: win_iconv.c:98
int codepage
Definition: win_iconv.c:156
#define UNICODE_MODE_SWAPPED
Definition: win_iconv.c:42
int codepage
Definition: win_iconv.c:92
static int seterror(int err)
Definition: win_iconv.c:1139
int flags
Definition: win_iconv.c:93
#define FLAG_USE_BOM
Definition: win_iconv.c:44

Referenced by make_csconv().

◆ utf16_to_ucs4()

static uint utf16_to_ucs4 ( const ushort wbuf)
static

Definition at line 1047 of file win_iconv.c.

1048 {
1049  uint wc = wbuf[0];
1050  if (0xD800 <= wbuf[0] && wbuf[0] <= 0xDBFF)
1051  wc = ((wbuf[0] & 0x3FF) << 10) + (wbuf[1] & 0x3FF) + 0x10000;
1052  return wc;
1053 }
UINT32 uint
Definition: types.h:83

Referenced by utf32_wctomb(), and win_iconv().

◆ utf16_wctomb()

static int utf16_wctomb ( csconv_t cv,
ushort wbuf,
int  wbufsize,
uchar buf,
int  bufsize 
)
static

Definition at line 1516 of file win_iconv.c.

1517 {
1518  if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE))
1519  {
1520  int r;
1521 
1522  cv->mode |= UNICODE_MODE_BOM_DONE;
1523  if (bufsize < 2)
1524  return seterror(E2BIG);
1525  if (cv->codepage == 1200) /* little endian */
1526  memcpy(buf, "\xFF\xFE", 2);
1527  else if (cv->codepage == 1201) /* big endian */
1528  memcpy(buf, "\xFE\xFF", 2);
1529 
1530  r = utf16_wctomb(cv, wbuf, wbufsize, buf + 2, bufsize - 2);
1531  if (r == -1)
1532  return -1;
1533  return r + 2;
1534  }
1535 
1536  if (bufsize < 2)
1537  return seterror(E2BIG);
1538  if (cv->codepage == 1200) /* little endian */
1539  {
1540  buf[0] = (wbuf[0] & 0x00FF);
1541  buf[1] = (wbuf[0] & 0xFF00) >> 8;
1542  }
1543  else if (cv->codepage == 1201) /* big endian */
1544  {
1545  buf[0] = (wbuf[0] & 0xFF00) >> 8;
1546  buf[1] = (wbuf[0] & 0x00FF);
1547  }
1548  if (0xD800 <= wbuf[0] && wbuf[0] <= 0xDBFF)
1549  {
1550  if (bufsize < 4)
1551  return seterror(E2BIG);
1552  if (cv->codepage == 1200) /* little endian */
1553  {
1554  buf[2] = (wbuf[1] & 0x00FF);
1555  buf[3] = (wbuf[1] & 0xFF00) >> 8;
1556  }
1557  else if (cv->codepage == 1201) /* big endian */
1558  {
1559  buf[2] = (wbuf[1] & 0xFF00) >> 8;
1560  buf[3] = (wbuf[1] & 0x00FF);
1561  }
1562  return 4;
1563  }
1564  return 2;
1565 }
Definition: arc.h:33
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static int utf16_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
Definition: win_iconv.c:1516
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
#define UNICODE_MODE_BOM_DONE
Definition: win_iconv.c:41
DWORD mode
Definition: win_iconv.c:98
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
int codepage
Definition: win_iconv.c:92
static int seterror(int err)
Definition: win_iconv.c:1139
int flags
Definition: win_iconv.c:93
#define FLAG_USE_BOM
Definition: win_iconv.c:44

Referenced by make_csconv().

◆ utf32_mbtowc()

static int utf32_mbtowc ( csconv_t cv,
const uchar buf,
int  bufsize,
ushort wbuf,
int wbufsize 
)
static

Definition at line 1568 of file win_iconv.c.

1569 {
1570  int codepage = cv->codepage;
1571  uint wc;
1572 
1573  /* swap endian: 12000 <-> 12001 */
1574  if (cv->mode & UNICODE_MODE_SWAPPED)
1575  codepage ^= 1;
1576 
1577  if (bufsize < 4)
1578  return seterror(EINVAL);
1579  if (codepage == 12000) /* little endian */
1580  wc = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
1581  else if (codepage == 12001) /* big endian */
1582  wc = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
1583 
1584  if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE))
1585  {
1586  cv->mode |= UNICODE_MODE_BOM_DONE;
1587  if (wc == 0xFFFE0000)
1588  {
1589  cv->mode |= UNICODE_MODE_SWAPPED;
1590  *wbufsize = 0;
1591  return 4;
1592  }
1593  else if (wc == 0x0000FEFF)
1594  {
1595  *wbufsize = 0;
1596  return 4;
1597  }
1598  }
1599 
1600  if ((0xD800 <= wc && wc <= 0xDFFF) || 0x10FFFF < wc)
1601  return seterror(EILSEQ);
1602  ucs4_to_utf16(wc, wbuf, wbufsize);
1603  return 4;
1604 }
#define EILSEQ
Definition: errno.h:97
static void ucs4_to_utf16(uint wc, ushort *wbuf, int *wbufsize)
Definition: win_iconv.c:1056
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: arc.h:39
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
#define UNICODE_MODE_BOM_DONE
Definition: win_iconv.c:41
DWORD mode
Definition: win_iconv.c:98
int codepage
Definition: win_iconv.c:156
#define UNICODE_MODE_SWAPPED
Definition: win_iconv.c:42
int codepage
Definition: win_iconv.c:92
static int seterror(int err)
Definition: win_iconv.c:1139
int flags
Definition: win_iconv.c:93
UINT32 uint
Definition: types.h:83
#define FLAG_USE_BOM
Definition: win_iconv.c:44

Referenced by make_csconv().

◆ utf32_wctomb()

static int utf32_wctomb ( csconv_t cv,
ushort wbuf,
int  wbufsize,
uchar buf,
int  bufsize 
)
static

Definition at line 1607 of file win_iconv.c.

1608 {
1609  uint wc;
1610 
1611  if ((cv->flags & FLAG_USE_BOM) && !(cv->mode & UNICODE_MODE_BOM_DONE))
1612  {
1613  int r;
1614 
1615  cv->mode |= UNICODE_MODE_BOM_DONE;
1616  if (bufsize < 4)
1617  return seterror(E2BIG);
1618  if (cv->codepage == 12000) /* little endian */
1619  memcpy(buf, "\xFF\xFE\x00\x00", 4);
1620  else if (cv->codepage == 12001) /* big endian */
1621  memcpy(buf, "\x00\x00\xFE\xFF", 4);
1622 
1623  r = utf32_wctomb(cv, wbuf, wbufsize, buf + 4, bufsize - 4);
1624  if (r == -1)
1625  return -1;
1626  return r + 4;
1627  }
1628 
1629  if (bufsize < 4)
1630  return seterror(E2BIG);
1631  wc = utf16_to_ucs4(wbuf);
1632  if (cv->codepage == 12000) /* little endian */
1633  {
1634  buf[0] = wc & 0x000000FF;
1635  buf[1] = (wc & 0x0000FF00) >> 8;
1636  buf[2] = (wc & 0x00FF0000) >> 16;
1637  buf[3] = (wc & 0xFF000000) >> 24;
1638  }
1639  else if (cv->codepage == 12001) /* big endian */
1640  {
1641  buf[0] = (wc & 0xFF000000) >> 24;
1642  buf[1] = (wc & 0x00FF0000) >> 16;
1643  buf[2] = (wc & 0x0000FF00) >> 8;
1644  buf[3] = wc & 0x000000FF;
1645  }
1646  return 4;
1647 }
static uint utf16_to_ucs4(const ushort *wbuf)
Definition: win_iconv.c:1047
Definition: arc.h:33
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
#define UNICODE_MODE_BOM_DONE
Definition: win_iconv.c:41
DWORD mode
Definition: win_iconv.c:98
static int utf32_wctomb(csconv_t *cv, ushort *wbuf, int wbufsize, uchar *buf, int bufsize)
Definition: win_iconv.c:1607
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
int codepage
Definition: win_iconv.c:92
static int seterror(int err)
Definition: win_iconv.c:1139
int flags
Definition: win_iconv.c:93
UINT32 uint
Definition: types.h:83
#define FLAG_USE_BOM
Definition: win_iconv.c:44

Referenced by make_csconv().

◆ utf8_mblen() [1/2]

static int utf8_mblen ( csconv_t cv,
const uchar buf,
int  bufsize 
)
static

Referenced by make_csconv().

◆ utf8_mblen() [2/2]

static int utf8_mblen ( csconv_t *cv  UNUSED,
const uchar buf,
int  bufsize 
)
static

Definition at line 1319 of file win_iconv.c.

1320 {
1321  int len = 0;
1322 
1323  if (buf[0] < 0x80) len = 1;
1324  else if ((buf[0] & 0xE0) == 0xC0) len = 2;
1325  else if ((buf[0] & 0xF0) == 0xE0) len = 3;
1326  else if ((buf[0] & 0xF8) == 0xF0) len = 4;
1327  else if ((buf[0] & 0xFC) == 0xF8) len = 5;
1328  else if ((buf[0] & 0xFE) == 0xFC) len = 6;
1329 
1330  if (len == 0)
1331  return seterror(EILSEQ);
1332  else if (bufsize < len)
1333  return seterror(EINVAL);
1334  return len;
1335 }
#define EILSEQ
Definition: errno.h:97
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: arc.h:39
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
GLenum GLsizei len
Definition: glext.h:6722
static int seterror(int err)
Definition: win_iconv.c:1139

◆ win_iconv()

static size_t win_iconv ( iconv_t  cd,
const char **  inbuf,
size_t inbytesleft,
char **  outbuf,
size_t outbytesleft 
)
static

Definition at line 798 of file win_iconv.c.

799 {
800  rec_iconv_t *cd = (rec_iconv_t *)_cd;
801  ushort wbuf[MB_CHAR_MAX]; /* enough room for one character */
802  int insize;
803  int outsize;
804  int wsize;
805  DWORD frommode;
806  DWORD tomode;
807  uint wc;
808  compat_t *cp;
809  int i;
810 
811  if (inbuf == NULL || *inbuf == NULL)
812  {
813  if (outbuf != NULL && *outbuf != NULL && cd->to.flush != NULL)
814  {
815  tomode = cd->to.mode;
816  outsize = cd->to.flush(&cd->to, (uchar *)*outbuf, *outbytesleft);
817  if (outsize == -1)
818  {
819  if ((cd->to.flags & FLAG_IGNORE) && errno != E2BIG)
820  {
821  outsize = 0;
822  }
823  else
824  {
825  cd->to.mode = tomode;
826  return (size_t)(-1);
827  }
828  }
829  *outbuf += outsize;
830  *outbytesleft -= outsize;
831  }
832  cd->from.mode = 0;
833  cd->to.mode = 0;
834  return 0;
835  }
836 
837  while (*inbytesleft != 0)
838  {
839  frommode = cd->from.mode;
840  tomode = cd->to.mode;
841  wsize = MB_CHAR_MAX;
842 
843  insize = cd->from.mbtowc(&cd->from, (const uchar *)*inbuf, *inbytesleft, wbuf, &wsize);
844  if (insize == -1)
845  {
846  if (cd->to.flags & FLAG_IGNORE)
847  {
848  cd->from.mode = frommode;
849  insize = 1;
850  wsize = 0;
851  }
852  else
853  {
854  cd->from.mode = frommode;
855  return (size_t)(-1);
856  }
857  }
858 
859  if (wsize == 0)
860  {
861  *inbuf += insize;
862  *inbytesleft -= insize;
863  continue;
864  }
865 
866  if (cd->from.compat != NULL)
867  {
868  wc = utf16_to_ucs4(wbuf);
869  cp = cd->from.compat;
870  for (i = 0; cp[i].in != 0; ++i)
871  {
872  if ((cp[i].flag & COMPAT_IN) && cp[i].out == wc)
873  {
874  ucs4_to_utf16(cp[i].in, wbuf, &wsize);
875  break;
876  }
877  }
878  }
879 
880  if (cd->to.compat != NULL)
881  {
882  wc = utf16_to_ucs4(wbuf);
883  cp = cd->to.compat;
884  for (i = 0; cp[i].in != 0; ++i)
885  {
886  if ((cp[i].flag & COMPAT_OUT) && cp[i].in == wc)
887  {
888  ucs4_to_utf16(cp[i].out, wbuf, &wsize);
889  break;
890  }
891  }
892  }
893 
894  outsize = cd->to.wctomb(&cd->to, wbuf, wsize, (uchar *)*outbuf, *outbytesleft);
895  if (outsize == -1)
896  {
897  if ((cd->to.flags & FLAG_IGNORE) && errno != E2BIG)
898  {
899  cd->to.mode = tomode;
900  outsize = 0;
901  }
902  else
903  {
904  cd->from.mode = frommode;
905  cd->to.mode = tomode;
906  return (size_t)(-1);
907  }
908  }
909 
910  *inbuf += insize;
911  *outbuf += outsize;
912  *inbytesleft -= insize;
913  *outbytesleft -= outsize;
914  }
915 
916  return 0;
917 }
static uint utf16_to_ucs4(const ushort *wbuf)
Definition: win_iconv.c:1047
Definition: arc.h:33
static void ucs4_to_utf16(uint wc, ushort *wbuf, int *wbufsize)
Definition: win_iconv.c:1056
unsigned char uchar
Definition: Unfrag.h:59
static struct cd_image cd
Definition: cdmake.c:182
#define MB_CHAR_MAX
Definition: win_iconv.c:39
int errno
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
unsigned short ushort
Definition: linux.h:273
#define COMPAT_IN
Definition: win_iconv.c:81
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char unsigned long * outsize
Definition: jpeglib.h:979
uchar inbuf[M_BLOCK]
Definition: unzcrash.c:40
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
const unsigned char unsigned long insize
Definition: jpeglib.h:982
#define COMPAT_OUT
Definition: win_iconv.c:82
GLuint in
Definition: glext.h:9616
#define FLAG_IGNORE
Definition: win_iconv.c:46
POINT cp
Definition: magnifier.c:60
UINT32 uint
Definition: types.h:83
uchar outbuf[M_BLOCK_OUT]
Definition: unzcrash.c:41

Referenced by win_iconv_open().

◆ win_iconv_close()

static int win_iconv_close ( iconv_t cd  UNUSED)
static

Definition at line 792 of file win_iconv.c.

793 {
794  return 0;
795 }

Referenced by win_iconv_open().

◆ win_iconv_open()

static int win_iconv_open ( rec_iconv_t cd,
const char tocode,
const char fromcode 
)
static

Definition at line 780 of file win_iconv.c.

781 {
782  if (!make_csconv(fromcode, &cd->from) || !make_csconv(tocode, &cd->to))
783  return FALSE;
784  cd->iconv_close = win_iconv_close;
785  cd->iconv = win_iconv;
786  cd->_errno = _errno;
787  cd->cd = (iconv_t)cd;
788  return TRUE;
789 }
#define TRUE
Definition: types.h:120
static size_t win_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Definition: win_iconv.c:798
static struct cd_image cd
Definition: cdmake.c:182
static int win_iconv_close(iconv_t cd)
Definition: win_iconv.c:792
_CRTIMP int *__cdecl _errno(void)
Definition: errno.c:19
static int make_csconv(const char *name, csconv_t *cv)
Definition: win_iconv.c:920
void * iconv_t
Definition: win_iconv.c:52

Referenced by iconv_open().

◆ xstrndup()

static char * xstrndup ( const char s,
size_t  n 
)
static

Definition at line 1126 of file win_iconv.c.

1127 {
1128  char *p;
1129 
1130  p = (char *)malloc(n + 1);
1131  if (p == NULL)
1132  return NULL;
1133  memcpy(p, s, n);
1134  p[n] = '\0';
1135  return p;
1136 }
GLdouble n
Definition: glext.h:7729
smooth NULL
Definition: ftsmooth.c:416
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLdouble s
Definition: gl.h:2039
#define malloc
Definition: debug_ros.c:4
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by make_csconv().

Variable Documentation

◆ codepage

◆ codepage_alias

struct { ... } codepage_alias[]

Referenced by name_to_codepage().

◆ ConvertINetMultiByteToUnicode

CONVERTINETMULTIBYTETOUNICODE ConvertINetMultiByteToUnicode
static

Definition at line 705 of file win_iconv.c.

Referenced by iso2022jp_mbtowc(), load_mlang(), and mlang_mbtowc().

◆ ConvertINetString

CONVERTINETSTRING ConvertINetString
static

Definition at line 704 of file win_iconv.c.

Referenced by load_mlang().

◆ ConvertINetUnicodeToMultiByte

CONVERTINETUNICODETOMULTIBYTE ConvertINetUnicodeToMultiByte
static

Definition at line 706 of file win_iconv.c.

Referenced by iso2022jp_wctomb(), load_mlang(), mlang_wctomb(), and SHUnicodeToAnsiCP().

◆ cp20932_compat

compat_t cp20932_compat[]
static
Initial value:
= {
{0x00A5, 0x005C, COMPAT_OUT},
{0x203E, 0x007E, COMPAT_OUT},
{0x2014, 0x2015, COMPAT_OUT},
{0xFF5E, 0x301C, COMPAT_OUT|COMPAT_IN},
{0x2225, 0x2016, COMPAT_OUT|COMPAT_IN},
{0xFF0D, 0x2212, COMPAT_OUT|COMPAT_IN},
{0xFFE0, 0x00A2, COMPAT_OUT|COMPAT_IN},
{0xFFE1, 0x00A3, COMPAT_OUT|COMPAT_IN},
{0xFFE2, 0x00AC, COMPAT_OUT|COMPAT_IN},
{0, 0, 0}
}
#define COMPAT_IN
Definition: win_iconv.c:81
#define COMPAT_OUT
Definition: win_iconv.c:82

Definition at line 639 of file win_iconv.c.

Referenced by make_csconv().

◆ cp5022x_compat

compat_t* cp5022x_compat = cp932_compat
static

Definition at line 655 of file win_iconv.c.

Referenced by make_csconv().

◆ cp51932_compat

compat_t* cp51932_compat = cp932_compat
static

Definition at line 652 of file win_iconv.c.

Referenced by make_csconv().

◆ cp932_compat

compat_t cp932_compat[]
static
Initial value:
= {
{0x00A5, 0x005C, COMPAT_OUT},
{0x203E, 0x007E, COMPAT_OUT},
{0x2014, 0x2015, COMPAT_OUT},
{0x301C, 0xFF5E, COMPAT_OUT},
{0x2016, 0x2225, COMPAT_OUT},
{0x2212, 0xFF0D, COMPAT_OUT},
{0x00A2, 0xFFE0, COMPAT_OUT},
{0x00A3, 0xFFE1, COMPAT_OUT},
{0x00AC, 0xFFE2, COMPAT_OUT},
{0, 0, 0}
}
#define COMPAT_OUT
Definition: win_iconv.c:82

Definition at line 626 of file win_iconv.c.

Referenced by make_csconv().

◆ IsConvertINetStringAvailable

ISCONVERTINETSTRINGAVAILABLE IsConvertINetStringAvailable
static

Definition at line 707 of file win_iconv.c.

Referenced by load_mlang().

◆ iso2022_SI_seq

const char iso2022_SI_seq[] = "\x0F"
static

Definition at line 1670 of file win_iconv.c.

Referenced by iso2022jp_flush(), iso2022jp_mbtowc(), and iso2022jp_wctomb().

◆ iso2022_SO_seq

const char iso2022_SO_seq[] = "\x0E"
static

Definition at line 1672 of file win_iconv.c.

Referenced by iso2022jp_mbtowc(), and iso2022jp_wctomb().

◆ iso2022jp_esc

iso2022_esc_t iso2022jp_esc[]
static
Initial value:
= {
{"\x1B\x28\x42", 3, 1, ISO2022JP_CS_ASCII},
{"\x1B\x28\x4A", 3, 1, ISO2022JP_CS_JISX0201_ROMAN},
{"\x1B\x28\x49", 3, 1, ISO2022JP_CS_JISX0201_KANA},
{"\x1B\x24\x40", 3, 2, ISO2022JP_CS_JISX0208_1983},
{"\x1B\x24\x42", 3, 2, ISO2022JP_CS_JISX0208_1983},
{"\x1B\x24\x28\x44", 4, 2, ISO2022JP_CS_JISX0212},
{NULL, 0, 0, 0}
}
#define ISO2022JP_CS_JISX0212
Definition: win_iconv.c:1687
#define ISO2022JP_CS_JISX0208_1983
Definition: win_iconv.c:1686
smooth NULL
Definition: ftsmooth.c:416
#define ISO2022JP_CS_JISX0201_KANA
Definition: win_iconv.c:1684
#define ISO2022JP_CS_ASCII
Definition: win_iconv.c:1682
#define ISO2022JP_CS_JISX0201_ROMAN
Definition: win_iconv.c:1683

Definition at line 1689 of file win_iconv.c.

Referenced by iso2022jp_flush(), iso2022jp_mbtowc(), and iso2022jp_wctomb().

◆ LcidToRfc1766A

LCIDTORFC1766A LcidToRfc1766A
static

Definition at line 708 of file win_iconv.c.

Referenced by load_mlang(), and test_GetAcceptLanguagesA().

◆ name

Definition at line 157 of file win_iconv.c.

Referenced by make_csconv().

◆ Rfc1766ToLcidA

RFC1766TOLCIDA Rfc1766ToLcidA
static

Definition at line 709 of file win_iconv.c.

Referenced by load_mlang().