Avoid sign extension when casting signed characters to unsigned wide

characters in ntfs_u28(). This fixes the conversion of filenames containing
single-byte characters with the high bit set.
This commit is contained in:
tjr 2003-12-16 01:52:54 +00:00
parent c1cde66b14
commit 7750c90c2f

View File

@ -2157,7 +2157,7 @@ ntfs_u28(
ntfs_iconv->convchr(ntmp->ntm_ic_u2l, (const char **)&p, &ilen,
&outp, &olen);
if (olen == 1) {
return ((wchar)(outbuf[0]));
return ((wchar)(outbuf[0]&0xFF));
} else if (olen == 0) {
return ((wchar)((outbuf[0]<<8) | (outbuf[1]&0xFF)));
}
@ -2167,7 +2167,7 @@ ntfs_u28(
p = ntmp->ntm_u28[(wc>>8)&0xFF];
if (p == NULL)
return ('_');
return (p[wc&0xFF]);
return (p[wc&0xFF]&0xFF);
}
wchar