[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: revision 70 - trunk

From: Branko Èibej <brane_at_xbc.nu>
Date: 2001-09-08 15:02:29 CEST

Branko �ibej wrote:

> Oh, yes: I've also got mods to APR (apr_filepath_merge,
> apr_filepath_get), but I have to research the impact on apr-util and
> httpd-2.0 before I dare commit those changes.
>
>

Well, it seems that neither apr-util nor httpd-2.0 will mind (I changed
the declaration of apr_filepath_get). But I don't have time to test
those changes on Unix. So I'm attaching a patch for APR. Anyone who
wants to test on Windows will need this patch to make commits work.

-- 
Brane �ibej   <brane_at_xbc.nu>            http://www.xbc.nu/brane/

Index: include/apr_file_info.h
===================================================================
RCS file: /home/cvs/apr/include/apr_file_info.h,v
retrieving revision 1.23
diff -u -r1.23 apr_file_info.h
--- include/apr_file_info.h 2001/08/18 15:15:46 1.23
+++ include/apr_file_info.h 2001/09/08 12:54:39
@@ -357,10 +357,12 @@
  * Return the default file path (for relative file names)
  * @ingroup apr_filepath
  * @param path the default path string returned
+ * @param flags the desired APR_FILEPATH_ rules to apply
  * @param p the pool to allocate the default path string from
  * @deffunc apr_status_t apr_filepath_get(char **path, apr_pool_t *p)
  */
-APR_DECLARE(apr_status_t) apr_filepath_get(char **path, apr_pool_t *p);
+APR_DECLARE(apr_status_t) apr_filepath_get(char **path, apr_int32_t flags,
+ apr_pool_t *p);
 
 /**
  * Set the default file path (for relative file names)
Index: include/arch/win32/fileio.h
===================================================================
RCS file: /home/cvs/apr/include/arch/win32/fileio.h,v
retrieving revision 1.55
diff -u -r1.55 fileio.h
--- include/arch/win32/fileio.h 2001/08/28 21:45:04 1.55
+++ include/arch/win32/fileio.h 2001/09/08 12:54:41
@@ -229,12 +229,13 @@
 
 /* The apr_filepath_merge wants to canonicalize the cwd to the
  * addpath if the user passes NULL as the old root path (this
- * isn't true of an empty string "", which won't be concatinated.
+ * isn't true of an empty string "", which won't be concatenated.
  *
  * But we need to figure out what the cwd of a given volume is,
  * when the user passes D:foo. This fn will determine D:'s cwd.
  */
-apr_status_t filepath_drive_get(char **rootpath, char drive, apr_pool_t *p);
+apr_status_t filepath_drive_get(char **rootpath, char drive,
+ apr_int32_t flags, apr_pool_t *p);
 
 
 /* If the user passes d: vs. D: (or //mach/share vs. //MACH/SHARE),
Index: file_io/win32/filepath.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/filepath.c,v
retrieving revision 1.12
diff -u -r1.12 filepath.c
--- file_io/win32/filepath.c 2001/09/01 05:11:46 1.12
+++ file_io/win32/filepath.c 2001/09/08 12:54:41
@@ -358,7 +358,9 @@
         /* This call _should_ test the path
          */
         addtype = apr_filepath_root(&addroot, &addpath,
- APR_FILEPATH_TRUENAME, p);
+ APR_FILEPATH_TRUENAME
+ | (flags & APR_FILEPATH_NATIVE),
+ p);
         if (addtype == APR_SUCCESS) {
             addtype = APR_EABSOLUTE;
         }
@@ -418,10 +420,11 @@
         char *getpath;
 #ifndef NETWARE
         if (addtype == APR_EINCOMPLETE && addroot[1] == ':')
- rv = filepath_drive_get(&getpath, addroot[0], p);
+ rv = filepath_drive_get(&getpath, addroot[0],
+ (flags & APR_FILEPATH_NATIVE), p);
         else
 #endif
- rv = apr_filepath_get(&getpath, p);
+ rv = apr_filepath_get(&getpath, (flags & APR_FILEPATH_NATIVE), p);
         if (rv != APR_SUCCESS)
             return rv;
         basepath = getpath;
@@ -430,7 +433,8 @@
     if (!baseroot) {
         /* This call should _not_ test the path
          */
- basetype = apr_filepath_root(&baseroot, &basepath, 0, p);
+ basetype = apr_filepath_root(&baseroot, &basepath,
+ (flags & APR_FILEPATH_NATIVE), p);
         if (basetype == APR_SUCCESS) {
             basetype = APR_EABSOLUTE;
         }
@@ -745,7 +749,9 @@
                 /* This call _should_ test the path
                  */
                 testtype = apr_filepath_root(&testroot, &testpath,
- APR_FILEPATH_TRUENAME, p);
+ APR_FILEPATH_TRUENAME
+ | (flags & APR_FILEPATH_NATIVE),
+ p);
                 if (testtype == APR_SUCCESS) {
                     rootlen = pathlen = (testpath - path);
                     memcpy(path, testroot, pathlen);
Index: file_io/win32/filesys.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/filesys.c,v
retrieving revision 1.2
diff -u -r1.2 filesys.c
--- file_io/win32/filesys.c 2001/09/02 05:10:41 1.2
+++ file_io/win32/filesys.c 2001/09/08 12:54:41
@@ -116,7 +116,8 @@
 }
 
 
-apr_status_t filepath_drive_get(char **rootpath, char drive, apr_pool_t *p)
+apr_status_t filepath_drive_get(char **rootpath, char drive,
+ apr_int32_t flags, apr_pool_t *p)
 {
     char path[APR_PATH_MAX];
 #if APR_HAS_UNICODE_FS
@@ -149,12 +150,12 @@
         if (!GetFullPathName(drivestr, sizeof(path), path, &ignored))
             return apr_get_os_error();
     }
- /* ###: We really should consider adding a flag to allow the user
- * to have the APR_FILEPATH_NATIVE result
- */
- for (*rootpath = path; **rootpath; ++*rootpath) {
- if (**rootpath == '\\')
- **rootpath = '/';
+ if (!(flags & APR_FILEPATH_NATIVE))
+ {
+ for (*rootpath = path; **rootpath; ++*rootpath) {
+ if (**rootpath == '\\')
+ **rootpath = '/';
+ }
     }
     *rootpath = apr_pstrdup(p, path);
     return APR_SUCCESS;
@@ -201,7 +202,7 @@
 }
 
 
-APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath,
+APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags,
                                            apr_pool_t *p)
 {
     char path[APR_PATH_MAX];
@@ -222,12 +223,12 @@
         if (!GetCurrentDirectory(sizeof(path), path))
             return apr_get_os_error();
     }
- /* ###: We really should consider adding a flag to allow the user
- * to have the APR_FILEPATH_NATIVE result
- */
- for (*rootpath = path; **rootpath; ++*rootpath) {
- if (**rootpath == '\\')
- **rootpath = '/';
+ if (!(flags & APR_FILEPATH_NATIVE))
+ {
+ for (*rootpath = path; **rootpath; ++*rootpath) {
+ if (**rootpath == '\\')
+ **rootpath = '/';
+ }
     }
     *rootpath = apr_pstrdup(p, path);
     return APR_SUCCESS;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:40 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.