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 2002/01/28 16:56:08 UTC

cvs commit: apr/user/win32 userinfo.c

wrowe       02/01/28 07:56:08

  Modified:    dso/win32 dso.c
               file_io/win32 dir.c filestat.c filesys.c open.c
               include/arch/win32 fileio.h misc.h
               misc/win32 misc.c
               shmem/win32 shm.c
               threadproc/win32 proc.c
               user/win32 userinfo.c
  Log:
    Mladen Turk's <mt...@mappingsoft.com> WinCE port.
  
    Nearly, the apr.hw patch needs some review.  In short, several quite
    standard ansi headers (e.g. time.h) aren't present in the WinCT port,
    but these changes require corresponding changes to apr.h.in.
  
    I changed Mladen's #define'd symbol names for the macro blocks to
    IF_WIN_OS_IS_UNICODE and ELSE_WIN_OS_IS_ANSI to make the code a bit more
    readable, and drop the global apr_os_level from each macro invocation.
    Also, I changed the scope of his APR_HAS_ANSI_FS to local scope, since
    it has no application in the public headers.
  
    Mladen's patch helps NT as well, allowing the /D WINNT flag to define
    NT-only compilations.  With WINNT defined, all UNICODE/ANSI os version
    tests drop out entirely.
  
  Revision  Changes    Path
  1.27      +4 -2      apr/dso/win32/dso.c
  
  Index: dso.c
  ===================================================================
  RCS file: /home/cvs/apr/dso/win32/dso.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- dso.c	28 Dec 2001 23:50:48 -0000	1.26
  +++ dso.c	28 Jan 2002 15:56:08 -0000	1.27
  @@ -89,7 +89,7 @@
       UINT em;
   
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT) 
  +    IF_WIN_OS_IS_UNICODE 
       {
           apr_wchar_t wpath[APR_PATH_MAX];
           if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) 
  @@ -107,8 +107,9 @@
               rv = apr_get_os_error();
           SetErrorMode(em);
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           char fspec[APR_PATH_MAX], *p = fspec;
           /* Must convert path from / to \ notation.
  @@ -132,6 +133,7 @@
               rv = APR_SUCCESS;
           SetErrorMode(em);
       }
  +#endif
       *res_handle = apr_pcalloc(ctx, sizeof(**res_handle));
       (*res_handle)->cont = ctx;
   
  
  
  
  1.62      +25 -12    apr/file_io/win32/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/dir.c,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- dir.c	27 Nov 2001 03:08:58 -0000	1.61
  +++ dir.c	28 Jan 2002 15:56:08 -0000	1.62
  @@ -100,15 +100,16 @@
       (*new)->dirname[len] = '\0';
   
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT)
  +    IF_WIN_OS_IS_UNICODE
       {
           /* Create a buffer for the longest file name we will ever see 
            */
           (*new)->w.entry = apr_pcalloc(cont, sizeof(WIN32_FIND_DATAW));
           (*new)->name = apr_pcalloc(cont, APR_FILE_MAX * 3 + 1);        
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           /* Note that we won't open a directory that is greater than MAX_PATH,
            * including the trailing /* wildcard suffix.  If a * won't fit, then
  @@ -122,6 +123,7 @@
           }
           (*new)->n.entry = apr_pcalloc(cont, sizeof(WIN32_FIND_DATAW));
       }
  +#endif
       (*new)->rootlen = len - 1;
       (*new)->cntxt = cont;
       (*new)->dirhand = INVALID_HANDLE_VALUE;
  @@ -147,7 +149,7 @@
   #if APR_HAS_UNICODE_FS
       apr_wchar_t wdirname[APR_PATH_MAX];
       apr_wchar_t *eos = NULL;
  -    if (apr_os_level >= APR_WIN_NT)
  +    IF_WIN_OS_IS_UNICODE
       {
           if (thedir->dirhand == INVALID_HANDLE_VALUE) 
           {
  @@ -181,8 +183,9 @@
               return rv;
           fname = thedir->name;
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           char *eop = strchr(thedir->dirname, '\0');
           if (thedir->dirhand == INVALID_HANDLE_VALUE) {
  @@ -208,6 +211,7 @@
           }
           fname = thedir->n.entry->cFileName;
       }
  +#endif
   
       fillin_fileinfo(finfo, (WIN32_FILE_ATTRIBUTE_DATA *) thedir->w.entry, 
                       0, wanted);
  @@ -220,7 +224,8 @@
           /* Go back and get more_info if we can't answer the whole inquiry
            */
   #if APR_HAS_UNICODE_FS
  -        if (apr_os_level >= APR_WIN_NT) {
  +        IF_WIN_OS_IS_UNICODE
  +        {
               /* Almost all our work is done.  Tack on the wide file name
                * to the end of the wdirname (already / delimited)
                */
  @@ -231,13 +236,16 @@
               eos[0] = '\0';
               return rv;
           }
  -        else {
  +#endif
  +#if APR_HAS_ANSI_FS
  +        ELSE_WIN_OS_IS_ANSI
  +        {
  +#if APR_HAS_UNICODE_FS
               /* Don't waste stack space on a second buffer, the one we set
                * aside for the wide directory name is twice what we need.
                */
               char *fspec = (char*)wdirname;
  -#else /* !APR_HAS_UNICODE_FS */
  -        {
  +#else
               char fspec[APR_PATH_MAX];
   #endif
               int dirlen = strlen(thedir->dirname);
  @@ -247,6 +255,7 @@
               apr_cpystrn(fspec + dirlen, fname, sizeof(fspec) - dirlen);
               return more_finfo(finfo, fspec, wanted, MORE_OF_FSPEC);
           }
  +#endif
       }
   
       return APR_SUCCESS;
  @@ -264,7 +273,7 @@
                                          apr_pool_t *cont)
   {
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT) 
  +    IF_WIN_OS_IS_UNICODE
       {
           apr_wchar_t wpath[APR_PATH_MAX];
           apr_status_t rv;
  @@ -276,18 +285,20 @@
               return apr_get_os_error();
           }
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
           if (!CreateDirectory(path, NULL)) {
               return apr_get_os_error();
           }
  +#endif
       return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *cont)
   {
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT) 
  +    IF_WIN_OS_IS_UNICODE
       {
           apr_wchar_t wpath[APR_PATH_MAX];
           apr_status_t rv;
  @@ -299,11 +310,13 @@
               return apr_get_os_error();
           }
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
           if (!RemoveDirectory(path)) {
               return apr_get_os_error();
           }
  +#endif
       return APR_SUCCESS;
   }
   
  
  
  
  1.61      +7 -3      apr/file_io/win32/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/filestat.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- filestat.c	28 Nov 2001 14:40:26 -0000	1.60
  +++ filestat.c	28 Jan 2002 15:56:08 -0000	1.61
  @@ -476,7 +476,8 @@
       }
   
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT) {
  +    IF_WIN_OS_IS_UNICODE
  +    {
           if (rv = utf8_to_unicode_path(wfname, sizeof(wfname) 
                                               / sizeof(apr_wchar_t), fname))
               return rv;
  @@ -505,8 +506,9 @@
               filename = apr_pstrdup(cont, tmpname);
           }
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
         if ((apr_os_level >= APR_WIN_98) && (!(wanted & APR_FINFO_NAME) || isroot))
       {
           /* cannot use FindFile on a Win98 root, it returns \*
  @@ -550,6 +552,7 @@
           FindClose(hFind);
           filename = apr_pstrdup(cont, FileInfo.n.cFileName);
       }
  +#endif
   
       if (ident_rv != APR_INCOMPLETE) {
           if (fillin_fileinfo(finfo, (WIN32_FILE_ATTRIBUTE_DATA *) &FileInfo, 
  @@ -559,7 +562,8 @@
                * to reliably translate char devices to the path '\\.\device'
                * so go ask for the full path.
                */
  -            if (apr_os_level >= APR_WIN_NT) {
  +            IF_WIN_OS_IS_UNICODE
  +            {
   #if APR_HAS_UNICODE_FS
                   apr_wchar_t tmpname[APR_FILE_MAX];
                   apr_wchar_t *tmpoff;
  
  
  
  1.6       +16 -8     apr/file_io/win32/filesys.c
  
  Index: filesys.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/filesys.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- filesys.c	28 Dec 2001 23:50:48 -0000	1.5
  +++ filesys.c	28 Jan 2002 15:56:08 -0000	1.6
  @@ -120,7 +120,7 @@
   {
       char path[APR_PATH_MAX];
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT)
  +    IF_WIN_OS_IS_UNICODE
       {
           apr_wchar_t *ignored;
           apr_wchar_t wdrive[8];
  @@ -136,8 +136,9 @@
           if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath)))
               return rv;
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           char *ignored;
           char drivestr[4];
  @@ -148,6 +149,7 @@
           if (!GetFullPathName(drivestr, sizeof(path), path, &ignored))
               return apr_get_os_error();
       }
  +#endif
       if (!(flags & APR_FILEPATH_NATIVE)) {
           for (*rootpath = path; **rootpath; ++*rootpath) {
               if (**rootpath == '\\')
  @@ -162,7 +164,7 @@
   apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p)
   {
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT)
  +    IF_WIN_OS_IS_UNICODE
       {
           apr_wchar_t *ignored;
           apr_wchar_t wpath[APR_PATH_MAX];
  @@ -183,8 +185,9 @@
               return rv;
           *rootpath = apr_pstrdup(p, (char*)wroot);
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           char path[APR_PATH_MAX];
           char *ignored;
  @@ -192,6 +195,7 @@
               return apr_get_os_error();
           *rootpath = apr_pstrdup(p, path);
       }
  +#endif
       return APR_SUCCESS;
   }
   
  @@ -201,7 +205,7 @@
   {
       char path[APR_PATH_MAX];
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT)
  +    IF_WIN_OS_IS_UNICODE
       {
           apr_wchar_t wpath[APR_PATH_MAX];
           apr_status_t rv;
  @@ -210,12 +214,14 @@
           if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath)))
               return rv;
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           if (!GetCurrentDirectory(sizeof(path), path))
               return apr_get_os_error();
       }
  +#endif
       if (!(flags & APR_FILEPATH_NATIVE)) {
           for (*rootpath = path; **rootpath; ++*rootpath) {
               if (**rootpath == '\\')
  @@ -231,7 +237,7 @@
                                              apr_pool_t *p)
   {
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT)
  +    IF_WIN_OS_IS_UNICODE
       {
           apr_wchar_t wpath[APR_PATH_MAX];
           apr_status_t rv;
  @@ -241,11 +247,13 @@
           if (!SetCurrentDirectoryW(wpath))
               return apr_get_os_error();
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           if (!SetCurrentDirectory(rootpath))
               return apr_get_os_error();
       }
  +#endif
       return APR_SUCCESS;
   }
  
  
  
  1.91      +18 -9     apr/file_io/win32/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/open.c,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- open.c	9 Jan 2002 22:05:09 -0000	1.90
  +++ open.c	28 Jan 2002 15:56:08 -0000	1.91
  @@ -168,7 +168,8 @@
   void *res_name_from_filename(const char *file, int global, apr_pool_t *pool)
   {
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT) {
  +    IF_WIN_OS_IS_UNICODE
  +    {
           apr_wchar_t *wpre, *wfile, *ch;
           apr_size_t n = strlen(file) + 1;
           apr_size_t r, d;
  @@ -205,8 +206,9 @@
           }
           return wfile;
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           char *nfile, *ch;
           apr_size_t n = strlen(file) + 1;
  @@ -247,6 +249,7 @@
           }
           return nfile;
       }
  +#endif
   }
   
   
  @@ -333,7 +336,8 @@
       }
   
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT) {
  +    IF_WIN_OS_IS_UNICODE
  +    {
           apr_wchar_t wfname[APR_PATH_MAX];
           if (rv = utf8_to_unicode_path(wfname, sizeof(wfname) 
                                                  / sizeof(apr_wchar_t), fname))
  @@ -341,11 +345,12 @@
           handle = CreateFileW(wfname, oflags, sharemode,
                                NULL, createflags, attributes, 0);
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
           handle = CreateFileA(fname, oflags, sharemode,
                                NULL, createflags, attributes, 0);
  -
  +#endif
       if (handle == INVALID_HANDLE_VALUE) {
           return apr_get_os_error();
       }
  @@ -424,7 +429,7 @@
   APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *cont)
   {
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT) 
  +    IF_WIN_OS_IS_UNICODE
       {
           apr_wchar_t wpath[APR_PATH_MAX];
           apr_status_t rv;
  @@ -435,10 +440,12 @@
           if (DeleteFileW(wpath))
               return APR_SUCCESS;
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
           if (DeleteFile(path))
               return APR_SUCCESS;
  +#endif
       return apr_get_os_error();
   }
   
  @@ -446,7 +453,7 @@
                                             const char *topath,
                                             apr_pool_t *cont)
   {
  -    if (apr_os_level >= APR_WIN_NT) 
  +    IF_WIN_OS_IS_UNICODE
       {
   #if APR_HAS_UNICODE_FS
           apr_wchar_t wfrompath[APR_PATH_MAX], wtopath[APR_PATH_MAX];
  @@ -468,7 +475,8 @@
               return APR_SUCCESS;
   #endif
       }
  -    else
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           /* Windows 95 and 98 do not support MoveFileEx, so we'll use
            * the old MoveFile function.  However, MoveFile requires that
  @@ -488,6 +496,7 @@
           if (MoveFile(frompath, topath))
               return APR_SUCCESS;
       }        
  +#endif
       return apr_get_os_error();
   }
   
  
  
  
  1.63      +2 -0      apr/include/arch/win32/fileio.h
  
  Index: fileio.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/win32/fileio.h,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- fileio.h	8 Jan 2002 22:48:25 -0000	1.62
  +++ fileio.h	28 Jan 2002 15:56:08 -0000	1.63
  @@ -225,9 +225,11 @@
               WIN32_FIND_DATAW *entry;
           } w;
   #endif
  +#if APR_HAS_ANSI_FS
           struct {
               WIN32_FIND_DATAA *entry;
           } n;
  +#endif        
       };
   };
   
  
  
  
  1.37      +39 -3     apr/include/arch/win32/misc.h
  
  Index: misc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/win32/misc.h,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- misc.h	30 Dec 2001 20:54:38 -0000	1.36
  +++ misc.h	28 Jan 2002 15:56:08 -0000	1.37
  @@ -112,15 +112,22 @@
           APR_WIN_98 =       14,
           APR_WIN_98_SE =    16,
           APR_WIN_ME =       18,
  -        APR_WIN_NT =       30,
  -        APR_WIN_NT_3_5 =   35,
  +
  +	APR_WIN_UNICODE =  20, /* Prior versions support only narrow chars */
  +
  +        APR_WIN_CE_3 =     23, /* CE is an odd beast, not supporting */
  +                               /* some pre-NT features, such as the    */
  +        APR_WIN_NT =       30, /* narrow charset APIs (fooA fns), while  */
  +        APR_WIN_NT_3_5 =   35, /* not supporting some NT-family features.  */
           APR_WIN_NT_3_51 =  36,
  +
           APR_WIN_NT_4 =     40,
           APR_WIN_NT_4_SP2 = 42,
           APR_WIN_NT_4_SP3 = 43,
           APR_WIN_NT_4_SP4 = 44,
           APR_WIN_NT_4_SP5 = 45,
           APR_WIN_NT_4_SP6 = 46,
  +
           APR_WIN_2000 =     50,
           APR_WIN_2000_SP1 = 51,
           APR_WIN_2000_SP2 = 52,
  @@ -129,6 +136,36 @@
   
   extern apr_oslevel_e apr_os_level;
   
  +apr_status_t apr_get_oslevel(struct apr_pool_t *, apr_oslevel_e *);
  +
  +/* The APR_HAS_ANSI_FS symbol is PRIVATE, and internal to APR.
  + * APR only supports char data for filenames.  Like most applications,
  + * characters >127 are essentially undefined.  APR_HAS_UNICODE_FS lets
  + * the application know that utf-8 is the encoding method of APR, and
  + * only incidently hints that we have Wide OS calls.
  + *
  + * APR_HAS_ANSI_FS is simply an OS flag to tell us all calls must be
  + * the unicode eqivilant.
  + */
  +
  +#if defined(_WIN32_WCE) || defined(WINNT)
  +#define APR_HAS_ANSI_FS           0
  +#else
  +#define APR_HAS_ANSI_FS           1
  +#endif
  +
  +/* IF_WIN_OS_IS_UNICODE / ELSE_WIN_OS_IS_ANSI help us keep the code trivial
  + * where have runtime tests for unicode-ness, that aren't needed in any
  + * build which supports only WINNT or WCE.
  + */
  +#if APR_HAS_ANSI_FS && APR_HAS_UNICODE_FS
  +#define IF_WIN_OS_IS_UNICODE if (apr_os_level >= APR_WIN_UNICODE)
  +#define ELSE_WIN_OS_IS_ANSI else
  +#else APR_HAS_UNICODE_FS
  +#define IF_WIN_OS_IS_UNICODE
  +#define ELSE_WIN_OS_IS_ANSI
  +#endif /* WINNT */
  +
   typedef enum {
       DLL_WINBASEAPI = 0,    // kernel32 From WinBase.h
       DLL_WINADVAPI = 1,     // advapi32 From WinBase.h
  @@ -254,7 +291,6 @@
   	 ppDacl, ppSacl, ppSecurityDescriptor));
   #define GetSecurityInfo apr_winapi_GetSecurityInfo
   
  -apr_status_t apr_get_oslevel(struct apr_pool_t *, apr_oslevel_e *);
   #endif /* WIN32 */
   
   #endif  /* ! MISC_H */
  
  
  
  1.8       +13 -0     apr/misc/win32/misc.c
  
  Index: misc.c
  ===================================================================
  RCS file: /home/cvs/apr/misc/win32/misc.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- misc.c	30 Dec 2001 20:46:22 -0000	1.7
  +++ misc.c	28 Jan 2002 15:56:08 -0000	1.8
  @@ -122,6 +122,7 @@
                   apr_os_level = APR_WIN_XP;
               }
           }
  +#ifndef WINNT
           else if (oslev.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
               char *prevision;
               if (prevision = oslev.szCSDVersion) {
  @@ -147,6 +148,18 @@
                   apr_os_level = APR_WIN_ME;
               }
           }
  +#endif
  +#ifdef _WIN32_WCE
  +        else if (oslev.dwPlatformId == VER_PLATFORM_WIN32_CE) 
  +        {
  +            if (oslev.dwMajorVersion < 3) {
  +                apr_os_level = APR_WIN_UNSUP;
  +            }
  +            else {
  +                apr_os_level = APR_WIN_CE_3;
  +            }
  +        }
  +#endif
           else {
               apr_os_level = APR_WIN_UNSUP;
           }
  
  
  
  1.9       +8 -4      apr/shmem/win32/shm.c
  
  Index: shm.c
  ===================================================================
  RCS file: /home/cvs/apr/shmem/win32/shm.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- shm.c	25 Jan 2002 07:16:01 -0000	1.8
  +++ shm.c	28 Jan 2002 15:56:08 -0000	1.9
  @@ -144,15 +144,17 @@
       }
   
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT) 
  +    IF_WIN_OS_IS_UNICODE
       {
           hMap = CreateFileMappingW(hFile, psec, PAGE_READWRITE, 0, size, mapkey);
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           hMap = CreateFileMappingA(hFile, psec, PAGE_READWRITE, 0, size, mapkey);
       }
  +#endif
       err = apr_get_os_error();
   
       if (file) {
  @@ -214,15 +216,17 @@
       }
   
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT) 
  +    IF_WIN_OS_IS_UNICODE
       {
           hMap = OpenFileMappingW(FILE_MAP_READ | FILE_MAP_WRITE, FALSE, mapkey);
       }
  -    else
   #endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           hMap = OpenFileMappingA(FILE_MAP_READ | FILE_MAP_WRITE, FALSE, mapkey);
       }
  +#endif
   
       if (!hMap) {
           return apr_get_os_error();
  
  
  
  1.61      +10 -4     apr/threadproc/win32/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/proc.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- proc.c	28 Dec 2001 23:50:49 -0000	1.60
  +++ proc.c	28 Jan 2002 15:56:08 -0000	1.61
  @@ -386,7 +386,8 @@
               ++iEnvBlockLen;
   
   #if APR_HAS_UNICODE_FS
  -        if (apr_os_level >= APR_WIN_NT) {
  +        IF_WIN_OS_IS_UNICODE
  +        {
               apr_wchar_t *pNext;
               pEnvBlock = (char *)apr_palloc(cont, iEnvBlockLen * 2);
               dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
  @@ -407,8 +408,9 @@
                   *(pNext++) = L'\0';
   	    *pNext = L'\0';
           }
  -        else 
   #endif /* APR_HAS_UNICODE_FS */
  +#if APR_HAS_ANSI_FS
  +        ELSE_WIN_OS_IS_ANSI
           {
               char *pNext;
               pEnvBlock = (char *)apr_palloc(cont, iEnvBlockLen);
  @@ -424,10 +426,11 @@
                   *(pNext++) = '\0';
   	    *pNext = '\0';
           }
  +#endif /* APR_HAS_ANSI_FS */
       } 
   
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT)
  +    IF_WIN_OS_IS_UNICODE
       {
           STARTUPINFOW si;
           apr_size_t nprg = strlen(progname) + 1;
  @@ -482,8 +485,10 @@
                               wcwd,              /* Current directory name */
                               &si, &pi);
       }
  -    else {
   #endif /* APR_HAS_UNICODE_FS */
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
  +    {
           STARTUPINFOA si;
           memset(&si, 0, sizeof(si));
           si.cb = sizeof(si);
  @@ -512,6 +517,7 @@
                               attr->currdir,     /* Current directory name */
                               &si, &pi);
       }
  +#endif /* APR_HAS_ANSI_FS */
   
       /* Check CreateProcess result 
        */
  
  
  
  1.17      +6 -3      apr/user/win32/userinfo.c
  
  Index: userinfo.c
  ===================================================================
  RCS file: /home/cvs/apr/user/win32/userinfo.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- userinfo.c	28 Dec 2001 23:50:49 -0000	1.16
  +++ userinfo.c	28 Jan 2002 15:56:08 -0000	1.17
  @@ -135,7 +135,8 @@
           return APR_FROM_OS_ERROR(rv);
   
   #if APR_HAS_UNICODE_FS
  -    if (apr_os_level >= APR_WIN_NT) {
  +    IF_WIN_OS_IS_UNICODE
  +    {
   
           keylen = sizeof(regkey);
           rv = RegQueryValueExW(key, L"ProfileImagePath", NULL, &type,
  @@ -162,8 +163,9 @@
           else
               return APR_ENOENT;
       }
  -    else
  -#endif /* APR_HAS_UNICODE_FS */
  +#endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
       {
           keylen = sizeof(regkey);
           rv = RegQueryValueEx(key, "ProfileImagePath", NULL, &type,
  @@ -182,6 +184,7 @@
           else
               return APR_ENOENT;
       }
  +#endif /* APR_HAS_ANSI_FS */
       for (fixch = *dirname; *fixch; ++fixch)
           if (*fixch == '\\')
               *fixch = '/';