httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/include apr.h.in apr.hw
Date Wed, 25 Oct 2000 02:46:44 GMT
wrowe       00/10/24 19:46:43

  Modified:    src/modules/standard mod_autoindex.c
               src/lib/apr aprlib.dsp
               src/lib/apr/file_io/unix fileacc.c
               src/lib/apr/file_io/win32 dir.c filedup.c fileio.h
                        filestat.c open.c
               src/lib/apr/include apr.h.in apr.hw
  Log:
    Ok here it is: Win32 utf-8 native unicode filename support.
    There are just too many folks to credit... so this goes out from
    the entire ApacheCon hacking team :-)
  
  Revision  Changes    Path
  1.44      +3 -0      apache-2.0/src/modules/standard/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_autoindex.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- mod_autoindex.c	2000/10/16 06:05:04	1.43
  +++ mod_autoindex.c	2000/10/25 02:46:40	1.44
  @@ -1558,6 +1558,9 @@
       }
   
       r->content_type = "text/html";
  +#if APR_HAS_UNICODE_FS 
  +    r->content_type = "text/html;charset=utf-8";
  +#endif
   
       ap_send_http_header(r);
   
  
  
  
  1.43      +3 -10     apache-2.0/src/lib/apr/aprlib.dsp
  
  Index: aprlib.dsp
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/aprlib.dsp,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- aprlib.dsp	2000/10/17 17:47:47	1.42
  +++ aprlib.dsp	2000/10/25 02:46:41	1.43
  @@ -43,7 +43,7 @@
   # ADD BASE RSC /l 0x409
   # ADD RSC /l 0x409
   # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
  -# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "dso/win32" /I "file_io/win32" /I "locks/win32"
/I "misc/win32" /I "misc/unix" /I "network_io/win32" /I "threadproc/win32" /I "time/win32"
/D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /FD /c
  +# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "dso/win32" /I "file_io/win32" /I "locks/win32"
/I "misc/win32" /I "misc/unix" /I "network_io/win32" /I "threadproc/win32" /I "time/win32"
/I "i18n/unix" /D "NDEBUG" /D "APR_UNICODE" /D "APR_IMPLEMENT_UNICODE" /D "APR_DECLARE_EXPORT"
/D "WIN32" /D "_WINDOWS" /FD /c
   # SUBTRACT CPP /YX
   BSC32=bscmake.exe
   # ADD BASE BSC32 /nologo
  @@ -68,8 +68,8 @@
   RSC=rc.exe
   # ADD BASE RSC /l 0x409
   # ADD RSC /l 0x409
  -# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD
/c
  -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "include" /I "dso/win32" /I "file_io/win32" /I
"locks/win32" /I "misc/win32" /I "misc/unix" /I "network_io/win32" /I "threadproc/win32" /I
"time/win32" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /FD /c
  +# ADD BASE CPP /nologo /MTd /W3 /GX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /ZI
/c
  +# ADD CPP /nologo /MDd /W3 /GX /Od /I "include" /I "dso/win32" /I "file_io/win32" /I "locks/win32"
/I "misc/win32" /I "misc/unix" /I "network_io/win32" /I "threadproc/win32" /I "time/win32"
/I "i18n/unix" /D "_DEBUG" /D "APR_UNICODE" /D "APR_IMPLEMENT_UNICODE" /D "APR_DECLARE_EXPORT"
/D "WIN32" /D "_WINDOWS" /FD /ZI /c
   # SUBTRACT CPP /YX
   BSC32=bscmake.exe
   # ADD BASE BSC32 /nologo
  @@ -341,13 +341,6 @@
   # Begin Source File
   
   SOURCE=.\i18n\unix\utf8_ucs2.c
  -
  -!IF  "$(CFG)" == "aprlib - Win32 Release"
  -
  -!ELSEIF  "$(CFG)" == "aprlib - Win32 Debug"
  -
  -!ENDIF 
  -
   # End Source File
   # Begin Source File
   
  
  
  
  1.34      +16 -0     apache-2.0/src/lib/apr/file_io/unix/fileacc.c
  
  Index: fileacc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/fileacc.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- fileacc.c	2000/08/02 05:25:50	1.33
  +++ fileacc.c	2000/10/25 02:46:41	1.34
  @@ -68,11 +68,27 @@
   #else
   #include "fileio.h"
   #endif
  +#if APR_HAS_UNICODE_FS
  +#include "i18n.h"
  +#endif
  +
   /* A file to put ALL of the accessor functions for apr_file_t types. */
   
   apr_status_t apr_get_filename(char **fname, apr_file_t *thefile)
   {
  +#if APR_HAS_UNICODE_FS
  +    apr_status_t rv;
  +    int len = wcslen(thefile->fname) + 1;
  +    int dremains = MAX_PATH;
  +    *fname = apr_palloc(thefile->cntxt, len * 2);
  +    if ((rv = conv_ucs2_to_utf8(thefile->fname, &len,
  +                                *fname, &dremains)))
  +        return rv;
  +    if (len)
  +        return APR_ENAMETOOLONG;
  +#else
       *fname = apr_pstrdup(thefile->cntxt, thefile->fname);
  +#endif
       return APR_SUCCESS;
   }
   
  
  
  
  1.29      +65 -30    apache-2.0/src/lib/apr/file_io/win32/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/dir.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- dir.c	2000/10/23 17:21:11	1.28
  +++ dir.c	2000/10/25 02:46:41	1.29
  @@ -57,6 +57,9 @@
   #include "apr_file_io.h"
   #include "apr_strings.h"
   #include "apr_portable.h"
  +#if APR_HAS_UNICODE_FS
  +#include "i18n.h"
  +#endif
   #include "atime.h"
   
   #if APR_HAVE_ERRNO_H
  @@ -75,70 +78,90 @@
   apr_status_t dir_cleanup(void *thedir)
   {
       apr_dir_t *dir = thedir;
  -    if (!CloseHandle(dir->dirhand)) {
  +    if (dir->dirhand != INVALID_HANDLE_VALUE && !FindClose(dir->dirhand))
{
           return apr_get_os_error();
       }
  +    dir->dirhand = INVALID_HANDLE_VALUE;
       return APR_SUCCESS;
   } 
   
   apr_status_t apr_opendir(apr_dir_t **new, const char *dirname, apr_pool_t *cont)
   {
  +    int len = strlen(dirname);
  +#if APR_HAS_UNICODE_FS
  +    apr_status_t rv;
  +    int lremains = len;
  +    int dremains = (len + 3) * 2;
       (*new) = apr_pcalloc(cont, sizeof(apr_dir_t));
  -    (*new)->cntxt = cont;
  -    (*new)->entry = NULL;
  -    if (dirname[strlen(dirname)] == '/') {
  -    	(*new)->dirname = apr_pstrcat(cont, dirname, "*", NULL);
  -    }
  -    else {
  -        (*new)->dirname = apr_pstrcat(cont, dirname, "/*", NULL);
  +    (*new)->entry = apr_pcalloc(cont, sizeof(WIN32_FIND_DATAW));
  +    (*new)->dirname = apr_palloc(cont, dremains);
  +    if ((rv = conv_utf8_to_ucs2(dirname, &lremains,
  +                                 (*new)->dirname, &dremains)))
  +        return rv;
  +    if (lremains)
  +        return APR_ENAMETOOLONG;
  +    len = (len + 3) * 2 - dremains;
  +#else
  +    (*new) = apr_pcalloc(cont, sizeof(apr_dir_t));
  +    (*new)->entry = apr_pcalloc(cont, sizeof(WIN32_FIND_DATA));
  +    (*new)->dirname = apr_palloc(cont, len + 3);
  +    memcpy((*new)->dirname, dirname, len);
  +#endif
  +    if (len && dirname[len - 1] != '/') {
  +    	(*new)->dirname[len++] = '/';
       }
  +    (*new)->dirname[len++] = '*';
  +    (*new)->dirname[len] = '\0';
  +    (*new)->cntxt = cont;
       (*new)->dirhand = INVALID_HANDLE_VALUE;
       apr_register_cleanup((*new)->cntxt, (void *)(*new), dir_cleanup,
                           apr_null_cleanup);
       return APR_SUCCESS;
   }
   
  -apr_status_t apr_closedir(apr_dir_t *thedir)
  +apr_status_t apr_closedir(apr_dir_t *dir)
   {
  -    if (!FindClose(thedir->dirhand)) {
  -        return apr_get_os_error();   
  +    if (dir->dirhand != INVALID_HANDLE_VALUE && !FindClose(dir->dirhand))
{
  +        return apr_get_os_error();
       }
  -    apr_kill_cleanup(thedir->cntxt, thedir, dir_cleanup);
  +    dir->dirhand = INVALID_HANDLE_VALUE;
       return APR_SUCCESS;
   }
   
   apr_status_t apr_readdir(apr_dir_t *thedir)
   {
  +#if APR_HAS_UNICODE_FS
  +    if (thedir->dirhand == INVALID_HANDLE_VALUE) {
  +        thedir->dirhand = FindFirstFileW(thedir->dirname, thedir->entry);
  +        if (thedir->dirhand == INVALID_HANDLE_VALUE) {
  +            return apr_get_os_error();
  +        }
  +    }
  +    else if (!FindNextFileW(thedir->dirhand, thedir->entry)) {
  +        return apr_get_os_error();
  +    }
  +#else
       if (thedir->dirhand == INVALID_HANDLE_VALUE) {
  -        thedir->entry = apr_pcalloc(thedir->cntxt, sizeof(WIN32_FIND_DATA));
           thedir->dirhand = FindFirstFile(thedir->dirname, thedir->entry);
           if (thedir->dirhand == INVALID_HANDLE_VALUE) {
               return apr_get_os_error();
           }
  -        return APR_SUCCESS;
       }
  -    if (!FindNextFile(thedir->dirhand, thedir->entry)) {
  +    else if (!FindNextFile(thedir->dirhand, thedir->entry)) {
           return apr_get_os_error();
       }
  +#endif
       return APR_SUCCESS;
   }
   
  -apr_status_t apr_rewinddir(apr_dir_t *thedir)
  +apr_status_t apr_rewinddir(apr_dir_t *dir)
   {
  -    apr_status_t stat;
  -    apr_pool_t *cont = thedir->cntxt;
  -    char *temp = apr_pstrdup(cont, thedir->dirname);
  -    temp[strlen(temp) - 2] = '\0';   /*remove the \* at the end */
  -    if (thedir->dirhand == INVALID_HANDLE_VALUE) {
  -        return APR_SUCCESS;
  -    }
  -    if ((stat = apr_closedir(thedir)) == APR_SUCCESS) {
  -        if ((stat = apr_opendir(&thedir, temp, cont)) == APR_SUCCESS) {
  -            apr_readdir(thedir);
  -            return APR_SUCCESS;
  -        }
  -    }
  -    return stat;	
  +    dir_cleanup(dir);
  +    if (!FindClose(dir->dirhand)) {
  +        return apr_get_os_error();
  +    }    
  +    dir->dirhand = INVALID_HANDLE_VALUE;
  +    return APR_SUCCESS;
   }
   
   apr_status_t apr_make_dir(const char *path, apr_fileperms_t perm, apr_pool_t *cont)
  @@ -196,7 +219,19 @@
   
   apr_status_t apr_get_dir_filename(char **new, apr_dir_t *thedir)
   {
  +#if APR_HAS_UNICODE_FS
  +    apr_status_t rv;
  +    int len = wcslen(thedir->entry->cFileName) + 1;
  +    int dremains = MAX_PATH;
  +    (*new) = apr_palloc(thedir->cntxt, len * 2);
  +    if ((rv = conv_ucs2_to_utf8(thedir->entry->cFileName, &len,
  +                                *new, &dremains)))
  +        return rv;
  +    if (len)
  +        return APR_ENAMETOOLONG;
  +#else
       (*new) = apr_pstrdup(thedir->cntxt, thedir->entry->cFileName);
  +#endif
       return APR_SUCCESS;
   }
   
  
  
  
  1.23      +13 -2     apache-2.0/src/lib/apr/file_io/win32/filedup.c
  
  Index: filedup.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/filedup.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- filedup.c	2000/10/23 17:21:11	1.22
  +++ filedup.c	2000/10/25 02:46:42	1.23
  @@ -57,19 +57,25 @@
   #include "apr_general.h"
   #include "apr_strings.h"
   #include <string.h>
  +#if APR_HAS_UNICODE_FS
  +#include "i18n.h"
  +#include <wchar.h>
  +#endif
   
   apr_status_t apr_dupfile(apr_file_t **new_file, apr_file_t *old_file, apr_pool_t *p)
   {
       BOOLEAN isStdHandle = FALSE;
       HANDLE hCurrentProcess = GetCurrentProcess();
  +#if APR_HAS_UNICODE_FS
  +    int len = wcslen(old_file->fname) + 1;
  +#endif
   
       if ((*new_file) == NULL) {
           if (p == NULL) {
               p = old_file->cntxt;
           }
               
  -        (*new_file) = (apr_file_t *) apr_pcalloc(p,
  -                                               sizeof(apr_file_t));
  +        (*new_file) = (apr_file_t *) apr_pcalloc(p, sizeof(apr_file_t));
           if ((*new_file) == NULL) {
               return APR_ENOMEM;
           }
  @@ -104,7 +110,12 @@
       }
   
       (*new_file)->cntxt = old_file->cntxt;
  +#if APR_HAS_UNICODE_FS
  +    (*new_file)->fname = apr_palloc(old_file->cntxt, len * 2);
  +    wcscpy((*new_file)->fname, old_file->fname);
  +#else
       (*new_file)->fname = apr_pstrdup(old_file->cntxt, old_file->fname);
  +#endif
   /*    (*new_file)->demonfname = apr_pstrdup(old_file->cntxt, old_file->demonfname);
    *    (*new_file)->lowerdemonfname = apr_pstrdup(old_file->cntxt, old_file->lowerdemonfname);
    */
  
  
  
  1.33      +12 -1     apache-2.0/src/lib/apr/file_io/win32/fileio.h
  
  Index: fileio.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/fileio.h,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- fileio.h	2000/10/23 17:21:11	1.32
  +++ fileio.h	2000/10/25 02:46:42	1.33
  @@ -89,6 +89,8 @@
   
   #define APR_FILE_BUFSIZE 4096
   
  +typedef apr_int16_t apr_wchar_t;
  +
   typedef enum apr_canon_case_e {
       APR_CANON_CASE_GIVEN,
       APR_CANON_CASE_LOWER,
  @@ -138,7 +140,11 @@
       apr_interval_time_t timeout;
   
       /* File specific info */
  +#if APR_HAS_UNICODE_FS
  +    apr_wchar_t *fname;
  +#else
       char *fname;
  +#endif
       apr_canon_t *canonname;
       
       DWORD dwFileAttributes;
  @@ -165,9 +171,14 @@
   
   struct apr_dir_t {
       apr_pool_t *cntxt;
  -    char *dirname;
       HANDLE dirhand;
  +#if APR_HAS_UNICODE_FS
  +    apr_wchar_t *dirname;
  +    WIN32_FIND_DATAW *entry;
  +#else
  +    char *dirname;
       WIN32_FIND_DATA *entry;
  +#endif
   };
   
   apr_status_t file_cleanup(void *);
  
  
  
  1.30      +47 -9     apache-2.0/src/lib/apr/file_io/win32/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/filestat.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- filestat.c	2000/10/16 03:35:02	1.29
  +++ filestat.c	2000/10/25 02:46:42	1.30
  @@ -58,6 +58,9 @@
   #include "apr_general.h"
   #include "apr_errno.h"
   #include "apr_time.h"
  +#if APR_HAS_UNICODE_FS
  +#include "i18n.h"
  +#endif
   #include <sys/stat.h>
   #include "atime.h"
   #include "misc.h"
  @@ -196,20 +199,53 @@
   {
       /* WIN32_FILE_ATTRIBUTE_DATA is an exact subset of the first 
        * entries of WIN32_FIND_DATA
  +     * We need to catch the case where fname length == MAX_PATH since for
  +     * some strange reason GetFileAttributesEx fails with PATH_NOT_FOUND.
  +     * We would rather indicate length error than 'not found'
  +     * since in many cases the apr user is testing for 'not found' 
  +     * and this is not such a case.
        */
  +#if APR_HAS_UNICODE_FS
  +    WIN32_FIND_DATAW FileInformation;
  +    apr_wchar_t wname[MAX_PATH];
  +    int len = MAX_PATH;
  +    int lremains = strlen(fname) + 1;
  +    apr_oslevel_e os_level;
  +    apr_status_t rv;
  +    HANDLE hFind;
  +    if ((rv = conv_utf8_to_ucs2(fname, &lremains, wname, &len)))
  +        return rv;
  +    if (lremains)
  +        return APR_ENAMETOOLONG;
  +    if (!apr_get_oslevel(cont, &os_level) && os_level >= APR_WIN_98) {
  +        if (!GetFileAttributesExW(wname, GetFileExInfoStandard, 
  +                                  (WIN32_FILE_ATTRIBUTE_DATA*) &FileInformation)) {
  +            return apr_get_os_error();
  +        }
  +    }
  +    else {
  +        /* What a waste of cpu cycles... but what else can we do?
  +         */
  +        if (strchr(fname, '*') || strchr(fname, '?'))
  +            return APR_ENOENT;
  +        hFind = FindFirstFileW(wname, &FileInformation);
  +        if (hFind == INVALID_HANDLE_VALUE) {
  +            return apr_get_os_error();
  +    	} else {
  +            FindClose(hFind);
  +        }
  +    }
  +#else
  +    int len = strlen(fname);
       WIN32_FIND_DATA FileInformation;
       HANDLE hFind;
       apr_oslevel_e os_level;
  -    
  -    memset(finfo,'\0', sizeof(*finfo));
  +    (*new) = apr_pcalloc(cont, sizeof(apr_dir_t));
  +    (*new)->entry = apr_pcalloc(cont, sizeof(WIN32_FIND_DATA));
  +    (*new)->dirname = apr_palloc(cont, len + 3);
  +    memcpy((*new)->dirname, dirname, len);
   
  -	/* We need to catch the case where fname length == MAX_PATH since for
  -	 * some strange reason GetFileAttributesEx fails with PATH_NOT_FOUND.
  -	 * We would rather indicate length error than 'not found'
  -	 * since in many cases the apr user is testing for 'not found' 
  -	 * and this is not such a case.
  -	 */
  -    if (strlen(fname) >= MAX_PATH) {
  +    if (len >= MAX_PATH) {
           return APR_ENAMETOOLONG;
       }
       else if (!apr_get_oslevel(cont, &os_level) && os_level >= APR_WIN_98)
{
  @@ -230,7 +266,9 @@
               FindClose(hFind);
           }
       }
  +#endif
   
  +    memset(finfo,'\0', sizeof(*finfo));
       /* Filetype - Directory or file?
        * Short of opening the handle to the file, the 'FileType' appears
        * to be unknowable (in any trustworthy or consistent sense), that
  
  
  
  1.52      +60 -6     apache-2.0/src/lib/apr/file_io/win32/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/open.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- open.c	2000/10/23 17:21:11	1.51
  +++ open.c	2000/10/25 02:46:42	1.52
  @@ -63,6 +63,9 @@
   #include <string.h>
   #include <sys/stat.h>
   #include "misc.h"
  +#if APR_HAS_UNICODE_FS
  +#include "i18n.h"
  +#endif
   
   apr_status_t file_cleanup(void *thefile)
   {
  @@ -76,7 +79,7 @@
   }
   
   apr_status_t apr_open(apr_file_t **new, const char *fname, 
  -                    apr_int32_t flag, apr_fileperms_t perm, apr_pool_t *cont)
  +                      apr_int32_t flag, apr_fileperms_t perm, apr_pool_t *cont)
   {
       DWORD oflags = 0;
       DWORD createflags = 0;
  @@ -84,6 +87,10 @@
       DWORD sharemode = FILE_SHARE_READ | FILE_SHARE_WRITE;
       apr_oslevel_e level;
       apr_status_t rv;
  +#if APR_HAS_UNICODE_FS
  +    int lremains = strlen(fname) + 1;
  +    int dremains = (lremains) * 2;
  +#endif
   
       (*new) = (apr_file_t *)apr_pcalloc(cont, sizeof(apr_file_t));
       (*new)->cntxt = cont;
  @@ -108,8 +115,16 @@
           if (rv)
               return rv;
       }
  -
  +#if APR_HAS_UNICODE_FS
  +    (*new)->fname = apr_palloc(cont, dremains);
  +    if ((rv = conv_utf8_to_ucs2(fname, &lremains,
  +                                (*new)->fname, &dremains)))
  +        return rv;
  +    if (lremains)
  +        return APR_ENAMETOOLONG;
  +#else
       (*new)->fname = apr_pstrdup(cont, fname);
  +#endif
   
       if (apr_get_oslevel(cont, &level) == APR_SUCCESS && level >= APR_WIN_NT)
{
           sharemode |= FILE_SHARE_DELETE;
  @@ -150,10 +165,14 @@
       if (flag & APR_DELONCLOSE) {
           attributes |= FILE_FLAG_DELETE_ON_CLOSE;
       }
  -
  -    (*new)->filehand = CreateFile(fname, oflags, sharemode,
  -                                     NULL, createflags, attributes, 0);
   
  +#if APR_HAS_UNICODE_FS
  +    (*new)->filehand = CreateFileW((*new)->fname, oflags, sharemode,
  +                                   NULL, createflags, attributes, 0);
  +#else
  +    (*new)->filehand = CreateFile((*new)->fname, oflags, sharemode,
  +                                  NULL, createflags, attributes, 0);
  +#endif
       if ((*new)->filehand == INVALID_HANDLE_VALUE) {
           return apr_get_os_error();
       }
  @@ -193,7 +212,20 @@
   
   apr_status_t apr_remove_file(const char *path, apr_pool_t *cont)
   {
  +#if APR_HAS_UNICODE_FS
  +    apr_wchar_t wpath[MAX_PATH];
  +    int lremains = strlen(path) + 1;
  +    int dremains = MAX_PATH;
  +    apr_status_t rv;
  +    if ((rv = conv_utf8_to_ucs2(path, &lremains,
  +                                wpath, &dremains)))
  +        return rv;
  +    if (lremains)
  +        return APR_ENAMETOOLONG;
  +    if (DeleteFileW(wpath))
  +#else
       if (DeleteFile(path))
  +#endif
           return APR_SUCCESS;
       return apr_get_os_error();
   }
  @@ -201,8 +233,30 @@
   apr_status_t apr_rename_file(const char *from_path, const char *to_path,
                              apr_pool_t *p)
   {
  +#if APR_HAS_UNICODE_FS
  +    apr_wchar_t wfrompath[MAX_PATH];
  +    apr_wchar_t wtopath[MAX_PATH];
  +    int lremains = strlen(from_path) + 1;
  +    int dremains = MAX_PATH;
  +    apr_status_t rv;
  +    if ((rv = conv_utf8_to_ucs2(from_path, &lremains,
  +                                wfrompath, &dremains)))
  +        return rv;
  +    if (lremains)
  +        return APR_ENAMETOOLONG;
  +    lremains = strlen(to_path) + 1;
  +    dremains = MAX_PATH;
  +    if ((rv = conv_utf8_to_ucs2(to_path, &lremains,
  +                                wtopath, &dremains)))
  +        return rv;
  +    if (lremains)
  +        return APR_ENAMETOOLONG;
  +    if (MoveFileExW(wfrompath, wtopath, MOVEFILE_REPLACE_EXISTING |
  +                                        MOVEFILE_COPY_ALLOWED))
  +#else
       if (MoveFileEx(from_path, to_path, MOVEFILE_REPLACE_EXISTING |
                                           MOVEFILE_COPY_ALLOWED))
  +#endif
           return APR_SUCCESS;
       return apr_get_os_error();
   }
  @@ -249,7 +303,7 @@
       if ((*thefile)->filehand == INVALID_HANDLE_VALUE)
           return apr_get_os_error();
       (*thefile)->cntxt = cont;
  -    (*thefile)->fname = "STD_ERROR_HANDLE";
  +    (*thefile)->fname = "\0\0"; // What was this: "STD_ERROR_HANDLE";
       (*thefile)->eof_hit = 0;
   
       return APR_SUCCESS;
  
  
  
  1.47      +1 -0      apache-2.0/src/lib/apr/include/apr.h.in
  
  Index: apr.h.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr.h.in,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- apr.h.in	2000/10/17 13:26:54	1.46
  +++ apr.h.in	2000/10/25 02:46:43	1.47
  @@ -93,6 +93,7 @@
   #define APR_HAS_XLATE             @iconv@
   #define APR_HAS_OTHER_CHILD       @oc@
   #define APR_HAS_DSO               @aprdso@
  +#define APR_HAS_UNICODE_FS        0
   
   /* This macro tells APR that it is safe to make a file masquerade as a 
    * socket.  This is necessary, because some platforms support poll'ing
  
  
  
  1.32      +3 -1      apache-2.0/src/lib/apr/include/apr.hw
  
  Index: apr.hw
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr.hw,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- apr.hw	2000/10/17 13:26:54	1.31
  +++ apr.hw	2000/10/25 02:46:43	1.32
  @@ -147,12 +147,14 @@
   
   /*  APR Feature Macros */
   #define APR_HAS_THREADS        1
  -#define APR_HAS_SENDFILE      1
  +#define APR_HAS_SENDFILE       1
   #define APR_HAS_RANDOM         1
   #define APR_HAS_DSO            1
   
   #define APR_HAS_MMAP           0
   #define APR_HAS_XLATE          0
  +
  +#define APR_HAS_UNICODE_FS     1
   
   /* Typedefs that APR needs. */
   
  
  
  

Mime
View raw message