From: Rémi Bernon <rbernon(a)codeweavers.com> To lookup invalid unix chars, instead of costly wcschr. --- dlls/ntdll/unix/file.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index ed949da103c..67a4d4b6c89 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -169,7 +169,6 @@ typedef struct #define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/') #define INVALID_NT_CHARS '*','?','<','>','|','"' -#define INVALID_DOS_CHARS INVALID_NT_CHARS,'+','=',',',';','[',']',' ','\345' #define MAX_DIR_ENTRY_LEN 255 /* max length of a directory entry in chars */ @@ -278,6 +277,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 ) { @@ -3364,7 +3369,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; @@ -3391,7 +3395,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; } } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1756