Changes by: cha0smaster
Update of /cvsroot/linux-ntfs/ntfsprogs/libntfs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4546/libntfs
Modified Files:
unistr.c
Log Message:
Fix unistr.c::ntfs_mbstoucs on systems with utf8 locale.
Index: unistr.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/libntfs/unistr.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -p -r1.20 -r1.21
--- unistr.c 6 Jul 2005 22:47:18 -0000 1.20
+++ unistr.c 28 Jul 2005 21:20:23 -0000 1.21
@@ -467,7 +467,7 @@ int ntfs_mbstoucs(const char *ins, ntfsc
ntfschar *ucs;
const char *s;
wchar_t wc;
- int i, o, cnt, ins_len, ucs_len;
+ int i, o, cnt, ins_len, ucs_len, ins_size;
#ifdef HAVE_MBSINIT
mbstate_t mbstate;
#endif
@@ -482,6 +482,8 @@ int ntfs_mbstoucs(const char *ins, ntfsc
errno = ENAMETOOLONG;
return -1;
}
+ /* Determine the size of the multi-byte string in bytes. */
+ ins_size = strlen(ins);
/* Determine the length of the multi-byte string. */
s = ins;
#if defined(HAVE_MBSINIT)
@@ -543,9 +545,9 @@ int ntfs_mbstoucs(const char *ins, ntfsc
}
/* Convert the multibyte character to a wide character. */
#ifdef HAVE_MBSINIT
- cnt = mbrtowc(&wc, ins + i, ins_len - i, &mbstate);
+ cnt = mbrtowc(&wc, ins + i, ins_size - i, &mbstate);
#else
- cnt = mbtowc(&wc, ins + i, ins_len - i);
+ cnt = mbtowc(&wc, ins + i, ins_size - i);
#endif
if (!cnt)
break;
|