diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 01e2a7625..3bf9f45d5 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2009-10-09 Corinna Vinschen + + * path.cc (tfx_chars): Convert all ASCII control characters except + ASCII NUL as well. Change layout to make the conversions more clear. + Add comment. + 2009-10-09 Corinna Vinschen * include/cygwin/config.h (DEFAULT_LOCALE): Define as "C.UTF-8". diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 7e89cb050..2020eda8f 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -395,23 +395,45 @@ path_conv::set_normalized_path (const char *path_copy) } } +/* Transform characters invalid for Windows filenames to the Unicode private + 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 strfuncs.cc, function sys_cp_wcstombs. */ WCHAR tfx_chars[] NO_COPY = { - 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, - 32, '!', 0xf000 | '"', '#', '$', '%', '&', 39, - '(', ')', 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 + 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 | '"', '#', + '$', '%', '&', 39, + '(', ')', 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