2009-12-17 Jerker Back <jerker.back@gmail.com>
* libc/iconv/lib/local.h[!__GNUC__]: Add alternative version of ICONV_ZERO_MB_STATE_T macro. * libc/iconv/lib/ucsconv.c (ucs_based_conversion_get_state): Use temporary local variable nullstate to hold empty mbstate_t.
This commit is contained in:
parent
8b917fbcdd
commit
bbe9636fd8
|
@ -1,3 +1,10 @@
|
||||||
|
2009-12-17 Jerker Back <jerker.back@gmail.com>
|
||||||
|
|
||||||
|
* libc/iconv/lib/local.h[!__GNUC__]: Add alternative version of
|
||||||
|
ICONV_ZERO_MB_STATE_T macro.
|
||||||
|
* libc/iconv/lib/ucsconv.c (ucs_based_conversion_get_state): Use
|
||||||
|
temporary local variable nullstate to hold empty mbstate_t.
|
||||||
|
|
||||||
2009-12-17 Jerker Back <jerker.back@gmail.com>
|
2009-12-17 Jerker Back <jerker.back@gmail.com>
|
||||||
|
|
||||||
* libc/include/_ansi.h: Add new _EXFNPTR macro for using with
|
* libc/include/_ansi.h: Add new _EXFNPTR macro for using with
|
||||||
|
|
|
@ -41,7 +41,11 @@
|
||||||
#define ICONV_DATA_EXT ".cct"
|
#define ICONV_DATA_EXT ".cct"
|
||||||
|
|
||||||
/* This macro is used to zero mbstate_t objects */
|
/* This macro is used to zero mbstate_t objects */
|
||||||
|
#ifdef __GNUC__
|
||||||
#define ICONV_ZERO_MB_STATE_T ((mbstate_t){0, {0}})
|
#define ICONV_ZERO_MB_STATE_T ((mbstate_t){0, {0}})
|
||||||
|
#else
|
||||||
|
#define ICONV_ZERO_MB_STATE_T {0}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define the maximum multi-byte character length produced by iconv library */
|
/* Define the maximum multi-byte character length produced by iconv library */
|
||||||
#if MB_LEN_MAX < 6
|
#if MB_LEN_MAX < 6
|
||||||
|
|
|
@ -258,20 +258,21 @@ _DEFUN(ucs_based_conversion_get_state, (data, state, direction),
|
||||||
int direction)
|
int direction)
|
||||||
{
|
{
|
||||||
iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data;
|
iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data;
|
||||||
|
mbstate_t nullstate = ICONV_ZERO_MB_STATE_T;
|
||||||
|
|
||||||
if (direction == 0)
|
if (direction == 0)
|
||||||
{
|
{
|
||||||
if (uc->to_ucs.handlers->get_state != NULL)
|
if (uc->to_ucs.handlers->get_state != NULL)
|
||||||
uc->to_ucs.handlers->get_state (uc->to_ucs.data, state);
|
uc->to_ucs.handlers->get_state (uc->to_ucs.data, state);
|
||||||
else
|
else
|
||||||
*state = ICONV_ZERO_MB_STATE_T;
|
*state = nullstate; /* internal copy */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (uc->from_ucs.handlers->get_state != NULL)
|
if (uc->from_ucs.handlers->get_state != NULL)
|
||||||
uc->from_ucs.handlers->get_state (uc->from_ucs.data, state);
|
uc->from_ucs.handlers->get_state (uc->from_ucs.data, state);
|
||||||
else
|
else
|
||||||
*state = ICONV_ZERO_MB_STATE_T;
|
*state = nullstate; /* internal copy */
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue