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 2001/10/11 15:48:59 UTC

cvs commit: apr/file_io/win32 filesys.c

wrowe       01/10/11 06:48:59

  Modified:    file_io/win32 filesys.c
  Log:
    More path parsing corrections, Win32 path code should now be stable.
  
  Revision  Changes    Path
  1.4       +12 -14    apr/file_io/win32/filesys.c
  
  Index: filesys.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/filesys.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- filesys.c	2001/09/09 06:03:05	1.3
  +++ filesys.c	2001/10/11 13:48:59	1.4
  @@ -170,23 +170,21 @@
           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