* path.h (get_nt_native_path): Add third parameter to declaration and
declare with regparms. * path.cc (get_nt_native_path): Add third parameter to allow conversion of leading and trailing dots and spaces on filesystems only supporting filenames following DOS rules. (path_conv::get_nt_native_path): Call get_nt_native_path according to fs.has_dos_filenames_only flag. (getfileattr): Accommodate new parameter to get_nt_native_path. (symlink_info::check): Revamp fs_update_called handling to call fs.update only once per call. Call get_nt_native_path according to fs.has_dos_filenames_only flag. Streamline filesystem dependent code not to be called more than once unnecessarily. Drop code tweaking incoming path for broken filesystems only allowing DOS pathnames. Rely on changed get_nt_native_path instead. * mount.cc (fillout_mntent): Accommodate new parameter to get_nt_native_path. * strfuncs.cc (tfx_rev_chars): New conversion table with comment. (sys_cp_wcstombs): Use tfx_rev_chars rather than tfx_chars.
This commit is contained in:
@ -23,8 +23,7 @@ details. */
|
||||
use area in the U+f0XX range. The affected characters are all control
|
||||
chars 1 <= c <= 31, as well as the characters " * : < > ? |. The backslash
|
||||
is affected as well, but we can't transform it as long as we accept Win32
|
||||
paths as input.
|
||||
The reverse functionality is in function sys_cp_wcstombs. */
|
||||
paths as input. */
|
||||
static const WCHAR tfx_chars[] = {
|
||||
0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3,
|
||||
0xf000 | 4, 0xf000 | 5, 0xf000 | 6, 0xf000 | 7,
|
||||
@ -60,6 +59,45 @@ static const WCHAR tfx_chars[] = {
|
||||
0xf000 | '|', '}', '~', 127
|
||||
};
|
||||
|
||||
/* This is the table for the reverse functionality in sys_cp_wcstombs.
|
||||
It differs deliberately in two code places (space and dot) to allow
|
||||
converting back space and dot on filesystems only supporting DOS
|
||||
filenames. */
|
||||
static const WCHAR tfx_rev_chars[] = {
|
||||
0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3,
|
||||
0xf000 | 4, 0xf000 | 5, 0xf000 | 6, 0xf000 | 7,
|
||||
0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11,
|
||||
0xf000 | 12, 0xf000 | 13, 0xf000 | 14, 0xf000 | 15,
|
||||
0xf000 | 16, 0xf000 | 17, 0xf000 | 18, 0xf000 | 19,
|
||||
0xf000 | 20, 0xf000 | 21, 0xf000 | 22, 0xf000 | 23,
|
||||
0xf000 | 24, 0xf000 | 25, 0xf000 | 26, 0xf000 | 27,
|
||||
0xf000 | 28, 0xf000 | 29, 0xf000 | 30, 0xf000 | 31,
|
||||
0xf000 | ' ', '!', 0xf000 | '"', '#',
|
||||
'$', '%', '&', 39,
|
||||
'(', ')', 0xf000 | '*', '+',
|
||||
',', '-', 0xf000 | '.', '\\',
|
||||
'0', '1', '2', '3',
|
||||
'4', '5', '6', '7',
|
||||
'8', '9', 0xf000 | ':', ';',
|
||||
0xf000 | '<', '=', 0xf000 | '>', 0xf000 | '?',
|
||||
'@', 'A', 'B', 'C',
|
||||
'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K',
|
||||
'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S',
|
||||
'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', '[',
|
||||
'\\', ']', '^', '_',
|
||||
'`', 'a', 'b', 'c',
|
||||
'd', 'e', 'f', 'g',
|
||||
'h', 'i', 'j', 'k',
|
||||
'l', 'm', 'n', 'o',
|
||||
'p', 'q', 'r', 's',
|
||||
't', 'u', 'v', 'w',
|
||||
'x', 'y', 'z', '{',
|
||||
0xf000 | '|', '}', '~', 127
|
||||
};
|
||||
|
||||
void
|
||||
transform_chars (PWCHAR path, PWCHAR path_end)
|
||||
{
|
||||
@ -382,7 +420,7 @@ sys_cp_wcstombs (wctomb_p f_wctomb, const char *charset, char *dst, size_t len,
|
||||
Reverse functionality for invalid bytes in a multibyte sequence is
|
||||
in sys_cp_mbstowcs below. */
|
||||
if ((pw & 0xff00) == 0xf000
|
||||
&& (((cwc = (pw & 0xff)) <= 0x7f && tfx_chars[cwc] >= 0xf000)
|
||||
&& (((cwc = (pw & 0xff)) <= 0x7f && tfx_rev_chars[cwc] >= 0xf000)
|
||||
|| (cwc >= 0x80 && MB_CUR_MAX > 1)))
|
||||
{
|
||||
buf[0] = (char) cwc;
|
||||
|
Reference in New Issue
Block a user