ReactOS  0.4.13-dev-99-g7e18b6d
wctomb.c File Reference
#include <string.h>
#include "wine/unicode.h"
Include dependency graph for wctomb.c:

Go to the source code of this file.

Functions

WCHAR wine_compose (const WCHAR *str) DECLSPEC_HIDDEN
 
static int is_valid_sbcs_mapping (const struct sbcs_table *table, int flags, WCHAR wch, unsigned char ch)
 
static int get_length_sbcs (const struct sbcs_table *table, int flags, const WCHAR *src, unsigned int srclen, int *used)
 
static int wcstombs_sbcs (const struct sbcs_table *table, const WCHAR *src, unsigned int srclen, char *dst, unsigned int dstlen)
 
static int wcstombs_sbcs_slow (const struct sbcs_table *table, int flags, const WCHAR *src, unsigned int srclen, char *dst, unsigned int dstlen, const char *defchar, int *used)
 
static int is_valid_dbcs_mapping (const struct dbcs_table *table, int flags, WCHAR wch, unsigned short ch)
 
static WCHAR get_defchar_dbcs (const struct dbcs_table *table, const char *defchar)
 
static int get_length_dbcs (const struct dbcs_table *table, int flags, const WCHAR *src, unsigned int srclen, const char *defchar, int *used)
 
static int wcstombs_dbcs (const struct dbcs_table *table, const WCHAR *src, unsigned int srclen, char *dst, unsigned int dstlen)
 
static int wcstombs_dbcs_slow (const struct dbcs_table *table, int flags, const WCHAR *src, unsigned int srclen, char *dst, unsigned int dstlen, const char *defchar, int *used)
 
int wine_cp_wcstombs (const union cptable *table, int flags, const WCHAR *src, int srclen, char *dst, int dstlen, const char *defchar, int *used)
 

Function Documentation

◆ get_defchar_dbcs()

static WCHAR get_defchar_dbcs ( const struct dbcs_table table,
const char defchar 
)
inlinestatic

Definition at line 241 of file wctomb.c.

242 {
243  if (!defchar) return table->info.def_char;
244  if (!defchar[1]) return (unsigned char)defchar[0];
245  return ((unsigned char)defchar[0] << 8) | (unsigned char)defchar[1];
246 }
unsigned char
Definition: typeof.h:29

Referenced by get_length_dbcs(), and wcstombs_dbcs_slow().

◆ get_length_dbcs()

static int get_length_dbcs ( const struct dbcs_table table,
int  flags,
const WCHAR src,
unsigned int  srclen,
const char defchar,
int used 
)
static

Definition at line 249 of file wctomb.c.

252 {
253  const unsigned short * const uni2cp_low = table->uni2cp_low;
254  const unsigned short * const uni2cp_high = table->uni2cp_high;
255  WCHAR defchar_value, composed;
256  int len, tmp;
257 
258  if (!defchar && !used && !(flags & WC_COMPOSITECHECK))
259  {
260  for (len = 0; srclen; srclen--, src++, len++)
261  {
262  if (uni2cp_low[uni2cp_high[*src >> 8] + (*src & 0xff)] & 0xff00) len++;
263  }
264  return len;
265  }
266 
267  defchar_value = get_defchar_dbcs( table, defchar );
268  if (!used) used = &tmp; /* avoid checking on every char */
269  *used = 0;
270  for (len = 0; srclen; len++, srclen--, src++)
271  {
272  unsigned short res;
273  WCHAR wch = *src;
274 
275  if ((flags & WC_COMPOSITECHECK) && (srclen > 1) && (composed = wine_compose(src)))
276  {
277  /* now check if we can use the composed char */
278  res = uni2cp_low[uni2cp_high[composed >> 8] + (composed & 0xff)];
279 
280  if (is_valid_dbcs_mapping( table, flags, composed, res ))
281  {
282  /* we have a good mapping for the composed char, use it */
283  if (res & 0xff00) len++;
284  src++;
285  srclen--;
286  continue;
287  }
288  /* no mapping for the composed char, check the other flags */
289  if (flags & WC_DEFAULTCHAR) /* use the default char instead */
290  {
291  if (defchar_value & 0xff00) len++;
292  *used = 1;
293  src++; /* skip the non-spacing char */
294  srclen--;
295  continue;
296  }
297  if (flags & WC_DISCARDNS) /* skip the second char of the composition */
298  {
299  src++;
300  srclen--;
301  }
302  /* WC_SEPCHARS is the default */
303  }
304 
305  res = uni2cp_low[uni2cp_high[wch >> 8] + (wch & 0xff)];
306  if (!is_valid_dbcs_mapping( table, flags, wch, res ))
307  {
308  res = defchar_value;
309  *used = 1;
310  }
311  if (res & 0xff00) len++;
312  }
313  return len;
314 }
static const unsigned char uni2cp_low[4884]
Definition: c_037.c:43
WCHAR wine_compose(const WCHAR *str) DECLSPEC_HIDDEN
Definition: compose.c:395
#define WC_DEFAULTCHAR
Definition: unicode.h:45
#define WC_DISCARDNS
Definition: unicode.h:44
static const unsigned short uni2cp_high[256]
Definition: c_037.c:649
c used
Definition: write.c:2885
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
static int is_valid_dbcs_mapping(const struct dbcs_table *table, int flags, WCHAR wch, unsigned short ch)
Definition: wctomb.c:224
#define WC_COMPOSITECHECK
Definition: unicode.h:43
GLuint res
Definition: glext.h:9613
static WCHAR get_defchar_dbcs(const struct dbcs_table *table, const char *defchar)
Definition: wctomb.c:241

Referenced by wine_cp_wcstombs().

◆ get_length_sbcs()

static int get_length_sbcs ( const struct sbcs_table table,
int  flags,
const WCHAR src,
unsigned int  srclen,
int used 
)
static

Definition at line 40 of file wctomb.c.

42 {
43  const unsigned char * const uni2cp_low = table->uni2cp_low;
44  const unsigned short * const uni2cp_high = table->uni2cp_high;
45  int ret, tmp;
46  WCHAR composed;
47 
48  if (!used) used = &tmp; /* avoid checking on every char */
49  *used = 0;
50 
51  for (ret = 0; srclen; ret++, src++, srclen--)
52  {
53  WCHAR wch = *src;
54  unsigned char ch;
55 
56  if ((flags & WC_COMPOSITECHECK) && (srclen > 1) && (composed = wine_compose(src)))
57  {
58  /* now check if we can use the composed char */
59  ch = uni2cp_low[uni2cp_high[composed >> 8] + (composed & 0xff)];
60  if (is_valid_sbcs_mapping( table, flags, composed, ch ))
61  {
62  /* we have a good mapping, use it */
63  src++;
64  srclen--;
65  continue;
66  }
67  /* no mapping for the composed char, check the other flags */
68  if (flags & WC_DEFAULTCHAR) /* use the default char instead */
69  {
70  *used = 1;
71  src++; /* skip the non-spacing char */
72  srclen--;
73  continue;
74  }
75  if (flags & WC_DISCARDNS) /* skip the second char of the composition */
76  {
77  src++;
78  srclen--;
79  }
80  /* WC_SEPCHARS is the default */
81  }
82  if (!*used)
83  {
84  ch = uni2cp_low[uni2cp_high[wch >> 8] + (wch & 0xff)];
85  *used = !is_valid_sbcs_mapping( table, flags, wch, ch );
86  }
87  }
88  return ret;
89 }
static const unsigned char uni2cp_low[4884]
Definition: c_037.c:43
WCHAR wine_compose(const WCHAR *str) DECLSPEC_HIDDEN
Definition: compose.c:395
#define WC_DEFAULTCHAR
Definition: unicode.h:45
#define WC_DISCARDNS
Definition: unicode.h:44
static const unsigned short uni2cp_high[256]
Definition: c_037.c:649
c used
Definition: write.c:2885
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
GLbitfield flags
Definition: glext.h:7161
int ret
GLenum src
Definition: glext.h:6340
#define WC_COMPOSITECHECK
Definition: unicode.h:43
static int is_valid_sbcs_mapping(const struct sbcs_table *table, int flags, WCHAR wch, unsigned char ch)
Definition: wctomb.c:31

Referenced by wine_cp_wcstombs().

◆ is_valid_dbcs_mapping()

static int is_valid_dbcs_mapping ( const struct dbcs_table table,
int  flags,
WCHAR  wch,
unsigned short  ch 
)
inlinestatic

Definition at line 224 of file wctomb.c.

226 {
227  if ((flags & WC_NO_BEST_FIT_CHARS) || ch == table->info.def_char)
228  {
229  /* check if char maps back to the same Unicode value */
230  if (ch & 0xff00)
231  {
232  unsigned char off = table->cp2uni_leadbytes[ch >> 8];
233  return (table->cp2uni[(off << 8) + (ch & 0xff)] == wch);
234  }
235  return (table->cp2uni[ch & 0xff] == wch);
236  }
237  return 1;
238 }
GLbitfield flags
Definition: glext.h:7161
#define WC_NO_BEST_FIT_CHARS
Definition: unicode.h:46
off
Definition: i386-dis.c:3909

Referenced by get_length_dbcs(), and wcstombs_dbcs_slow().

◆ is_valid_sbcs_mapping()

static int is_valid_sbcs_mapping ( const struct sbcs_table table,
int  flags,
WCHAR  wch,
unsigned char  ch 
)
inlinestatic

Definition at line 31 of file wctomb.c.

33 {
34  if ((flags & WC_NO_BEST_FIT_CHARS) || ch == (unsigned char)table->info.def_char)
35  return (table->cp2uni[ch] == wch);
36  return 1;
37 }
GLbitfield flags
Definition: glext.h:7161
#define WC_NO_BEST_FIT_CHARS
Definition: unicode.h:46

Referenced by get_length_sbcs(), and wcstombs_sbcs_slow().

◆ wcstombs_dbcs()

static int wcstombs_dbcs ( const struct dbcs_table table,
const WCHAR src,
unsigned int  srclen,
char dst,
unsigned int  dstlen 
)
inlinestatic

Definition at line 317 of file wctomb.c.

320 {
321  const unsigned short * const uni2cp_low = table->uni2cp_low;
322  const unsigned short * const uni2cp_high = table->uni2cp_high;
323  int len;
324 
325  for (len = dstlen; srclen && len; len--, srclen--, src++)
326  {
327  unsigned short res = uni2cp_low[uni2cp_high[*src >> 8] + (*src & 0xff)];
328  if (res & 0xff00)
329  {
330  if (len == 1) break; /* do not output a partial char */
331  len--;
332  *dst++ = res >> 8;
333  }
334  *dst++ = (char)res;
335  }
336  if (srclen) return -1; /* overflow */
337  return dstlen - len;
338 }
static const unsigned char uni2cp_low[4884]
Definition: c_037.c:43
unsigned char
Definition: typeof.h:29
static const unsigned short uni2cp_high[256]
Definition: c_037.c:649
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
static DWORD dstlen
Definition: directory.c:51
GLenum GLenum dst
Definition: glext.h:6340
GLuint res
Definition: glext.h:9613

Referenced by wine_cp_wcstombs().

◆ wcstombs_dbcs_slow()

static int wcstombs_dbcs_slow ( const struct dbcs_table table,
int  flags,
const WCHAR src,
unsigned int  srclen,
char dst,
unsigned int  dstlen,
const char defchar,
int used 
)
static

Definition at line 341 of file wctomb.c.

345 {
346  const unsigned short * const uni2cp_low = table->uni2cp_low;
347  const unsigned short * const uni2cp_high = table->uni2cp_high;
348  WCHAR defchar_value = get_defchar_dbcs( table, defchar );
349  WCHAR composed;
350  int len, tmp;
351 
352  if (!used) used = &tmp; /* avoid checking on every char */
353  *used = 0;
354 
355  for (len = dstlen; srclen && len; len--, srclen--, src++)
356  {
357  unsigned short res;
358  WCHAR wch = *src;
359 
360  if ((flags & WC_COMPOSITECHECK) && (srclen > 1) && (composed = wine_compose(src)))
361  {
362  /* now check if we can use the composed char */
363  res = uni2cp_low[uni2cp_high[composed >> 8] + (composed & 0xff)];
364 
365  if (is_valid_dbcs_mapping( table, flags, composed, res ))
366  {
367  /* we have a good mapping for the composed char, use it */
368  src++;
369  srclen--;
370  goto output_char;
371  }
372  /* no mapping for the composed char, check the other flags */
373  if (flags & WC_DEFAULTCHAR) /* use the default char instead */
374  {
375  res = defchar_value;
376  *used = 1;
377  src++; /* skip the non-spacing char */
378  srclen--;
379  goto output_char;
380  }
381  if (flags & WC_DISCARDNS) /* skip the second char of the composition */
382  {
383  src++;
384  srclen--;
385  }
386  /* WC_SEPCHARS is the default */
387  }
388 
389  res = uni2cp_low[uni2cp_high[wch >> 8] + (wch & 0xff)];
390  if (!is_valid_dbcs_mapping( table, flags, wch, res ))
391  {
392  res = defchar_value;
393  *used = 1;
394  }
395 
396  output_char:
397  if (res & 0xff00)
398  {
399  if (len == 1) break; /* do not output a partial char */
400  len--;
401  *dst++ = res >> 8;
402  }
403  *dst++ = (char)res;
404  }
405  if (srclen) return -1; /* overflow */
406  return dstlen - len;
407 }
static const unsigned char uni2cp_low[4884]
Definition: c_037.c:43
WCHAR wine_compose(const WCHAR *str) DECLSPEC_HIDDEN
Definition: compose.c:395
#define WC_DEFAULTCHAR
Definition: unicode.h:45
#define WC_DISCARDNS
Definition: unicode.h:44
unsigned char
Definition: typeof.h:29
static const unsigned short uni2cp_high[256]
Definition: c_037.c:649
c used
Definition: write.c:2885
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
static int is_valid_dbcs_mapping(const struct dbcs_table *table, int flags, WCHAR wch, unsigned short ch)
Definition: wctomb.c:224
static DWORD dstlen
Definition: directory.c:51
#define WC_COMPOSITECHECK
Definition: unicode.h:43
GLenum GLenum dst
Definition: glext.h:6340
GLuint res
Definition: glext.h:9613
static WCHAR get_defchar_dbcs(const struct dbcs_table *table, const char *defchar)
Definition: wctomb.c:241

Referenced by wine_cp_wcstombs().

◆ wcstombs_sbcs()

static int wcstombs_sbcs ( const struct sbcs_table table,
const WCHAR src,
unsigned int  srclen,
char dst,
unsigned int  dstlen 
)
inlinestatic

Definition at line 92 of file wctomb.c.

95 {
96  const unsigned char * const uni2cp_low = table->uni2cp_low;
97  const unsigned short * const uni2cp_high = table->uni2cp_high;
98  int ret = srclen;
99 
100  if (dstlen < srclen)
101  {
102  /* buffer too small: fill it up to dstlen and return error */
103  srclen = dstlen;
104  ret = -1;
105  }
106 
107  while (srclen >= 16)
108  {
109  dst[0] = uni2cp_low[uni2cp_high[src[0] >> 8] + (src[0] & 0xff)];
110  dst[1] = uni2cp_low[uni2cp_high[src[1] >> 8] + (src[1] & 0xff)];
111  dst[2] = uni2cp_low[uni2cp_high[src[2] >> 8] + (src[2] & 0xff)];
112  dst[3] = uni2cp_low[uni2cp_high[src[3] >> 8] + (src[3] & 0xff)];
113  dst[4] = uni2cp_low[uni2cp_high[src[4] >> 8] + (src[4] & 0xff)];
114  dst[5] = uni2cp_low[uni2cp_high[src[5] >> 8] + (src[5] & 0xff)];
115  dst[6] = uni2cp_low[uni2cp_high[src[6] >> 8] + (src[6] & 0xff)];
116  dst[7] = uni2cp_low[uni2cp_high[src[7] >> 8] + (src[7] & 0xff)];
117  dst[8] = uni2cp_low[uni2cp_high[src[8] >> 8] + (src[8] & 0xff)];
118  dst[9] = uni2cp_low[uni2cp_high[src[9] >> 8] + (src[9] & 0xff)];
119  dst[10] = uni2cp_low[uni2cp_high[src[10] >> 8] + (src[10] & 0xff)];
120  dst[11] = uni2cp_low[uni2cp_high[src[11] >> 8] + (src[11] & 0xff)];
121  dst[12] = uni2cp_low[uni2cp_high[src[12] >> 8] + (src[12] & 0xff)];
122  dst[13] = uni2cp_low[uni2cp_high[src[13] >> 8] + (src[13] & 0xff)];
123  dst[14] = uni2cp_low[uni2cp_high[src[14] >> 8] + (src[14] & 0xff)];
124  dst[15] = uni2cp_low[uni2cp_high[src[15] >> 8] + (src[15] & 0xff)];
125  src += 16;
126  dst += 16;
127  srclen -= 16;
128  }
129 
130  /* now handle remaining characters */
131  src += srclen;
132  dst += srclen;
133  switch(srclen)
134  {
135  case 15: dst[-15] = uni2cp_low[uni2cp_high[src[-15] >> 8] + (src[-15] & 0xff)];
136  case 14: dst[-14] = uni2cp_low[uni2cp_high[src[-14] >> 8] + (src[-14] & 0xff)];
137  case 13: dst[-13] = uni2cp_low[uni2cp_high[src[-13] >> 8] + (src[-13] & 0xff)];
138  case 12: dst[-12] = uni2cp_low[uni2cp_high[src[-12] >> 8] + (src[-12] & 0xff)];
139  case 11: dst[-11] = uni2cp_low[uni2cp_high[src[-11] >> 8] + (src[-11] & 0xff)];
140  case 10: dst[-10] = uni2cp_low[uni2cp_high[src[-10] >> 8] + (src[-10] & 0xff)];
141  case 9: dst[-9] = uni2cp_low[uni2cp_high[src[-9] >> 8] + (src[-9] & 0xff)];
142  case 8: dst[-8] = uni2cp_low[uni2cp_high[src[-8] >> 8] + (src[-8] & 0xff)];
143  case 7: dst[-7] = uni2cp_low[uni2cp_high[src[-7] >> 8] + (src[-7] & 0xff)];
144  case 6: dst[-6] = uni2cp_low[uni2cp_high[src[-6] >> 8] + (src[-6] & 0xff)];
145  case 5: dst[-5] = uni2cp_low[uni2cp_high[src[-5] >> 8] + (src[-5] & 0xff)];
146  case 4: dst[-4] = uni2cp_low[uni2cp_high[src[-4] >> 8] + (src[-4] & 0xff)];
147  case 3: dst[-3] = uni2cp_low[uni2cp_high[src[-3] >> 8] + (src[-3] & 0xff)];
148  case 2: dst[-2] = uni2cp_low[uni2cp_high[src[-2] >> 8] + (src[-2] & 0xff)];
149  case 1: dst[-1] = uni2cp_low[uni2cp_high[src[-1] >> 8] + (src[-1] & 0xff)];
150  case 0: break;
151  }
152  return ret;
153 }
static const unsigned char uni2cp_low[4884]
Definition: c_037.c:43
static const unsigned short uni2cp_high[256]
Definition: c_037.c:649
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
int ret
GLenum src
Definition: glext.h:6340
static DWORD dstlen
Definition: directory.c:51
GLenum GLenum dst
Definition: glext.h:6340

Referenced by wine_cp_wcstombs().

◆ wcstombs_sbcs_slow()

static int wcstombs_sbcs_slow ( const struct sbcs_table table,
int  flags,
const WCHAR src,
unsigned int  srclen,
char dst,
unsigned int  dstlen,
const char defchar,
int used 
)
static

Definition at line 156 of file wctomb.c.

160 {
161  const unsigned char * const uni2cp_low = table->uni2cp_low;
162  const unsigned short * const uni2cp_high = table->uni2cp_high;
163  unsigned char def;
164  unsigned int len;
165  int tmp;
166  WCHAR composed;
167 
168  if (!defchar)
169  def = table->info.def_char & 0xff;
170  else
171  def = *defchar;
172 
173  if (!used) used = &tmp; /* avoid checking on every char */
174  *used = 0;
175 
176  for (len = dstlen; srclen && len; dst++, len--, src++, srclen--)
177  {
178  WCHAR wch = *src;
179 
180  if ((flags & WC_COMPOSITECHECK) && (srclen > 1) && (composed = wine_compose(src)))
181  {
182  /* now check if we can use the composed char */
183  *dst = uni2cp_low[uni2cp_high[composed >> 8] + (composed & 0xff)];
184  if (is_valid_sbcs_mapping( table, flags, composed, *dst ))
185  {
186  /* we have a good mapping, use it */
187  src++;
188  srclen--;
189  continue;
190  }
191  /* no mapping for the composed char, check the other flags */
192  if (flags & WC_DEFAULTCHAR) /* use the default char instead */
193  {
194  *dst = def;
195  *used = 1;
196  src++; /* skip the non-spacing char */
197  srclen--;
198  continue;
199  }
200  if (flags & WC_DISCARDNS) /* skip the second char of the composition */
201  {
202  src++;
203  srclen--;
204  }
205  /* WC_SEPCHARS is the default */
206  }
207 
208  *dst = uni2cp_low[uni2cp_high[wch >> 8] + (wch & 0xff)];
209  if (!is_valid_sbcs_mapping( table, flags, wch, *dst ))
210  {
211  *dst = def;
212  *used = 1;
213  }
214  }
215  if (srclen) return -1; /* overflow */
216  return dstlen - len;
217 }
static const unsigned char uni2cp_low[4884]
Definition: c_037.c:43
WCHAR wine_compose(const WCHAR *str) DECLSPEC_HIDDEN
Definition: compose.c:395
#define WC_DEFAULTCHAR
Definition: unicode.h:45
#define WC_DISCARDNS
Definition: unicode.h:44
static const unsigned short uni2cp_high[256]
Definition: c_037.c:649
c used
Definition: write.c:2885
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
static DWORD dstlen
Definition: directory.c:51
#define WC_COMPOSITECHECK
Definition: unicode.h:43
GLenum GLenum dst
Definition: glext.h:6340
static int is_valid_sbcs_mapping(const struct sbcs_table *table, int flags, WCHAR wch, unsigned char ch)
Definition: wctomb.c:31

Referenced by wine_cp_wcstombs().

◆ wine_compose()

WCHAR wine_compose ( const WCHAR str)

Definition at line 395 of file compose.c.

396 {
397  int pos, idx = 1, start = 0, count = 70;
398  for (;;)
399  {
400  if ((pos = binary_search( str[idx], start, count - 1 )) == -1) return 0;
401  if (!idx--) return table[2 * pos + 1];
402  start = table[2 * pos + 1];
403  count = table[2 * pos + 3];
404  }
405 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
static int binary_search(WCHAR ch, int low, int high)
Definition: compose.c:383
unsigned int idx
Definition: utils.c:41
const WCHAR * str
GLuint start
Definition: gl.h:1545

Referenced by get_length_dbcs(), get_length_sbcs(), wcstombs_dbcs_slow(), and wcstombs_sbcs_slow().

◆ wine_cp_wcstombs()

int wine_cp_wcstombs ( const union cptable table,
int  flags,
const WCHAR src,
int  srclen,
char dst,
int  dstlen,
const char defchar,
int used 
)

Definition at line 411 of file wctomb.c.

414 {
415  if (table->info.char_size == 1)
416  {
417  if (flags || defchar || used)
418  {
419  if (!dstlen) return get_length_sbcs( &table->sbcs, flags, src, srclen, used );
420  return wcstombs_sbcs_slow( &table->sbcs, flags, src, srclen,
421  dst, dstlen, defchar, used );
422  }
423  if (!dstlen) return srclen;
424  return wcstombs_sbcs( &table->sbcs, src, srclen, dst, dstlen );
425  }
426  else /* mbcs */
427  {
428  if (!dstlen) return get_length_dbcs( &table->dbcs, flags, src, srclen, defchar, used );
429  if (flags || defchar || used)
430  return wcstombs_dbcs_slow( &table->dbcs, flags, src, srclen,
431  dst, dstlen, defchar, used );
432  return wcstombs_dbcs( &table->dbcs, src, srclen, dst, dstlen );
433  }
434 }
static int wcstombs_sbcs(const struct sbcs_table *table, const WCHAR *src, unsigned int srclen, char *dst, unsigned int dstlen)
Definition: wctomb.c:92
static int get_length_dbcs(const struct dbcs_table *table, int flags, const WCHAR *src, unsigned int srclen, const char *defchar, int *used)
Definition: wctomb.c:249
c used
Definition: write.c:2885
static int wcstombs_dbcs_slow(const struct dbcs_table *table, int flags, const WCHAR *src, unsigned int srclen, char *dst, unsigned int dstlen, const char *defchar, int *used)
Definition: wctomb.c:341
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
static int get_length_sbcs(const struct sbcs_table *table, int flags, const WCHAR *src, unsigned int srclen, int *used)
Definition: wctomb.c:40
GLbitfield flags
Definition: glext.h:7161
static int wcstombs_sbcs_slow(const struct sbcs_table *table, int flags, const WCHAR *src, unsigned int srclen, char *dst, unsigned int dstlen, const char *defchar, int *used)
Definition: wctomb.c:156
GLenum src
Definition: glext.h:6340
static DWORD dstlen
Definition: directory.c:51
GLenum GLenum dst
Definition: glext.h:6340
static int wcstombs_dbcs(const struct dbcs_table *table, const WCHAR *src, unsigned int srclen, char *dst, unsigned int dstlen)
Definition: wctomb.c:317