You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2011/05/03 20:22:49 UTC
svn commit: r1099173 - /apr/apr/branches/1.4.x/file_io/win32/filepath.c
Author: wrowe
Date: Tue May 3 18:22:49 2011
New Revision: 1099173
URL: http://svn.apache.org/viewvc?rev=1099173&view=rev
Log:
Remove assumption that drive letters are always uppercase.
* file_io/win32/filepath.c:
(same_drive): new helper function
(apr_filepath_merge): use helper rather than a simple comparison
* test/testnames.c:
(merge_lowercasedrive): do some tests with lowercase drive names
Patch by: Bert Huijben <bert {at} qqmail.nl>
Backports: r960665
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=1099173&r1=1099172&r2=1099173&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:22:49 2011
@@ -327,6 +327,19 @@ APR_DECLARE(apr_status_t) apr_filepath_r
#endif /* ndef(NETWARE) */
}
+#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));
+}
+#endif
APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
const char *basepath,
@@ -540,7 +553,7 @@ APR_DECLARE(apr_status_t) apr_filepath_m
* use the basepath _if_ it matches this drive letter!
* Otherwise we must discard the basepath.
*/
- if (addroot[0] == baseroot[0] && baseroot[1] == ':') {
+ if (same_drive(addroot, baseroot)) {
#endif
/* Base the result path on the basepath
*/
RE: svn commit: r1099173 - /apr/apr/branches/1.4.x/file_io/win32/filepath.c
Posted by Bert Huijben <be...@qqmail.nl>.
> -----Original Message-----
> From: William A. Rowe Jr. [mailto:wrowe@rowe-clan.net]
> Sent: dinsdag 3 mei 2011 20:28
> To: APR Developer List
> Subject: Re: svn commit: r1099173 -
> /apr/apr/branches/1.4.x/file_io/win32/filepath.c
>
> On 5/3/2011 1:22 PM, wrowe@apache.org wrote:
> > Remove assumption that drive letters are always uppercase.
> > Patch by: Bert Huijben <bert {at} qqmail.nl>
> > Backports: r960665
>
> We needed this on 1.4, I'll add to 1.5 later tonight, and I'll refactor
> once again for the //Machine/Share/ syntax later (since we believe it
> can also fall out of case-synchronization).
//Machine/share might have similar issues, but not this specific one as Windows doesn't allow setting the current directory to a UNC share.
(The share name can be case sensitive depending on which server architecture you use (E.g. Samba). The machine name is mostly case insensitive)
Bert
Re: svn commit: r1099173 - /apr/apr/branches/1.4.x/file_io/win32/filepath.c
Posted by "William A. Rowe Jr." <wr...@rowe-clan.net>.
On 5/3/2011 1:22 PM, wrowe@apache.org wrote:
> Remove assumption that drive letters are always uppercase.
> Patch by: Bert Huijben <bert {at} qqmail.nl>
> Backports: r960665
We needed this on 1.4, I'll add to 1.5 later tonight, and I'll refactor
once again for the //Machine/Share/ syntax later (since we believe it
can also fall out of case-synchronization).