Alexandre Julliard : ntdll: Simplify the RtlIsDosDeviceName_U implementation.
Alexandre Julliard
julliard at winehq.org
Wed Oct 29 09:39:54 CDT 2008
Module: wine
Branch: master
Commit: 6be25f8cb1f1c0f98ae704ed812a03db4eec8ae8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6be25f8cb1f1c0f98ae704ed812a03db4eec8ae8
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Oct 29 15:21:51 2008 +0100
ntdll: Simplify the RtlIsDosDeviceName_U implementation.
---
dlls/ntdll/path.c | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index a6fb090..6716c6a 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -287,30 +287,24 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
if (!strcmpiW( dos_name, consoleW ))
return MAKELONG( sizeof(conW), 4 * sizeof(WCHAR) ); /* 4 is length of \\.\ prefix */
return 0;
+ case ABSOLUTE_DRIVE_PATH:
+ case RELATIVE_DRIVE_PATH:
+ start = dos_name + 2; /* skip drive letter */
+ break;
default:
+ start = dos_name;
break;
}
- end = dos_name + strlenW(dos_name) - 1;
- while (end >= dos_name && *end == ':') end--; /* remove all trailing ':' */
-
/* find start of file name */
- for (start = end; start >= dos_name; start--)
- {
- if (IS_SEPARATOR(start[0])) break;
- /* check for ':' but ignore if before extension (for things like NUL:.txt) */
- if (start[0] == ':' && start[1] != '.') break;
- }
- start++;
+ for (p = start; *p; p++) if (IS_SEPARATOR(*p)) start = p + 1;
+
+ /* truncate at extension and ':' */
+ for (end = start; *end; end++) if (*end == '.' || *end == ':') break;
+ end--;
- /* remove extension */
- if ((p = strchrW( start, '.' )))
- {
- end = p - 1;
- if (end >= dos_name && *end == ':') end--; /* remove trailing ':' before extension */
- }
/* remove trailing spaces */
- while (end >= dos_name && *end == ' ') end--;
+ while (end >= start && *end == ' ') end--;
/* now we have a potential device name between start and end, check it */
switch(end - start + 1)
More information about the wine-cvs
mailing list