Return-Path: X-Original-To: apmail-apr-commits-archive@www.apache.org Delivered-To: apmail-apr-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 93AC53000 for ; Tue, 3 May 2011 18:23:13 +0000 (UTC) Received: (qmail 22110 invoked by uid 500); 3 May 2011 18:23:13 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 22068 invoked by uid 500); 3 May 2011 18:23:13 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 22061 invoked by uid 99); 3 May 2011 18:23:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 18:23:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 18:23:11 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 062A52388901; Tue, 3 May 2011 18:22:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1099173 - /apr/apr/branches/1.4.x/file_io/win32/filepath.c Date: Tue, 03 May 2011 18:22:49 -0000 To: commits@apr.apache.org From: wrowe@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110503182250.062A52388901@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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 */