apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r1099181 - /apr/apr/branches/1.4.x/file_io/win32/filepath.c
Date Tue, 03 May 2011 18:39:15 GMT
Author: wrowe
Date: Tue May  3 18:39:14 2011
New Revision: 1099181

URL: http://svn.apache.org/viewvc?rev=1099181&view=rev
Log:
Use Bert's exact code from r690665

Modified:
    apr/apr/branches/1.4.x/file_io/win32/filepath.c

Modified: apr/apr/branches/1.4.x/file_io/win32/filepath.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/file_io/win32/filepath.c?rev=1099181&r1=1099180&r2=1099181&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/file_io/win32/filepath.c (original)
+++ apr/apr/branches/1.4.x/file_io/win32/filepath.c Tue May  3 18:39:14 2011
@@ -330,14 +330,22 @@ APR_DECLARE(apr_status_t) apr_filepath_r
 #if !defined(NETWARE)
 static int same_drive(const char *path1, const char *path2)
 {
-    /* Alpha-colon pattern test, assumes an ASCII character set mapping */
-    if ((path1[0] < 'A' || (path1[0] > 'Z' && path1[0] < 'a') || path1[0]
> 'z')
-     || (path2[0] < 'A' || (path2[0] > 'Z' && path2[0] < 'a') || path2[0]
> 'z')
-     || path1[1] != ':' || path2[1] != ':')
-        return 0;
+    char drive1 = path1[0];
+    char drive2 = path2[0];
 
-    /* Once in the domain of ASCII alpha, compare these case insensitive */
-    return ((path1[0] & 0x1f) == (path2[0] & 0x1f));
+    if (!drive1 || !drive2 || path1[1] != ':' || path2[1] != ':')
+        return FALSE;
+
+    if (drive1 == drive2)
+        return TRUE;
+
+    if (drive1 >= 'a' && drive1 <= 'z')
+        drive1 += 'A' - 'a';
+
+    if (drive2 >= 'a' && drive2 <= 'z')
+        drive2 += 'A' - 'a';
+
+    return (drive1 == drive2);
 }
 #endif
 



Mime
View raw message