summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2011-05-03 18:39:14 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2011-05-03 18:39:14 +0000
commitb0f9db7489168d68381050097587e63d628479a6 (patch)
tree9aa980426da2b2ef3c1ba0c2cb5cb7d688342626 /file_io
parent78f3401162a5166f2d14be7a52cd282dad2cd085 (diff)
downloadlibapr-b0f9db7489168d68381050097587e63d628479a6.tar.gz
Use Bert's exact code from r960665.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@1099181 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r--file_io/win32/filepath.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/file_io/win32/filepath.c b/file_io/win32/filepath.c
index 1c6fe1430..559d1b28c 100644
--- a/file_io/win32/filepath.c
+++ b/file_io/win32/filepath.c
@@ -330,14 +330,22 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath,
#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;
-
- /* Once in the domain of ASCII alpha, compare these case insensitive */
- return ((path1[0] & 0x1f) == (path2[0] & 0x1f));
+ char drive1 = path1[0];
+ char drive2 = path2[0];
+
+ 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