diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2001-10-11 13:48:59 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2001-10-11 13:48:59 +0000 |
commit | 24de2f9caa3925b739a69e810d9010c73118b8f2 (patch) | |
tree | 9651d01b805b10a803e12ba9b1a88dd430b1ade5 | |
parent | caa24e808f168131983b4a9cc279e3edd0393079 (diff) | |
download | libapr-24de2f9caa3925b739a69e810d9010c73118b8f2.tar.gz |
More path parsing corrections, Win32 path code should now be stable.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62417 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | file_io/win32/filesys.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/file_io/win32/filesys.c b/file_io/win32/filesys.c index ba3d5b480..464e0e089 100644 --- a/file_io/win32/filesys.c +++ b/file_io/win32/filesys.c @@ -170,23 +170,21 @@ apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) apr_wchar_t *ignored; apr_wchar_t wpath[APR_PATH_MAX]; apr_status_t rv; + apr_wchar_t wroot[APR_PATH_MAX]; /* ???: This needs review, apparently "\\?\d:." returns "\\?\d:" * as if that is useful for anything. */ - { - apr_wchar_t wroot[APR_PATH_MAX]; - if (rv = utf8_to_unicode_path(wroot, sizeof(wroot) - / sizeof(apr_wchar_t), root)) - return rv; - if (!GetFullPathNameW(wroot, sizeof(wpath) / sizeof(apr_wchar_t), wpath, &ignored)) - return apr_get_os_error(); - } - { - char path[APR_PATH_MAX]; - if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath))) - return rv; - *rootpath = apr_pstrdup(p, path); - } + if (rv = utf8_to_unicode_path(wroot, sizeof(wroot) + / sizeof(apr_wchar_t), root)) + return rv; + if (!GetFullPathNameW(wroot, sizeof(wpath) / sizeof(apr_wchar_t), wpath, &ignored)) + return apr_get_os_error(); + + /* Borrow wroot as a char buffer (twice as big as necessary) + */ + if ((rv = unicode_to_utf8_path((char*)wroot, sizeof(wroot), wpath))) + return rv; + *rootpath = apr_pstrdup(p, (char*)wroot); } else #endif |