From: Rémi Bernon rbernon@codeweavers.com
To lookup invalid unix chars, instead of costly wcschr. --- dlls/ntdll/unix/file.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index e41a7c214f1..09370508a3f 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -168,8 +168,6 @@ typedef struct
#define IS_SEPARATOR(ch) ((ch) == '\' || (ch) == '/')
-#define INVALID_NT_CHARS '*','?','<','>','|','"' - #define MAX_DIR_ENTRY_LEN 255 /* max length of a directory entry in chars */
#define MAX_IGNORED_FILES 4 @@ -277,6 +275,12 @@ static inline BOOL is_invalid_nt_char( WCHAR ch ) return ch <= 0x7f ? is_invalid[ch] : FALSE; }
+static inline BOOL is_invalid_unix_char( WCHAR ch ) +{ + if (ch == '/') return TRUE; + return is_invalid_nt_char( ch ); +} + /* check if the device can be a mounted volume */ static inline BOOL is_valid_mounted_device( const struct stat *st ) { @@ -3363,7 +3367,6 @@ done: static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer, int unix_len, int pos, UINT disposition, BOOL is_unix ) { - static const WCHAR invalid_charsW[] = { INVALID_NT_CHARS, '/', 0 }; NTSTATUS status; int ret; struct stat st; @@ -3390,7 +3393,7 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer { if (!*ptr) return STATUS_OBJECT_NAME_INVALID; if (is_unix) continue; - if (*ptr < 32 || wcschr( invalid_charsW, *ptr )) return STATUS_OBJECT_NAME_INVALID; + if (is_invalid_unix_char( *ptr )) return STATUS_OBJECT_NAME_INVALID; } }