diff options
author | mturk <mturk@13f79535-47bb-0310-9956-ffa450edef68> | 2021-12-02 23:58:46 +0000 |
---|---|---|
committer | mturk <mturk@13f79535-47bb-0310-9956-ffa450edef68> | 2021-12-02 23:58:46 +0000 |
commit | d6ed209050f42ba909df783b591d8490f411f907 (patch) | |
tree | 228b042e0a4f04ea0417cca6a7d529b35eeab23a | |
parent | 7b5409010af104a97c2767b8ce81d779b7c0e93c (diff) | |
download | libapr-d6ed209050f42ba909df783b591d8490f411f907.tar.gz |
TAB police ... get rid of missmatch of TAB and spaces through the code
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895517 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | misc/win32/env.c | 102 | ||||
-rw-r--r-- | misc/win32/start.c | 88 |
2 files changed, 95 insertions, 95 deletions
diff --git a/misc/win32/env.c b/misc/win32/env.c index 5838feaac..629cd5488 100644 --- a/misc/win32/env.c +++ b/misc/win32/env.c @@ -46,36 +46,36 @@ APR_DECLARE(apr_status_t) apr_env_get(char **value, { char *val = NULL; DWORD size; - apr_wchar_t wenvvar[APR_PATH_MAX]; - apr_size_t inchars, outchars; - apr_wchar_t *wvalue, dummy; - apr_status_t status; - - status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar); - if (status) - return status; - - SetLastError(0); - size = GetEnvironmentVariableW(wenvvar, &dummy, 0); - if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) - /* The environment variable doesn't exist. */ - return APR_ENOENT; - - if (size == 0) { - /* The environment value exists, but is zero-length. */ - *value = apr_pstrdup(pool, ""); - return APR_SUCCESS; - } - - wvalue = apr_palloc(pool, size * sizeof(*wvalue)); - size = GetEnvironmentVariableW(wenvvar, wvalue, size); - - inchars = wcslen(wvalue) + 1; - outchars = 3 * inchars; /* Enough for any UTF-8 representation */ - val = apr_palloc(pool, outchars); - status = apr_conv_utf16_to_utf8(wvalue, &inchars, val, &outchars); - if (status) - return status; + apr_wchar_t wenvvar[APR_PATH_MAX]; + apr_size_t inchars, outchars; + apr_wchar_t *wvalue, dummy; + apr_status_t status; + + status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar); + if (status) + return status; + + SetLastError(0); + size = GetEnvironmentVariableW(wenvvar, &dummy, 0); + if (GetLastError() == ERROR_ENVVAR_NOT_FOUND) + /* The environment variable doesn't exist. */ + return APR_ENOENT; + + if (size == 0) { + /* The environment value exists, but is zero-length. */ + *value = apr_pstrdup(pool, ""); + return APR_SUCCESS; + } + + wvalue = apr_palloc(pool, size * sizeof(*wvalue)); + size = GetEnvironmentVariableW(wenvvar, wvalue, size); + + inchars = wcslen(wvalue) + 1; + outchars = 3 * inchars; /* Enough for any UTF-8 representation */ + val = apr_palloc(pool, outchars); + status = apr_conv_utf16_to_utf8(wvalue, &inchars, val, &outchars); + if (status) + return status; *value = val; return APR_SUCCESS; @@ -86,23 +86,23 @@ APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, const char *value, apr_pool_t *pool) { - apr_wchar_t wenvvar[APR_PATH_MAX]; - apr_wchar_t *wvalue; - apr_size_t inchars, outchars; - apr_status_t status; + apr_wchar_t wenvvar[APR_PATH_MAX]; + apr_wchar_t *wvalue; + apr_size_t inchars, outchars; + apr_status_t status; - status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar); - if (status) - return status; + status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar); + if (status) + return status; - outchars = inchars = strlen(value) + 1; - wvalue = apr_palloc(pool, outchars * sizeof(*wvalue)); - status = apr_conv_utf8_to_utf16(value, &inchars, wvalue, &outchars); - if (status) - return status; + outchars = inchars = strlen(value) + 1; + wvalue = apr_palloc(pool, outchars * sizeof(*wvalue)); + status = apr_conv_utf8_to_utf16(value, &inchars, wvalue, &outchars); + if (status) + return status; - if (!SetEnvironmentVariableW(wenvvar, wvalue)) - return apr_get_os_error(); + if (!SetEnvironmentVariableW(wenvvar, wvalue)) + return apr_get_os_error(); return APR_SUCCESS; } @@ -110,15 +110,15 @@ APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, APR_DECLARE(apr_status_t) apr_env_delete(const char *envvar, apr_pool_t *pool) { - apr_wchar_t wenvvar[APR_PATH_MAX]; - apr_status_t status; + apr_wchar_t wenvvar[APR_PATH_MAX]; + apr_status_t status; - status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar); - if (status) - return status; + status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar); + if (status) + return status; - if (!SetEnvironmentVariableW(wenvvar, NULL)) - return apr_get_os_error(); + if (!SetEnvironmentVariableW(wenvvar, NULL)) + return apr_get_os_error(); return APR_SUCCESS; } diff --git a/misc/win32/start.c b/misc/win32/start.c index c60a650fe..2524707c2 100644 --- a/misc/win32/start.c +++ b/misc/win32/start.c @@ -98,56 +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_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_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); - } + 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; } |