|
Lines 467-473
int ntfs_mbstoucs(const char *ins, ntfsc
|
Link Here
|
|---|
|
ntfschar *ucs; | ntfschar *ucs; |
const char *s; | const char *s; |
wchar_t wc; | wchar_t wc; |
int i, o, cnt, ins_len, ucs_len; |
int i, o, cnt, ins_len, ucs_len, ins_size; |
#ifdef HAVE_MBSINIT | #ifdef HAVE_MBSINIT |
mbstate_t mbstate; | mbstate_t mbstate; |
#endif | #endif |
|
Lines 482-487
int ntfs_mbstoucs(const char *ins, ntfsc
|
Link Here
|
|---|
|
errno = ENAMETOOLONG; | errno = ENAMETOOLONG; |
return -1; | return -1; |
} | } |
|
/* Determine the size of the multi-byte string in bytes. */ |
|
ins_size = strlen(ins); |
/* Determine the length of the multi-byte string. */ | /* Determine the length of the multi-byte string. */ |
s = ins; | s = ins; |
#if defined(HAVE_MBSINIT) | #if defined(HAVE_MBSINIT) |
|
Lines 543-551
int ntfs_mbstoucs(const char *ins, ntfsc
|
Link Here
|
|---|
|
} | } |
/* Convert the multibyte character to a wide character. */ | /* Convert the multibyte character to a wide character. */ |
#ifdef HAVE_MBSINIT | #ifdef HAVE_MBSINIT |
cnt = mbrtowc(&wc, ins + i, ins_len - i, &mbstate); |
cnt = mbrtowc(&wc, ins + i, ins_size - i, &mbstate); |
#else | #else |
cnt = mbtowc(&wc, ins + i, ins_len - i); |
cnt = mbtowc(&wc, ins + i, ins_size - i); |
#endif | #endif |
if (!cnt) | if (!cnt) |
break; | break; |