citrus_mskanji's cstowc() cannot convert csid=0x2 / index=0x987e (wchar_t=0xfcfc).
Issue #56
closed
CP932 User Defined Area and Unicode mapping is 0xF040 - 0xF9FC = 0xE000 - 0xE757. and no charactere assigned but 0xFAFC - 0xFCFC is still available.
but our cstowc() wrongly limiting these area, so following code doesn't work.
#include <assert.h>
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include "citrus_namespace.h"
#include "citrus_types.h"
#include "citrus_module.h"
#include "citrus_ctype.h"
#include "citrus_ctype_local.h"
#include "citrus_stdenc.h"
#include "citrus_stdenc_local.h"
#include "citrus_mskanji.h"
int
main(void)
{
struct _citrus_stdenc *ce;
char st[sizeof(mbstate_t)];
size_t ret, n;
char mb[MB_LEN_MAX];
ce = malloc(sizeof(*ce));
assert(ce != NULL);
ce->ce_ops = malloc(sizeof(*ce->ce_ops));
assert(ce->ce_ops != NULL);
ce->ce_traits = malloc(sizeof(*ce->ce_traits));
assert(ce->ce_traits != NULL);
ret = (*_citrus_MSKanji_stdenc_getops)(ce->ce_ops,
sizeof(*ce->ce_ops), _CITRUS_STDENC_ABI_VERSION);
assert(ret == 0);
(*ce->ce_ops->eo_init_state)(ce, &st);
ret = (*ce->ce_ops->eo_cstomb)(ce,
&mb[0], sizeof(mb), 2, 0x987e, (void *)&st, &n);
assert(ret == 0);
assert(n == 2);
assert((unsigned char)mb[0] == 0xfc);
assert((unsigned char)mb[1] == 0xfc);
}
Comments (3)
-
reporter -
reporter - changed status to resolved
BUGFIX: Issue
#56-- citrus_mskanji's cstowc() cannot convert csid=0x2 / index=0x987e (wchar_t=0xfcfc).→ <<cset 36c5967b9e5e>>
-
reporter - changed status to closed
- Log in to comment