diff options
author | Mladen Turk <mturk@apache.org> | 2021-12-02 22:09:53 +0000 |
---|---|---|
committer | Mladen Turk <mturk@apache.org> | 2021-12-02 22:09:53 +0000 |
commit | fd59a4a0747cf5895c21481acb67f1519b11802a (patch) | |
tree | 52e43979463cd86b92971dff2bea3a358168abcf | |
parent | 62285e4db364a86e99699b0a1d13a2f2f3bae49f (diff) | |
download | apr-fd59a4a0747cf5895c21481acb67f1519b11802a.tar.gz |
Stage 3 in cleaning win95 code ... cleanup headers
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895511 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | file_io/win32/filepath.c | 12 | ||||
-rw-r--r-- | include/arch/win32/apr_arch_misc.h | 24 | ||||
-rw-r--r-- | misc/win32/start.c | 95 |
3 files changed, 46 insertions, 85 deletions
diff --git a/file_io/win32/filepath.c b/file_io/win32/filepath.c index 23870bc54..56e69a153 100644 --- a/file_io/win32/filepath.c +++ b/file_io/win32/filepath.c @@ -977,14 +977,6 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p) { -#if APR_HAS_UNICODE_FS - IF_WIN_OS_IS_UNICODE - { - *style = APR_FILEPATH_ENCODING_UTF8; - return APR_SUCCESS; - } -#endif - - *style = APR_FILEPATH_ENCODING_LOCALE; - return APR_SUCCESS; + *style = APR_FILEPATH_ENCODING_UTF8; + return APR_SUCCESS; } diff --git a/include/arch/win32/apr_arch_misc.h b/include/arch/win32/apr_arch_misc.h index fe42ec49b..057f4adfa 100644 --- a/include/arch/win32/apr_arch_misc.h +++ b/include/arch/win32/apr_arch_misc.h @@ -118,30 +118,6 @@ extern APR_DECLARE_DATA apr_oslevel_e apr_os_level; apr_status_t apr_get_oslevel(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. - */ - -#define APR_HAS_ANSI_FS 0 - -/* 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 /* APR_HAS_ANSI_FS && APR_HAS_UNICODE_FS */ - #if defined(_MSC_VER) #include "crtdbg.h" diff --git a/misc/win32/start.c b/misc/win32/start.c index 1def000ae..c60a650fe 100644 --- a/misc/win32/start.c +++ b/misc/win32/start.c @@ -98,63 +98,56 @@ APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, const char * const * *argv, const char * const * *env) { + apr_wchar_t **wstrs; + apr_wchar_t *sysstr; + int wstrc; + int dupenv; apr_status_t rv = apr_initialize(); if (rv != APR_SUCCESS) { return rv; } -#if APR_HAS_UNICODE_FS - IF_WIN_OS_IS_UNICODE - { - apr_wchar_t **wstrs; - apr_wchar_t *sysstr; - int wstrc; - int dupenv; - - if (apr_app_init_complete) { - return rv; - } - - apr_app_init_complete = 1; - - sysstr = GetCommandLineW(); - if (sysstr) { - wstrs = apr_winapi_CommandLineToArgvW(sysstr, &wstrc); - if (wstrs) { - *argc = apr_wastrtoastr(argv, wstrs, wstrc); - LocalFree(wstrs); - } - } - - sysstr = GetEnvironmentStringsW(); - dupenv = warrsztoastr(&_environ, sysstr); - - if (env) { - *env = apr_malloc_dbg((dupenv + 1) * sizeof (char *), - __FILE__, __LINE__ ); - memcpy((void*)*env, _environ, (dupenv + 1) * sizeof (char *)); - } - else { - } - - FreeEnvironmentStringsW(sysstr); - - /* MSVCRT will attempt to maintain the wide environment calls - * on _putenv(), which is bogus if we've passed a non-ascii - * string to _putenv(), since they use MultiByteToWideChar - * and breaking the implicit utf-8 assumption we've built. - * - * Reset _wenviron for good measure. - */ - if (_wenviron) { - apr_wchar_t **wenv = _wenviron; - _wenviron = NULL; - free(wenv); - } - - } -#endif + if (apr_app_init_complete) { + return rv; + } + + apr_app_init_complete = 1; + + sysstr = GetCommandLineW(); + if (sysstr) { + wstrs = apr_winapi_CommandLineToArgvW(sysstr, &wstrc); + if (wstrs) { + *argc = apr_wastrtoastr(argv, wstrs, wstrc); + LocalFree(wstrs); + } + } + + sysstr = GetEnvironmentStringsW(); + dupenv = warrsztoastr(&_environ, sysstr); + + if (env) { + *env = apr_malloc_dbg((dupenv + 1) * sizeof (char *), + __FILE__, __LINE__ ); + memcpy((void*)*env, _environ, (dupenv + 1) * sizeof (char *)); + } + else { + } + + FreeEnvironmentStringsW(sysstr); + + /* MSVCRT will attempt to maintain the wide environment calls + * on _putenv(), which is bogus if we've passed a non-ascii + * string to _putenv(), since they use MultiByteToWideChar + * and breaking the implicit utf-8 assumption we've built. + * + * Reset _wenviron for good measure. + */ + if (_wenviron) { + apr_wchar_t **wenv = _wenviron; + _wenviron = NULL; + free(wenv); + } return rv; } |