apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: [PATCH] Determining the character encoding used for paths in APR
Date Fri, 19 Jul 2002 00:16:46 GMT
Before we consider this patch, there is a deeper question.

Will we support MULTIPLE paths?  If so we should consider a given
filepath as an argument to the function.  I'm thinking unix or NFS mounts
here, not really win32 filesystems since NT is utf-8 and others are local
codepages.

Finally, I would rather return an apr_xlate compatible string, not some
enum that must be extended forever.

Bill

At 05:45 PM 7/18/2002, brane wrote:
>Bill, you may remember use talking about this issue on IRC a couple of 
>days ago. Subversion needs this information, so I cooked up a patch. Could 
>you please have a quick look at it, to see if it's O.K.? I know you're 
>very busy at the moment ....
>
>Thanks.
>
>Index: include/apr_file_info.h
>===================================================================
>RCS file: /home/cvs/apr/include/apr_file_info.h,v
>retrieving revision 1.32
>diff -u -p -r1.32 apr_file_info.h
>--- include/apr_file_info.h     20 Mar 2002 08:54:43 -0000      1.32
>+++ include/apr_file_info.h     18 Jul 2002 22:37:50 -0000
>@@ -314,6 +314,14 @@ APR_DECLARE(apr_status_t) apr_dir_rewind
>  * trailing slash if a directory
>  */
>#define APR_FILEPATH_TRUENAME       0x20
>+
>+
>+typedef enum
>+{
>+    APR_FILEPATH_ENCODING_UNKNOWN, /**< The path encoding is not known. */
>+    APR_FILEPATH_ENCODING_DEFAULT, /**< The locale determines path 
>encoding. */
>+    APR_FILEPATH_ENCODING_UTF8     /**< The path endoding is UTF-8. */
>+} apr_filepath_encoding_e;
>/** @} */
>/**
>  * Extract the rootpath from the given filepath
>@@ -381,6 +389,14 @@ APR_DECLARE(apr_status_t) apr_filepath_g
>  * @deffunc apr_status_t apr_filepath_get(char **defpath, apr_pool_t *p)
>  */
>APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p);
>+
>+
>+/**
>+ * Return the character encoding for paths produced and consumed by APR
>+ * @ingroup apr_filepath
>+ * @deffunc apr_filepath_encoding_e apr_filepath_encoding(void)
>+ */
>+APR_DECLARE(apr_filepath_encoding_e) apr_filepath_encoding(void);
>/** @} */
>Index: file_io/unix/filepath.c
>===================================================================
>RCS file: /home/cvs/apr/file_io/unix/filepath.c,v
>retrieving revision 1.15
>diff -u -p -r1.15 filepath.c
>--- file_io/unix/filepath.c     12 Jun 2002 01:42:35 -0000      1.15
>+++ file_io/unix/filepath.c     18 Jul 2002 22:37:50 -0000
>@@ -329,3 +329,9 @@ APR_DECLARE(apr_status_t) apr_filepath_m
>     *newpath = path;
>     return APR_SUCCESS;
>}
>+
>+
>+APR_DECLARE(apr_filepath_encoding_e) apr_filepath_encoding(void)
>+{
>+    return APR_FILEPATH_ENCODING_DEFAULT;
>+}
>Index: file_io/win32/filepath.c
>===================================================================
>RCS file: /home/cvs/apr/file_io/win32/filepath.c,v
>retrieving revision 1.25
>diff -u -p -r1.25 filepath.c
>--- file_io/win32/filepath.c    10 Jul 2002 06:01:12 -0000      1.25
>+++ file_io/win32/filepath.c    18 Jul 2002 22:37:51 -0000
>@@ -966,3 +966,20 @@ APR_DECLARE(apr_status_t) apr_filepath_m
>     (*newpath)[pathlen] = '\0';
>     return APR_SUCCESS;
>}
>+
>+
>+APR_DECLARE(apr_filepath_encoding_e) apr_filepath_encoding(void)
>+{
>+#ifdef WIN32
>+#if APR_HAS_UNICODE_FS
>+    IF_WIN_OS_IS_UNICODE
>+        return APR_FILEPATH_ENCODING_UTF8;
>+#endif
>+#if APR_HAS_ANSI_FS
>+    ELSE_WIN_OS_IS_ANSI
>+        return APR_FILEPATH_ENCODING_DEFAULT;
>+#endif
>+#else  /* !WIN32 */
>+    return APR_FILEPATH_ENCODING_DEFAULT;
>+#endif /* !WIN32 */
>+}
>
>
>
>--
>Brane Čibej   <brane@xbc.nu>   http://www.xbc.nu/brane/



Mime
View raw message